warnings fixed for compilation with VC++ at max warning level with optimization

(mainly "unreachable code"), another warning ("function not inlined") disabled
in defs.h, minor fixes to DLL project file template


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@7961 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2000-08-06 10:12:09 +00:00
parent a3a57f29ce
commit 23c44a6134
20 changed files with 111 additions and 103 deletions

View File

@@ -87,13 +87,13 @@ RSC=rc.exe
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /i "$(wx)\include" /d "NDEBUG"
BSC32=bscmake.exe BSC32=bscmake.exe
# ADD BASE BSC32 /nologo # ADD BASE BSC32 /nologo
# ADD BSC32 /nologo # ADD BSC32 /nologo
LINK32=link.exe LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib src\jpeg\Release\jpeg.lib src\tiff\Release\tiff.lib src\png\Release\png.lib src\xpm\Release\xpm.lib src\zlib\Release\zlib.lib /nologo /dll /machine:I386 /out:"ReleaseDll/wxmsw221.dll" # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib src\jpeg\Release\jpeg.lib src\tiff\Release\tiff.lib src\png\Release\png.lib src\xpm\Release\xpm.lib src\zlib\Release\zlib.lib /nologo /dll /machine:I386 /out:"ReleaseDll/wxmsw221.dll"
# ADD LINK32 kernel32.lib user32.lib gdi32.lib advapi32.lib comdlg32.lib shell32.lib ole32.lib oleaut32.lib odbc32.lib uuid.lib rpcrt4.lib comctl32.lib winmm.lib src\jpeg\Release\jpeg.lib src\tiff\Release\tiff.lib src\png\Release\png.lib src\xpm\Release\xpm.lib src\zlib\Release\zlib.lib /nologo /dll /machine:I386 /out:"ReleaseDll/wxmsw221.dll" # ADD LINK32 kernel32.lib user32.lib gdi32.lib advapi32.lib comdlg32.lib shell32.lib ole32.lib oleaut32.lib odbc32.lib uuid.lib rpcrt4.lib comctl32.lib wsock32.lib winmm.lib src\jpeg\Release\jpeg.lib src\tiff\Release\tiff.lib src\png\Release\png.lib src\xpm\Release\xpm.lib src\zlib\Release\zlib.lib /nologo /dll /machine:I386 /out:"ReleaseDll/wxmsw221.dll"
!ELSEIF "$(CFG)" == "wxWinDll - Win32 Debug" !ELSEIF "$(CFG)" == "wxWinDll - Win32 Debug"
@@ -113,7 +113,7 @@ LINK32=link.exe
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /i "$(wx)\include" /d "_DEBUG"
BSC32=bscmake.exe BSC32=bscmake.exe
# ADD BASE BSC32 /nologo # ADD BASE BSC32 /nologo
# ADD BSC32 /nologo # ADD BSC32 /nologo
@@ -152,6 +152,7 @@ SOURCE=.\src\common\y_tab.c
!IF "$(CFG)" == "wxWinDll - Win32 Release" !IF "$(CFG)" == "wxWinDll - Win32 Release"
# ADD CPP /W1
# SUBTRACT CPP /YX /Yc /Yu # SUBTRACT CPP /YX /Yc /Yu
!ELSEIF "$(CFG)" == "wxWinDll - Win32 Debug" !ELSEIF "$(CFG)" == "wxWinDll - Win32 Debug"

View File

@@ -100,8 +100,9 @@
# pragma warning(disable:4100) // unreferenced formal parameter # pragma warning(disable:4100) // unreferenced formal parameter
# pragma warning(disable:4511) // copy ctor couldn't be generated # pragma warning(disable:4511) // copy ctor couldn't be generated
# pragma warning(disable:4512) // operator=() couldn't be generated # pragma warning(disable:4512) // operator=() couldn't be generated
# pragma warning(disable:4699) // Using precompiled header # pragma warning(disable:4699) // using precompiled header
# pragma warning(disable:4134) // conversion between pointers to members of same class # pragma warning(disable:4134) // conversion between pointers to members of same class
# pragma warning(disable:4710) // function not inlined
#ifndef WIN32 #ifndef WIN32
# pragma warning(disable:4135) // conversion between different integral types # pragma warning(disable:4135) // conversion between different integral types
# pragma warning(disable:4769) // assignment of near pointer to long integer # pragma warning(disable:4769) // assignment of near pointer to long integer

View File

