]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Improved const correctness in IPAddress.
authorAmos Jeffries <squid3@treenet.co.nz>
Tue, 24 Jun 2008 11:20:15 +0000 (23:20 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Tue, 24 Jun 2008 11:20:15 +0000 (23:20 +1200)
include/IPAddress.h
lib/IPAddress.cc

index 1ee310e4c66c3091eb38d6d72196b4c7cec6a2b7..5f86819fe224bfedf1ff00ecfba8b131f056f376 100644 (file)
@@ -232,7 +232,7 @@ public:
      *  Valid results IF and only IF the stored IP address is actually a network bitmask
      \retval N number of bits which are set in the bitmask stored.
      */
-    int GetCIDR();
+    int GetCIDR() const;
 
     /** Apply a mask to the stored address.
      \param mask Netmask format to be bit-mask-AND'd over the stored address.
index 1b5deaf721ced7a2e875247797ffd8ae9d1e5dac..08b94eb08022cb1f4f3b04a7c5e921a0e71e345b 100644 (file)
@@ -118,15 +118,15 @@ IPAddress::~IPAddress()
 }
 
 int
-IPAddress::GetCIDR()
+IPAddress::GetCIDR() const
 {
     uint8_t shift,byte;
     uint8_t bit,caught;
     int len = 0;
 #if USE_IPV6
-    uint8_t *ptr= m_SocketAddr.sin6_addr.s6_addr;
+    const uint8_t *ptr= m_SocketAddr.sin6_addr.s6_addr;
 #else
-    uint8_t *ptr= (uint8_t *)&m_SocketAddr.sin_addr.s_addr;
+    const uint8_t *ptr= (uint8_t *)&m_SocketAddr.sin_addr.s_addr;
 #endif
 
     /* Let's scan all the bits from Most Significant to Least */