summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2014-07-07 10:15:32 +0100
committerCaolán McNamara <caolanm@redhat.com>2014-07-07 10:48:25 +0100
commit0d78ad871e85a74a2a7eac2f2a2ff94776f35e77 (patch)
treea29ea7098cc49b1116db16f219bdc662e04ac874
parent807b696c5c15dc2d8255116305fd28ba60f201c0 (diff)
DBG_ASSERT->assert when followed by dereference
Change-Id: Ic1c999ffdc391ea01be5711721e7c9e63179473e
-rw-r--r--binaryurp/source/writer.cxx2
-rw-r--r--comphelper/source/misc/anytostring.cxx2
-rw-r--r--connectivity/source/parse/sqlnode.cxx4
-rw-r--r--cppu/source/uno/lbenv.cxx8
-rw-r--r--cppu/source/uno/lbmap.cxx2
-rw-r--r--desktop/source/pkgchk/unopkg/unopkg_misc.cxx4
-rw-r--r--editeng/source/editeng/impedit2.cxx2
-rw-r--r--filter/source/msfilter/eschesdo.cxx7
-rw-r--r--jvmaccess/source/virtualmachine.cxx2
-rw-r--r--registry/source/regkey.cxx2
-rw-r--r--sal/osl/unx/socket.c5
-rw-r--r--sal/rtl/byteseq.cxx3
-rw-r--r--sc/source/ui/app/uiitems.cxx2
-rw-r--r--sfx2/source/view/viewfrm.cxx2
-rw-r--r--sot/source/sdstor/stgavl.cxx11
-rw-r--r--stoc/source/corereflection/criface.cxx2
-rw-r--r--svtools/source/contnr/treelist.cxx2
-rw-r--r--svtools/source/contnr/treelistbox.cxx9
-rw-r--r--svtools/source/uno/unoevent.cxx2
-rw-r--r--svx/source/svdraw/svdotext.cxx2
-rw-r--r--tools/source/inet/inetmime.cxx2
-rw-r--r--vcl/generic/print/genpspgraphics.cxx6
22 files changed, 35 insertions, 48 deletions
diff --git a/binaryurp/source/writer.cxx b/binaryurp/source/writer.cxx
index a47abf81a822..84edbd40187d 100644
--- a/binaryurp/source/writer.cxx
+++ b/binaryurp/source/writer.cxx
@@ -221,7 +221,7 @@ void Writer::sendRequest(
typelib_InterfaceMethodTypeDescription * mtd =
reinterpret_cast< typelib_InterfaceMethodTypeDescription * >(
member.get());
- OSL_ASSERT(mtd->pInterface != 0);
+ assert(mtd->pInterface != 0);
if (!t.is()) {
t = css::uno::TypeDescription(&mtd->pInterface->aBase);
}
diff --git a/comphelper/source/misc/anytostring.cxx b/comphelper/source/misc/anytostring.cxx
index 254c74311a5f..50dc18547411 100644
--- a/comphelper/source/misc/anytostring.cxx
+++ b/comphelper/source/misc/anytostring.cxx
@@ -61,7 +61,7 @@ void appendValue( OUStringBuffer & buf,
buf.append( "void" );
return;
}
- OSL_ASSERT( val != 0 );
+ assert(val != 0);
if (prependType &&
typeRef->eTypeClass != typelib_TypeClass_STRING &&
diff --git a/connectivity/source/parse/sqlnode.cxx b/connectivity/source/parse/sqlnode.cxx
index fa7f395e94d0..a80e8d4d94cb 100644
--- a/connectivity/source/parse/sqlnode.cxx
+++ b/connectivity/source/parse/sqlnode.cxx
@@ -1993,10 +1993,8 @@ void OSQLParseNode::negateSearchCondition(OSQLParseNode*& pSearchCondition, bool
case SQL_NODE_NOTEQUAL:
pNewComparison = new OSQLParseNode(OUString("="),SQL_NODE_EQUAL,SQL_EQUAL);
break;
- default:
- assert(false && "OSQLParseNode::negateSearchCondition: unexpected node type!");
- break;
}
+ assert(pNewComparison && "OSQLParseNode::negateSearchCondition: unexpected node type!");
pSearchCondition->replace(pComparison, pNewComparison);
delete pComparison;
}
diff --git a/cppu/source/uno/lbenv.cxx b/cppu/source/uno/lbenv.cxx
index b2828209d45d..c38a9b7a2eb0 100644
--- a/cppu/source/uno/lbenv.cxx
+++ b/cppu/source/uno/lbenv.cxx
@@ -1006,7 +1006,7 @@ inline void EnvironmentsData::getRegisteredEnvironments(
uno_Environment *** pppEnvs, sal_Int32 * pnLen, uno_memAlloc memAlloc,
const OUString & rEnvDcp )
{
- OSL_ENSURE( pppEnvs && pnLen && memAlloc, "### null ptr!" );
+ assert(pppEnvs && pnLen && memAlloc && "### null ptr!");
// max size
uno_Environment ** ppFound = (uno_Environment **)alloca(
@@ -1144,7 +1144,7 @@ CPPU_DLLPUBLIC void SAL_CALL uno_createEnvironment(
uno_Environment ** ppEnv, rtl_uString * pEnvDcp, void * pContext )
SAL_THROW_EXTERN_C()
{
- OSL_ENSURE( ppEnv, "### null ptr!" );
+ assert(ppEnv && "### null ptr!");
if (*ppEnv)
(*(*ppEnv)->release)( *ppEnv );
@@ -1152,12 +1152,11 @@ CPPU_DLLPUBLIC void SAL_CALL uno_createEnvironment(
*ppEnv = initDefaultEnvironment( rEnvDcp, pContext );
}
-
CPPU_DLLPUBLIC void SAL_CALL uno_getEnvironment(
uno_Environment ** ppEnv, rtl_uString * pEnvDcp, void * pContext )
SAL_THROW_EXTERN_C()
{
- OSL_ENSURE( ppEnv, "### null ptr!" );
+ assert(ppEnv && "### null ptr!");
OUString const & rEnvDcp = OUString::unacquired( &pEnvDcp );
EnvironmentsData & rData = theEnvironmentsData::get();
@@ -1175,7 +1174,6 @@ CPPU_DLLPUBLIC void SAL_CALL uno_getEnvironment(
}
}
-
CPPU_DLLPUBLIC void SAL_CALL uno_getRegisteredEnvironments(
uno_Environment *** pppEnvs, sal_Int32 * pnLen, uno_memAlloc memAlloc,
rtl_uString * pEnvDcp )
diff --git a/cppu/source/uno/lbmap.cxx b/cppu/source/uno/lbmap.cxx
index 43c5d4af6e6f..162f438ceebe 100644
--- a/cppu/source/uno/lbmap.cxx
+++ b/cppu/source/uno/lbmap.cxx
@@ -631,7 +631,7 @@ void SAL_CALL uno_getMappingByName(
rtl_uString * pAddPurpose )
SAL_THROW_EXTERN_C()
{
- OSL_ENSURE( ppMapping && pFrom && pTo, "### null ptr!" );
+ assert(ppMapping && pFrom && pTo && "### null ptr!");
if (*ppMapping)
{
(*(*ppMapping)->release)( *ppMapping );
diff --git a/desktop/source/pkgchk/unopkg/unopkg_misc.cxx b/desktop/source/pkgchk/unopkg/unopkg_misc.cxx
index 199355ea7269..68b3321cb90e 100644
--- a/desktop/source/pkgchk/unopkg/unopkg_misc.cxx
+++ b/desktop/source/pkgchk/unopkg/unopkg_misc.cxx
@@ -49,7 +49,7 @@ namespace unopkg {
OUString toString( OptionInfo const * info )
{
- OSL_ASSERT( info != 0 );
+ assert(info != 0);
OUStringBuffer buf;
buf.appendAscii("--");
buf.appendAscii(info->m_name);
@@ -98,7 +98,7 @@ OptionInfo const * getOptionInfo(
bool isOption( OptionInfo const * option_info, sal_uInt32 * pIndex )
{
- OSL_ASSERT( option_info != 0 );
+ assert(option_info != 0);
if (osl_getCommandArgCount() <= *pIndex)
return false;
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index 2184d8f9cb3b..a1bac55cf2b0 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -3223,7 +3223,7 @@ void ImpEditEngine::GetLineBoundaries( /*out*/sal_Int32 &rStart, /*out*/sal_Int3
if ( pPPortion && ( nLine < pPPortion->GetLines().Count() ) )
{
const EditLine* pLine = pPPortion->GetLines()[nLine];
- OSL_ENSURE( pLine, "Line not found: GetLineBoundaries" );
+ assert(pLine && "Line not found: GetLineBoundaries");
rStart = pLine->GetStart();
rEnd = pLine->GetEnd();
}
diff --git a/filter/source/msfilter/eschesdo.cxx b/filter/source/msfilter/eschesdo.cxx
index 35fd7308d4aa..bc314622edbb 100644
--- a/filter/source/msfilter/eschesdo.cxx
+++ b/filter/source/msfilter/eschesdo.cxx
@@ -960,22 +960,19 @@ void ImplEscherExSdr::ImplFlushSolverContainer()
}
}
-
void ImplEscherExSdr::ImplWriteCurrentPage()
{
- DBG_ASSERT( mpSolverContainer, "ImplEscherExSdr::ImplWriteCurrentPage: no SolverContainer" );
+ assert(mpSolverContainer && "ImplEscherExSdr::ImplWriteCurrentPage: no SolverContainer");
ImplWritePage( *mpSolverContainer, NORMAL );
ImplExitPage();
}
-
sal_uInt32 ImplEscherExSdr::ImplWriteTheShape( ImplEESdrObject& rObj , bool ooxmlExport )
{
- DBG_ASSERT( mpSolverContainer, "ImplEscherExSdr::ImplWriteShape: no SolverContainer" );
+ assert(mpSolverContainer && "ImplEscherExSdr::ImplWriteShape: no SolverContainer");
return ImplWriteShape( rObj, *mpSolverContainer, NORMAL, ooxmlExport );
}
-
void EscherEx::AddSdrPage( const SdrPage& rPage )
{
if ( mpImplEscherExSdr->ImplInitPage( rPage ) )
diff --git a/jvmaccess/source/virtualmachine.cxx b/jvmaccess/source/virtualmachine.cxx
index 23192ab3e437..69bcf5fe6669 100644
--- a/jvmaccess/source/virtualmachine.cxx
+++ b/jvmaccess/source/virtualmachine.cxx
@@ -82,7 +82,7 @@ VirtualMachine::~VirtualMachine()
JNIEnv * VirtualMachine::attachThread(bool * pAttached) const
{
- OSL_ENSURE(pAttached != 0, "bad parameter");
+ assert(pAttached != 0 && "bad parameter");
JNIEnv * pEnv;
jint n = m_pVm->GetEnv(reinterpret_cast< void ** >(&pEnv), m_nVersion);
if (n != JNI_OK && n != JNI_EDETACHED) {
diff --git a/registry/source/regkey.cxx b/registry/source/regkey.cxx
index 89bf17bda2d3..21698c165ceb 100644
--- a/registry/source/regkey.cxx
+++ b/registry/source/regkey.cxx
@@ -459,7 +459,7 @@ RegError REGISTRY_CALLTYPE getLongListValue(RegKeyHandle hKey,
sal_Int32** pValueList,
sal_uInt32* pLen)
{
- OSL_PRECOND((pValueList != 0) && (pLen != 0), "registry::getLongListValue(): invalid parameter");
+ assert((pValueList != 0) && (pLen != 0) && "registry::getLongListValue(): invalid parameter");
*pValueList = 0, *pLen = 0;
ORegKey* pKey = static_cast< ORegKey* >(hKey);
diff --git a/sal/osl/unx/socket.c b/sal/osl/unx/socket.c
index fb6ced2ce77c..618bd7afc462 100644
--- a/sal/osl/unx/socket.c
+++ b/sal/osl/unx/socket.c
@@ -25,7 +25,7 @@
#include <osl/signal.h>
#include <rtl/alloc.h>
-
+#include <assert.h>
#include <ctype.h>
#include <sal/types.h>
@@ -552,8 +552,7 @@ sal_Bool SAL_CALL osl_isEqualSocketAddr (
struct sockaddr* pAddr1 = NULL;
struct sockaddr* pAddr2 = NULL;
- OSL_ASSERT(Addr1);
- OSL_ASSERT(Addr2);
+ assert(Addr1 && Addr2);
pAddr1 = &(Addr1->m_sockaddr);
pAddr2 = &(Addr2->m_sockaddr);
diff --git a/sal/rtl/byteseq.cxx b/sal/rtl/byteseq.cxx
index 5fd6022cfa75..f0f190125dce 100644
--- a/sal/rtl/byteseq.cxx
+++ b/sal/rtl/byteseq.cxx
@@ -216,8 +216,7 @@ void SAL_CALL rtl_byte_sequence_assign( sal_Sequence **ppSequence , sal_Sequence
sal_Bool SAL_CALL rtl_byte_sequence_equals( sal_Sequence *pSequence1 , sal_Sequence *pSequence2 )
SAL_THROW_EXTERN_C()
{
- OSL_ASSERT( pSequence1 );
- OSL_ASSERT( pSequence2 );
+ assert(pSequence1 && pSequence2);
if (pSequence1 == pSequence2)
{
return sal_True;
diff --git a/sc/source/ui/app/uiitems.cxx b/sc/source/ui/app/uiitems.cxx
index 6a7e0887e5bf..9b12278b7b35 100644
--- a/sc/source/ui/app/uiitems.cxx
+++ b/sc/source/ui/app/uiitems.cxx
@@ -456,7 +456,7 @@ ScPivotItem::ScPivotItem( const ScPivotItem& rItem ) :
aDestRange ( rItem.aDestRange ),
bNewSheet ( rItem.bNewSheet )
{
- OSL_ENSURE(rItem.pSaveData, "pSaveData");
+ assert(rItem.pSaveData && "pSaveData");
pSaveData = new ScDPSaveData(*rItem.pSaveData);
}
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index a65f0e648d0d..57de550aafd4 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -2370,7 +2370,7 @@ void SfxViewFrame::StateView_Impl
return;
const sal_uInt16 *pRanges = rSet.GetRanges();
- DBG_ASSERT(pRanges, "Set with no Range");
+ assert(pRanges && "Set with no Range");
while ( *pRanges )
{
for ( sal_uInt16 nWhich = *pRanges++; nWhich <= *pRanges; ++nWhich )
diff --git a/sot/source/sdstor/stgavl.cxx b/sot/source/sdstor/stgavl.cxx
index 3cb48c2a1da9..93869ac9b042 100644
--- a/sot/source/sdstor/stgavl.cxx
+++ b/sot/source/sdstor/stgavl.cxx
@@ -131,7 +131,7 @@ short StgAvlNode::Adjust( StgAvlNode** pHeavy, StgAvlNode* pNew )
StgAvlNode* StgAvlNode::RotLL()
{
- OSL_ENSURE( pLeft, "The pointer is not allowed to be NULL!" );
+ assert(pLeft && "The pointer is not allowed to be NULL!");
StgAvlNode *pHeavy = pLeft;
pLeft = pHeavy->pRight;
pHeavy->pRight = this;
@@ -172,10 +172,9 @@ StgAvlNode* StgAvlNode::RotLR()
}
// perform RR rotation and return new root
-
StgAvlNode* StgAvlNode::RotRR()
{
- OSL_ENSURE( pRight, "The pointer is not allowed to be NULL!" );
+ assert(pRight && "The pointer is not allowed to be NULL!" );
StgAvlNode* pHeavy = pRight;
pRight = pHeavy->pLeft;
pHeavy->pLeft = this;
@@ -184,10 +183,9 @@ StgAvlNode* StgAvlNode::RotRR()
}
// perform the RL rotation and return the new root
-
StgAvlNode* StgAvlNode::RotRL()
{
- OSL_ENSURE( pRight && pRight->pLeft, "The pointer is not allowed to be NULL!" );
+ assert(pRight && pRight->pLeft && "The pointer is not allowed to be NULL!");
StgAvlNode* pHeavy = pRight;
StgAvlNode* pNewRoot = pHeavy->pLeft;
pHeavy->pLeft = pNewRoot->pRight;
@@ -297,7 +295,8 @@ bool StgAvlNode::Insert( StgAvlNode** pRoot, StgAvlNode* pIns )
short nRes = (*pRoot)->Locate( pIns, &pPivot, &pParent, &pPrev );
if( !nRes )
return false;
- OSL_ENSURE( pPivot && pPrev, "The pointers may not be NULL!" );
+
+ assert(pPivot && pPrev && "The pointers may not be NULL!");
// add new node
if( nRes < 0 )
diff --git a/stoc/source/corereflection/criface.cxx b/stoc/source/corereflection/criface.cxx
index 84fe1c0c8879..6e57ee604888 100644
--- a/stoc/source/corereflection/criface.cxx
+++ b/stoc/source/corereflection/criface.cxx
@@ -817,7 +817,7 @@ void InterfaceIdlClassImpl::initMembers()
typelib_TypeDescription * pTD = 0;
typelib_typedescriptionreference_getDescription( &pTD, ppAllMembers[nPos] );
- OSL_ENSURE( pTD, "### cannot get type description!" );
+ assert(pTD && "### cannot get type description!");
pSortedMemberInit[nIndex].first = ((typelib_InterfaceMemberTypeDescription *)pTD)->pMemberName;
pSortedMemberInit[nIndex].second = pTD;
}
diff --git a/svtools/source/contnr/treelist.cxx b/svtools/source/contnr/treelist.cxx
index 362f93b4f42a..a8830a6587c3 100644
--- a/svtools/source/contnr/treelist.cxx
+++ b/svtools/source/contnr/treelist.cxx
@@ -596,7 +596,7 @@ sal_uLong SvTreeList::GetVisiblePos( const SvListView* pView, SvTreeListEntry* p
sal_uLong SvTreeList::GetVisibleCount( SvListView* pView ) const
{
- DBG_ASSERT(pView,"GetVisCount:No View");
+ assert(pView && "GetVisCount:No View");
if( !pView->HasViewData() )
return 0;
if ( pView->nVisibleCount )
diff --git a/svtools/source/contnr/treelistbox.cxx b/svtools/source/contnr/treelistbox.cxx
index 5d0eadfe7627..2f6bc55d6b95 100644
--- a/svtools/source/contnr/treelistbox.cxx
+++ b/svtools/source/contnr/treelistbox.cxx
@@ -3813,22 +3813,19 @@ void SvTreeListBox::ExcecuteContextMenuAction( sal_uInt16 )
void SvTreeListBox::EnableContextMenuHandling( void )
{
- DBG_ASSERT( pImp, "-SvTreeListBox::EnableContextMenuHandling(): No implementation!" );
-
+ assert(pImp && "-SvTreeListBox::EnableContextMenuHandling(): No implementation!");
pImp->bContextMenuHandling = true;
}
void SvTreeListBox::EnableContextMenuHandling( bool b )
{
- DBG_ASSERT( pImp, "-SvTreeListBox::EnableContextMenuHandling(): No implementation!" );
-
+ assert(pImp && "-SvTreeListBox::EnableContextMenuHandling(): No implementation!");
pImp->bContextMenuHandling = b;
}
bool SvTreeListBox::IsContextMenuHandlingEnabled( void ) const
{
- DBG_ASSERT( pImp, "-SvTreeListBox::IsContextMenuHandlingEnabled(): No implementation!" );
-
+ assert(pImp && "-SvTreeListBox::IsContextMenuHandlingEnabled(): No implementation!");
return pImp->bContextMenuHandling;
}
diff --git a/svtools/source/uno/unoevent.cxx b/svtools/source/uno/unoevent.cxx
index 627ea8f87f6d..a448ff70a52a 100644
--- a/svtools/source/uno/unoevent.cxx
+++ b/svtools/source/uno/unoevent.cxx
@@ -53,7 +53,7 @@ SvBaseEventDescriptor::SvBaseEventDescriptor( const SvEventDescription* pSupport
mpSupportedMacroItems(pSupportedMacroItems),
mnMacroItems(0)
{
- DBG_ASSERT(pSupportedMacroItems != NULL, "Need a list of supported events!");
+ assert(pSupportedMacroItems != NULL && "Need a list of supported events!");
for( ; mpSupportedMacroItems[mnMacroItems].mnEvent != 0; mnMacroItems++) ;
}
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index ab38de0db5ef..0c6e8ca63560 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -1917,7 +1917,7 @@ void SdrTextObj::onEditOutlinerStatusEvent( EditStatus* pEditStatus )
}
else if (IsAutoFit() && !mbInDownScale)
{
- OSL_ASSERT(pEdtOutl);
+ assert(pEdtOutl);
mbInDownScale = true;
// sucks that we cannot disable paints via
diff --git a/tools/source/inet/inetmime.cxx b/tools/source/inet/inetmime.cxx
index ff67d01d2a20..9f69e72a019a 100644
--- a/tools/source/inet/inetmime.cxx
+++ b/tools/source/inet/inetmime.cxx
@@ -2872,7 +2872,7 @@ void INetMIMEOutputSink::writeSequence(const sal_uInt32 * pBegin,
void INetMIMEOutputSink::writeSequence(const sal_Unicode * pBegin,
const sal_Unicode * pEnd)
{
- DBG_ASSERT(pBegin && pBegin <= pEnd,
+ assert(pBegin && pBegin <= pEnd &&
"INetMIMEOutputSink::writeSequence(): Bad sequence");
sal_Char * pBufferBegin = new sal_Char[pEnd - pBegin];
diff --git a/vcl/generic/print/genpspgraphics.cxx b/vcl/generic/print/genpspgraphics.cxx
index 1678852c0c14..d4072ed1188e 100644
--- a/vcl/generic/print/genpspgraphics.cxx
+++ b/vcl/generic/print/genpspgraphics.cxx
@@ -86,10 +86,10 @@ private:
virtual sal_uInt32 GetDepth () const SAL_OVERRIDE;
};
-SalPrinterBmp::SalPrinterBmp (BitmapBuffer* pBuffer) :
- mpBmpBuffer (pBuffer)
+SalPrinterBmp::SalPrinterBmp (BitmapBuffer* pBuffer)
+ : mpBmpBuffer(pBuffer)
{
- DBG_ASSERT (mpBmpBuffer, "SalPrinterBmp::SalPrinterBmp () can't acquire Bitmap");
+ assert(mpBmpBuffer && "SalPrinterBmp::SalPrinterBmp () can't acquire Bitmap");
// calibrate scanline buffer
if( BMP_SCANLINE_ADJUSTMENT( mpBmpBuffer->mnFormat ) == BMP_FORMAT_TOP_DOWN )