@@ -1114,8 +1114,8 @@ wxDocument *wxDocManager::CreateDocument(const wxString& path, long flags)
} }
return newDoc; return newDoc;
} }
else
return (wxDocument *) NULL; return (wxDocument *) NULL;
} }
wxView *wxDocManager::CreateView(wxDocument *doc, long flags) wxView *wxDocManager::CreateView(wxDocument *doc, long flags)
@@ -1376,6 +1376,7 @@ wxDocTemplate *wxDocManager::SelectDocumentPath(wxDocTemplate **templates,
0, 0,
parent); parent);
wxDocTemplate *theTemplate = (wxDocTemplate *)NULL;
if (!pathTmp.IsEmpty()) if (!pathTmp.IsEmpty())
{ {
if (!wxFileExists(pathTmp)) if (!wxFileExists(pathTmp))
@@ -1398,19 +1399,18 @@ wxDocTemplate *wxDocManager::SelectDocumentPath(wxDocTemplate **templates,
// first choose the template using the extension, if this fails (i.e. // first choose the template using the extension, if this fails (i.e.
// wxFileSelectorEx() didn't fill it), then use the path // wxFileSelectorEx() didn't fill it), then use the path
wxDocTemplate *theTemplate = (wxDocTemplate *)NULL;
if ( FilterIndex != -1 ) if ( FilterIndex != -1 )
theTemplate = templates[FilterIndex]; theTemplate = templates[FilterIndex];
if ( !theTemplate ) if ( !theTemplate )
theTemplate = FindTemplateForPath(path); theTemplate = FindTemplateForPath(path);
return theTemplate;
} }
else else
{ {
path = wxT(""); path = wxT("");
return (wxDocTemplate *) NULL;
} }
return theTemplate;
#if 0 #if 0
// In all other windowing systems, until we have more advanced // In all other windowing systems, until we have more advanced
// file selectors, we must select the document type (template) first, and // file selectors, we must select the document type (template) first, and

View File

@@ -741,8 +741,8 @@ bool wxFontMapper::IsEncodingAvailable(wxFontEncoding encoding,
info.facename = facename; info.facename = facename;
return wxTestFontEncoding(info); return wxTestFontEncoding(info);
} }
else
return FALSE; return FALSE;
} }
#endif // wxUSE_GUI #endif // wxUSE_GUI

View File

@@ -85,12 +85,9 @@ wxFSFile* wxZipFSHandler::OpenFile(wxFileSystem& WXUNUSED(fs), const wxString& l
GetAnchor(location), GetAnchor(location),
wxDateTime(wxFileModificationTime(left))); wxDateTime(wxFileModificationTime(left)));
} }
else
{ delete s;
if (s) return NULL;
delete s;
return NULL;
}
} }

View File

@@ -662,9 +662,9 @@ bool wxImage::SaveFile( const wxString& filename, int type )
wxBufferedOutputStream bstream( stream ); wxBufferedOutputStream bstream( stream );
return SaveFile(bstream, type); return SaveFile(bstream, type);
} }
else
#endif // wxUSE_STREAMS #endif // wxUSE_STREAMS
return FALSE;
return FALSE;
} }
bool wxImage::SaveFile( const wxString& filename, const wxString& mimetype ) bool wxImage::SaveFile( const wxString& filename, const wxString& mimetype )
@@ -677,9 +677,9 @@ bool wxImage::SaveFile( const wxString& filename, const wxString& mimetype )
wxBufferedOutputStream bstream( stream ); wxBufferedOutputStream bstream( stream );
return SaveFile(bstream, mimetype); return SaveFile(bstream, mimetype);
} }
else
#endif // wxUSE_STREAMS #endif // wxUSE_STREAMS
return FALSE;
return FALSE;
} }
bool wxImage::CanRead( const wxString &name ) bool wxImage::CanRead( const wxString &name )

View File

@@ -887,10 +887,13 @@ int wxMessageBox(const wxString& message, const wxString& caption, long style,
return wxYES; return wxYES;
case wxID_NO: case wxID_NO:
return wxNO; return wxNO;
default:
case wxID_CANCEL: case wxID_CANCEL:
return wxCANCEL; return wxCANCEL;
} }
wxFAIL_MSG( _T("unexpected return code from wxMessageDialog") );
return wxCANCEL;
} }
#if wxUSE_TEXTDLG #if wxUSE_TEXTDLG

View File

