From: Bjoern Sikora Date: Tue, 18 May 2010 12:39:54 +0000 (+0200) Subject: Finished fine tuning due to linter output. X-Git-Tag: v1.1~123 X-Git-Url: http://developer.intra2net.com/git/?a=commitdiff_plain;h=08a5a621071542bae8a452a9e7debcda9010ef8b;p=bpdyndnsd Finished fine tuning due to linter output. --- diff --git a/bpdyndnsd.lnt b/bpdyndnsd.lnt index cad6d39..d09e654 100644 --- a/bpdyndnsd.lnt +++ b/bpdyndnsd.lnt @@ -12,6 +12,7 @@ -emacro(121, BOOST_CLASS_EXPORT_GUID) -esym(1024, boost::lexical_cast) -esym(534, boost::program_options::options_description_easy_init::operator*) +-esym(1793, boost::program_options::options_description_easy_init::operator*) -esym(534, boost::algorithm::split) -esym(534, boost::program_options::options_description::add) @@ -23,3 +24,35 @@ // Don't complain about redeclaration of Service::serialize -esym(1511, Service::serialize) + +// Don't complain about absent assignment operator in class Config, HTTPHelper, IPAddrHelper +-esym(1732, Config) +-esym(1732, HTTPHelper) +-esym(1732, IPAddrHelper) +-esym(1732, NetHelper) +-esym(1732, Service) +-esym(1732, ServiceDhs) +-esym(1732, ServiceDyndns) +-esym(1732, ServiceDyns) +-esym(1732, ServiceEasydns) +-esym(1732, ServiceGnudip) +-esym(1732, Serviceholder) +-esym(1732, ServiceTzo) +-esym(1732, ServiceZoneedit) +-esym(1732, Updater) +-esym(1732, Logger) +-esym(1733, Config) +-esym(1733, HTTPHelper) +-esym(1733, IPAddrHelper) +-esym(1733, NetHelper) +-esym(1733, Service) +-esym(1733, ServiceDhs) +-esym(1733, ServiceDyndns) +-esym(1733, ServiceDyns) +-esym(1733, ServiceEasydns) +-esym(1733, ServiceGnudip) +-esym(1733, Serviceholder) +-esym(1733, ServiceTzo) +-esym(1733, ServiceZoneedit) +-esym(1733, Updater) +-esym(1733, Logger) \ No newline at end of file diff --git a/src/config.cpp b/src/config.cpp index 89fcbfc..24f720b 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -302,19 +302,19 @@ int Config::parse_cmd_line(int argc, char *argv[]) ExternalWarningLevel = VariablesMap["external_warning_level"].as(); } - catch( po::unknown_option& e ) + catch( const po::unknown_option& e ) { Log->print_unknown_cmd_option(e.what()); Log->print_usage(OptDescCmd); return -1; } - catch( po::multiple_occurrences& e ) + catch( const po::multiple_occurrences& e ) { Log->print_multiple_cmd_option(e.what()); Log->print_usage(OptDescCmd); return -1; } - catch( po::error& e ) + catch( const po::error& e ) { Log->print_error_parsing_cmd(e.what()); Log->print_usage(OptDescCmd); @@ -464,20 +464,20 @@ int Config::load_service_config_file(const string& full_filename) return -1; } } - catch ( po::unknown_option& e ) + catch( const po::unknown_option& e ) { // unknown option in config file detected service_config_file.close(); Log->print_unknown_service_conf_option(full_filename,e.what()); return -1; } - catch( po::multiple_occurrences& e ) + catch( const po::multiple_occurrences& e ) { service_config_file.close(); Log->print_multiple_service_conf_option(full_filename,e.what()); return -1; } - catch( po::error& e ) + catch( const po::error& e ) { service_config_file.close(); Log->print_error_parsing_config_file(full_filename,e.what()); @@ -553,14 +553,14 @@ int Config::load_main_config_file(const string& full_filename) ExternalWarningLevel = VariablesMap["external_warning_level"].as(); } - catch ( po::unknown_option& e ) // at the moment 04-08-2009 this exception is never thrown :-( + catch( const po::unknown_option& e ) // at the moment 04-08-2009 this exception is never thrown :-( { // unknown option in main config file detected main_config_file.close(); Log->print_unknown_main_conf_option(e.what()); return -1; } - catch(po::multiple_occurrences& e) + catch( const po::multiple_occurrences& e ) { main_config_file.close(); Log->print_multiple_main_conf_option(full_filename,e.what()); diff --git a/src/httphelper.cpp b/src/httphelper.cpp index e4c2ba6..428286a 100644 --- a/src/httphelper.cpp +++ b/src/httphelper.cpp @@ -193,7 +193,7 @@ CURL* HTTPHelper::init_curl(string& curl_writedata_buff,char* curl_err_buff) * Test if the curl handle is initialized correctly. * @return True if correctly initialized, false if something went wrong during initialization. */ -bool HTTPHelper::is_initialized() +bool HTTPHelper::is_initialized() const { if ( (CurlError == CURLE_OK) && (CurlEasyHandle != NULL) ) { diff --git a/src/httphelper.h b/src/httphelper.h index 9a1e047..026cfec 100644 --- a/src/httphelper.h +++ b/src/httphelper.h @@ -50,7 +50,7 @@ public: std::string get_curl_data() const; - bool is_initialized(); + bool is_initialized() const; // libcurl is a C library, so we have to make the callback member function static :-( static size_t http_receive(const char *inBuffer, size_t size, size_t nmemb, std::string *outBuffer); diff --git a/src/ip_addr_helper.cpp b/src/ip_addr_helper.cpp index af88ee4..5070a94 100644 --- a/src/ip_addr_helper.cpp +++ b/src/ip_addr_helper.cpp @@ -36,7 +36,7 @@ IPAddrHelper::IPAddrHelper() /** * Constructor. */ -IPAddrHelper::IPAddrHelper(const Logger::Ptr _log, const string& _webcheck_url, const string& _webcheck_url_alt, const int _webcheck_interval, const int _last_webcheck ,const bool _use_ipv6, const string& _proxy, const int _proxy_port) +IPAddrHelper::IPAddrHelper(const Logger::Ptr _log, const string& _webcheck_url, const string& _webcheck_url_alt, const int _webcheck_interval, const time_t _last_webcheck ,const bool _use_ipv6, const string& _proxy, const int _proxy_port) : Log(_log) , WebcheckIpUrl(_webcheck_url) , WebcheckIpUrlAlt(_webcheck_url_alt) @@ -225,7 +225,7 @@ string IPAddrHelper::get_local_wan_nic_ip() const if ( address_family == AF_INET ) { // Translate the address to a protocol independent representation (dottet format). Copy address into ip_addr_buff. - ret_val = getnameinfo(ifa->ifa_addr, sizeof(struct sockaddr_in), ip_addr_buff, NI_MAXHOST, NULL, 0, NI_NUMERICHOST); + ret_val = getnameinfo(ifa->ifa_addr, (socklen_t)sizeof(struct sockaddr_in), ip_addr_buff, NI_MAXHOST, NULL, 0, NI_NUMERICHOST); if ( ret_val != 0 ) { Log->print_error_getting_local_wan_ip("getnameinfo", gai_strerror(ret_val)); @@ -248,7 +248,7 @@ string IPAddrHelper::get_local_wan_nic_ip() const else if ( (address_family == AF_INET6) && (UseIPv6) ) { // Translate the address to a protocol independent representation (dottet format). Copy address into ip_addr_buff. - ret_val = getnameinfo(ifa->ifa_addr, sizeof(struct sockaddr_in6), ip_addr_buff, NI_MAXHOST, NULL, 0, NI_NUMERICHOST); + ret_val = getnameinfo(ifa->ifa_addr, (socklen_t)sizeof(struct sockaddr_in6), ip_addr_buff, NI_MAXHOST, NULL, 0, NI_NUMERICHOST); if ( ret_val != 0 ) { Log->print_error_getting_local_wan_ip("getnameinfo", gai_strerror(ret_val)); @@ -559,10 +559,7 @@ CURL * IPAddrHelper::init_curl(string& curl_writedata_buff,char* curl_err_buff) return NULL; } - CURLcode curlError = CURLE_OK; - - if ( curlError == CURLE_OK ) - curlError = curl_easy_setopt(curl_easy_handle,CURLOPT_NOPROGRESS,1); + CURLcode curlError = curl_easy_setopt(curl_easy_handle,CURLOPT_NOPROGRESS,1); if ( curlError == CURLE_OK) curlError = curl_easy_setopt(curl_easy_handle,CURLOPT_CONNECTTIMEOUT,5); if ( curlError == CURLE_OK) @@ -617,7 +614,7 @@ size_t IPAddrHelper::http_receive( const char *inBuffer, size_t size, size_t nme * Get member LastWebcheck * @return LastWebcheck */ -int IPAddrHelper::get_last_webcheck() const +time_t IPAddrHelper::get_last_webcheck() const { return LastWebcheck; } diff --git a/src/ip_addr_helper.h b/src/ip_addr_helper.h index 3cb339d..f817854 100644 --- a/src/ip_addr_helper.h +++ b/src/ip_addr_helper.h @@ -55,7 +55,7 @@ public: IPAddrHelper(); - IPAddrHelper(const Logger::Ptr _log, const std::string& _webcheck_url, const std::string& _webcheck_url_alt, const int _webcheck_interval, const int _last_webcheck, const bool _use_ipv6, const std::string& _proxy, const int _proxy_port); + IPAddrHelper(const Logger::Ptr _log, const std::string& _webcheck_url, const std::string& _webcheck_url_alt, const int _webcheck_interval, const time_t _last_webcheck, const bool _use_ipv6, const std::string& _proxy, const int _proxy_port); ~IPAddrHelper(); @@ -68,7 +68,7 @@ public: // libcurl is a C library, so we have to make the callback member function static :-( static size_t http_receive(const char *inBuffer, size_t size, size_t nmemb, std::string *outBuffer); - int get_last_webcheck() const; + time_t get_last_webcheck() const; }; #endif diff --git a/src/logger.cpp b/src/logger.cpp index cd3d024..a42c7d7 100644 --- a/src/logger.cpp +++ b/src/logger.cpp @@ -962,7 +962,7 @@ void Logger::print_multiple_cmd_option(const string& message) const * @param MaxUpdatesWithinInterval Number of allowed updates in one update interval. * @param service The service which exceeds update interval. */ -void Logger::print_update_not_allowed(const int current_time, const int old_time, const int MaxUpdatesWithinInterval, const string& service) const +void Logger::print_update_not_allowed(const time_t current_time, const time_t old_time, const int MaxUpdatesWithinInterval, const string& service) const { int level = 1; if ( (level <= Loglevel) || ((level <= ExternalWarningLevel) && (!ExternalWarningLog.empty())) ) @@ -1608,7 +1608,7 @@ void Logger::print_update_service_firttime(const string& hostname, const string& * @param ip_host Hosts IP * @param lastupdated Lastupdated */ -void Logger::print_update_service(const string& hostname, const string& ip_dns_recheck, const string& ip_last_update, const string& ip_host, const int lastupdated) const{ +void Logger::print_update_service(const string& hostname, const string& ip_dns_recheck, const string& ip_last_update, const string& ip_host, const time_t lastupdated) const{ int level = 1; if ( level <= Loglevel ) { @@ -1629,7 +1629,7 @@ void Logger::print_update_service(const string& hostname, const string& ip_dns_r * @param dns_cache_ttl DNS cache ttl * @param current_time Current time */ -void Logger::print_update_service_ttl_expired(const string& hostname, const string& ip_dns_recheck, const string& ip_last_update, const string& ip_host, const int lastupdated, const int dns_cache_ttl, const int current_time) const +void Logger::print_update_service_ttl_expired(const string& hostname, const string& ip_dns_recheck, const string& ip_last_update, const string& ip_host, const time_t lastupdated, const int dns_cache_ttl, const time_t current_time) const { int level = 1; if ( level <= Loglevel ) @@ -1651,7 +1651,7 @@ void Logger::print_update_service_ttl_expired(const string& hostname, const stri * @param dns_cache_ttl DNS cache ttl * @param current_time Current time */ -void Logger::print_update_service_ttl_not_expired(const string& hostname, const string& ip_dns_recheck, const string& ip_last_update, const string& ip_host, const int lastupdated, const int dns_cache_ttl, const int current_time) const +void Logger::print_update_service_ttl_not_expired(const string& hostname, const string& ip_dns_recheck, const string& ip_last_update, const string& ip_host, const time_t lastupdated, const int dns_cache_ttl, const time_t current_time) const { int level = 1; if ( level <= Loglevel ) @@ -1671,7 +1671,7 @@ void Logger::print_update_service_ttl_not_expired(const string& hostname, const * @param ip_host Hosts IP * @param lastupdated Last updated */ -void Logger::print_no_update_needed(const string& hostname, const string& ip_dns_recheck, const string& ip_last_update, const string& ip_host, const int lastupdated) const +void Logger::print_no_update_needed(const string& hostname, const string& ip_dns_recheck, const string& ip_last_update, const string& ip_host, const time_t lastupdated) const { int level = 1; if ( level <= Loglevel ) diff --git a/src/logger.h b/src/logger.h index 3c3c85d..b33d924 100644 --- a/src/logger.h +++ b/src/logger.h @@ -160,7 +160,7 @@ public: void print_multiple_main_conf_option(const std::string& main_conf_file, const std::string& message) const; - void print_update_not_allowed(const int current_time, const int old_time, const int MaxUpdatesWithinInterval, const std::string& service) const; + void print_update_not_allowed(const time_t current_time, const time_t old_time, const int MaxUpdatesWithinInterval, const std::string& service) const; void print_update_service_failure(const std::string& service) const; @@ -232,13 +232,13 @@ public: void print_update_service_firttime(const std::string& hostname, const std::string& ip_dns_recheck, const std::string& ip_host) const; - void print_update_service(const std::string& hostname, const std::string& ip_dns_recheck, const std::string& ip_last_update, const std::string& ip_host, const int lastupdated) const; + void print_update_service(const std::string& hostname, const std::string& ip_dns_recheck, const std::string& ip_last_update, const std::string& ip_host, const time_t lastupdated) const; - void print_update_service_ttl_expired(const std::string& hostname, const std::string& ip_dns_recheck, const std::string& ip_last_update, const std::string& ip_host, const int lastupdated, const int dns_cache_ttl, const int current_time) const; + void print_update_service_ttl_expired(const std::string& hostname, const std::string& ip_dns_recheck, const std::string& ip_last_update, const std::string& ip_host, const time_t lastupdated, const int dns_cache_ttl, const time_t current_time) const; - void print_update_service_ttl_not_expired(const std::string& hostname, const std::string& ip_dns_recheck, const std::string& ip_last_update, const std::string& ip_host, const int lastupdated, const int dns_cache_ttl, const int current_time) const; + void print_update_service_ttl_not_expired(const std::string& hostname, const std::string& ip_dns_recheck, const std::string& ip_last_update, const std::string& ip_host, const time_t lastupdated, const int dns_cache_ttl, const time_t current_time) const; - void print_no_update_needed(const std::string& hostname, const std::string& ip_dns_recheck, const std::string& ip_last_update, const std::string& ip_host, const int lastupdated) const; + void print_no_update_needed(const std::string& hostname, const std::string& ip_dns_recheck, const std::string& ip_last_update, const std::string& ip_host, const time_t lastupdated) const; void print_error_getting_local_wan_ip(const std::string& system_call, const std::string& error) const; }; diff --git a/src/main.cpp b/src/main.cpp index f26b482..683a7bd 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -139,7 +139,7 @@ void terminate(int param) updater->get_logger()->print_caught_sigterm(); exit(shutdown()); -} +} /*lint !e715 */ /** @@ -150,7 +150,7 @@ void switch_to_offline(int param) { updater->get_logger()->print_caught_siguser1(); is_online = false; -} +} /*lint !e715 */ /** @@ -163,7 +163,7 @@ void reload_config(int param) if ( updater->reload_config() != 0 ) exit(-1); is_online = true; -} +} /*lint !e715 */ /** diff --git a/src/net_helper.cpp b/src/net_helper.cpp index f826823..0063ca4 100644 --- a/src/net_helper.cpp +++ b/src/net_helper.cpp @@ -53,14 +53,14 @@ int NetHelper::open_connection(const string& hostname, const string& port) const { IPServicePtr->connect(hostname,port); } - catch ( boost::system::system_error& boost_exception ) + catch ( const boost::system::system_error& boost_exception ) { ostringstream out; out << "NetHelper::open_connection(): " << boost_exception.what() << " Host: " << hostname << " Port: " << port; Log->print_network_error(out.str()); return -1; } - catch ( exception& e ) + catch ( const exception& e ) { ostringstream out; out << "NetHelper::open_connection(): " << e.what() << " Host: " << hostname << " Port: " << port; @@ -89,7 +89,7 @@ int NetHelper::send_data(const std::string& data) const { IPServicePtr->write_to_socket(data); } - catch ( boost::system::system_error& boost_exception ) + catch ( const boost::system::system_error& boost_exception ) { ostringstream out; out << "NetHelper::send_data(): " << boost_exception.what() << " Data to be send: " << data; @@ -111,7 +111,7 @@ std::string NetHelper::receive_data() const { received_data = IPServicePtr->read_from_socket(); } - catch ( boost::system::system_error& boost_exception ) + catch ( const boost::system::system_error& boost_exception ) { ostringstream out; out << "NetHelper::receive_data(): " << boost_exception.what(); @@ -132,7 +132,7 @@ int NetHelper::close_connection() const { IPServicePtr->close(); } - catch ( boost::system::system_error& boost_exception ) + catch ( const boost::system::system_error& boost_exception ) { ostringstream out; out << "NetHelper::close_connection(): " << boost_exception.what(); diff --git a/src/service_dhs.cpp b/src/service_dhs.cpp index fa4df6f..bd56479 100644 --- a/src/service_dhs.cpp +++ b/src/service_dhs.cpp @@ -62,7 +62,7 @@ ServiceDhs::ServiceDhs(const string& _protocol, const string& _hostname, const s // extract domain part from hostname list host_domain_part = separate_domain_and_host_part(get_hostname()); - BaseUrl = assemble_base_url(host_domain_part.front(),host_domain_part.back()); + BaseUrl = assemble_base_url(host_domain_part.front(),host_domain_part.back()); /*lint !e864 */ } @@ -138,7 +138,7 @@ int ServiceDhs::perform_update(const std::string& ip) string url = BaseUrl; url.append(ip); - if ( HTTPHelp->is_initialized() == true ) + if ( HTTPHelp->is_initialized() ) { // Perform curl operation on given url. long http_status_code = HTTPHelp->http_get(url); diff --git a/src/service_dyndns.cpp b/src/service_dyndns.cpp index 2999582..56a62dc 100644 --- a/src/service_dyndns.cpp +++ b/src/service_dyndns.cpp @@ -98,7 +98,7 @@ int ServiceDyndns::perform_update(const std::string& ip) string url = BaseUrl; url.append(ip); - if ( HTTPHelp->is_initialized() == true ) + if ( HTTPHelp->is_initialized() ) { // Perform curl operation on given url long http_status_code = HTTPHelp->http_get(url); diff --git a/src/service_dyns.cpp b/src/service_dyns.cpp index 5948e06..d1c90ee 100644 --- a/src/service_dyns.cpp +++ b/src/service_dyns.cpp @@ -105,7 +105,7 @@ int ServiceDyns::perform_update(const std::string& ip) string url = BaseUrl; url.append(ip); - if ( HTTPHelp->is_initialized() == true ) + if ( HTTPHelp->is_initialized() ) { long http_status_code = HTTPHelp->http_get(url); diff --git a/src/service_easydns.cpp b/src/service_easydns.cpp index 019cf34..6e2d536 100644 --- a/src/service_easydns.cpp +++ b/src/service_easydns.cpp @@ -183,7 +183,7 @@ int ServiceEasydns::perform_update(const std::string& ip) string url = BaseUrl; url.append(ip); - if ( HTTPHelp->is_initialized() == true ) + if ( HTTPHelp->is_initialized() ) { long http_status_code = HTTPHelp->http_get(url); diff --git a/src/service_gnudip.cpp b/src/service_gnudip.cpp index 7e07d2a..b4fede5 100644 --- a/src/service_gnudip.cpp +++ b/src/service_gnudip.cpp @@ -187,7 +187,7 @@ string ServiceGnudip::assemble_update_url(const string& salt, const string& curr */ int ServiceGnudip::perform_update(const std::string& ip) { - if ( HTTPHelp->is_initialized() == true ) + if ( HTTPHelp->is_initialized() ) { // initial request long http_status_code = HTTPHelp->http_get(BaseUrl); diff --git a/src/service_tzo.cpp b/src/service_tzo.cpp index da8bd75..346ae4d 100644 --- a/src/service_tzo.cpp +++ b/src/service_tzo.cpp @@ -105,7 +105,7 @@ int ServiceTzo::perform_update(const std::string& ip) string url = BaseUrl; url.append(ip); - if ( HTTPHelp->is_initialized() == true ) + if ( HTTPHelp->is_initialized() ) { long http_status_code = HTTPHelp->http_get(url); diff --git a/src/service_zoneedit.cpp b/src/service_zoneedit.cpp index e1d6d9e..57bd1e7 100644 --- a/src/service_zoneedit.cpp +++ b/src/service_zoneedit.cpp @@ -99,7 +99,7 @@ int ServiceZoneedit::perform_update(const std::string& ip) string url = BaseUrl; url.append(ip); - if ( HTTPHelp->is_initialized() == true ) + if ( HTTPHelp->is_initialized() ) { long http_status_code = HTTPHelp->http_get(url); diff --git a/src/serviceholder.cpp b/src/serviceholder.cpp index e4beb18..0fcf3cd 100644 --- a/src/serviceholder.cpp +++ b/src/serviceholder.cpp @@ -67,7 +67,7 @@ int Serviceholder::serialize_services() const BOOST_FOREACH(const Service::Ptr &service, OldServices) { - if ( ( service->get_last_updates().front() + ((time_t)service->get_update_interval()*60) ) >= current_time ) // UpdateInterval timeout of service isn't expired. + if ( ( service->get_last_updates().front() + ((time_t)service->get_update_interval()*60) ) >= current_time ) /*lint !e1793 */ // UpdateInterval timeout of service isn't expired. service_container->add_service(service); } @@ -82,7 +82,7 @@ int Serviceholder::serialize_services() const boost::archive::text_oarchive oa(ofs); oa << _service_container << _ip_addr_helper; } - catch( boost::archive::archive_exception e ) + catch( const boost::archive::archive_exception& e ) { Log->print_exception_serialize(e.what()); ofs.close(); @@ -129,7 +129,7 @@ int Serviceholder::deserialize_services() boost::archive::text_iarchive ia(ifs); ia >> _service_container >> _ip_addr_helper; } - catch( boost::archive::archive_exception e ) + catch( const boost::archive::archive_exception& e ) { Log->print_exception_deserialize(e.what()); ifs.close(); diff --git a/src/tcp_service.cpp b/src/tcp_service.cpp index 496534a..f1b8ca1 100644 --- a/src/tcp_service.cpp +++ b/src/tcp_service.cpp @@ -102,7 +102,7 @@ std::string TCPService::read_from_socket() boost::system::error_code error_code; // Is blocking until all available data was read or buffer is full - size_t bytes_read = boost::asio::read(*Socket.get(),stream_buffer,boost::asio::transfer_at_least(1),error_code); + size_t bytes_read = boost::asio::read(*Socket.get(),stream_buffer,boost::asio::transfer_at_least(1),error_code); /*lint !e747 */ if ( error_code == boost::asio::error::eof ) throw boost::system::system_error(boost::system::error_code(ECONNABORTED,boost::system::system_category),"Connection closed by peer."); else if (error_code) @@ -114,7 +114,7 @@ std::string TCPService::read_from_socket() // Copy data from stream buffer to a constant buffer and create a string object from the constant buffer boost::asio::streambuf::const_buffers_type const_buffer = stream_buffer.data(); - std::string data_read(boost::asio::buffers_begin(const_buffer), boost::asio::buffers_begin(const_buffer) + bytes_read); + std::string data_read(boost::asio::buffers_begin(const_buffer), boost::asio::buffers_begin(const_buffer) + bytes_read); /*lint !e713*/ return data_read; } @@ -135,11 +135,10 @@ void TCPService::write_to_socket(const string& data) std::ostream request_stream(&stream_buffer); request_stream << data; - // Init bytes_read and the error_code - size_t bytes_wrote = 0; + // Init error_code boost::system::error_code error_code; - bytes_wrote = boost::asio::write(*Socket.get(), stream_buffer, boost::asio::transfer_at_least(data_size), error_code); + size_t bytes_wrote = boost::asio::write(*Socket.get(), stream_buffer, boost::asio::transfer_at_least(data_size), error_code); if (error_code) throw boost::system::system_error(error_code); else if ( bytes_wrote != data_size ) diff --git a/src/updater.cpp b/src/updater.cpp index 5c7e2ac..74ae13f 100644 --- a/src/updater.cpp +++ b/src/updater.cpp @@ -101,7 +101,7 @@ int Updater::reload_config() * @param argv[] Array with arguments. * @return 0 if cmd options successfully parsed, 1 if usage or version. */ -int Updater::init_config_from_cmd(int argc, char *argv[]) +int Updater::init_config_from_cmd(int argc, char *argv[]) const { // Load the command line parameters if( Conf->parse_cmd_line( argc, argv) != 0) @@ -120,7 +120,7 @@ int Updater::init_config_from_cmd(int argc, char *argv[]) * Load the main config and the service definition files in config path. * @return 0 if all is fine, */ -int Updater::init_config_from_files() +int Updater::init_config_from_files() const { // Load the main and service config files in config path if ( Conf->load_config_from_files() != 0 ) @@ -170,7 +170,7 @@ int Updater::init_ip_helper() else { // IPAddrHelper from ServiceHolder was not declared, so init oen with LastWebcheck 0 - IPAddrHelp = IPAddrHelper::Ptr( new IPAddrHelper( Log, Conf->get_webcheck_ip_url(), Conf->get_webcheck_ip_url_alt(), Conf->get_webcheck_interval(), 0, Conf->get_enable_ipv6(), Conf->get_proxy(), Conf->get_proxy_port() ) ); + IPAddrHelp = IPAddrHelper::Ptr( new IPAddrHelper( Log, Conf->get_webcheck_ip_url(), Conf->get_webcheck_ip_url_alt(), Conf->get_webcheck_interval(), (size_t)0, Conf->get_enable_ipv6(), Conf->get_proxy(), Conf->get_proxy_port() ) ); } // Put the IPAddrHelper into ServiceHolder, so the LastWebcheck state will be serialized too. @@ -232,7 +232,7 @@ void Updater::update_services() const // Try to get the lastupdated time of the actual service if there is one. if ( service->get_last_updates().size() > 0 ) - lastupdated = service->get_last_updates().front(); + lastupdated = service->get_last_updates().front(); /*lint !e1793 */ Log->print_check_service_update(hostname, current_time, lastupdated); diff --git a/src/updater.h b/src/updater.h index c64ad20..ad2dd99 100644 --- a/src/updater.h +++ b/src/updater.h @@ -40,9 +40,9 @@ public: void update_services() const; - int init_config_from_cmd(int argc, char *argv[]); + int init_config_from_cmd(int argc, char *argv[]) const; - int init_config_from_files(); + int init_config_from_files() const; Config::Ptr get_config() const;