From: Vadim Zeitlin Date: Mon, 20 Oct 2008 10:30:49 +0000 (+0000) Subject: fix more Borland release build warnings about unused variable/code without effect X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/e822d1bd5fc4f3ac91fafd201d7519d091408dd2 fix more Borland release build warnings about unused variable/code without effect git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56463 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/private/wxprintf.h b/include/wx/private/wxprintf.h index e83002f4a7..4b7b890454 100644 --- a/include/wx/private/wxprintf.h +++ b/include/wx/private/wxprintf.h @@ -254,7 +254,11 @@ bool wxPrintfConvSpec::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; diff --git a/src/common/dlgcmn.cpp b/src/common/dlgcmn.cpp index e386099c3a..d99c8c0880 100644 --- a/src/common/dlgcmn.cpp +++ b/src/common/dlgcmn.cpp @@ -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) diff --git a/src/common/event.cpp b/src/common/event.cpp index 3299349d15..fbb9cc8f15 100644 --- a/src/common/event.cpp +++ b/src/common/event.cpp @@ -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); } } diff --git a/src/common/fontcmn.cpp b/src/common/fontcmn.cpp index 5ac8cce15e..b2b7e2c108 100644 --- a/src/common/fontcmn.cpp +++ b/src/common/fontcmn.cpp @@ -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); diff --git a/src/generic/datavgen.cpp b/src/generic/datavgen.cpp index fb301b760d..008eee7474 100644 --- a/src/generic/datavgen.cpp +++ b/src/generic/datavgen.cpp @@ -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; } diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index f92efb38ba..69a99ab9ba 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -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 ); } } diff --git a/src/generic/logg.cpp b/src/generic/logg.cpp index 80aab72d47..ed2a915892 100644 --- a/src/generic/logg.cpp +++ b/src/generic/logg.cpp @@ -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; diff --git a/src/generic/treectlg.cpp b/src/generic/treectlg.cpp index 0e14dc2830..391a1d635d 100644 --- a/src/generic/treectlg.cpp +++ b/src/generic/treectlg.cpp @@ -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; diff --git a/src/html/htmlpars.cpp b/src/html/htmlpars.cpp index 1274b14f6b..ba8154d00d 100644 --- a/src/html/htmlpars.cpp +++ b/src/html/htmlpars.cpp @@ -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++) { diff --git a/src/html/htmprint.cpp b/src/html/htmprint.cpp index 79544586f5..80277e0336 100644 --- a/src/html/htmprint.cpp +++ b/src/html/htmprint.cpp @@ -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); diff --git a/src/msw/mediactrl_qt.cpp b/src/msw/mediactrl_qt.cpp index a840d3c0ad..633d4c6631 100644 --- a/src/msw/mediactrl_qt.cpp +++ b/src/msw/mediactrl_qt.cpp @@ -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) { diff --git a/src/msw/ole/activex.cpp b/src/msw/ole/activex.cpp index e8e7647a48..3ae004370c 100644 --- a/src/msw/ole/activex.cpp +++ b/src/msw/ole/activex.cpp @@ -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) ); + } } } diff --git a/src/msw/toplevel.cpp b/src/msw/toplevel.cpp index 93e36350df..ec54792ae3 100644 --- a/src/msw/toplevel.cpp +++ b/src/msw/toplevel.cpp @@ -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) diff --git a/src/msw/window.cpp b/src/msw/window.cpp index f2b47d0fa4..ea9a66c3c0 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -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