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 MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# 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
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
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 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"
@@ -113,7 +113,7 @@ LINK32=link.exe
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# 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
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
@@ -152,6 +152,7 @@ SOURCE=.\src\common\y_tab.c
!IF "$(CFG)" == "wxWinDll - Win32 Release"
# ADD CPP /W1
# SUBTRACT CPP /YX /Yc /Yu
!ELSEIF "$(CFG)" == "wxWinDll - Win32 Debug"

View File

@@ -100,8 +100,9 @@
# pragma warning(disable:4100) // unreferenced formal parameter
# pragma warning(disable:4511) // copy ctor 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:4710) // function not inlined
#ifndef WIN32
# pragma warning(disable:4135) // conversion between different integral types
# 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;
}
else
return (wxDocument *) NULL;
return (wxDocument *) NULL;
}
wxView *wxDocManager::CreateView(wxDocument *doc, long flags)
@@ -1376,6 +1376,7 @@ wxDocTemplate *wxDocManager::SelectDocumentPath(wxDocTemplate **templates,
0,
parent);
wxDocTemplate *theTemplate = (wxDocTemplate *)NULL;
if (!pathTmp.IsEmpty())
{
if (!wxFileExists(pathTmp))
@@ -1398,19 +1399,18 @@ wxDocTemplate *wxDocManager::SelectDocumentPath(wxDocTemplate **templates,
// first choose the template using the extension, if this fails (i.e.
// wxFileSelectorEx() didn't fill it), then use the path
wxDocTemplate *theTemplate = (wxDocTemplate *)NULL;
if ( FilterIndex != -1 )
theTemplate = templates[FilterIndex];
if ( !theTemplate )
theTemplate = FindTemplateForPath(path);
return theTemplate;
}
else
{
path = wxT("");
return (wxDocTemplate *) NULL;
}
return theTemplate;
#if 0
// In all other windowing systems, until we have more advanced
// 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;
return wxTestFontEncoding(info);
}
else
return FALSE;
return FALSE;
}
#endif // wxUSE_GUI

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -151,13 +151,13 @@ wxString wxFileSelector(const wxChar *title,
fileDialog.SetFilterIndex(filterFind);
}
wxString filename;
if ( fileDialog.ShowModal() == wxID_OK )
{
wxStrcpy(wxBuffer, (const wxChar *)fileDialog.GetPath());
return wxBuffer;
filename = fileDialog.GetPath();
}
else
return wxGetEmptyString();
return filename;
}
@@ -172,17 +172,23 @@ wxString wxFileSelectorEx(const wxChar *title,
int y)
{
wxFileDialog fileDialog(parent, title ? title : wxT(""), defaultDir ? defaultDir : wxT(""),
defaultFileName ? defaultFileName : wxT(""), filter ? filter : wxT(""), flags, wxPoint(x, y));
wxFileDialog fileDialog(parent,
title ? title : wxT(""),
defaultDir ? defaultDir : wxT(""),
defaultFileName ? defaultFileName : wxT(""),
filter ? filter : wxT(""),
flags, wxPoint(x, y));
wxString filename;
if ( fileDialog.ShowModal() == wxID_OK )
{
*defaultFilterIndex = fileDialog.GetFilterIndex();
wxStrcpy(wxBuffer, (const wxChar *)fileDialog.GetPath());
return wxBuffer;
if ( defaultFilterIndex )
*defaultFilterIndex = fileDialog.GetFilterIndex();
filename = fileDialog.GetPath();
}
else
return wxGetEmptyString();
return filename;
}
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
// 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
@@ -144,8 +144,7 @@ bool wxImageList::GetSize(int WXUNUSED(index), int &width, int &height) const
// 'bitmap' and 'mask'.
int wxImageList::Add(const wxBitmap& bitmap, const wxBitmap& mask)
{
wxBitmap bmpMask = GetMaskForImage(bitmap, mask);
HBITMAP hbmpMask = wxInvertMask(GetHbitmapOf(bmpMask));
HBITMAP hbmpMask = GetMaskForImage(bitmap, mask);
int index = ImageList_Add(GetHImageList(), GetHbitmapOf(bitmap), hbmpMask);
if ( index == -1 )
@@ -201,8 +200,7 @@ bool wxImageList::Replace(int index,
wxFAIL_MSG(_T("ImageList_Replace not implemented in TWIN32"));
return FALSE;
#else
wxBitmap bmpMask = GetMaskForImage(bitmap, mask);
HBITMAP hbmpMask = wxInvertMask(GetHbitmapOf(bmpMask));
HBITMAP hbmpMask = GetMaskForImage(bitmap, mask);
bool ok = ImageList_Replace(GetHImageList(), index,
GetHbitmapOf(bitmap), hbmpMask) != 0;
@@ -314,36 +312,42 @@ bool wxImageList::Draw(int index,
// 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() )
{
bmpMask = mask;
hbmpMask = GetHbitmapOf(mask);
}
else
{
wxMask *pMask = bitmap.GetMask();
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() )
{
// create a non transparent mask - apparently, this is needed under
// Win9x (it doesn't behave correctly if it's passed 0 mask)
bmpMask.Create(bitmap.GetWidth(), bitmap.GetHeight(), 1);
// windows mask convention is opposite to the wxWindows one
HBITMAP hbmpMaskInv = wxInvertMask(hbmpMask);
delete bmpMask;
wxMemoryDC dcMem;
dcMem.SelectObject(bmpMask);
dcMem.Clear();
dcMem.SelectObject(wxNullBitmap);
}
return bmpMask;
return hbmpMaskInv;
}
#endif // Win95

View File

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

View File

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

View File

@@ -282,11 +282,9 @@ wxWindow* wxWindow::CreateWindowFromHWND(wxWindow* parent, WXHWND hWnd)
win->SubclassWin(hWnd);
win->AdoptAttributesFromHWND();
win->SetupColours();
return win;
}
else
return NULL;
return win;
}
// 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();
}
else
{
return (WXIDISPATCH*) NULL;
}
}
else
return (WXIDISPATCH*) NULL;
return (WXIDISPATCH*) NULL;
}
// A way of initialising another wxAutomationObject with a dispatch object

View File

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

View File

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

View File

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

View File

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