@@ -45,10 +45,11 @@ wxString wxGetSingleChoice( const wxString& message, const wxString& caption, in
int WXUNUSED(width), int WXUNUSED(height) ) int WXUNUSED(width), int WXUNUSED(height) )
{ {
wxSingleChoiceDialog dialog(parent, message, caption, n, choices); wxSingleChoiceDialog dialog(parent, message, caption, n, choices);
wxString choice;
if ( dialog.ShowModal() == wxID_OK ) if ( dialog.ShowModal() == wxID_OK )
return dialog.GetStringSelection(); choice = dialog.GetStringSelection();
else
return wxT(""); return choice;
} }
// Overloaded for backward compatibility // Overloaded for backward compatibility
@@ -75,10 +76,13 @@ int wxGetSingleChoiceIndex( const wxString& message, const wxString& caption, in
int WXUNUSED(width), int WXUNUSED(height) ) int WXUNUSED(width), int WXUNUSED(height) )
{ {
wxSingleChoiceDialog dialog(parent, message, caption, n, choices); wxSingleChoiceDialog dialog(parent, message, caption, n, choices);
int choice;
if ( dialog.ShowModal() == wxID_OK ) if ( dialog.ShowModal() == wxID_OK )
return dialog.GetSelection(); choice = dialog.GetSelection();
else else
return -1; choice = -1;
return choice;
} }
// Overloaded for backward compatibility // Overloaded for backward compatibility
@@ -102,10 +106,13 @@ void *wxGetSingleChoiceData( const wxString& message, const wxString& caption, i
int WXUNUSED(width), int WXUNUSED(height) ) int WXUNUSED(width), int WXUNUSED(height) )
{ {
wxSingleChoiceDialog dialog(parent, message, caption, n, choices, (char **)client_data); wxSingleChoiceDialog dialog(parent, message, caption, n, choices, (char **)client_data);
void *data;
if ( dialog.ShowModal() == wxID_OK ) if ( dialog.ShowModal() == wxID_OK )
return dialog.GetSelectionClientData(); data = dialog.GetSelectionClientData();
else else
return NULL; data = NULL;
return data;
} }
// Overloaded for backward compatibility // Overloaded for backward compatibility

View File

@@ -160,7 +160,7 @@ wxString wxHtmlFilterHTML::ReadFile(const wxFSFile& file) const
return s; return s;
} }
else return doc; return doc;
} }

View File

@@ -485,16 +485,14 @@ bool wxHtmlEasyPrinting::DoPreview(wxHtmlPrintout *printout1, wxHtmlPrintout *pr
delete preview; delete preview;
return FALSE; return FALSE;
} }
else { wxPreviewFrame *frame = new wxPreviewFrame(preview, m_Frame,
wxPreviewFrame *frame = new wxPreviewFrame(preview, m_Frame, m_Name + _(" Preview"),
m_Name + _(" Preview"), wxPoint(100, 100), wxSize(650, 500));
wxPoint(100, 100), wxSize(650, 500)); frame -> Centre(wxBOTH);
frame -> Centre(wxBOTH); frame -> Initialize();
frame -> Initialize(); frame -> Show(TRUE);
frame -> Show(TRUE); return TRUE;
return TRUE;
}
} }
@@ -508,11 +506,9 @@ bool wxHtmlEasyPrinting::DoPrint(wxHtmlPrintout *printout)
{ {
return FALSE; return FALSE;
} }
else
{ (*m_PrintData) = printer.GetPrintDialogData().GetPrintData();
(*m_PrintData) = printer.GetPrintDialogData().GetPrintData(); return TRUE;
return TRUE;
}
} }

View File

@@ -151,13 +151,13 @@ wxString wxFileSelector(const wxChar *title,
fileDialog.SetFilterIndex(filterFind); fileDialog.SetFilterIndex(filterFind);
} }
wxString filename;
if ( fileDialog.ShowModal() == wxID_OK ) if ( fileDialog.ShowModal() == wxID_OK )
{ {
wxStrcpy(wxBuffer, (const wxChar *)fileDialog.GetPath()); filename = fileDialog.GetPath();
return wxBuffer;
} }
else
return wxGetEmptyString(); return filename;
} }
@@ -172,17 +172,23 @@ wxString wxFileSelectorEx(const wxChar *title,
int y) int y)
{ {
wxFileDialog fileDialog(parent, title ? title : wxT(""), defaultDir ? defaultDir : wxT(""), wxFileDialog fileDialog(parent,
defaultFileName ? defaultFileName : wxT(""), filter ? filter : wxT(""), flags, wxPoint(x, y)); title ? title : wxT(""),
defaultDir ? defaultDir : wxT(""),
defaultFileName ? defaultFileName : wxT(""),
filter ? filter : wxT(""),
flags, wxPoint(x, y));
wxString filename;
if ( fileDialog.ShowModal() == wxID_OK ) if ( fileDialog.ShowModal() == wxID_OK )
{ {
*defaultFilterIndex = fileDialog.GetFilterIndex(); if ( defaultFilterIndex )
wxStrcpy(wxBuffer, (const wxChar *)fileDialog.GetPath()); *defaultFilterIndex = fileDialog.GetFilterIndex();
return wxBuffer;
filename = fileDialog.GetPath();
} }
else
return wxGetEmptyString(); return filename;
} }
wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message, wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,

