diff --git a/components/demo/democomponent.cpp b/components/demo/democomponent.cpp index 19145330c..1b4ab06d7 100644 --- a/components/demo/democomponent.cpp +++ b/components/demo/democomponent.cpp @@ -66,7 +66,7 @@ void DemoComponent::DemoTimerHandler(void) * Processes demo::HelloWorld messages. */ void DemoComponent::HelloWorldRequestHandler(const Endpoint::Ptr& sender, - const RequestMessage& request) + const RequestMessage&) { Logger::Write(LogInformation, "demo", "Got 'hello world' from identity=" + (sender ? sender->GetName() : "(anonymous)")); diff --git a/lib/base/application.cpp b/lib/base/application.cpp index e93ff13d0..e0a77022a 100644 --- a/lib/base/application.cpp +++ b/lib/base/application.cpp @@ -349,10 +349,7 @@ BOOL WINAPI Application::CtrlHandler(DWORD type) */ void Application::ExceptionHandler(void) { - static bool rethrow = true; - try { - rethrow = false; throw; } catch (const std::exception& ex) { std::cerr << std::endl; diff --git a/lib/base/stream_bio.cpp b/lib/base/stream_bio.cpp index 020b79acc..885bdaa04 100644 --- a/lib/base/stream_bio.cpp +++ b/lib/base/stream_bio.cpp @@ -127,7 +127,7 @@ static int I2Stream_write(BIO *bi, const char *in, int inl) return inl; } -static long I2Stream_ctrl(BIO *bi, int cmd, long num, void *ptr) +static long I2Stream_ctrl(BIO *, int cmd, long, void *) { switch (cmd) { case BIO_CTRL_FLUSH: diff --git a/lib/base/unixsocket.cpp b/lib/base/unixsocket.cpp index d90978852..8cf7ea277 100644 --- a/lib/base/unixsocket.cpp +++ b/lib/base/unixsocket.cpp @@ -36,7 +36,8 @@ void UnixSocket::Bind(const String& path) { unlink(path.CStr()); - sockaddr_un sun = {}; + sockaddr_un sun; + memset(&sun, 0, sizeof(sun)); sun.sun_family = AF_UNIX; strncpy(sun.sun_path, path.CStr(), sizeof(sun.sun_path)); sun.sun_path[sizeof(sun.sun_path) - 1] = '\0'; @@ -47,7 +48,8 @@ void UnixSocket::Bind(const String& path) void UnixSocket::Connect(const String& path) { - sockaddr_un sun = {}; + sockaddr_un sun; + memset(&sun, 0, sizeof(sun)); sun.sun_family = AF_UNIX; strncpy(sun.sun_path, path.CStr(), sizeof(sun.sun_path)); sun.sun_path[sizeof(sun.sun_path) - 1] = '\0'; diff --git a/lib/config/configtype.cpp b/lib/config/configtype.cpp index bc23a68b0..c4ff22b15 100644 --- a/lib/config/configtype.cpp +++ b/lib/config/configtype.cpp @@ -72,7 +72,7 @@ void ConfigType::ValidateDictionary(const Dictionary::Ptr& dictionary, const Typ String key; Value value; BOOST_FOREACH(tie(key, value), dictionary) { - + // TODO: implement (#3619) } } diff --git a/lib/icinga/externalcommandprocessor.cpp b/lib/icinga/externalcommandprocessor.cpp index 527037683..110b147d8 100644 --- a/lib/icinga/externalcommandprocessor.cpp +++ b/lib/icinga/externalcommandprocessor.cpp @@ -57,7 +57,6 @@ void ExternalCommandProcessor::Execute(const String& line) void ExternalCommandProcessor::Execute(double time, const String& command, const vector& arguments) { if (!m_Initialized) { - RegisterCommand("HELLO_WORLD", &ExternalCommandProcessor::HelloWorld); RegisterCommand("PROCESS_SERVICE_CHECK_RESULT", &ExternalCommandProcessor::ProcessServiceCheckResult); RegisterCommand("SCHEDULE_SVC_CHECK", &ExternalCommandProcessor::ScheduleSvcCheck); RegisterCommand("SCHEDULE_FORCED_SVC_CHECK", &ExternalCommandProcessor::ScheduleForcedSvcCheck); @@ -118,11 +117,6 @@ void ExternalCommandProcessor::RegisterCommand(const String& command, const Exte m_Commands[command] = callback; } -void ExternalCommandProcessor::HelloWorld(double time, const vector& arguments) -{ - Logger::Write(LogInformation, "icinga", "HelloWorld external command called."); -} - void ExternalCommandProcessor::ProcessServiceCheckResult(double time, const vector& arguments) { if (arguments.size() < 4) @@ -140,11 +134,10 @@ void ExternalCommandProcessor::ProcessServiceCheckResult(double time, const vect Dictionary::Ptr result = PluginCheckTask::ParseCheckOutput(arguments[3]); result->Set("state", PluginCheckTask::ExitStatusToState(exitStatus)); - double now = Utility::GetTime(); - result->Set("schedule_start", now); - result->Set("schedule_end", now); - result->Set("execution_start", now); - result->Set("execution_end", now); + result->Set("schedule_start", time); + result->Set("schedule_end", time); + result->Set("execution_start", time); + result->Set("execution_end", time); result->Set("active", 0); Logger::Write(LogInformation, "icinga", "Processing passive check result for service '" + arguments[1] + "'"); @@ -156,7 +149,7 @@ void ExternalCommandProcessor::ProcessServiceCheckResult(double time, const vect service->SetNextCheck(Utility::GetTime() + service->GetCheckInterval()); } -void ExternalCommandProcessor::ScheduleSvcCheck(double time, const vector& arguments) +void ExternalCommandProcessor::ScheduleSvcCheck(double, const vector& arguments) { if (arguments.size() < 3) throw_exception(invalid_argument("Expected 3 arguments.")); @@ -178,7 +171,7 @@ void ExternalCommandProcessor::ScheduleSvcCheck(double time, const vectorSetNextCheck(planned_check); } -void ExternalCommandProcessor::ScheduleForcedSvcCheck(double time, const vector& arguments) +void ExternalCommandProcessor::ScheduleForcedSvcCheck(double, const vector& arguments) { if (arguments.size() < 3) throw_exception(invalid_argument("Expected 3 arguments.")); @@ -193,7 +186,7 @@ void ExternalCommandProcessor::ScheduleForcedSvcCheck(double time, const vector< service->SetNextCheck(Convert::ToDouble(arguments[2])); } -void ExternalCommandProcessor::EnableSvcCheck(double time, const vector& arguments) +void ExternalCommandProcessor::EnableSvcCheck(double, const vector& arguments) { if (arguments.size() < 2) throw_exception(invalid_argument("Expected 2 arguments.")); @@ -207,7 +200,7 @@ void ExternalCommandProcessor::EnableSvcCheck(double time, const vector& service->SetEnableActiveChecks(true); } -void ExternalCommandProcessor::DisableSvcCheck(double time, const vector& arguments) +void ExternalCommandProcessor::DisableSvcCheck(double, const vector& arguments) { if (arguments.size() < 2) throw_exception(invalid_argument("Expected 2 arguments.")); @@ -221,13 +214,13 @@ void ExternalCommandProcessor::DisableSvcCheck(double time, const vector service->SetEnableActiveChecks(false); } -void ExternalCommandProcessor::ShutdownProcess(double time, const vector& arguments) +void ExternalCommandProcessor::ShutdownProcess(double, const vector&) { Logger::Write(LogInformation, "icinga", "Shutting down Icinga via external command."); Application::RequestShutdown(); } -void ExternalCommandProcessor::ScheduleForcedHostSvcChecks(double time, const vector& arguments) +void ExternalCommandProcessor::ScheduleForcedHostSvcChecks(double, const vector& arguments) { if (arguments.size() < 2) throw_exception(invalid_argument("Expected 2 arguments.")); @@ -246,7 +239,7 @@ void ExternalCommandProcessor::ScheduleForcedHostSvcChecks(double time, const ve } } -void ExternalCommandProcessor::ScheduleHostSvcChecks(double time, const vector& arguments) +void ExternalCommandProcessor::ScheduleHostSvcChecks(double, const vector& arguments) { if (arguments.size() < 2) throw_exception(invalid_argument("Expected 2 arguments.")); @@ -270,7 +263,7 @@ void ExternalCommandProcessor::ScheduleHostSvcChecks(double time, const vector& arguments) +void ExternalCommandProcessor::EnableHostSvcChecks(double, const vector& arguments) { if (arguments.size() < 1) throw_exception(invalid_argument("Expected 1 argument.")); @@ -286,7 +279,7 @@ void ExternalCommandProcessor::EnableHostSvcChecks(double time, const vector& arguments) +void ExternalCommandProcessor::DisableHostSvcChecks(double, const vector& arguments) { if (arguments.size() < 1) throw_exception(invalid_argument("Expected 1 arguments.")); @@ -302,7 +295,7 @@ void ExternalCommandProcessor::DisableHostSvcChecks(double time, const vector& arguments) +void ExternalCommandProcessor::AcknowledgeSvcProblem(double, const vector& arguments) { if (arguments.size() < 7) throw_exception(invalid_argument("Expected 7 arguments.")); @@ -322,7 +315,7 @@ void ExternalCommandProcessor::AcknowledgeSvcProblem(double time, const vectorSetAcknowledgementExpiry(0); } -void ExternalCommandProcessor::AcknowledgeSvcProblemExpire(double time, const vector& arguments) +void ExternalCommandProcessor::AcknowledgeSvcProblemExpire(double, const vector& arguments) { if (arguments.size() < 8) throw_exception(invalid_argument("Expected 8 arguments.")); @@ -343,7 +336,7 @@ void ExternalCommandProcessor::AcknowledgeSvcProblemExpire(double time, const ve service->SetAcknowledgementExpiry(timestamp); } -void ExternalCommandProcessor::RemoveSvcAcknowledgement(double time, const vector& arguments) +void ExternalCommandProcessor::RemoveSvcAcknowledgement(double, const vector& arguments) { if (arguments.size() < 2) throw_exception(invalid_argument("Expected 2 arguments.")); @@ -358,7 +351,7 @@ void ExternalCommandProcessor::RemoveSvcAcknowledgement(double time, const vecto service->SetAcknowledgementExpiry(0); } -void ExternalCommandProcessor::AcknowledgeHostProblem(double time, const vector& arguments) +void ExternalCommandProcessor::AcknowledgeHostProblem(double, const vector& arguments) { if (arguments.size() < 6) throw_exception(invalid_argument("Expected 6 arguments.")); @@ -378,7 +371,7 @@ void ExternalCommandProcessor::AcknowledgeHostProblem(double time, const vector< host->SetAcknowledgementExpiry(0); } -void ExternalCommandProcessor::AcknowledgeHostProblemExpire(double time, const vector& arguments) +void ExternalCommandProcessor::AcknowledgeHostProblemExpire(double, const vector& arguments) { if (arguments.size() < 7) throw_exception(invalid_argument("Expected 7 arguments.")); @@ -399,7 +392,7 @@ void ExternalCommandProcessor::AcknowledgeHostProblemExpire(double time, const v host->SetAcknowledgementExpiry(timestamp); } -void ExternalCommandProcessor::RemoveHostAcknowledgement(double time, const vector& arguments) +void ExternalCommandProcessor::RemoveHostAcknowledgement(double, const vector& arguments) { if (arguments.size() < 1) throw_exception(invalid_argument("Expected 1 argument.")); @@ -414,7 +407,7 @@ void ExternalCommandProcessor::RemoveHostAcknowledgement(double time, const vect host->SetAcknowledgementExpiry(0); } -void ExternalCommandProcessor::EnableHostgroupSvcChecks(double time, const vector& arguments) +void ExternalCommandProcessor::EnableHostgroupSvcChecks(double, const vector& arguments) { if (arguments.size() < 1) throw_exception(invalid_argument("Expected 1 argument.")); @@ -432,7 +425,7 @@ void ExternalCommandProcessor::EnableHostgroupSvcChecks(double time, const vecto } } -void ExternalCommandProcessor::DisableHostgroupSvcChecks(double time, const vector& arguments) +void ExternalCommandProcessor::DisableHostgroupSvcChecks(double, const vector& arguments) { if (arguments.size() < 1) throw_exception(invalid_argument("Expected 1 argument.")); @@ -450,7 +443,7 @@ void ExternalCommandProcessor::DisableHostgroupSvcChecks(double time, const vect } } -void ExternalCommandProcessor::EnableServicegroupSvcChecks(double time, const vector& arguments) +void ExternalCommandProcessor::EnableServicegroupSvcChecks(double, const vector& arguments) { if (arguments.size() < 1) throw_exception(invalid_argument("Expected 1 argument.")); @@ -466,7 +459,7 @@ void ExternalCommandProcessor::EnableServicegroupSvcChecks(double time, const ve } } -void ExternalCommandProcessor::DisableServicegroupSvcChecks(double time, const vector& arguments) +void ExternalCommandProcessor::DisableServicegroupSvcChecks(double, const vector& arguments) { if (arguments.size() < 1) throw_exception(invalid_argument("Expected 1 argument.")); @@ -482,7 +475,7 @@ void ExternalCommandProcessor::DisableServicegroupSvcChecks(double time, const v } } -void ExternalCommandProcessor::EnablePassiveSvcChecks(double time, const vector& arguments) +void ExternalCommandProcessor::EnablePassiveSvcChecks(double, const vector& arguments) { if (arguments.size() < 2) throw_exception(invalid_argument("Expected 2 arguments.")); @@ -496,7 +489,7 @@ void ExternalCommandProcessor::EnablePassiveSvcChecks(double time, const vector< service->SetEnablePassiveChecks(true); } -void ExternalCommandProcessor::DisablePassiveSvcChecks(double time, const vector& arguments) +void ExternalCommandProcessor::DisablePassiveSvcChecks(double, const vector& arguments) { if (arguments.size() < 2) throw_exception(invalid_argument("Expected 2 arguments.")); @@ -510,7 +503,7 @@ void ExternalCommandProcessor::DisablePassiveSvcChecks(double time, const vector service->SetEnablePassiveChecks(false); } -void ExternalCommandProcessor::EnableServicegroupPassiveSvcChecks(double time, const vector& arguments) +void ExternalCommandProcessor::EnableServicegroupPassiveSvcChecks(double, const vector& arguments) { if (arguments.size() < 1) throw_exception(invalid_argument("Expected 1 argument.")); @@ -526,7 +519,7 @@ void ExternalCommandProcessor::EnableServicegroupPassiveSvcChecks(double time, c } } -void ExternalCommandProcessor::DisableServicegroupPassiveSvcChecks(double time, const vector& arguments) +void ExternalCommandProcessor::DisableServicegroupPassiveSvcChecks(double, const vector& arguments) { if (arguments.size() < 1) throw_exception(invalid_argument("Expected 1 argument.")); @@ -542,7 +535,7 @@ void ExternalCommandProcessor::DisableServicegroupPassiveSvcChecks(double time, } } -void ExternalCommandProcessor::EnableHostgroupPassiveSvcChecks(double time, const vector& arguments) +void ExternalCommandProcessor::EnableHostgroupPassiveSvcChecks(double, const vector& arguments) { if (arguments.size() < 1) throw_exception(invalid_argument("Expected 1 argument.")); @@ -560,7 +553,7 @@ void ExternalCommandProcessor::EnableHostgroupPassiveSvcChecks(double time, cons } } -void ExternalCommandProcessor::DisableHostgroupPassiveSvcChecks(double time, const vector& arguments) +void ExternalCommandProcessor::DisableHostgroupPassiveSvcChecks(double, const vector& arguments) { if (arguments.size() < 1) throw_exception(invalid_argument("Expected 1 argument.")); @@ -578,7 +571,7 @@ void ExternalCommandProcessor::DisableHostgroupPassiveSvcChecks(double time, con } } -void ExternalCommandProcessor::ProcessFile(double time, const vector& arguments) +void ExternalCommandProcessor::ProcessFile(double, const vector& arguments) { if (arguments.size() < 2) throw_exception(invalid_argument("Expected 2 arguments.")); @@ -612,7 +605,7 @@ void ExternalCommandProcessor::ProcessFile(double time, const vector& ar (void) unlink(file.CStr()); } -void ExternalCommandProcessor::ScheduleSvcDowntime(double time, const vector& arguments) +void ExternalCommandProcessor::ScheduleSvcDowntime(double, const vector& arguments) { if (arguments.size() < 9) throw_exception(invalid_argument("Expected 9 arguments.")); @@ -633,7 +626,7 @@ void ExternalCommandProcessor::ScheduleSvcDowntime(double time, const vector& arguments) +void ExternalCommandProcessor::DelSvcDowntime(double, const vector& arguments) { if (arguments.size() < 1) throw_exception(invalid_argument("Expected 1 argument.")); @@ -644,7 +637,7 @@ void ExternalCommandProcessor::DelSvcDowntime(double time, const vector& DowntimeProcessor::RemoveDowntime(rid); } -void ExternalCommandProcessor::ScheduleHostDowntime(double time, const vector& arguments) +void ExternalCommandProcessor::ScheduleHostDowntime(double, const vector& arguments) { if (arguments.size() < 8) throw_exception(invalid_argument("Expected 8 arguments.")); @@ -665,7 +658,7 @@ void ExternalCommandProcessor::ScheduleHostDowntime(double time, const vector& arguments) +void ExternalCommandProcessor::DelHostDowntime(double, const vector& arguments) { if (arguments.size() < 1) throw_exception(invalid_argument("Expected 1 argument.")); @@ -676,7 +669,7 @@ void ExternalCommandProcessor::DelHostDowntime(double time, const vector DowntimeProcessor::RemoveDowntime(rid); } -void ExternalCommandProcessor::ScheduleHostSvcDowntime(double time, const vector& arguments) +void ExternalCommandProcessor::ScheduleHostSvcDowntime(double, const vector& arguments) { if (arguments.size() < 8) throw_exception(invalid_argument("Expected 8 argument.")); @@ -704,7 +697,7 @@ void ExternalCommandProcessor::ScheduleHostSvcDowntime(double time, const vector } } -void ExternalCommandProcessor::ScheduleHostgroupHostDowntime(double time, const vector& arguments) +void ExternalCommandProcessor::ScheduleHostgroupHostDowntime(double, const vector& arguments) { if (arguments.size() < 8) throw_exception(invalid_argument("Expected 8 arguments.")); @@ -727,7 +720,7 @@ void ExternalCommandProcessor::ScheduleHostgroupHostDowntime(double time, const } } -void ExternalCommandProcessor::ScheduleHostgroupSvcDowntime(double time, const vector& arguments) +void ExternalCommandProcessor::ScheduleHostgroupSvcDowntime(double, const vector& arguments) { if (arguments.size() < 8) throw_exception(invalid_argument("Expected 8 arguments.")); @@ -762,7 +755,7 @@ void ExternalCommandProcessor::ScheduleHostgroupSvcDowntime(double time, const v } } -void ExternalCommandProcessor::ScheduleServicegroupHostDowntime(double time, const vector& arguments) +void ExternalCommandProcessor::ScheduleServicegroupHostDowntime(double, const vector& arguments) { if (arguments.size() < 8) throw_exception(invalid_argument("Expected 8 arguments.")); @@ -795,7 +788,7 @@ void ExternalCommandProcessor::ScheduleServicegroupHostDowntime(double time, con } } -void ExternalCommandProcessor::ScheduleServicegroupSvcDowntime(double time, const vector& arguments) +void ExternalCommandProcessor::ScheduleServicegroupSvcDowntime(double, const vector& arguments) { if (arguments.size() < 8) throw_exception(invalid_argument("Expected 8 arguments.")); @@ -818,7 +811,7 @@ void ExternalCommandProcessor::ScheduleServicegroupSvcDowntime(double time, cons } } -void ExternalCommandProcessor::AddHostComment(double time, const vector& arguments) +void ExternalCommandProcessor::AddHostComment(double, const vector& arguments) { if (arguments.size() < 4) throw_exception(invalid_argument("Expected 4 arguments.")); @@ -832,7 +825,7 @@ void ExternalCommandProcessor::AddHostComment(double time, const vector& (void) CommentProcessor::AddComment(host, Comment_User, arguments[2], arguments[3], 0); } -void ExternalCommandProcessor::DelHostComment(double time, const vector& arguments) +void ExternalCommandProcessor::DelHostComment(double, const vector& arguments) { if (arguments.size() < 1) throw_exception(invalid_argument("Expected 1 argument.")); @@ -843,7 +836,7 @@ void ExternalCommandProcessor::DelHostComment(double time, const vector& CommentProcessor::RemoveComment(rid); } -void ExternalCommandProcessor::AddSvcComment(double time, const vector& arguments) +void ExternalCommandProcessor::AddSvcComment(double, const vector& arguments) { if (arguments.size() < 5) throw_exception(invalid_argument("Expected 5 arguments.")); @@ -857,7 +850,7 @@ void ExternalCommandProcessor::AddSvcComment(double time, const vector& (void) CommentProcessor::AddComment(service, Comment_User, arguments[3], arguments[4], 0); } -void ExternalCommandProcessor::DelSvcComment(double time, const vector& arguments) +void ExternalCommandProcessor::DelSvcComment(double, const vector& arguments) { if (arguments.size() < 1) throw_exception(invalid_argument("Expected 1 argument.")); @@ -869,7 +862,7 @@ void ExternalCommandProcessor::DelSvcComment(double time, const vector& CommentProcessor::RemoveComment(rid); } -void ExternalCommandProcessor::DelAllHostComments(double time, const vector& arguments) +void ExternalCommandProcessor::DelAllHostComments(double, const vector& arguments) { if (arguments.size() < 1) throw_exception(invalid_argument("Expected 1 argument.")); @@ -883,7 +876,7 @@ void ExternalCommandProcessor::DelAllHostComments(double time, const vector& arguments) +void ExternalCommandProcessor::DelAllSvcComments(double, const vector& arguments) { if (arguments.size() < 2) throw_exception(invalid_argument("Expected 2 arguments.")); diff --git a/lib/icinga/externalcommandprocessor.h b/lib/icinga/externalcommandprocessor.h index a1e8dbe5f..49a3e5da9 100644 --- a/lib/icinga/externalcommandprocessor.h +++ b/lib/icinga/externalcommandprocessor.h @@ -28,7 +28,6 @@ public: static void Execute(const String& line); static void Execute(double time, const String& command, const vector& arguments); - static void HelloWorld(double time, const vector& arguments); static void ProcessServiceCheckResult(double time, const vector& arguments); static void ScheduleSvcCheck(double time, const vector& arguments); static void ScheduleForcedSvcCheck(double time, const vector& arguments); diff --git a/lib/icinga/host.cpp b/lib/icinga/host.cpp index 97c0f8079..6a4977721 100644 --- a/lib/icinga/host.cpp +++ b/lib/icinga/host.cpp @@ -313,7 +313,7 @@ void Host::ObjectRemovedHandler(const ConfigItem::Ptr& item) } } -void Host::OnAttributeChanged(const String& name, const Value& oldValue) +void Host::OnAttributeChanged(const String& name, const Value&) { if (name == "hostgroups") HostGroup::InvalidateMembersCache();