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
This commit is contained in:
Vadim Zeitlin
2008-10-20 10:30:49 +00:00
parent 107b52ed17
commit e822d1bd5f
14 changed files with 55 additions and 60 deletions

View File

@@ -254,7 +254,11 @@ bool wxPrintfConvSpec<CharType>::Parse(const CharType *format)
break; break;
case wxT('.'): 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; in_prec = true;
prec_dot = false; prec_dot = false;
m_nMaxWidth = 0; m_nMaxWidth = 0;

View File

@@ -174,8 +174,6 @@ wxSizer *wxDialogBase::CreateTextSizer(const wxString& message)
wxSizer *wxDialogBase::CreateButtonSizer(long flags) wxSizer *wxDialogBase::CreateButtonSizer(long flags)
{ {
wxSizer *sizer = NULL;
#ifdef __SMARTPHONE__ #ifdef __SMARTPHONE__
wxDialog* dialog = (wxDialog*) this; wxDialog* dialog = (wxDialog*) this;
if ( flags & wxOK ) if ( flags & wxOK )
@@ -189,6 +187,8 @@ wxSizer *wxDialogBase::CreateButtonSizer(long flags)
if ( flags & wxNO ) if ( flags & wxNO )
dialog->SetRightMenu(wxID_NO); dialog->SetRightMenu(wxID_NO);
return NULL;
#else // !__SMARTPHONE__ #else // !__SMARTPHONE__
#if wxUSE_BUTTON #if wxUSE_BUTTON
@@ -202,15 +202,19 @@ wxSizer *wxDialogBase::CreateButtonSizer(long flags)
wxSystemOptions::GetOptionInt(wxT("wince.dialog.real-ok-cancel")) ) wxSystemOptions::GetOptionInt(wxT("wince.dialog.real-ok-cancel")) )
#endif // __POCKETPC__ #endif // __POCKETPC__
{ {
sizer = CreateStdDialogButtonSizer(flags); return CreateStdDialogButtonSizer(flags);
} }
#ifdef __POCKETPC__
return NULL;
#endif // __POCKETPC__
#else // !wxUSE_BUTTON #else // !wxUSE_BUTTON
wxUnusedVar(flags); wxUnusedVar(flags);
return NULL;
#endif // wxUSE_BUTTON/!wxUSE_BUTTON #endif // wxUSE_BUTTON/!wxUSE_BUTTON
#endif // __SMARTPHONE__/!__SMARTPHONE__ #endif // __SMARTPHONE__/!__SMARTPHONE__
return sizer;
} }
wxSizer *wxDialogBase::CreateSeparatedButtonSizer(long flags) wxSizer *wxDialogBase::CreateSeparatedButtonSizer(long flags)

View File

@@ -1398,7 +1398,7 @@ void wxEvtHandler::Connect( int id, int lastId,
if ( evtConnRef ) if ( evtConnRef )
evtConnRef->IncRef( ); evtConnRef->IncRef( );
else else
evtConnRef = new wxEventConnectionRef(this, eventSink); new wxEventConnectionRef(this, eventSink);
} }
} }

View File

