]> git.saurik.com Git - wxWidgets.git/commitdiff
warnings for mingw32 compilation fixed
authorVadim Zeitlin <vadim@wxwidgets.org>
Wed, 13 Oct 1999 18:52:05 +0000 (18:52 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Wed, 13 Oct 1999 18:52:05 +0000 (18:52 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3970 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

14 files changed:
src/common/filefn.cpp
src/generic/dirdlgg.cpp
src/msw/caret.cpp
src/msw/dcprint.cpp
src/msw/listctrl.cpp
src/msw/menu.cpp
src/msw/menuitem.cpp
src/msw/printwin.cpp
src/msw/radiobox.cpp
src/msw/tbar95.cpp
src/msw/tooltip.cpp
src/msw/treectrl.cpp
src/msw/utils.cpp
src/msw/window.cpp

index 65aeab4ae3dd9bbfe1e2d1f08c7b87bf38fa939b..e65513fc9958683f30214d8d17fa38cf5f93b1fb 100644 (file)
@@ -156,15 +156,20 @@ void wxPathList::AddEnvList (const wxString& envVariable)
       wxChar *save_ptr, *token = wxStrtok (s, PATH_TOKS, &save_ptr);
 
       if (token)
-        {
+      {
           Add (copystring (token));
           while (token)
-            {
+          {
               if ((token = wxStrtok ((wxChar *) NULL, PATH_TOKS, &save_ptr)) != NULL)
-                Add (wxString(token));
-            }
-        }
-      delete[]s;
+                  Add (wxString(token));
+          }
+      }
+
+      // suppress warning about unused variable save_ptr when wxStrtok() is a
+      // macro which throws away its third argument
+      save_ptr = token;
+
+      delete [] s;
     }
 }
 
