From 0c0d1521c0d69e3e45992fd5140d7f663d5970bd Mon Sep 17 00:00:00 2001 From: =?utf8?q?W=C5=82odzimierz=20Skiba?= Date: Fri, 1 Jul 2005 13:39:03 +0000 Subject: [PATCH] Helpers in disabling warnings for unused params. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34792 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/msw/winundef.h | 6 +-- include/wx/msw/wrapcctl.h | 3 +- src/generic/dirctrlg.cpp | 6 +-- src/msw/dc.cpp | 31 +++++------ src/msw/gdiimage.cpp | 5 +- src/msw/ole/dataobj.cpp | 7 ++- src/msw/registry.cpp | 107 +++++++++++++++++++------------------- src/msw/thread.cpp | 3 +- src/msw/window.cpp | 25 ++++----- 9 files changed, 88 insertions(+), 105 deletions(-) diff --git a/include/wx/msw/winundef.h b/include/wx/msw/winundef.h index 3d8a52e020..969366cc08 100644 --- a/include/wx/msw/winundef.h +++ b/include/wx/msw/winundef.h @@ -338,10 +338,9 @@ #ifdef IsMaximized #undef IsMaximized - inline BOOL IsMaximized(HWND hwnd) + inline BOOL IsMaximized(HWND WXUNUSED_IN_WINCE(hwnd)) { #ifdef __WXWINCE__ - wxUnusedVar(hwnd); return FALSE; #else return IsZoomed(hwnd); @@ -353,10 +352,9 @@ #ifdef GetFirstChild #undef GetFirstChild - inline HWND GetFirstChild(HWND hwnd) + inline HWND GetFirstChild(HWND WXUNUSED_IN_WINCE(hwnd)) { #ifdef __WXWINCE__ - wxUnusedVar(hwnd); return 0; #else return GetTopWindow(hwnd); diff --git a/include/wx/msw/wrapcctl.h b/include/wx/msw/wrapcctl.h index 3faa980790..f61d2cec20 100644 --- a/include/wx/msw/wrapcctl.h +++ b/include/wx/msw/wrapcctl.h @@ -40,13 +40,12 @@ #include "wx/msw/missing.h" // Set Unicode format for a common control -inline void wxSetCCUnicodeFormat(HWND hwnd) +inline void wxSetCCUnicodeFormat(HWND WXUNUSED_IN_WINCE(hwnd)) { #ifndef __WXWINCE__ ::SendMessage(hwnd, CCM_SETUNICODEFORMAT, wxUSE_UNICODE, 0); #else // !__WXWINCE__ // here it should be already in Unicode anyhow - wxUnusedVar(hwnd); #endif // __WXWINCE__/!__WXWINCE__ } diff --git a/src/generic/dirctrlg.cpp b/src/generic/dirctrlg.cpp index e66dbb5a0c..7c88c16a7c 100644 --- a/src/generic/dirctrlg.cpp +++ b/src/generic/dirctrlg.cpp @@ -278,10 +278,9 @@ bool wxIsDriveAvailable(const wxString& dirName) #elif defined(__WINDOWS__) || defined(__OS2__) -int setdrive(int drive) +int setdrive(int WXUNUSED_IN_WINCE(drive)) { #ifdef __WXWINCE__ - wxUnusedVar(drive); return 0; #elif defined(__GNUWIN32__) && \ (defined(__MINGW32_MAJOR_VERSION) && __MINGW32_MAJOR_VERSION >= 1) @@ -311,10 +310,9 @@ int setdrive(int drive) #endif // !GNUWIN32 } -bool wxIsDriveAvailable(const wxString& dirName) +bool wxIsDriveAvailable(const wxString& WXUNUSED_IN_WINCE(dirName)) { #ifdef __WXWINCE__ - wxUnusedVar(dirName); return false; #else #ifdef __WIN32__ diff --git a/src/msw/dc.cpp b/src/msw/dc.cpp index 63f940e5a9..f843360fcf 100644 --- a/src/msw/dc.cpp +++ b/src/msw/dc.cpp @@ -170,15 +170,14 @@ private: class StretchBltModeChanger { public: - StretchBltModeChanger(HDC hdc, int mode) + StretchBltModeChanger(HDC hdc, + int WXUNUSED_IN_WINCE(mode)) : m_hdc(hdc) { #ifndef __WXWINCE__ m_modeOld = ::SetStretchBltMode(m_hdc, mode); if ( !m_modeOld ) wxLogLastError(_T("SetStretchBltMode")); -#else - wxUnusedVar(mode); #endif } @@ -560,16 +559,14 @@ void wxDC::Clear() #endif } -bool wxDC::DoFloodFill(wxCoord x, wxCoord y, const wxColour& col, int style) +bool wxDC::DoFloodFill(wxCoord WXUNUSED_IN_WINCE(x), + wxCoord WXUNUSED_IN_WINCE(y), + const wxColour& WXUNUSED_IN_WINCE(col), + int WXUNUSED_IN_WINCE(style)) { #ifdef __WXWINCE__ - wxUnusedVar(x); - wxUnusedVar(y); - wxUnusedVar(col); - wxUnusedVar(style); return false; #else - WXMICROWIN_CHECK_HDC_RET(false) bool success = (0 != ::ExtFloodFill(GetHdc(), XLOG2DEV(x), YLOG2DEV(y), @@ -758,7 +755,11 @@ void wxDC::DoDrawPoint(wxCoord x, wxCoord y) CalcBoundingBox(x, y); } -void wxDC::DoDrawPolygon(int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset,int fillStyle) +void wxDC::DoDrawPolygon(int n, + wxPoint points[], + wxCoord xoffset, + wxCoord yoffset, + int WXUNUSED_IN_WINCE(fillStyle)) { WXMICROWIN_CHECK_HDC @@ -778,8 +779,6 @@ void wxDC::DoDrawPolygon(int n, wxPoint points[], wxCoord xoffset, wxCoord yoffs } #ifndef __WXWINCE__ int prev = SetPolyFillMode(GetHdc(),fillStyle==wxODDEVEN_RULE?ALTERNATE:WINDING); -#else - wxUnusedVar(fillStyle); #endif (void)Polygon(GetHdc(), cpoints, n); #ifndef __WXWINCE__ @@ -1780,7 +1779,8 @@ void wxDC::SetUserScale(double x, double y) this->SetMapMode(m_mappingMode); } -void wxDC::SetAxisOrientation(bool xLeftRight, bool yBottomUp) +void wxDC::SetAxisOrientation(bool WXUNUSED_IN_WINCE(xLeftRight), + bool WXUNUSED_IN_WINCE(yBottomUp)) { WXMICROWIN_CHECK_HDC @@ -1795,9 +1795,6 @@ void wxDC::SetAxisOrientation(bool xLeftRight, bool yBottomUp) SetMapMode(m_mappingMode); } -#else - wxUnusedVar(xLeftRight); - wxUnusedVar(yBottomUp); #endif } @@ -2494,7 +2491,7 @@ wxAlphaBlend(HDC hdcDst, int xDst, int yDst, int w, int h, int srcX, int srcY, c { wxAlphaPixelData::Iterator pDstRowStart = pDst, pSrcRowStart = pSrc; - + for ( int x = 0; x < w; x++ ) { // note that source bitmap uses premultiplied alpha (as required by diff --git a/src/msw/gdiimage.cpp b/src/msw/gdiimage.cpp index f2e84134d0..4f73c774b1 100644 --- a/src/msw/gdiimage.cpp +++ b/src/msw/gdiimage.cpp @@ -570,7 +570,7 @@ bool wxICOResourceHandler::LoadIcon(wxIcon *icon, // private functions // ---------------------------------------------------------------------------- -wxSize wxGetHiconSize(HICON hicon) +wxSize wxGetHiconSize(HICON WXUNUSED_IN_WINCE(hicon)) { // default icon size on this hardware // usually 32x32 but can be other (smaller) on pocket devices @@ -601,9 +601,8 @@ wxSize wxGetHiconSize(HICON hicon) ::DeleteObject(info.hbmColor); } } -#else - wxUnusedVar(hicon); #endif + return size; } diff --git a/src/msw/ole/dataobj.cpp b/src/msw/ole/dataobj.cpp index e26a1ea1d5..73924fa3e2 100644 --- a/src/msw/ole/dataobj.cpp +++ b/src/msw/ole/dataobj.cpp @@ -979,7 +979,8 @@ bool wxBitmapDataObject::SetData(const wxDataFormat& format, // wxFileDataObject // ---------------------------------------------------------------------------- -bool wxFileDataObject::SetData(size_t WXUNUSED(size), const void *pData) +bool wxFileDataObject::SetData(size_t WXUNUSED(size), + const void *WXUNUSED_IN_WINCE(pData)) { #ifndef __WXWINCE__ m_filenames.Empty(); @@ -1015,7 +1016,6 @@ bool wxFileDataObject::SetData(size_t WXUNUSED(size), const void *pData) return true; #else - wxUnusedVar(pData); return false; #endif } @@ -1055,7 +1055,7 @@ size_t wxFileDataObject::GetDataSize() const #endif } -bool wxFileDataObject::GetDataHere(void *pData) const +bool wxFileDataObject::GetDataHere(void *WXUNUSED_IN_WINCE(pData)) const { #ifndef __WXWINCE__ // pData points to an externally allocated memory block @@ -1095,7 +1095,6 @@ bool wxFileDataObject::GetDataHere(void *pData) const return true; #else - wxUnusedVar(pData); return false; #endif } diff --git a/src/msw/registry.cpp b/src/msw/registry.cpp index 7020b4c030..a266cc3ad9 100644 --- a/src/msw/registry.cpp +++ b/src/msw/registry.cpp @@ -894,70 +894,71 @@ bool wxRegKey::QueryValue(const wxChar *szValue, wxMemoryBuffer& buffer) const bool wxRegKey::QueryValue(const wxChar *szValue, wxString& strValue, - bool raw) const + bool WXUNUSED_IN_WINCE(raw)) const { - if ( CONST_CAST Open(Read) ) { - - // first get the type and size of the data - DWORD dwType, dwSize; - m_dwLastError = RegQueryValueEx((HKEY) m_hKey, WXSTRINGCAST szValue, RESERVED, - &dwType, NULL, &dwSize); - if ( m_dwLastError == ERROR_SUCCESS ) { - if ( !dwSize ) { - // must treat this case specially as GetWriteBuf() doesn't like - // being called with 0 size - strValue.Empty(); - } - else { - m_dwLastError = RegQueryValueEx((HKEY) m_hKey, - WXSTRINGCAST szValue, - RESERVED, - &dwType, - (RegString)(wxChar*)wxStringBuffer(strValue, dwSize), - &dwSize); + if ( CONST_CAST Open(Read) ) + { - // expand the var expansions in the string unless disabled -#ifndef __WXWINCE__ - if ( (dwType == REG_EXPAND_SZ) && !raw ) + // first get the type and size of the data + DWORD dwType, dwSize; + m_dwLastError = RegQueryValueEx((HKEY) m_hKey, WXSTRINGCAST szValue, RESERVED, + &dwType, NULL, &dwSize); + if ( m_dwLastError == ERROR_SUCCESS ) + { + if ( !dwSize ) { - DWORD dwExpSize = ::ExpandEnvironmentStrings(strValue, NULL, 0); - bool ok = dwExpSize != 0; - if ( ok ) + // must treat this case specially as GetWriteBuf() doesn't like + // being called with 0 size + strValue.Empty(); + } + else + { + m_dwLastError = RegQueryValueEx((HKEY) m_hKey, + WXSTRINGCAST szValue, + RESERVED, + &dwType, + (RegString)(wxChar*)wxStringBuffer(strValue, dwSize), + &dwSize); + + // expand the var expansions in the string unless disabled +#ifndef __WXWINCE__ + if ( (dwType == REG_EXPAND_SZ) && !raw ) { - wxString strExpValue; - ok = ::ExpandEnvironmentStrings - ( - strValue, - wxStringBuffer(strExpValue, dwExpSize), - dwExpSize - ) != 0; - strValue = strExpValue; - } + DWORD dwExpSize = ::ExpandEnvironmentStrings(strValue, NULL, 0); + bool ok = dwExpSize != 0; + if ( ok ) + { + wxString strExpValue; + ok = ::ExpandEnvironmentStrings(strValue, + wxStringBuffer(strExpValue, dwExpSize), + dwExpSize + ) != 0; + strValue = strExpValue; + } - if ( !ok ) - { - wxLogLastError(_T("ExpandEnvironmentStrings")); + if ( !ok ) + { + wxLogLastError(_T("ExpandEnvironmentStrings")); + } } - } -#else - wxUnusedVar(raw); #endif - // __WXWINCE__ - } + // __WXWINCE__ + } - if ( m_dwLastError == ERROR_SUCCESS ) { - // check that it was the right type - wxASSERT_MSG( !IsNumericValue(szValue), - wxT("Type mismatch in wxRegKey::QueryValue().") ); + if ( m_dwLastError == ERROR_SUCCESS ) + { + // check that it was the right type + wxASSERT_MSG( !IsNumericValue(szValue), + wxT("Type mismatch in wxRegKey::QueryValue().") ); - return true; + return true; + } } - } - } + } - wxLogSysError(m_dwLastError, _("Can't read value of '%s'"), - GetFullName(this, szValue)); - return false; + wxLogSysError(m_dwLastError, _("Can't read value of '%s'"), + GetFullName(this, szValue)); + return false; } bool wxRegKey::SetValue(const wxChar *szValue, const wxString& strValue) diff --git a/src/msw/thread.cpp b/src/msw/thread.cpp index 615451a3f5..ac439b82c2 100644 --- a/src/msw/thread.cpp +++ b/src/msw/thread.cpp @@ -888,10 +888,9 @@ unsigned long wxThread::GetCurrentId() return (unsigned long)::GetCurrentThreadId(); } -bool wxThread::SetConcurrency(size_t level) +bool wxThread::SetConcurrency(size_t WXUNUSED_IN_WINCE(level)) { #ifdef __WXWINCE__ - wxUnusedVar(level); return false; #else wxASSERT_MSG( IsMain(), _T("should only be called from the main thread") ); diff --git a/src/msw/window.cpp b/src/msw/window.cpp index d959e2d5ff..be906d875e 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -1060,7 +1060,8 @@ void wxWindowMSW::DissociateHandle() } -bool wxCheckWindowWndProc(WXHWND hWnd, WXFARPROC wndProc) +bool wxCheckWindowWndProc(WXHWND hWnd, + WXFARPROC WXUNUSED_IN_WINCE(wndProc)) { // Unicows note: the code below works, but only because WNDCLASS contains // original window handler rather that the unicows fake one. This may not @@ -1072,8 +1073,6 @@ bool wxCheckWindowWndProc(WXHWND hWnd, WXFARPROC wndProc) // On WinCE (at least), the wndproc comparison doesn't work, // so have to use something like this. #ifdef __WXWINCE__ - wxUnusedVar(wndProc); - extern wxChar *wxCanvasClassName; extern wxChar *wxCanvasClassNameNR; extern const wxChar *wxMDIFrameClassName; @@ -1418,14 +1417,12 @@ void wxWindowMSW::SetDropTarget(wxDropTarget *pDropTarget) // old style file-manager drag&drop support: we retain the old-style // DragAcceptFiles in parallel with SetDropTarget. -void wxWindowMSW::DragAcceptFiles(bool accept) +void wxWindowMSW::DragAcceptFiles(bool WXUNUSED_IN_WINCE(accept)) { -#if !defined(__WXWINCE__) +#ifndef __WXWINCE__ HWND hWnd = GetHwnd(); if ( hWnd ) ::DragAcceptFiles(hWnd, (BOOL)accept); -#else - wxUnusedVar(accept); #endif } @@ -3355,7 +3352,8 @@ bool wxWindowMSW::HandleEndSession(bool endSession, long logOff) // window creation/destruction // --------------------------------------------------------------------------- -bool wxWindowMSW::HandleCreate(WXLPCREATESTRUCT cs, bool *mayCreate) +bool wxWindowMSW::HandleCreate(WXLPCREATESTRUCT WXUNUSED_IN_WINCE(cs), + bool *mayCreate) { // VZ: why is this commented out for WinCE? If it doesn't support // WS_EX_CONTROLPARENT at all it should be somehow handled globally, @@ -3363,8 +3361,6 @@ bool wxWindowMSW::HandleCreate(WXLPCREATESTRUCT cs, bool *mayCreate) #ifndef __WXWINCE__ if ( ((CREATESTRUCT *)cs)->dwExStyle & WS_EX_CONTROLPARENT ) EnsureParentHasControlParentStyle(GetParent()); -#else - wxUnusedVar(cs); #endif // !__WXWINCE__ // TODO: should generate this event from WM_NCCREATE @@ -4311,10 +4307,9 @@ bool wxWindowMSW::HandleSizing(wxRect& rect) return rc; } -bool wxWindowMSW::HandleGetMinMaxInfo(void *mmInfo) +bool wxWindowMSW::HandleGetMinMaxInfo(void *WXUNUSED_IN_WINCE(mmInfo)) { #ifdef __WXWINCE__ - wxUnusedVar(mmInfo); return false; #else MINMAXINFO *info = (MINMAXINFO *)mmInfo; @@ -4831,7 +4826,8 @@ bool wxWindowMSW::HandleKeyUp(WXWPARAM wParam, WXLPARAM lParam) return false; } -int wxWindowMSW::HandleMenuChar(int chAccel, WXLPARAM lParam) +int wxWindowMSW::HandleMenuChar(int WXUNUSED_IN_WINCE(chAccel), + WXLPARAM WXUNUSED_IN_WINCE(lParam)) { // FIXME: implement GetMenuItemCount for WinCE, possibly // in terms of GetMenuItemInfo @@ -4889,9 +4885,6 @@ int wxWindowMSW::HandleMenuChar(int chAccel, WXLPARAM lParam) wxLogLastError(_T("GetMenuItemInfo")); } } -#else - wxUnusedVar(chAccel); - wxUnusedVar(lParam); #endif return wxNOT_FOUND; } -- 2.45.2