From dbe84b6e46f78b7bcabd8d7a72b5f2e10812c942 Mon Sep 17 00:00:00 2001 From: Lars Op den Kamp Date: Fri, 21 Sep 2012 20:06:27 +0200 Subject: [PATCH] silence some warnings. closes #47 --- include/cectypes.h | 10 +++++----- src/lib/adapter/Pulse-Eight/USBCECAdapterDetection.cpp | 2 +- src/lib/platform/posix/os-socket.h | 8 ++++---- src/lib/platform/posix/serialport.cpp | 3 ++- src/lib/platform/threads/mutex.h | 9 ++++++--- src/lib/platform/threads/threads.h | 2 +- 6 files changed, 19 insertions(+), 15 deletions(-) diff --git a/include/cectypes.h b/include/cectypes.h index 9c3ffec..f50c8db 100644 --- a/include/cectypes.h +++ b/include/cectypes.h @@ -1089,13 +1089,13 @@ typedef enum libcec_parameter_type CEC_PARAMETER_TYPE_UNKOWN } libcec_parameter_type; -struct libcec_parameter +typedef struct libcec_parameter { libcec_parameter_type paramType; /**< the type of this parameter */ void* paramData; /**< the value of this parameter */ -}; +} libcec_parameter; -struct libcec_configuration; +typedef struct libcec_configuration libcec_configuration; typedef int (CEC_CDECL* CBCecLogMessageType)(void *param, const cec_log_message &); typedef int (CEC_CDECL* CBCecKeyPressType)(void *param, const cec_keypress &); @@ -1219,7 +1219,7 @@ typedef enum cec_server_version CEC_SERVER_VERSION_1_9_0 = 0x1900 } cec_server_version; -typedef struct libcec_configuration +struct libcec_configuration { uint32_t clientVersion; /*!< the version of the client that is connecting */ char strDeviceName[13]; /*!< how to name the device on the CEC bus */ @@ -1345,7 +1345,7 @@ typedef struct libcec_configuration callbacks = NULL; } #endif -} libcec_configuration; +}; #ifdef __cplusplus }; diff --git a/src/lib/adapter/Pulse-Eight/USBCECAdapterDetection.cpp b/src/lib/adapter/Pulse-Eight/USBCECAdapterDetection.cpp index 5d72b5e..d441a48 100644 --- a/src/lib/adapter/Pulse-Eight/USBCECAdapterDetection.cpp +++ b/src/lib/adapter/Pulse-Eight/USBCECAdapterDetection.cpp @@ -440,7 +440,7 @@ uint8_t CUSBCECAdapterDetection::FindAdapters(cec_adapter *deviceList, uint8_t i tmp = (void *)strDevicePath; #endif - iBufSize = 0; /* silence "unused" warning on linux/osx */ + iBufSize = 0; if(!iBufSize){} /* silence "unused" warning on linux/osx */ return iFound; } diff --git a/src/lib/platform/posix/os-socket.h b/src/lib/platform/posix/os-socket.h index 7539aab..06df1e4 100644 --- a/src/lib/platform/posix/os-socket.h +++ b/src/lib/platform/posix/os-socket.h @@ -86,7 +86,7 @@ namespace PLATFORM { FD_ZERO(&port); FD_SET(socket, &port); - int returnv = select(socket + 1, NULL, &port, NULL, tv); + ssize_t returnv = (ssize_t)select(socket + 1, NULL, &port, NULL, tv); if (returnv < 0) { *iError = errno; @@ -145,7 +145,7 @@ namespace PLATFORM FD_ZERO(&port); FD_SET(socket, &port); - int32_t returnv = select(socket + 1, &port, NULL, NULL, tv); + ssize_t returnv = (ssize_t)select(socket + 1, &port, NULL, NULL, tv); if (returnv == -1) { @@ -228,7 +228,7 @@ namespace PLATFORM { if (iTimeoutMs > 0) { - int iPollResult = poll(&fds, 1, iTarget - iNow); + int iPollResult = poll(&fds, 1, (int)(iTarget - iNow)); if (iPollResult == 0) { *iError = ETIMEDOUT; @@ -305,7 +305,7 @@ namespace PLATFORM pfd.events = POLLOUT; pfd.revents = 0; - int iPollResult = poll(&pfd, 1, iTimeout); + int iPollResult = poll(&pfd, 1, (int)iTimeout); if (iPollResult == 0) *iError = ETIMEDOUT; else if (iPollResult == -1) diff --git a/src/lib/platform/posix/serialport.cpp b/src/lib/platform/posix/serialport.cpp index c1b3b22..0089521 100644 --- a/src/lib/platform/posix/serialport.cpp +++ b/src/lib/platform/posix/serialport.cpp @@ -60,6 +60,7 @@ inline bool RemoveLock(const char *strDeviceName) return dev_unlock(strDeviceName, 0) == 0; #else void *tmp = (void*)strDeviceName; // silence unused warning + tmp = NULL; return true; #endif } @@ -95,7 +96,7 @@ ssize_t CSerialSocket::Read(void* data, size_t len, uint64_t iTimeoutMs /* = 0 * //setting all this stuff up is a pain in the ass bool CSerialSocket::Open(uint64_t iTimeoutMs /* = 0 */) { - iTimeoutMs = 0; + iTimeoutMs = 0; if (!iTimeoutMs){} // silence unused warning if (IsOpen()) { m_iError = EINVAL; diff --git a/src/lib/platform/threads/mutex.h b/src/lib/platform/threads/mutex.h index 00953db..286cc32 100644 --- a/src/lib/platform/threads/mutex.h +++ b/src/lib/platform/threads/mutex.h @@ -86,9 +86,12 @@ namespace PLATFORM inline bool Lock(void) { - MutexLock(m_mutex); - ++m_iLockCount; - return true; + if (MutexLock(m_mutex)) + { + ++m_iLockCount; + return true; + } + return false; } inline void Unlock(void) diff --git a/src/lib/platform/threads/threads.h b/src/lib/platform/threads/threads.h index 3647770..d99cbf6 100644 --- a/src/lib/platform/threads/threads.h +++ b/src/lib/platform/threads/threads.h @@ -49,7 +49,7 @@ namespace PLATFORM StopThread(0); void *retVal = NULL; if (m_thread != INVALID_THREAD_VALUE) - ThreadsWait(m_thread, &retVal); + if (ThreadsWait(m_thread, &retVal)){}; // silence unused warning } static void *ThreadHandler(CThread *thread) -- 2.34.1