Kaydet (Commit) 0d78ad87 authored tarafından Caolán McNamara's avatar Caolán McNamara

DBG_ASSERT->assert when followed by dereference

Change-Id: Ic1c999ffdc391ea01be5711721e7c9e63179473e
üst 807b696c
......@@ -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);
}
......
......@@ -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 &&
......
......@@ -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;
}
......
......@@ -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 )
......
......@@ -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 );
......
......@@ -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;
......
......@@ -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();
}
......
......@@ -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 ) )
......
......@@ -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) {
......
......@@ -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);
......
......@@ -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);
......
......@@ -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;
......
......@@ -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);
}
......
......@@ -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 )
......
......@@ -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 )
......
......@@ -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;
}
......
......@@ -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 )
......
......@@ -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;
}
......
......@@ -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++) ;
}
......
......@@ -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
......
......@@ -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];
......
......@@ -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 )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment