Warning fixes for VC5 (Igor Korot)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37526 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Michael Wetherell
2006-02-12 12:16:56 +00:00
parent 51d0522672
commit 8d7eaf9140
25 changed files with 61 additions and 53 deletions

View File

@@ -73,6 +73,12 @@
# pragma warning(disable:4512) /* operator=() couldn't be generated */
# pragma warning(disable:4710) /* function not inlined */
/* For VC++ 5.0 for release mode, the warning 'C4702: unreachable code */
/* is buggy, and occurs for code that does actually get executed */
# if !defined __WXDEBUG__ && __VISUALC__ <= 1100
# pragma warning(disable:4702) /* unreachable code */
# endif
/* Deprecated functions such as sprintf, localtime */
#if __VISUALC__ >= 1400
#define _CRT_SECURE_NO_DEPRECATE 1
@@ -895,40 +901,42 @@ inline wxUIntPtr wxPtrToUInt(const void *p)
explicit with /Wp64 option, suppress them as we really know what we're
doing here. Same thing with icc with -Wall.
*/
#if defined(__VISUALC__) || defined(__INTELC__)
#pragma warning(push)
#ifdef __VISUALC__
/* pointer truncation from '' to '' */
#pragma warning(disable: 4311)
#elif defined(__INTELC__)
/* conversion from pointer to same-sized integral type */
#pragma warning(disable: 1684)
#ifdef __VISUALC__
#if __VISUALC__ >= 1200
#pragma warning(push)
#endif
/* pointer truncation from '' to '' */
#pragma warning(disable: 4311)
#elif defined(__INTELC__)
#pragma warning(push)
/* conversion from pointer to same-sized integral type */
#pragma warning(disable: 1684)
#endif
return wx_reinterpret_cast(wxUIntPtr, p);
#if defined(__VISUALC__) || defined(__INTELC__)
#if (defined(__VISUALC__) && __VISUALC__ >= 1200) || defined(__INTELC__)
#pragma warning(pop)
#endif
}
inline void *wxUIntToPtr(wxUIntPtr p)
{
#if defined(__VISUALC__) || defined(__INTELC__)
#pragma warning(push)
#ifdef __VISUALC__
/* conversion to type of greater size */
#pragma warning(disable: 4312)
#elif defined(__INTELC__)
/* invalid type conversion: "wxUIntPtr={unsigned long}" to "void *" */
#pragma warning(disable: 171)
#ifdef __VISUALC__
#if __VISUALC__ >= 1200
#pragma warning(push)
#endif
/* conversion to type of greater size */
#pragma warning(disable: 4312)
#elif defined(__INTELC__)
#pragma warning(push)
/* invalid type conversion: "wxUIntPtr={unsigned long}" to "void *" */
#pragma warning(disable: 171)
#endif
return wx_reinterpret_cast(void *, p);
#if defined(__VISUALC__) || defined(__INTELC__)
#if (defined(__VISUALC__) && __VISUALC__ >= 1200) || defined(__INTELC__)
#pragma warning(pop)
#endif
}

View File

@@ -101,7 +101,7 @@ public:
// calling DecRef() once will delete it. Calling IncRef() allows to lock
// it until the matching DecRef() is called
void IncRef() { m_nRef++; }
void DecRef() { if ( !--m_nRef ) delete this; }
void DecRef() { if ( --m_nRef == 0 ) delete this; }
// interpret renderer parameters: arbitrary string whose interpretatin is
// left to the derived classes
@@ -656,7 +656,7 @@ public:
// calling DecRef() once will delete it. Calling IncRef() allows to lock
// it until the matching DecRef() is called
void IncRef() { m_nRef++; }
void DecRef() { if ( !--m_nRef ) delete this; }
void DecRef() { if ( --m_nRef == 0 ) delete this; }
// setters
void SetTextColour(const wxColour& colText) { m_colText = colText; }

View File

@@ -1139,7 +1139,7 @@ void wxEvtHandler::ProcessPendingEvents()
wxENTER_CRIT_SECT( Lock() );
if ( !--n )
if ( --n == 0 )
break;
}

View File

