From 1ec7c223d47602b039d8618b149f1196b711363b Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Thu, 10 May 2012 13:46:04 +0200 Subject: [PATCH] Fixed more compilation warnings. --- base/application.cpp | 12 ++++++++---- base/base.vcxproj | 4 ++-- base/i2-base.h | 1 + base/socket.cpp | 4 ++-- base/tcpclient.cpp | 8 ++++---- base/tcpserver.cpp | 4 ++-- base/thread.cpp | 5 ++++- base/thread.h | 2 +- base/tlsclient.cpp | 8 ++++---- cJSON/cJSON.vcxproj | 4 ++-- components/configfile/configfile.vcxproj | 4 ++-- components/configrpc/configrpc.vcxproj | 4 ++-- components/demo/demo.vcxproj | 4 ++-- components/demo/democomponent.cpp | 4 ++-- components/discovery/discovery.vcxproj | 4 ++-- icinga-app/icinga-app.vcxproj | 4 ++-- icinga/icinga.vcxproj | 4 ++-- icinga/icingaapplication.cpp | 4 +--- icinga/jsonrpcendpoint.cpp | 2 +- jsonrpc/jsonrpc.vcxproj | 4 ++-- jsonrpc/jsonrpcclient.cpp | 4 ++-- mmatch/mmatch.vcxproj | 4 ++-- 22 files changed, 52 insertions(+), 46 deletions(-) diff --git a/base/application.cpp b/base/application.cpp index 907f91759..358837bee 100644 --- a/base/application.cpp +++ b/base/application.cpp @@ -226,11 +226,15 @@ Component::Ptr Application::LoadComponent(const string& path, throw ComponentLoadException("Could not load module"); #ifdef _WIN32 - pCreateComponent = (CreateComponentFunction)GetProcAddress(hModule, - "CreateComponent"); + pCreateComponent = reinterpret_cast(GetProcAddress(hModule, + "CreateComponent")); #else /* _WIN32 */ - pCreateComponent = (CreateComponentFunction)lt_dlsym(hModule, - "CreateComponent"); +# ifdef __GNUC__ + /* suppress compiler warning for void * cast */ + __extension__ +# endif + pCreateComponent = reinterpret_cast(lt_dlsym(hModule, + "CreateComponent")); #endif /* _WIN32 */ if (pCreateComponent == NULL) diff --git a/base/base.vcxproj b/base/base.vcxproj index e94e09843..3710e309d 100644 --- a/base/base.vcxproj +++ b/base/base.vcxproj @@ -105,9 +105,9 @@ - Level3 Disabled _WINDLL;I2_BASE_BUILD;_DEBUG;%(PreprocessorDefinitions) + Level3 Windows @@ -120,7 +120,6 @@ - Level3 MaxSpeed @@ -128,6 +127,7 @@ true _WINDLL;I2_BASE_BUILD;%(PreprocessorDefinitions) Speed + Level3 Windows diff --git a/base/i2-base.h b/base/i2-base.h index 6333c69b2..79422dcc8 100644 --- a/base/i2-base.h +++ b/base/i2-base.h @@ -24,6 +24,7 @@ # define HAVE_CXX11 # pragma warning(disable:4251) # define _CRT_SECURE_NO_DEPRECATE +# define _CRT_SECURE_NO_WARNINGS #else /* _MSC_VER */ # include "config.h" #endif /* _MSC_VER */ diff --git a/base/socket.cpp b/base/socket.cpp index dfdcb6cad..6b57a2116 100644 --- a/base/socket.cpp +++ b/base/socket.cpp @@ -170,10 +170,10 @@ void Socket::HandleSocketError(void) * * Processes errors that have occured for the socket. * - * @param ea Event arguments for the socket error. + * @param - Event arguments for the socket error. * @returns 0 */ -int Socket::ExceptionEventHandler(const EventArgs& ea) +int Socket::ExceptionEventHandler(const EventArgs&) { HandleSocketError(); diff --git a/base/tcpclient.cpp b/base/tcpclient.cpp index fb8b1ba09..894ae6055 100644 --- a/base/tcpclient.cpp +++ b/base/tcpclient.cpp @@ -146,10 +146,10 @@ FIFO::Ptr TCPClient::GetRecvQueue(void) * * Processes data that is available for this socket. * - * @param ea Event arguments. + * @param - Event arguments. * @returns 0 */ -int TCPClient::ReadableEventHandler(const EventArgs& ea) +int TCPClient::ReadableEventHandler(const EventArgs&) { int rc; @@ -183,10 +183,10 @@ int TCPClient::ReadableEventHandler(const EventArgs& ea) * * Processes data that can be written for this socket. * - * @param ea Event arguments. + * @param - Event arguments. * @returns 0 */ -int TCPClient::WritableEventHandler(const EventArgs& ea) +int TCPClient::WritableEventHandler(const EventArgs&) { int rc; diff --git a/base/tcpserver.cpp b/base/tcpserver.cpp index 07cf7525f..efa7041f6 100644 --- a/base/tcpserver.cpp +++ b/base/tcpserver.cpp @@ -88,10 +88,10 @@ void TCPServer::Listen(void) * Accepts a new client and creates a new client object for it * using the client factory function. * - * @param ea Event arguments. + * @param - Event arguments. * @returns 0 */ -int TCPServer::ReadableEventHandler(const EventArgs& ea) +int TCPServer::ReadableEventHandler(const EventArgs&) { int fd; sockaddr_storage addr; diff --git a/base/thread.cpp b/base/thread.cpp index fbf67f455..3cf9a10e8 100644 --- a/base/thread.cpp +++ b/base/thread.cpp @@ -57,13 +57,16 @@ static void *ThreadStartProc(void *param) * Constructor for the thread class. Creates a new thread that begins * executing immediately. */ -Thread::Thread(ThreadProc callback) +Thread::Thread(ThreadProc callback, void *param) { threadparam_t *tparam = new threadparam_t(); if (tparam == NULL) throw OutOfMemoryException("Out of memory"); + tparam->callback = callback; + tparam->param = param; + #ifdef _WIN32 m_Thread = CreateThread(NULL, 0, ThreadStartProc, tparam, CREATE_SUSPENDED, NULL); diff --git a/base/thread.h b/base/thread.h index 6f66b6495..34b51b96a 100644 --- a/base/thread.h +++ b/base/thread.h @@ -40,7 +40,7 @@ private: #endif public: - Thread(ThreadProc callback); + Thread(ThreadProc callback, void *param); ~Thread(void); void Join(void); diff --git a/base/tlsclient.cpp b/base/tlsclient.cpp index d5237bb79..5e3f57519 100644 --- a/base/tlsclient.cpp +++ b/base/tlsclient.cpp @@ -118,10 +118,10 @@ void TLSClient::Start(void) * * Processes data that is available for this socket. * - * @param ea Event arguments. + * @param - Event arguments. * @returns 0 */ -int TLSClient::ReadableEventHandler(const EventArgs& ea) +int TLSClient::ReadableEventHandler(const EventArgs&) { int rc; @@ -164,10 +164,10 @@ int TLSClient::ReadableEventHandler(const EventArgs& ea) * * Processes data that can be written for this socket. * - * @param ea Event arguments. + * @param - Event arguments. * @returns 0 */ -int TLSClient::WritableEventHandler(const EventArgs& ea) +int TLSClient::WritableEventHandler(const EventArgs&) { int rc; diff --git a/cJSON/cJSON.vcxproj b/cJSON/cJSON.vcxproj index 0d218cc03..3568a5482 100644 --- a/cJSON/cJSON.vcxproj +++ b/cJSON/cJSON.vcxproj @@ -48,9 +48,9 @@ - Level3 Disabled WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + Level3 Windows @@ -59,7 +59,6 @@ - Level3 MaxSpeed @@ -67,6 +66,7 @@ true WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) Speed + Level3 Windows diff --git a/components/configfile/configfile.vcxproj b/components/configfile/configfile.vcxproj index d21122a56..1f8708527 100644 --- a/components/configfile/configfile.vcxproj +++ b/components/configfile/configfile.vcxproj @@ -56,9 +56,9 @@ - Level3 Disabled WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + Level3 Windows @@ -72,7 +72,6 @@ - Level3 MaxSpeed @@ -80,6 +79,7 @@ true WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) Speed + Level3 Windows diff --git a/components/configrpc/configrpc.vcxproj b/components/configrpc/configrpc.vcxproj index de2fc3264..f42b96386 100644 --- a/components/configrpc/configrpc.vcxproj +++ b/components/configrpc/configrpc.vcxproj @@ -58,9 +58,9 @@ - Level3 Disabled WIN32;_DEBUG;_WINDOWS;_USRDLL;CONFIGCOMPONENT_EXPORTS;%(PreprocessorDefinitions) + Level3 Windows @@ -70,7 +70,6 @@ - Level3 MaxSpeed @@ -78,6 +77,7 @@ true WIN32;NDEBUG;_WINDOWS;_USRDLL;CONFIGCOMPONENT_EXPORTS;%(PreprocessorDefinitions) Speed + Level3 Windows diff --git a/components/demo/demo.vcxproj b/components/demo/demo.vcxproj index 87a7a9442..db011539a 100644 --- a/components/demo/demo.vcxproj +++ b/components/demo/demo.vcxproj @@ -51,9 +51,9 @@ - Level3 Disabled WIN32;_DEBUG;_WINDOWS;_USRDLL;DEMO_EXPORTS;%(PreprocessorDefinitions) + Level3 Windows @@ -63,13 +63,13 @@ - Level3 MaxSpeed true true WIN32;NDEBUG;_WINDOWS;_USRDLL;DEMO_EXPORTS;%(PreprocessorDefinitions) + Level3 Windows diff --git a/components/demo/democomponent.cpp b/components/demo/democomponent.cpp index 0e3d73eb1..0ea5fcc5f 100644 --- a/components/demo/democomponent.cpp +++ b/components/demo/democomponent.cpp @@ -74,10 +74,10 @@ void DemoComponent::Stop(void) * * Periodically sends a demo::HelloWorld message. * - * @param tea Event arguments for the timer. + * @param - Event arguments for the timer. * @returns 0 */ -int DemoComponent::DemoTimerHandler(const TimerEventArgs& tea) +int DemoComponent::DemoTimerHandler(const TimerEventArgs&) { Application::Log("Sending multicast 'hello world' message."); diff --git a/components/discovery/discovery.vcxproj b/components/discovery/discovery.vcxproj index 2dc598823..ff09b4f25 100644 --- a/components/discovery/discovery.vcxproj +++ b/components/discovery/discovery.vcxproj @@ -51,9 +51,9 @@ - Level3 Disabled WIN32;_DEBUG;_WINDOWS;_USRDLL;DISCOVERY_EXPORTS;%(PreprocessorDefinitions) + Level3 Windows @@ -63,13 +63,13 @@ - Level3 MaxSpeed true true WIN32;NDEBUG;_WINDOWS;_USRDLL;DISCOVERY_EXPORTS;%(PreprocessorDefinitions) + Level3 Windows diff --git a/icinga-app/icinga-app.vcxproj b/icinga-app/icinga-app.vcxproj index ea6bb9328..16a24dedf 100644 --- a/icinga-app/icinga-app.vcxproj +++ b/icinga-app/icinga-app.vcxproj @@ -55,9 +55,9 @@ - Level3 Disabled WIN32;I2_ICINGALAUNCHER_BUILD;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + Level3 Console @@ -67,7 +67,6 @@ - Level3 MaxSpeed @@ -75,6 +74,7 @@ true WIN32;I2_ICINGALAUNCHER_BUILD;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) Speed + Level3 Console diff --git a/icinga/icinga.vcxproj b/icinga/icinga.vcxproj index 3520d007d..c58a2675b 100644 --- a/icinga/icinga.vcxproj +++ b/icinga/icinga.vcxproj @@ -69,9 +69,9 @@ - Level3 Disabled WIN32;I2_ICINGA_BUILD;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + Level3 Console @@ -81,7 +81,6 @@ - Level3 MaxSpeed @@ -89,6 +88,7 @@ true WIN32;I2_ICINGA_BUILD;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) Speed + Level3 Console diff --git a/icinga/icingaapplication.cpp b/icinga/icingaapplication.cpp index ae6770f26..208863d12 100644 --- a/icinga/icingaapplication.cpp +++ b/icinga/icingaapplication.cpp @@ -167,11 +167,9 @@ int IcingaApplication::NewIcingaConfigHandler(const EventArgs& ea) return 0; } -int IcingaApplication::DeletedIcingaConfigHandler(const EventArgs& ea) +int IcingaApplication::DeletedIcingaConfigHandler(const EventArgs&) { throw Exception("Unsupported operation."); - - return 0; } void IcingaApplication::SetPrivateKeyFile(string privkey) diff --git a/icinga/jsonrpcendpoint.cpp b/icinga/jsonrpcendpoint.cpp index db8c2a439..3c3758752 100644 --- a/icinga/jsonrpcendpoint.cpp +++ b/icinga/jsonrpcendpoint.cpp @@ -108,7 +108,7 @@ int JsonRpcEndpoint::NewMessageHandler(const NewMessageEventArgs& nmea) return 0; } -int JsonRpcEndpoint::ClientClosedHandler(const EventArgs& ea) +int JsonRpcEndpoint::ClientClosedHandler(const EventArgs&) { Application::Log("Lost connection to endpoint: identity=" + GetIdentity()); diff --git a/jsonrpc/jsonrpc.vcxproj b/jsonrpc/jsonrpc.vcxproj index e595d6d80..1eaa212b9 100644 --- a/jsonrpc/jsonrpc.vcxproj +++ b/jsonrpc/jsonrpc.vcxproj @@ -66,9 +66,9 @@ - Level3 Disabled WIN32;I2_JSONRPC_BUILD;_DEBUG;_LIB;%(PreprocessorDefinitions) + Level3 Windows @@ -82,7 +82,6 @@ - Level3 MaxSpeed @@ -90,6 +89,7 @@ true WIN32;I2_JSONRPC_BUILD;NDEBUG;_LIB;%(PreprocessorDefinitions) Speed + Level3 Windows diff --git a/jsonrpc/jsonrpcclient.cpp b/jsonrpc/jsonrpcclient.cpp index 7e82d8091..b83331811 100644 --- a/jsonrpc/jsonrpcclient.cpp +++ b/jsonrpc/jsonrpcclient.cpp @@ -36,9 +36,9 @@ void JsonRpcClient::SendMessage(const Message& message) Netstring::WriteMessageToFIFO(GetSendQueue(), message); } -int JsonRpcClient::DataAvailableHandler(const EventArgs& ea) +int JsonRpcClient::DataAvailableHandler(const EventArgs&) { - while (true) { + for (;;) { try { Message message; diff --git a/mmatch/mmatch.vcxproj b/mmatch/mmatch.vcxproj index 40d9905b5..632e28d77 100644 --- a/mmatch/mmatch.vcxproj +++ b/mmatch/mmatch.vcxproj @@ -48,9 +48,9 @@ - Level3 Disabled WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + Level3 Windows @@ -59,13 +59,13 @@ - Level3 MaxSpeed true true WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + Level3 Windows -- 2.40.0