diff options
author | Fakabbir Amin <fakabbir@gmail.com> | 2017-02-03 17:44:40 +0530 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2017-05-08 16:58:21 +0200 |
commit | f9f0b6ac12c5d6c73d9aa415a9de5e37105085d8 (patch) | |
tree | 315107b7aed634c4b74d4239093e529425f75fb8 | |
parent | f17d55e5495859b2a78ed625fc2573391e26cdf1 (diff) |
tdf#43157 Cleanup DBG_ASSERT in pstm.cxx
Change-Id: Ibc7b7399ccc827168768ee94b6e75e4116fc95c9
Reviewed-on: https://gerrit.libreoffice.org/33882
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
-rw-r--r-- | tools/source/ref/pstm.cxx | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/tools/source/ref/pstm.cxx b/tools/source/ref/pstm.cxx index c025ed96e132..5e9a7b450f3d 100644 --- a/tools/source/ref/pstm.cxx +++ b/tools/source/ref/pstm.cxx @@ -17,10 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <tools/debug.hxx> #include <tools/pstm.hxx> #include <rtl/strbuf.hxx> #include <osl/diagnose.h> +#include <sal/log.hxx> #define STOR_NO_OPTIMIZE @@ -29,7 +29,7 @@ void SvClassManager::Register( sal_Int32 nClassId, SvCreateInstancePersist pFunc #ifdef DBG_UTIL SvCreateInstancePersist p; p = Get( nClassId ); - DBG_ASSERT( !p || p == pFunc, "register class with same id" ); + assert( (!p || p == pFunc) && "register class with same id"); #endif aAssocTable.insert(Map::value_type(nClassId, pFunc)); } @@ -57,7 +57,6 @@ SvPersistStream::SvPersistStream( SvClassManager & rMgr, SvStream * pStream ) , aPUIdx( UniqueIndex<SvPersistBase>::Index(1) ) , nStartIdx( 1 ) { - DBG_ASSERT( nStartIdx != Index(0), "zero index not allowed" ); m_isWritable = true; if( pStm ) { @@ -80,13 +79,13 @@ SvPersistStream::~SvPersistStream() void SvPersistStream::ResetError() { SvStream::ResetError(); - DBG_ASSERT( pStm, "stream not set" ); + assert(pStm && "stream not set"); pStm->ResetError(); } std::size_t SvPersistStream::GetData( void* pData, std::size_t nSize ) { - DBG_ASSERT( pStm, "stream not set" ); + assert(pStm && "stream not set"); std::size_t const nRet = pStm->ReadBytes( pData, nSize ); SetError( pStm->GetError() ); return nRet; @@ -94,7 +93,7 @@ std::size_t SvPersistStream::GetData( void* pData, std::size_t nSize ) std::size_t SvPersistStream::PutData( const void* pData, std::size_t nSize ) { - DBG_ASSERT( pStm, "stream not set" ); + assert(pStm && "stream not set"); std::size_t const nRet = pStm->WriteBytes( pData, nSize ); SetError( pStm->GetError() ); return nRet; @@ -102,7 +101,7 @@ std::size_t SvPersistStream::PutData( const void* pData, std::size_t nSize ) sal_uInt64 SvPersistStream::SeekPos(sal_uInt64 const nPos) { - DBG_ASSERT( pStm, "stream not set" ); + assert(pStm && "stream not set"); sal_uInt64 nRet = pStm->Seek( nPos ); SetError( pStm->GetError() ); return nRet; @@ -446,8 +445,7 @@ void SvPersistStream::ReadObj { if( P_OBJ & nHdr ) { // read object, nId only set for P_DBGUTIL - DBG_ASSERT( !(nHdr & P_DBGUTIL) || nullptr == aPUIdx.Get( nId ), - "object already exist" ); + SAL_WARN_IF( (nHdr & P_DBGUTIL) && nullptr != aPUIdx.Get( nId ), "tools","object already exists"); SvCreateInstancePersist pFunc = rClassMgr.Get( nClassId ); sal_uInt32 nObjLen(0), nObjPos(0); @@ -474,8 +472,8 @@ void SvPersistStream::ReadObj const Index nNewId = aPUIdx.Insert( rpObj ); // in order to restore state after saving aPTable[ rpObj ] = nNewId; - DBG_ASSERT( !(nHdr & P_DBGUTIL) || nId == nNewId, - "read write id conflict: not the same" ); + SAL_WARN_IF( (nHdr & P_DBGUTIL) && (nId != nNewId), "tools","read write id conflict: not the same"); + rpObj->Load( *this ); #ifdef DBG_UTIL if( nObjLen + nObjPos != Tell() ) @@ -493,8 +491,8 @@ void SvPersistStream::ReadObj else { rpObj = GetObject( nId ); - DBG_ASSERT( rpObj != nullptr, "object does not exist" ); - DBG_ASSERT( rpObj->GetClassId() == nClassId, "class mismatch" ); + SAL_WARN_IF(rpObj==nullptr,"tools","object does not exist"); + SAL_WARN_IF( rpObj->GetClassId() != nClassId , "tools" , "class mismatch" ); } } } |