fix warnings about unused parameters/variables in release build

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@52690 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2008-03-22 12:11:37 +00:00
parent 5c7b506103
commit 947f3b358c
17 changed files with 197 additions and 148 deletions

View File

@@ -419,9 +419,12 @@ public :
T value; T value;
OSStatus err = GetData<T>( inPartCode , inTag , &value ); OSStatus err = GetData<T>( inPartCode , inTag , &value );
wxASSERT_MSG( err == noErr, if ( err != noErr )
wxString::Format(wxT("GetData Failed for Part [%i] and Tag [%i]"), {
wxFAIL_MSG( wxString::Format(wxT("GetData Failed for Part [%i] and Tag [%i]"),
inPartCode, (int)inTag) ); inPartCode, (int)inTag) );
}
return value; return value;
} }
template <typename T> OSStatus GetData( ResType inTag , T *data ) const template <typename T> OSStatus GetData( ResType inTag , T *data ) const

View File

@@ -565,8 +565,9 @@ IconRef wxBitmapRefData::GetIconRef()
HLock((Handle) iconFamily); HLock((Handle) iconFamily);
OSStatus err = GetIconRefFromIconFamilyPtr( *iconFamily, GetHandleSize((Handle) iconFamily), &m_iconRef ); OSStatus err = GetIconRefFromIconFamilyPtr( *iconFamily, GetHandleSize((Handle) iconFamily), &m_iconRef );
HUnlock((Handle) iconFamily); HUnlock((Handle) iconFamily);
wxASSERT_MSG( err == noErr , wxT("Error when constructing icon ref") );
DisposeHandle( (Handle) iconFamily ) ; DisposeHandle( (Handle) iconFamily ) ;
wxCHECK_MSG( err == noErr, NULL, wxT("Error when constructing icon ref") );
} }
return m_iconRef ; return m_iconRef ;

View File

@@ -98,7 +98,10 @@ wxMacCarbonFontPanelHandler(EventHandlerCallRef WXUNUSED(nextHandler),
FMFontFamily fontFamily = cEvent.GetParameter<FMFontFamily>(kEventParamFMFontFamily); FMFontFamily fontFamily = cEvent.GetParameter<FMFontFamily>(kEventParamFMFontFamily);
ATSFontFamilyRef atsfontfamilyref = FMGetATSFontFamilyRefFromFontFamily( fontFamily ) ; ATSFontFamilyRef atsfontfamilyref = FMGetATSFontFamilyRefFromFontFamily( fontFamily ) ;
OSStatus err = ATSFontFamilyGetName( atsfontfamilyref , kATSOptionFlagsDefault , &cfName ) ; OSStatus err = ATSFontFamilyGetName( atsfontfamilyref , kATSOptionFlagsDefault , &cfName ) ;
wxASSERT_MSG( err == noErr , wxT("ATSFontFamilyGetName failed") ); if ( err == noErr )
{
wxFAIL_MSG("ATSFontFamilyGetName failed");
}
#else #else
// we don't use the ATSU naming anymore // we don't use the ATSU naming anymore
ByteCount actualLength = 0; ByteCount actualLength = 0;
@@ -182,7 +185,7 @@ wxMacCarbonFontPanelHandler(EventHandlerCallRef WXUNUSED(nextHandler),
} }
} }
break ; break ;
} ; }
return result ; return result ;
} }

View File

