]> git.saurik.com Git - wxWidgets.git/commitdiff
Warning fixes found under hardest mode of OpenWatcom. Seems clean in Borland, MinGW...
authorWłodzimierz Skiba <abx@abx.art.pl>
Thu, 7 Oct 2004 13:36:41 +0000 (13:36 +0000)
committerWłodzimierz Skiba <abx@abx.art.pl>
Thu, 7 Oct 2004 13:36:41 +0000 (13:36 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29697 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/msw/window.h
include/wx/ptr_scpd.h
src/msw/accel.cpp
src/msw/dib.cpp
src/msw/font.cpp
src/msw/fontenum.cpp
src/msw/fontutil.cpp
src/msw/frame.cpp
src/msw/palette.cpp
src/msw/window.cpp

index d3739f665aaffbe71748ea3cc0dea847cf950c1c..d582c1b9413c5b4dddc3dc198332e3ed3ffa445c 100644 (file)
@@ -491,7 +491,7 @@ inline void wxWindowMSW::SetTransparent(bool WXUNUSED(t)) { }
 
 // kbd code translation
 WXDLLEXPORT int wxCharCodeMSWToWX(int keySym, WXLPARAM lParam = 0);
-WXDLLEXPORT int wxCharCodeWXToMSW(int id, bool *IsVirtual);
+WXDLLEXPORT WXWORD wxCharCodeWXToMSW(int id, bool *IsVirtual);
 
 // window creation helper class: before creating a new HWND, instantiate an
 // object of this class on stack - this allows to process the messages sent to
index 2000d346a3a6ce217f7a824c9c63a99fb4a57e46..0804211086c70ce2ad1a3c35d4a5b6dab2a6b885 100644 (file)
    still force a semicolon after the macro
 */
 
+#ifdef __WATCOMC__
+    #define wxPRE_NO_WARNING_SCOPE  for(int i=0;i<1;i++)
+    #define wxPOST_NO_WARNING_SCOPE
+#else
+    #define wxPRE_NO_WARNING_SCOPE  do
+    #define wxPOST_NO_WARNING_SCOPE while ( 0 )
+#endif
+
 #define wxCHECKED_DELETE(ptr)                                                 \
-    do                                                                        \
+    wxPRE_NO_WARNING_SCOPE                                                    \
     {                                                                         \
         typedef char complete[sizeof(*ptr)];                                  \
         delete ptr;                                                           \
-    } while ( 0 )
+    } wxPOST_NO_WARNING_SCOPE
 
 #define wxCHECKED_DELETE_ARRAY(ptr)                                           \
