diff options
125 files changed, 388 insertions, 584 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 70ccdbba..ce47949c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -73,12 +73,12 @@ ENDIF() set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99") # Tell the compiler to be stringent -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wformat=2") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wformat=2") +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat=2 -Wvla") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wformat=2 -Wvla") # Make sure we catch these issues whilst developing IF(CMAKE_BUILD_TYPE MATCHES Debug) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror -Werror=vla") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Werror=vla") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror") ENDIF() # clang doesn't support format_arg, which breaks this warning if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") diff --git a/common/os/CMakeLists.txt b/common/os/CMakeLists.txt index 7644341a..e93c74b5 100644 --- a/common/os/CMakeLists.txt +++ b/common/os/CMakeLists.txt @@ -3,7 +3,6 @@ include_directories(${CMAKE_SOURCE_DIR}/common) add_library(os STATIC Mutex.cxx Thread.cxx - w32tiger.c os.cxx) if(UNIX) diff --git a/common/os/os.h b/common/os/os.h index 9b1de597..d0717fd0 100644 --- a/common/os/os.h +++ b/common/os/os.h @@ -19,8 +19,6 @@ #ifndef OS_OS_H #define OS_OS_H -#include <os/w32tiger.h> - /* * Get VNC home directory ($HOME/.vnc or %APPDATA%/vnc/). * If HOME environment variable is set then it is used. diff --git a/common/os/w32tiger.c b/common/os/w32tiger.c deleted file mode 100644 index 3427cf48..00000000 --- a/common/os/w32tiger.c +++ /dev/null @@ -1,33 +0,0 @@ -/* Copyright (C) 2011 TigerVNC Team. All Rights Reserved. - * - * This is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this software; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, - * USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#ifdef WIN32 - -#define INITGUID -#include <basetyps.h> - -#ifndef HAVE_ACTIVE_DESKTOP_L -DEFINE_GUID(CLSID_ActiveDesktop,0x75048700L,0xEF1F,0x11D0,0x98,0x88,0x00,0x60,0x97,0xDE,0xAC,0xF9); -DEFINE_GUID(IID_IActiveDesktop,0xF490EB00L,0x1240,0x11D1,0x98,0x88,0x00,0x60,0x97,0xDE,0xAC,0xF9); -#endif - -#endif /* WIN32 */ diff --git a/common/os/w32tiger.h b/common/os/w32tiger.h deleted file mode 100644 index d09994f2..00000000 --- a/common/os/w32tiger.h +++ /dev/null @@ -1,187 +0,0 @@ -/* Copyright (C) 2011 TigerVNC Team. All Rights Reserved. - * - * This is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this software; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, - * USA. - */ - -#ifndef OS_W32TIGER_H -#define OS_W32TIGER_H - -#ifdef WIN32 - -#include <windows.h> -#include <wininet.h> -#include <shlobj.h> -#include <shlguid.h> -#include <wininet.h> - - -/* Windows has different names for these */ -#define strcasecmp _stricmp -#define strncasecmp _strnicmp - - -/* MSLLHOOKSTRUCT structure*/ -#ifndef LLMHF_INJECTED -#define LLMHF_INJECTED 0x00000001 -#endif - - -/* IActiveDesktop. As of 2011-10-12, MinGW does not define - IActiveDesktop in any way (see tracker 2877129), while MinGW64 is - broken: has the headers but not the lib symbols. */ -#ifndef HAVE_ACTIVE_DESKTOP_H -extern const GUID CLSID_ActiveDesktop; -extern const GUID IID_IActiveDesktop; - -/* IActiveDesktop::AddUrl */ -#define ADDURL_SILENT 0x0001 - -/* IActiveDesktop::AddDesktopItemWithUI */ -#define DTI_ADDUI_DEFAULT 0x00000000 -#define DTI_ADDUI_DISPSUBWIZARD 0x00000001 -#define DTI_ADDUI_POSITIONITEM 0x00000002 - -/* IActiveDesktop::ModifyDesktopItem */ -#define COMP_ELEM_TYPE 0x00000001 -#define COMP_ELEM_CHECKED 0x00000002 -#define COMP_ELEM_DIRTY 0x00000004 -#define COMP_ELEM_NOSCROLL 0x00000008 -#define COMP_ELEM_POS_LEFT 0x00000010 -#define COMP_ELEM_POS_TOP 0x00000020 -#define COMP_ELEM_SIZE_WIDTH 0x00000040 -#define COMP_ELEM_SIZE_HEIGHT 0x00000080 -#define COMP_ELEM_POS_ZINDEX 0x00000100 -#define COMP_ELEM_SOURCE 0x00000200 -#define COMP_ELEM_FRIENDLYNAME 0x00000400 -#define COMP_ELEM_SUBSCRIBEDURL 0x00000800 -#define COMP_ELEM_ORIGINAL_CSI 0x00001000 -#define COMP_ELEM_RESTORED_CSI 0x00002000 -#define COMP_ELEM_CURITEMSTATE 0x00004000 -#define COMP_ELEM_ALL 0x00007FFF /* OR-ed all COMP_ELEM_ */ - -/* IActiveDesktop::GetWallpaper */ -#define AD_GETWP_BMP 0x00000000 -#define AD_GETWP_IMAGE 0x00000001 -#define AD_GETWP_LAST_APPLIED 0x00000002 - -/* IActiveDesktop::ApplyChanges */ -#define AD_APPLY_SAVE 0x00000001 -#define AD_APPLY_HTMLGEN 0x00000002 -#define AD_APPLY_REFRESH 0x00000004 -#define AD_APPLY_ALL 0x00000007 /* OR-ed three AD_APPLY_ above */ -#define AD_APPLY_FORCE 0x00000008 -#define AD_APPLY_BUFFERED_REFRESH 0x00000010 -#define AD_APPLY_DYNAMICREFRESH 0x00000020 - -/* Structures for IActiveDesktop */ -typedef struct { - DWORD dwSize; - int iLeft; - int iTop; - DWORD dwWidth; - DWORD dwHeight; - DWORD dwItemState; -} COMPSTATEINFO, *LPCOMPSTATEINFO; -typedef const COMPSTATEINFO *LPCCOMPSTATEINFO; - -typedef struct { - DWORD dwSize; - int iLeft; - int iTop; - DWORD dwWidth; - DWORD dwHeight; - int izIndex; - BOOL fCanResize; - BOOL fCanResizeX; - BOOL fCanResizeY; - int iPreferredLeftPercent; - int iPreferredTopPercent; -} COMPPOS, *LPCOMPPOS; -typedef const COMPPOS *LPCCOMPPOS; - -typedef struct { - DWORD dwSize; - DWORD dwID; - int iComponentType; - BOOL fChecked; - BOOL fDirty; - BOOL fNoScroll; - COMPPOS cpPos; - WCHAR wszFriendlyName[MAX_PATH]; - WCHAR wszSource[INTERNET_MAX_URL_LENGTH]; - WCHAR wszSubscribedURL[INTERNET_MAX_URL_LENGTH]; - DWORD dwCurItemState; - COMPSTATEINFO csiOriginal; - COMPSTATEINFO csiRestored; -} COMPONENT, *LPCOMPONENT; -typedef const COMPONENT *LPCCOMPONENT; - -typedef struct { - DWORD dwSize; - BOOL fEnableComponents; - BOOL fActiveDesktop; -} COMPONENTSOPT, *LPCOMPONENTSOPT; -typedef const COMPONENTSOPT *LPCCOMPONENTSOPT; - -typedef struct { - DWORD dwSize; - DWORD dwStyle; -} WALLPAPEROPT, *LPWALLPAPEROPT; -typedef const WALLPAPEROPT *LPCWALLPAPEROPT; - -/* WALLPAPEROPT styles */ -#define WPSTYLE_CENTER 0x0 -#define WPSTYLE_TILE 0x1 -#define WPSTYLE_STRETCH 0x2 -#define WPSTYLE_MAX 0x3 - -/* Those two are defined in Windows 7 and newer, we don't need them now */ -#if 0 -#define WPSTYLE_KEEPASPECT 0x3 -#define WPSTYLE_CROPTOFIT 0x4 -#endif - -#define INTERFACE IActiveDesktop -DECLARE_INTERFACE_(IActiveDesktop, IUnknown) -{ - STDMETHOD(QueryInterface)(THIS_ REFIID,PVOID*) PURE; - STDMETHOD_(ULONG,AddRef)(THIS) PURE; - STDMETHOD_(ULONG,Release)(THIS) PURE; - STDMETHOD(AddDesktopItem)(THIS_ LPCOMPONENT,DWORD) PURE; - STDMETHOD(AddDesktopItemWithUI)(THIS_ HWND,LPCOMPONENT,DWORD) PURE; - STDMETHOD(AddUrl)(THIS_ HWND,LPCWSTR,LPCOMPONENT,DWORD) PURE; - STDMETHOD(ApplyChanges)(THIS_ DWORD) PURE; - STDMETHOD(GenerateDesktopItemHtml)(THIS_ LPCWSTR,LPCOMPONENT,DWORD) PURE; - STDMETHOD(GetDesktopItem)(THIS_ int,LPCOMPONENT,DWORD) PURE; - STDMETHOD(GetDesktopItemByID)(THIS_ DWORD,LPCOMPONENT,DWORD) PURE; - STDMETHOD(GetDesktopItemBySource)(THIS_ LPCWSTR,LPCOMPONENT,DWORD) PURE; - STDMETHOD(GetDesktopItemCount)(THIS_ LPINT,DWORD) PURE; - STDMETHOD(GetDesktopItemOptions)(THIS_ LPCOMPONENTSOPT,DWORD) PURE; - STDMETHOD(GetPattern)(THIS_ LPWSTR,UINT,DWORD) PURE; - STDMETHOD(GetWallpaper)(THIS_ LPWSTR,UINT,DWORD) PURE; - STDMETHOD(GetWallpaperOptions)(THIS_ LPWALLPAPEROPT,DWORD) PURE; - STDMETHOD(ModifyDesktopItem)(THIS_ LPCCOMPONENT,DWORD) PURE; - STDMETHOD(RemoveDesktopItem)(THIS_ LPCCOMPONENT,DWORD) PURE; - STDMETHOD(SetDesktopItemOptions)(THIS_ LPCCOMPONENTSOPT,DWORD) PURE; - STDMETHOD(SetPattern)(THIS_ LPCWSTR,DWORD) PURE; - STDMETHOD(SetWallpaper)(THIS_ LPCWSTR,DWORD) PURE; - STDMETHOD(SetWallpaperOptions)(THIS_ LPCWALLPAPEROPT,DWORD) PURE; -}; -#undef INTERFACE -#endif /* HAVE_ACTIVE_DESKTOP_H */ - -#endif /* WIN32 */ -#endif /* OS_W32TIGER_H */ diff --git a/common/rdr/CMakeLists.txt b/common/rdr/CMakeLists.txt index 7f642b48..429d0c72 100644 --- a/common/rdr/CMakeLists.txt +++ b/common/rdr/CMakeLists.txt @@ -1,5 +1,5 @@ include_directories(${CMAKE_SOURCE_DIR}/common) -include_directories(${ZLIB_INCLUDE_DIRS}) +include_directories(SYSTEM ${ZLIB_INCLUDE_DIRS}) add_library(rdr STATIC AESInStream.cxx @@ -22,11 +22,11 @@ add_library(rdr STATIC target_link_libraries(rdr ${ZLIB_LIBRARIES} os) if(GNUTLS_FOUND) - include_directories(${GNUTLS_INCLUDE_DIR}) + include_directories(SYSTEM ${GNUTLS_INCLUDE_DIR}) target_link_libraries(rdr ${GNUTLS_LIBRARIES}) endif() if (NETTLE_FOUND) - include_directories(${NETTLE_INCLUDE_DIRS}) + include_directories(SYSTEM ${NETTLE_INCLUDE_DIRS}) target_link_libraries(rdr ${NETTLE_LIBRARIES}) target_link_directories(rdr PUBLIC ${NETTLE_LIBRARY_DIRS}) endif() diff --git a/common/rdr/Exception.h b/common/rdr/Exception.h index e5bff80d..2c66ffca 100644 --- a/common/rdr/Exception.h +++ b/common/rdr/Exception.h @@ -21,18 +21,13 @@ #ifndef __RDR_EXCEPTION_H__ #define __RDR_EXCEPTION_H__ -#ifdef __GNUC__ -# define __printf_attr(a, b) __attribute__((__format__ (__printf__, a, b))) -#else -# define __printf_attr(a, b) -#endif // __GNUC__ - namespace rdr { struct Exception { enum { len = 256 }; char str_[len]; - Exception(const char *format = 0, ...) __printf_attr(2, 3); + Exception(const char *format = 0, ...) + __attribute__((__format__ (__printf__, 2, 3))); virtual ~Exception() {} virtual const char* str() const { return str_; } }; diff --git a/common/rdr/MemInStream.h b/common/rdr/MemInStream.h index a5196594..b54334ca 100644 --- a/common/rdr/MemInStream.h +++ b/common/rdr/MemInStream.h @@ -59,7 +59,7 @@ namespace rdr { private: - bool overrun(size_t needed) { throw EndOfStream(); } + bool overrun(size_t /*needed*/) { throw EndOfStream(); } const U8* start; bool deleteWhenDone; }; diff --git a/common/rfb/CConnection.cxx b/common/rfb/CConnection.cxx index 396b48b3..27942764 100644 --- a/common/rfb/CConnection.cxx +++ b/common/rfb/CConnection.cxx @@ -581,7 +581,7 @@ void CConnection::handleClipboardRequest(rdr::U32 flags) handleClipboardRequest(); } -void CConnection::handleClipboardPeek(rdr::U32 flags) +void CConnection::handleClipboardPeek() { if (server.clipboardFlags() & rfb::clipboardNotify) writer()->writeClipboardNotify(hasLocalClipboard ? rfb::clipboardUTF8 : 0); @@ -635,11 +635,11 @@ void CConnection::handleClipboardRequest() { } -void CConnection::handleClipboardAnnounce(bool available) +void CConnection::handleClipboardAnnounce(bool /*available*/) { } -void CConnection::handleClipboardData(const char* data) +void CConnection::handleClipboardData(const char* /*data*/) { } diff --git a/common/rfb/CConnection.h b/common/rfb/CConnection.h index 68554b59..f6818628 100644 --- a/common/rfb/CConnection.h +++ b/common/rfb/CConnection.h @@ -119,7 +119,7 @@ namespace rfb { virtual void handleClipboardCaps(rdr::U32 flags, const rdr::U32* lengths); virtual void handleClipboardRequest(rdr::U32 flags); - virtual void handleClipboardPeek(rdr::U32 flags); + virtual void handleClipboardPeek(); virtual void handleClipboardNotify(rdr::U32 flags); virtual void handleClipboardProvide(rdr::U32 flags, const size_t* lengths, diff --git a/common/rfb/CMakeLists.txt b/common/rfb/CMakeLists.txt index b7ac1145..e18cff34 100644 --- a/common/rfb/CMakeLists.txt +++ b/common/rfb/CMakeLists.txt @@ -1,6 +1,6 @@ include_directories(${CMAKE_SOURCE_DIR}/common) -include_directories(${JPEG_INCLUDE_DIR}) -include_directories(${PIXMAN_INCLUDE_DIRS}) +include_directories(SYSTEM ${JPEG_INCLUDE_DIR}) +include_directories(SYSTEM ${PIXMAN_INCLUDE_DIRS}) add_library(rfb STATIC Blacklist.cxx @@ -77,7 +77,7 @@ if(ENABLE_H264 AND NOT H264_LIBS STREQUAL "NONE") elseif(H264_LIBS STREQUAL "WIN") target_sources(rfb PRIVATE H264WinDecoderContext.cxx) endif() - include_directories(${H264_INCLUDE_DIRS}) + include_directories(SYSTEM ${H264_INCLUDE_DIRS}) target_link_libraries(rfb ${H264_LIBRARIES}) target_link_directories(rfb PUBLIC ${H264_LIBRARY_DIRS}) endif() @@ -98,14 +98,14 @@ endif() if(GNUTLS_FOUND) target_sources(rfb PRIVATE CSecurityTLS.cxx SSecurityTLS.cxx) - include_directories(${GNUTLS_INCLUDE_DIR}) + include_directories(SYSTEM ${GNUTLS_INCLUDE_DIR}) target_link_libraries(rfb ${GNUTLS_LIBRARIES}) endif() if (NETTLE_FOUND) target_sources(rfb PRIVATE CSecurityDH.cxx CSecurityMSLogonII.cxx CSecurityRSAAES.cxx SSecurityRSAAES.cxx) - include_directories(${NETTLE_INCLUDE_DIRS} ${GMP_INCLUDE_DIRS}) + include_directories(SYSTEM ${NETTLE_INCLUDE_DIRS} ${GMP_INCLUDE_DIRS}) target_link_libraries(rfb ${HOGWEED_LIBRARIES} ${NETTLE_LIBRARIES} ${GMP_LIBRARIES}) target_link_directories(rfb PUBLIC ${HOGWEED_LIBRARY_DIRS} diff --git a/common/rfb/CMsgHandler.cxx b/common/rfb/CMsgHandler.cxx index 8cdfc451..f4f785b2 100644 --- a/common/rfb/CMsgHandler.cxx +++ b/common/rfb/CMsgHandler.cxx @@ -68,7 +68,8 @@ void CMsgHandler::setName(const char* name) server.setName(name); } -void CMsgHandler::fence(rdr::U32 flags, unsigned len, const char data[]) +void CMsgHandler::fence(rdr::U32 /*flags*/, unsigned /*len*/, + const char /*data*/ []) { server.supportsFence = true; } @@ -150,20 +151,20 @@ void CMsgHandler::handleClipboardCaps(rdr::U32 flags, const rdr::U32* lengths) server.setClipboardCaps(flags, lengths); } -void CMsgHandler::handleClipboardRequest(rdr::U32 flags) +void CMsgHandler::handleClipboardRequest(rdr::U32 /*flags*/) { } -void CMsgHandler::handleClipboardPeek(rdr::U32 flags) +void CMsgHandler::handleClipboardPeek() { } -void CMsgHandler::handleClipboardNotify(rdr::U32 flags) +void CMsgHandler::handleClipboardNotify(rdr::U32 /*flags*/) { } -void CMsgHandler::handleClipboardProvide(rdr::U32 flags, - const size_t* lengths, - const rdr::U8* const* data) +void CMsgHandler::handleClipboardProvide(rdr::U32 /*flags*/, + const size_t* /*lengths*/, + const rdr::U8* const* /*data*/) { } diff --git a/common/rfb/CMsgHandler.h b/common/rfb/CMsgHandler.h index 43d8df24..e358a4f4 100644 --- a/common/rfb/CMsgHandler.h +++ b/common/rfb/CMsgHandler.h @@ -79,7 +79,7 @@ namespace rfb { virtual void handleClipboardCaps(rdr::U32 flags, const rdr::U32* lengths); virtual void handleClipboardRequest(rdr::U32 flags); - virtual void handleClipboardPeek(rdr::U32 flags); + virtual void handleClipboardPeek(); virtual void handleClipboardNotify(rdr::U32 flags); virtual void handleClipboardProvide(rdr::U32 flags, const size_t* lengths, diff --git a/common/rfb/CMsgReader.cxx b/common/rfb/CMsgReader.cxx index 1ca993aa..1c175584 100644 --- a/common/rfb/CMsgReader.cxx +++ b/common/rfb/CMsgReader.cxx @@ -390,7 +390,7 @@ bool CMsgReader::readExtendedClipboard(rdr::S32 len) handler->handleClipboardRequest(flags); break; case clipboardPeek: - handler->handleClipboardPeek(flags); + handler->handleClipboardPeek(); break; case clipboardNotify: handler->handleClipboardNotify(flags); diff --git a/common/rfb/CSecurityRSAAES.cxx b/common/rfb/CSecurityRSAAES.cxx index db6e43ad..c84422b6 100644 --- a/common/rfb/CSecurityRSAAES.cxx +++ b/common/rfb/CSecurityRSAAES.cxx @@ -100,31 +100,31 @@ bool CSecurityRSAAES::processMsg() { switch (state) { case ReadPublicKey: - if (readPublicKey()) { - verifyServer(); - writePublicKey(); - writeRandom(); - state = ReadRandom; - } - return false; + if (!readPublicKey()) + return false; + verifyServer(); + writePublicKey(); + writeRandom(); + state = ReadRandom; + /* fall through */ case ReadRandom: - if (readRandom()) { - setCipher(); - writeHash(); - state = ReadHash; - } - return false; + if (!readRandom()) + return false; + setCipher(); + writeHash(); + state = ReadHash; + /* fall through */ case ReadHash: - if (readHash()) { - clearSecrets(); - state = ReadSubtype; - } + if (!readHash()) + return false; + clearSecrets(); + state = ReadSubtype; + /* fall through */ case ReadSubtype: - if (readSubtype()) { - writeCredentials(); - return true; - } - return false; + if (!readSubtype()) + return false; + writeCredentials(); + return true; } assert(!"unreachable"); return false; diff --git a/common/rfb/ClientParams.h b/common/rfb/ClientParams.h index 202cef4e..a78ad14c 100644 --- a/common/rfb/ClientParams.h +++ b/common/rfb/ClientParams.h @@ -62,8 +62,8 @@ namespace rfb { return !beforeVersion(major,minor+1); } - const int width() const { return width_; } - const int height() const { return height_; } + int width() const { return width_; } + int height() const { return height_; } const ScreenSet& screenLayout() const { return screenLayout_; } void setDimensions(int width, int height); void setDimensions(int width, int height, const ScreenSet& layout); diff --git a/common/rfb/Congestion.cxx b/common/rfb/Congestion.cxx index 32339a14..f642752e 100644 --- a/common/rfb/Congestion.cxx +++ b/common/rfb/Congestion.cxx @@ -313,6 +313,8 @@ size_t Congestion::getBandwidth() void Congestion::debugTrace(const char* filename, int fd) { + (void)filename; + (void)fd; #ifdef CONGESTION_TRACE #ifdef __linux__ FILE *f; diff --git a/common/rfb/CopyRectDecoder.cxx b/common/rfb/CopyRectDecoder.cxx index 82ae06f1..fb05dcbd 100644 --- a/common/rfb/CopyRectDecoder.cxx +++ b/common/rfb/CopyRectDecoder.cxx @@ -36,8 +36,10 @@ CopyRectDecoder::~CopyRectDecoder() { } -bool CopyRectDecoder::readRect(const Rect& r, rdr::InStream* is, - const ServerParams& server, rdr::OutStream* os) +bool CopyRectDecoder::readRect(const Rect& /*r*/, + rdr::InStream* is, + const ServerParams& /*server*/, + rdr::OutStream* os) { if (!is->hasData(4)) return false; @@ -63,7 +65,8 @@ void CopyRectDecoder::getAffectedRegion(const Rect& rect, } void CopyRectDecoder::decodeRect(const Rect& r, const void* buffer, - size_t buflen, const ServerParams& server, + size_t buflen, + const ServerParams& /*server*/, ModifiablePixelBuffer* pb) { rdr::MemInStream is(buffer, buflen); diff --git a/common/rfb/Decoder.cxx b/common/rfb/Decoder.cxx index 924f86d8..832d8cf0 100644 --- a/common/rfb/Decoder.cxx +++ b/common/rfb/Decoder.cxx @@ -45,17 +45,22 @@ Decoder::~Decoder() { } -void Decoder::getAffectedRegion(const Rect& rect, const void* buffer, - size_t buflen, const ServerParams& server, +void Decoder::getAffectedRegion(const Rect& rect, + const void* /*buffer*/, + size_t /*buflen*/, + const ServerParams& /*server*/, Region* region) { region->reset(rect); } -bool Decoder::doRectsConflict(const Rect& rectA, const void* bufferA, - size_t buflenA, const Rect& rectB, - const void* bufferB, size_t buflenB, - const ServerParams& server) +bool Decoder::doRectsConflict(const Rect& /*rectA*/, + const void* /*bufferA*/, + size_t /*buflenA*/, + const Rect& /*rectB*/, + const void* /*bufferB*/, + size_t /*buflenB*/, + const ServerParams& /*server*/) { return false; } diff --git a/common/rfb/EncodeManager.cxx b/common/rfb/EncodeManager.cxx index e49fa254..6a78939e 100644 --- a/common/rfb/EncodeManager.cxx +++ b/common/rfb/EncodeManager.cxx @@ -1060,7 +1060,7 @@ void EncodeManager::OffsetPixelBuffer::update(const PixelFormat& pf, setBuffer(width, height, (rdr::U8*)data_, stride_); } -rdr::U8* EncodeManager::OffsetPixelBuffer::getBufferRW(const Rect& r, int* stride) +rdr::U8* EncodeManager::OffsetPixelBuffer::getBufferRW(const Rect& /*r*/, int* /*stride*/) { throw rfb::Exception("Invalid write attempt to OffsetPixelBuffer"); } diff --git a/common/rfb/Encoder.h b/common/rfb/Encoder.h index d5a0288e..76079930 100644 --- a/common/rfb/Encoder.h +++ b/common/rfb/Encoder.h @@ -51,9 +51,10 @@ namespace rfb { // checking the list of encodings in the connection parameters. virtual bool isSupported()=0; - virtual void setCompressLevel(int level) {}; - virtual void setQualityLevel(int level) {}; - virtual void setFineQualityLevel(int quality, int subsampling) {}; + virtual void setCompressLevel(int /*level*/) {}; + virtual void setQualityLevel(int /*level*/) {}; + virtual void setFineQualityLevel(int /*quality*/, + int /*subsampling*/) {}; virtual int getCompressLevel() { return -1; }; virtual int getQualityLevel() { return -1; }; diff --git a/common/rfb/H264Decoder.cxx b/common/rfb/H264Decoder.cxx index 27c380bb..92231fcd 100644 --- a/common/rfb/H264Decoder.cxx +++ b/common/rfb/H264Decoder.cxx @@ -65,8 +65,10 @@ H264DecoderContext* H264Decoder::findContext(const Rect& r) return NULL; } -bool H264Decoder::readRect(const Rect& r, rdr::InStream* is, - const ServerParams& server, rdr::OutStream* os) +bool H264Decoder::readRect(const Rect& /*r*/, + rdr::InStream* is, + const ServerParams& /*server*/, + rdr::OutStream* os) { rdr::U32 len; @@ -92,7 +94,8 @@ bool H264Decoder::readRect(const Rect& r, rdr::InStream* is, } void H264Decoder::decodeRect(const Rect& r, const void* buffer, - size_t buflen, const ServerParams& server, + size_t buflen, + const ServerParams& /*server*/, ModifiablePixelBuffer* pb) { rdr::MemInStream is(buffer, buflen); @@ -134,5 +137,5 @@ void H264Decoder::decodeRect(const Rect& r, const void* buffer, if (!len) return; - ctx->decode(is.getptr(len), len, flags, pb); + ctx->decode(is.getptr(len), len, pb); } diff --git a/common/rfb/H264DecoderContext.h b/common/rfb/H264DecoderContext.h index bd93b46f..f261f4f2 100644 --- a/common/rfb/H264DecoderContext.h +++ b/common/rfb/H264DecoderContext.h @@ -33,7 +33,9 @@ namespace rfb { virtual ~H264DecoderContext() = 0; - virtual void decode(const rdr::U8* h264_buffer, rdr::U32 len, rdr::U32 flags, ModifiablePixelBuffer* pb) {} + virtual void decode(const rdr::U8* /*h264_buffer*/, + rdr::U32 /*len*/, + ModifiablePixelBuffer* /*pb*/) {} void reset(); inline bool isEqualRect(const Rect &r) const { return r.equals(rect); } diff --git a/common/rfb/H264LibavDecoderContext.cxx b/common/rfb/H264LibavDecoderContext.cxx index 6254c8a2..67c14991 100644 --- a/common/rfb/H264LibavDecoderContext.cxx +++ b/common/rfb/H264LibavDecoderContext.cxx @@ -128,7 +128,9 @@ rdr::U8* H264LibavDecoderContext::makeH264WorkBuffer(const rdr::U8* buffer, rdr: return h264WorkBuffer; } -void H264LibavDecoderContext::decode(const rdr::U8* h264_in_buffer, rdr::U32 len, rdr::U32 flags, ModifiablePixelBuffer* pb) { +void H264LibavDecoderContext::decode(const rdr::U8* h264_in_buffer, + rdr::U32 len, + ModifiablePixelBuffer* pb) { os::AutoMutex lock(&mutex); if (!initialized) return; diff --git a/common/rfb/H264LibavDecoderContext.h b/common/rfb/H264LibavDecoderContext.h index ff2a0868..1f005e4b 100644 --- a/common/rfb/H264LibavDecoderContext.h +++ b/common/rfb/H264LibavDecoderContext.h @@ -34,7 +34,8 @@ namespace rfb { H264LibavDecoderContext(const Rect &r) : H264DecoderContext(r) {} ~H264LibavDecoderContext() { freeCodec(); } - virtual void decode(const rdr::U8* h264_buffer, rdr::U32 len, rdr::U32 flags, ModifiablePixelBuffer* pb); + virtual void decode(const rdr::U8* h264_buffer, rdr::U32 len, + ModifiablePixelBuffer* pb); protected: virtual bool initCodec(); diff --git a/common/rfb/H264WinDecoderContext.cxx b/common/rfb/H264WinDecoderContext.cxx index 12dfda77..a6855c0d 100644 --- a/common/rfb/H264WinDecoderContext.cxx +++ b/common/rfb/H264WinDecoderContext.cxx @@ -154,7 +154,9 @@ void H264WinDecoderContext::freeCodec() { initialized = false; } -void H264WinDecoderContext::decode(const rdr::U8* h264_buffer, rdr::U32 len, rdr::U32 flags, ModifiablePixelBuffer* pb) { +void H264WinDecoderContext::decode(const rdr::U8* h264_buffer, + rdr::U32 len, + ModifiablePixelBuffer* pb) { os::AutoMutex lock(&mutex); if (!initialized) return; diff --git a/common/rfb/H264WinDecoderContext.h b/common/rfb/H264WinDecoderContext.h index e79f97ae..96e7bf00 100644 --- a/common/rfb/H264WinDecoderContext.h +++ b/common/rfb/H264WinDecoderContext.h @@ -33,7 +33,8 @@ namespace rfb { H264WinDecoderContext(const Rect &r) : H264DecoderContext(r) {}; ~H264WinDecoderContext() { freeCodec(); } - virtual void decode(const rdr::U8* h264_buffer, rdr::U32 len, rdr::U32 flags, ModifiablePixelBuffer* pb); + virtual void decode(const rdr::U8* h264_buffer, rdr::U32 len, + ModifiablePixelBuffer* pb); protected: virtual bool initCodec(); diff --git a/common/rfb/HextileEncoder.cxx b/common/rfb/HextileEncoder.cxx index e3845a83..f9db06b8 100644 --- a/common/rfb/HextileEncoder.cxx +++ b/common/rfb/HextileEncoder.cxx @@ -63,7 +63,8 @@ bool HextileEncoder::isSupported() return conn->client.supportsEncoding(encodingHextile); } -void HextileEncoder::writeRect(const PixelBuffer* pb, const Palette& palette) +void HextileEncoder::writeRect(const PixelBuffer* pb, + const Palette& /*palette*/) { rdr::OutStream* os = conn->getOutStream(); switch (pb->getPF().bpp) { diff --git a/common/rfb/InputHandler.h b/common/rfb/InputHandler.h index b91f0e42..4719eca0 100644 --- a/common/rfb/InputHandler.h +++ b/common/rfb/InputHandler.h @@ -32,12 +32,11 @@ namespace rfb { class InputHandler { public: virtual ~InputHandler() {} - virtual void keyEvent(rdr::U32 __unused_attr keysym, - rdr::U32 __unused_attr keycode, - bool __unused_attr down) { } - virtual void pointerEvent(const Point& __unused_attr pos, - int __unused_attr buttonMask) { } - virtual void clientCutText(const char* __unused_attr str) { } + virtual void keyEvent(rdr::U32 /*keysym*/, rdr::U32 /*keycode*/, + bool /*down*/) { } + virtual void pointerEvent(const Point& /*pos*/, + int /*buttonMask*/) { } + virtual void clientCutText(const char* /*str*/) { } }; } diff --git a/common/rfb/JpegCompressor.cxx b/common/rfb/JpegCompressor.cxx index 18d34c3d..efb26a77 100644 --- a/common/rfb/JpegCompressor.cxx +++ b/common/rfb/JpegCompressor.cxx @@ -155,15 +155,16 @@ JpegCompressor::~JpegCompressor(void) delete cinfo; } -void JpegCompressor::compress(const rdr::U8 *buf, int stride, const Rect& r, - const PixelFormat& pf, int quality, int subsamp) +void JpegCompressor::compress(const rdr::U8 *buf, volatile int stride, + const Rect& r, const PixelFormat& pf, + int quality, int subsamp) { int w = r.width(); int h = r.height(); int pixelsize; - rdr::U8 *srcBuf = NULL; - bool srcBufIsTemp = false; - JSAMPROW *rowPointer = NULL; + rdr::U8 * volatile srcBuf = NULL; + volatile bool srcBufIsTemp = false; + JSAMPROW * volatile rowPointer = NULL; if(setjmp(err->jmpBuffer)) { // this will execute if libjpeg has an error @@ -232,6 +233,7 @@ void JpegCompressor::compress(const rdr::U8 *buf, int stride, const Rect& r, break; case subsampleGray: jpeg_set_colorspace(cinfo, JCS_GRAYSCALE); + // fall through default: cinfo->comp_info[0].h_samp_factor = 1; cinfo->comp_info[0].v_samp_factor = 1; @@ -252,7 +254,7 @@ void JpegCompressor::compress(const rdr::U8 *buf, int stride, const Rect& r, delete[] rowPointer; } -void JpegCompressor::writeBytes(const void* data, int length) +void JpegCompressor::writeBytes(const void* /*data*/, int /*length*/) { throw rdr::Exception("writeBytes() is not valid with a JpegCompressor instance. Use compress() instead."); } diff --git a/common/rfb/JpegDecompressor.cxx b/common/rfb/JpegDecompressor.cxx index 7b24e783..ea148b94 100644 --- a/common/rfb/JpegDecompressor.cxx +++ b/common/rfb/JpegDecompressor.cxx @@ -84,7 +84,7 @@ struct JPEG_SRC_MGR { }; static void -JpegNoOp(j_decompress_ptr dinfo) +JpegNoOp(j_decompress_ptr /*dinfo*/) { } @@ -150,16 +150,18 @@ JpegDecompressor::~JpegDecompressor(void) delete dinfo; } -void JpegDecompressor::decompress(const rdr::U8 *jpegBuf, int jpegBufLen, - rdr::U8 *buf, int stride, const Rect& r, const PixelFormat& pf) +void JpegDecompressor::decompress(const rdr::U8 *jpegBuf, + int jpegBufLen, rdr::U8 *buf, + volatile int stride, + const Rect& r, const PixelFormat& pf) { int w = r.width(); int h = r.height(); int pixelsize; int dstBufStride; - rdr::U8 *dstBuf = NULL; - bool dstBufIsTemp = false; - JSAMPROW *rowPointer = NULL; + rdr::U8 * volatile dstBuf = NULL; + volatile bool dstBufIsTemp = false; + JSAMPROW * volatile rowPointer = NULL; if(setjmp(err->jmpBuffer)) { // this will execute if libjpeg has an error diff --git a/common/rfb/LogWriter.cxx b/common/rfb/LogWriter.cxx index 7feee2fe..6df82d8e 100644 --- a/common/rfb/LogWriter.cxx +++ b/common/rfb/LogWriter.cxx @@ -51,7 +51,7 @@ void LogWriter::setLevel(int level) { } void -LogWriter::listLogWriters(int width) { +LogWriter::listLogWriters(int /*width*/) { // *** make this respect width... LogWriter* current = log_writers; fprintf(stderr, " "); diff --git a/common/rfb/LogWriter.h b/common/rfb/LogWriter.h index f718d60e..6eff6da1 100644 --- a/common/rfb/LogWriter.h +++ b/common/rfb/LogWriter.h @@ -25,22 +25,20 @@ #include <rfb/Logger.h> #include <rfb/Configuration.h> -#ifdef __GNUC__ -# define __printf_attr(a, b) __attribute__((__format__ (__printf__, a, b))) -#else -# define __printf_attr(a, b) -#endif // __GNUC__ - // Each log writer instance has a unique textual name, // and is attached to a particular Log instance and // is assigned a particular log level. #define DEF_LOGFUNCTION(name, level) \ - inline void v##name(const char* fmt, va_list ap) __printf_attr(2, 0) { \ + inline void v##name(const char* fmt, va_list ap) \ + __attribute__((__format__ (__printf__, 2, 0))) \ + { \ if (m_log && (level <= m_level)) \ m_log->write(level, m_name, fmt, ap); \ } \ - inline void name(const char* fmt, ...) __printf_attr(2, 3) { \ + inline void name(const char* fmt, ...) \ + __attribute__((__format__ (__printf__, 2, 3))) \ + { \ if (m_log && (level <= m_level)) { \ va_list ap; va_start(ap, fmt); \ m_log->write(level, m_name, fmt, ap);\ @@ -63,7 +61,9 @@ namespace rfb { void setLevel(int level); int getLevel(void) { return m_level; } - inline void write(int level, const char* format, ...) __printf_attr(3, 4) { + inline void write(int level, const char* format, ...) + __attribute__((__format__ (__printf__, 3, 4))) + { if (m_log && (level <= m_level)) { va_list ap; va_start(ap, format); diff --git a/common/rfb/Logger.h b/common/rfb/Logger.h index b75594c9..76f03535 100644 --- a/common/rfb/Logger.h +++ b/common/rfb/Logger.h @@ -28,12 +28,6 @@ // and is attached to a particular Logger instance and // is assigned a particular log level. -#ifdef __GNUC__ -# define __printf_attr(a, b) __attribute__((__format__ (__printf__, a, b))) -#else -# define __printf_attr(a, b) -#endif // __GNUC__ - namespace rfb { class Logger { @@ -51,7 +45,8 @@ namespace rfb { // -=- Write data to a log virtual void write(int level, const char *logname, const char *text) = 0; - void write(int level, const char *logname, const char* format, va_list ap) __printf_attr(4, 0); + void write(int level, const char *logname, const char* format, va_list ap) + __attribute__((__format__ (__printf__, 4, 0))); // -=- Register a logger diff --git a/common/rfb/Logger_file.cxx b/common/rfb/Logger_file.cxx index 89ff7433..684614cc 100644 --- a/common/rfb/Logger_file.cxx +++ b/common/rfb/Logger_file.cxx @@ -45,7 +45,7 @@ Logger_File::~Logger_File() delete mutex; } -void Logger_File::write(int level, const char *logname, const char *message) +void Logger_File::write(int /*level*/, const char *logname, const char *message) { os::AutoMutex a(mutex); diff --git a/common/rfb/PixelBuffer.cxx b/common/rfb/PixelBuffer.cxx index 1b39a9ec..1b534b7b 100644 --- a/common/rfb/PixelBuffer.cxx +++ b/common/rfb/PixelBuffer.cxx @@ -339,7 +339,7 @@ rdr::U8* FullFramePixelBuffer::getBufferRW(const Rect& r, int* stride_) return &data[(r.tl.x + (r.tl.y * stride)) * (format.bpp/8)]; } -void FullFramePixelBuffer::commitBufferRW(const Rect& r) +void FullFramePixelBuffer::commitBufferRW(const Rect& /*r*/) { } @@ -371,7 +371,7 @@ void FullFramePixelBuffer::setBuffer(int width, int height, data = data_; } -void FullFramePixelBuffer::setSize(int w, int h) +void FullFramePixelBuffer::setSize(int /*w*/, int /*h*/) { // setBuffer() should be used throw rfb::Exception("Invalid call to FullFramePixelBuffer::setSize()"); diff --git a/common/rfb/PixelBuffer.h b/common/rfb/PixelBuffer.h index 3e4018f9..b12a734e 100644 --- a/common/rfb/PixelBuffer.h +++ b/common/rfb/PixelBuffer.h @@ -86,7 +86,7 @@ namespace rfb { // Ensure that the specified rectangle of buffer is up to date. // Overridden by derived classes implementing framebuffer access // to copy the required display data into place. - virtual void grabRegion(const Region& __unused_attr region) {} + virtual void grabRegion(const Region& /*region*/) {} protected: PixelBuffer(); diff --git a/common/rfb/PixelFormat.inl b/common/rfb/PixelFormat.inl index 5a40379a..3a0bfe49 100644 --- a/common/rfb/PixelFormat.inl +++ b/common/rfb/PixelFormat.inl @@ -30,8 +30,10 @@ inline Pixel PixelFormat::pixelFromBuffer(const rdr::U8* buffer) const case 32: p |= ((Pixel)*(buffer++)) << 24; p |= ((Pixel)*(buffer++)) << 16; + /* fall through */ case 16: p |= ((Pixel)*(buffer++)) << 8; + /* fall through */ case 8: p |= *buffer; } @@ -57,8 +59,10 @@ inline void PixelFormat::bufferFromPixel(rdr::U8* buffer, Pixel p) const case 32: *(buffer++) = (p >> 24) & 0xff; *(buffer++) = (p >> 16) & 0xff; + /* fall through */ case 16: *(buffer++) = (p >> 8) & 0xff; + /* fall through */ case 8: *(buffer++) = (p >> 0) & 0xff; } diff --git a/common/rfb/RREDecoder.cxx b/common/rfb/RREDecoder.cxx index a0818987..a01cbe74 100644 --- a/common/rfb/RREDecoder.cxx +++ b/common/rfb/RREDecoder.cxx @@ -48,7 +48,7 @@ RREDecoder::~RREDecoder() { } -bool RREDecoder::readRect(const Rect& r, rdr::InStream* is, +bool RREDecoder::readRect(const Rect& /*r*/, rdr::InStream* is, const ServerParams& server, rdr::OutStream* os) { rdr::U32 numRects; diff --git a/common/rfb/RREEncoder.cxx b/common/rfb/RREEncoder.cxx index f5b9be72..31f94e7c 100644 --- a/common/rfb/RREEncoder.cxx +++ b/common/rfb/RREEncoder.cxx @@ -107,7 +107,7 @@ void RREEncoder::writeRect(const PixelBuffer* pb, const Palette& palette) mos.clear(); } -void RREEncoder::writeSolidRect(int width, int height, +void RREEncoder::writeSolidRect(int /*width*/, int /*height*/, const PixelFormat& pf, const rdr::U8* colour) { diff --git a/common/rfb/RawEncoder.cxx b/common/rfb/RawEncoder.cxx index a820c32c..28115588 100644 --- a/common/rfb/RawEncoder.cxx +++ b/common/rfb/RawEncoder.cxx @@ -44,7 +44,8 @@ bool RawEncoder::isSupported() return true; } -void RawEncoder::writeRect(const PixelBuffer* pb, const Palette& palette) +void RawEncoder::writeRect(const PixelBuffer* pb, + const Palette& /*palette*/) { const rdr::U8* buffer; int stride; diff --git a/common/rfb/SConnection.cxx b/common/rfb/SConnection.cxx index f70d21dc..8e0bff8c 100644 --- a/common/rfb/SConnection.cxx +++ b/common/rfb/SConnection.cxx @@ -286,7 +286,7 @@ bool SConnection::processInitMsg() return reader_->readClientInit(); } -bool SConnection::handleAuthFailureTimeout(Timer* t) +bool SConnection::handleAuthFailureTimeout(Timer* /*t*/) { if (state_ != RFBSTATE_SECURITY_FAILURE) { close("SConnection::handleAuthFailureTimeout: invalid state"); @@ -402,7 +402,7 @@ void SConnection::handleClipboardRequest(rdr::U32 flags) handleClipboardRequest(); } -void SConnection::handleClipboardPeek(rdr::U32 flags) +void SConnection::handleClipboardPeek() { if (client.clipboardFlags() & rfb::clipboardNotify) writer()->writeClipboardNotify(hasLocalClipboard ? rfb::clipboardUTF8 : 0); @@ -452,7 +452,7 @@ void SConnection::authSuccess() { } -void SConnection::queryConnection(const char* userName) +void SConnection::queryConnection(const char* /*userName*/) { approveConnection(true); } @@ -491,14 +491,14 @@ void SConnection::approveConnection(bool accept, const char* reason) } } -void SConnection::clientInit(bool shared) +void SConnection::clientInit(bool /*shared*/) { writer_->writeServerInit(client.width(), client.height(), client.pf(), client.name()); state_ = RFBSTATE_NORMAL; } -void SConnection::close(const char* reason) +void SConnection::close(const char* /*reason*/) { state_ = RFBSTATE_CLOSING; cleanup(); @@ -512,7 +512,8 @@ void SConnection::setPixelFormat(const PixelFormat& pf) writeFakeColourMap(); } -void SConnection::framebufferUpdateRequest(const Rect& r, bool incremental) +void SConnection::framebufferUpdateRequest(const Rect& /*r*/, + bool /*incremental*/) { if (!readyForSetColourMapEntries) { readyForSetColourMapEntries = true; @@ -533,8 +534,9 @@ void SConnection::fence(rdr::U32 flags, unsigned len, const char data[]) writer()->writeFence(flags, len, data); } -void SConnection::enableContinuousUpdates(bool enable, - int x, int y, int w, int h) +void SConnection::enableContinuousUpdates(bool /*enable*/, + int /*x*/, int /*y*/, + int /*w*/, int /*h*/) { } @@ -542,11 +544,11 @@ void SConnection::handleClipboardRequest() { } -void SConnection::handleClipboardAnnounce(bool available) +void SConnection::handleClipboardAnnounce(bool /*available*/) { } -void SConnection::handleClipboardData(const char* data) +void SConnection::handleClipboardData(const char* /*data*/) { } diff --git a/common/rfb/SConnection.h b/common/rfb/SConnection.h index 38969c22..b7e30c6a 100644 --- a/common/rfb/SConnection.h +++ b/common/rfb/SConnection.h @@ -85,7 +85,7 @@ namespace rfb { virtual void clientCutText(const char* str); virtual void handleClipboardRequest(rdr::U32 flags); - virtual void handleClipboardPeek(rdr::U32 flags); + virtual void handleClipboardPeek(); virtual void handleClipboardNotify(rdr::U32 flags); virtual void handleClipboardProvide(rdr::U32 flags, const size_t* lengths, @@ -222,7 +222,8 @@ namespace rfb { // throwConnFailedException() prints a message to the log, sends a conn // failed message to the client (if possible) and throws a // ConnFailedException. - void throwConnFailedException(const char* format, ...) __printf_attr(2, 3); + void throwConnFailedException(const char* format, ...) + __attribute__((__format__ (__printf__, 2, 3))); void setState(stateEnum s) { state_ = s; } diff --git a/common/rfb/SDesktop.h b/common/rfb/SDesktop.h index b4104ea7..6d2a5dd8 100644 --- a/common/rfb/SDesktop.h +++ b/common/rfb/SDesktop.h @@ -84,9 +84,9 @@ namespace rfb { // setScreenLayout() requests to reconfigure the framebuffer and/or // the layout of screens. - virtual unsigned int setScreenLayout(int __unused_attr fb_width, - int __unused_attr fb_height, - const ScreenSet& __unused_attr layout) { + virtual unsigned int setScreenLayout(int /*fb_width*/, + int /*fb_height*/, + const ScreenSet& /*layout*/) { return resultProhibited; } @@ -104,14 +104,14 @@ namespace rfb { // handleClipboardAnnounce() is called to indicate a change in the // clipboard on a client. Call VNCServer::requestClipboard() to // access the actual data. - virtual void handleClipboardAnnounce(bool __unused_attr available) {} + virtual void handleClipboardAnnounce(bool /*available*/) {} // handleClipboardData() is called when a client has sent over // the clipboard data as a result of a previous call to // VNCServer::requestClipboard(). Note that this function might // never be called if the clipboard data was no longer available // when the client received the request. - virtual void handleClipboardData(const char* __unused_attr data) {} + virtual void handleClipboardData(const char* /*data*/) {} protected: virtual ~SDesktop() {} @@ -149,7 +149,7 @@ namespace rfb { server = 0; } virtual void queryConnection(network::Socket* sock, - const char* userName) { + const char* /*userName*/) { server->approveConnection(sock, true, NULL); } diff --git a/common/rfb/SMsgHandler.cxx b/common/rfb/SMsgHandler.cxx index 0f813178..4f008039 100644 --- a/common/rfb/SMsgHandler.cxx +++ b/common/rfb/SMsgHandler.cxx @@ -40,7 +40,7 @@ SMsgHandler::~SMsgHandler() { } -void SMsgHandler::clientInit(bool shared) +void SMsgHandler::clientInit(bool /*shared*/) { } @@ -118,21 +118,21 @@ void SMsgHandler::handleClipboardCaps(rdr::U32 flags, const rdr::U32* lengths) client.setClipboardCaps(flags, lengths); } -void SMsgHandler::handleClipboardRequest(rdr::U32 flags) +void SMsgHandler::handleClipboardRequest(rdr::U32 /*flags*/) { } -void SMsgHandler::handleClipboardPeek(rdr::U32 flags) +void SMsgHandler::handleClipboardPeek() { } -void SMsgHandler::handleClipboardNotify(rdr::U32 flags) +void SMsgHandler::handleClipboardNotify(rdr::U32 /*flags*/) { } -void SMsgHandler::handleClipboardProvide(rdr::U32 flags, - const size_t* lengths, - const rdr::U8* const* data) +void SMsgHandler::handleClipboardProvide(rdr::U32 /*flags*/, + const size_t* /*lengths*/, + const rdr::U8* const* /*data*/) { } diff --git a/common/rfb/SMsgHandler.h b/common/rfb/SMsgHandler.h index b290f194..274a1c3c 100644 --- a/common/rfb/SMsgHandler.h +++ b/common/rfb/SMsgHandler.h @@ -57,7 +57,7 @@ namespace rfb { virtual void handleClipboardCaps(rdr::U32 flags, const rdr::U32* lengths); virtual void handleClipboardRequest(rdr::U32 flags); - virtual void handleClipboardPeek(rdr::U32 flags); + virtual void handleClipboardPeek(); virtual void handleClipboardNotify(rdr::U32 flags); virtual void handleClipboardProvide(rdr::U32 flags, const size_t* lengths, diff --git a/common/rfb/SMsgReader.cxx b/common/rfb/SMsgReader.cxx index e5582630..e7c78c4e 100644 --- a/common/rfb/SMsgReader.cxx +++ b/common/rfb/SMsgReader.cxx @@ -429,7 +429,7 @@ bool SMsgReader::readExtendedClipboard(rdr::S32 len) handler->handleClipboardRequest(flags); break; case clipboardPeek: - handler->handleClipboardPeek(flags); + handler->handleClipboardPeek(); break; case clipboardNotify: handler->handleClipboardNotify(flags); diff --git a/common/rfb/SSecurityRSAAES.cxx b/common/rfb/SSecurityRSAAES.cxx index 15d2e97b..3211f12f 100644 --- a/common/rfb/SSecurityRSAAES.cxx +++ b/common/rfb/SSecurityRSAAES.cxx @@ -238,36 +238,35 @@ bool SSecurityRSAAES::processMsg() loadPrivateKey(); writePublicKey(); state = ReadPublicKey; - // fall through + /* fall through */ case ReadPublicKey: - if (readPublicKey()) { - writeRandom(); - state = ReadRandom; - } - return false; + if (!readPublicKey()) + return false; + writeRandom(); + state = ReadRandom; + /* fall through */ case ReadRandom: - if (readRandom()) { - setCipher(); - writeHash(); - state = ReadHash; - } - return false; + if (!readRandom()) + return false; + setCipher(); + writeHash(); + state = ReadHash; + /* fall through */ case ReadHash: - if (readHash()) { - clearSecrets(); - writeSubtype(); - state = ReadCredentials; - } - return false; + if (!readHash()) + return false; + clearSecrets(); + writeSubtype(); + state = ReadCredentials; + /* fall through */ case ReadCredentials: - if (readCredentials()) { - if (requireUsername) - verifyUserPass(); - else - verifyPass(); - return true; - } - return false; + if (!readCredentials()) + return false; + if (requireUsername) + verifyUserPass(); + else + verifyPass(); + return true; } assert(!"unreachable"); return false; diff --git a/common/rfb/ServerParams.h b/common/rfb/ServerParams.h index ce0c722f..dba8b9a1 100644 --- a/common/rfb/ServerParams.h +++ b/common/rfb/ServerParams.h @@ -51,8 +51,8 @@ namespace rfb { return !beforeVersion(major,minor+1); } - const int width() const { return width_; } - const int height() const { return height_; } + int width() const { return width_; } + int height() const { return height_; } const ScreenSet& screenLayout() const { return screenLayout_; } void setDimensions(int width, int height); void setDimensions(int width, int height, const ScreenSet& layout); diff --git a/common/rfb/TightDecoder.cxx b/common/rfb/TightDecoder.cxx index ce01104e..69971dbc 100644 --- a/common/rfb/TightDecoder.cxx +++ b/common/rfb/TightDecoder.cxx @@ -199,13 +199,13 @@ bool TightDecoder::readRect(const Rect& r, rdr::InStream* is, return true; } -bool TightDecoder::doRectsConflict(const Rect& rectA, +bool TightDecoder::doRectsConflict(const Rect& /*rectA*/, const void* bufferA, size_t buflenA, - const Rect& rectB, + const Rect& /*rectB*/, const void* bufferB, size_t buflenB, - const ServerParams& server) + const ServerParams& /*server*/) { rdr::U8 comp_ctl_a, comp_ctl_b; diff --git a/common/rfb/TightEncoder.cxx b/common/rfb/TightEncoder.cxx index 5cce03e9..94acd3d1 100644 --- a/common/rfb/TightEncoder.cxx +++ b/common/rfb/TightEncoder.cxx @@ -89,7 +89,7 @@ void TightEncoder::writeRect(const PixelBuffer* pb, const Palette& palette) { switch (palette.size()) { case 0: - writeFullColourRect(pb, palette); + writeFullColourRect(pb); break; case 1: Encoder::writeSolidRect(pb, palette); @@ -102,7 +102,7 @@ void TightEncoder::writeRect(const PixelBuffer* pb, const Palette& palette) } } -void TightEncoder::writeSolidRect(int width, int height, +void TightEncoder::writeSolidRect(int /*width*/, int /*height*/, const PixelFormat& pf, const rdr::U8* colour) { @@ -154,11 +154,11 @@ void TightEncoder::writeIndexedRect(const PixelBuffer* pb, const Palette& palett break; default: // It's more efficient to just do raw pixels - writeFullColourRect(pb, palette); + writeFullColourRect(pb); } } -void TightEncoder::writeFullColourRect(const PixelBuffer* pb, const Palette& palette) +void TightEncoder::writeFullColourRect(const PixelBuffer* pb) { const int streamId = 0; diff --git a/common/rfb/TightEncoder.h b/common/rfb/TightEncoder.h index 7bce2642..b96bc4c6 100644 --- a/common/rfb/TightEncoder.h +++ b/common/rfb/TightEncoder.h @@ -43,7 +43,7 @@ namespace rfb { protected: void writeMonoRect(const PixelBuffer* pb, const Palette& palette); void writeIndexedRect(const PixelBuffer* pb, const Palette& palette); - void writeFullColourRect(const PixelBuffer* pb, const Palette& palette); + void writeFullColourRect(const PixelBuffer* pb); void writePixels(const rdr::U8* buffer, const PixelFormat& pf, unsigned int count, rdr::OutStream* os); diff --git a/common/rfb/TightJPEGEncoder.cxx b/common/rfb/TightJPEGEncoder.cxx index 11701e74..976601f7 100644 --- a/common/rfb/TightJPEGEncoder.cxx +++ b/common/rfb/TightJPEGEncoder.cxx @@ -112,7 +112,8 @@ int TightJPEGEncoder::getQualityLevel() return qualityLevel; } -void TightJPEGEncoder::writeRect(const PixelBuffer* pb, const Palette& palette) +void TightJPEGEncoder::writeRect(const PixelBuffer* pb, + const Palette& /*palette*/) { const rdr::U8* buffer; int stride; diff --git a/common/rfb/UnixPasswordValidator.cxx b/common/rfb/UnixPasswordValidator.cxx index ee7bc0da..fa1513a4 100644 --- a/common/rfb/UnixPasswordValidator.cxx +++ b/common/rfb/UnixPasswordValidator.cxx @@ -37,7 +37,7 @@ AliasParameter pam_service("pam_service", "Alias for PAMService", int do_pam_auth(const char *service, const char *username, const char *password); -bool UnixPasswordValidator::validateInternal(SConnection * sc, +bool UnixPasswordValidator::validateInternal(SConnection * /*sc*/, const char *username, const char *password) { diff --git a/common/rfb/WinPasswdValidator.cxx b/common/rfb/WinPasswdValidator.cxx index b2edde5f..f07c27e8 100644 --- a/common/rfb/WinPasswdValidator.cxx +++ b/common/rfb/WinPasswdValidator.cxx @@ -29,7 +29,7 @@ using namespace rfb; // This method will only work for Windows NT, 2000, and XP (and possibly Vista) -bool WinPasswdValidator::validateInternal(rfb::SConnection* sc, +bool WinPasswdValidator::validateInternal(rfb::SConnection* /*sc*/, const char* username, const char* password) { diff --git a/common/rfb/ZRLEDecoder.cxx b/common/rfb/ZRLEDecoder.cxx index 3c7ed2ce..f5120e9c 100644 --- a/common/rfb/ZRLEDecoder.cxx +++ b/common/rfb/ZRLEDecoder.cxx @@ -80,8 +80,9 @@ ZRLEDecoder::~ZRLEDecoder() { } -bool ZRLEDecoder::readRect(const Rect& r, rdr::InStream* is, - const ServerParams& server, rdr::OutStream* os) +bool ZRLEDecoder::readRect(const Rect& /*r*/, rdr::InStream* is, + const ServerParams& /*server*/, + rdr::OutStream* os) { rdr::U32 len; diff --git a/common/rfb/ZRLEEncoder.cxx b/common/rfb/ZRLEEncoder.cxx index ff70c6ee..7d985401 100644 --- a/common/rfb/ZRLEEncoder.cxx +++ b/common/rfb/ZRLEEncoder.cxx @@ -76,7 +76,7 @@ void ZRLEEncoder::writeRect(const PixelBuffer* pb, const Palette& palette) tile.br.x = pb->width(); if (palette.size() == 0) - writeRawTile(tile, pb, palette); + writeRawTile(tile, pb); else if (palette.size() <= 16) writePaletteTile(tile, pb, palette); else @@ -171,8 +171,7 @@ void ZRLEEncoder::writePaletteRLETile(const Rect& tile, const PixelBuffer* pb, } } -void ZRLEEncoder::writeRawTile(const Rect& tile, const PixelBuffer* pb, - const Palette& palette) +void ZRLEEncoder::writeRawTile(const Rect& tile, const PixelBuffer* pb) { const rdr::U8* buffer; int stride; diff --git a/common/rfb/ZRLEEncoder.h b/common/rfb/ZRLEEncoder.h index d61bab17..37a3be2d 100644 --- a/common/rfb/ZRLEEncoder.h +++ b/common/rfb/ZRLEEncoder.h @@ -42,8 +42,7 @@ namespace rfb { const Palette& palette); void writePaletteRLETile(const Rect& tile, const PixelBuffer* pb, const Palette& palette); - void writeRawTile(const Rect& tile, const PixelBuffer* pb, - const Palette& palette); + void writeRawTile(const Rect& tile, const PixelBuffer* pb); void writePalette(const PixelFormat& pf, const Palette& palette); diff --git a/common/rfb/util.h b/common/rfb/util.h index f0ac9ef8..99d350e3 100644 --- a/common/rfb/util.h +++ b/common/rfb/util.h @@ -29,16 +29,6 @@ struct timeval; -#ifdef __GNUC__ -# define __printf_attr(a, b) __attribute__((__format__ (__printf__, a, b))) -#else -# define __printf_attr(a, b) -#endif // __GNUC__ - -#ifndef __unused_attr -# define __unused_attr __attribute((__unused__)) -#endif - namespace rfb { // -=- Class to handle cleanup of arrays of characters @@ -53,7 +43,8 @@ namespace rfb { ~CharArray() { delete [] buf; } - void format(const char *fmt, ...) __printf_attr(2, 3); + void format(const char *fmt, ...) + __attribute__((__format__ (__printf__, 2, 3))); // Get the buffer pointer & clear it (i.e. caller takes ownership) char* takeBuf() {char* tmp = buf; buf = 0; return tmp;} void replaceBuf(char* b) {delete [] buf; buf = b;} diff --git a/tests/perf/CMakeLists.txt b/tests/perf/CMakeLists.txt index 70ffe777..562adfc0 100644 --- a/tests/perf/CMakeLists.txt +++ b/tests/perf/CMakeLists.txt @@ -1,5 +1,5 @@ include_directories(${CMAKE_SOURCE_DIR}/common) -include_directories(${GETTEXT_INCLUDE_DIR}) +include_directories(SYSTEM ${GETTEXT_INCLUDE_DIR}) add_library(test_util STATIC util.cxx) @@ -13,7 +13,7 @@ add_executable(encperf encperf.cxx) target_link_libraries(encperf test_util rfb) if (BUILD_VIEWER) - include_directories(${FLTK_INCLUDE_DIR}) + include_directories(SYSTEM ${FLTK_INCLUDE_DIR}) add_executable(fbperf fbperf.cxx ${CMAKE_SOURCE_DIR}/vncviewer/PlatformPixelBuffer.cxx diff --git a/tests/perf/convperf.cxx b/tests/perf/convperf.cxx index 4897f159..7a01bae8 100644 --- a/tests/perf/convperf.cxx +++ b/tests/perf/convperf.cxx @@ -41,7 +41,8 @@ struct TestEntry { testfn fn; }; -static void testMemcpy(rfb::PixelFormat &dstpf, rfb::PixelFormat &srcpf, +static void testMemcpy(rfb::PixelFormat &dstpf, + rfb::PixelFormat& /*srcpf*/, rdr::U8 *dst, rdr::U8 *src) { int h; @@ -53,19 +54,22 @@ static void testMemcpy(rfb::PixelFormat &dstpf, rfb::PixelFormat &srcpf, } } -static void testBuffer(rfb::PixelFormat &dstpf, rfb::PixelFormat &srcpf, +static void testBuffer(rfb::PixelFormat &dstpf, + rfb::PixelFormat &srcpf, rdr::U8 *dst, rdr::U8 *src) { dstpf.bufferFromBuffer(dst, srcpf, src, tile, tile, fbsize, fbsize); } -static void testToRGB(rfb::PixelFormat &dstpf, rfb::PixelFormat &srcpf, +static void testToRGB(rfb::PixelFormat& /*dstpf*/, + rfb::PixelFormat &srcpf, rdr::U8 *dst, rdr::U8 *src) { srcpf.rgbFromBuffer(dst, src, tile, fbsize, tile); } -static void testFromRGB(rfb::PixelFormat &dstpf, rfb::PixelFormat &srcpf, +static void testFromRGB(rfb::PixelFormat &dstpf, + rfb::PixelFormat& /*srcpf*/, rdr::U8 *dst, rdr::U8 *src) { dstpf.bufferFromRGB(dst, src, tile, fbsize, tile); @@ -120,7 +124,7 @@ static void doTests(rfb::PixelFormat &dstpf, rfb::PixelFormat &srcpf) printf("\n"); } -int main(int argc, char **argv) +int main(int /*argc*/, char** /*argv*/) { size_t bufsize; diff --git a/tests/perf/decperf.cxx b/tests/perf/decperf.cxx index 21674127..0509c15d 100644 --- a/tests/perf/decperf.cxx +++ b/tests/perf/decperf.cxx @@ -139,7 +139,7 @@ void CConn::initDone() server.height())); } -void CConn::setPixelFormat(const rfb::PixelFormat& pf) +void CConn::setPixelFormat(const rfb::PixelFormat& /*pf*/) { // Override format CConnection::setPixelFormat(filePF); diff --git a/tests/perf/encperf.cxx b/tests/perf/encperf.cxx index 8fb9553d..476b613a 100644 --- a/tests/perf/encperf.cxx +++ b/tests/perf/encperf.cxx @@ -329,12 +329,11 @@ void SConn::getStats(double& ratio, unsigned long long& bytes, manager->getStats(ratio, bytes, rawEquivalent); } -void SConn::setAccessRights(AccessRights ar) +void SConn::setAccessRights(AccessRights) { } -void SConn::setDesktopSize(int fb_width, int fb_height, - const rfb::ScreenSet& layout) +void SConn::setDesktopSize(int, int, const rfb::ScreenSet&) { } diff --git a/tests/perf/fbperf.cxx b/tests/perf/fbperf.cxx index 01781725..d512ef80 100644 --- a/tests/perf/fbperf.cxx +++ b/tests/perf/fbperf.cxx @@ -378,7 +378,7 @@ static void dotest(TestWindow* win) 1.0 / (delay + rate * 1920 * 1080)); } -int main(int argc, char** argv) +int main(int /*argc*/, char** /*argv*/) { TestWindow* win; diff --git a/tests/unit/CMakeLists.txt b/tests/unit/CMakeLists.txt index 6daecba5..00f38b76 100644 --- a/tests/unit/CMakeLists.txt +++ b/tests/unit/CMakeLists.txt @@ -1,6 +1,6 @@ include_directories(${CMAKE_SOURCE_DIR}/common) include_directories(${CMAKE_SOURCE_DIR}/vncviewer) -include_directories(${GETTEXT_INCLUDE_DIR}) +include_directories(SYSTEM ${GETTEXT_INCLUDE_DIR}) add_executable(conv conv.cxx) target_link_libraries(conv rfb) diff --git a/tests/unit/conv.cxx b/tests/unit/conv.cxx index b14f8987..5696c149 100644 --- a/tests/unit/conv.cxx +++ b/tests/unit/conv.cxx @@ -291,7 +291,7 @@ static void doTests(const rfb::PixelFormat &dstpf, } } -int main(int argc, char **argv) +int main(int /*argc*/, char** /*argv*/) { rfb::PixelFormat dstpf, srcpf; diff --git a/tests/unit/convertlf.cxx b/tests/unit/convertlf.cxx index b85b270c..4dff9098 100644 --- a/tests/unit/convertlf.cxx +++ b/tests/unit/convertlf.cxx @@ -84,7 +84,7 @@ static void testCRLF(const char* input, const char* expected) rfb::strFree(output); } -int main(int argc, char** argv) +int main(int /*argc*/, char** /*argv*/) { testLF("", ""); testLF("no EOL", "no EOL"); diff --git a/tests/unit/emulatemb.cxx b/tests/unit/emulatemb.cxx index 927f3e48..7dfc2541 100644 --- a/tests/unit/emulatemb.cxx +++ b/tests/unit/emulatemb.cxx @@ -461,7 +461,7 @@ void testDragAndRelease() printf("OK\n"); } -int main(int argc, char** argv) +int main(int /*argc*/, char** /*argv*/) { testDisabledOption(); diff --git a/tests/unit/gesturehandler.cxx b/tests/unit/gesturehandler.cxx index 12d83556..bc39c24c 100644 --- a/tests/unit/gesturehandler.cxx +++ b/tests/unit/gesturehandler.cxx @@ -1233,7 +1233,7 @@ void testIgnore() testIgnoreAfterGesture(); } -int main(int argc, char** argv) +int main(int /*argc*/, char** /*argv*/) { testOneTap(); testTwoTap(); diff --git a/tests/unit/hostport.cxx b/tests/unit/hostport.cxx index 6ca5df8f..93ebc4c7 100644 --- a/tests/unit/hostport.cxx +++ b/tests/unit/hostport.cxx @@ -46,7 +46,7 @@ static void doTest(const char* hostAndPort, rfb::strFree(host); } -int main(int argc, char** argv) +int main(int /*argc*/, char** /*argv*/) { doTest(":5", "localhost", 5905); diff --git a/tests/unit/pixelformat.cxx b/tests/unit/pixelformat.cxx index 6ab736b8..a2ca50d0 100644 --- a/tests/unit/pixelformat.cxx +++ b/tests/unit/pixelformat.cxx @@ -183,7 +183,7 @@ void is888Tests() printf("\n"); } -int main(int argc, char** argv) +int main(int /*argc*/, char** /*argv*/) { sanityTests(); is888Tests(); diff --git a/tests/unit/unicode.cxx b/tests/unit/unicode.cxx index aa2af85b..0cd0f077 100644 --- a/tests/unit/unicode.cxx +++ b/tests/unit/unicode.cxx @@ -85,7 +85,7 @@ struct _utf8utf16 utf8utf16[] = { #define ARRAY_SIZE(a) (sizeof(a)/sizeof(*a)) -int main(int argc, char** argv) +int main(int /*argc*/, char** /*argv*/) { int failures; size_t i; diff --git a/unix/tx/CMakeLists.txt b/unix/tx/CMakeLists.txt index 67976150..e913de3c 100644 --- a/unix/tx/CMakeLists.txt +++ b/unix/tx/CMakeLists.txt @@ -1,4 +1,4 @@ -include_directories(${X11_INCLUDE_DIR}) +include_directories(SYSTEM ${X11_INCLUDE_DIR}) include_directories(${CMAKE_SOURCE_DIR}/common) include_directories(${CMAKE_SOURCE_DIR}/common/rfb) diff --git a/unix/tx/TXButton.h b/unix/tx/TXButton.h index b7472797..35694333 100644 --- a/unix/tx/TXButton.h +++ b/unix/tx/TXButton.h @@ -91,7 +91,7 @@ private: XDrawString(dpy, win(), gc, startx, starty, text.buf, strlen(text.buf)); } - virtual void handleEvent(TXWindow* w, XEvent* ev) { + virtual void handleEvent(TXWindow* /*w*/, XEvent* ev) { switch (ev->type) { case Expose: paint(); diff --git a/unix/tx/TXCheckbox.h b/unix/tx/TXCheckbox.h index 0880b38c..76cdc950 100644 --- a/unix/tx/TXCheckbox.h +++ b/unix/tx/TXCheckbox.h @@ -109,7 +109,7 @@ private: text, strlen(text)); } - virtual void handleEvent(TXWindow* w, XEvent* ev) { + virtual void handleEvent(TXWindow* /*w*/, XEvent* ev) { switch (ev->type) { case Expose: paint(); diff --git a/unix/tx/TXDialog.h b/unix/tx/TXDialog.h index 28876e7e..861a20be 100644 --- a/unix/tx/TXDialog.h +++ b/unix/tx/TXDialog.h @@ -82,7 +82,7 @@ public: } protected: - virtual void deleteWindow(TXWindow* w) { + virtual void deleteWindow(TXWindow* /*w*/) { ok = false; done = true; unmap(); diff --git a/unix/tx/TXLabel.h b/unix/tx/TXLabel.h index 3d5200d6..aba798cb 100644 --- a/unix/tx/TXLabel.h +++ b/unix/tx/TXLabel.h @@ -108,7 +108,7 @@ private: } while (text.buf[i] != 0); } - virtual void handleEvent(TXWindow* w, XEvent* ev) { + virtual void handleEvent(TXWindow* /*w*/, XEvent* ev) { switch (ev->type) { case Expose: paint(); diff --git a/unix/tx/TXWindow.h b/unix/tx/TXWindow.h index 5a72c335..746791d6 100644 --- a/unix/tx/TXWindow.h +++ b/unix/tx/TXWindow.h @@ -142,19 +142,21 @@ public: // takeFocus() is called when the window has received keyboard focus from the // window manager. - virtual void takeFocus(Time time) {} + virtual void takeFocus(Time /*time*/) {} // selectionNotify() is called when the selection owner has replied to a // request for information about a selection from the selection owner. - virtual void selectionNotify(XSelectionEvent* ev, Atom type, int format, - int nitems, void* data) {} + virtual void selectionNotify(XSelectionEvent* /*ev*/, Atom /*type*/, + int /*format*/, int /*nitems*/, + void* /*data*/) {} // selectionRequest() is called when this window is the selection owner and // another X client has requested the selection. It should set the given // property on the given window to the value of the given selection, // returning true if successful, false otherwise. - virtual bool selectionRequest(Window requestor, - Atom selection, Atom property) { return false;} + virtual bool selectionRequest(Window /*requestor*/, + Atom /*selection*/, + Atom /*property*/) { return false;} // Static methods diff --git a/unix/vncconfig/CMakeLists.txt b/unix/vncconfig/CMakeLists.txt index c3823ab0..8734ff63 100644 --- a/unix/vncconfig/CMakeLists.txt +++ b/unix/vncconfig/CMakeLists.txt @@ -1,4 +1,4 @@ -include_directories(${X11_INCLUDE_DIR}) +include_directories(SYSTEM ${X11_INCLUDE_DIR}) include_directories(${CMAKE_SOURCE_DIR}/common) include_directories(${CMAKE_SOURCE_DIR}/unix/tx) diff --git a/unix/vncconfig/QueryConnectDialog.cxx b/unix/vncconfig/QueryConnectDialog.cxx index 31302d2d..e13af34b 100644 --- a/unix/vncconfig/QueryConnectDialog.cxx +++ b/unix/vncconfig/QueryConnectDialog.cxx @@ -74,7 +74,7 @@ void QueryConnectDialog::buttonActivate(TXButton* b) { callback->queryRejected(); } -bool QueryConnectDialog::handleTimeout(rfb::Timer* t) { +bool QueryConnectDialog::handleTimeout(rfb::Timer* /*t*/) { if (timeUntilReject-- == 0) { unmap(); callback->queryTimedOut(); diff --git a/unix/vncconfig/vncconfig.cxx b/unix/vncconfig/vncconfig.cxx index 276d0e62..c15d91f4 100644 --- a/unix/vncconfig/vncconfig.cxx +++ b/unix/vncconfig/vncconfig.cxx @@ -110,7 +110,7 @@ public: // handleEvent() - virtual void handleEvent(TXWindow* w, XEvent* ev) { + virtual void handleEvent(TXWindow* /*w*/, XEvent* ev) { if (ev->type == vncExtEventBase + VncExtQueryConnectNotify) { vlog.debug("query connection event"); if (queryConnectDialog) @@ -134,7 +134,7 @@ public: } // TXDeleteWindowCallback method - virtual void deleteWindow(TXWindow* w) { + virtual void deleteWindow(TXWindow* /*w*/) { exit(1); } diff --git a/unix/vncserver/vncsession.c b/unix/vncserver/vncsession.c index 49d68435..c7229221 100644 --- a/unix/vncserver/vncsession.c +++ b/unix/vncserver/vncsession.c @@ -48,7 +48,7 @@ extern char **environ; const char *SERVICE_NAME = "tigervnc"; // Main script PID -volatile static pid_t script = -1; +static volatile pid_t script = -1; // Daemon completion pipe int daemon_pipe_fd = -1; @@ -142,6 +142,7 @@ finish_daemon(void) static void sighandler(int sig) { + (void)sig; if (script > 0) { kill(script, SIGTERM); } @@ -169,6 +170,10 @@ conv(int num_msg, const struct pam_message **msg, struct pam_response **resp, void *appdata_ptr) { + (void)num_msg; + (void)msg; + (void)resp; + (void)appdata_ptr; /* Opening a session should not require a conversation */ return PAM_CONV_ERR; } @@ -344,7 +349,7 @@ static void redir_stdio(const char *homedir, const char *display) { int fd; - size_t hostlen; + long hostlen; char* hostname = NULL; char logfile[PATH_MAX]; diff --git a/unix/x0vncserver/CMakeLists.txt b/unix/x0vncserver/CMakeLists.txt index af824150..488a78fd 100644 --- a/unix/x0vncserver/CMakeLists.txt +++ b/unix/x0vncserver/CMakeLists.txt @@ -1,4 +1,4 @@ -include_directories(${X11_INCLUDE_DIR}) +include_directories(SYSTEM ${X11_INCLUDE_DIR}) include_directories(${CMAKE_SOURCE_DIR}/unix/common) include_directories(${CMAKE_SOURCE_DIR}/unix/tx) include_directories(${CMAKE_SOURCE_DIR}/unix) diff --git a/unix/x0vncserver/Image.cxx b/unix/x0vncserver/Image.cxx index fb2d0602..b171c904 100644 --- a/unix/x0vncserver/Image.cxx +++ b/unix/x0vncserver/Image.cxx @@ -208,7 +208,8 @@ void Image::updateRect(Image *src, int dst_x, int dst_y, static bool caughtShmError = false; -static int ShmCreationXErrorHandler(Display *dpy, XErrorEvent *error) +static int ShmCreationXErrorHandler(Display* /*dpy*/, + XErrorEvent* /*error*/) { caughtShmError = true; return 0; diff --git a/unix/x0vncserver/RandrGlue.c b/unix/x0vncserver/RandrGlue.c index 9530fd7a..f303297a 100644 --- a/unix/x0vncserver/RandrGlue.c +++ b/unix/x0vncserver/RandrGlue.c @@ -505,11 +505,13 @@ int vncRandRReconfigureOutput(int outputIdx, int x, int y, int vncRandRCanCreateOutputs(int extraOutputs) { + (void)extraOutputs; return 0; } int vncRandRCreateOutputs(int extraOutputs) { + (void)extraOutputs; return 0; } diff --git a/unix/x0vncserver/XDesktop.cxx b/unix/x0vncserver/XDesktop.cxx index d5c6b2db..5f5366b7 100644 --- a/unix/x0vncserver/XDesktop.cxx +++ b/unix/x0vncserver/XDesktop.cxx @@ -545,7 +545,7 @@ void XDesktop::keyEvent(rdr::U32 keysym, rdr::U32 xtcode, bool down) { #endif } -void XDesktop::clientCutText(const char* str) { +void XDesktop::clientCutText(const char* /*str*/) { } ScreenSet XDesktop::computeScreenLayout() diff --git a/unix/x0vncserver/x0vncserver.cxx b/unix/x0vncserver/x0vncserver.cxx index 7384f93a..c89cd853 100644 --- a/unix/x0vncserver/x0vncserver.cxx +++ b/unix/x0vncserver/x0vncserver.cxx @@ -78,7 +78,7 @@ StringParameter interface("interface", static const char* defaultDesktopName() { - size_t host_max = sysconf(_SC_HOST_NAME_MAX); + long host_max = sysconf(_SC_HOST_NAME_MAX); if (host_max < 0) return ""; @@ -90,7 +90,7 @@ static const char* defaultDesktopName() if (pwent == NULL) return ""; - size_t len = snprintf(NULL, 0, "%s@%s", pwent->pw_name, hostname.data()); + int len = snprintf(NULL, 0, "%s@%s", pwent->pw_name, hostname.data()); if (len < 0) return ""; @@ -108,7 +108,7 @@ static const char* defaultDesktopName() static bool caughtSignal = false; -static void CleanupSignalHandler(int sig) +static void CleanupSignalHandler(int /*sig*/) { caughtSignal = true; } diff --git a/unix/xserver/hw/vnc/RFBGlue.h b/unix/xserver/hw/vnc/RFBGlue.h index 695cea10..9dd91eab 100644 --- a/unix/xserver/hw/vnc/RFBGlue.h +++ b/unix/xserver/hw/vnc/RFBGlue.h @@ -26,16 +26,14 @@ extern "C" { void vncInitRFB(void); -#ifdef __GNUC__ -# define __printf_attr(a, b) __attribute__((__format__ (__printf__, a, b))) -#else -# define __printf_attr(a, b) -#endif // __GNUC__ - -void vncLogError(const char *name, const char *format, ...) __printf_attr(2, 3); -void vncLogStatus(const char *name, const char *format, ...) __printf_attr(2, 3); -void vncLogInfo(const char *name, const char *format, ...) __printf_attr(2, 3); -void vncLogDebug(const char *name, const char *format, ...) __printf_attr(2, 3); +void vncLogError(const char *name, const char *format, ...) + __attribute__((__format__ (__printf__, 2, 3))); +void vncLogStatus(const char *name, const char *format, ...) + __attribute__((__format__ (__printf__, 2, 3))); +void vncLogInfo(const char *name, const char *format, ...) + __attribute__((__format__ (__printf__, 2, 3))); +void vncLogDebug(const char *name, const char *format, ...) + __attribute__((__format__ (__printf__, 2, 3))); int vncSetParam(const char *name, const char *value); int vncSetParamSimple(const char *nameAndValue); diff --git a/unix/xserver/hw/vnc/XorgGlue.h b/unix/xserver/hw/vnc/XorgGlue.h index 5d019493..40b3d343 100644 --- a/unix/xserver/hw/vnc/XorgGlue.h +++ b/unix/xserver/hw/vnc/XorgGlue.h @@ -24,18 +24,12 @@ extern "C" { #endif -#ifdef __GNUC__ -# define __printf_attr(a, b) __attribute__((__format__ (__printf__, a, b))) -# define __noreturn_attr __attribute__((noreturn)) -#else -# define __printf_attr(a, b) -# define __noreturn_attr -#endif // __GNUC__ - const char *vncGetDisplay(void); unsigned long vncGetServerGeneration(void); -void vncFatalError(const char *format, ...) __printf_attr(1, 2) __noreturn_attr; +void vncFatalError(const char *format, ...) + __attribute__((__format__ (__printf__, 1, 2))) + __attribute__((noreturn)); int vncGetScreenCount(void); diff --git a/vncviewer/CConn.cxx b/vncviewer/CConn.cxx index 045d8f67..da27b848 100644 --- a/vncviewer/CConn.cxx +++ b/vncviewer/CConn.cxx @@ -399,7 +399,8 @@ void CConn::framebufferUpdateEnd() // The rest of the callbacks are fairly self-explanatory... -void CConn::setColourMapEntries(int firstColour, int nColours, rdr::U16* rgbs) +void CConn::setColourMapEntries(int /*firstColour*/, int /*nColours*/, + rdr::U16* /*rgbs*/) { vlog.error(_("Invalid SetColourMapEntries from server!")); } diff --git a/vncviewer/CMakeLists.txt b/vncviewer/CMakeLists.txt index 87ab5f47..01b3a89c 100644 --- a/vncviewer/CMakeLists.txt +++ b/vncviewer/CMakeLists.txt @@ -1,5 +1,5 @@ -include_directories(${FLTK_INCLUDE_DIR}) -include_directories(${GETTEXT_INCLUDE_DIR}) +include_directories(SYSTEM ${FLTK_INCLUDE_DIR}) +include_directories(SYSTEM ${GETTEXT_INCLUDE_DIR}) include_directories(${CMAKE_SOURCE_DIR}/common) diff --git a/vncviewer/DesktopWindow.cxx b/vncviewer/DesktopWindow.cxx index 9b086f4f..70573a28 100644 --- a/vncviewer/DesktopWindow.cxx +++ b/vncviewer/DesktopWindow.cxx @@ -840,6 +840,7 @@ int DesktopWindow::handle(int event) case FL_ENTER: if (keyboardGrabbed) grabPointer(); + /* fall through */ case FL_LEAVE: case FL_DRAG: case FL_MOVE: @@ -1031,7 +1032,8 @@ void DesktopWindow::fullscreen_on() } #if !defined(WIN32) && !defined(__APPLE__) -Bool eventIsFocusWithSerial(Display *display, XEvent *event, XPointer arg) +Bool eventIsFocusWithSerial(Display* /*display*/, XEvent *event, + XPointer arg) { unsigned long serial; @@ -1270,7 +1272,7 @@ void DesktopWindow::handleResizeTimeout(void *data) } -void DesktopWindow::reconfigureFullscreen(void *data) +void DesktopWindow::reconfigureFullscreen(void* /*data*/) { std::set<DesktopWindow *>::iterator iter; @@ -1495,7 +1497,7 @@ void DesktopWindow::repositionWidgets() vscroll->value(vscroll->clamp(vscroll->value())); } -void DesktopWindow::handleClose(Fl_Widget *wnd, void *data) +void DesktopWindow::handleClose(Fl_Widget* /*wnd*/, void* /*data*/) { disconnect(); } @@ -1552,7 +1554,7 @@ void DesktopWindow::scrollTo(int x, int y) damage(FL_DAMAGE_SCROLL); } -void DesktopWindow::handleScroll(Fl_Widget *widget, void *data) +void DesktopWindow::handleScroll(Fl_Widget* /*widget*/, void *data) { DesktopWindow *self = (DesktopWindow *)data; diff --git a/vncviewer/DesktopWindow.h b/vncviewer/DesktopWindow.h index a654b126..f7721f2e 100644 --- a/vncviewer/DesktopWindow.h +++ b/vncviewer/DesktopWindow.h @@ -37,12 +37,6 @@ class Viewport; class Fl_Scrollbar; -#ifdef __GNUC__ -# define __printf_attr(a, b) __attribute__((__format__ (__printf__, a, b))) -#else -# define __printf_attr(a, b) -#endif // __GNUC__ - class DesktopWindow : public Fl_Window { public: @@ -89,7 +83,8 @@ public: private: static void menuOverlay(void *data); - void setOverlay(const char *text, ...) __printf_attr(2, 3); + void setOverlay(const char *text, ...) + __attribute__((__format__ (__printf__, 2, 3))); static void updateOverlay(void *data); static int fltkDispatch(int event, Fl_Window *win); diff --git a/vncviewer/MonitorIndicesParameter.cxx b/vncviewer/MonitorIndicesParameter.cxx index 7fabf85b..691a8470 100644 --- a/vncviewer/MonitorIndicesParameter.cxx +++ b/vncviewer/MonitorIndicesParameter.cxx @@ -76,9 +76,6 @@ bool MonitorIndicesParameter::setParam(const char* value) int index; std::set<int> indices; - if (strlen(value) < 0) - return false; - if (!parseIndices(value, &indices, true)) { vlog.error(_("Invalid configuration specified for %s"), name); return false; @@ -200,7 +197,7 @@ std::vector<MonitorIndicesParameter::Monitor> MonitorIndicesParameter::fetchMoni // Start by creating a struct for every monitor. for (int i = 0; i < Fl::screen_count(); i++) { - Monitor monitor = {0}; + Monitor monitor; bool match; // Get the properties of the monitor at the current index; diff --git a/vncviewer/OptionsDialog.cxx b/vncviewer/OptionsDialog.cxx index f4736a64..d0481708 100644 --- a/vncviewer/OptionsDialog.cxx +++ b/vncviewer/OptionsDialog.cxx @@ -295,6 +295,7 @@ void OptionsDialog::loadOptions(void) case secTypeRA2ne: case secTypeRAne256: authVncCheckbox->value(true); + /* fall through */ case secTypeDH: case secTypeMSLogonII: encNoneCheckbox->value(true); @@ -1050,7 +1051,7 @@ void OptionsDialog::createMiscPage(int tx, int ty, int tw, int th) } -void OptionsDialog::handleAutoselect(Fl_Widget *widget, void *data) +void OptionsDialog::handleAutoselect(Fl_Widget* /*widget*/, void *data) { OptionsDialog *dialog = (OptionsDialog*)data; @@ -1067,7 +1068,7 @@ void OptionsDialog::handleAutoselect(Fl_Widget *widget, void *data) } -void OptionsDialog::handleCompression(Fl_Widget *widget, void *data) +void OptionsDialog::handleCompression(Fl_Widget* /*widget*/, void *data) { OptionsDialog *dialog = (OptionsDialog*)data; @@ -1078,7 +1079,7 @@ void OptionsDialog::handleCompression(Fl_Widget *widget, void *data) } -void OptionsDialog::handleJpeg(Fl_Widget *widget, void *data) +void OptionsDialog::handleJpeg(Fl_Widget* /*widget*/, void *data) { OptionsDialog *dialog = (OptionsDialog*)data; @@ -1090,7 +1091,7 @@ void OptionsDialog::handleJpeg(Fl_Widget *widget, void *data) } -void OptionsDialog::handleX509(Fl_Widget *widget, void *data) +void OptionsDialog::handleX509(Fl_Widget* /*widget*/, void *data) { OptionsDialog *dialog = (OptionsDialog*)data; @@ -1104,7 +1105,7 @@ void OptionsDialog::handleX509(Fl_Widget *widget, void *data) } -void OptionsDialog::handleRSAAES(Fl_Widget *widget, void *data) +void OptionsDialog::handleRSAAES(Fl_Widget* /*widget*/, void *data) { OptionsDialog *dialog = (OptionsDialog*)data; @@ -1115,8 +1116,9 @@ void OptionsDialog::handleRSAAES(Fl_Widget *widget, void *data) } -void OptionsDialog::handleClipboard(Fl_Widget *widget, void *data) +void OptionsDialog::handleClipboard(Fl_Widget* /*widget*/, void *data) { + (void)data; #if !defined(WIN32) && !defined(__APPLE__) OptionsDialog *dialog = (OptionsDialog*)data; @@ -1131,7 +1133,7 @@ void OptionsDialog::handleClipboard(Fl_Widget *widget, void *data) #endif } -void OptionsDialog::handleFullScreenMode(Fl_Widget *widget, void *data) +void OptionsDialog::handleFullScreenMode(Fl_Widget* /*widget*/, void *data) { OptionsDialog *dialog = (OptionsDialog*)data; @@ -1142,7 +1144,7 @@ void OptionsDialog::handleFullScreenMode(Fl_Widget *widget, void *data) } } -void OptionsDialog::handleCancel(Fl_Widget *widget, void *data) +void OptionsDialog::handleCancel(Fl_Widget* /*widget*/, void *data) { OptionsDialog *dialog = (OptionsDialog*)data; @@ -1150,7 +1152,7 @@ void OptionsDialog::handleCancel(Fl_Widget *widget, void *data) } -void OptionsDialog::handleOK(Fl_Widget *widget, void *data) +void OptionsDialog::handleOK(Fl_Widget* /*widget*/, void *data) { OptionsDialog *dialog = (OptionsDialog*)data; diff --git a/vncviewer/PlatformPixelBuffer.cxx b/vncviewer/PlatformPixelBuffer.cxx index e551651d..b37e47a5 100644 --- a/vncviewer/PlatformPixelBuffer.cxx +++ b/vncviewer/PlatformPixelBuffer.cxx @@ -135,7 +135,8 @@ rfb::Rect PlatformPixelBuffer::getDamage(void) static bool caughtError; -static int XShmAttachErrorHandler(Display *dpy, XErrorEvent *error) +static int XShmAttachErrorHandler(Display* /*dpy*/, + XErrorEvent* /*error*/) { caughtError = true; return 0; diff --git a/vncviewer/ServerDialog.cxx b/vncviewer/ServerDialog.cxx index 54c34b4f..6a4dcfc9 100644 --- a/vncviewer/ServerDialog.cxx +++ b/vncviewer/ServerDialog.cxx @@ -157,13 +157,13 @@ void ServerDialog::run(const char* servername, char *newservername) newservername[VNCSERVERNAMELEN - 1] = '\0'; } -void ServerDialog::handleOptions(Fl_Widget *widget, void *data) +void ServerDialog::handleOptions(Fl_Widget* /*widget*/, void* /*data*/) { OptionsDialog::showDialog(); } -void ServerDialog::handleLoad(Fl_Widget *widget, void *data) +void ServerDialog::handleLoad(Fl_Widget* /*widget*/, void* data) { ServerDialog *dialog = (ServerDialog*)data; @@ -201,7 +201,7 @@ void ServerDialog::handleLoad(Fl_Widget *widget, void *data) } -void ServerDialog::handleSaveAs(Fl_Widget *widget, void *data) +void ServerDialog::handleSaveAs(Fl_Widget* /*widget*/, void* data) { ServerDialog *dialog = (ServerDialog*)data; const char* servername = dialog->serverName->value(); @@ -261,13 +261,13 @@ void ServerDialog::handleSaveAs(Fl_Widget *widget, void *data) } -void ServerDialog::handleAbout(Fl_Widget *widget, void *data) +void ServerDialog::handleAbout(Fl_Widget* /*widget*/, void* /*data*/) { about_vncviewer(); } -void ServerDialog::handleCancel(Fl_Widget *widget, void *data) +void ServerDialog::handleCancel(Fl_Widget* /*widget*/, void* data) { ServerDialog *dialog = (ServerDialog*)data; @@ -276,7 +276,7 @@ void ServerDialog::handleCancel(Fl_Widget *widget, void *data) } -void ServerDialog::handleConnect(Fl_Widget *widget, void *data) +void ServerDialog::handleConnect(Fl_Widget* /*widget*/, void *data) { ServerDialog *dialog = (ServerDialog*)data; const char* servername = dialog->serverName->value(); diff --git a/vncviewer/Surface_Win32.cxx b/vncviewer/Surface_Win32.cxx index 39692452..d438fa12 100644 --- a/vncviewer/Surface_Win32.cxx +++ b/vncviewer/Surface_Win32.cxx @@ -93,7 +93,9 @@ void Surface::draw(Surface* dst, int src_x, int src_y, int x, int y, int w, int DeleteDC(dstdc); } -void Surface::blend(int src_x, int src_y, int x, int y, int w, int h, int a) +void Surface::blend(int /*src_x*/, int /*src_y*/, + int /*x*/, int /*y*/, int /*w*/, int /*h*/, + int /*a*/) { // Compositing doesn't work properly for window DC:s assert(false); diff --git a/vncviewer/Viewport.cxx b/vncviewer/Viewport.cxx index 6d970f12..89d1a097 100644 --- a/vncviewer/Viewport.cxx +++ b/vncviewer/Viewport.cxx @@ -114,7 +114,7 @@ enum { ID_DISCONNECT, ID_FULLSCREEN, ID_MINIMIZE, ID_RESIZE, static const WORD SCAN_FAKE = 0xaa; #endif -Viewport::Viewport(int w, int h, const rfb::PixelFormat& serverPF, CConn* cc_) +Viewport::Viewport(int w, int h, const rfb::PixelFormat& /*serverPF*/, CConn* cc_) : Fl_Widget(0, 0, w, h), cc(cc_), frameBuffer(NULL), lastPointerPos(0, 0), lastButtonMask(0), #ifdef WIN32 diff --git a/vncviewer/Win32TouchHandler.cxx b/vncviewer/Win32TouchHandler.cxx index dccf10a8..d6dc7aa4 100644 --- a/vncviewer/Win32TouchHandler.cxx +++ b/vncviewer/Win32TouchHandler.cxx @@ -59,7 +59,8 @@ Win32TouchHandler::Win32TouchHandler(HWND hWnd) : supportedTouches); } -bool Win32TouchHandler::processEvent(UINT Msg, WPARAM wParam, LPARAM lParam) +bool Win32TouchHandler::processEvent(UINT Msg, WPARAM /*wParam*/, + LPARAM lParam) { GESTUREINFO gi; @@ -386,7 +387,7 @@ void Win32TouchHandler::fakeButtonEvent(bool press, int button, } void Win32TouchHandler::fakeKeyEvent(bool press, int keysym, - const GestureEvent origEvent) + const GestureEvent /*origEvent*/) { UINT Msg = press ? WM_KEYDOWN : WM_KEYUP; WPARAM wParam; diff --git a/vncviewer/fltk/Fl_Monitor_Arrangement.cxx b/vncviewer/fltk/Fl_Monitor_Arrangement.cxx index ce61b1e7..3dddd801 100644 --- a/vncviewer/fltk/Fl_Monitor_Arrangement.cxx +++ b/vncviewer/fltk/Fl_Monitor_Arrangement.cxx @@ -362,7 +362,8 @@ std::string Fl_Monitor_Arrangement::description(int m) #if defined(WIN32) static BOOL CALLBACK EnumDisplayMonitorsCallback( - HMONITOR monitor, HDC deviceContext, LPRECT rect, LPARAM userData) + HMONITOR monitor, HDC /*deviceContext*/, LPRECT /*rect*/, + LPARAM userData) { std::set<HMONITOR>* sys_monitors = (std::set<HMONITOR>*)userData; sys_monitors->insert(monitor); @@ -549,7 +550,8 @@ int Fl_Monitor_Arrangement::fltk_event_handler(int event) return 0; } -void Fl_Monitor_Arrangement::monitor_pressed(Fl_Widget *widget, void *user_data) +void Fl_Monitor_Arrangement::monitor_pressed(Fl_Widget* /*widget*/, + void *user_data) { Fl_Monitor_Arrangement *self = (Fl_Monitor_Arrangement *) user_data; diff --git a/vncviewer/parameters.cxx b/vncviewer/parameters.cxx index 0912b461..173406d5 100644 --- a/vncviewer/parameters.cxx +++ b/vncviewer/parameters.cxx @@ -682,7 +682,7 @@ void saveViewerParameters(const char *filename, const char *servername) { static bool findAndSetViewerParameterFromValue( VoidParameter* parameters[], size_t parameters_len, - char* value, char* line, char* filepath) + char* value, char* line) { const size_t buffersize = 256; char decodingBuffer[buffersize]; @@ -821,11 +821,11 @@ char* loadViewerParameters(const char *filename) { } else { invalidParameterName = findAndSetViewerParameterFromValue(parameterArray, sizeof(parameterArray), - value, line, filepath); + value, line); if (invalidParameterName) { invalidParameterName = findAndSetViewerParameterFromValue(readOnlyParameterArray, sizeof(readOnlyParameterArray), - value, line, filepath); + value, line); } } } catch(Exception& e) { diff --git a/vncviewer/touch.cxx b/vncviewer/touch.cxx index 5ba9d108..d4f4098a 100644 --- a/vncviewer/touch.cxx +++ b/vncviewer/touch.cxx @@ -61,8 +61,9 @@ static HandlerMap handlers; #if defined(WIN32) LRESULT CALLBACK win32WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, - LPARAM lParam, UINT_PTR uIdSubclass, - DWORD_PTR dwRefData) + LPARAM lParam, + UINT_PTR /*uIdSubclass*/, + DWORD_PTR /*dwRefData*/) { bool handled = false; @@ -168,7 +169,7 @@ void x11_ungrab_pointer(Window window) } #endif -static int handleTouchEvent(void *event, void *data) +static int handleTouchEvent(void *event, void* /*data*/) { #if defined(WIN32) MSG *msg = (MSG*)event; @@ -189,7 +190,10 @@ static int handleTouchEvent(void *event, void *data) (int)GetLastError()); } } -#elif !defined(__APPLE__) +#elif defined(__APPLE__) + // No touch support on macOS + (void)event; +#else XEvent *xevent = (XEvent*)event; if (xevent->type == MapNotify) { diff --git a/vncviewer/vncviewer.cxx b/vncviewer/vncviewer.cxx index a7e99ffb..529f2f30 100644 --- a/vncviewer/vncviewer.cxx +++ b/vncviewer/vncviewer.cxx @@ -184,7 +184,7 @@ static void mainloop(const char* vncserver, network::Socket* sock) exitMainloop = false; - cc = new CConn(vncServerName, sock); + cc = new CConn(vncserver, sock); while (!exitMainloop) { int next_timer; @@ -232,12 +232,12 @@ static void mainloop(const char* vncserver, network::Socket* sock) } #ifdef __APPLE__ -static void about_callback(Fl_Widget *widget, void *data) +static void about_callback(Fl_Widget* /*widget*/, void* /*data*/) { about_vncviewer(); } -static void new_connection_cb(Fl_Widget *widget, void *data) +static void new_connection_cb(Fl_Widget* /*widget*/, void* /*data*/) { const char *argv[2]; pid_t pid; diff --git a/vncviewer/vncviewer.h b/vncviewer/vncviewer.h index 199e2e2c..f39a5776 100644 --- a/vncviewer/vncviewer.h +++ b/vncviewer/vncviewer.h @@ -21,18 +21,14 @@ #define VNCSERVERNAMELEN 256 -#ifdef __GNUC__ -# define __printf_attr(a, b) __attribute__((__format__ (__printf__, a, b))) -#else -# define __printf_attr(a, b) -#endif // __GNUC__ - namespace rdr { struct Exception; }; -void abort_vncviewer(const char *error, ...) __printf_attr(1, 2); -void abort_connection(const char *error, ...) __printf_attr(1, 2); +void abort_vncviewer(const char *error, ...) + __attribute__((__format__ (__printf__, 1, 2))); +void abort_connection(const char *error, ...) + __attribute__((__format__ (__printf__, 1, 2))); void abort_connection_with_unexpected_error(const rdr::Exception &); void disconnect(); diff --git a/vncviewer/win32.c b/vncviewer/win32.c index c4a68b67..77366f96 100644 --- a/vncviewer/win32.c +++ b/vncviewer/win32.c @@ -59,11 +59,13 @@ static int is_system_hotkey(int vkCode) { case VK_TAB: if (GetAsyncKeyState(VK_MENU) & 0x8000) return 1; + break; case VK_ESCAPE: if (GetAsyncKeyState(VK_MENU) & 0x8000) return 1; if (GetAsyncKeyState(VK_CONTROL) & 0x8000) return 1; + break; } return 0; } @@ -140,7 +142,7 @@ void win32_disable_lowlevel_keyboard(HWND hwnd) } // Layout independent keys -static const int vkey_map[][3] = { +static const UINT vkey_map[][3] = { { VK_CANCEL, NoSymbol, XK_Break }, { VK_BACK, XK_BackSpace, NoSymbol }, { VK_TAB, XK_Tab, NoSymbol }, @@ -231,7 +233,7 @@ static const int vkey_map[][3] = { // Layout dependent keys, but without useful symbols // Japanese -static const int vkey_map_jp[][3] = { +static const UINT vkey_map_jp[][3] = { { VK_KANA, XK_Hiragana_Katakana, NoSymbol }, { VK_KANJI, XK_Kanji, NoSymbol }, { VK_OEM_ATTN, XK_Eisu_toggle, NoSymbol }, @@ -246,12 +248,12 @@ static const int vkey_map_jp[][3] = { }; // Korean -static const int vkey_map_ko[][3] = { +static const UINT vkey_map_ko[][3] = { { VK_HANGUL, XK_Hangul, NoSymbol }, { VK_HANJA, XK_Hangul_Hanja, NoSymbol }, }; -static int lookup_vkey_map(UINT vkey, int extended, const int map[][3], size_t size) +static int lookup_vkey_map(UINT vkey, int extended, const UINT map[][3], size_t size) { size_t i; diff --git a/win/rfb_win32/Dialog.cxx b/win/rfb_win32/Dialog.cxx index 08a5226c..369bea30 100644 --- a/win/rfb_win32/Dialog.cxx +++ b/win/rfb_win32/Dialog.cxx @@ -229,7 +229,7 @@ struct DLGTEMPLATEEX { short cy; }; -static int CALLBACK removeCtxtHelp(HWND hwnd, UINT message, LPARAM lParam) { +static int CALLBACK removeCtxtHelp(HWND /*hwnd*/, UINT message, LPARAM lParam) { if (message == PSCB_PRECREATE) { // Remove the context-help style, to remove the titlebar ? button // *** Nasty hack to cope with new & old dialog template formats... @@ -280,6 +280,7 @@ bool PropSheet::showPropSheet(HWND owner, bool showApply, bool showCtxtHelp, boo centerWindow(handle, owner); plog.info("created %p", handle); + (void)capture; #ifdef _DIALOG_CAPTURE if (capture) { plog.info("capturing \"%s\"", (const char*)CStr(title.buf)); diff --git a/win/rfb_win32/Dialog.h b/win/rfb_win32/Dialog.h index cb23baff..35abb990 100644 --- a/win/rfb_win32/Dialog.h +++ b/win/rfb_win32/Dialog.h @@ -60,13 +60,13 @@ namespace rfb { // onCommand() is called upon receipt of a WM_COMMAND message item other than IDOK // or IDCANCEL. It should return true if the command has been handled. - virtual bool onCommand(int item, int cmd) { return false; } + virtual bool onCommand(int /*item*/, int /*cmd*/) { return false; } // onHelp() is called upon receipt of a WM_MENU message. This indicates that // context-specific help should be displayed, for a dialog control, for example. // It should return true if the command has been handled. - virtual bool onHelp(int item) { return false; } + virtual bool onHelp(int /*item*/) { return false; } // onOk() is called when the OK button is pressed. The hwnd argument is the // dialog box's window handle. diff --git a/win/rfb_win32/EventManager.cxx b/win/rfb_win32/EventManager.cxx index 9e08b793..401a8ee2 100644 --- a/win/rfb_win32/EventManager.cxx +++ b/win/rfb_win32/EventManager.cxx @@ -95,7 +95,7 @@ BOOL EventManager::getMessage(MSG* msg, HWND hwnd, UINT minMsg, UINT maxMsg) { } else return GetMessage(msg, hwnd, minMsg, maxMsg); - if ((result >= WAIT_OBJECT_0) && (result < (WAIT_OBJECT_0 + eventCount))) { + if (result < (WAIT_OBJECT_0 + eventCount)) { // - An event was set - call the handler int index = result - WAIT_OBJECT_0; handlers[index]->processEvent(events[index]); diff --git a/win/rfb_win32/MonitorInfo.cxx b/win/rfb_win32/MonitorInfo.cxx index b9865e91..2f216e19 100644 --- a/win/rfb_win32/MonitorInfo.cxx +++ b/win/rfb_win32/MonitorInfo.cxx @@ -79,8 +79,8 @@ struct monitorByNameData { }; static BOOL CALLBACK monitorByNameEnumProc(HMONITOR monitor, - HDC dc, - LPRECT pos, + HDC /*dc*/, + LPRECT /*pos*/, LPARAM d) { monitorByNameData* data = (monitorByNameData*)d; memset(data->info, 0, sizeof(MONITORINFOEXA)); diff --git a/win/rfb_win32/RegConfig.cxx b/win/rfb_win32/RegConfig.cxx index 8a87bc4b..e697e66b 100644 --- a/win/rfb_win32/RegConfig.cxx +++ b/win/rfb_win32/RegConfig.cxx @@ -73,7 +73,7 @@ void RegConfig::loadRegistryConfig(RegKey& key) { } } -void RegConfig::processEvent(HANDLE event_) { +void RegConfig::processEvent(HANDLE /*event*/) { vlog.info("registry changed"); // Reinstate the registry change notifications @@ -108,7 +108,7 @@ bool RegConfigThread::start(const HKEY rootKey, const TCHAR* keyname) { } void RegConfigThread::worker() { - DWORD result = 0; + BOOL result = 0; MSG msg; thread_id = GetCurrentThreadId(); while ((result = eventMgr.getMessage(&msg, 0, 0, 0)) > 0) {} diff --git a/win/rfb_win32/SecurityPage.cxx b/win/rfb_win32/SecurityPage.cxx index e540702d..59d0a832 100644 --- a/win/rfb_win32/SecurityPage.cxx +++ b/win/rfb_win32/SecurityPage.cxx @@ -106,7 +106,7 @@ SecurityPage::initDialog() } bool -SecurityPage::onCommand(int id, int cmd) +SecurityPage::onCommand(int id, int /*cmd*/) { if (id == IDC_ENC_X509) { if (isItemChecked(IDC_ENC_X509)) diff --git a/win/rfb_win32/WMHooks.cxx b/win/rfb_win32/WMHooks.cxx index 3c58d801..70844563 100644 --- a/win/rfb_win32/WMHooks.cxx +++ b/win/rfb_win32/WMHooks.cxx @@ -72,37 +72,37 @@ static void LoadHooks() if (hooksLibrary == NULL) return; - WM_Hooks_WindowChanged = (WM_Hooks_WMVAL_proto)GetProcAddress(hooksLibrary, "WM_Hooks_WindowChanged"); + WM_Hooks_WindowChanged = (WM_Hooks_WMVAL_proto)(void*)GetProcAddress(hooksLibrary, "WM_Hooks_WindowChanged"); if (WM_Hooks_WindowChanged == NULL) goto error; - WM_Hooks_WindowBorderChanged = (WM_Hooks_WMVAL_proto)GetProcAddress(hooksLibrary, "WM_Hooks_WindowBorderChanged"); + WM_Hooks_WindowBorderChanged = (WM_Hooks_WMVAL_proto)(void*)GetProcAddress(hooksLibrary, "WM_Hooks_WindowBorderChanged"); if (WM_Hooks_WindowBorderChanged == NULL) goto error; - WM_Hooks_WindowClientAreaChanged = (WM_Hooks_WMVAL_proto)GetProcAddress(hooksLibrary, "WM_Hooks_WindowClientAreaChanged"); + WM_Hooks_WindowClientAreaChanged = (WM_Hooks_WMVAL_proto)(void*)GetProcAddress(hooksLibrary, "WM_Hooks_WindowClientAreaChanged"); if (WM_Hooks_WindowClientAreaChanged == NULL) goto error; - WM_Hooks_RectangleChanged = (WM_Hooks_WMVAL_proto)GetProcAddress(hooksLibrary, "WM_Hooks_RectangleChanged"); + WM_Hooks_RectangleChanged = (WM_Hooks_WMVAL_proto)(void*)GetProcAddress(hooksLibrary, "WM_Hooks_RectangleChanged"); if (WM_Hooks_RectangleChanged == NULL) goto error; #ifdef _DEBUG - WM_Hooks_Diagnostic = (WM_Hooks_WMVAL_proto)GetProcAddress(hooksLibrary, "WM_Hooks_Diagnostic"); + WM_Hooks_Diagnostic = (WM_Hooks_WMVAL_proto)(void*)GetProcAddress(hooksLibrary, "WM_Hooks_Diagnostic"); if (WM_Hooks_Diagnostic == NULL) goto error; #endif - WM_Hooks_Install = (WM_Hooks_Install_proto)GetProcAddress(hooksLibrary, "WM_Hooks_Install"); + WM_Hooks_Install = (WM_Hooks_Install_proto)(void*)GetProcAddress(hooksLibrary, "WM_Hooks_Install"); if (WM_Hooks_Install == NULL) goto error; - WM_Hooks_Remove = (WM_Hooks_Remove_proto)GetProcAddress(hooksLibrary, "WM_Hooks_Remove"); + WM_Hooks_Remove = (WM_Hooks_Remove_proto)(void*)GetProcAddress(hooksLibrary, "WM_Hooks_Remove"); if (WM_Hooks_Remove == NULL) goto error; #ifdef _DEBUG - WM_Hooks_SetDiagnosticRange = (WM_Hooks_SetDiagnosticRange_proto)GetProcAddress(hooksLibrary, "WM_Hooks_SetDiagnosticRange"); + WM_Hooks_SetDiagnosticRange = (WM_Hooks_SetDiagnosticRange_proto)(void*)GetProcAddress(hooksLibrary, "WM_Hooks_SetDiagnosticRange"); if (WM_Hooks_SetDiagnosticRange == NULL) goto error; #endif - WM_Hooks_EnableRealInputs = (WM_Hooks_EnableRealInputs_proto)GetProcAddress(hooksLibrary, "WM_Hooks_EnableRealInputs"); + WM_Hooks_EnableRealInputs = (WM_Hooks_EnableRealInputs_proto)(void*)GetProcAddress(hooksLibrary, "WM_Hooks_EnableRealInputs"); if (WM_Hooks_EnableRealInputs == NULL) goto error; diff --git a/win/vncconfig/Authentication.h b/win/vncconfig/Authentication.h index 175cd240..1e4ea4ac 100644 --- a/win/vncconfig/Authentication.h +++ b/win/vncconfig/Authentication.h @@ -149,7 +149,7 @@ namespace rfb { setItemChecked(enc_idc, enable); setItemChecked(auth_idc, enable); } - inline bool showFileChooser(const RegKey& rk, + inline bool showFileChooser(const RegKey& /*rk*/, const char* title, const char* filter, HWND hwnd) diff --git a/win/vncconfig/Desktop.h b/win/vncconfig/Desktop.h index 1a687d74..a102a0c7 100644 --- a/win/vncconfig/Desktop.h +++ b/win/vncconfig/Desktop.h @@ -40,7 +40,7 @@ namespace rfb { setItemChecked(IDC_REMOVE_WALLPAPER, rfb::win32::SDisplay::removeWallpaper); setItemChecked(IDC_DISABLE_EFFECTS, rfb::win32::SDisplay::disableEffects); } - bool onCommand(int id, int cmd) { + bool onCommand(int id, int /*cmd*/) { switch (id) { case IDC_DISCONNECT_LOGOFF: case IDC_DISCONNECT_LOCK: diff --git a/win/vncconfig/Hooking.h b/win/vncconfig/Hooking.h index f5ef8b74..1b02a1d5 100644 --- a/win/vncconfig/Hooking.h +++ b/win/vncconfig/Hooking.h @@ -39,7 +39,7 @@ namespace rfb { setItemChecked(IDC_CAPTUREBLT, rfb::win32::DeviceFrameBuffer::useCaptureBlt); onCommand(IDC_USEHOOKS, 0); } - bool onCommand(int id, int cmd) { + bool onCommand(int id, int /*cmd*/) { switch (id) { case IDC_USEPOLLING: case IDC_USEHOOKS: diff --git a/win/vncconfig/Inputs.h b/win/vncconfig/Inputs.h index f290831e..e71efde6 100644 --- a/win/vncconfig/Inputs.h +++ b/win/vncconfig/Inputs.h @@ -49,7 +49,7 @@ namespace rfb { enableAffectSSaver = false; enableItem(IDC_AFFECT_SCREENSAVER, enableAffectSSaver); } - bool onCommand(int id, int cmd) { + bool onCommand(int /*id*/, int /*cmd*/) { BOOL inputResetsBlocked; SystemParametersInfo(SPI_GETBLOCKSENDINPUTRESETS, 0, &inputResetsBlocked, 0); setChanged((rfb::Server::acceptKeyEvents != isItemChecked(IDC_ACCEPT_KEYS)) || diff --git a/win/vncconfig/Legacy.h b/win/vncconfig/Legacy.h index 9fb20563..0fcf29fe 100644 --- a/win/vncconfig/Legacy.h +++ b/win/vncconfig/Legacy.h @@ -39,7 +39,7 @@ namespace rfb { void initDialog() { setItemChecked(IDC_PROTOCOL_3_3, rfb::Server::protocol3_3); } - bool onCommand(int id, int cmd) { + bool onCommand(int id, int /*cmd*/) { switch (id) { case IDC_LEGACY_IMPORT: { diff --git a/win/vncconfig/Sharing.h b/win/vncconfig/Sharing.h index 872ae133..4dcb1db9 100644 --- a/win/vncconfig/Sharing.h +++ b/win/vncconfig/Sharing.h @@ -36,7 +36,7 @@ namespace rfb { setItemChecked(IDC_SHARE_ALWAYS, rfb::Server::alwaysShared); setItemChecked(IDC_SHARE_CLIENT, !(rfb::Server::neverShared || rfb::Server::alwaysShared)); } - bool onCommand(int id, int cmd) { + bool onCommand(int /*id*/, int /*cmd*/) { setChanged((isItemChecked(IDC_DISCONNECT_CLIENTS) != rfb::Server::disconnectClients) || (isItemChecked(IDC_SHARE_NEVER) != rfb::Server::neverShared) || (isItemChecked(IDC_SHARE_ALWAYS) != rfb::Server::alwaysShared)); diff --git a/win/vncconfig/vncconfig.cxx b/win/vncconfig/vncconfig.cxx index 18045c77..c58303d4 100644 --- a/win/vncconfig/vncconfig.cxx +++ b/win/vncconfig/vncconfig.cxx @@ -76,7 +76,7 @@ processParams(int argc, char* argv[]) { } -int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, char* cmdLine, int cmdShow) { +int WINAPI WinMain(HINSTANCE inst, HINSTANCE /*prev*/, char* /*cmdLine*/, int /*cmdShow*/) { // Configure debugging output #ifdef _DEBUG diff --git a/win/winvnc/ControlPanel.cxx b/win/winvnc/ControlPanel.cxx index a2a85e2d..d498513a 100644 --- a/win/winvnc/ControlPanel.cxx +++ b/win/winvnc/ControlPanel.cxx @@ -102,7 +102,7 @@ void ControlPanel::UpdateListView(ListConnInfo* LCInfo) } } -BOOL ControlPanel::dialogProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) +BOOL ControlPanel::dialogProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM /*lParam*/) { switch (msg) { case WM_INITDIALOG: diff --git a/win/winvnc/STrayIcon.cxx b/win/winvnc/STrayIcon.cxx index 83afbed2..2cf24752 100644 --- a/win/winvnc/STrayIcon.cxx +++ b/win/winvnc/STrayIcon.cxx @@ -189,6 +189,7 @@ public: return thread.server.disconnectClients("IPC disconnect") ? 1 : 0; case 3: thread.server.setClientsStatus(&CPanel->ListConnStatus); + /* fall through */ case 4: thread.server.getClientsInfo(&LCInfo); CPanel->UpdateListView(&LCInfo); diff --git a/win/winvnc/VNCServerService.cxx b/win/winvnc/VNCServerService.cxx index 4092592a..b4f81e27 100644 --- a/win/winvnc/VNCServerService.cxx +++ b/win/winvnc/VNCServerService.cxx @@ -49,7 +49,7 @@ VNCServerService::VNCServerService() if (sasLibrary == NULL) { sasLibrary = LoadLibrary("sas.dll"); if (sasLibrary != NULL) - _SendSAS = (SendSAS_proto)GetProcAddress(sasLibrary, "SendSAS"); + _SendSAS = (SendSAS_proto)(void*)GetProcAddress(sasLibrary, "SendSAS"); } // - Set the service-mode logging defaults // These will be overridden by the Log option in the @@ -101,7 +101,7 @@ BOOL GetSessionUserTokenWin(OUT LPHANDLE lphUserToken) ////////////////////////////////////////////////////////////////////////////// // START the app as system -HANDLE LaunchProcessWin(DWORD dwSessionId) +HANDLE LaunchProcessWin(DWORD /*dwSessionId*/) { HANDLE hProcess = NULL; HANDLE hToken = NULL; @@ -125,7 +125,7 @@ HANDLE LaunchProcessWin(DWORD dwSessionId) return hProcess; } -DWORD VNCServerService::serviceMain(int argc, TCHAR* argv[]) +DWORD VNCServerService::serviceMain(int /*argc*/, TCHAR* /*argv*/ []) { ConsoleSessionId OlddwSessionId; diff --git a/win/winvnc/winvnc.cxx b/win/winvnc/winvnc.cxx index b1bfb9dc..271538d0 100644 --- a/win/winvnc/winvnc.cxx +++ b/win/winvnc/winvnc.cxx @@ -238,7 +238,7 @@ static void processParams(int argc, char** argv) { // -=- main // -int WINAPI WinMain(HINSTANCE inst, HINSTANCE prevInst, char* cmdLine, int cmdShow) { +int WINAPI WinMain(HINSTANCE /*inst*/, HINSTANCE /*prevInst*/, char* /*cmdLine*/, int /*cmdShow*/) { int result = 0; try { diff --git a/win/wm_hooks/wm_hooks.cxx b/win/wm_hooks/wm_hooks.cxx index 54c3d80d..be845d6a 100644 --- a/win/wm_hooks/wm_hooks.cxx +++ b/win/wm_hooks/wm_hooks.cxx @@ -73,7 +73,7 @@ ATOM ATOM_Popup_Selection = GlobalAddAtom(_T("RFB.WM_Hooks.PopupSelectionAtom")) HINSTANCE dll_instance = 0; -BOOL WINAPI DllMain(HANDLE instance, ULONG reason, LPVOID reserved) { +BOOL WINAPI DllMain(HANDLE instance, ULONG reason, LPVOID /*reserved*/) { switch (reason) { case DLL_PROCESS_ATTACH: dll_instance = (HINSTANCE)instance; @@ -144,7 +144,7 @@ bool NotifyCursor(HCURSOR cursor) { return NotifyHookOwner(WM_HK_CursorChanged, 0, (LPARAM)cursor); } -void ProcessWindowMessage(UINT msg, HWND wnd, WPARAM wParam, LPARAM lParam) { +void ProcessWindowMessage(UINT msg, HWND wnd, WPARAM wParam, LPARAM /*lParam*/) { #ifdef _DEBUG if ((msg >= diagnostic_min) && (msg <= diagnostic_max)) PostThreadMessage(hook_owner, WM_HK_Diagnostic, msg, (LPARAM)wnd); |