]> git.saurik.com Git - wxWidgets.git/commitdiff
fix more Borland release build warnings about unused variable/code without effect
authorVadim Zeitlin <vadim@wxwidgets.org>
Mon, 20 Oct 2008 10:30:49 +0000 (10:30 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Mon, 20 Oct 2008 10:30:49 +0000 (10:30 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56463 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

14 files changed:
include/wx/private/wxprintf.h
src/common/dlgcmn.cpp
src/common/event.cpp
src/common/fontcmn.cpp
src/generic/datavgen.cpp
src/generic/grid.cpp
src/generic/logg.cpp
src/generic/treectlg.cpp
src/html/htmlpars.cpp
src/html/htmprint.cpp
src/msw/mediactrl_qt.cpp
src/msw/ole/activex.cpp
src/msw/toplevel.cpp
src/msw/window.cpp

index e83002f4a70648bf032489cf5ac7766bb8973966..4b7b89045468965e630cc0615f47eb850488c80e 100644 (file)
@@ -254,7 +254,11 @@ bool wxPrintfConvSpec<CharType>::Parse(const CharType *format)
                 break;
 
             case wxT('.'):
-                CHECK_PREC
+                // don't use CHECK_PREC here to avoid warning about the value
+                // assigned to prec_dot inside it being never used (because
+                // overwritten just below) from Borland in release build
+                if (in_prec && !prec_dot)
+                    m_szFlags[flagofs++] = '.';
                 in_prec = true;
                 prec_dot = false;
                 m_nMaxWidth = 0;
index e386099c3aa9e5354fd9cb4aa3d5085196563758..d99c8c0880bf6cc177c8694b185e0334bdd3df57 100644 (file)
@@ -174,8 +174,6 @@ wxSizer *wxDialogBase::CreateTextSizer(const wxString& message)
 
 wxSizer *wxDialogBase::CreateButtonSizer(long flags)
 {
-    wxSizer *sizer = NULL;
-
 #ifdef __SMARTPHONE__
     wxDialog* dialog = (wxDialog*) this;
     if ( flags & wxOK )
@@ -189,6 +187,8 @@ wxSizer *wxDialogBase::CreateButtonSizer(long flags)
 
     if ( flags & wxNO )
         dialog->SetRightMenu(wxID_NO);
+
+    return NULL;
 #else // !__SMARTPHONE__
 
 #if wxUSE_BUTTON
@@ -202,15 +202,19 @@ wxSizer *wxDialogBase::CreateButtonSizer(long flags)
             wxSystemOptions::GetOptionInt(wxT("wince.dialog.real-ok-cancel")) )
 #endif // __POCKETPC__
     {
-        sizer = CreateStdDialogButtonSizer(flags);
+        return CreateStdDialogButtonSizer(flags);
     }
+#ifdef __POCKETPC__
+    return NULL;
+#endif // __POCKETPC__
+
 #else // !wxUSE_BUTTON
     wxUnusedVar(flags);
+
+    return NULL;
 #endif // wxUSE_BUTTON/!wxUSE_BUTTON
 
 #endif // __SMARTPHONE__/!__SMARTPHONE__
-
-    return sizer;
 }
 
 wxSizer *wxDialogBase::CreateSeparatedButtonSizer(long flags)
index 3299349d15892e3bab7c207724b0e2330c43e973..fbb9cc8f158d3d44ced335d5e861464b627a373f 100644 (file)
@@ -1398,7 +1398,7 @@ void wxEvtHandler::Connect( int id, int lastId,
         if ( evtConnRef )
             evtConnRef->IncRef( );
         else
-            evtConnRef = new wxEventConnectionRef(this, eventSink);
+            new wxEventConnectionRef(this, eventSink);
     }
 }
 
