summaryrefslogtreecommitdiff
path: root/ASNMP
diff options
context:
space:
mode:
authorOssama Othman <ossama-othman@users.noreply.github.com>2004-04-23 03:46:55 +0000
committerOssama Othman <ossama-othman@users.noreply.github.com>2004-04-23 03:46:55 +0000
commit58ed38c9b346078e6e0b9151291f3623f206c2e0 (patch)
tree7cedc3a21fdfd8db410444287e8dc0dcea162e4a /ASNMP
parentddd3fdc0fe56295a0d8b679452f44ebb0c6a850e (diff)
downloadATCD-58ed38c9b346078e6e0b9151291f3623f206c2e0.tar.gz
ChangeLogTag:Thu Apr 22 20:45:27 2004 Ossama Othman <ossama@dre.vanderbilt.edu>
Diffstat (limited to 'ASNMP')
-rw-r--r--ASNMP/ChangeLog18
-rw-r--r--ASNMP/asnmp/address.cpp72
-rw-r--r--ASNMP/asnmp/address.h28
-rw-r--r--ASNMP/asnmp/octet.cpp72
-rw-r--r--ASNMP/asnmp/octet.h28
-rw-r--r--ASNMP/asnmp/oid.cpp38
-rw-r--r--ASNMP/asnmp/oid.h16
-rw-r--r--ASNMP/asnmp/target.cpp26
-rw-r--r--ASNMP/asnmp/target.h8
-rw-r--r--ASNMP/asnmp/vb.cpp20
-rw-r--r--ASNMP/asnmp/vb.h7
-rw-r--r--ASNMP/tests/Octet_Test.cpp24
-rw-r--r--ASNMP/tests/Oid_Test.cpp12
13 files changed, 199 insertions, 170 deletions
diff --git a/ASNMP/ChangeLog b/ASNMP/ChangeLog
index efa64b7e485..b4cbb3d0e81 100644
--- a/ASNMP/ChangeLog
+++ b/ASNMP/ChangeLog
@@ -1,3 +1,21 @@
+Thu Apr 22 20:45:27 2004 Ossama Othman <ossama@dre.vanderbilt.edu>
+
+ * ASNMP/asnmp/address.cpp:
+ * ASNMP/asnmp/address.h:
+ * ASNMP/asnmp/octet.cpp:
+ * ASNMP/asnmp/octet.h:
+ * ASNMP/asnmp/oid.cpp:
+ * ASNMP/asnmp/oid.h:
+ * ASNMP/asnmp/target.cpp:
+ * ASNMP/asnmp/target.h:
+ * ASNMP/asnmp/vb.cpp:
+ * ASNMP/asnmp/vb.h:
+ * ASNMP/tests/Octet_Test.cpp:
+ * ASNMP/tests/Oid_Test.cpp:
+
+ Changed all return types for equality, relational and logical
+ operators to "bool", as is the norm for modern C++.
+
Fri Apr 16 16:53:20 2004 Ossama Othman <ossama@dre.vanderbilt.edu>
* tests/Gauge_Test.cpp (TestGuage):
diff --git a/ASNMP/asnmp/address.cpp b/ASNMP/asnmp/address.cpp
index 72a910ddb07..d5a72aad750 100644
--- a/ASNMP/asnmp/address.cpp
+++ b/ASNMP/asnmp/address.cpp
@@ -93,17 +93,17 @@ unsigned char& Address::operator[]( const int position)
//-----------------------------------------------------------------------
// overloaded equivlence operator, are two addresses equal?
-int operator==( const Address &lhs, const Address &rhs)
+bool operator==( const Address &lhs, const Address &rhs)
{
if ( ACE_OS::strcmp( (const char*) lhs, (const char*)rhs)==0)
- return 1;
+ return true;
else
- return 0;
+ return false;
}
//-----------------------------------------------------------------------
// overloaded equivlence operator, are two addresses equal?
-int operator!=( const Address &lhs, const Address &rhs)
+bool operator!=( const Address &lhs, const Address &rhs)
{
return (!( lhs == rhs));
}
@@ -111,109 +111,109 @@ int operator!=( const Address &lhs, const Address &rhs)
//------------------------------------------------------------------
// overloaded > operator, is a1 > a2
-int operator>( const Address &lhs, const Address &rhs)
+bool operator>( const Address &lhs, const Address &rhs)
{
if (ACE_OS::strcmp( (const char*) lhs, (const char*)rhs)>0)
- return 1;
+ return true;
else
- return 0;
+ return false;
}
// overloaded >= operator, is a1 > a2
-int operator>=( const Address &lhs,const Address &rhs)
+bool operator>=( const Address &lhs,const Address &rhs)
{
if (( lhs > rhs) || ( lhs == rhs))
- return 1;
+ return true;
else
- return 0;
+ return false;
}
// overloaded < operator, is a1 <= a2
-int operator<=( const Address &lhs,const Address &rhs)
+bool operator<=( const Address &lhs,const Address &rhs)
{
if (( lhs < rhs) || ( lhs == rhs))
- return 1;
+ return true;
else
- return 0;
+ return false;
}
//-----------------------------------------------------------------
// overloaded < operator, is a1 < a2
-int operator<( const Address &lhs, const Address &rhs)
+bool operator<( const Address &lhs, const Address &rhs)
{
if (ACE_OS::strcmp( (const char*) lhs, (const char*)rhs)<0)
- return 1;
+ return true;
else
- return 0;
+ return false;
}
//------------------------------------------------------------------
// equivlence operator overloaded, are an address and a string equal?
-int operator==( const Address &lhs,const char *rhs)
+bool operator==( const Address &lhs,const char *rhs)
{
if (!rhs && !lhs.valid())
- return 1;
+ return true;
if (ACE_OS::strcmp( (const char *) lhs, rhs)== 0)
- return 1;
+ return true;
else
- return 0;
+ return false;
}
//------------------------------------------------------------------
// not equal operator overloaded, are an address and a string not equal?
-int operator!=( const Address &lhs,const char *rhs)
+bool operator!=( const Address &lhs,const char *rhs)
{
return (!( lhs == rhs));
}
//------------------------------------------------------------------
// overloaded > , is a > inaddr
-int operator>( const Address &lhs,const char *rhs)
+bool operator>( const Address &lhs,const char *rhs)
{
if (!rhs)
return lhs.valid(); // if lhs valid then > 0, else invalid !> 0
if (ACE_OS::strcmp( (const char *) lhs, rhs)> 0)
- return 1;
+ return true;
else
- return 0;
+ return false;
}
//------------------------------------------------------------------
// overloaded >= , is a >= inaddr
-int operator>=( const Address &lhs,const char *rhs)
+bool operator>=( const Address &lhs,const char *rhs)
{
if (!rhs)
- return 1; // always >= 0
+ return true; // always >= 0
if (ACE_OS::strcmp( (const char *) lhs, rhs)>= 0)
- return 1;
+ return true;
else
- return 0;
+ return false;
}
//-----------------------------------------------------------------
// overloaded < , are an address and a string equal?
-int operator<( const Address &lhs,const char *rhs)
+bool operator<( const Address &lhs,const char *rhs)
{
if (!rhs)
- return 0; // always >= 0
+ return false; // always >= 0
if (ACE_OS::strcmp( (const char *) lhs, rhs)< 0)
- return 1;
+ return true;
else
- return 0;
+ return false;
}
//-----------------------------------------------------------------
// overloaded <= , is a <= inaddr
-int operator<=( const Address &lhs,const char *rhs)
+bool operator<=( const Address &lhs,const char *rhs)
{
if (!rhs)
return !lhs.valid(); // invalid == 0, else valid > 0
- if (ACE_OS::strcmp( (const char *) lhs, rhs)<= 0)
- return 1;
+ if (ACE_OS::strcmp( (const char *) lhs, rhs) <= 0)
+ return true;
else
- return 0;
+ return false;
}
diff --git a/ASNMP/asnmp/address.h b/ASNMP/asnmp/address.h
index 6a0f9823feb..1db8adbbd6e 100644
--- a/ASNMP/asnmp/address.h
+++ b/ASNMP/asnmp/address.h
@@ -1,5 +1,7 @@
-/* -*-C++-*- */
+// -*-C++-*-
+
// $Id$
+
#ifndef ADDRESS_
#define ADDRESS_
// ============================================================================
@@ -110,40 +112,40 @@ public:
virtual ~Address();
// allow destruction of derived classes
- friend ASNMP_Export int operator==( const Address &lhs,const Address &rhs);
+ friend ASNMP_Export bool operator==( const Address &lhs,const Address &rhs);
// overloaded equivlence operator, are two addresses equal?
- friend ASNMP_Export int operator!=( const Address &lhs,const Address &rhs);
+ friend ASNMP_Export bool operator!=( const Address &lhs,const Address &rhs);
// overloaded not equivlence operator, are two addresses not equal?
- friend ASNMP_Export int operator>( const Address &lhs,const Address &rhs);
+ friend ASNMP_Export bool operator>( const Address &lhs,const Address &rhs);
// overloaded > operator, is a1 > a2
- friend ASNMP_Export int operator>=( const Address &lhs,const Address &rhs);
+ friend ASNMP_Export bool operator>=( const Address &lhs,const Address &rhs);
// overloaded >= operator, is a1 >= a2
- friend ASNMP_Export int operator<( const Address &lhs,const Address &rhs);
+ friend ASNMP_Export bool operator<( const Address &lhs,const Address &rhs);
// overloaded < operator, is a1 < a2
- friend ASNMP_Export int operator<=( const Address &lhs,const Address &rhs);
+ friend ASNMP_Export bool operator<=( const Address &lhs,const Address &rhs);
// overloaded <= operator, is a1 <= a2
- friend ASNMP_Export int operator==( const Address &lhs,const char *rhs);
+ friend ASNMP_Export bool operator==( const Address &lhs,const char *rhs);
// equivlence operator overloaded, are an address and a string equal?
- friend ASNMP_Export int operator!=( const Address &lhs,const char *rhs);
+ friend ASNMP_Export bool operator!=( const Address &lhs,const char *rhs);
// overloaded not equivlence operator, are an address and string not equal?
- friend ASNMP_Export int operator>( const Address &lhs,const char *rhs);
+ friend ASNMP_Export bool operator>( const Address &lhs,const char *rhs);
// overloaded < , is an address greater than a string?
- friend ASNMP_Export int operator>=( const Address &lhs,const char *rhs);
+ friend ASNMP_Export bool operator>=( const Address &lhs,const char *rhs);
// overloaded >=, is an address greater than or equal to a string?
- friend ASNMP_Export int operator<( const Address &lhs,const char *rhs);
+ friend ASNMP_Export bool operator<( const Address &lhs,const char *rhs);
// overloaded < , is an address less than a string?
- friend ASNMP_Export int operator<=( const Address &lhs,const char *rhs);
+ friend ASNMP_Export bool operator<=( const Address &lhs,const char *rhs);
// overloaded <=, is an address less than or equal to a string?
virtual operator const char *() const = 0;
diff --git a/ASNMP/asnmp/octet.cpp b/ASNMP/asnmp/octet.cpp
index 7c9db8ca405..1da1aecaca0 100644
--- a/ASNMP/asnmp/octet.cpp
+++ b/ASNMP/asnmp/octet.cpp
@@ -204,121 +204,121 @@ OctetStr& OctetStr::operator=( const OctetStr &octet)
}
//==============[ equivlence operator overloaded ]====================
-int operator==( const OctetStr &lhs, const OctetStr &rhs)
+bool operator==( const OctetStr &lhs, const OctetStr &rhs)
{
if( lhs.left_comparison( rhs.smival.value.string.len, rhs)==0)
- return 1;
+ return true;
else
- return 0;
+ return false;
}
//==============[ not equivlence operator overloaded ]================
-int operator!=( const OctetStr &lhs, const OctetStr &rhs)
+bool operator!=( const OctetStr &lhs, const OctetStr &rhs)
{
if( lhs.left_comparison( rhs.smival.value.string.len, rhs)!=0)
- return 1;
+ return true;
else
- return 0;
+ return false;
}
//==============[ less than < overloaded ]============================
-int operator<( const OctetStr &lhs, const OctetStr &rhs)
+bool operator<( const OctetStr &lhs, const OctetStr &rhs)
{
if( lhs.left_comparison( rhs.smival.value.string.len, rhs)<0)
- return 1;
+ return true;
else
- return 0;
+ return false;
}
//==============[ less than <= overloaded ]===========================
-int operator<=( const OctetStr &lhs, const OctetStr &rhs)
+bool operator<=( const OctetStr &lhs, const OctetStr &rhs)
{
if(( lhs.left_comparison( rhs.smival.value.string.len, rhs)<0) ||
( lhs.left_comparison( rhs.smival.value.string.len, rhs)==0))
- return 1;
+ return true;
else
- return 0;
+ return false;
}
//===============[ greater than > overloaded ]========================
-int operator>( const OctetStr &lhs, const OctetStr &rhs)
+bool operator>( const OctetStr &lhs, const OctetStr &rhs)
{
if( lhs.left_comparison( rhs.smival.value.string.len, rhs)>0)
- return 1;
+ return true;
else
- return 0;
+ return false;
}
//===============[ greater than >= overloaded ]=======================
-int operator>=( const OctetStr &lhs, const OctetStr &rhs)
+bool operator>=( const OctetStr &lhs, const OctetStr &rhs)
{
if(( lhs.left_comparison( rhs.smival.value.string.len, rhs)>0) ||
( lhs.left_comparison( rhs.smival.value.string.len, rhs)==0))
- return 1;
+ return true;
else
- return 0;
+ return false;
}
//===============[ equivlence operator overloaded ]===================
-int operator==( const OctetStr &lhs,const char *rhs)
+bool operator==( const OctetStr &lhs,const char *rhs)
{
OctetStr to( rhs);
if( lhs.left_comparison( to.smival.value.string.len,to)==0)
- return 1;
+ return true;
else
- return 0;
+ return false;
}
//===============[ not equivlence operator overloaded ]===============
-int operator!=( const OctetStr &lhs,const char *rhs)
+bool operator!=( const OctetStr &lhs,const char *rhs)
{
OctetStr to( rhs);
if ( lhs.left_comparison( to.smival.value.string.len,to)!=0)
- return 1;
+ return true;
else
- return 0;
+ return false;
}
//===============[ less than < operator overloaded ]==================
-int operator<( const OctetStr &lhs,const char *rhs)
+bool operator<( const OctetStr &lhs,const char *rhs)
{
OctetStr to( rhs);
if ( lhs.left_comparison( to.smival.value.string.len,to)<0)
- return 1;
+ return true;
else
- return 0;
+ return false;
}
//===============[ less than <= operator overloaded ]=================
-int operator<=( const OctetStr &lhs,char *rhs)
+bool operator<=( const OctetStr &lhs,char *rhs)
{
OctetStr to( rhs);
if (( lhs.left_comparison( to.smival.value.string.len,to)<0) ||
( lhs.left_comparison( to.smival.value.string.len,to)==0))
- return 1;
+ return true;
else
- return 0;
+ return false;
}
//===============[ greater than > operator overloaded ]===============
-int operator>( const OctetStr &lhs,const char *rhs)
+bool operator>( const OctetStr &lhs,const char *rhs)
{
OctetStr to( rhs);
if ( lhs.left_comparison( to.smival.value.string.len,to)>0)
- return 1;
+ return true;
else
- return 0;
+ return false;
}
//===============[ greater than >= operator overloaded ]==============
-int operator>=( const OctetStr &lhs,const char *rhs)
+bool operator>=( const OctetStr &lhs,const char *rhs)
{
OctetStr to( rhs);
if (( lhs.left_comparison( to.smival.value.string.len,to)>0) ||
( lhs.left_comparison( to.smival.value.string.len,to)==0))
- return 1;
+ return true;
else
- return 0;
+ return false;
}
//===============[ append operator, appends a string ]================
diff --git a/ASNMP/asnmp/octet.h b/ASNMP/asnmp/octet.h
index 7070771ab61..bb0a68432d1 100644
--- a/ASNMP/asnmp/octet.h
+++ b/ASNMP/asnmp/octet.h
@@ -1,5 +1,7 @@
-/* -*-C++-*- */
+// -*-C++-*-
+
// $Id$
+
#ifndef OCTET_CLS_
#define OCTET_CLS_
// ============================================================================
@@ -66,40 +68,40 @@ public:
OctetStr& operator=( const OctetStr &octet);
// assignment to another oid object overloaded
- friend ASNMP_Export int operator==( const OctetStr &lhs, const OctetStr &rhs);
+ friend ASNMP_Export bool operator==( const OctetStr &lhs, const OctetStr &rhs);
// equivlence operator overloaded
- friend ASNMP_Export int operator!=( const OctetStr &lhs, const OctetStr &rhs);
+ friend ASNMP_Export bool operator!=( const OctetStr &lhs, const OctetStr &rhs);
// not equivlence operator overloaded
- friend ASNMP_Export int operator<( const OctetStr &lhs, const OctetStr &rhs);
+ friend ASNMP_Export bool operator<( const OctetStr &lhs, const OctetStr &rhs);
// less than < overloaded
- friend ASNMP_Export int operator<=( const OctetStr &lhs,const OctetStr &rhs);
+ friend ASNMP_Export bool operator<=( const OctetStr &lhs,const OctetStr &rhs);
// less than <= overloaded
- friend ASNMP_Export int operator>( const OctetStr &lhs, const OctetStr &rhs);
+ friend ASNMP_Export bool operator>( const OctetStr &lhs, const OctetStr &rhs);
// greater than > overloaded
- friend ASNMP_Export int operator>=( const OctetStr &lhs, const OctetStr &rhs);
+ friend ASNMP_Export bool operator>=( const OctetStr &lhs, const OctetStr &rhs);
// greater than >= overloaded
- friend ASNMP_Export int operator==( const OctetStr &lhs,const char *rhs);
+ friend ASNMP_Export bool operator==( const OctetStr &lhs,const char *rhs);
// equivlence operator overloaded
- friend ASNMP_Export int operator!=( const OctetStr &lhs,const char *rhs);
+ friend ASNMP_Export bool operator!=( const OctetStr &lhs,const char *rhs);
// not equivlence operator overloaded
- friend ASNMP_Export int operator<( const OctetStr &lhs,const char *rhs);
+ friend ASNMP_Export bool operator<( const OctetStr &lhs,const char *rhs);
// less than < operator overloaded
- friend ASNMP_Export int operator<=( const OctetStr &lhs,char *rhs);
+ friend ASNMP_Export bool operator<=( const OctetStr &lhs,char *rhs);
// less than <= operator overloaded
- friend ASNMP_Export int operator>( const OctetStr &lhs,const char *rhs);
+ friend ASNMP_Export bool operator>( const OctetStr &lhs,const char *rhs);
// greater than > operator overloaded
- friend ASNMP_Export int operator>=( const OctetStr &lhs,const char *rhs);
+ friend ASNMP_Export bool operator>=( const OctetStr &lhs,const char *rhs);
// greater than >= operator overloaded
OctetStr& operator+=( const char *a);
diff --git a/ASNMP/asnmp/oid.cpp b/ASNMP/asnmp/oid.cpp
index 71c5caa8835..ffbcda7aa23 100644
--- a/ASNMP/asnmp/oid.cpp
+++ b/ASNMP/asnmp/oid.cpp
@@ -270,76 +270,76 @@ Oid& Oid::operator+=( const char *a)
//=============[ int operator == oid,oid ]=================================
// equivlence operator overloaded
-int operator==( const Oid &lhs, const Oid &rhs)
+bool operator==( const Oid &lhs, const Oid &rhs)
{
// ensure same len, then use left_comparison
if (rhs.length() != lhs.length())
- return 0;
+ return false;
if( lhs.left_comparison( rhs.length(), rhs) == 0)
- return 1;
+ return true;
else
- return 0;
+ return false;
}
//==============[ operator!=( Oid &x,Oid &y) ]=============================
//not equivlence operator overloaded
-int operator!=( const Oid &lhs,const Oid &rhs)
+bool operator!=( const Oid &lhs,const Oid &rhs)
{
return (!(lhs == rhs));
}
//==============[ operator<( Oid &x,Oid &y) ]=============================
// less than < overloaded
-int operator<( const Oid &lhs,const Oid &rhs)
+bool operator<( const Oid &lhs,const Oid &rhs)
{
int result;
// call left_comparison with the current
// Oidx, Oidy and len of Oidx
if ((result = lhs.left_comparison( rhs.length(), rhs)) < 0)
- return 1;
+ return true;
else if (result > 0)
- return 0;
+ return false;
else{
// if here, equivalent substrings, call the shorter one <
if (lhs.length() < rhs.length())
- return 1;
+ return true;
else
- return 0;
+ return false;
}
}
//==============[ operator<=( Oid &x,Oid &y) ]=============================
// less than <= overloaded
-int operator<=( const Oid &x,const Oid &y)
+bool operator<=( const Oid &x,const Oid &y)
{
if ( (x < y) || (x == y) )
- return 1;
+ return true;
else
- return 0;
+ return false;
}
//==============[ operator>( Oid &x,Oid &y) ]=============================
// greater than > overloaded
-int operator>( const Oid &x,const Oid &y)
+bool operator>( const Oid &x,const Oid &y)
{
// just invert existing <=
if (!(x<=y))
- return 1;
+ return true;
else
- return 0;
+ return false;
}
//==============[ operator>=( Oid &x,Oid &y) ]=============================
// greater than >= overloaded
-int operator>=( const Oid &x,const Oid &y)
+bool operator>=( const Oid &x,const Oid &y)
{
// just invert existing <
if (!(x<y))
- return 1;
+ return true;
else
- return 0;
+ return false;
}
//===============[Oid::oidval ]=============================================
diff --git a/ASNMP/asnmp/oid.h b/ASNMP/asnmp/oid.h
index d1f51fd4905..fd198c04073 100644
--- a/ASNMP/asnmp/oid.h
+++ b/ASNMP/asnmp/oid.h
@@ -1,5 +1,7 @@
-/* -*-C++-*- */
+// -*-C++-*-
+
// $Id$
+
#ifndef OID_CLS_
#define OID_CLS_
// ============================================================================
@@ -70,22 +72,22 @@ public:
Oid& operator=( const Oid &oid);
// assignment to another oid object overloaded
- friend ASNMP_Export int operator==( const Oid &lhs,const Oid &rhs);
+ friend ASNMP_Export bool operator==( const Oid &lhs,const Oid &rhs);
// equal operator overloaded
- friend ASNMP_Export int operator!=( const Oid &lhs,const Oid &rhs);
+ friend ASNMP_Export bool operator!=( const Oid &lhs,const Oid &rhs);
// not equal operator overloaded
- friend ASNMP_Export int operator<( const Oid &lhs,const Oid &rhs);
+ friend ASNMP_Export bool operator<( const Oid &lhs,const Oid &rhs);
// less than < overloaded
- friend ASNMP_Export int operator<=( const Oid &lhs,const Oid &rhs);
+ friend ASNMP_Export bool operator<=( const Oid &lhs,const Oid &rhs);
// less than <= overloaded
- friend ASNMP_Export int operator>( const Oid &lhs,const Oid &rhs);
+ friend ASNMP_Export bool operator>( const Oid &lhs,const Oid &rhs);
// greater than > overloaded
- friend ASNMP_Export int operator>=( const Oid &lhs,const Oid &rhs);
+ friend ASNMP_Export bool operator>=( const Oid &lhs,const Oid &rhs);
// greater than >= overloaded
Oid& operator+=( const char *a);
diff --git a/ASNMP/asnmp/target.cpp b/ASNMP/asnmp/target.cpp
index d6f8de6151f..7c93a9275f9 100644
--- a/ASNMP/asnmp/target.cpp
+++ b/ASNMP/asnmp/target.cpp
@@ -157,21 +157,21 @@ SnmpTarget& SnmpTarget::operator=(const SnmpTarget& lhs)
return *this;
}
-int operator==(const SnmpTarget& lhs, const SnmpTarget& rhs)
+bool operator==(const SnmpTarget& lhs, const SnmpTarget& rhs)
{
if (lhs.timeout_ != rhs.timeout_)
- return 0;
+ return false;
if (lhs.retries_ != rhs.retries_)
- return 0;
+ return false;
if (lhs.max_pdu_size_ != rhs.max_pdu_size_)
- return 0;
+ return false;
if (lhs.version_ != rhs.version_)
- return 0;
+ return false;
- return 1;
+ return true;
}
@@ -299,23 +299,23 @@ ver: %d, timeout: %d, retries: %d max_pdu_size: %d]",
//=============[ int operator == UdpTarget, UdpTarget ]===============
// equivlence operator overloaded
-int operator==( const UdpTarget &lhs,const UdpTarget &rhs)
+bool operator==( const UdpTarget &lhs,const UdpTarget &rhs)
{
// need to compare all the members of a UdpTarget
if ( lhs.read_community_ != rhs.read_community_)
- return 0; // !=
+ return false; // !=
if ( lhs.write_community_ != rhs.write_community_)
- return 0; // !=
+ return false; // !=
if ( lhs.udp_address_ != rhs.udp_address_)
- return 0;
+ return false;
if ( lhs.timeout_ != rhs.timeout_)
- return 0;
+ return false;
if ( lhs.retries_ != rhs.retries_)
- return 0;
+ return false;
- return 1; // they are equal
+ return true; // they are equal
}
diff --git a/ASNMP/asnmp/target.h b/ASNMP/asnmp/target.h
index 64142f61651..1a42cb75b37 100644
--- a/ASNMP/asnmp/target.h
+++ b/ASNMP/asnmp/target.h
@@ -1,5 +1,7 @@
-/* -*-C++-*- */
+// -*-C++-*-
+
// $Id$
+
#ifndef TARGET_
#define TARGET_
// ============================================================================
@@ -132,7 +134,7 @@ class ASNMP_Export SnmpTarget
// SnmpTarget. The caller MUST use the delete operation on the return
// value when done.
- friend int operator==(const SnmpTarget& lhs, const SnmpTarget& rhs);
+ friend bool operator==(const SnmpTarget& lhs, const SnmpTarget& rhs);
// manipulate the base part
SnmpTarget& operator=(const SnmpTarget& lhs);
@@ -227,7 +229,7 @@ class ASNMP_Export UdpTarget: public SnmpTarget
UdpTarget& operator=( const UdpTarget& target);
// overloaded assignment
- friend int operator==( const UdpTarget &lhs, const UdpTarget &rhs);
+ friend bool operator==( const UdpTarget &lhs, const UdpTarget &rhs);
// compare two C targets
const char *to_string();
diff --git a/ASNMP/asnmp/vb.cpp b/ASNMP/asnmp/vb.cpp
index ee80d7e68ec..4e94b5e81b9 100644
--- a/ASNMP/asnmp/vb.cpp
+++ b/ASNMP/asnmp/vb.cpp
@@ -382,16 +382,18 @@ void set_exception_status( Vb *vb, const SmiUINT32 status)
// equivlence operator overloaded
// hack, by side effect, compare based on string formatting output_
-int operator==( const Vb &lhs, const Vb &rhs)
+bool operator==( const Vb &lhs, const Vb &rhs)
{
if ( lhs.iv_vb_oid_ != rhs.iv_vb_oid_)
- return 0;
-
- if (lhs.iv_vb_value_ != 0 && rhs.iv_vb_value_ != 0) {
- int val = ACE_OS::strcmp(lhs.iv_vb_value_->to_string(),
- rhs.iv_vb_value_->to_string());
- return !val;
- }
+ return false;
+
+ if (lhs.iv_vb_value_ != 0 && rhs.iv_vb_value_ != 0)
+ {
+ const int val =
+ ACE_OS::strcmp (lhs.iv_vb_value_->to_string(),
+ rhs.iv_vb_value_->to_string());
+ return !val;
+ }
else
- return 0;
+ return false;
}
diff --git a/ASNMP/asnmp/vb.h b/ASNMP/asnmp/vb.h
index a364ec41b11..be6bdabfd37 100644
--- a/ASNMP/asnmp/vb.h
+++ b/ASNMP/asnmp/vb.h
@@ -1,5 +1,7 @@
-/* -*-C++-*- */
+// -*-C++-*-
+
// $Id$
+
#ifndef VB_CLS_
#define VB_CLS_
// ============================================================================
@@ -95,7 +97,7 @@ public:
Vb& operator=( const Vb &vb);
// assignment to another Vb object overloaded
- friend ASNMP_Export int operator==( const Vb &lhs, const Vb &rhs);
+ friend ASNMP_Export bool operator==( const Vb &lhs, const Vb &rhs);
// equivlence operator overloaded
//-----[ set oid / get oid part]------------------------------------------
@@ -201,4 +203,3 @@ protected:
};
#endif // VB_CLS_
-
diff --git a/ASNMP/tests/Octet_Test.cpp b/ASNMP/tests/Octet_Test.cpp
index db90b7a5ee2..759ac16ee7c 100644
--- a/ASNMP/tests/Octet_Test.cpp
+++ b/ASNMP/tests/Octet_Test.cpp
@@ -56,18 +56,18 @@ ACE_RCSID(tests, Octet_Test, "$Id$")
OctetStr& operator=( const char *string);
OctetStr& operator=( const OctetStr &octet);
- int operator==( const OctetStr &lhs, const OctetStr &rhs);
- int operator!=( const OctetStr &lhs, const OctetStr &rhs);
- int operator<( const OctetStr &lhs, const OctetStr &rhs);
- int operator<=( const OctetStr &lhs,const OctetStr &rhs);
- int operator>( const OctetStr &lhs, const OctetStr &rhs);
- int operator>=( const OctetStr &lhs, const OctetStr &rhs);
- int operator==( const OctetStr &lhs,const char *rhs);
- int operator!=( const OctetStr &lhs,const char *rhs);
- int operator<( const OctetStr &lhs,const char *rhs);
- int operator<=( const OctetStr &lhs,char *rhs);
- int operator>( const OctetStr &lhs,const char *rhs);
- int operator>=( const OctetStr &lhs,const char *rhs);
+ bool operator==( const OctetStr &lhs, const OctetStr &rhs);
+ bool operator!=( const OctetStr &lhs, const OctetStr &rhs);
+ bool operator<( const OctetStr &lhs, const OctetStr &rhs);
+ bool operator<=( const OctetStr &lhs,const OctetStr &rhs);
+ bool operator>( const OctetStr &lhs, const OctetStr &rhs);
+ bool operator>=( const OctetStr &lhs, const OctetStr &rhs);
+ bool operator==( const OctetStr &lhs,const char *rhs);
+ bool operator!=( const OctetStr &lhs,const char *rhs);
+ bool operator<( const OctetStr &lhs,const char *rhs);
+ bool operator<=( const OctetStr &lhs,char *rhs);
+ bool operator>( const OctetStr &lhs,const char *rhs);
+ bool operator>=( const OctetStr &lhs,const char *rhs);
OctetStr& operator+=( const SmiBYTE *a);
OctetStr& operator+=( const char c);
OctetStr& operator+=( const OctetStr& octetstr);
diff --git a/ASNMP/tests/Oid_Test.cpp b/ASNMP/tests/Oid_Test.cpp
index 9343dc2575e..c4b1660ef92 100644
--- a/ASNMP/tests/Oid_Test.cpp
+++ b/ASNMP/tests/Oid_Test.cpp
@@ -51,12 +51,12 @@ ACE_RCSID(tests, Oid_Test, "$Id$")
SmiUINT32 get_syntax();
Oid& operator=( const Oid &oid);
- int operator==( const Oid &lhs,const Oid &rhs);
- int operator!=( const Oid &lhs,const Oid &rhs);
- int operator<( const Oid &lhs,const Oid &rhs);
- int operator<=( const Oid &lhs,const Oid &rhs);
- int operator>( const Oid &lhs,const Oid &rhs);
- int operator>=( const Oid &lhs,const Oid &rhs);
+ bool operator==( const Oid &lhs,const Oid &rhs);
+ bool operator!=( const Oid &lhs,const Oid &rhs);
+ bool operator<( const Oid &lhs,const Oid &rhs);
+ bool operator<=( const Oid &lhs,const Oid &rhs);
+ bool operator>( const Oid &lhs,const Oid &rhs);
+ bool operator>=( const Oid &lhs,const Oid &rhs);
Oid& operator+=( const char *a);
Oid& operator+=( const unsigned long i);
Oid& operator+=( const Oid &o);