]> granicus.if.org Git - icinga2/commitdiff
Fix compiler warnings.
authorGunnar Beutner <gunnar@beutner.name>
Thu, 22 May 2014 07:02:44 +0000 (09:02 +0200)
committerGunnar Beutner <gunnar@beutner.name>
Thu, 22 May 2014 08:28:21 +0000 (10:28 +0200)
Fixes #5823

20 files changed:
components/compat/checkresultreader.cpp
components/compat/compatlogger.cpp
components/compat/externalcommandlistener.cpp
components/compat/statusdatawriter.cpp
components/demo/demo.cpp
components/livestatus/commentstable.cpp
components/livestatus/downtimestable.cpp
components/livestatus/hoststable.cpp
components/livestatus/logtable.cpp
components/livestatus/statehisttable.cpp
components/livestatus/statustable.cpp
components/notification/notificationcomponent.cpp
components/perfdata/graphitewriter.cpp
components/perfdata/perfdatawriter.cpp
lib/db_ido/dbconnection.cpp
lib/db_ido/dbevents.cpp
lib/icinga/cib.cpp
lib/icinga/cib.h
lib/remote/apilistener.cpp
tools/mkclass/class_lexer.ll

index 03f8c82462042c7d255e7f46896334875c286a2c..10eda7e3fe30e33dd0cd0a7443341fa705f01281 100644 (file)
@@ -38,7 +38,7 @@ REGISTER_TYPE(CheckResultReader);
 
 REGISTER_STATSFUNCTION(CheckResultReaderStats, &CheckResultReader::StatsFunc);
 
-Value CheckResultReader::StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr& perfdata)
+Value CheckResultReader::StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr&)
 {
        Dictionary::Ptr nodes = make_shared<Dictionary>();
 
index 924a6c35a5015e1c242ce9ba104868afa86d06d7..4b3e402f21a8286e340f076a6968f2f8215c8e83 100644 (file)
@@ -45,7 +45,7 @@ REGISTER_SCRIPTFUNCTION(ValidateRotationMethod, &CompatLogger::ValidateRotationM
 
 REGISTER_STATSFUNCTION(CompatLoggerStats, &CompatLogger::StatsFunc);
 
-Value CompatLogger::StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr& perfdata)
+Value CompatLogger::StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr&)
 {
        Dictionary::Ptr nodes = make_shared<Dictionary>();
 
index c2eab5f503d7d49a7b411cc858f1e6eb24f8b798..c1c6253213e777fb0fd58f39407bc3e1c0a21211 100644 (file)
@@ -31,7 +31,7 @@ REGISTER_TYPE(ExternalCommandListener);
 
 REGISTER_STATSFUNCTION(ExternalCommandListenerStats, &ExternalCommandListener::StatsFunc);
 
-Value ExternalCommandListener::StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr& perfdata)
+Value ExternalCommandListener::StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr&)
 {
        Dictionary::Ptr nodes = make_shared<Dictionary>();
 
index b2908d0c8c1e20054e37ef3d32c3f2075631dc20..5d072fba325268dc483f046592c217e28b1ce808 100644 (file)
@@ -48,7 +48,7 @@ REGISTER_TYPE(StatusDataWriter);
 
 REGISTER_STATSFUNCTION(StatusDataWriterStats, &StatusDataWriter::StatsFunc);
 
-Value StatusDataWriter::StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr& perfdata)
+Value StatusDataWriter::StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr&)
 {
        Dictionary::Ptr nodes = make_shared<Dictionary>();
 
index c8dde99667c157e0a93c81a4f1211b20363d18a2..04f950e4f0ffff6c27b39f1b913787b856a2a925 100644 (file)
@@ -57,7 +57,7 @@ void Demo::DemoTimerHandler(void)
        }
 }
 
-Value Demo::DemoMessageHandler(const MessageOrigin& origin, const Dictionary::Ptr& params)
+Value Demo::DemoMessageHandler(const MessageOrigin& origin, const Dictionary::Ptr&)
 {
        Log(LogInformation, "demo", "Got demo message from '" + origin.FromClient->GetEndpoint()->GetName() + "'");
 
index 0143e275096d70762fd7d9f270e5f6bd3cc42d64..5ad4899e0f849a6d85cbc90a44ddbcc98e027e4d 100644 (file)
@@ -82,7 +82,7 @@ void CommentsTable::FetchRows(const AddRowFunction& addRowFn)
        }
 }
 