View File

@@ -64,7 +64,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxImageList, wxObject)
// returns the mask if it's valid, otherwise the bitmap mask and, if it's not // returns the mask if it's valid, otherwise the bitmap mask and, if it's not
// valid neither, a "solid" mask (no transparent zones at all) // valid neither, a "solid" mask (no transparent zones at all)
static wxBitmap GetMaskForImage(const wxBitmap& bitmap, const wxBitmap& mask); static HBITMAP GetMaskForImage(const wxBitmap& bitmap, const wxBitmap& mask);
// ============================================================================ // ============================================================================
// implementation // implementation
@@ -144,8 +144,7 @@ bool wxImageList::GetSize(int WXUNUSED(index), int &width, int &height) const
// 'bitmap' and 'mask'. // 'bitmap' and 'mask'.
int wxImageList::Add(const wxBitmap& bitmap, const wxBitmap& mask) int wxImageList::Add(const wxBitmap& bitmap, const wxBitmap& mask)
{ {
wxBitmap bmpMask = GetMaskForImage(bitmap, mask); HBITMAP hbmpMask = GetMaskForImage(bitmap, mask);
HBITMAP hbmpMask = wxInvertMask(GetHbitmapOf(bmpMask));
int index = ImageList_Add(GetHImageList(), GetHbitmapOf(bitmap), hbmpMask); int index = ImageList_Add(GetHImageList(), GetHbitmapOf(bitmap), hbmpMask);
if ( index == -1 ) if ( index == -1 )
@@ -201,8 +200,7 @@ bool wxImageList::Replace(int index,
wxFAIL_MSG(_T("ImageList_Replace not implemented in TWIN32")); wxFAIL_MSG(_T("ImageList_Replace not implemented in TWIN32"));
return FALSE; return FALSE;
#else #else
wxBitmap bmpMask = GetMaskForImage(bitmap, mask); HBITMAP hbmpMask = GetMaskForImage(bitmap, mask);
HBITMAP hbmpMask = wxInvertMask(GetHbitmapOf(bmpMask));
bool ok = ImageList_Replace(GetHImageList(), index, bool ok = ImageList_Replace(GetHImageList(), index,
GetHbitmapOf(bitmap), hbmpMask) != 0; GetHbitmapOf(bitmap), hbmpMask) != 0;
@@ -314,36 +312,42 @@ bool wxImageList::Draw(int index,
// helpers // helpers
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
static wxBitmap GetMaskForImage(const wxBitmap& bitmap, const wxBitmap& mask) static HBITMAP GetMaskForImage(const wxBitmap& bitmap, const wxBitmap& mask)
{ {
wxBitmap bmpMask; HBITMAP hbmpMask;
wxBitmap *bmpMask = NULL;
if ( mask.Ok() ) if ( mask.Ok() )
{ {
bmpMask = mask; hbmpMask = GetHbitmapOf(mask);
} }
else else
{ {
wxMask *pMask = bitmap.GetMask(); wxMask *pMask = bitmap.GetMask();
if ( pMask ) if ( pMask )
{ {
bmpMask.SetHBITMAP(pMask->GetMaskBitmap()); hbmpMask = (HBITMAP)pMask->GetMaskBitmap();
}
else
{
// create a non transparent mask - apparently, this is needed under
// Win9x (it doesn't behave correctly if it's passed 0 mask)
bmpMask = new wxBitmap(bitmap.GetWidth(), bitmap.GetHeight(), 1);
wxMemoryDC dcMem;
dcMem.SelectObject(*bmpMask);
dcMem.Clear();
dcMem.SelectObject(wxNullBitmap);
hbmpMask = GetHbitmapOf(*bmpMask);
} }
} }
if ( !bmpMask.Ok() ) // windows mask convention is opposite to the wxWindows one
{ HBITMAP hbmpMaskInv = wxInvertMask(hbmpMask);
// create a non transparent mask - apparently, this is needed under delete bmpMask;
// Win9x (it doesn't behave correctly if it's passed 0 mask)
bmpMask.Create(bitmap.GetWidth(), bitmap.GetHeight(), 1);
wxMemoryDC dcMem; return hbmpMaskInv;
dcMem.SelectObject(bmpMask);
dcMem.Clear();
dcMem.SelectObject(wxNullBitmap);
}
return bmpMask;
} }
#endif // Win95 #endif // Win95

View File

@@ -925,15 +925,17 @@ bool wxMDIChildFrame::HandleCommand(WXWORD id, WXWORD cmd, WXHWND hwnd)
return TRUE; return TRUE;
} }
bool processed;
if (GetMenuBar() && GetMenuBar()->FindItem(id)) if (GetMenuBar() && GetMenuBar()->FindItem(id))
{ {
ProcessCommand(id); processed = ProcessCommand(id);
return TRUE;
} }
else else
return FALSE; {
processed = FALSE;
}
return TRUE; return processed;
} }
bool wxMDIChildFrame::HandleMDIActivate(long WXUNUSED(activate), bool wxMDIChildFrame::HandleMDIActivate(long WXUNUSED(activate),

View File

@@ -558,11 +558,9 @@ void wxMenuBar::Refresh()
WXHMENU wxMenuBar::Create() WXHMENU wxMenuBar::Create()
{ {
if (m_hMenu != 0 ) if ( m_hMenu != 0 )
return m_hMenu; return m_hMenu;
wxCHECK_MSG( !m_hMenu, TRUE, wxT("menubar already created") );
m_hMenu = (WXHMENU)::CreateMenu(); m_hMenu = (WXHMENU)::CreateMenu();
if ( !m_hMenu ) if ( !m_hMenu )

View File

@@ -282,11 +282,9 @@ wxWindow* wxWindow::CreateWindowFromHWND(wxWindow* parent, WXHWND hWnd)
win->SubclassWin(hWnd); win->SubclassWin(hWnd);
win->AdoptAttributesFromHWND(); win->AdoptAttributesFromHWND();
win->SetupColours(); win->SetupColours();
return win;
} }
else
return NULL; return win;
} }
// Make sure the window style (etc.) reflects the HWND style (roughly) // Make sure the window style (etc.) reflects the HWND style (roughly)

