From: Guilherme Maciel Ferreira Date: Tue, 20 Dec 2011 09:38:53 +0000 (-0200) Subject: PC-Lint warnings fixed: X-Git-Tag: v1.3~33 X-Git-Url: http://developer.intra2net.com/git/?a=commitdiff_plain;h=238da857b4c7f0e92f19a1d14a80ca1e5d381098;p=pingcheck PC-Lint warnings fixed: - Warning 574: Signed-unsigned mix with relational; - Info 737: Loss of sign in promotion from int to unsigned int; --- diff --git a/src/host/pinger.h b/src/host/pinger.h index c530ef6..c697449 100644 --- a/src/host/pinger.h +++ b/src/host/pinger.h @@ -21,6 +21,8 @@ #ifndef PINGER_H #define PINGER_H +#include + #include #include @@ -37,15 +39,16 @@ class Pinger public: virtual void ping( const std::string &destination_ip, - const int destination_port, + const uint16_t destination_port, boost::function ping_done_callback ) = 0; protected: Pinger(); - Pinger( const Pinger &other ); virtual ~Pinger(); +private: + Pinger( const Pinger &other ); Pinger& operator=( const Pinger &other ); }; diff --git a/src/host/pingscheduler.cpp b/src/host/pingscheduler.cpp index 9f52a98..0182f08 100644 --- a/src/host/pingscheduler.cpp +++ b/src/host/pingscheduler.cpp @@ -48,7 +48,7 @@ using I2n::Logger::GlobalLogger; PingScheduler::PingScheduler( const string &network_interface, const string &destination_address, - const int destination_port, + const uint16_t destination_port, const PingProtocol ping_protocol, const long ping_interval_in_sec, const int ping_fail_percentage_limit, @@ -149,11 +149,11 @@ bool PingScheduler::resolve_ping_address() void PingScheduler::ping( const string &destination_ip, - const int destination_port + const uint16_t destination_port ) { BOOST_ASSERT( !destination_ip.empty() ); - BOOST_ASSERT( ( 0 <= destination_port ) && ( destination_port < numeric_limits::max() ) ); + BOOST_ASSERT( ( 0 < destination_port ) && ( destination_port < numeric_limits::max() ) ); Ping->ping( destination_ip, diff --git a/src/host/pingscheduler.h b/src/host/pingscheduler.h index 5a325f5..dddd903 100644 --- a/src/host/pingscheduler.h +++ b/src/host/pingscheduler.h @@ -20,6 +20,8 @@ on this file might be covered by the GNU General Public License. #ifndef PINGSCHEDULER_H #define PINGSCHEDULER_H +#include + #include #include @@ -51,7 +53,7 @@ public: PingScheduler( const std::string &network_interface, const std::string &destination_address, - const int destination_port, + const uint16_t destination_port, const PingProtocol ping_protocol, const long ping_interval_in_sec, const int ping_fail_percentage_limit, @@ -71,7 +73,7 @@ private: bool resolve_ping_address(); void ping( const std::string &destination_ip, - const int destination_port + const uint16_t destination_port ); void ping_done_handler(bool ping_success); @@ -96,7 +98,7 @@ private: /// The list of IPs which are aliases to the host DNS DnsResolver IpList; /// The port to ping at destination host - int DestinationPort; + uint16_t DestinationPort; /// Object responsible to evaluate the status of the host HostStatusAnalyzer HostAnalyzer; /// Internal boost pinger object diff --git a/src/icmp/icmppinger.h b/src/icmp/icmppinger.h index bb0f17f..f92b33b 100644 --- a/src/icmp/icmppinger.h +++ b/src/icmp/icmppinger.h @@ -7,6 +7,8 @@ #ifndef ICMP_PINGER_H #define ICMP_PINGER_H +#include + #include #include @@ -38,7 +40,7 @@ public: virtual void ping( const std::string &destination_ip, - const int destination_port, + const uint16_t destination_port, boost::function< void(bool) > ping_done_callback ); diff --git a/src/main.cpp b/src/main.cpp index 15df1a7..7577915 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -18,6 +18,7 @@ This exception does not invalidate any other reasons why a work based on this file might be covered by the GNU General Public License. */ #include +#include #include #include @@ -103,7 +104,7 @@ void init_pingers( BOOST_FOREACH( HostItem host, hosts ) { string destination_address = host->get_address(); - int destination_port = host->get_port(); + uint16_t destination_port = host->get_port(); int ping_interval_in_sec = host->get_interval_in_sec(); PingSchedulerItem scheduler( new PingScheduler( diff --git a/src/tcp/tcppinger.h b/src/tcp/tcppinger.h index 1fdbf4e..96247b0 100644 --- a/src/tcp/tcppinger.h +++ b/src/tcp/tcppinger.h @@ -20,6 +20,8 @@ on this file might be covered by the GNU General Public License. #ifndef TCP_PINGER_H #define TCP_PINGER_H +#include + #include #include @@ -52,7 +54,7 @@ public: virtual void ping( const std::string &destination_ip, - const int destination_port, + const uint16_t destination_port, boost::function ping_done_callback ); @@ -65,7 +67,7 @@ private: void set_destination_endpoint( const std::string &destination_ip, - const int destination_port + const uint16_t destination_port ); void start_send();