diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2015-11-10 10:24:17 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2015-11-10 10:31:40 +0100 |
commit | e246e5e3cf2722beb8a633259c0c395b498f58c6 (patch) | |
tree | a04f4d49e8f762a9ef780aceb20e81894ff185a3 /sot | |
parent | 2ee689b56a8ec09387e1fadcea3097537180e4a7 (diff) |
loplugin:nullptr (automatic rewrite)
Change-Id: I147f1ca886d5194d0e7180c427923225ef4ef927
Diffstat (limited to 'sot')
-rw-r--r-- | sot/source/base/factory.cxx | 14 | ||||
-rw-r--r-- | sot/source/base/formats.cxx | 2 | ||||
-rw-r--r-- | sot/source/base/object.cxx | 2 | ||||
-rw-r--r-- | sot/source/sdstor/stg.cxx | 34 | ||||
-rw-r--r-- | sot/source/sdstor/stgavl.cxx | 22 | ||||
-rw-r--r-- | sot/source/sdstor/stgcache.cxx | 10 | ||||
-rw-r--r-- | sot/source/sdstor/stgdir.cxx | 42 | ||||
-rw-r--r-- | sot/source/sdstor/stgio.cxx | 16 | ||||
-rw-r--r-- | sot/source/sdstor/stgstrms.cxx | 12 | ||||
-rw-r--r-- | sot/source/sdstor/stgstrms.hxx | 4 | ||||
-rw-r--r-- | sot/source/sdstor/storage.cxx | 24 | ||||
-rw-r--r-- | sot/source/sdstor/ucbstorage.cxx | 80 | ||||
-rw-r--r-- | sot/source/unoolestorage/register.cxx | 2 | ||||
-rw-r--r-- | sot/source/unoolestorage/xolesimplestorage.cxx | 8 |
14 files changed, 136 insertions, 136 deletions
diff --git a/sot/source/base/factory.cxx b/sot/source/base/factory.cxx index 3310739d5ec1..8111c2bc3f38 100644 --- a/sot/source/base/factory.cxx +++ b/sot/source/base/factory.cxx @@ -34,11 +34,11 @@ *************************************************************************/ SotData_Impl::SotData_Impl() : nSvObjCount( 0 ) - , pFactoryList( NULL ) - , pSotObjectFactory( NULL ) - , pSotStorageStreamFactory( NULL ) - , pSotStorageFactory( NULL ) - , pDataFlavorList( NULL ) + , pFactoryList( nullptr ) + , pSotObjectFactory( nullptr ) + , pSotStorageStreamFactory( nullptr ) + , pSotStorageFactory( nullptr ) + , pDataFlavorList( nullptr ) { } @@ -77,7 +77,7 @@ SotData_Impl * SOTDATA() SotFactory::SotFactory( const SvGlobalName & rName ) : SvGlobalName ( rName ) , nSuperCount ( 0 ) - , pSuperClasses ( NULL ) + , pSuperClasses ( nullptr ) { #ifdef DBG_UTIL SvGlobalName aEmptyName; @@ -123,7 +123,7 @@ const SotFactory* SotFactory::Find( const SvGlobalName & rFactName ) } } - return 0; + return nullptr; } #endif diff --git a/sot/source/base/formats.cxx b/sot/source/base/formats.cxx index 1230dc62ac96..948ee4ea8c40 100644 --- a/sot/source/base/formats.cxx +++ b/sot/source/base/formats.cxx @@ -1287,7 +1287,7 @@ static SotDestinationEntry_Impl const aDestinationArray[] = \ aEXCHG_DEST_SWDOC_FREE_AREA_WEB_Link \ }, \ { \ - static_cast<SotExchangeDest>(0xffff), 0, 0, 0, 0 \ + static_cast<SotExchangeDest>(0xffff), nullptr, nullptr, nullptr, nullptr \ } \ }; diff --git a/sot/source/base/object.cxx b/sot/source/base/object.cxx index 7c1054c5e97b..9f39e035736f 100644 --- a/sot/source/base/object.cxx +++ b/sot/source/base/object.cxx @@ -44,7 +44,7 @@ SotFactory * SotObject::ClassFactory() void * SotObject::Cast( const SotFactory * pFact ) { - void * pRet = NULL; + void * pRet = nullptr; if( !pFact || pFact == ClassFactory() ) pRet = this; return pRet; diff --git a/sot/source/sdstor/stg.cxx b/sot/source/sdstor/stg.cxx index 3ee94cfca56f..2c126466b3de 100644 --- a/sot/source/sdstor/stg.cxx +++ b/sot/source/sdstor/stg.cxx @@ -102,14 +102,14 @@ OLEStorageBase::~OLEStorageBase() pEntry->Close(); } - pEntry = NULL; + pEntry = nullptr; } if( pIo && !pIo->DecRef() ) { delete pIo; - pIo = NULL; + pIo = nullptr; } } @@ -339,7 +339,7 @@ bool Storage::IsStorageFile( SvStream* pStream ) TYPEINIT1( Storage, BaseStorage ); Storage::Storage( const OUString& rFile, StreamMode m, bool bDirect ) - : OLEStorageBase( new StgIo, NULL, m_nMode ) + : OLEStorageBase( new StgIo, nullptr, m_nMode ) , aName( rFile ), bIsRoot( false ) { bool bTemp = false; @@ -364,14 +364,14 @@ Storage::Storage( const OUString& rFile, StreamMode m, bool bDirect ) else { pIo->MoveError( *this ); - pEntry = NULL; + pEntry = nullptr; } } // Create a storage on a given stream. Storage::Storage( SvStream& r, bool bDirect ) - : OLEStorageBase( new StgIo, NULL, m_nMode ) + : OLEStorageBase( new StgIo, nullptr, m_nMode ) , bIsRoot( false ) { m_nMode = StreamMode::READ; @@ -394,20 +394,20 @@ Storage::Storage( SvStream& r, bool bDirect ) else { SetError( r.GetError() ); - pEntry = NULL; + pEntry = nullptr; } } Storage::Storage( UCBStorageStream& rStrm, bool bDirect ) - : OLEStorageBase( new StgIo, NULL, m_nMode ), bIsRoot( false ) + : OLEStorageBase( new StgIo, nullptr, m_nMode ), bIsRoot( false ) { m_nMode = StreamMode::READ; if ( rStrm.GetError() != SVSTREAM_OK ) { SetError( rStrm.GetError() ); - pEntry = NULL; + pEntry = nullptr; return; } @@ -416,7 +416,7 @@ Storage::Storage( UCBStorageStream& rStrm, bool bDirect ) { OSL_FAIL( "UCBStorageStream can not provide SvStream implementation!\n" ); SetError( SVSTREAM_GENERALERROR ); - pEntry = NULL; + pEntry = nullptr; return; } @@ -443,7 +443,7 @@ Storage::Storage( UCBStorageStream& rStrm, bool bDirect ) void Storage::Init( bool bCreate ) { - pEntry = NULL; + pEntry = nullptr; bool bHdrLoaded = false; bIsRoot = true; @@ -556,7 +556,7 @@ BaseStorage* Storage::OpenOLEStorage( const OUString& rName, StreamMode m, bool BaseStorage* Storage::OpenStorage( const OUString& rName, StreamMode m, bool bDirect ) { if( !Validate() || !ValidateMode( m ) ) - return new Storage( pIo, NULL, m ); + return new Storage( pIo, nullptr, m ); if( bDirect && !pEntry->m_bDirect ) bDirect = false; @@ -582,11 +582,11 @@ BaseStorage* Storage::OpenStorage( const OUString& rName, StreamMode m, bool bDi ? SVSTREAM_CANNOT_MAKE : SVSTREAM_FILE_NOT_FOUND ); } else if( !ValidateMode( m, p ) ) - p = NULL; + p = nullptr; if( p && p->m_aEntry.GetType() != STG_STORAGE ) { pIo->SetError( SVSTREAM_FILE_NOT_FOUND ); - p = NULL; + p = nullptr; } // Either direct or transacted mode is supported @@ -613,7 +613,7 @@ BaseStorageStream* Storage::OpenStream( const OUString& rName, StreamMode m, boo DBG_ASSERT(!pB, "Encryption not supported"); if( !Validate() || !ValidateMode( m ) ) - return new StorageStream( pIo, NULL, m ); + return new StorageStream( pIo, nullptr, m ); StgDirEntry* p = pIo->m_pTOC->Find( *pEntry, rName ); bool bTemp = false; if( !p ) @@ -635,11 +635,11 @@ BaseStorageStream* Storage::OpenStream( const OUString& rName, StreamMode m, boo ? SVSTREAM_CANNOT_MAKE : SVSTREAM_FILE_NOT_FOUND ); } else if( !ValidateMode( m, p ) ) - p = NULL; + p = nullptr; if( p && p->m_aEntry.GetType() != STG_STREAM ) { pIo->SetError( SVSTREAM_FILE_NOT_FOUND ); - p = NULL; + p = nullptr; } if( p ) { @@ -791,7 +791,7 @@ bool Storage::IsStream( const OUString& rName ) const bool Storage::IsContained( const OUString& rName ) const { if( Validate() ) - return pIo->m_pTOC->Find( *pEntry, rName ) != NULL; + return pIo->m_pTOC->Find( *pEntry, rName ) != nullptr; else return false; } diff --git a/sot/source/sdstor/stgavl.cxx b/sot/source/sdstor/stgavl.cxx index 536e7de31e18..a6a63bb967df 100644 --- a/sot/source/sdstor/stgavl.cxx +++ b/sot/source/sdstor/stgavl.cxx @@ -23,7 +23,7 @@ StgAvlNode::StgAvlNode() { - m_pLeft = m_pRight = NULL; + m_pLeft = m_pRight = nullptr; m_nBalance = m_nId = 0; } @@ -46,7 +46,7 @@ StgAvlNode* StgAvlNode::Find( StgAvlNode* pFind ) else p = ( nRes < 0 ) ? p->m_pLeft : p->m_pRight; } } - return NULL; + return nullptr; } // find point to add node to AVL tree and returns @@ -60,13 +60,13 @@ short StgAvlNode::Locate StgAvlNode* pCur = this; OSL_ENSURE( pPivot && pParent && pPrev, "The pointers may not be NULL!" ); - *pParent = *pPrev = NULL; + *pParent = *pPrev = nullptr; *pPivot = this; // search tree for insertion point if ( pFind ) { - while( pCur != NULL ) + while( pCur != nullptr ) { // check for pPivot if( pCur->m_nBalance != 0 ) @@ -224,11 +224,11 @@ StgAvlNode* StgAvlNode::Rem( StgAvlNode** p, StgAvlNode* pDel, bool bPtrs ) // Element found: remove if( !pCur->m_pRight ) { - *p = pCur->m_pLeft; pCur->m_pLeft = NULL; + *p = pCur->m_pLeft; pCur->m_pLeft = nullptr; } else if( !pCur->m_pLeft ) { - *p = pCur->m_pRight; pCur->m_pRight = NULL; + *p = pCur->m_pRight; pCur->m_pRight = nullptr; } else { @@ -250,7 +250,7 @@ StgAvlNode* StgAvlNode::Rem( StgAvlNode** p, StgAvlNode* pDel, bool bPtrs ) l->m_pRight = pCur->m_pRight; *p = l; // delete the element - pCur->m_pLeft = pCur->m_pRight = NULL; + pCur->m_pLeft = pCur->m_pRight = nullptr; } return pCur; } @@ -262,7 +262,7 @@ StgAvlNode* StgAvlNode::Rem( StgAvlNode** p, StgAvlNode* pDel, bool bPtrs ) return Rem( &pCur->m_pRight, pDel, bPtrs ); } } - return NULL; + return nullptr; } // Enumerate the tree for later iteration @@ -286,7 +286,7 @@ bool StgAvlNode::Insert( StgAvlNode** pRoot, StgAvlNode* pIns ) return false; // special case - empty tree - if( *pRoot == NULL ) + if( *pRoot == nullptr ) { *pRoot = pIns; return true; @@ -320,7 +320,7 @@ bool StgAvlNode::Insert( StgAvlNode** pRoot, StgAvlNode* pIns ) else pNewRoot = pPivot->RotRL(); // relink balanced subtree - if( pParent == NULL ) + if( pParent == nullptr ) *pRoot = pNewRoot; else if( pPivot == pParent->m_pLeft ) pParent->m_pLeft = pNewRoot; @@ -339,7 +339,7 @@ bool StgAvlNode::Remove( StgAvlNode** pRoot, StgAvlNode* pDel, bool bDel ) return false; // special case - empty tree - if( *pRoot == NULL ) + if( *pRoot == nullptr ) return false; // delete the element pDel = Rem( pRoot, pDel, false ); diff --git a/sot/source/sdstor/stgcache.cxx b/sot/source/sdstor/stgcache.cxx index d3b2ec2af99e..a92180ad2940 100644 --- a/sot/source/sdstor/stgcache.cxx +++ b/sot/source/sdstor/stgcache.cxx @@ -93,8 +93,8 @@ StgCache::StgCache() , m_nReplaceIdx( 0 ) , maLRUPages( 8 ) // entries in the LRU lookup , m_nPageSize( 512 ) - , m_pStorageStream( NULL ) - , m_pStrm( NULL ) + , m_pStorageStream( nullptr ) + , m_pStrm( nullptr ) , m_bMyStream( false ) , m_bFile( false ) { @@ -103,7 +103,7 @@ StgCache::StgCache() StgCache::~StgCache() { Clear(); - SetStrm( NULL, false ); + SetStrm( nullptr, false ); } void StgCache::SetPhysPageSize( short n ) @@ -243,7 +243,7 @@ void StgCache::SetStrm( SvStream* p, bool bMy ) if( m_pStorageStream ) { m_pStorageStream->ReleaseRef(); - m_pStorageStream = NULL; + m_pStorageStream = nullptr; } if( m_bMyStream ) @@ -261,7 +261,7 @@ void StgCache::SetStrm( UCBStorageStream* pStgStream ) if( m_bMyStream ) delete m_pStrm; - m_pStrm = NULL; + m_pStrm = nullptr; if ( m_pStorageStream ) { diff --git a/sot/source/sdstor/stgdir.cxx b/sot/source/sdstor/stgdir.cxx index c93dfe4edb3f..7436764c00bd 100644 --- a/sot/source/sdstor/stgdir.cxx +++ b/sot/source/sdstor/stgdir.cxx @@ -66,11 +66,11 @@ void StgDirEntry::InitMembers() { m_aSave = m_aEntry; m_pUp = - m_pDown = NULL; - m_ppRoot = NULL; - m_pStgStrm = NULL; + m_pDown = nullptr; + m_ppRoot = nullptr; + m_pStgStrm = nullptr; m_pCurStrm = - m_pTmpStrm = NULL; + m_pTmpStrm = nullptr; m_nPos = m_nEntry = m_nRefCnt = 0; @@ -162,7 +162,7 @@ void StgDirEntry::DelTemp( bool bForce ) StgAvlNode::Remove( reinterpret_cast<StgAvlNode**>(&m_pUp->m_pDown), this, bDel ); if( !bDel ) { - m_pLeft = m_pRight = m_pDown = 0; + m_pLeft = m_pRight = m_pDown = nullptr; m_bInvalid = m_bZombie = true; } } @@ -200,7 +200,7 @@ bool StgDirEntry::StoreStream( StgIo& rIo ) if( !m_pStgStrm ) { OpenStream( rIo ); - delete m_pStgStrm, m_pStgStrm = NULL; + delete m_pStgStrm, m_pStgStrm = nullptr; } else m_pStgStrm->SetSize( 0 ); @@ -285,7 +285,7 @@ void StgDirEntry::OpenStream( StgIo& rIo, bool bForceBig ) void StgDirEntry::Close() { delete m_pTmpStrm; - m_pTmpStrm = NULL; + m_pTmpStrm = nullptr; // nRefCnt = 0; m_bInvalid = m_bTemp; } @@ -333,7 +333,7 @@ bool StgDirEntry::SetSize( sal_Int32 nNewSize ) StgIo& rIo = m_pStgStrm->GetIo(); sal_Int32 nThreshold = rIo.m_aHdr.GetThreshold(); // ensure the correct storage stream! - StgStrm* pOld = NULL; + StgStrm* pOld = nullptr; sal_uInt16 nOldSize = 0; if( nNewSize >= nThreshold && m_pStgStrm->IsSmallStrm() ) { @@ -532,7 +532,7 @@ bool StgDirEntry::Commit() if( m_aEntry.GetType() == STG_STREAM ) { if( m_pTmpStrm ) - delete m_pCurStrm, m_pCurStrm = m_pTmpStrm, m_pTmpStrm = NULL; + delete m_pCurStrm, m_pCurStrm = m_pTmpStrm, m_pTmpStrm = nullptr; if( m_bRemoved ) // Delete the stream if needed if( m_pStgStrm ) @@ -603,7 +603,7 @@ bool StgDirEntry::Strm2Tmp() m_pStgStrm->GetIo().SetError( m_pTmpStrm->GetError() ); delete m_pTmpStrm; - m_pTmpStrm = NULL; + m_pTmpStrm = nullptr; return false; } } @@ -616,7 +616,7 @@ bool StgDirEntry::Tmp2Strm() { // We did commit once, but have not written since then if( !m_pTmpStrm ) - m_pTmpStrm = m_pCurStrm, m_pCurStrm = NULL; + m_pTmpStrm = m_pCurStrm, m_pCurStrm = nullptr; if( m_pTmpStrm ) { OSL_ENSURE( m_pStgStrm, "The pointer may not be NULL!" ); @@ -661,7 +661,7 @@ bool StgDirEntry::Tmp2Strm() pNewStrm->Pos2Page( m_nPos ); delete m_pTmpStrm; delete m_pCurStrm; - m_pTmpStrm = m_pCurStrm = NULL; + m_pTmpStrm = m_pCurStrm = nullptr; m_aSave = m_aEntry; } } @@ -720,7 +720,7 @@ void StgDirEntry::Invalidate( bool bDel ) StgDirStrm::StgDirStrm( StgIo& r ) : StgDataStrm( r, r.m_aHdr.GetTOCStart(), -1 ) - , m_pRoot( NULL ) + , m_pRoot( nullptr ) , m_nEntries( 0 ) { if( r.GetError() ) @@ -741,7 +741,7 @@ StgDirStrm::StgDirStrm( StgIo& r ) // the TOC pages can be removed. m_pEntry = reinterpret_cast<StgDirEntry*>(this); // just for a bit pattern SetupEntry( 0, m_pRoot ); - m_pEntry = NULL; + m_pEntry = nullptr; } } @@ -754,7 +754,7 @@ StgDirStrm::~StgDirStrm() void StgDirStrm::SetupEntry( sal_Int32 n, StgDirEntry* pUpper ) { - void* p = ( n == STG_FREE ) ? NULL : GetEntry( n ); + void* p = ( n == STG_FREE ) ? nullptr : GetEntry( n ); if( p ) { SvStream *pUnderlyingStream = m_rIo.GetStrm(); @@ -916,7 +916,7 @@ bool StgDirStrm::Store() void* StgDirStrm::GetEntry( sal_Int32 n, bool bDirty ) { return n < 0 || n >= m_nSize / STGENTRY_SIZE - ? NULL : GetPtr( n * STGENTRY_SIZE, true, bDirty ); + ? nullptr : GetPtr( n * STGENTRY_SIZE, true, bDirty ); } // Find a dir entry. @@ -930,14 +930,14 @@ StgDirEntry* StgDirStrm::Find( StgDirEntry& rStg, const OUString& rName ) if( !aEntry.SetName( rName ) ) { m_rIo.SetError( SVSTREAM_GENERALERROR ); - return NULL; + return nullptr; } // Look in the directory attached to the entry StgDirEntry aTest( aEntry ); return static_cast<StgDirEntry*>( rStg.m_pDown->Find( &aTest ) ); } else - return NULL; + return nullptr; } // Create a new entry. @@ -950,7 +950,7 @@ StgDirEntry* StgDirStrm::Create( StgDirEntry& rStg, const OUString& rName, StgEn if( !aEntry.SetName( rName ) ) { m_rIo.SetError( SVSTREAM_GENERALERROR ); - return NULL; + return nullptr; } StgDirEntry* pRes = Find( rStg, rName ); if( pRes ) @@ -958,7 +958,7 @@ StgDirEntry* StgDirStrm::Create( StgDirEntry& rStg, const OUString& rName, StgEn if( !pRes->m_bInvalid ) { m_rIo.SetError( SVSTREAM_CANNOT_MAKE ); - return NULL; + return nullptr; } pRes->m_bInvalid = pRes->m_bRemoved = @@ -979,7 +979,7 @@ StgDirEntry* StgDirStrm::Create( StgDirEntry& rStg, const OUString& rName, StgEn else { m_rIo.SetError( SVSTREAM_CANNOT_MAKE ); - delete pRes; pRes = NULL; + delete pRes; pRes = nullptr; } } return pRes; diff --git a/sot/source/sdstor/stgio.cxx b/sot/source/sdstor/stgio.cxx index 538a3c2d517a..3ae6b11b5468 100644 --- a/sot/source/sdstor/stgio.cxx +++ b/sot/source/sdstor/stgio.cxx @@ -32,10 +32,10 @@ StgIo::StgIo() : StgCache() { - m_pTOC = NULL; - m_pDataFAT = NULL; - m_pDataStrm = NULL; - m_pFAT = NULL; + m_pTOC = nullptr; + m_pDataFAT = nullptr; + m_pDataStrm = nullptr; + m_pFAT = nullptr; m_bCopied = false; } @@ -81,10 +81,10 @@ void StgIo::SetupStreams() delete m_pDataFAT; delete m_pDataStrm; delete m_pFAT; - m_pTOC = NULL; - m_pDataFAT = NULL; - m_pDataStrm = NULL; - m_pFAT = NULL; + m_pTOC = nullptr; + m_pDataFAT = nullptr; + m_pDataStrm = nullptr; + m_pFAT = nullptr; ResetError(); SetPhysPageSize( 1 << m_aHdr.GetPageSize() ); m_pFAT = new StgFATStrm( *this ); diff --git a/sot/source/sdstor/stgstrms.cxx b/sot/source/sdstor/stgstrms.cxx index 4367fc743b8b..a67a663101f4 100644 --- a/sot/source/sdstor/stgstrms.cxx +++ b/sot/source/sdstor/stgstrms.cxx @@ -307,10 +307,10 @@ bool StgFAT::FreePages( sal_Int32 nStart, bool bAll ) StgStrm::StgStrm( StgIo& r ) : m_rIo( r ) { - m_pFat = NULL; + m_pFat = nullptr; m_nStart = m_nPage = STG_EOF; m_nOffset = 0; - m_pEntry = NULL; + m_pEntry = nullptr; m_nPos = m_nSize = 0; m_nPageSize = m_rIo.GetPhysPageSize(); } @@ -663,7 +663,7 @@ bool StgFATStrm::SetPage( short nOff, sal_Int32 nNewPage ) { if( nFAT == STG_EOF || nFAT == STG_FREE ) { - pMaster = 0; + pMaster = nullptr; break; } pMaster = m_rIo.Get( nFAT, true ); @@ -870,7 +870,7 @@ void* StgDataStrm::GetPtr( sal_Int32 Pos, bool bForce, bool bDirty ) return static_cast<sal_uInt8 *>(pPg->GetData()) + m_nOffset; } } - return NULL; + return nullptr; } // This could easily be adapted to a better algorithm by determining @@ -1116,7 +1116,7 @@ StgTmpStrm::StgTmpStrm( sal_uInt64 nInitSize ) ? 16 : ( nInitSize ? nInitSize : 16 ), 4096 ) { - m_pStrm = NULL; + m_pStrm = nullptr; // this calls FlushData, so all members should be set by this time SetBufferSize( 0 ); if( nInitSize > THRESHOLD ) @@ -1183,7 +1183,7 @@ void StgTmpStrm::SetSize(sal_uInt64 n) { if( n > THRESHOLD ) { - m_aName = utl::TempFile(0, false).GetURL(); + m_aName = utl::TempFile(nullptr, false).GetURL(); SvFileStream* s = new SvFileStream( m_aName, STREAM_READWRITE ); const sal_uInt64 nCur = Tell(); sal_uInt64 i = nEndOfData; diff --git a/sot/source/sdstor/stgstrms.hxx b/sot/source/sdstor/stgstrms.hxx index 2ce3ff3f5b0e..ad544f032a93 100644 --- a/sot/source/sdstor/stgstrms.hxx +++ b/sot/source/sdstor/stgstrms.hxx @@ -71,7 +71,7 @@ protected: short m_nOffset; // offset into current page short m_nPageSize; // logical page size std::vector<sal_Int32> m_aPagesCache; - void scanBuildPageChainCache(sal_Int32 *pOptionalCalcSize = NULL); + void scanBuildPageChainCache(sal_Int32 *pOptionalCalcSize = nullptr); bool Copy( sal_Int32 nFrom, sal_Int32 nBytes ); explicit StgStrm( StgIo& ); public: @@ -102,7 +102,7 @@ public: explicit StgFATStrm( StgIo& ); virtual ~StgFATStrm() {} using StgStrm::GetPage; - sal_Int32 GetPage( short, bool, sal_uInt16 *pnMasterAlloc = 0); + sal_Int32 GetPage( short, bool, sal_uInt16 *pnMasterAlloc = nullptr); virtual bool SetSize( sal_Int32 ) override; }; diff --git a/sot/source/sdstor/storage.cxx b/sot/source/sdstor/storage.cxx index 75f98de9619f..df13786b3158 100644 --- a/sot/source/sdstor/storage.cxx +++ b/sot/source/sdstor/storage.cxx @@ -64,7 +64,7 @@ SotFactory * SotStorageStream::ClassFactory() void * SotStorageStream::Cast( const SotFactory * pFact ) { - void * pRet = NULL; + void * pRet = nullptr; if( !pFact || pFact == ClassFactory() ) pRet = this; if( !pRet ) @@ -90,7 +90,7 @@ SvLockBytesRef MakeLockBytes_Impl( const OUString & rName, StreamMode nMode ) SotStorageStream::SotStorageStream( const OUString & rName, StreamMode nMode ) : SvStream( MakeLockBytes_Impl( rName, nMode ) ) - , pOwnStm( NULL ) + , pOwnStm( nullptr ) { if( nMode & StreamMode::WRITE ) m_isWritable = true; @@ -113,14 +113,14 @@ SotStorageStream::SotStorageStream( BaseStorageStream * pStm ) } else { - pOwnStm = NULL; + pOwnStm = nullptr; m_isWritable = true; SetError( SVSTREAM_INVALID_PARAMETER ); } } SotStorageStream::SotStorageStream() - : pOwnStm( NULL ) + : pOwnStm( nullptr ) { // ??? wenn Init virtuell ist, entsprechen setzen m_isWritable = true; @@ -313,7 +313,7 @@ SotFactory * SotStorage::ClassFactory() void * SotStorage::Cast( const SotFactory * pFact ) { - void * pRet = NULL; + void * pRet = nullptr; if( !pFact || pFact == ClassFactory() ) pRet = this; if( !pRet ) @@ -343,8 +343,8 @@ void * SotStorage::Cast( const SotFactory * pFact ) |* *************************************************************************/ #define INIT_SotStorage() \ - : m_pOwnStg( NULL ) \ - , m_pStorStm( NULL ) \ + : m_pOwnStg( nullptr ) \ + , m_pStorStm( nullptr ) \ , m_nError( SVSTREAM_OK ) \ , m_bIsRoot( false ) \ , m_bDelStm( false ) \ @@ -543,7 +543,7 @@ SotStorage::~SotStorage() SvMemoryStream * SotStorage::CreateMemoryStream() { - SvMemoryStream * pStm = NULL; + SvMemoryStream * pStm = nullptr; pStm = new SvMemoryStream( 0x8000, 0x8000 ); tools::SvRef<SotStorage> aStg = new SotStorage( *pStm ); if( CopyTo( aStg ) ) @@ -554,7 +554,7 @@ SvMemoryStream * SotStorage::CreateMemoryStream() { aStg.Clear(); // Storage vorher freigeben delete pStm; - pStm = NULL; + pStm = nullptr; } return pStm; } @@ -688,7 +688,7 @@ bool SotStorage::Commit() SotStorageStream * SotStorage::OpenSotStream( const OUString & rEleName, StreamMode nMode ) { - SotStorageStream * pStm = NULL; + SotStorageStream * pStm = nullptr; DBG_ASSERT( Owner(), "must be owner" ); if( m_pOwnStg ) { @@ -732,7 +732,7 @@ SotStorage * SotStorage::OpenSotStorage( const OUString & rEleName, SetError( SVSTREAM_GENERALERROR ); - return NULL; + return nullptr; } bool SotStorage::IsStorage( const OUString & rEleName ) const @@ -832,7 +832,7 @@ SotStorage* SotStorage::OpenOLEStorage( const css::uno::Reference < css::embed:: if ( nMode & StreamMode::NOCREATE ) nEleMode |= embed::ElementModes::NOCREATE; - SvStream* pStream = NULL; + SvStream* pStream = nullptr; try { uno::Reference < io::XStream > xStream = xStorage->openStreamElement( rEleName, nEleMode ); diff --git a/sot/source/sdstor/ucbstorage.cxx b/sot/source/sdstor/ucbstorage.cxx index 9093d510ca81..178446bde51a 100644 --- a/sot/source/sdstor/ucbstorage.cxx +++ b/sot/source/sdstor/ucbstorage.cxx @@ -109,7 +109,7 @@ protected: FileStreamWrapper_Impl::FileStreamWrapper_Impl( const OUString& rName ) : m_aURL( rName ) - , m_pSvStream(0) + , m_pSvStream(nullptr) { // if no URL is provided the stream is empty } @@ -438,7 +438,7 @@ public: // reference is destroyed bool m_bIsOLEStorage;// an OLEStorage on a UCBStorageStream makes this an Autocommit-stream - UCBStorageStream_Impl( const OUString&, StreamMode, UCBStorageStream*, bool, const OString* pKey=0, + UCBStorageStream_Impl( const OUString&, StreamMode, UCBStorageStream*, bool, const OString* pKey=nullptr, bool bRepair = false, Reference< XProgressHandler > xProgress = Reference< XProgressHandler >() ); void Free(); @@ -510,7 +510,7 @@ public: bool Revert(); bool Insert( ::ucbhelper::Content *pContent ); UCBStorage_Impl* OpenStorage( UCBStorageElement_Impl* pElement, StreamMode nMode, bool bDirect ); - UCBStorageStream_Impl* OpenStream( UCBStorageElement_Impl*, StreamMode, bool, const OString* pKey=0 ); + UCBStorageStream_Impl* OpenStream( UCBStorageElement_Impl*, StreamMode, bool, const OString* pKey=nullptr ); void SetProps( const Sequence < Sequence < PropertyValue > >& rSequence, const OUString& ); void GetProps( sal_Int32&, Sequence < Sequence < PropertyValue > >& rSequence, const OUString& ); sal_Int32 GetObjectCount(); @@ -584,7 +584,7 @@ struct UCBStorageElement_Impl else if ( m_xStorage.Is() ) return m_xStorage->GetContent(); else - return NULL; + return nullptr; } OUString UCBStorageElement_Impl::GetContentType() @@ -640,8 +640,8 @@ bool UCBStorageElement_Impl::IsModified() UCBStorageStream_Impl::UCBStorageStream_Impl( const OUString& rName, StreamMode nMode, UCBStorageStream* pStream, bool bDirect, const OString* pKey, bool bRepair, Reference< XProgressHandler > xProgress ) : m_pAntiImpl( pStream ) , m_aURL( rName ) - , m_pContent( NULL ) - , m_pStream( NULL ) + , m_pContent( nullptr ) + , m_pStream( nullptr ) , m_nRepresentMode( nonset ) , m_nError( 0 ) , m_nMode( nMode ) @@ -1208,7 +1208,7 @@ bool UCBStorageStream_Impl::Revert() bool UCBStorageStream_Impl::Clear() { - bool bRet = ( m_pAntiImpl == NULL ); + bool bRet = ( m_pAntiImpl == nullptr ); DBG_ASSERT( bRet, "Removing used stream!" ); if( bRet ) { @@ -1281,7 +1281,7 @@ UCBStorageStream::~UCBStorageStream() { if ( pImp->m_nMode & StreamMode::WRITE ) pImp->Flush(); - pImp->m_pAntiImpl = NULL; + pImp->m_pAntiImpl = nullptr; pImp->Free(); pImp->ReleaseRef(); } @@ -1506,15 +1506,15 @@ UCBStorage::~UCBStorage() // DirectMode is simulated with an AutoCommit Commit(); - pImp->m_pAntiImpl = NULL; + pImp->m_pAntiImpl = nullptr; pImp->ReleaseRef(); } UCBStorage_Impl::UCBStorage_Impl( const ::ucbhelper::Content& rContent, const OUString& rName, StreamMode nMode, UCBStorage* pStorage, bool bDirect, bool bIsRoot, bool bIsRepair, Reference< XProgressHandler > xProgressHandler ) : m_pAntiImpl( pStorage ) , m_pContent( new ::ucbhelper::Content( rContent ) ) - , m_pTempFile( NULL ) - , m_pSource( NULL ) + , m_pTempFile( nullptr ) + , m_pSource( nullptr ) //, m_pStream( NULL ) , m_nError( 0 ) , m_nMode( nMode ) @@ -1545,9 +1545,9 @@ UCBStorage_Impl::UCBStorage_Impl( const ::ucbhelper::Content& rContent, const OU UCBStorage_Impl::UCBStorage_Impl( const OUString& rName, StreamMode nMode, UCBStorage* pStorage, bool bDirect, bool bIsRoot, bool bIsRepair, Reference< XProgressHandler > xProgressHandler ) : m_pAntiImpl( pStorage ) - , m_pContent( NULL ) - , m_pTempFile( NULL ) - , m_pSource( NULL ) + , m_pContent( nullptr ) + , m_pTempFile( nullptr ) + , m_pSource( nullptr ) //, m_pStream( NULL ) , m_nError( 0 ) , m_nMode( nMode ) @@ -1583,7 +1583,7 @@ UCBStorage_Impl::UCBStorage_Impl( const OUString& rName, StreamMode nMode, UCBSt if ( m_nMode & StreamMode::WRITE ) { // the root storage opens the package, so make sure that there is any - SvStream* pStream = ::utl::UcbStreamHelper::CreateStream( aName, STREAM_STD_READWRITE, m_pTempFile != 0 /* bFileExists */ ); + SvStream* pStream = ::utl::UcbStreamHelper::CreateStream( aName, STREAM_STD_READWRITE, m_pTempFile != nullptr /* bFileExists */ ); delete pStream; } } @@ -1598,7 +1598,7 @@ UCBStorage_Impl::UCBStorage_Impl( const OUString& rName, StreamMode nMode, UCBSt UCBStorage_Impl::UCBStorage_Impl( SvStream& rStream, UCBStorage* pStorage, bool bDirect ) : m_pAntiImpl( pStorage ) - , m_pContent( NULL ) + , m_pContent( nullptr ) , m_pTempFile( new ::utl::TempFile ) , m_pSource( &rStream ) , m_nError( 0 ) @@ -1685,8 +1685,8 @@ void UCBStorage_Impl::Init() Sequence < Sequence < PropertyValue > > aProps = xReader->readManifestSequence( xInputStream ); // cleanup - xReader = NULL; - xInputStream = NULL; + xReader = nullptr; + xInputStream = nullptr; SetProps( aProps, OUString() ); } } @@ -2265,8 +2265,8 @@ sal_Int16 UCBStorage_Impl::Commit() // move the stream to its desired location Content aSource( pTempFile->GetURL(), Reference < XCommandEnvironment >(), comphelper::getProcessComponentContext() ); - xWriter = NULL; - xOutputStream = NULL; + xWriter = nullptr; + xOutputStream = nullptr; pTempFile.reset(); aNewSubFolder.transferContent( aSource, InsertOperation_MOVE, "manifest.xml", NameClash::OVERWRITE ); } @@ -2280,7 +2280,7 @@ sal_Int16 UCBStorage_Impl::Commit() // force writing Any aAny; m_pContent->executeCommand( "flush", aAny ); - if ( m_pSource != 0 ) + if ( m_pSource != nullptr ) { std::unique_ptr<SvStream> pStream(::utl::UcbStreamHelper::CreateStream( m_pTempFile->GetURL(), STREAM_STD_READ )); m_pSource->SetStreamSize(0); @@ -2497,7 +2497,7 @@ bool UCBStorage::CopyStorageElement_Impl( UCBStorageElement_Impl& rElement, Base // copy the streams data // the destination stream must not be open std::unique_ptr<BaseStorageStream> pOtherStream(pDest->OpenStream( rNew, StreamMode::WRITE | StreamMode::SHARE_DENYALL, pImp->m_bDirect )); - BaseStorageStream* pStream = NULL; + BaseStorageStream* pStream = nullptr; bool bDeleteStream = false; // if stream is already open, it is allowed to copy it, so be aware of this @@ -2523,7 +2523,7 @@ bool UCBStorage::CopyStorageElement_Impl( UCBStorageElement_Impl& rElement, Base { // copy the storage content // the destination storage must not be open - BaseStorage* pStorage = NULL; + BaseStorage* pStorage = nullptr; // if stream is already open, it is allowed to copy it, so be aware of this bool bDeleteStorage = false; @@ -2574,7 +2574,7 @@ UCBStorageElement_Impl* UCBStorage::FindElement_Impl( const OUString& rName ) co if ( pElement->m_aName == rName && !pElement->m_bIsRemoved ) return pElement; } - return NULL; + return nullptr; } bool UCBStorage::CopyTo( BaseStorage* pDestStg ) const @@ -2651,7 +2651,7 @@ bool UCBStorage::Revert() BaseStorageStream* UCBStorage::OpenStream( const OUString& rEleName, StreamMode nMode, bool bDirect, const OString* pKey ) { if( rEleName.isEmpty() ) - return NULL; + return nullptr; // try to find the storage element UCBStorageElement_Impl *pElement = FindElement_Impl( rEleName ); @@ -2688,7 +2688,7 @@ BaseStorageStream* UCBStorage::OpenStream( const OUString& rEleName, StreamMode { OSL_FAIL("Stream is already open!" ); SetError( SVSTREAM_ACCESS_DENIED ); // ??? - return NULL; + return nullptr; } else { @@ -2714,7 +2714,7 @@ BaseStorageStream* UCBStorage::OpenStream( const OUString& rEleName, StreamMode return new UCBStorageStream( pElement->m_xStream ); } - return NULL; + return nullptr; } UCBStorageStream_Impl* UCBStorage_Impl::OpenStream( UCBStorageElement_Impl* pElement, StreamMode nMode, bool bDirect, const OString* pKey ) @@ -2722,14 +2722,14 @@ UCBStorageStream_Impl* UCBStorage_Impl::OpenStream( UCBStorageElement_Impl* pEle OUString aName( m_aURL ); aName += "/"; aName += pElement->m_aOriginalName; - pElement->m_xStream = new UCBStorageStream_Impl( aName, nMode, NULL, bDirect, pKey, m_bRepairPackage, m_xProgressHandler ); + pElement->m_xStream = new UCBStorageStream_Impl( aName, nMode, nullptr, bDirect, pKey, m_bRepairPackage, m_xProgressHandler ); return pElement->m_xStream; } BaseStorage* UCBStorage::OpenUCBStorage( const OUString& rEleName, StreamMode nMode, bool bDirect ) { if( rEleName.isEmpty() ) - return NULL; + return nullptr; return OpenStorage_Impl( rEleName, nMode, bDirect, true ); } @@ -2737,7 +2737,7 @@ BaseStorage* UCBStorage::OpenUCBStorage( const OUString& rEleName, StreamMode nM BaseStorage* UCBStorage::OpenOLEStorage( const OUString& rEleName, StreamMode nMode, bool bDirect ) { if( rEleName.isEmpty() ) - return NULL; + return nullptr; return OpenStorage_Impl( rEleName, nMode, bDirect, false ); } @@ -2745,7 +2745,7 @@ BaseStorage* UCBStorage::OpenOLEStorage( const OUString& rEleName, StreamMode nM BaseStorage* UCBStorage::OpenStorage( const OUString& rEleName, StreamMode nMode, bool bDirect ) { if( rEleName.isEmpty() ) - return NULL; + return nullptr; return OpenStorage_Impl( rEleName, nMode, bDirect, true ); } @@ -2791,7 +2791,7 @@ BaseStorage* UCBStorage::OpenStorage_Impl( const OUString& rEleName, StreamMode if ( !pStream ) { SetError( ( nMode & StreamMode::WRITE ) ? SVSTREAM_CANNOT_MAKE : SVSTREAM_FILE_NOT_FOUND ); - return NULL; + return nullptr; } pElement->m_xStream = pStream->pImp; @@ -2803,7 +2803,7 @@ BaseStorage* UCBStorage::OpenStorage_Impl( const OUString& rEleName, StreamMode if (!bInited) { SetError( ( nMode & StreamMode::WRITE ) ? SVSTREAM_CANNOT_MAKE : SVSTREAM_FILE_NOT_FOUND ); - return NULL; + return nullptr; } pElement->m_bIsStorage = true; @@ -2851,7 +2851,7 @@ BaseStorage* UCBStorage::OpenStorage_Impl( const OUString& rEleName, StreamMode if ( !bRet ) { SetError( SVSTREAM_CANNOT_MAKE ); - return NULL; + return nullptr; } } @@ -2865,12 +2865,12 @@ BaseStorage* UCBStorage::OpenStorage_Impl( const OUString& rEleName, StreamMode } } - return NULL; + return nullptr; } UCBStorage_Impl* UCBStorage_Impl::OpenStorage( UCBStorageElement_Impl* pElement, StreamMode nMode, bool bDirect ) { - UCBStorage_Impl* pRet = NULL; + UCBStorage_Impl* pRet = nullptr; OUString aName( m_aURL ); aName += "/"; aName += pElement->m_aOriginalName; // ??? @@ -2882,11 +2882,11 @@ UCBStorage_Impl* UCBStorage_Impl::OpenStorage( UCBStorageElement_Impl* pElement, Content aNewFolder; bool bRet = ::utl::UCBContentHelper::MakeFolder( *m_pContent, pElement->m_aOriginalName, aNewFolder ); if ( bRet ) - pRet = new UCBStorage_Impl( aNewFolder, aName, nMode, NULL, bDirect, false, m_bRepairPackage, m_xProgressHandler ); + pRet = new UCBStorage_Impl( aNewFolder, aName, nMode, nullptr, bDirect, false, m_bRepairPackage, m_xProgressHandler ); } else { - pRet = new UCBStorage_Impl( aName, nMode, NULL, bDirect, false, m_bRepairPackage, m_xProgressHandler ); + pRet = new UCBStorage_Impl( aName, nMode, nullptr, bDirect, false, m_bRepairPackage, m_xProgressHandler ); } if ( pRet ) @@ -2928,7 +2928,7 @@ bool UCBStorage::IsContained( const OUString & rEleName ) const if( rEleName.isEmpty() ) return false; const UCBStorageElement_Impl *pElement = FindElement_Impl( rEleName ); - return ( pElement != NULL ); + return ( pElement != nullptr ); } bool UCBStorage::Remove( const OUString& rEleName ) @@ -2944,7 +2944,7 @@ bool UCBStorage::Remove( const OUString& rEleName ) else SetError( SVSTREAM_FILE_NOT_FOUND ); - return ( pElement != NULL ); + return ( pElement != nullptr ); } bool UCBStorage::ValidateFAT() diff --git a/sot/source/unoolestorage/register.cxx b/sot/source/unoolestorage/register.cxx index df55fa0f98cb..1c6531105f27 100644 --- a/sot/source/unoolestorage/register.cxx +++ b/sot/source/unoolestorage/register.cxx @@ -32,7 +32,7 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL sot_component_getFactory( const sal_Char * pImplName, void * pServiceManager, SAL_UNUSED_PARAMETER void * /*pRegistryKey*/ ) { - void * pRet = 0; + void * pRet = nullptr; OUString aImplName( OUString::createFromAscii( pImplName ) ); uno::Reference< lang::XSingleServiceFactory > xFactory; diff --git a/sot/source/unoolestorage/xolesimplestorage.cxx b/sot/source/unoolestorage/xolesimplestorage.cxx index 3c180c51ed9f..280d0a57f9c2 100644 --- a/sot/source/unoolestorage/xolesimplestorage.cxx +++ b/sot/source/unoolestorage/xolesimplestorage.cxx @@ -46,9 +46,9 @@ const sal_Int32 nBytesCount = 32000; OLESimpleStorage::OLESimpleStorage( uno::Reference< lang::XMultiServiceFactory > xFactory ) : m_bDisposed( false ) -, m_pStream( NULL ) -, m_pStorage( NULL ) -, m_pListenersContainer( NULL ) +, m_pStream( nullptr ) +, m_pStorage( nullptr ) +, m_pListenersContainer( nullptr ) , m_xFactory( xFactory ) , m_bNoTemporaryCopy( false ) { @@ -69,7 +69,7 @@ OLESimpleStorage::~OLESimpleStorage() if ( m_pListenersContainer ) { delete m_pListenersContainer; - m_pListenersContainer = NULL; + m_pListenersContainer = nullptr; } } |