]> git.saurik.com Git - wxWidgets.git/commitdiff
Warning fixes for VC5 (Igor Korot)
authorMichael Wetherell <mike.wetherell@ntlworld.com>
Sun, 12 Feb 2006 12:16:56 +0000 (12:16 +0000)
committerMichael Wetherell <mike.wetherell@ntlworld.com>
Sun, 12 Feb 2006 12:16:56 +0000 (12:16 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37526 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

25 files changed:
include/wx/defs.h
include/wx/generic/grid.h
src/common/event.cpp
src/common/init.cpp
src/common/object.cpp
src/common/socket.cpp
src/common/wincmn.cpp
src/generic/dragimgg.cpp
src/generic/fontdlgg.cpp
src/generic/grid.cpp
src/generic/listctrl.cpp
src/generic/progdlgg.cpp
src/generic/sashwin.cpp
src/generic/scrlwing.cpp
src/generic/statusbr.cpp
src/generic/treectlg.cpp
src/msw/dcclient.cpp
src/msw/dialup.cpp
src/msw/dragimag.cpp
src/msw/ownerdrw.cpp
src/msw/tbar95.cpp
src/msw/thread.cpp
src/msw/window.cpp
src/richtext/richtextctrl.cpp
src/univ/radiobox.cpp

index a15d8de78cd89adfd26350da197ba5345d5145ca..ade8f25bc9e1499719e01d004bfc53c3cfe5b07f 100644 (file)
 #   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
 }
index 80156c82392f1c2f6b964e1f7f53571dd5c62984..9b88b90485ca21d2bf5bdc9c0939c3fa4c8cec5a 100644 (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; }
index e4401d231ffb4cb1b74d3745f2d95d4a940b25c1..6da2424443fd3dc654650f555e38a7888c45e379 100644 (file)
@@ -1139,7 +1139,7 @@ void wxEvtHandler::ProcessPendingEvents()
 
         wxENTER_CRIT_SECT( Lock() );
 
-        if ( !--n )
+        if ( --n == 0 )
             break;
     }
 
index 9b87e1815244d7fbf73bbd262ffa881a144a862a..258539e3ff02aafbdd4e739354862ea1820cee43 100644 (file)
@@ -477,7 +477,7 @@ void wxUninitialize()
 {
     wxCRIT_SECT_LOCKER(lockInit, gs_initData.csInit);
 
-    if ( !--gs_initData.nInitCount )
+    if ( --gs_initData.nInitCount == 0 )
     {
         wxEntryCleanup();
     }
index 78f63ab0a8e4a0d868835faa003b69657663d5e5..87e3dc1ed78bc0977852256aa609a791338cc180 100644 (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;
     }
index a5b9eff86a8b12630f04bb16152cc682047bebdc..4525cfa2d7acf51f3c292aab5d5dd95960abc214 100644 (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();
     }
index a884b67788a7a0835ceddcf1ed7cfd8b710a147d..19ee280fe2c129fce33df5e1560fd073594b17b0 100644 (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 );
     }
index 06912f3064d9a0265ac24c56cc362d3c342b1fbc..fd104aad66361fae2fb81d6e402991f039f06cb4 100644 (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);
index 9476f3e2049c584c345bcb6b6b2d922aaa89cf53..61e9a9a30e06415d3d163b426c86b6b5b7f15d43 100644 (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);
index f40295f5f33d196df1a65b833804347f5c55f028..e27d34ae3e3563751781a3f8a67689fa7e00e29a 100644 (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++ )
index a026f0f683f743c2f4392993890face861ce5319..c7821beb30b933f37bdd8fb66b54314e5adf0dcd 100644 (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();
 }
 
index e623577737e11d65b4a6b05d8939e24d7eb91e8e..c261d63be45df5eac446c180fa214d1935fdad83 100644 (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);
index 85b0648bf4b79eac2001d69bd95ffc289ec0f29c..b9e554da14270c6530724dd1dedcbcd6f8051b30 100644 (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);
index be7802df03f8de0975d7d76e8dae1264c08bab67..6eff74787a8d6dd64d611bea581e85357c1e1674 100644 (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);
index e294b18078a9be29c7f198b4dc3e40ccc8a202a1..5703a629808e386b14b8b0a23c8cbec725d1e93c 100644 (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);
 
index 2e2650bfed959324dc2f106afce9c13b13fe13dc..68e2b73bdb7c6bf65054a488b5bf253d84867e39 100644 (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();
     }
index ce86219b75d979d53e4654c218d1e6f9e657c70c..d318904387a3f5e4b66b1a1d463b44442ae76288 100644 (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);
index 0114b7759e8e41da798a1c1a00a7b119c5424667..074b23c6a52d25336bb5505b5a31890a0fe67443 100644 (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;
index 396962f92f1b808a5621cb59690b60e74f253d93..9249d8c35c19b873e0c5a8ad2a2a03a83d35072e 100644 (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);
index 5b3312796e58bcbac3c3e7f7dc65b2e046f26ce2..c7b56a1dbc4469ed2a179e483cb0300fc8653216 100644 (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"
index 9015f5cf7388f5d21bf78865baa59844b3f47af7..43a159862d3ec6056a17495b95586ea694cdda34 100644 (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);
index 602968aca608372e4cd2a834f85eef9807770a45..30484e2c86debec6b7df855ac32cc054ffcfc4dc 100644 (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;
index 5273cbc4d6b365330204e2aecec76600938340a9..703677417373e8d0b6fb3df639b0c597afae576e 100644 (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() )
         {
index 5bdad6e5846acb81042fc928b507d971309df340..80d59be6ff5bc7400d298e774edf9540d1ac8ed5 100644 (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)
index e4038b1a0d7d8511bb1be0e1da8a3b3cc3d08b4d..6a23d3d34b093ad32f48da1858d86e1acf24787d 100644 (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();