Fixed more problems issued by PC-lint (3 times now, bad programmer!)
authorGuilherme Maciel Ferreira <guilherme.maciel.ferreira@intra2net.com>
Mon, 11 Apr 2011 13:51:42 +0000 (15:51 +0200)
committerGuilherme Maciel Ferreira <guilherme.maciel.ferreira@intra2net.com>
Mon, 11 Apr 2011 13:51:42 +0000 (15:51 +0200)
src/dns/dnsresolver.cpp
src/notify/linkstatusanalyzer.cpp
src/ping/boostpinger.cpp
src/ping/boostpinger.h

index b67d2e8..e8d7d73 100644 (file)
@@ -76,7 +76,7 @@ int DnsResolver::get_resolved_ip_count() const
 
     BOOST_ASSERT( 1 <= resolved_ip_count );
 
-    return resolved_ip_count;
+    return static_cast<int> ( resolved_ip_count );
 }
 
 /**
index 3b8eb8a..561f5d4 100644 (file)
@@ -84,7 +84,8 @@ void LinkStatusAnalyzer::add_host_down( const string &host_address )
 
 bool LinkStatusAnalyzer::exceeded_host_down_limit() const
 {
-    int host_down_count = HostsDownList.size();
+    int host_down_count = static_cast<int> ( HostsDownList.size() );
+
     return ( host_down_count > HostsDownLimit );
 }
 
index 3612744..e013019 100644 (file)
@@ -67,7 +67,7 @@ bool BoostPinger::ping( const string &destination_ip )
 {
     BOOST_ASSERT( !destination_ip.empty() );
 
-    int port = 0;
+    uint16_t port = 0;
     address destination_address = ip::address::from_string( destination_ip );
     icmp::endpoint destination_endpoint( destination_address, port );
     DestinationEndpoint = destination_endpoint;
@@ -257,7 +257,7 @@ void BoostPinger::handle_receive_icmp_packet( const size_t &bytes_transferred )
     start_receive();
 }
 
-void BoostPinger::print_request_timeout()
+void BoostPinger::print_request_timeout() const
 {
     cout << "Request timed out" << endl;
 }
@@ -274,16 +274,16 @@ void BoostPinger::print_echo_reply(
 
     size_t bytes_received = bytes_transferred - ipv4_hdr.get_header_length();
     string remote_address = ipv4_hdr.get_source_address().to_string();
-    int sequence_number = icmp_hdr.get_sequence_number();
+    uint16_t sequence_number = icmp_hdr.get_sequence_number();
     int ttl = ipv4_hdr.get_time_to_live();
     ptime now = microsec_clock::universal_time();
-    int time = (now - TimeSent).total_milliseconds();
+    int elapsed_time = (now - TimeSent).total_milliseconds();
 
     cout << bytes_received << " bytes "
          << "from " << remote_address
          << ": icmp_seq=" << sequence_number
          << " ttl=" << ttl
-         << " time=" << time << " ms" << endl;
+         << " time=" << elapsed_time << " ms" << endl;
 }
 
 void BoostPinger::print_destination_unreachable(
@@ -296,7 +296,7 @@ void BoostPinger::print_destination_unreachable(
     IcmpHeader icmp_hdr = icmp_packet.get_icmp_header();
 
     string local_address = ipv4_hdr.get_destination_address().to_string();
-    int sequence_number = icmp_hdr.get_sequence_number();
+    uint16_t sequence_number = icmp_hdr.get_sequence_number();
 
     cout << "From " << local_address
          << " icmp_seq=" << sequence_number
index 0da0485..1ed7233 100644 (file)
@@ -48,7 +48,7 @@ private:
     void start_receive();
     void handle_receive_icmp_packet( const std::size_t &bytes_transferred );
 
-    void print_request_timeout();
+    void print_request_timeout() const;
     void print_echo_reply(
             const IcmpPacket &icmp_packet,
             const std::size_t &bytes_transferred