More constification
authorThomas Jarosch <thomas.jarosch@intra2net.com>
Mon, 12 Dec 2011 11:33:24 +0000 (12:33 +0100)
committerThomas Jarosch <thomas.jarosch@intra2net.com>
Mon, 12 Dec 2011 11:33:24 +0000 (12:33 +0100)
Hide "xyz could be made const" linter message
for modifications done through a boost::shared_ptr.
(Pc-Lint can't detect those properly).

14 files changed:
src/config/configurationreader.cpp
src/config/configurationreader.h
src/dns/dnsresolver.cpp
src/dns/dnsresolver.h
src/host/hoststatusanalyzer.cpp
src/host/messagepayload.cpp
src/host/pinginterval.cpp
src/host/pinginterval.h
src/icmp/icmpv4header.cpp
src/icmp/icmpv6header.cpp
src/tcp/tcpheader.cpp
src/tcp/tcpheader.h
src/tcp/tcppinger.cpp
src/tcp/tcppinger.h

index 9eee6fd..eac230e 100644 (file)
@@ -408,7 +408,7 @@ bool ConfigurationReader::process_command_line(
         const int argc,
         char *argv[],
         variables_map &vm
-)
+) const
 {
     try
     {
index 3365ce6..2d2176d 100644 (file)
@@ -63,7 +63,7 @@ private:
             const int argc,
             char *argv[],
             boost::program_options::variables_map &vm
-    );
+    ) const;
     bool process_configuration_file(
             boost::program_options::variables_map &vm
     );
index 1384ba0..6a9cba5 100644 (file)
@@ -162,11 +162,11 @@ string DnsResolver::get_next_ip()
  * @return @c true if the last IPs resolved for the host have expired, thus
  * requiring another query for up-to-date IPs.
  */