View File

@@ -435,13 +435,9 @@ WXIDISPATCH* wxAutomationObject::GetDispatchProperty(const wxString& property, i
{ {
return (WXIDISPATCH*) retVariant.GetVoidPtr(); return (WXIDISPATCH*) retVariant.GetVoidPtr();
} }
else
{
return (WXIDISPATCH*) NULL;
}
} }
else
return (WXIDISPATCH*) NULL; return (WXIDISPATCH*) NULL;
} }
// A way of initialising another wxAutomationObject with a dispatch object // A way of initialising another wxAutomationObject with a dispatch object

View File

@@ -171,6 +171,5 @@ int wxSystemSettings::GetSystemMetric(int index)
default: default:
return 0; return 0;
} }
return 0;
} }

View File

@@ -2760,11 +2760,9 @@ bool wxWindow::HandleSetCursor(WXHWND hWnd,
// cursor set, stop here // cursor set, stop here
return TRUE; return TRUE;
} }
else
{ // pass up the window chain
// pass up the window chain return FALSE;
return FALSE;
}
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------

View File

@@ -67,7 +67,8 @@ static void XpmToBitmap(wxBitmap *bitmap,
if (xmask) if (xmask)
{ {
wxMask *mask = new wxMask(); wxMask *mask = new wxMask();
mask->SetMaskBitmap((WXHBITMAP) wxInvertMask(xmask->bitmap)); mask->SetMaskBitmap((WXHBITMAP) wxInvertMask(xmask->bitmap,
bm.bmWidth, bm.bmHeight));
bitmap->SetMask(mask); bitmap->SetMask(mask);
} }
} }

View File

@@ -155,8 +155,9 @@ OpenReadFile(filename, mdata)
#endif #endif
{ {
#ifndef NO_ZPIPE #ifndef NO_ZPIPE
char *compressfile, buf[BUFSIZ]; char buf[BUFSIZ];
# ifdef STAT_ZFILE # ifdef STAT_ZFILE
char *compressfile;
struct stat status; struct stat status;
# endif # endif
#endif #endif