warnings for mingw32 compilation fixed

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3970 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
1999-10-13 18:52:05 +00:00
parent 4882bf1b78
commit a17e237f4a
14 changed files with 109 additions and 84 deletions

View File

@@ -156,15 +156,20 @@ void wxPathList::AddEnvList (const wxString& envVariable)
wxChar *save_ptr, *token = wxStrtok (s, PATH_TOKS, &save_ptr); wxChar *save_ptr, *token = wxStrtok (s, PATH_TOKS, &save_ptr);
if (token) if (token)
{ {
Add (copystring (token)); Add (copystring (token));
while (token) while (token)
{ {
if ((token = wxStrtok ((wxChar *) NULL, PATH_TOKS, &save_ptr)) != NULL) if ((token = wxStrtok ((wxChar *) NULL, PATH_TOKS, &save_ptr)) != NULL)
Add (wxString(token)); Add (wxString(token));
} }
} }
delete[]s;
// 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 // find a file in a list of directories, returns false if not found
bool wxFindFileInPath(wxString *pStr, const wxChar *pszPath, const wxChar *pszFile) bool wxFindFileInPath(wxString *pStr, const wxChar *pszPath, const wxChar *pszFile)
{ {
// we assume that it's not empty // we assume that it's not empty
wxCHECK_MSG( !wxIsEmpty(pszFile), FALSE, wxCHECK_MSG( !wxIsEmpty(pszFile), FALSE,
_("empty file name in wxFindFileInPath")); _("empty file name in wxFindFileInPath"));
// skip path separator in the beginning of the file name if present // skip path separator in the beginning of the file name if present
if ( wxIsPathSeparator(*pszFile) ) if ( wxIsPathSeparator(*pszFile) )
pszFile++; pszFile++;
// copy the path (strtok will modify it) // copy the path (strtok will modify it)
wxChar *szPath = new wxChar[wxStrlen(pszPath) + 1]; wxChar *szPath = new wxChar[wxStrlen(pszPath) + 1];
wxStrcpy(szPath, pszPath); wxStrcpy(szPath, pszPath);
wxString strFile; wxString strFile;
wxChar *pc, *save_ptr; wxChar *pc, *save_ptr;
for ( pc = wxStrtok(szPath, wxPATH_SEP, &save_ptr); for ( pc = wxStrtok(szPath, wxPATH_SEP, &save_ptr);
pc != NULL; pc != NULL;
pc = wxStrtok((wxChar *) NULL, wxPATH_SEP, &save_ptr) ) pc = wxStrtok((wxChar *) NULL, wxPATH_SEP, &save_ptr) )
{ {
// search for the file in this directory // search for the file in this directory
strFile = pc; strFile = pc;
if ( !wxEndsWithPathSeparator(pc) ) if ( !wxEndsWithPathSeparator(pc) )
strFile += wxFILE_SEP_PATH; strFile += wxFILE_SEP_PATH;
strFile += pszFile; strFile += pszFile;
if ( FileExists(strFile) ) { if ( FileExists(strFile) ) {
*pStr = strFile; *pStr = strFile;
break; break;
}
} }
}
delete [] szPath; // suppress warning about unused variable save_ptr when wxStrtok() is a
// macro which throws away its third argument
save_ptr = pc;
return pc != NULL; // if true => we breaked from the loop delete [] szPath;
return pc != NULL; // if true => we breaked from the loop
} }
void WXDLLEXPORT wxSplitPath(const wxChar *pszFileName, void WXDLLEXPORT wxSplitPath(const wxChar *pszFileName,

View File

@@ -50,6 +50,7 @@
#undef GetFirstChild #undef GetFirstChild
#endif #endif
#ifndef __WXMSW__
/* XPM */ /* XPM */
static char * icon1_xpm[] = { static char * icon1_xpm[] = {
/* width height ncolors chars_per_pixel */ /* 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_DIRCTRL = 1000;
static const int ID_TEXTCTRL = 1001; static const int ID_TEXTCTRL = 1001;
static const int ID_OK = 1002; static const int ID_OK = 1002;

View File

@@ -153,8 +153,8 @@ void wxCaret::DoMove()
{ {
if ( m_hasCaret ) if ( m_hasCaret )
{ {
wxWindow *winFocus = wxWindow::FindFocus(); wxASSERT_MSG( wxWindow::FindFocus() == GetWindow(),
wxASSERT_MSG( winFocus == GetWindow(), wxT("how did we lose focus?") ); wxT("how did we lose focus?") );
CALL_CARET_API(SetCaretPos, (m_x, m_y)); CALL_CARET_API(SetCaretPos, (m_x, m_y));
} }

View File

@@ -370,7 +370,12 @@ WXHDC WXDLLEXPORT wxGetPrinterDC(const wxPrintData& printDataConst)
{ {
// Retrieve the default device name // Retrieve the default device name
wxString portName; 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.") ); wxASSERT_MSG( ret, wxT("Could not get default device name.") );

View File

@@ -1410,7 +1410,7 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
if ( !GetEventHandler()->ProcessEvent(event) ) if ( !GetEventHandler()->ProcessEvent(event) )
return FALSE; return FALSE;
if (hdr1->code == LVN_GETDISPINFO) if ( (int)hdr1->code == LVN_GETDISPINFO)
{ {
LV_DISPINFO *info = (LV_DISPINFO *)lParam; LV_DISPINFO *info = (LV_DISPINFO *)lParam;
if ( info->item.mask & LVIF_TEXT ) if ( info->item.mask & LVIF_TEXT )

View File

@@ -258,7 +258,7 @@ void wxMenu::Append(wxMenuItem *pItem)
else else
{ {
#ifdef __WIN32__ #ifdef __WIN32__
if ( id == idMenuTitle ) if ( (int)id == idMenuTitle )
{ {
// visually select the menu title // visually select the menu title
MENUITEMINFO mii; MENUITEMINFO mii;
@@ -855,7 +855,7 @@ void wxMenuBar::SetLabelTop(int pos, const wxString& label)
} }
if ( ::ModifyMenu(GetHmenu(), pos, MF_BYPOSITION | MF_STRING | flagsOld, if ( ::ModifyMenu(GetHmenu(), pos, MF_BYPOSITION | MF_STRING | flagsOld,
id, label) == 0xFFFFFFFF ) id, label) == (int)0xFFFFFFFF )
{ {
wxLogLastError("ModifyMenu"); wxLogLastError("ModifyMenu");
} }
@@ -1094,7 +1094,7 @@ void wxMenuBar::Attach(wxFrame *frame)
void wxMenuBar::Detach() void wxMenuBar::Detach()
{ {
// ::DestroyMenu((HMENU)m_hMenu); // ::DestroyMenu((HMENU)m_hMenu);
m_hMenu = NULL; m_hMenu = (WXHMENU)NULL;
m_menuBarFrame = NULL; m_menuBarFrame = NULL;
} }

View File

@@ -208,7 +208,7 @@ void wxMenuItem::SetName(const wxString& strName)
if ( ::ModifyMenu(hMenu, id, if ( ::ModifyMenu(hMenu, id,
MF_BYCOMMAND | flagsOld, MF_BYCOMMAND | flagsOld,
id, data) == 0xFFFFFFFF ) id, data) == (int)0xFFFFFFFF )
{ {
wxLogLastError(wxT("ModifyMenu")); wxLogLastError(wxT("ModifyMenu"));
} }

View File

@@ -87,7 +87,11 @@ wxWindowsPrinter::wxWindowsPrinter(wxPrintDialogData *data)
wxWindowsPrinter::~wxWindowsPrinter() wxWindowsPrinter::~wxWindowsPrinter()
{ {
// avoids mingw warning about statement with no effect (FreeProcInstance
// doesn't do anything under Win32)
#ifndef __GNUWIN32__
FreeProcInstance((FARPROC) m_lpAbortProc); FreeProcInstance((FARPROC) m_lpAbortProc);
#endif
} }
bool wxWindowsPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt) bool wxWindowsPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt)

View File

@@ -360,7 +360,8 @@ bool wxToolBar95::MSWOnNotify(int WXUNUSED(idCtrl),
// the tooltips control created by the toolbar is sometimes Unicode, even in // the tooltips control created by the toolbar is sometimes Unicode, even in
// an ANSI application // 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; return FALSE;
HWND toolTipWnd = (HWND)::SendMessage((HWND)GetHWND(), TB_GETTOOLTIPS, 0, 0); HWND toolTipWnd = (HWND)::SendMessage((HWND)GetHWND(), TB_GETTOOLTIPS, 0, 0);
@@ -379,7 +380,7 @@ bool wxToolBar95::MSWOnNotify(int WXUNUSED(idCtrl),
if ( !help.IsEmpty() ) if ( !help.IsEmpty() )
{ {
if ( hdr->code == TTN_NEEDTEXTA ) if ( code == TTN_NEEDTEXTA )
{ {
ttText->lpszText = (wxChar *)help.c_str(); ttText->lpszText = (wxChar *)help.c_str();
} }

View File

@@ -41,7 +41,7 @@
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// the tooltip parent window // the tooltip parent window
WXHWND wxToolTip::hwndTT = NULL; WXHWND wxToolTip::hwndTT = (WXHWND)NULL;
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// private classes // private classes

View File

@@ -1444,7 +1444,7 @@ bool wxTreeCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
"message"), tv->action); "message"), tv->action);
} }
bool ing = (hdr->code == TVN_ITEMEXPANDING); bool ing = ((int)hdr->code == TVN_ITEMEXPANDING);
eventType = g_events[expand][ing]; eventType = g_events[expand][ing];
event.m_item = (WXHTREEITEM) tv->itemNew.hItem; event.m_item = (WXHTREEITEM) tv->itemNew.hItem;

View File

@@ -434,7 +434,6 @@ void wxBell()
// detect WindowsNT correctly // detect WindowsNT correctly
int wxGetOsVersion(int *majorVsn, int *minorVsn) int wxGetOsVersion(int *majorVsn, int *minorVsn)
{ {
extern char *wxOsVersion;
if (majorVsn) *majorVsn = 0; if (majorVsn) *majorVsn = 0;
if (minorVsn) *minorVsn = 0; if (minorVsn) *minorVsn = 0;

View File

@@ -2379,7 +2379,7 @@ bool wxWindow::MSWOnNotify(int WXUNUSED(idCtrl),
{ {
#if wxUSE_TOOLTIPS #if wxUSE_TOOLTIPS
NMHDR* hdr = (NMHDR *)lParam; NMHDR* hdr = (NMHDR *)lParam;
if ( hdr->code == TTN_NEEDTEXT && m_tooltip ) if ( (int)hdr->code == TTN_NEEDTEXT && m_tooltip )
{ {
TOOLTIPTEXT *ttt = (TOOLTIPTEXT *)lParam; TOOLTIPTEXT *ttt = (TOOLTIPTEXT *)lParam;
ttt->lpszText = (wxChar *)m_tooltip->GetTip().c_str(); 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); wxCloseEvent event(wxEVT_QUERY_END_SESSION, -1);
event.SetEventObject(wxTheApp); event.SetEventObject(wxTheApp);
event.SetCanVeto(TRUE); event.SetCanVeto(TRUE);
event.SetLoggingOff(logOff == ENDSESSION_LOGOFF); event.SetLoggingOff(logOff == (long)ENDSESSION_LOGOFF);
bool rc = wxTheApp->ProcessEvent(event); bool rc = wxTheApp->ProcessEvent(event);
@@ -2425,7 +2425,7 @@ bool wxWindow::HandleEndSession(bool endSession, long logOff)
wxCloseEvent event(wxEVT_END_SESSION, -1); wxCloseEvent event(wxEVT_END_SESSION, -1);
event.SetEventObject(wxTheApp); event.SetEventObject(wxTheApp);
event.SetCanVeto(FALSE); event.SetCanVeto(FALSE);
event.SetLoggingOff( (logOff == ENDSESSION_LOGOFF) ); event.SetLoggingOff( (logOff == (long)ENDSESSION_LOGOFF) );
if ( (this == wxTheApp->GetTopWindow()) && // Only send once if ( (this == wxTheApp->GetTopWindow()) && // Only send once
wxTheApp->ProcessEvent(event)) wxTheApp->ProcessEvent(event))
{ {
@@ -3567,7 +3567,11 @@ void wxSetKeyboardHook(bool doIt)
else else
{ {
UnhookWindowsHookEx(wxTheKeyboardHook); UnhookWindowsHookEx(wxTheKeyboardHook);
// avoids mingw warning about statement with no effect (FreeProcInstance
// doesn't do anything under Win32)
#ifndef __GNUWIN32__
FreeProcInstance(wxTheKeyboardHookProc); FreeProcInstance(wxTheKeyboardHookProc);
#endif
} }
} }