-Object::Ptr CommentsTable::ServiceAccessor(const Value& row, const Column::ObjectAccessor& parentObjectAccessor)
+Object::Ptr CommentsTable::ServiceAccessor(const Value& row, const Column::ObjectAccessor&)
 {
        Comment::Ptr comment = static_cast<Comment::Ptr>(row);
        return Checkable::GetOwnerByCommentID(comment->GetId()); // XXX: this might return a Host object
index a24087162d3043ebb63607459fca69911012c71b..ccb01decab2b75d11d8f4550e05b444cb25e673b 100644 (file)
@@ -71,7 +71,7 @@ void DowntimesTable::FetchRows(const AddRowFunction& addRowFn)
        }
 }
 
-Object::Ptr DowntimesTable::ServiceAccessor(const Value& row, const Column::ObjectAccessor& parentObjectAccessor)
+Object::Ptr DowntimesTable::ServiceAccessor(const Value& row, const Column::ObjectAccessor&)
 {
        Downtime::Ptr downtime = static_cast<Downtime::Ptr>(row);
        return Service::GetOwnerByDowntimeID(downtime->GetId());
index 21d41c4b59cccb94fd5d5ed3d680a0b3bb28a42a..b6e2091d838fd1da39de1be06b251f02c85abdb0 100644 (file)
@@ -732,7 +732,7 @@ Value HostsTable::ActiveChecksEnabledAccessor(const Value& row)
        return CompatUtility::GetCheckableActiveChecksEnabled(host);
 }
 