@@ -55,7 +55,6 @@
static void AdjustFontSize(wxFont& font, wxDC& dc, const wxSize& pixelSize) static void AdjustFontSize(wxFont& font, wxDC& dc, const wxSize& pixelSize)
{ {
int currentSize = 0;
int largestGood = 0; int largestGood = 0;
int smallestBad = 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 // NB: this assignment was separated from the variable definition
// in order to fix a gcc v3.3.3 compiler crash // in order to fix a gcc v3.3.3 compiler crash
currentSize = font.GetPointSize(); int currentSize = font.GetPointSize();
while (currentSize > 0) while (currentSize > 0)
{ {
dc.SetFont(font); dc.SetFont(font);

View File

@@ -2093,7 +2093,7 @@ void wxDataViewMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
// compute which columns needs to be redrawn // compute which columns needs to be redrawn
unsigned int cols = GetOwner()->GetColumnCount(); unsigned int cols = GetOwner()->GetColumnCount();
unsigned int col_start = 0; unsigned int col_start = 0;
unsigned int x_start = 0; unsigned int x_start;
for (x_start = 0; col_start < cols; col_start++) for (x_start = 0; col_start < cols; col_start++)
{ {
wxDataViewColumn *col = GetOwner()->GetColumn(col_start); wxDataViewColumn *col = GetOwner()->GetColumn(col_start);
@@ -2651,7 +2651,7 @@ void wxDataViewMainWindow::ScrollTo( int rows, int column )
{ {
wxRect rect = GetClientRect(); wxRect rect = GetClientRect();
int colnum = 0; int colnum = 0;
int x_start = 0, x_end = 0, w = 0; int x_start = 0, w = 0;
int xx, yy, xe; int xx, yy, xe;
m_owner->CalcUnscrolledPosition( rect.x, rect.y, &xx, &yy ); m_owner->CalcUnscrolledPosition( rect.x, rect.y, &xx, &yy );
for (x_start = 0; colnum < column; colnum++) for (x_start = 0; colnum < column; colnum++)
@@ -2664,7 +2664,7 @@ void wxDataViewMainWindow::ScrollTo( int rows, int column )
x_start += w; x_start += w;
} }
x_end = x_start + w; int x_end = x_start + w;
xe = xx + rect.width; xe = xx + rect.width;
if( x_end > xe ) if( x_end > xe )
{ {
@@ -3318,7 +3318,7 @@ void wxDataViewMainWindow::OnCollapsing(unsigned int row)
{ {
if (IsVirtualList()) if (IsVirtualList())
return; return;
wxDataViewTreeNode * node = GetTreeNodeByRow(row); wxDataViewTreeNode * node = GetTreeNodeByRow(row);
if( node != NULL ) if( node != NULL )
{ {
@@ -3414,10 +3414,9 @@ void wxDataViewMainWindow::HitTest( const wxPoint & point, wxDataViewItem & item
wxDataViewColumn *col = NULL; wxDataViewColumn *col = NULL;
unsigned int cols = GetOwner()->GetColumnCount(); unsigned int cols = GetOwner()->GetColumnCount();
unsigned int colnum = 0; unsigned int colnum = 0;
unsigned int x_start = 0;
int x, y; int x, y;
m_owner->CalcUnscrolledPosition( point.x, point.y, &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); col = GetOwner()->GetColumn(colnum);
if (col->IsHidden()) if (col->IsHidden())
@@ -3536,7 +3535,7 @@ int wxDataViewMainWindow::GetRowByItem(const wxDataViewItem & item) const
//Compose the a parent-chain of the finding item //Compose the a parent-chain of the finding item
ItemList list; ItemList list;
wxDataViewItem * pItem = NULL; wxDataViewItem * pItem;
list.DeleteContents( true ); list.DeleteContents( true );
wxDataViewItem it( item ); wxDataViewItem it( item );
while( it.IsOk() ) while( it.IsOk() )
@@ -4093,7 +4092,7 @@ void wxDataViewCtrl::Init()
{ {
m_cols.DeleteContents(true); m_cols.DeleteContents(true);
m_notifier = NULL; m_notifier = NULL;
// No sorting column at start // No sorting column at start
m_sortingColumn = NULL; m_sortingColumn = NULL;
m_headerArea = NULL; m_headerArea = NULL;
@@ -4160,7 +4159,7 @@ wxSize wxDataViewCtrl::GetSizeAvailableForScrollTarget(const wxSize& size)
wxSize newsize = size; wxSize newsize = size;
if (!HasFlag(wxDV_NO_HEADER) && (m_headerArea)) if (!HasFlag(wxDV_NO_HEADER) && (m_headerArea))
newsize.y -= m_headerArea->GetSize().y; newsize.y -= m_headerArea->GetSize().y;
return newsize; return newsize;
} }

View File

@@ -965,32 +965,19 @@ bool wxGridCellEditor::IsAcceptedKey(wxKeyEvent& event)
if ((ctrl || alt) && !(ctrl && alt)) if ((ctrl || alt) && !(ctrl && alt))
return false; 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 wxUSE_UNICODE
// if the unicode key code is not really a unicode character (it may // 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 // 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 // small value in this case) then fallback to the ASCII key code but
// don't do anything for function keys or etc. // don't do anything for function keys or etc.
key = event.GetUnicodeKey(); if ( event.GetUnicodeKey() > 127 && event.GetKeyCode() > 127 )
if (key <= 127) return false;
{
key = event.GetKeyCode();
keyOk = (key <= 127);
}
#else #else
key = event.GetKeyCode(); if ( event.GetKeyCode() > 255 )
keyOk = (key <= 255); return false;
#endif #endif
return keyOk; return true;
} }
void wxGridCellEditor::StartingKey(wxKeyEvent& event) void wxGridCellEditor::StartingKey(wxKeyEvent& event)
@@ -4903,10 +4890,9 @@ void wxGrid::InitColWidths()
m_colWidths.Add( m_defaultColWidth, m_numCols ); m_colWidths.Add( m_defaultColWidth, m_numCols );
int colRight = 0;
for ( int i = 0; i < m_numCols; i++ ) 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 ); m_colRights.Add( colRight );
} }
} }

View File

@@ -1170,7 +1170,7 @@ static int OpenLogFile(wxFile& file, wxString *pFilename, wxWindow *parent)
// open file // open file
// --------- // ---------
bool bOk = false; bool bOk;
if ( wxFile::Exists(filename) ) { if ( wxFile::Exists(filename) ) {
bool bAppend = false; bool bAppend = false;
wxString strMsg; wxString strMsg;

View File

@@ -877,10 +877,6 @@ wxGenericTreeItem::DoCalculateSize(wxGenericTreeCtrl* control,
else else
state_w += MARGIN_BETWEEN_IMAGE_AND_TEXT; state_w += MARGIN_BETWEEN_IMAGE_AND_TEXT;
} }
else
{
state = wxTREE_ITEMSTATE_NONE;
}
} }
m_height = (image_h > text_h) ? image_h : text_h; m_height = (image_h > text_h) ? image_h : text_h;

View File

@@ -846,9 +846,10 @@ wxChar wxHtmlEntitiesParser::GetEntityChar(const wxString& entity) const
while (substitutions[substitutions_cnt].code != 0) while (substitutions[substitutions_cnt].code != 0)
substitutions_cnt++; substitutions_cnt++;
wxHtmlEntityInfo *info = NULL; wxHtmlEntityInfo *info;
#ifdef __WXWINCE__ #ifdef __WXWINCE__
// bsearch crashes under WinCE for some reason // bsearch crashes under WinCE for some reason
info = NULL;
size_t i; size_t i;
for (i = 0; i < substitutions_cnt; i++) for (i = 0; i < substitutions_cnt; i++)
{ {

View File

@@ -200,8 +200,10 @@ void wxHtmlPrintout::OnPreparePrinting()
int ppiPrinterX, ppiPrinterY; int ppiPrinterX, ppiPrinterY;
GetPPIPrinter(&ppiPrinterX, &ppiPrinterY); GetPPIPrinter(&ppiPrinterX, &ppiPrinterY);
wxUnusedVar(ppiPrinterX);
int ppiScreenX, ppiScreenY; int ppiScreenX, ppiScreenY;
GetPPIScreen(&ppiScreenX, &ppiScreenY); GetPPIScreen(&ppiScreenX, &ppiScreenY);
wxUnusedVar(ppiScreenX);
wxDisplaySize(&scr_w, &scr_h); wxDisplaySize(&scr_w, &scr_h);
GetDC()->GetSize(&dc_w, &dc_h); GetDC()->GetSize(&dc_w, &dc_h);

View File

@@ -695,15 +695,13 @@ bool wxQTMediaBackend::Load(const wxString& fileName)
if (m_movie) if (m_movie)
Cleanup(); Cleanup();
bool result = true;
OSErr err = noErr;
short movieResFile = 0; //= 0 because of annoying VC6 warning short movieResFile = 0; //= 0 because of annoying VC6 warning
FSSpec sfFile; FSSpec sfFile;
err = m_lib.NativePathNameToFSSpec( OSErr err = m_lib.NativePathNameToFSSpec(
(char*) (const char*) fileName.mb_str(), (char*) (const char*) fileName.mb_str(),
&sfFile, 0); &sfFile, 0);
result = (err == noErr); bool result = (err == noErr);
if (result) if (result)
{ {

View File

@@ -935,15 +935,21 @@ void wxActiveXContainer::CreateActiveX(REFIID iid, IUnknown* pUnk)
HRESULT hret = HRESULT hret =
cpContainer->FindConnectionPoint(ta->guid, cp.GetRef()); cpContainer->FindConnectionPoint(ta->guid, cp.GetRef());
wxASSERT ( SUCCEEDED(hret)); if ( !SUCCEEDED(hret) )
{
wxFAIL_MSG( wxString::Format("FindConnectionPoint(): %X",
(unsigned)hret) );
}
IDispatch* disp; IDispatch* disp;
frame->QueryInterface(IID_IDispatch, (void**)&disp); frame->QueryInterface(IID_IDispatch, (void**)&disp);
hret = cp->Advise(new wxActiveXEvents(this, ta->guid), hret = cp->Advise(new wxActiveXEvents(this, ta->guid),
&adviseCookie); &adviseCookie);
wxASSERT_MSG( SUCCEEDED(hret), if ( !SUCCEEDED(hret) )
wxString::Format(wxT("Cannot connect!\nHRESULT:%X"), (unsigned int)hret) {
); wxFAIL_MSG( wxString::Format("Advise(): %X",
(unsigned)hret) );
}
} }
} }

View File

@@ -993,11 +993,11 @@ void wxTopLevelWindowMSW::SetIcons(const wxIconBundle& icons)
{ {
wxTopLevelWindowBase::SetIcons(icons); wxTopLevelWindowBase::SetIcons(icons);
bool ok = DoSelectAndSetIcon(icons, SM_CXSMICON, SM_CYSMICON, ICON_SMALL); if ( !DoSelectAndSetIcon(icons, SM_CXSMICON, SM_CYSMICON, ICON_SMALL) &&
if ( DoSelectAndSetIcon(icons, SM_CXICON, SM_CYICON, ICON_BIG) ) !DoSelectAndSetIcon(icons, SM_CXICON, SM_CYICON, ICON_BIG) )
ok = true; {
wxFAIL_MSG( "icon bundle doesn't contain any suitable icon" );
wxASSERT_MSG( ok, "icon bundle doesn't contain any suitable icon" ); }
} }
bool wxTopLevelWindowMSW::EnableCloseButton(bool enable) bool wxTopLevelWindowMSW::EnableCloseButton(bool enable)

View File

@@ -3423,12 +3423,12 @@ WXLRESULT wxWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM l
rc.result = MSWDefWindowProc(message, wParam, lParam); rc.result = MSWDefWindowProc(message, wParam, lParam);
processed = true; processed = true;
// now alter the client size making room for drawing a themed border // now alter the client size making room for drawing a
NCCALCSIZE_PARAMS *csparam = NULL; // themed border
RECT *rect; RECT *rect;
if ( wParam ) if ( wParam )
{ {
csparam = (NCCALCSIZE_PARAMS *)lParam; NCCALCSIZE_PARAMS *csparam = (NCCALCSIZE_PARAMS *)lParam;
rect = &csparam->rgrc[0]; rect = &csparam->rgrc[0];
} }
else else