@@ -1572,39 +1577,43 @@ bool wxEndsWithPathSeparator(const wxChar *pszFileName)
 // find a file in a list of directories, returns false if not found
 bool wxFindFileInPath(wxString *pStr, const wxChar *pszPath, const wxChar *pszFile)
 {
-  // we assume that it's not empty
-  wxCHECK_MSG( !wxIsEmpty(pszFile), FALSE,
-               _("empty file name in wxFindFileInPath"));
-
-  // skip path separator in the beginning of the file name if present
-  if ( wxIsPathSeparator(*pszFile) )
-    pszFile++;
-
-  // copy the path (strtok will modify it)
-  wxChar *szPath = new wxChar[wxStrlen(pszPath) + 1];
-  wxStrcpy(szPath, pszPath);
-
-  wxString strFile;
-  wxChar *pc, *save_ptr;
-  for ( pc = wxStrtok(szPath, wxPATH_SEP, &save_ptr);
-        pc != NULL;
-        pc = wxStrtok((wxChar *) NULL, wxPATH_SEP, &save_ptr) )
-  {
-    // search for the file in this directory
-    strFile = pc;
-    if ( !wxEndsWithPathSeparator(pc) )
-      strFile += wxFILE_SEP_PATH;
-    strFile += pszFile;
-
-    if ( FileExists(strFile) ) {
-      *pStr = strFile;
-      break;
+    // we assume that it's not empty
+    wxCHECK_MSG( !wxIsEmpty(pszFile), FALSE,
+            _("empty file name in wxFindFileInPath"));
+
+    // skip path separator in the beginning of the file name if present
+    if ( wxIsPathSeparator(*pszFile) )
+        pszFile++;
+
+    // copy the path (strtok will modify it)
+    wxChar *szPath = new wxChar[wxStrlen(pszPath) + 1];
+    wxStrcpy(szPath, pszPath);
+
+    wxString strFile;
+    wxChar *pc, *save_ptr;
+    for ( pc = wxStrtok(szPath, wxPATH_SEP, &save_ptr);
+          pc != NULL;
+          pc = wxStrtok((wxChar *) NULL, wxPATH_SEP, &save_ptr) )
+    {
+        // search for the file in this directory
+        strFile = pc;
+        if ( !wxEndsWithPathSeparator(pc) )
+            strFile += wxFILE_SEP_PATH;
+        strFile += pszFile;
+
+        if ( FileExists(strFile) ) {
+            *pStr = strFile;
+            break;
+        }
     }
-  }
 
-  delete [] szPath;
+    // suppress warning about unused variable save_ptr when wxStrtok() is a
+    // macro which throws away its third argument
+    save_ptr = pc;
+
+    delete [] szPath;
 
-  return pc != NULL;  // if true => we breaked from the loop
+    return pc != NULL;  // if true => we breaked from the loop
 }
 
 void WXDLLEXPORT wxSplitPath(const wxChar *pszFileName,
index 5343555b80b96253b2fca0302d340f5100db00e0..1b5ee25035c5ce9f54508ee69434e9c275806047 100644 (file)
@@ -50,6 +50,7 @@
 #undef GetFirstChild
 #endif
 
+#ifndef __WXMSW__
 /* XPM */
 static char * icon1_xpm[] = {
 /* width height ncolors chars_per_pixel */
@@ -108,6 +109,8 @@ static char * icon2_xpm[] = {
 "                ",
 "                "};
 
+#endif // !wxMSW
+
 static const int ID_DIRCTRL = 1000;
 static const int ID_TEXTCTRL = 1001;
 static const int ID_OK = 1002;
index e35dc6da09e01c757d9935c89b2887a5ed26097a..5378bc1f8f898f423fd92939e6efb2d74b8bc449 100644 (file)
@@ -153,8 +153,8 @@ void wxCaret::DoMove()
 {
     if ( m_hasCaret )
     {
-        wxWindow *winFocus = wxWindow::FindFocus();
-        wxASSERT_MSG( winFocus == GetWindow(), wxT("how did we lose focus?") );
+        wxASSERT_MSG( wxWindow::FindFocus() == GetWindow(),
+                      wxT("how did we lose focus?") );
 
         CALL_CARET_API(SetCaretPos, (m_x, m_y));
     }
index ffd7d73fdac1056c6bede1a38f9bafc29adb25d3..4344e5977296f0c1fe0705104f110a3d0eb63b29 100644 (file)
@@ -46,15 +46,15 @@ IMPLEMENT_CLASS(wxPrinterDC, wxDC)
 wxPrinterDC::wxPrinterDC(const wxString& driver_name, const wxString& device_name, const wxString& file, bool interactive, int orientation)
 {
     m_isInteractive = interactive;
-    
+
     if (!file.IsNull() && file != wxT(""))
         m_printData.SetFilename(file);
-    
+
 #if wxUSE_COMMON_DIALOGS
     if (interactive)
     {
         PRINTDLG pd;
-        
+
         pd.lStructSize = sizeof( PRINTDLG );
         pd.hwndOwner=(HWND) NULL;
         pd.hDevMode=(HANDLE)NULL;
@@ -66,7 +66,7 @@ wxPrinterDC::wxPrinterDC(const wxString& driver_name, const wxString& device_nam
         pd.nMaxPage=0;
         pd.nCopies=1;
         pd.hInstance=(HINSTANCE)NULL;
-        
+
         if ( PrintDlg( &pd ) != 0 )
         {
             m_hDC = (WXHDC) pd.hDC;
@@ -77,7 +77,7 @@ wxPrinterDC::wxPrinterDC(const wxString& driver_name, const wxString& device_nam
             m_ok = FALSE;
             return;
         }
-        
+
         //     m_dontDelete = TRUE;
     }
     else
@@ -96,7 +96,7 @@ wxPrinterDC::wxPrinterDC(const wxString& driver_name, const wxString& device_nam
             m_hDC = wxGetPrinterDC(printData);
             m_ok = m_hDC ? TRUE: FALSE;
         }
-        
+
         if (m_hDC)
         {
             //     int width = GetDeviceCaps(m_hDC, VERTRES);
@@ -115,10 +115,10 @@ wxPrinterDC::wxPrinterDC(const wxPrintData& printData)
 
     m_hDC = wxGetPrinterDC(printData);
     m_ok = (m_hDC != 0);
-    
+
     if (m_hDC)
         SetMapMode(wxMM_TEXT);
-    
+
     SetBrush(*wxBLACK_BRUSH);
     SetPen(*wxBLACK_PEN);
 }
@@ -127,7 +127,7 @@ wxPrinterDC::wxPrinterDC(const wxPrintData& printData)
 wxPrinterDC::wxPrinterDC(WXHDC theDC)
 {
     m_isInteractive = FALSE;
-    
+
     m_hDC = theDC;
     m_ok = TRUE;
     if (m_hDC)
@@ -161,10 +161,10 @@ bool wxPrinterDC::StartDoc(const wxString& message)
     docinfo.lpszDatatype = NULL;
     docinfo.fwType = 0;
 #endif
-    
+
     if (!m_hDC)
         return FALSE;
-    
+
     int ret =
 #ifndef __WIN32__
         ::StartDoc((HDC) m_hDC, &docinfo);
@@ -179,7 +179,7 @@ bool wxPrinterDC::StartDoc(const wxString& message)
 #endif
 #endif
 #endif
-    
+
 #ifndef __WIN16__
     if (ret <= 0)
     {
@@ -187,7 +187,7 @@ bool wxPrinterDC::StartDoc(const wxString& message)
         wxLogDebug(wxT("wxDC::StartDoc failed with error: %d\n"), lastError);
     }
 #endif
-    
+
     return (ret > 0);
 }
 
@@ -217,7 +217,7 @@ static bool wxGetDefaultDeviceName(wxString& deviceName, wxString& portName)
     LPSTR       lpszDriverName;
     LPSTR       lpszDeviceName;
     LPSTR       lpszPortName;
-    
+
     PRINTDLG    pd;
 
     // Cygwin has trouble believing PRINTDLG is 66 bytes - thinks it is 68
@@ -232,17 +232,17 @@ static bool wxGetDefaultDeviceName(wxString& deviceName, wxString& portName)
     pd.hDevNames      = NULL; // Ditto
     pd.Flags          = PD_RETURNDEFAULT;
     pd.nCopies        = 1;
-    
+
     if (!PrintDlg((LPPRINTDLG)&pd))
     {
         if ( pd.hDevMode )
             GlobalFree(pd.hDevMode);
         if (pd.hDevNames)
             GlobalFree(pd.hDevNames);
-        
+
         return FALSE;
     }
-    
+
     if (pd.hDevNames)
     {
         lpDevNames = (LPDEVNAMES)GlobalLock(pd.hDevNames);
@@ -256,7 +256,7 @@ static bool wxGetDefaultDeviceName(wxString& deviceName, wxString& portName)
         deviceName = lpszDeviceName;
         portName = lpszPortName;
     }
-    
+
     if (pd.hDevMode)
     {
         GlobalFree(pd.hDevMode);
@@ -276,7 +276,7 @@ WXHDC wxGetPrinterDC(int orientation)
     LPSTR       lpszDriverName;
     LPSTR       lpszDeviceName;
     LPSTR       lpszPortName;
-    
+
     PRINTDLG    pd;
     // __GNUWIN32__ has trouble believing PRINTDLG is 66 bytes - thinks it is 68
 #ifdef __GNUWIN32__
@@ -289,45 +289,45 @@ WXHDC wxGetPrinterDC(int orientation)
     pd.hDevNames      = NULL; // Ditto
     pd.Flags          = PD_RETURNDEFAULT;
     pd.nCopies        = 1;
-    
+
     if (!PrintDlg((LPPRINTDLG)&pd))
     {
         if ( pd.hDevMode )
             GlobalFree(pd.hDevMode);
         if (pd.hDevNames)
             GlobalFree(pd.hDevNames);
-        
+
         return(0);
     }
-    
+
     if (!pd.hDevNames)
     {
         if ( pd.hDevMode )
             GlobalFree(pd.hDevMode);
     }
-    
+
     lpDevNames = (LPDEVNAMES)GlobalLock(pd.hDevNames);
     lpszDriverName = (LPSTR)lpDevNames + lpDevNames->wDriverOffset;
     lpszDeviceName = (LPSTR)lpDevNames + lpDevNames->wDeviceOffset;
     lpszPortName   = (LPSTR)lpDevNames + lpDevNames->wOutputOffset;
     GlobalUnlock(pd.hDevNames);
-    
+
     if ( pd.hDevMode )
     {
         lpDevMode = (DEVMODE*) GlobalLock(pd.hDevMode);
         lpDevMode->dmOrientation = orientation;
         lpDevMode->dmFields |= DM_ORIENTATION;
     }
-    
+
 #ifdef __WIN32__
     hDC = CreateDC(lpszDriverName, lpszDeviceName, lpszPortName, (DEVMODE *)lpDevMode);
 #else
     hDC = CreateDC(lpszDriverName, lpszDeviceName, lpszPortName, (LPSTR)lpDevMode);
 #endif
-    
+
     if (pd.hDevMode && lpDevMode)
         GlobalUnlock(pd.hDevMode);
-    
+
     if (pd.hDevNames)
     {
         GlobalFree(pd.hDevNames);
@@ -347,13 +347,13 @@ WXHDC WXDLLEXPORT wxGetPrinterDC(const wxPrintData& printDataConst)
 {
     wxPrintData printData = printDataConst;
     printData.ConvertToNative();
-    
+
     wxChar* driverName = (wxChar*) NULL;
-    
+
     wxString devNameStr = printData.GetPrinterName();
     wxChar* deviceName;
     wxChar* portName = (wxChar*) NULL; // Obsolete in WIN32
-    
+
     if (devNameStr == wxT(""))
         deviceName = (wxChar*) NULL;
     else
@@ -370,22 +370,27 @@ WXHDC WXDLLEXPORT wxGetPrinterDC(const wxPrintData& printDataConst)
     {
         // Retrieve the default device name
         wxString portName;
-        bool ret = wxGetDefaultDeviceName(devNameStr, portName);
+#ifdef  __WXDEBUG__
+        bool ret =
+#else   // !Debug
+        (void)
+#endif // Debug/Release
+        wxGetDefaultDeviceName(devNameStr, portName);
 
         wxASSERT_MSG( ret, wxT("Could not get default device name.") );
 
         deviceName = WXSTRINGCAST devNameStr;
     }
-    
+
 #ifdef __WIN32__
     HDC hDC = CreateDC(driverName, deviceName, portName, (DEVMODE *) lpDevMode);
 #else
     HDC hDC = CreateDC(driverName, deviceName, portName, (LPSTR) lpDevMode);
 #endif
-    
+
     if (hDevMode && lpDevMode)
         GlobalUnlock(hDevMode);
-    
+
     return (WXHDC) hDC;
 }
 
index f8b52a99cff2047fa402b069badbf7890dbb47d7..93d6a1482e40e9bfdc9a4f742fc5e00ca1bf7459 100644 (file)
@@ -1410,7 +1410,7 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
     if ( !GetEventHandler()->ProcessEvent(event) )
         return FALSE;
 
-    if (hdr1->code == LVN_GETDISPINFO)
+    if ( (int)hdr1->code == LVN_GETDISPINFO)
     {
         LV_DISPINFO *info = (LV_DISPINFO *)lParam;
         if ( info->item.mask & LVIF_TEXT )
index 8e19e7acb34d49f469a6f1cf13261792ca2712f9..626d99902f7bf6619bbd7d3c4f878621a46b2287 100644 (file)
@@ -258,7 +258,7 @@ void wxMenu::Append(wxMenuItem *pItem)
     else
     {
 #ifdef __WIN32__
-        if ( id == idMenuTitle )
+        if ( (int)id == idMenuTitle )
         {
             // visually select the menu title
             MENUITEMINFO mii;
@@ -855,7 +855,7 @@ void wxMenuBar::SetLabelTop(int pos, const wxString& label)
     }
 
     if ( ::ModifyMenu(GetHmenu(), pos, MF_BYPOSITION | MF_STRING | flagsOld,
-                      id, label) == 0xFFFFFFFF )
+                      id, label) == (int)0xFFFFFFFF )
     {
         wxLogLastError("ModifyMenu");
     }
@@ -1094,7 +1094,7 @@ void wxMenuBar::Attach(wxFrame *frame)
 void wxMenuBar::Detach()
 {
 //    ::DestroyMenu((HMENU)m_hMenu);
-    m_hMenu = NULL;
+    m_hMenu = (WXHMENU)NULL;
     m_menuBarFrame = NULL;
 }
 
index d7c5bef8aa543f6df741136f25dbd23c3d842649..f40498487b497b27c0c7bb11b66335746fc4c5ee 100644 (file)
@@ -208,7 +208,7 @@ void wxMenuItem::SetName(const wxString& strName)
 
         if ( ::ModifyMenu(hMenu, id,
                           MF_BYCOMMAND | flagsOld,
-                          id, data) == 0xFFFFFFFF )
+                          id, data) == (int)0xFFFFFFFF )
         {
             wxLogLastError(wxT("ModifyMenu"));
         }
index c8b1a50dd2eb0c8bb11a6539b2ddea5a4af84fbc..0f05f726185ca818f3926fa2b8f207af0027acaa 100644 (file)
@@ -87,7 +87,11 @@ wxWindowsPrinter::wxWindowsPrinter(wxPrintDialogData *data)
 
 wxWindowsPrinter::~wxWindowsPrinter()
 {
+    // avoids mingw warning about statement with no effect (FreeProcInstance
+    // doesn't do anything under Win32)
+#ifndef __GNUWIN32__
     FreeProcInstance((FARPROC) m_lpAbortProc);
+#endif
 }
 
 bool wxWindowsPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt)
index 426599d197a2beaedd83782972eb42a508e72f8b..48666d0859b1fad52bd2f2710c453bf677279be7 100644 (file)
@@ -440,7 +440,7 @@ void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags)
         {
             if ( sizeFlags & wxSIZE_AUTO_HEIGHT )
                 height = totHeight + extraHeight;
-            else 
+            else
                 height = heightOld;
         }
 
@@ -718,7 +718,7 @@ LRESULT APIENTRY _EXPORT wxRadioBtnWndProc(HWND hwnd,
 {
     bool processed = TRUE;
     if ( msg != WM_KEYDOWN )
-        processed = FALSE;        
+        processed = FALSE;
 
     if ( processed )
     {
@@ -759,7 +759,7 @@ LRESULT APIENTRY _EXPORT wxRadioBtnWndProc(HWND hwnd,
                 // fall through
 
             default:
-                processed = FALSE;        
+                processed = FALSE;
         }
 
         if ( processed )
index 1c0cb2d5cc1226bc3745a67f725ef3b7de2ad9c4..c3b57815e59a381cc687c541c80c70c0ae6ff0af 100644 (file)
@@ -360,7 +360,8 @@ bool wxToolBar95::MSWOnNotify(int WXUNUSED(idCtrl),
 
     // the tooltips control created by the toolbar is sometimes Unicode, even in
     // an ANSI application
-    if ( (hdr->code != TTN_NEEDTEXTA) && (hdr->code != TTN_NEEDTEXTW) )
+    int code = (int)hdr->code;
+    if ( (code != TTN_NEEDTEXTA) && (code != TTN_NEEDTEXTW) )
         return FALSE;
 
     HWND toolTipWnd = (HWND)::SendMessage((HWND)GetHWND(), TB_GETTOOLTIPS, 0, 0);
@@ -379,7 +380,7 @@ bool wxToolBar95::MSWOnNotify(int WXUNUSED(idCtrl),
 
     if ( !help.IsEmpty() )
     {
-        if ( hdr->code == TTN_NEEDTEXTA )
+        if ( code == TTN_NEEDTEXTA )
         {
             ttText->lpszText = (wxChar *)help.c_str();
         }
index f7a4ab2bbc19cbc12be9a0c785c04959e98453c6..cbe06c171143c622a398148ad0ac3c274a58fe46 100644 (file)
@@ -41,7 +41,7 @@
 // ----------------------------------------------------------------------------
 
 // the tooltip parent window
-WXHWND wxToolTip::hwndTT = NULL;
+WXHWND wxToolTip::hwndTT = (WXHWND)NULL;
 
 // ----------------------------------------------------------------------------
 // private classes
index 8517884f189738dc1b5d4bf63f95e0d0af691798..baad3f6a6e97853fbadeb86cec37ca8976a03897 100644 (file)
@@ -1444,7 +1444,7 @@ bool wxTreeCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
                                       "message"), tv->action);
                 }
 
-                bool ing = (hdr->code == TVN_ITEMEXPANDING);
+                bool ing = ((int)hdr->code == TVN_ITEMEXPANDING);
                 eventType = g_events[expand][ing];
 
                 event.m_item = (WXHTREEITEM) tv->itemNew.hItem;
index 5590eb7fb3a9dc1c4cd75bd8b0cc12d0515e8ed7..38723ea82c9d0847022d0ff101c0b9b6042f3099 100644 (file)
@@ -434,7 +434,6 @@ void wxBell()
 // detect WindowsNT correctly
 int wxGetOsVersion(int *majorVsn, int *minorVsn)
 {
-  extern char *wxOsVersion;
   if (majorVsn) *majorVsn = 0;
   if (minorVsn) *minorVsn = 0;
 
index 411e011c1aa1c34c975213858f919d249b8e652d..c5134276101243c00b248836378e1a18ec86c903 100644 (file)
@@ -2379,7 +2379,7 @@ bool wxWindow::MSWOnNotify(int WXUNUSED(idCtrl),
 {
 #if wxUSE_TOOLTIPS
     NMHDR* hdr = (NMHDR *)lParam;
-    if ( hdr->code == TTN_NEEDTEXT && m_tooltip )
+    if ( (int)hdr->code == TTN_NEEDTEXT && m_tooltip )
     {
         TOOLTIPTEXT *ttt = (TOOLTIPTEXT *)lParam;
         ttt->lpszText = (wxChar *)m_tooltip->GetTip().c_str();
@@ -2402,7 +2402,7 @@ bool wxWindow::HandleQueryEndSession(long logOff, bool *mayEnd)
     wxCloseEvent event(wxEVT_QUERY_END_SESSION, -1);
     event.SetEventObject(wxTheApp);
     event.SetCanVeto(TRUE);
-    event.SetLoggingOff(logOff == ENDSESSION_LOGOFF);
+    event.SetLoggingOff(logOff == (long)ENDSESSION_LOGOFF);
 
     bool rc = wxTheApp->ProcessEvent(event);
 
@@ -2425,7 +2425,7 @@ bool wxWindow::HandleEndSession(bool endSession, long logOff)
     wxCloseEvent event(wxEVT_END_SESSION, -1);
     event.SetEventObject(wxTheApp);
     event.SetCanVeto(FALSE);
-    event.SetLoggingOff( (logOff == ENDSESSION_LOGOFF) );
+    event.SetLoggingOff( (logOff == (long)ENDSESSION_LOGOFF) );
     if ( (this == wxTheApp->GetTopWindow()) && // Only send once
         wxTheApp->ProcessEvent(event))
     {
@@ -3567,7 +3567,11 @@ void wxSetKeyboardHook(bool doIt)
     else
     {
         UnhookWindowsHookEx(wxTheKeyboardHook);
+        // avoids mingw warning about statement with no effect (FreeProcInstance
+        // doesn't do anything under Win32)
+#ifndef __GNUWIN32__
         FreeProcInstance(wxTheKeyboardHookProc);
+#endif
     }
 }