-Value HostsTable::CheckOptionsAccessor(const Value& row)
+Value HostsTable::CheckOptionsAccessor(const Value&)
 {
        /* TODO - forcexec, freshness, orphan, none */
        return Empty;
index 695da7ac3b06b455b813b6b8b2a6dd8d9a1e5a2c..12a6bf76ea88e1d848475ad701206036cb18c6a3 100644 (file)
@@ -109,7 +109,7 @@ void LogTable::UpdateLogEntries(const Dictionary::Ptr& log_entry_attrs, int line
        addRowFn(log_entry_attrs);
 }
 
-Object::Ptr LogTable::HostAccessor(const Value& row, const Column::ObjectAccessor& parentObjectAccessor)
+Object::Ptr LogTable::HostAccessor(const Value& row, const Column::ObjectAccessor&)
 {
        String host_name = static_cast<Dictionary::Ptr>(row)->Get("host_name");
 
@@ -119,7 +119,7 @@ Object::Ptr LogTable::HostAccessor(const Value& row, const Column::ObjectAccesso
        return Host::GetByName(host_name);
 }
 
-Object::Ptr LogTable::ServiceAccessor(const Value& row, const Column::ObjectAccessor& parentObjectAccessor)
+Object::Ptr LogTable::ServiceAccessor(const Value& row, const Column::ObjectAccessor&)
 {
        String host_name = static_cast<Dictionary::Ptr>(row)->Get("host_name");
        String service_description = static_cast<Dictionary::Ptr>(row)->Get("service_description");
@@ -130,7 +130,7 @@ Object::Ptr LogTable::ServiceAccessor(const Value& row, const Column::ObjectAcce
        return Service::GetByNamePair(host_name, service_description);
 }
 
-Object::Ptr LogTable::ContactAccessor(const Value& row, const Column::ObjectAccessor& parentObjectAccessor)
+Object::Ptr LogTable::ContactAccessor(const Value& row, const Column::ObjectAccessor&)
 {
        String contact_name = static_cast<Dictionary::Ptr>(row)->Get("contact_name");
 
@@ -140,7 +140,7 @@ Object::Ptr LogTable::ContactAccessor(const Value& row, const Column::ObjectAcce
        return User::GetByName(contact_name);
 }
 
-Object::Ptr LogTable::CommandAccessor(const Value& row, const Column::ObjectAccessor& parentObjectAccessor)
+Object::Ptr LogTable::CommandAccessor(const Value& row, const Column::ObjectAccessor&)
 {
        String command_name = static_cast<Dictionary::Ptr>(row)->Get("command_name");
 
index 6ee9e091c157c888cdcb6e48e96632a139592d80..8927f10e556d2f708e4bd0d92da2b72a51f216cc 100644 (file)
@@ -270,7 +270,7 @@ void StateHistTable::FetchRows(const AddRowFunction& addRowFn)
        }
 }
 
-Object::Ptr StateHistTable::HostAccessor(const Value& row, const Column::ObjectAccessor& parentObjectAccessor)
+Object::Ptr StateHistTable::HostAccessor(const Value& row, const Column::ObjectAccessor&)
 {
        String host_name = static_cast<Dictionary::Ptr>(row)->Get("host_name");
 
@@ -280,7 +280,7 @@ Object::Ptr StateHistTable::HostAccessor(const Value& row, const Column::ObjectA
        return Host::GetByName(host_name);
 }
 
-Object::Ptr StateHistTable::ServiceAccessor(const Value& row, const Column::ObjectAccessor& parentObjectAccessor)
+Object::Ptr StateHistTable::ServiceAccessor(const Value& row, const Column::ObjectAccessor&)
 {
        String host_name = static_cast<Dictionary::Ptr>(row)->Get("host_name");
        String service_description = static_cast<Dictionary::Ptr>(row)->Get("service_description");
index 383ae6fef486ced793f4bb37e758bd443c5b480d..f92ed524ec1a9851408d0c070a756f9266a3a63b 100644 (file)
@@ -213,7 +213,7 @@ Value StatusTable::LivestatusActiveConnectionsAccessor(const Value&)
        return LivestatusListener::GetClientsConnected();
 }
 
-Value StatusTable::CustomVariableNamesAccessor(const Value& row)
+Value StatusTable::CustomVariableNamesAccessor(const Value&)
 {
        Dictionary::Ptr vars = IcingaApplication::GetInstance()->GetVars();
 
@@ -231,7 +231,7 @@ Value StatusTable::CustomVariableNamesAccessor(const Value& row)
        return cv;
 }
 
-Value StatusTable::CustomVariableValuesAccessor(const Value& row)
+Value StatusTable::CustomVariableValuesAccessor(const Value&)
 {
        Dictionary::Ptr vars = IcingaApplication::GetInstance()->GetVars();
 
index b16fa94d38b83023ab7cb3a60321ddf8ca8e1949..b818d749f0416371917adf94e9569830e6a4029b 100644 (file)
@@ -33,7 +33,7 @@ REGISTER_TYPE(NotificationComponent);
 
 REGISTER_STATSFUNCTION(NotificationComponentStats, &NotificationComponent::StatsFunc);
 
-Value NotificationComponent::StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr& perfdata)
+Value NotificationComponent::StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr&)
 {
        Dictionary::Ptr nodes = make_shared<Dictionary>();
 
index c82fc39a9d5665e2663bf900ff64f7aecb07a308..3412e7000a5d643e22b1ce22bf57198b4978beca 100644 (file)
@@ -46,7 +46,7 @@ REGISTER_TYPE(GraphiteWriter);
 
 REGISTER_STATSFUNCTION(GraphiteWriterStats, &GraphiteWriter::StatsFunc);
 
-Value GraphiteWriter::StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr& perfdata)
+Value GraphiteWriter::StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr&)
 {
        Dictionary::Ptr nodes = make_shared<Dictionary>();
 
index 8cdb2c36b3c9ac244f668b23bc397b0001036e08..81c8ae46beaca15666cebc27283be49c6c999171 100644 (file)
@@ -36,7 +36,7 @@ REGISTER_TYPE(PerfdataWriter);
 
 REGISTER_STATSFUNCTION(PerfdataWriterStats, &PerfdataWriter::StatsFunc);
 
-Value PerfdataWriter::StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr& perfdata)
+Value PerfdataWriter::StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr&)
 {
        Dictionary::Ptr nodes = make_shared<Dictionary>();
 
index 019076695d7ad1b648c8da322ab770146c3250b7..2d785370eacf073ffb69a50abf519d04931f3851 100644 (file)
@@ -205,7 +205,7 @@ void DbConnection::CleanUpHandler(void)
 
 }
 
-void DbConnection::CleanUpExecuteQuery(const String& table, const String& time_column, double max_age)
+void DbConnection::CleanUpExecuteQuery(const String&, const String&, double)
 {
        /* Default handler does nothing. */
 }
index 39d6ab21054f609e603f466a7359a5716a1ef745..189d600d65d54f45e33320bb726542dfdc7aaae0 100644 (file)
@@ -650,7 +650,7 @@ void DbEvents::AddAcknowledgementHistory(const Checkable::Ptr& checkable, const
        fields1->Set("entry_time_usec", time_bag.second);
        fields1->Set("acknowledgement_type", type);
        fields1->Set("object_id", checkable);
-       fields1->Set("state", service ? service->GetState() : host->GetState());
+       fields1->Set("state", service ? static_cast<int>(service->GetState()) : static_cast<int>(host->GetState()));
        fields1->Set("author_name", author);
        fields1->Set("comment_data", comment);
        fields1->Set("is_sticky", type == AcknowledgementSticky ? 1 : 0);
@@ -741,7 +741,7 @@ void DbEvents::AddNotificationHistory(const Notification::Ptr& notification, con
        fields1->Set("start_time_usec", time_bag.second);
        fields1->Set("end_time", DbValue::FromTimestamp(time_bag.first));
        fields1->Set("end_time_usec", time_bag.second);
-       fields1->Set("state", service ? service->GetState() : host->GetState());
+       fields1->Set("state", service ? static_cast<int>(service->GetState()) : static_cast<int>(host->GetState()));
 
        if (cr) {
                fields1->Set("output", CompatUtility::GetCheckResultOutput(cr));
@@ -807,7 +807,7 @@ void DbEvents::AddStateChangeHistory(const Checkable::Ptr& checkable, const Chec
        fields1->Set("state_time_usec", time_bag.second);
        fields1->Set("object_id", checkable);
        fields1->Set("state_change", 1); /* service */
-       fields1->Set("state", service ? service->GetState() : host->GetState());
+       fields1->Set("state", service ? static_cast<int>(service->GetState()) : static_cast<int>(host->GetState()));
        fields1->Set("state_type", checkable->GetStateType());
        fields1->Set("current_check_attempt", checkable->GetCheckAttempt());
        fields1->Set("max_check_attempts", checkable->GetMaxCheckAttempts());
@@ -1281,7 +1281,7 @@ void DbEvents::AddEventHandlerHistory(const Checkable::Ptr& checkable)
 
        fields1->Set("eventhandler_type", service ? 1 : 0);
        fields1->Set("object_id", checkable);
-       fields1->Set("state", service ? service->GetState() : host->GetState());
+       fields1->Set("state", service ? static_cast<int>(service->GetState()) : static_cast<int>(host->GetState()));
        fields1->Set("state_type", checkable->GetStateType());
 
        fields1->Set("start_time", DbValue::FromTimestamp(time_bag.first));
index e0429ca4a866577190803eda126fefabff461e1d..cfbf53538b966d3ce4029c5c118fd6c3058e8a1c 100644 (file)
@@ -87,7 +87,7 @@ ServiceCheckStatistics CIB::CalculateServiceCheckStats(void)
                count_execution_time++;
        }
 
-       ServiceCheckStatistics scs = {0};
+       ServiceCheckStatistics scs;
 
        scs.min_latency = min_latency;
        scs.max_latency = max_latency;
index 1b713e747bba356b409d2833e9f13436f1d02355..39c3d6a5eaf80a68081850d795eb021fe325a99e 100644 (file)
 namespace icinga
 {
 
-typedef struct {
+struct ServiceCheckStatistics {
     double min_latency;
     double max_latency;
     double avg_latency;
     double min_execution_time;
     double max_execution_time;
     double avg_execution_time;
-} ServiceCheckStatistics;
+};
 
-typedef struct {
+struct ServiceStatistics {
     double services_ok;
     double services_warning;
     double services_critical;
@@ -46,9 +46,9 @@ typedef struct {
     double services_flapping;
     double services_in_downtime;
     double services_acknowledged;
-} ServiceStatistics;
+};
 
-typedef struct {
+struct HostStatistics {
     double hosts_up;
     double hosts_down;
     double hosts_unreachable;
@@ -56,7 +56,7 @@ typedef struct {
     double hosts_flapping;
     double hosts_in_downtime;
     double hosts_acknowledged;
-} HostStatistics;
+};
 
 /**
  * Common Information Base class. Holds some statistics (and will likely be
index 8a7071b01bf1b3e1382ef86328b4203090ce522f..60dbb14be66b285a1bbcc2e32cd5eaa7de8ff08d 100644 (file)
@@ -204,7 +204,7 @@ void ApiListener::NewClientHandler(const Socket::Ptr& client, ConnectionRole rol
 
        Endpoint::Ptr endpoint = Endpoint::GetByName(identity);
 
-       bool need_sync;
+       bool need_sync = false;
 
        if (endpoint)
                need_sync = !endpoint->IsConnected();
index 9ede8ce8114068ae312381514c93cd108e9e39e5..ab95b26b11a881b00caccc5a1c5d33e2089a284c 100644 (file)
@@ -53,10 +53,10 @@ static void lb_init(lex_buf *lb)
        lb->size = 0;
 }
 
-static void lb_cleanup(lex_buf *lb)
+/*static void lb_cleanup(lex_buf *lb)
 {
        free(lb->buf);
-}
+}*/
 
 static void lb_append_char(lex_buf *lb, char new_char)
 {