@@ -477,7 +477,7 @@ void wxUninitialize()
{
wxCRIT_SECT_LOCKER(lockInit, gs_initData.csInit);
if ( !--gs_initData.nInitCount )
if ( --gs_initData.nInitCount == 0 )
{
wxEntryCleanup();
}

View File

@@ -310,7 +310,7 @@ void wxObject::UnRef()
{
wxASSERT_MSG( m_refData->m_count > 0, _T("invalid ref data count") );
if ( !--m_refData->m_count )
if ( --m_refData->m_count == 0 )
delete m_refData;
m_refData = NULL;
}

View File

@@ -159,7 +159,7 @@ void wxSocketBase::Shutdown()
{
// we should be initialized
wxASSERT_MSG( m_countInit, _T("extra call to Shutdown()") );
if ( !--m_countInit )
if ( --m_countInit == 0 )
{
GSocket_Cleanup();
}

View File

@@ -1703,7 +1703,7 @@ bool wxWindowBase::Layout()
// If there is a sizer, use it instead of the constraints
if ( GetSizer() )
{
int w, h;
int w = 0, h = 0;
GetVirtualSize(&w, &h);
GetSizer()->SetDimension( 0, 0, w, h );
}

View File

@@ -123,7 +123,7 @@ bool wxGenericDragImage::Create(const wxString& str, const wxCursor& cursor)
{
wxFont font(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT));
long w, h;
long w = 0, h = 0;
wxScreenDC dc;
dc.SetFont(font);
dc.GetTextExtent(str, & w, & h);

View File

@@ -76,7 +76,7 @@ void wxFontPreviewer::OnPaint(wxPaintEvent& WXUNUSED(event))
{
dc.SetFont(font);
// Calculate vertical centre
long w, h;
long w = 0, h = 0;
dc.GetTextExtent( wxT("X"), &w, &h);
dc.SetTextForeground(GetForegroundColour());
dc.SetClippingRegion(2, 2, size.x-4, size.y-4);

View File

@@ -7484,8 +7484,8 @@ void wxGrid::DrawTextRectangle( wxDC& dc,
int vertAlign,
int textOrientation )
{
long textWidth, textHeight;
long lineWidth, lineHeight;
long textWidth = 0, textHeight = 0;
long lineWidth = 0, lineHeight = 0;
int nLines;
dc.SetClippingRegion( rect );
@@ -7614,7 +7614,7 @@ void wxGrid::GetTextBoxSize( const wxDC& dc,
{
long w = 0;
long h = 0;
long lineW, lineH;
long lineW = 0, lineH = 0;
size_t i;
for ( i = 0; i < lines.GetCount(); i++ )

View File

@@ -2564,7 +2564,7 @@ void wxListMainWindow::Thaw()
{
wxCHECK_RET( m_freezeCount > 0, _T("thawing unfrozen list control?") );
if ( !--m_freezeCount )
if ( --m_freezeCount == 0 )
Refresh();
}

View File

@@ -141,7 +141,7 @@ wxProgressDialog::wxProgressDialog(wxString const &title,
wxClientDC dc(this);
dc.SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT));
long widthText;
long widthText = 0;
dc.GetTextExtent(message, &widthText, NULL, NULL, NULL, NULL);
wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL);

View File

@@ -95,7 +95,7 @@ void wxSashWindow::OnPaint(wxPaintEvent& WXUNUSED(event))
void wxSashWindow::OnMouseEvent(wxMouseEvent& event)
{
wxCoord x, y;
wxCoord x = 0, y = 0;
event.GetPosition(&x, &y);
wxSashEdgePosition sashHit = SashHitTest(x, y);

View File

@@ -868,7 +868,7 @@ void wxScrollHelper::Scroll( int x_pos, int y_pos )
if (((x_pos == -1) || (x_pos == m_xScrollPosition)) &&
((y_pos == -1) || (y_pos == m_yScrollPosition))) return;
int w, h;
int w = 0, h = 0;
GetTargetSize(&w, &h);
if ((x_pos != -1) && (m_xScrollPixelsPerLine))
@@ -957,7 +957,7 @@ bool wxScrollHelper::ScrollLayout()
// If we're the scroll target, take into account the
// virtual size and scrolled position of the window.
int x, y, w, h;
int x = 0, y = 0, w = 0, h = 0;
CalcScrolledPosition(0,0, &x,&y);
m_win->GetVirtualSize(&w, &h);
m_win->GetSizer()->SetDimension(x, y, w, h);
@@ -1048,9 +1048,9 @@ void wxScrollHelper::HandleOnPaint(wxPaintEvent& WXUNUSED(event))
// this they always have the priority
void wxScrollHelper::HandleOnChar(wxKeyEvent& event)
{
int stx, sty, // view origin
szx, szy, // view size (total)
clix, cliy; // view size (on screen)
int stx = 0, sty = 0, // view origin
szx = 0, szy = 0, // view size (total)
clix = 0, cliy = 0; // view size (on screen)
GetViewStart(&stx, &sty);
GetTargetSize(&clix, &cliy);

View File

@@ -232,7 +232,7 @@ void wxStatusBarGeneric::DrawFieldText(wxDC& dc, int i)
wxString text(GetStatusText(i));
long x, y;
long x = 0, y = 0;
dc.GetTextExtent(text, &x, &y);

View File

@@ -3518,7 +3518,7 @@ void wxGenericTreeCtrl::Thaw()
{
wxCHECK_RET( m_freezeCount > 0, _T("thawing unfrozen tree control?") );
if ( !--m_freezeCount )
if ( --m_freezeCount == 0 )
{
Refresh();
}

View File

@@ -253,7 +253,7 @@ wxPaintDC::~wxPaintDC()
wxCHECK_RET( info, wxT("existing DC should have a cache entry") );
if ( !--info->count )
if ( --info->count == 0 )
{
::EndPaint(GetHwndOf(m_canvas), &g_paintStruct);
@@ -338,7 +338,7 @@ wxPaintDCEx::~wxPaintDCEx()
wxCHECK_RET( info, wxT("existing DC should have a cache entry") );
if ( !--info->count )
if ( --info->count == 0 )
{
RestoreDC((HDC) m_hDC, saveState);
ms_cache.RemoveAt(index);

View File

@@ -1188,7 +1188,7 @@ void wxDialUpManagerMSW::DisableAutoCheckOnlineStatus()
{
wxCHECK_RET( IsOk(), wxT("using uninitialized wxDialUpManager") );
if ( --m_autoCheckLevel )
if ( --m_autoCheckLevel != 0 )
{
// still checking
return;

View File

@@ -208,7 +208,7 @@ bool wxDragImage::Create(const wxString& str, const wxCursor& cursor)
{
wxFont font(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT));
long w, h;
long w = 0, h = 0;
wxScreenDC dc;
dc.SetFont(font);
dc.GetTextExtent(str, & w, & h);

View File

@@ -100,12 +100,12 @@ IMPLEMENT_DYNAMIC_CLASS(wxMSWSystemMenuFontModule, wxModule)
// a UDT. Will produce errors if applied using infix notation.
//
// shut it down
#ifdef __VISUALC__
#if __VISUALC__ <= 1300
#if defined __VISUALC__ && __VISUALC__ <= 1300
#if __VISUALC__ >= 1200
#pragma warning(push)
#pragma warning(disable: 4284)
#define POP_WARNINGS
#endif
#pragma warning(disable: 4284)
#endif
#include "wx/hashset.h"

View File

@@ -1324,7 +1324,7 @@ void wxToolBar::OnMouseEvent(wxMouseEvent& event)
if ( event.RightDown() )
{
// find the tool under the mouse
wxCoord x,y;
wxCoord x = 0, y = 0;
event.GetPosition(&x, &y);
wxToolBarToolBase *tool = FindToolForPosition(x, y);

View File

@@ -925,7 +925,7 @@ bool wxThread::SetConcurrency(size_t WXUNUSED_IN_WINCE(level))
dwProcMask |= bit;
// another process added
if ( !--level )
if ( --level == 0 )
{
// and that's enough
break;

View File

@@ -1359,7 +1359,7 @@ void wxWindowMSW::Thaw()
{
wxASSERT_MSG( m_frozenness > 0, _T("Thaw() without matching Freeze()") );
if ( !--m_frozenness )
if ( --m_frozenness == 0 )
{
if ( IsShown() )
{

View File

@@ -703,7 +703,7 @@ bool wxRichTextCtrl::ScrollIntoView(long position, int keyCode)
startX = 0;
startY = startY * ppuY;
int sx, sy;
int sx = 0, sy = 0;
GetVirtualSize(& sx, & sy);
sx = 0;
if (ppuY != 0)
@@ -796,7 +796,7 @@ bool wxRichTextCtrl::IsPositionVisible(long pos) const
startX = 0;
startY = startY * ppuY;
int sx, sy;
int sx = 0, sy = 0;
GetVirtualSize(& sx, & sy);
sx = 0;
if (ppuY != 0)

View File

@@ -392,7 +392,7 @@ void wxRadioBox::DoSetToolTip(wxToolTip *tooltip)
wxSize wxRadioBox::GetMaxButtonSize() const
{
int widthMax, heightMax, width, height;
int widthMax, heightMax, width = 0, height = 0;
widthMax = heightMax = 0;
int count = GetCount();