Mask some PC-Lint messages. Simple constification
authorThomas Jarosch <thomas.jarosch@intra2net.com>
Fri, 23 Mar 2012 09:24:32 +0000 (10:24 +0100)
committerThomas Jarosch <thomas.jarosch@intra2net.com>
Fri, 23 Mar 2012 09:24:32 +0000 (10:24 +0100)
13 files changed:
src/config/configurationreader.cpp
src/config/option/configurationoption.cpp
src/config/option/configurationoption.h
src/config/option/hostpingprotocoloption.cpp
src/host/loglevel.cpp
src/host/messagepayload.cpp
src/host/messagepayload.h
src/host/networkinterfacelist.cpp
src/host/pingprotocol.cpp
src/host/pingrotate.cpp
src/host/pingrotate.h
src/host/pingscheduler.cpp
src/main.cpp

index 2273449..48f8261 100644 (file)
@@ -21,8 +21,6 @@ on this file might be covered by the GNU General Public License.
 
 #include <boost/assert.hpp>
 
-#include <logfunc.hpp>
-
 #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;
index 99ad877..efb875a 100644 (file)
@@ -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;
 }
index 6cc9eef..7003212 100644 (file)
@@ -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;
 
index aac7025..bd3011a 100644 (file)
@@ -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() );
index 44eaf91..fa27ef1 100644 (file)
@@ -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;
index 01f9d44..49c7c6b 100644 (file)
@@ -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<int>(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<int>(PayloadSizeInBytes) ) );
     BOOST_ASSERT( ( 0 <= right_byte_index ) && ( right_byte_index < static_cast<int>(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<int>(PayloadSizeInBytes) ) );
     BOOST_ASSERT( ( 0 <= last_byte_index ) && ( last_byte_index < static_cast<int>(PayloadSizeInBytes) ) );
index 0766874..772ff0a 100644 (file)
@@ -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;
index f766559..e7b2e47 100644 (file)
@@ -56,7 +56,7 @@ NetworkInterfaceList::~NetworkInterfaceList()
     catch ( ... )
     {
         GlobalLogger.error() << "Error: could not destroy network interface list."
-                << endl;
+                << endl;                                                                       //lint !e1551
     }
 } //lint !e1579
 
index 038da96..e1bd46f 100644 (file)
@@ -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;
index 93043c8..3fbf9ee 100644 (file)
@@ -105,7 +105,7 @@ void PingRotate::ping( function<void(bool)> 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<void(bool)> 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
 }
index 38ace9e..0ac2f76 100644 (file)
@@ -67,7 +67,7 @@ private:
     //
 
     void set_ping_done_callback( boost::function<void(bool)> 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();
index abfe444..5a0ff07 100644 (file)
@@ -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;
 }
index 38ad683..5a92c82 100644 (file)
@@ -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 )