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

View File

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

View File

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

View File

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

View File

@@ -1500,22 +1500,25 @@ void wxMacCoreGraphicsContext::EnsureIsValid()
#else
paramErr;
#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 );
CGContextSaveGState( m_cgContext );
m_releaseContext = true;
if ( !HIShapeIsEmpty(m_clipRgn) )
{
CGContextSaveGState( m_cgContext );
m_releaseContext = true;
if ( !HIShapeIsEmpty(m_clipRgn) )
{
// the clip region is in device coordinates, so we convert this again to user coordinates
wxCFRef<HIMutableShapeRef> hishape( HIShapeCreateMutableCopy( m_clipRgn ) );
CGPoint transformedOrigin = CGPointApplyAffineTransform( CGPointZero,m_windowTransform);
HIShapeOffset( hishape, -transformedOrigin.x, -transformedOrigin.y );
HIShapeReplacePathInCGContext( hishape, m_cgContext );
CGContextClip( m_cgContext );
}
CGContextSaveGState( m_cgContext );
}
HIShapeReplacePathInCGContext( hishape, m_cgContext );
CGContextClip( m_cgContext );
}
CGContextSaveGState( m_cgContext );
}
}
// TODO test whether the private CGContextSetCompositeOperation works under 10.3 (using NSCompositingModes)
@@ -2503,7 +2506,10 @@ CGDataConsumerRef wxMacCGDataConsumerCreateWithCFData( CFMutableDataRef 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 ;

View File

@@ -220,7 +220,11 @@ bool wxIcon::LoadFile(
HLock((Handle) iconFamily);
OSStatus err = GetIconRefFromIconFamilyPtr( *iconFamily, GetHandleSize((Handle) iconFamily), &iconRef );
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 ) ;
}
}

View File

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

View File

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

View File

@@ -413,7 +413,10 @@ void wxNotebook::MacSetupTabs()
wxMacCreateBitmapButton( &info, bmap ) ;
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 ) ;
}

View File

@@ -166,7 +166,10 @@ void wxOverlayImpl::Reset()
{
#ifndef __LP64__
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
m_overlayContext = NULL ;
}

View File

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

View File

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

View File

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

View File

@@ -232,7 +232,11 @@ static pascal OSStatus wxMacWindowControlEventHandler( EventHandlerCallRef handl
bool created = false ;
CGContextRef cgContext = NULL ;
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 ) ;
{