index 5ac8cce15e6eb60094e002b139301d9b847b2525..b2b7e2c1080de23e8de56e11c3900c404f06a12e 100644 (file)
@@ -55,7 +55,6 @@
 
 static void AdjustFontSize(wxFont& font, wxDC& dc, const wxSize& pixelSize)
 {
-    int currentSize = 0;
     int largestGood = 0;
     int smallestBad = 0;
 
@@ -64,7 +63,7 @@ static void AdjustFontSize(wxFont& font, wxDC& dc, const wxSize& pixelSize)
 
     // NB: this assignment was separated from the variable definition
     // in order to fix a gcc v3.3.3 compiler crash
-    currentSize = font.GetPointSize();
+    int currentSize = font.GetPointSize();
     while (currentSize > 0)
     {
         dc.SetFont(font);
index fb301b760d94ff42d28da0c4ca99ebd8ede6e7dc..008eee74744d86b2d3f05971629d9ea41d01e58a 100644 (file)
@@ -2093,7 +2093,7 @@ void wxDataViewMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
     // compute which columns needs to be redrawn
     unsigned int cols = GetOwner()->GetColumnCount();
     unsigned int col_start = 0;
-    unsigned int x_start = 0;
+    unsigned int x_start;
     for (x_start = 0; col_start < cols; col_start++)
     {
         wxDataViewColumn *col = GetOwner()->GetColumn(col_start);
@@ -2651,7 +2651,7 @@ void wxDataViewMainWindow::ScrollTo( int rows, int column )
     {
         wxRect rect = GetClientRect();
         int colnum = 0;
-        int x_start = 0, x_end = 0, w = 0;
+        int x_start = 0, w = 0;
         int xx, yy, xe;
         m_owner->CalcUnscrolledPosition( rect.x, rect.y, &xx, &yy );
         for (x_start = 0; colnum < column; colnum++)
@@ -2664,7 +2664,7 @@ void wxDataViewMainWindow::ScrollTo( int rows, int column )
             x_start += w;
         }
 
-        x_end = x_start + w;
+        int x_end = x_start + w;
         xe = xx + rect.width;
         if( x_end > xe )
         {
@@ -3318,7 +3318,7 @@ void wxDataViewMainWindow::OnCollapsing(unsigned int row)
 {
     if (IsVirtualList())
        return;
-       
+
     wxDataViewTreeNode * node = GetTreeNodeByRow(row);
     if( node != NULL )
     {
@@ -3414,10 +3414,9 @@ void wxDataViewMainWindow::HitTest( const wxPoint & point, wxDataViewItem & item
     wxDataViewColumn *col = NULL;
     unsigned int cols = GetOwner()->GetColumnCount();
     unsigned int colnum = 0;
-    unsigned int x_start = 0;
     int x, y;
     m_owner->CalcUnscrolledPosition( point.x, point.y, &x, &y );
-    for (x_start = 0; colnum < cols; colnum++)
+    for (unsigned x_start = 0; colnum < cols; colnum++)
     {
         col = GetOwner()->GetColumn(colnum);
         if (col->IsHidden())
@@ -3536,7 +3535,7 @@ int wxDataViewMainWindow::GetRowByItem(const wxDataViewItem & item) const
 
         //Compose the a parent-chain of the finding item
         ItemList list;
-        wxDataViewItem * pItem = NULL;
+        wxDataViewItem * pItem;
         list.DeleteContents( true );
         wxDataViewItem it( item );
         while( it.IsOk() )
@@ -4093,7 +4092,7 @@ void wxDataViewCtrl::Init()
 {
     m_cols.DeleteContents(true);
     m_notifier = NULL;
-    
+
     // No sorting column at start
     m_sortingColumn = NULL;
     m_headerArea = NULL;
@@ -4160,7 +4159,7 @@ wxSize wxDataViewCtrl::GetSizeAvailableForScrollTarget(const wxSize& size)
     wxSize newsize = size;
     if (!HasFlag(wxDV_NO_HEADER) && (m_headerArea))
        newsize.y -= m_headerArea->GetSize().y;
-    
+
     return newsize;
 }
 
index f92efb38ba23cf0984c13565ed528b92429ea5f8..69a99ab9babc185de593e26958eb96d8795480fe 100644 (file)
@@ -965,32 +965,19 @@ bool wxGridCellEditor::IsAcceptedKey(wxKeyEvent& event)
     if ((ctrl || alt) && !(ctrl && alt))
         return false;
 
-    int key = 0;
-    bool keyOk = true;
-
-#ifdef __WXGTK20__
-    // If it's a F-Key or other special key then it shouldn't start the
-    // editor.
-    if (event.GetKeyCode() >= WXK_START)
-        return false;
-#endif
 #if wxUSE_UNICODE
     // if the unicode key code is not really a unicode character (it may
     // be a function key or etc., the platforms appear to always give us a
     // small value in this case) then fallback to the ASCII key code but
     // don't do anything for function keys or etc.
-    key = event.GetUnicodeKey();
-    if (key <= 127)
-    {
-        key = event.GetKeyCode();
-        keyOk = (key <= 127);
-    }
+    if ( event.GetUnicodeKey() > 127 && event.GetKeyCode() > 127 )
+        return false;
 #else
-    key = event.GetKeyCode();
-    keyOk = (key <= 255);
+    if ( event.GetKeyCode() > 255 )
+        return false;
 #endif
 
-    return keyOk;
+    return true;
 }
 
 void wxGridCellEditor::StartingKey(wxKeyEvent& event)
@@ -4903,10 +4890,9 @@ void wxGrid::InitColWidths()
 
     m_colWidths.Add( m_defaultColWidth, m_numCols );
 
-    int colRight = 0;
     for ( int i = 0; i < m_numCols; i++ )
     {
-        colRight = ( GetColPos( i ) + 1 ) * m_defaultColWidth;
+        int colRight = ( GetColPos( i ) + 1 ) * m_defaultColWidth;
         m_colRights.Add( colRight );
     }
 }
index 80aab72d473abe71b372c27b542c38a55524dbdb..ed2a915892e807f122b952d3242283c82246458c 100644 (file)
@@ -1170,7 +1170,7 @@ static int OpenLogFile(wxFile& file, wxString *pFilename, wxWindow *parent)
 
     // open file
     // ---------
-    bool bOk = false;
+    bool bOk;
     if ( wxFile::Exists(filename) ) {
         bool bAppend = false;
         wxString strMsg;
index 0e14dc28301b8dbf1d2c420011c28cc2fb00643a..391a1d635de71c8f5f7fd38b88defe01d669dcb4 100644 (file)
@@ -877,10 +877,6 @@ wxGenericTreeItem::DoCalculateSize(wxGenericTreeCtrl* control,
             else
                 state_w += MARGIN_BETWEEN_IMAGE_AND_TEXT;
         }
-        else
-        {
-            state = wxTREE_ITEMSTATE_NONE;
-        }
     }
 
     m_height = (image_h > text_h) ? image_h : text_h;
index 1274b14f6be405028368de7abf871908bbaa8fbc..ba8154d00dad9e6ef9524808538304e30149abc8 100644 (file)
@@ -846,9 +846,10 @@ wxChar wxHtmlEntitiesParser::GetEntityChar(const wxString& entity) const
             while (substitutions[substitutions_cnt].code != 0)
                 substitutions_cnt++;
 
-        wxHtmlEntityInfo *info = NULL;
+        wxHtmlEntityInfo *info;
 #ifdef __WXWINCE__
         // bsearch crashes under WinCE for some reason
+        info = NULL;
         size_t i;
         for (i = 0; i < substitutions_cnt; i++)
         {
index 79544586f52510fc321aad711908da2825349fac..80277e0336a00b95be043087e04af43aca9a524c 100644 (file)
@@ -200,8 +200,10 @@ void wxHtmlPrintout::OnPreparePrinting()
 
     int ppiPrinterX, ppiPrinterY;
     GetPPIPrinter(&ppiPrinterX, &ppiPrinterY);
+    wxUnusedVar(ppiPrinterX);
     int ppiScreenX, ppiScreenY;
     GetPPIScreen(&ppiScreenX, &ppiScreenY);
+    wxUnusedVar(ppiScreenX);
 
     wxDisplaySize(&scr_w, &scr_h);
     GetDC()->GetSize(&dc_w, &dc_h);
index a840d3c0ad95733167c7af4e011507b137fe6978..633d4c6631d38836efb3142f636ead3199e3028d 100644 (file)
@@ -695,15 +695,13 @@ bool wxQTMediaBackend::Load(const wxString& fileName)
     if (m_movie)
         Cleanup();
 
-    bool result = true;
-    OSErr err = noErr;
     short movieResFile = 0; //= 0 because of annoying VC6 warning
     FSSpec sfFile;
 
-    err = m_lib.NativePathNameToFSSpec(
+    OSErr err = m_lib.NativePathNameToFSSpec(
         (char*) (const char*) fileName.mb_str(),
         &sfFile, 0);
-    result = (err == noErr);
+    bool result = (err == noErr);
 
     if (result)
     {
index e8e7647a4850c8cc6ccfc25a1ff095d4455a9dac..3ae004370caf16357c860b7d5870cdcff649eacd 100644 (file)
@@ -935,15 +935,21 @@ void wxActiveXContainer::CreateActiveX(REFIID iid, IUnknown* pUnk)
 
                 HRESULT hret =
                     cpContainer->FindConnectionPoint(ta->guid, cp.GetRef());
-                wxASSERT ( SUCCEEDED(hret));
+                if ( !SUCCEEDED(hret) )
+                {
+                    wxFAIL_MSG( wxString::Format("FindConnectionPoint(): %X",
+                                                 (unsigned)hret) );
+                }
 
                 IDispatch* disp;
                 frame->QueryInterface(IID_IDispatch, (void**)&disp);
                 hret = cp->Advise(new wxActiveXEvents(this, ta->guid),
                                   &adviseCookie);
-                wxASSERT_MSG( SUCCEEDED(hret),
-                    wxString::Format(wxT("Cannot connect!\nHRESULT:%X"), (unsigned int)hret)
-                            );
+                if ( !SUCCEEDED(hret) )
+                {
+                    wxFAIL_MSG( wxString::Format("Advise(): %X",
+                                                 (unsigned)hret) );
+                }
             }
         }
 
index 93e36350dfbadfd5178d07e7e9bef22445bcf85c..ec54792ae3c4805dfb531f82a71e42a3e025da9e 100644 (file)
@@ -993,11 +993,11 @@ void wxTopLevelWindowMSW::SetIcons(const wxIconBundle& icons)
 {
     wxTopLevelWindowBase::SetIcons(icons);
 
-    bool ok = DoSelectAndSetIcon(icons, SM_CXSMICON, SM_CYSMICON, ICON_SMALL);
-    if ( DoSelectAndSetIcon(icons, SM_CXICON, SM_CYICON, ICON_BIG) )
-        ok = true;
-
-    wxASSERT_MSG( ok, "icon bundle doesn't contain any suitable icon" );
+    if ( !DoSelectAndSetIcon(icons, SM_CXSMICON, SM_CYSMICON, ICON_SMALL) &&
+            !DoSelectAndSetIcon(icons, SM_CXICON, SM_CYICON, ICON_BIG) )
+    {
+        wxFAIL_MSG( "icon bundle doesn't contain any suitable icon" );
+    }
 }
 
 bool wxTopLevelWindowMSW::EnableCloseButton(bool enable)
index f2b47d0fa4e255be7f579caef7ef8685caab9826..ea9a66c3c0db2be3e382d3cd8b6274140c277008 100644 (file)
@@ -3423,12 +3423,12 @@ WXLRESULT wxWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM l
                     rc.result = MSWDefWindowProc(message, wParam, lParam);
                     processed = true;
 
-                    // now alter the client size making room for drawing a themed border
-                    NCCALCSIZE_PARAMS *csparam = NULL;
+                    // now alter the client size making room for drawing a
+                    // themed border
                     RECT *rect;
                     if ( wParam )
                     {
-                        csparam = (NCCALCSIZE_PARAMS *)lParam;
+                        NCCALCSIZE_PARAMS *csparam = (NCCALCSIZE_PARAMS *)lParam;
                         rect = &csparam->rgrc[0];
                     }
                     else