-bool DnsResolver::expired_resolved_ip()
+bool DnsResolver::expired_resolved_ip() const
 {
     const int threshold = 10; // TODO configurable
 
-    BOOST_FOREACH( HostAddress host_address, ResolvedHostAddressList )
+    BOOST_FOREACH( const HostAddress &host_address, ResolvedHostAddressList )
     {
         int ttl = host_address.get_ttl().get_updated_value();
         if ( ttl <= threshold )
index d9d011b..abc82e1 100644 (file)
@@ -46,7 +46,7 @@ public:
     bool resolve();
     int get_resolved_ip_count() const;
     std::string get_next_ip();
-    bool expired_resolved_ip();
+    bool expired_resolved_ip() const;
 
 private:
     bool handle_ip_address();
index 1b072d6..76bea2f 100644 (file)
@@ -128,8 +128,7 @@ void HostStatusAnalyzer::analyze_ping_statistics()
     {
         LinkAnalyzer->notify_host_up( HostAddress );
     }
-
-}
+} //lint !e1762
 
 void HostStatusAnalyzer::reset_ping_counters()
 {
index e23dfa4..0048566 100644 (file)
@@ -234,7 +234,7 @@ void MessagePayload::encode16(
 
     Payload[ left_byte ] = static_cast<uint8_t>( value >> 8 );
     Payload[ right_byte ] = static_cast<uint8_t>( value & 0xFF );
-}
+} //lint !e1762
 
 /**
  * @brief Retrieve 32 bits from the payload buffer.
@@ -297,7 +297,7 @@ void MessagePayload::encode32(
     Payload[ ++current_byte  ] = static_cast<uint8_t>( value & 0xFF );
 
     BOOST_ASSERT( current_byte == last_byte );
-}
+} //lint !e1762
 
 /**
  * @brief Read/Extract all the data from the input stream @a is and stores it
index 0669d3d..2f0d5e6 100644 (file)
@@ -38,7 +38,7 @@ PingInterval::~PingInterval()
 {
 }
 
-PingInterval::operator PingIntervalType()
+PingInterval::operator PingIntervalType() const
 {
     BOOST_ASSERT( 0 < Interval );
 
index a4a7afb..6289bb6 100644 (file)
@@ -41,7 +41,7 @@ public:
     PingInterval( PingIntervalType interval );
     ~PingInterval();
 
-    operator PingIntervalType();
+    operator PingIntervalType() const;
 
     void back_to_original();
     void speed_up();
index bc6d8ce..fbf441c 100644 (file)
@@ -49,7 +49,7 @@ Icmpv4Type Icmpv4Header::get_type() const
 void Icmpv4Header::set_type( const Icmpv4Type type )
 {
     get_icmp_message_format()->set_type_v4( type );
-}
+} //lint !e1762
 
 uint8_t Icmpv4Header::get_code() const
 {
@@ -59,7 +59,7 @@ uint8_t Icmpv4Header::get_code() const
 void Icmpv4Header::set_code( const uint8_t code )
 {
     get_icmp_message_format()->set_code( code );
-}
+} //lint !e1762
 
 uint16_t Icmpv4Header::get_checksum() const
 {
@@ -69,7 +69,7 @@ uint16_t Icmpv4Header::get_checksum() const
 void Icmpv4Header::set_checksum( const uint16_t checksum )
 {
     get_icmp_message_format()->set_checksum( checksum );
-}
+} //lint !e1762
 
 uint16_t Icmpv4Header::get_identifier() const
 {
@@ -79,7 +79,7 @@ uint16_t Icmpv4Header::get_identifier() const
 void Icmpv4Header::set_identifier( const uint16_t identifier )
 {
     get_icmp_message_format()->set_identifier( identifier );
-}
+} //lint !e1762
 
 uint16_t Icmpv4Header::get_sequence_number() const
 {
@@ -89,7 +89,7 @@ uint16_t Icmpv4Header::get_sequence_number() const
 void Icmpv4Header::set_sequence_number( const uint16_t sequence_number )
 {
     get_icmp_message_format()->set_sequence_number( sequence_number );
-}
+} //lint !e1762
 
 shared_ptr<IcmpMessage> Icmpv4Header::get_icmp_message_format() const
 {
index 8d9a54c..0baff6d 100644 (file)
@@ -49,7 +49,7 @@ Icmpv6Type Icmpv6Header::get_type() const
 void Icmpv6Header::set_type( const Icmpv6Type type )
 {
     get_icmp_message_format()->set_type_v6( type );
-}
+} //lint !e1762
 
 uint8_t Icmpv6Header::get_code() const
 {
@@ -59,7 +59,7 @@ uint8_t Icmpv6Header::get_code() const
 void Icmpv6Header::set_code( const uint8_t code )
 {
     get_icmp_message_format()->set_code( code );
-}
+} //lint !e1762
 
 uint16_t Icmpv6Header::get_checksum() const
 {
@@ -69,7 +69,7 @@ uint16_t Icmpv6Header::get_checksum() const
 void Icmpv6Header::set_checksum( const uint16_t checksum )
 {
     get_icmp_message_format()->set_checksum( checksum );
-}
+} //lint !e1762
 
 uint16_t Icmpv6Header::get_identifier() const
 {
@@ -79,7 +79,7 @@ uint16_t Icmpv6Header::get_identifier() const
 void Icmpv6Header::set_identifier( const uint16_t identifier )
 {
     get_icmp_message_format()->set_identifier( identifier );
-}
+} //lint !e1762
 
 uint16_t Icmpv6Header::get_sequence_number() const
 {
@@ -89,7 +89,7 @@ uint16_t Icmpv6Header::get_sequence_number() const
 void Icmpv6Header::set_sequence_number( const uint16_t sequence_number )
 {
     get_icmp_message_format()->set_sequence_number( sequence_number );
-}
+} //lint !e1762
 
 shared_ptr<IcmpMessage> Icmpv6Header::get_icmp_message_format() const
 {
index 5f743ad..a1984d7 100644 (file)
@@ -310,7 +310,7 @@ ostream& operator<<( ostream& os, const TcpHeader& header )
     return header.Payload.write( os );
 }
 
-uint16_t TcpHeader::calculate_checksum( const uint16_t *word_array, int size )
+uint16_t TcpHeader::calculate_checksum( const uint16_t *word_array, int size ) const
 {
     unsigned long cksum = 0;
     while ( size > 1 )
index 33cd52d..7387d05 100644 (file)
@@ -130,7 +130,7 @@ public:
     );
 
 private:
-    uint16_t calculate_checksum( const uint16_t *word_array, int size );
+    uint16_t calculate_checksum( const uint16_t *word_array, int size ) const;
 
     MessagePayload Payload;
 };
index 99fc96e..74499f9 100644 (file)
@@ -133,7 +133,7 @@ void TcpPinger::ping(
     start_receive();
 }
 
-address TcpPinger::get_source_address()
+address TcpPinger::get_source_address() const
 {
     return NetInterface.get_address( Protocol );
 }
index 2f55f26..1fdbf4e 100644 (file)
@@ -57,7 +57,7 @@ public:
     );
 
 private:
-    boost::asio::ip::address get_source_address();
+    boost::asio::ip::address get_source_address() const;
     boost::asio::ip::address get_destination_address() const;
 
     uint16_t get_source_port() const;