[esnacc-dev] [PATCH] cxx/asnbufbits: constify operator<

Aaron Conole aconole at bytheb.org
Fri Jan 18 15:56:17 UTC 2019


The less-than comparison operator makes no modifications to the internal
state of either the lhs or rhs of the expression.  Signal this properly
as a 'const' operation.

Signed-off-by: Aaron Conole <aconole at bytheb.org>
---
 cxx-lib/inc/asn-buf.h       | 2 +-
 cxx-lib/src/asn-bufbits.cpp | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/cxx-lib/inc/asn-buf.h b/cxx-lib/inc/asn-buf.h
index 013e3d6..c2e7bd3 100644
--- a/cxx-lib/inc/asn-buf.h
+++ b/cxx-lib/inc/asn-buf.h
@@ -216,7 +216,7 @@ public:
 	}
 */
 
-    bool operator<(AsnBufBits &rhs);
+    bool operator<(const AsnBufBits &rhs) const;
 
 	unsigned char MaskBits(unsigned char cCharToMask, int iBitsToMask);
 	unsigned long PutBits(const unsigned char* seg, unsigned long numBits);
diff --git a/cxx-lib/src/asn-bufbits.cpp b/cxx-lib/src/asn-bufbits.cpp
index 361d172..368f65c 100644
--- a/cxx-lib/src/asn-bufbits.cpp
+++ b/cxx-lib/src/asn-bufbits.cpp
@@ -627,7 +627,7 @@ unsigned char  AsnBufBits::MaskBits(unsigned char cCharToMask, int iBitsToMask)
 
 
 //RWC;TBD; FIX THIS TO WORK PROPERLY.....
-bool AsnBufBits::operator<(AsnBufBits &rhs)
+bool AsnBufBits::operator<(const AsnBufBits &rhs) const
 {
 	FUNC("AsnBufBits::operator<()");
 
-- 
2.19.1



More information about the dev mailing list