From 96e214221d884934f1c00f4a2e75aa7b0152c3ff Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Wed, 13 Dec 2017 12:47:51 +0100 Subject: [PATCH] Remove unused variables --- icinga-app/icinga.cpp | 2 +- lib/base/utility.cpp | 2 +- lib/cli/consolecommand.cpp | 2 +- lib/config/expression.cpp | 2 +- lib/remote/apiclient.cpp | 6 +++--- lib/remote/apilistener.cpp | 2 +- lib/remote/filterutility.cpp | 2 +- lib/remote/httpclientconnection.cpp | 2 +- plugins/check_nscp_api.cpp | 4 ++-- plugins/check_service.cpp | 2 +- 10 files changed, 13 insertions(+), 13 deletions(-) diff --git a/icinga-app/icinga.cpp b/icinga-app/icinga.cpp index 597961ecc..f20670863 100644 --- a/icinga-app/icinga.cpp +++ b/icinga-app/icinga.cpp @@ -106,7 +106,7 @@ static int Main(void) try { autoindex = Convert::ToLong(argv[2]); - } catch (const std::invalid_argument& ex) { + } catch (const std::invalid_argument&) { Log(LogCritical, "icinga-app") << "Invalid index for --autocomplete: " << argv[2]; return EXIT_FAILURE; diff --git a/lib/base/utility.cpp b/lib/base/utility.cpp index fddc40cfc..24d5b1b92 100644 --- a/lib/base/utility.cpp +++ b/lib/base/utility.cpp @@ -1780,7 +1780,7 @@ String Utility::CreateTempFile(const String& path, int mode, std::fstream& fp) try { fp.open(&targetPath[0], std::ios_base::trunc | std::ios_base::out); - } catch (const std::fstream::failure& e) { + } catch (const std::fstream::failure&) { close(fd); throw; } diff --git a/lib/cli/consolecommand.cpp b/lib/cli/consolecommand.cpp index 89cb892bc..42a225b4a 100644 --- a/lib/cli/consolecommand.cpp +++ b/lib/cli/consolecommand.cpp @@ -515,7 +515,7 @@ void ConsoleCommand::ExecuteScriptCompletionHandler(boost::mutex& mutex, boost:: if (eptr) { try { boost::rethrow_exception(eptr); - } catch (const ScriptError& ex) { + } catch (const ScriptError&) { eptrOut = boost::current_exception(); } catch (const std::exception& ex) { Log(LogCritical, "ConsoleCommand") diff --git a/lib/config/expression.cpp b/lib/config/expression.cpp index a2a75f62f..f7dcb1a22 100644 --- a/lib/config/expression.cpp +++ b/lib/config/expression.cpp @@ -948,7 +948,7 @@ ExpressionResult TryExceptExpression::DoEvaluate(ScriptFrame& frame, DebugHint * try { ExpressionResult tryResult = m_TryBody->Evaluate(frame, dhint); CHECK_RESULT(tryResult); - } catch (const std::exception& ex) { + } catch (const std::exception&) { ExpressionResult exceptResult = m_ExceptBody->Evaluate(frame, dhint); CHECK_RESULT(exceptResult); } diff --git a/lib/remote/apiclient.cpp b/lib/remote/apiclient.cpp index 124c5b9d1..8cf41d38f 100644 --- a/lib/remote/apiclient.cpp +++ b/lib/remote/apiclient.cpp @@ -48,7 +48,7 @@ void ApiClient::GetTypes(const TypesCompletionCallback& callback) const req->AddHeader("Authorization", "Basic " + Base64::Encode(m_User + ":" + m_Password)); req->AddHeader("Accept", "application/json"); m_Connection->SubmitRequest(req, std::bind(TypesHttpCompletionCallback, _1, _2, callback)); - } catch (const std::exception& ex) { + } catch (const std::exception&) { callback(boost::current_exception(), std::vector()); } } @@ -133,7 +133,7 @@ void ApiClient::GetObjects(const String& pluralType, const ObjectsCompletionCall req->AddHeader("Authorization", "Basic " + Base64::Encode(m_User + ":" + m_Password)); req->AddHeader("Accept", "application/json"); m_Connection->SubmitRequest(req, std::bind(ObjectsHttpCompletionCallback, _1, _2, callback)); - } catch (const std::exception& ex) { + } catch (const std::exception&) { callback(boost::current_exception(), std::vector()); } } @@ -242,7 +242,7 @@ void ApiClient::ExecuteScript(const String& session, const String& command, bool req->AddHeader("Authorization", "Basic " + Base64::Encode(m_User + ":" + m_Password)); req->AddHeader("Accept", "application/json"); m_Connection->SubmitRequest(req, std::bind(ExecuteScriptHttpCompletionCallback, _1, _2, callback)); - } catch (const std::exception& ex) { + } catch (const std::exception&) { callback(boost::current_exception(), Empty); } } diff --git a/lib/remote/apilistener.cpp b/lib/remote/apilistener.cpp index 83e023728..1daf0352d 100644 --- a/lib/remote/apilistener.cpp +++ b/lib/remote/apilistener.cpp @@ -449,7 +449,7 @@ void ApiListener::NewClientHandlerInternal(const Socket::Ptr& client, const Stri try { tlsStream->Handshake(); - } catch (const std::exception& ex) { + } catch (const std::exception&) { Log(LogCritical, "ApiListener") << "Client TLS handshake failed (" << conninfo << ")"; return; diff --git a/lib/remote/filterutility.cpp b/lib/remote/filterutility.cpp index fbe0e0f29..8038314d6 100644 --- a/lib/remote/filterutility.cpp +++ b/lib/remote/filterutility.cpp @@ -271,7 +271,7 @@ std::vector FilterUtility::GetFilterTargets(const QueryDescription& qd, c provider->FindTargets(type, std::bind(&FilteredAddTarget, std::ref(permissionFrame), permissionFilter, std::ref(frame), ufilter, std::ref(result), variableName, _1)); - } catch (const std::exception& ex) { + } catch (const std::exception&) { delete ufilter; throw; } diff --git a/lib/remote/httpclientconnection.cpp b/lib/remote/httpclientconnection.cpp index 8cb6bbfdd..99ce94c09 100644 --- a/lib/remote/httpclientconnection.cpp +++ b/lib/remote/httpclientconnection.cpp @@ -115,7 +115,7 @@ bool HttpClientConnection::ProcessMessage(void) try { res = response.Parse(m_Context, false); - } catch (const std::exception& ex) { + } catch (const std::exception&) { callback(request, response); m_Stream->Shutdown(); diff --git a/plugins/check_nscp_api.cpp b/plugins/check_nscp_api.cpp index 116120c6c..a363dc6c9 100644 --- a/plugins/check_nscp_api.cpp +++ b/plugins/check_nscp_api.cpp @@ -146,7 +146,7 @@ static int FormatOutput(const Dictionary::Ptr& result) Dictionary::Ptr payload; try { payload = payloads->Get(0); - } catch (const std::exception& ex) { + } catch (const std::exception&) { std::cout << "UNKNOWN: Answer format error: 'payload' was not a Dictionary.\n"; return 3; } @@ -171,7 +171,7 @@ static int FormatOutput(const Dictionary::Ptr& result) Dictionary::Ptr line; try { line = vline; - } catch (const std::exception& ex) { + } catch (const std::exception&) { std::cout << "UNKNOWN: Answer format error: 'lines' entry was not a Dictionary.\n"; return 3; } diff --git a/plugins/check_service.cpp b/plugins/check_service.cpp index f5f0f463b..fbd7ef257 100644 --- a/plugins/check_service.cpp +++ b/plugins/check_service.cpp @@ -255,7 +255,7 @@ DWORD ServiceStatus(CONST printInfoStruct& printInfo) { SC_HANDLE hSCM; SC_HANDLE hService; - DWORD cbBufSize, lpServicesReturned, pcbBytesNeeded; + DWORD cbBufSize; DWORD lpResumeHandle = 0; LPBYTE lpBuf = NULL; -- 2.40.0