-    do                                                                        \
+    wxPRE_NO_WARNING_SCOPE                                                    \
     {                                                                         \
         typedef char complete[sizeof(*ptr)];                                  \
         delete [] ptr;                                                        \
-    } while ( 0 )
+    } wxPOST_NO_WARNING_SCOPE
 
 /* These scoped pointers are *not* assignable and cannot be used
    within a container.  Look for wxDECLARE_SHARED_PTR for this
index cad9c19c303fa9fce28914540d21626ede79facd..a5feca7c4b2ef21f72fbf34b125e2eb33f60ca66 100644 (file)
@@ -92,7 +92,7 @@ wxAcceleratorTable::wxAcceleratorTable(const wxString& resource)
     M_ACCELDATA->m_ok = (hAccel != 0);
 }
 
-extern int wxCharCodeWXToMSW(int id, bool *isVirtual);
+extern WXWORD wxCharCodeWXToMSW(int id, bool *isVirtual);
 
 // Create from an array
 wxAcceleratorTable::wxAcceleratorTable(int n, const wxAcceleratorEntry entries[])
@@ -114,13 +114,13 @@ wxAcceleratorTable::wxAcceleratorTable(int n, const wxAcceleratorEntry entries[]
 
         bool isVirtual;
 
-        WORD key = (WORD)wxCharCodeWXToMSW(entries[i].GetKeyCode(), &isVirtual);
+        WORD key = wxCharCodeWXToMSW(entries[i].GetKeyCode(), &isVirtual);
         if (isVirtual)
             fVirt |= FVIRTKEY;
 
         arr[i].fVirt = fVirt;
         arr[i].key = key;
-        arr[i].cmd = entries[i].GetCommand();
+        arr[i].cmd = (WORD)entries[i].GetCommand();
     }
 
     M_ACCELDATA->m_hAccel = ::CreateAcceleratorTable(arr, n);
index 0589ec323ec4d7a1907a9e635f8c9c87c9d30815..a76592f9b06a65be056fe0f6292bbb6cc2a2fb28 100644 (file)
@@ -118,7 +118,7 @@ bool wxDIB::Create(int width, int height, int depth)
     info->bmiHeader.biHeight = height;
 
     info->bmiHeader.biPlanes = 1;
-    info->bmiHeader.biBitCount = depth;
+    info->bmiHeader.biBitCount = (WORD)depth;
     info->bmiHeader.biSizeImage = GetLineSize(width, depth)*height;
 
     m_handle = ::CreateDIBSection
@@ -603,7 +603,7 @@ wxPalette *wxDIB::CreatePalette() const
 
     // initialize the palette header
     pPalette->palVersion = 0x300;  // magic number, not in docs but works
-    pPalette->palNumEntries = biClrUsed;
+    pPalette->palNumEntries = (WORD)biClrUsed;
 
     // and the colour table (it starts right after the end of the header)
     const RGBQUAD *pRGB = (RGBQUAD *)((char *)&ds.dsBmih + ds.dsBmih.biSize);
index d79b4b74a691bc9b81cffdec94b9e81b999cf1ea..4b96f6029e525fa89342364ffec65c9bfcc9a25a 100644 (file)
@@ -578,7 +578,7 @@ void wxNativeFontInfo::SetFaceName(wxString facename)
 
 void wxNativeFontInfo::SetFamily(wxFontFamily family)
 {
-    int ff_family;
+    BYTE ff_family;
     wxString facename;
 
     switch ( family )
@@ -647,7 +647,7 @@ void wxNativeFontInfo::SetEncoding(wxFontEncoding encoding)
         }
     }
 
-    lf.lfCharSet = info.charset;
+    lf.lfCharSet = (BYTE)info.charset;
 }
 
 bool wxNativeFontInfo::FromString(const wxString& s)
index 07a79b78f4909e289fc78f99b9a753ae646a43f2..8dca8b0909b1452143db2d93bdc2e74d30df23ad 100644 (file)
@@ -166,7 +166,7 @@ void wxFontEnumeratorHelper::DoEnumerate()
                          (LPARAM)this) ;
 #else // __WIN32__
     LOGFONT lf;
-    lf.lfCharSet = m_charset;
+    lf.lfCharSet = (BYTE)m_charset;
     wxStrncpy(lf.lfFaceName, m_facename, WXSIZEOF(lf.lfFaceName));
     lf.lfPitchAndFamily = 0;
     ::EnumFontFamiliesEx(hDC, &lf, (wxFONTENUMPROC)wxFontEnumeratorProc,
index dbf009105ad3ed52d14c4a266626605177e3b60f..266971d30a792b4ea46cb1fab9a9320fee98a16d 100644 (file)
@@ -164,7 +164,7 @@ bool wxTestFontEncoding(const wxNativeEncodingInfo& info)
     LOGFONT lf;
     wxZeroMemory(lf);       // all default values
 
-    lf.lfCharSet = info.charset;
+    lf.lfCharSet = (BYTE)info.charset;
     wxStrncpy(lf.lfFaceName, info.facename, WXSIZEOF(lf.lfFaceName));
 
     HFONT hfont = ::CreateFontIndirect(&lf);
index f80a8f8da66266ff792877cfbc52053c31b27253..edc5c5c22c5d5e3d2b39cb0ae5f8b23896069c78 100644 (file)
@@ -982,7 +982,7 @@ WXLRESULT wxFrame::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lPara
             break;
 
         case WM_EXITMENULOOP:
-            processed = HandleMenuLoop(wxEVT_MENU_CLOSE, wParam);
+            processed = HandleMenuLoop(wxEVT_MENU_CLOSE, (WXWORD)wParam);
             break;
 
         case WM_QUERYDRAGICON:
index 4a73bb28b27b3895dd6b9a8f14ac56eecf89255f..0d46158e021b7d199fefef3c803b844f56e400c8 100644 (file)
@@ -87,7 +87,7 @@ bool wxPalette::Create(int n, const unsigned char *red, const unsigned char *gre
     return false;
 
   npPal->palVersion = 0x300;
-  npPal->palNumEntries = n;
+  npPal->palNumEntries = (WORD)n;
 
   int i;
   for (i = 0; i < n; i ++)
index 7daffb9b2a23be52787819e70ebd618a39cfddb9..02e5c2cfcfdffa05d453b2c05e637da47259a9d8 100644 (file)
@@ -5045,10 +5045,10 @@ int wxCharCodeMSWToWX(int keySym, WXLPARAM lParam)
     return id;
 }
 
-int wxCharCodeWXToMSW(int id, bool *isVirtual)
+WXWORD wxCharCodeWXToMSW(int id, bool *isVirtual)
 {
     *isVirtual = true;
-    int keySym;
+    WXWORD keySym;
     switch (id)
     {
     case WXK_CANCEL:    keySym = VK_CANCEL; break;
@@ -5117,7 +5117,7 @@ int wxCharCodeWXToMSW(int id, bool *isVirtual)
     default:
         {
             *isVirtual = false;
-            keySym = id;
+            keySym = (WORD)id;
             break;
         }
     }
@@ -5127,7 +5127,7 @@ int wxCharCodeWXToMSW(int id, bool *isVirtual)
 bool wxGetKeyState(wxKeyCode key)
 {
     bool bVirtual;
-    int vkey = wxCharCodeWXToMSW(key, &bVirtual);
+    WORD vkey = wxCharCodeWXToMSW(key, &bVirtual);
     SHORT state;
 
     switch (key)