@@ -141,8 +141,10 @@ int RunMixedFontDialog(wxFontDialog* WXUNUSED(dialog))
{ {
int retval = wxID_CANCEL ; int retval = wxID_CANCEL ;
bool cocoaLoaded = NSApplicationLoad(); if ( !NSApplicationLoad() )
wxASSERT_MSG(cocoaLoaded,wxT("Couldn't load Cocoa in Carbon Environment")) ; {
wxFAIL_MSG("Couldn't load Cocoa in Carbon Environment");
}
wxAutoNSAutoreleasePool pool; wxAutoNSAutoreleasePool pool;

View File

@@ -1500,7 +1500,10 @@ void wxMacCoreGraphicsContext::EnsureIsValid()
#else #else
paramErr; paramErr;
#endif #endif
wxASSERT_MSG( status == noErr , wxT("Cannot nest wxDCs on the same window") ); if ( status != noErr )
{
wxFAIL_MSG("Cannot nest wxDCs on the same window");
}
CGContextConcatCTM( m_cgContext, m_windowTransform ); CGContextConcatCTM( m_cgContext, m_windowTransform );
CGContextSaveGState( m_cgContext ); CGContextSaveGState( m_cgContext );
@@ -2503,7 +2506,10 @@ CGDataConsumerRef wxMacCGDataConsumerCreateWithCFData( CFMutableDataRef data )
return CGDataConsumerCreateWithCFData( data ); return CGDataConsumerCreateWithCFData( data );
} }
void wxMacReleaseMemoryBufferProviderCallback(void *info, const void *data, size_t WXUNUSED(size)) void
wxMacReleaseMemoryBufferProviderCallback(void *info,
const void * WXUNUSED_UNLESS_DEBUG(data),
size_t WXUNUSED(size))
{ {
wxMemoryBuffer* membuf = (wxMemoryBuffer*) info ; wxMemoryBuffer* membuf = (wxMemoryBuffer*) info ;

View File

@@ -220,7 +220,11 @@ bool wxIcon::LoadFile(
HLock((Handle) iconFamily); HLock((Handle) iconFamily);
OSStatus err = GetIconRefFromIconFamilyPtr( *iconFamily, GetHandleSize((Handle) iconFamily), &iconRef ); OSStatus err = GetIconRefFromIconFamilyPtr( *iconFamily, GetHandleSize((Handle) iconFamily), &iconRef );
HUnlock((Handle) iconFamily); HUnlock((Handle) iconFamily);
wxASSERT_MSG( err == noErr , wxT("Error when constructing icon ref") ); if ( err != noErr )
{
wxFAIL_MSG("Error when constructing icon ref");
}
ReleaseResource( resHandle ) ; ReleaseResource( resHandle ) ;
} }
} }

View File

@@ -774,7 +774,8 @@ wxListCtrl::~wxListCtrl()
} }
/*static*/ /*static*/
wxVisualAttributes wxListCtrl::GetClassDefaultAttributes(wxWindowVariant variant) wxVisualAttributes
wxListCtrl::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
{ {
wxVisualAttributes attr; wxVisualAttributes attr;

View File

@@ -40,7 +40,7 @@ BEGIN_EVENT_TABLE(wxMDIClientWindow, wxWindow)
EVT_SCROLL(wxMDIClientWindow::OnScroll) EVT_SCROLL(wxMDIClientWindow::OnScroll)
END_EVENT_TABLE() END_EVENT_TABLE()
static const wxChar *TRACE_MDI = _T("mdi"); #define TRACE_MDI "mdi"
static const int IDM_WINDOWTILEHOR = 4001; static const int IDM_WINDOWTILEHOR = 4001;
static const int IDM_WINDOWCASCADE = 4002; static const int IDM_WINDOWCASCADE = 4002;

View File

@@ -413,7 +413,10 @@ void wxNotebook::MacSetupTabs()
wxMacCreateBitmapButton( &info, bmap ) ; wxMacCreateBitmapButton( &info, bmap ) ;
OSStatus err = m_peer->SetData<ControlButtonContentInfo>( ii + 1, kControlTabImageContentTag, &info ); OSStatus err = m_peer->SetData<ControlButtonContentInfo>( ii + 1, kControlTabImageContentTag, &info );
wxASSERT_MSG( err == noErr , wxT("Error when setting icon on tab") ) ; if ( err != noErr )
{
wxFAIL_MSG("Error when setting icon on tab");
}
wxMacReleaseBitmapButton( &info ) ; wxMacReleaseBitmapButton( &info ) ;
} }

View File

@@ -166,7 +166,10 @@ void wxOverlayImpl::Reset()
{ {
#ifndef __LP64__ #ifndef __LP64__
OSStatus err = QDEndCGContext(GetWindowPort(m_overlayWindow), &m_overlayContext); OSStatus err = QDEndCGContext(GetWindowPort(m_overlayWindow), &m_overlayContext);
wxASSERT_MSG( err == noErr , _("Couldn't end the context on the overlay window") ); if ( err != noErr )
{
wxFAIL_MSG("Couldn't end the context on the overlay window");
}
#endif #endif
m_overlayContext = NULL ; m_overlayContext = NULL ;
} }

