wxCHECK/wxCHECK_RET changes
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@132 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -184,7 +184,8 @@ public: \
|
||||
void Remove(uint uiIndex) { wxBaseArray::Remove(uiIndex); } \
|
||||
void Remove(T Item) \
|
||||
{ int iIndex = Index(Item); \
|
||||
wxCHECK( iIndex != NOT_FOUND ); \
|
||||
wxCHECK2_MSG( iIndex != NOT_FOUND, return, \
|
||||
"removing inexisting element in wxArray::Remove" ); \
|
||||
wxBaseArray::Remove((uint)iIndex); } \
|
||||
\
|
||||
void Sort(CMPFUNC##T fCmp) { wxBaseArray::Sort((CMPFUNC)fCmp); } \
|
||||
|
@@ -179,7 +179,7 @@ void wxBaseArray::Add(long lItem)
|
||||
// add item at the given position
|
||||
void wxBaseArray::Insert(long lItem, uint uiIndex)
|
||||
{
|
||||
wxCHECK( uiIndex <= m_uiCount );
|
||||
wxCHECK_RET( uiIndex <= m_uiCount, "bad index in wxArray::Insert" );
|
||||
|
||||
Grow();
|
||||
|
||||
@@ -192,7 +192,7 @@ void wxBaseArray::Insert(long lItem, uint uiIndex)
|
||||
// removes item from array (by index)
|
||||
void wxBaseArray::Remove(uint uiIndex)
|
||||
{
|
||||
wxCHECK( uiIndex <= m_uiCount );
|
||||
wxCHECK_RET( uiIndex <= m_uiCount, "bad index in wxArray::Remove" );
|
||||
|
||||
memmove(&m_pItems[uiIndex], &m_pItems[uiIndex + 1],
|
||||
(m_uiCount - uiIndex - 1)*sizeof(long));
|
||||
@@ -204,7 +204,8 @@ void wxBaseArray::Remove(long lItem)
|
||||
{
|
||||
int iIndex = Index(lItem);
|
||||
|
||||
wxCHECK( iIndex != NOT_FOUND );
|
||||
wxCHECK_RET( iIndex != NOT_FOUND,
|
||||
"removing inexistent item in wxArray::Remove" );
|
||||
|
||||
Remove((uint)iIndex);
|
||||
}
|
||||
|
@@ -190,7 +190,7 @@ bool wxFile::Close()
|
||||
// read
|
||||
off_t wxFile::Read(void *pBuf, off_t nCount)
|
||||
{
|
||||
wxCHECK_RET( (pBuf != NULL) && IsOpened(), 0 );
|
||||
wxCHECK( (pBuf != NULL) && IsOpened(), 0 );
|
||||
|
||||
int iRc = ::read(m_fd, pBuf, nCount);
|
||||
if ( iRc == -1 ) {
|
||||
@@ -204,7 +204,7 @@ off_t wxFile::Read(void *pBuf, off_t nCount)
|
||||
// write
|
||||
bool wxFile::Write(const void *pBuf, uint nCount)
|
||||
{
|
||||
wxCHECK_RET( (pBuf != NULL) && IsOpened(), 0 );
|
||||
wxCHECK( (pBuf != NULL) && IsOpened(), 0 );
|
||||
|
||||
int iRc = ::write(m_fd, pBuf, nCount);
|
||||
if ( iRc == -1 ) {
|
||||
|
@@ -1066,7 +1066,7 @@ static struct _find_t wxFileStruc;
|
||||
static wxString wxFileSpec = "";
|
||||
static int wxFindFileFlags;
|
||||
|
||||
char *wxFindFirstFile(const wxString& spec, int flags)
|
||||
char *wxFindFirstFile(const char *spec, int flags)
|
||||
{
|
||||
wxFileSpec = spec;
|
||||
wxFindFileFlags = flags; /* MATTHEW: [5] Remember flags */
|
||||
@@ -1284,7 +1284,8 @@ bool wxEndsWithPathSeparator(const char *pszFileName)
|
||||
bool wxFindFileInPath(wxString *pStr, const char *pszPath, const char *pszFile)
|
||||
{
|
||||
// we assume that it's not empty
|
||||
wxCHECK_RET( Strlen(pszFile) != 0, FALSE);
|
||||
wxCHECK_MSG( !IsEmpty(pszFile), FALSE,
|
||||
"empty file name in wxFindFileInPath");
|
||||
|
||||
// skip path separator in the beginning of the file name if present
|
||||
if ( wxIsPathSeparator(*pszFile) )
|
||||
|
@@ -381,7 +381,8 @@ wxStatusBar *wxFrame::OnCreateStatusBar(const int number)
|
||||
bool wxFrame::CreateStatusBar(const int number)
|
||||
{
|
||||
// VZ: calling CreateStatusBar twice is an error - why anyone would do it?
|
||||
wxCHECK_RET( m_frameStatusBar == NULL, FALSE );
|
||||
wxCHECK_MSG( m_frameStatusBar == NULL, FALSE,
|
||||
"recreating status bar in wxFrame" );
|
||||
|
||||
m_frameStatusBar = OnCreateStatusBar(number);
|
||||
if ( m_frameStatusBar )
|
||||
@@ -395,14 +396,14 @@ bool wxFrame::CreateStatusBar(const int number)
|
||||
|
||||
void wxFrame::SetStatusText(const wxString& text, const int number)
|
||||
{
|
||||
wxCHECK( m_frameStatusBar != NULL );
|
||||
wxCHECK_RET( m_frameStatusBar != NULL, "no statusbar to set text for" );
|
||||
|
||||
m_frameStatusBar->SetStatusText(text, number);
|
||||
}
|
||||
|
||||
void wxFrame::SetStatusWidths(const int n, const int *widths_field)
|
||||
{
|
||||
wxCHECK( m_frameStatusBar != NULL );
|
||||
wxCHECK_RET( m_frameStatusBar != NULL, "no statusbar to set widths for" );
|
||||
|
||||
m_frameStatusBar->SetStatusWidths(n, widths_field);
|
||||
PositionStatusBar();
|
||||
|
@@ -139,7 +139,7 @@ void wxMenu::Break(void)
|
||||
// function appends a new item or submenu to the menu
|
||||
void wxMenu::Append(wxMenuItem *pItem)
|
||||
{
|
||||
wxCHECK( pItem != NULL );
|
||||
wxCHECK_RET( pItem != NULL, "can't append NULL item to the menu" );
|
||||
|
||||
m_menuItems.Append(pItem);
|
||||
|
||||
@@ -269,7 +269,7 @@ void wxMenu::Delete(int id)
|
||||
void wxMenu::Enable(int Id, bool Flag)
|
||||
{
|
||||
wxMenuItem *item = FindItemForId(Id);
|
||||
wxCHECK( item != NULL );
|
||||
wxCHECK_RET( item != NULL, "can't enable non-existing menu item" );
|
||||
|
||||
item->Enable(Flag);
|
||||
}
|
||||
@@ -277,7 +277,7 @@ void wxMenu::Enable(int Id, bool Flag)
|
||||
bool wxMenu::Enabled(int Id) const
|
||||
{
|
||||
wxMenuItem *item = FindItemForId(Id);
|
||||
wxCHECK_RET( item != NULL, FALSE );
|
||||
wxCHECK( item != NULL, FALSE );
|
||||
|
||||
return item->IsEnabled();
|
||||
}
|
||||
@@ -285,7 +285,7 @@ bool wxMenu::Enabled(int Id) const
|
||||
void wxMenu::Check(int Id, bool Flag)
|
||||
{
|
||||
wxMenuItem *item = FindItemForId(Id);
|
||||
wxCHECK( item != NULL );
|
||||
wxCHECK_RET( item != NULL, "can't get status of non-existing menu item" );
|
||||
|
||||
item->Check(Flag);
|
||||
}
|
||||
@@ -293,7 +293,7 @@ void wxMenu::Check(int Id, bool Flag)
|
||||
bool wxMenu::Checked(int Id) const
|
||||
{
|
||||
wxMenuItem *item = FindItemForId(Id);
|
||||
wxCHECK_RET( item != NULL, FALSE );
|
||||
wxCHECK( item != NULL, FALSE );
|
||||
|
||||
return item->IsChecked();
|
||||
}
|
||||
|
@@ -134,7 +134,7 @@ void wxMenuItem::Enable(bool bDoEnable)
|
||||
|
||||
void wxMenuItem::Check(bool bDoCheck)
|
||||
{
|
||||
wxCHECK ( IsCheckable() );
|
||||
wxCHECK_RET( IsCheckable(), "only checkable items may be checked" );
|
||||
|
||||
if ( m_bChecked != bDoCheck ) {
|
||||
CheckMenuItem((HMENU)m_pParentMenu->GetHMenu(), m_idItem,
|
||||
|
@@ -122,7 +122,7 @@ const size_t wxRegKey::nStdKeys = WXSIZEOF(aStdKeys);
|
||||
const char *wxRegKey::GetStdKeyName(uint key)
|
||||
{
|
||||
// return empty string if key is invalid
|
||||
wxCHECK_RET( key < nStdKeys, "" );
|
||||
wxCHECK_MSG( key < nStdKeys, "", "invalid key in wxRegKey::GetStdKeyName" );
|
||||
|
||||
return aStdKeys[key].szName;
|
||||
}
|
||||
@@ -130,7 +130,7 @@ const char *wxRegKey::GetStdKeyName(uint key)
|
||||
const char *wxRegKey::GetStdKeyShortName(uint key)
|
||||
{
|
||||
// return empty string if key is invalid
|
||||
wxCHECK_RET( key < nStdKeys, "" );
|
||||
wxCHECK( key < nStdKeys, "" );
|
||||
|
||||
return aStdKeys[key].szShortName;
|
||||
}
|
||||
|
Reference in New Issue
Block a user