From d4828254c4f1bd6d9c0661edd13b7bec08235ad0 Mon Sep 17 00:00:00 2001 From: Thomas Jarosch Date: Fri, 23 Mar 2012 10:24:32 +0100 Subject: [PATCH] Mask some PC-Lint messages. Simple constification --- src/config/configurationreader.cpp | 7 ++++--- src/config/option/configurationoption.cpp | 3 +-- src/config/option/configurationoption.h | 2 +- src/config/option/hostpingprotocoloption.cpp | 2 +- src/host/loglevel.cpp | 2 +- src/host/messagepayload.cpp | 6 +++--- src/host/messagepayload.h | 6 +++--- src/host/networkinterfacelist.cpp | 2 +- src/host/pingprotocol.cpp | 2 +- src/host/pingrotate.cpp | 6 +++--- src/host/pingrotate.h | 2 +- src/host/pingscheduler.cpp | 2 +- src/main.cpp | 2 +- 13 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/config/configurationreader.cpp b/src/config/configurationreader.cpp index 2273449..48f8261 100644 --- a/src/config/configurationreader.cpp +++ b/src/config/configurationreader.cpp @@ -21,8 +21,6 @@ on this file might be covered by the GNU General Public License. #include -#include - #include "config/configurationcommandline.h" #include "config/configurationfile.h" @@ -87,7 +85,10 @@ bool ConfigurationReader::parse( bool configuration_file_processed = file.process( &vm ); if ( configuration_file_processed ) { - file.parse( vm, &Config ); + if ( !file.parse( vm, &Config ) ) + { + return false; + } } bool input_processed = command_line_processed && configuration_file_processed; diff --git a/src/config/option/configurationoption.cpp b/src/config/option/configurationoption.cpp index 99ad877..efb875a 100644 --- a/src/config/option/configurationoption.cpp +++ b/src/config/option/configurationoption.cpp @@ -22,7 +22,6 @@ using namespace std; using boost::program_options::option_description; -using boost::program_options::option_description; using boost::program_options::untyped_value; using boost::program_options::value_semantic; using boost::shared_ptr; @@ -71,7 +70,7 @@ ConfigurationOption::~ConfigurationOption() /** * @return The underlining @c boost::program_options::option_description object. */ -option_description ConfigurationOption::get_option_description() +option_description ConfigurationOption::get_option_description() const { return option; } diff --git a/src/config/option/configurationoption.h b/src/config/option/configurationoption.h index 6cc9eef..7003212 100644 --- a/src/config/option/configurationoption.h +++ b/src/config/option/configurationoption.h @@ -50,7 +50,7 @@ public: ); virtual ~ConfigurationOption(); - boost::program_options::option_description get_option_description(); + boost::program_options::option_description get_option_description() const; std::string get_command_string() const; std::string get_command_description() const; diff --git a/src/config/option/hostpingprotocoloption.cpp b/src/config/option/hostpingprotocoloption.cpp index aac7025..bd3011a 100644 --- a/src/config/option/hostpingprotocoloption.cpp +++ b/src/config/option/hostpingprotocoloption.cpp @@ -114,7 +114,7 @@ PingProtocolList HostPingProtocolOption::parse_protocol_list( GlobalLogger.debug() << "- " << protocol_string; - BOOST_ASSERT( ( PingProtocol_First <= protocol ) && ( protocol <= PingProtocol_Last ) ); + BOOST_ASSERT( ( PingProtocol_First <= protocol ) && ( protocol <= PingProtocol_Last ) ); //lint !e568 } BOOST_ASSERT( 0 < protocol_list.size() ); diff --git a/src/host/loglevel.cpp b/src/host/loglevel.cpp index 44eaf91..fa27ef1 100644 --- a/src/host/loglevel.cpp +++ b/src/host/loglevel.cpp @@ -38,7 +38,7 @@ LogLevel get_log_level_from_string( const string & log_level_string ) string log_level_uppercase_string( log_level_string ); transform( log_level_string.begin(), log_level_string.end(), log_level_uppercase_string.begin(), - ::toupper ); + ::toupper ); //lint !e534 // TODO move to an init method log_level_string_map[ "DEBUG" ] = LogLevel::Debug; diff --git a/src/host/messagepayload.cpp b/src/host/messagepayload.cpp index 01f9d44..49c7c6b 100644 --- a/src/host/messagepayload.cpp +++ b/src/host/messagepayload.cpp @@ -235,7 +235,7 @@ void MessagePayload::encode1( const int byte_index, const int bit_index, const bool value -) +) const { const int max_bit_index = 7; BOOST_ASSERT( ( 0 <= byte_index ) && ( byte_index < static_cast(PayloadSizeInBytes) ) ); @@ -296,7 +296,7 @@ void MessagePayload::encode16( const int left_byte_index, const int right_byte_index, const uint16_t value -) +) const { BOOST_ASSERT( ( 0 <= left_byte_index ) && ( left_byte_index < static_cast(PayloadSizeInBytes) ) ); BOOST_ASSERT( ( 0 <= right_byte_index ) && ( right_byte_index < static_cast(PayloadSizeInBytes) ) ); @@ -353,7 +353,7 @@ void MessagePayload::encode32( const int first_byte_index, const int last_byte_index, const uint32_t value -) +) const { BOOST_ASSERT( ( 0 <= first_byte_index ) && ( first_byte_index < static_cast(PayloadSizeInBytes) ) ); BOOST_ASSERT( ( 0 <= last_byte_index ) && ( last_byte_index < static_cast(PayloadSizeInBytes) ) ); diff --git a/src/host/messagepayload.h b/src/host/messagepayload.h index 0766874..772ff0a 100644 --- a/src/host/messagepayload.h +++ b/src/host/messagepayload.h @@ -51,7 +51,7 @@ public: const int byte_index, const int bit_index, const bool value - ); + ) const; uint16_t decode16( const int left_byte_index, @@ -61,7 +61,7 @@ public: const int left_byte_index, const int right_byte_index, const uint16_t value - ); + ) const; uint32_t decode32( const int first_byte, @@ -71,7 +71,7 @@ public: const int first_byte, const int last_byte, const uint32_t value - ); + ) const; std::istream& read( std::istream &is ); std::ostream& write( std::ostream &os ) const; diff --git a/src/host/networkinterfacelist.cpp b/src/host/networkinterfacelist.cpp index f766559..e7b2e47 100644 --- a/src/host/networkinterfacelist.cpp +++ b/src/host/networkinterfacelist.cpp @@ -56,7 +56,7 @@ NetworkInterfaceList::~NetworkInterfaceList() catch ( ... ) { GlobalLogger.error() << "Error: could not destroy network interface list." - << endl; + << endl; //lint !e1551 } } //lint !e1579 diff --git a/src/host/pingprotocol.cpp b/src/host/pingprotocol.cpp index 038da96..e1bd46f 100644 --- a/src/host/pingprotocol.cpp +++ b/src/host/pingprotocol.cpp @@ -44,7 +44,7 @@ PingProtocol get_ping_protocol_from_string( const string & protocol_string ) string protocol_uppercase_string( protocol_string ); transform( protocol_string.begin(), protocol_string.end(), protocol_uppercase_string.begin(), - ::toupper ); + ::toupper ); //lint !e534 // TODO move to an init method protocol_string_map[ "ICMP" ] = PingProtocol_ICMP; diff --git a/src/host/pingrotate.cpp b/src/host/pingrotate.cpp index 93043c8..3fbf9ee 100644 --- a/src/host/pingrotate.cpp +++ b/src/host/pingrotate.cpp @@ -105,7 +105,7 @@ void PingRotate::ping( function ping_done_callback ) ); } -bool PingRotate::resolve_ping_address() +bool PingRotate::resolve_ping_address() //lint !e1762 { return IpList->resolve(); } @@ -125,7 +125,7 @@ void PingRotate::set_ping_done_callback( function ping_done_callback PingDoneCallback = ping_done_callback; } -void PingRotate::ping_done_handler( bool ping_success ) +void PingRotate::ping_done_handler( bool ping_success ) const { PingDoneCallback( ping_success ); } @@ -171,5 +171,5 @@ void PingRotate::update_dns_resolver( PingProtocol current_protocol ) // when the protocol change, there is a chance that the IP version required by the new // protocol differ from the previous one, thus it is required to resolve the address again. // FIXME add some intelligence here to decide if the new protocol requires to update the DNS - resolve_ping_address(); + resolve_ping_address(); //lint !e534 } diff --git a/src/host/pingrotate.h b/src/host/pingrotate.h index 38ace9e..0ac2f76 100644 --- a/src/host/pingrotate.h +++ b/src/host/pingrotate.h @@ -67,7 +67,7 @@ private: // void set_ping_done_callback( boost::function ping_done_callback ); - void ping_done_handler( bool ping_success ); + void ping_done_handler( bool ping_success ) const; void init_ping_protocol(); void update_ping_protocol(); diff --git a/src/host/pingscheduler.cpp b/src/host/pingscheduler.cpp index abfe444..5a0ff07 100644 --- a/src/host/pingscheduler.cpp +++ b/src/host/pingscheduler.cpp @@ -106,7 +106,7 @@ PingScheduler::~PingScheduler() */ bool PingScheduler::start_pinging_thread() { - Thread = thread( &PingScheduler::start_pinging, this ); + Thread = thread( &PingScheduler::start_pinging, this ); //lint !e1793 return true; } diff --git a/src/main.cpp b/src/main.cpp index 38ad683..5a92c82 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -257,7 +257,7 @@ int main( int argc, const char *argv[] ) if ( configuration.get() != NULL ) { int log_level = configuration->get_log_level(); - I2n::Logger::set_log_level( log_level ); + I2n::Logger::set_log_level( log_level ); //lint !e534 bool daemon_mode = configuration->get_daemon(); if ( daemon_mode ) -- 1.7.1