View File

@@ -122,13 +122,16 @@ public:
// different behaviour under Leopard // different behaviour under Leopard
if ( UMAGetSystemVersion() < 0x1050 ) if ( UMAGetSystemVersion() < 0x1050 )
{ {
wxASSERT_MSG( count == 1 , wxT("Reference Count of native tool was not 1 in wxToolBarTool destructor") ); if ( count != 1 )
{
wxFAIL_MSG("Reference count of native tool was not 1 in wxToolBarTool destructor");
}
} }
wxTheApp->MacAddToAutorelease(m_toolbarItemRef); wxTheApp->MacAddToAutorelease(m_toolbarItemRef);
CFRelease(m_toolbarItemRef); CFRelease(m_toolbarItemRef);
m_toolbarItemRef = NULL; m_toolbarItemRef = NULL;
} }
#endif #endif // wxMAC_USE_NATIVE_TOOLBAR
} }
wxSize GetSize() const wxSize GetSize() const
@@ -628,10 +631,13 @@ static pascal OSStatus ControlToolbarItemHandler( EventHandlerCallRef inCallRef,
// depending whether the wxControl corresponding to this HIView has already been destroyed or // depending whether the wxControl corresponding to this HIView has already been destroyed or
// not, ref counts differ, so we cannot assert a special value // not, ref counts differ, so we cannot assert a special value
CFIndex count = CFGetRetainCount( viewRef ) ; CFIndex count = CFGetRetainCount( viewRef ) ;
wxASSERT_MSG( count >=1 , wxT("Reference Count of native tool was illegal before removal") );
if ( count >= 1 ) if ( count >= 1 )
{
wxFAIL_MSG("Reference count of native tool was illegal before removal");
CFRelease( viewRef ) ; CFRelease( viewRef ) ;
} }
}
free( object ) ; free( object ) ;
result = noErr; result = noErr;
} }
@@ -871,7 +877,10 @@ wxToolBar::~wxToolBar()
// Leopard seems to have one refcount more, so we cannot check reliably at the moment // Leopard seems to have one refcount more, so we cannot check reliably at the moment
if ( UMAGetSystemVersion() < 0x1050 ) if ( UMAGetSystemVersion() < 0x1050 )
{ {
wxASSERT_MSG( count == 1 , wxT("Reference Count of native control was not 1 in wxToolBar destructor") ); if ( count != 1 )
{
wxFAIL_MSG("Reference count of native control was not 1 in wxToolBar destructor");
}
} }
CFRelease( (HIToolbarRef)m_macHIToolbarRef ); CFRelease( (HIToolbarRef)m_macHIToolbarRef );
m_macHIToolbarRef = NULL; m_macHIToolbarRef = NULL;
@@ -1183,7 +1192,11 @@ bool wxToolBar::Realize()
if ( tool2->IsControl() ) if ( tool2->IsControl() )
{ {
CFIndex count = CFGetRetainCount( tool2->GetControl()->GetPeer()->GetControlRef() ) ; CFIndex count = CFGetRetainCount( tool2->GetControl()->GetPeer()->GetControlRef() ) ;
wxASSERT_MSG( count == 3 || count == 2 , wxT("Reference Count of native tool was illegal before removal") ); if ( count != 3 && count != 2 )
{
wxFAIL_MSG("Reference count of native tool was illegal before removal");
}
wxASSERT( IsValidControlHandle(tool2->GetControl()->GetPeer()->GetControlRef() )) ; wxASSERT( IsValidControlHandle(tool2->GetControl()->GetPeer()->GetControlRef() )) ;
} }
err = HIToolbarRemoveItemAtIndex(refTB, idx); err = HIToolbarRemoveItemAtIndex(refTB, idx);
@@ -1195,7 +1208,11 @@ bool wxToolBar::Realize()
if ( tool2->IsControl() ) if ( tool2->IsControl() )
{ {
CFIndex count = CFGetRetainCount( tool2->GetControl()->GetPeer()->GetControlRef() ) ; CFIndex count = CFGetRetainCount( tool2->GetControl()->GetPeer()->GetControlRef() ) ;
wxASSERT_MSG( count == 2 , wxT("Reference Count of native tool was not 2 after removal") ); if ( count != 2 )
{
wxFAIL_MSG("Reference count of native tool was not 2 after removal");
}
wxASSERT( IsValidControlHandle(tool2->GetControl()->GetPeer()->GetControlRef() )) ; wxASSERT( IsValidControlHandle(tool2->GetControl()->GetPeer()->GetControlRef() )) ;
} }
@@ -1214,7 +1231,10 @@ bool wxToolBar::Realize()
if ( tool->IsControl() ) if ( tool->IsControl() )
{ {
CFIndex count = CFGetRetainCount( tool->GetControl()->GetPeer()->GetControlRef() ) ; CFIndex count = CFGetRetainCount( tool->GetControl()->GetPeer()->GetControlRef() ) ;
wxASSERT_MSG( count == 3 || count == 2, wxT("Reference Count of native tool was illegal after insertion") ); if ( count != 3 && count != 2 )
{
wxFAIL_MSG("Reference count of native tool was illegal before removal");
}
wxASSERT( IsValidControlHandle(tool->GetControl()->GetPeer()->GetControlRef() )) ; wxASSERT( IsValidControlHandle(tool->GetControl()->GetPeer()->GetControlRef() )) ;
} }
} }

View File

@@ -61,7 +61,7 @@
#define kWindowUnifiedTitleAndToolbarAttribute (1 << 7) #define kWindowUnifiedTitleAndToolbarAttribute (1 << 7)
// trace mask for activation tracing messages // trace mask for activation tracing messages
static const wxChar *TRACE_ACTIVATE = _T("activation"); #define TRACE_ACTIVATE "activation"
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// globals // globals

View File

@@ -314,7 +314,6 @@ wxWindow* wxFindWindowAtPoint(const wxPoint& pt)
wxString wxGetOsDescription() wxString wxGetOsDescription()
{ {
char data[128];
struct utsname name; struct utsname name;
uname(&name); uname(&name);
return wxString::Format(_T("Mac OS X (%s %s %s)"), return wxString::Format(_T("Mac OS X (%s %s %s)"),
@@ -1561,7 +1560,7 @@ unsigned int wxMacDataItemBrowserControl::GetLineFromItem(const wxMacDataItem* i
{ {
DataBrowserTableViewRowIndex row; DataBrowserTableViewRowIndex row;
OSStatus err = GetItemRow( (DataBrowserItemID) item , &row); OSStatus err = GetItemRow( (DataBrowserItemID) item , &row);
wxASSERT( err == noErr); wxCHECK( err == noErr, (unsigned)-1 );
return row; return row;
} }
@@ -1569,7 +1568,7 @@ wxMacDataItem* wxMacDataItemBrowserControl::GetItemFromLine(unsigned int n) con
{ {
DataBrowserItemID id; DataBrowserItemID id;
OSStatus err = GetItemID( (DataBrowserTableViewRowIndex) n , &id); OSStatus err = GetItemID( (DataBrowserTableViewRowIndex) n , &id);
wxASSERT( err == noErr); wxCHECK( err == noErr, NULL );
return (wxMacDataItem*) id; return (wxMacDataItem*) id;
} }

View File

@@ -232,7 +232,11 @@ static pascal OSStatus wxMacWindowControlEventHandler( EventHandlerCallRef handl
bool created = false ; bool created = false ;
CGContextRef cgContext = NULL ; CGContextRef cgContext = NULL ;
OSStatus err = cEvent.GetParameter<CGContextRef>(kEventParamCGContextRef, &cgContext) ; OSStatus err = cEvent.GetParameter<CGContextRef>(kEventParamCGContextRef, &cgContext) ;
wxASSERT_MSG( err == noErr , wxT("Unable to retrieve CGContextRef") ) ; if ( err != noErr )
{
wxFAIL_MSG("Unable to retrieve CGContextRef");
}
thisWindow->MacSetCGContextRef( cgContext ) ; thisWindow->MacSetCGContextRef( cgContext ) ;
{ {