diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2015-11-10 10:10:36 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2015-11-10 10:31:17 +0100 |
commit | 08e49fa3377d8c4e7e5df7a32233fcd9763ee936 (patch) | |
tree | f06399e5a005a70612093f415bd02ea2d1ba719f /basic/source/basmgr | |
parent | a17cde058213f962b8de880de6f5b1e4f2061b37 (diff) |
loplugin:nullptr (automatic rewrite)
Change-Id: I1ec9a671fe3ac838feb36297915e3cdf8749d944
Diffstat (limited to 'basic/source/basmgr')
-rw-r--r-- | basic/source/basmgr/basicmanagerrepository.cxx | 20 | ||||
-rw-r--r-- | basic/source/basmgr/basmgr.cxx | 60 |
2 files changed, 40 insertions, 40 deletions
diff --git a/basic/source/basmgr/basicmanagerrepository.cxx b/basic/source/basmgr/basicmanagerrepository.cxx index 3ec9ed4f8bf0..1b3ca26af456 100644 --- a/basic/source/basmgr/basicmanagerrepository.cxx +++ b/basic/source/basmgr/basicmanagerrepository.cxx @@ -225,7 +225,7 @@ namespace basic without creating another instance. */ BasicManager*& pBasicManager = impl_getLocationForModel( _rxDocumentModel ); - if ( pBasicManager == NULL ) + if ( pBasicManager == nullptr ) impl_createManagerForModel( pBasicManager, _rxDocumentModel ); return pBasicManager; @@ -237,7 +237,7 @@ namespace basic SolarMutexGuard g; BasicManager* pAppManager = GetSbData()->pAppBasMgr; - if ( ( pAppManager == NULL ) && _bCreate ) + if ( ( pAppManager == nullptr ) && _bCreate ) pAppManager = impl_createApplicationBasicManager(); return pAppManager; @@ -259,7 +259,7 @@ namespace basic { SolarMutexGuard g; - OSL_PRECOND( getApplicationBasicManager( false ) == NULL, "ImplRepository::impl_createApplicationBasicManager: there already is one!" ); + OSL_PRECOND( getApplicationBasicManager( false ) == nullptr, "ImplRepository::impl_createApplicationBasicManager: there already is one!" ); // Determine Directory SvtPathOptions aPathCFG; @@ -308,7 +308,7 @@ namespace basic // (BasicLibraries and DialogLibraries have automatically been added in SetLibraryContainerInfo) // notify - impl_notifyCreationListeners( NULL, *pBasicManager ); + impl_notifyCreationListeners( nullptr, *pBasicManager ); // outta here return pBasicManager; @@ -352,8 +352,8 @@ namespace basic { BasicManager* pAppManager = getApplicationBasicManager( true ); - StarBASIC* pAppBasic = pAppManager ? pAppManager->GetLib(0) : NULL; - DBG_ASSERT( pAppBasic != NULL, "impl_getApplicationBasic: unable to determine the default application's Basic library!" ); + StarBASIC* pAppBasic = pAppManager ? pAppManager->GetLib(0) : nullptr; + DBG_ASSERT( pAppBasic != nullptr, "impl_getApplicationBasic: unable to determine the default application's Basic library!" ); return pAppBasic; } @@ -398,7 +398,7 @@ namespace basic { StarBASIC* pAppBasic = impl_getDefaultAppBasicLibrary(); - _out_rpBasicManager = 0; + _out_rpBasicManager = nullptr; Reference< XStorage > xStorage; if ( !impl_getDocumentStorage_nothrow( _rxDocumentModel, xStorage ) ) { @@ -434,7 +434,7 @@ namespace basic { // user wants to break loading of BASIC-manager delete _out_rpBasicManager; - _out_rpBasicManager = NULL; + _out_rpBasicManager = nullptr; xStorage.clear(); break; } @@ -448,7 +448,7 @@ namespace basic // create new BASIC-manager StarBASIC* pBasic = new StarBASIC( pAppBasic ); pBasic->SetFlag( SbxFlagBits::ExtSearch ); - _out_rpBasicManager = new BasicManager( pBasic, NULL, true ); + _out_rpBasicManager = new BasicManager( pBasic, nullptr, true ); } // knit the containers with the BasicManager @@ -599,7 +599,7 @@ namespace basic void BasicManagerRepository::resetApplicationBasicManager() { - return ImplRepository::Instance().setApplicationBasicManager( NULL ); + return ImplRepository::Instance().setApplicationBasicManager( nullptr ); } diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx index 18e8f6ff50c3..34e052cd91b3 100644 --- a/basic/source/basmgr/basmgr.cxx +++ b/basic/source/basmgr/basmgr.cxx @@ -115,8 +115,8 @@ struct BasicManagerImpl OUString aBasicLibPath; BasicManagerImpl() - : mpManagerStream( NULL ) - , mppLibStreams( NULL ) + : mpManagerStream( nullptr ) + , mppLibStreams( nullptr ) , mnLibStreamCount( 0 ) {} ~BasicManagerImpl(); @@ -343,7 +343,7 @@ void SAL_CALL BasMgrContainerListenerImpl::elementRemoved( const container::Cont else { StarBASIC* pLib = mpMgr->GetLib( maLibName ); - SbModule* pMod = pLib ? pLib->FindModule( aName ) : NULL; + SbModule* pMod = pLib ? pLib->FindModule( aName ) : nullptr; if( pMod ) { pLib->Remove( pMod ); @@ -434,7 +434,7 @@ BasicLibInfo::BasicLibInfo() bReference = false; bPasswordVerified = false; bDoLoad = false; - mxScriptCont = NULL; + mxScriptCont = nullptr; aStorageName = szImbedded; aRelStorageName = szImbedded; } @@ -505,7 +505,7 @@ BasicManager::BasicManager( SotStorage& rStorage, const OUString& rBaseURL, Star if ( !pStdLib ) { // Should never happen, but if it happens we wont crash... - pStdLib = new StarBASIC( NULL, mbDocMgr ); + pStdLib = new StarBASIC( nullptr, mbDocMgr ); if (mpImpl->aLibs.empty()) CreateLibInfo(); @@ -649,7 +649,7 @@ void BasicManager::SetLibraryContainerInfo( const LibraryContainerInfo& rInfo ) StarBASIC* pLib = rpBasLibInfo->GetLib(); if( !pLib ) { - bool bLoaded = ImpLoadLibrary( rpBasLibInfo.get(), NULL ); + bool bLoaded = ImpLoadLibrary( rpBasLibInfo.get(), nullptr ); if( bLoaded ) pLib = rpBasLibInfo->GetLib(); } @@ -705,7 +705,7 @@ void BasicManager::ImpMgrNotLoaded( const OUString& rStorageName ) // Create a stdlib otherwise we crash! BasicLibInfo* pStdLibInfo = CreateLibInfo(); - pStdLibInfo->SetLib( new StarBASIC( NULL, mbDocMgr ) ); + pStdLibInfo->SetLib( new StarBASIC( nullptr, mbDocMgr ) ); StarBASICRef xStdLib = pStdLibInfo->GetLib(); xStdLib->SetName( szStdLibName ); pStdLibInfo->SetLibName( szStdLibName ); @@ -909,7 +909,7 @@ BasicManager::~BasicManager() void BasicManager::LegacyDeleteBasicManager( BasicManager*& _rpManager ) { delete _rpManager; - _rpManager = NULL; + _rpManager = nullptr; } @@ -1078,7 +1078,7 @@ bool BasicManager::ImplLoadBasic( SvStream& rStrm, StarBASICRef& rOldBasic ) con bool bLoaded = false; if( xNew.Is() ) { - if( 0 != dynamic_cast<const StarBASIC*>( &xNew ) ) + if( nullptr != dynamic_cast<const StarBASIC*>( &xNew ) ) { StarBASIC* pNew = static_cast<StarBASIC*>(static_cast<SbxBase*>(xNew)); // Use the Parent of the old BASICs @@ -1178,10 +1178,10 @@ StarBASIC* BasicManager::AddLib( SotStorage& rStorage, const OUString& rLibName, else { RemoveLib( nLibId, false ); - pLibInfo = 0; + pLibInfo = nullptr; } - return pLibInfo ? &*pLibInfo->GetLib() : 0; + return pLibInfo ? &*pLibInfo->GetLib() : nullptr; } @@ -1298,7 +1298,7 @@ StarBASIC* BasicManager::GetLib( sal_uInt16 nLib ) const { return mpImpl->aLibs[nLib]->GetLib(); } - return 0; + return nullptr; } StarBASIC* BasicManager::GetStdLib() const @@ -1316,7 +1316,7 @@ StarBASIC* BasicManager::GetLib( const OUString& rName ) const return rpLib->GetLib(); } } - return 0; + return nullptr; } sal_uInt16 BasicManager::GetLibId( const OUString& rName ) const @@ -1369,7 +1369,7 @@ bool BasicManager::LoadLib( sal_uInt16 nLib ) } else { - bDone = ImpLoadLibrary( &rLibInfo, NULL ); + bDone = ImpLoadLibrary( &rLibInfo, nullptr ); StarBASIC* pLib = GetLib( nLib ); if ( pLib ) { @@ -1390,7 +1390,7 @@ StarBASIC* BasicManager::CreateLib( const OUString& rLibName ) { if ( GetLib( rLibName ) ) { - return 0; + return nullptr; } BasicLibInfo* pLibInfo = CreateLibInfo(); StarBASIC* pNew = new StarBASIC( GetStdLib(), mbDocMgr ); @@ -1445,7 +1445,7 @@ StarBASIC* BasicManager::CreateLibForLibContainer( const OUString& rLibName, { if ( GetLib( rLibName ) ) { - return 0; + return nullptr; } BasicLibInfo* pLibInfo = CreateLibInfo(); StarBASIC* pNew = new StarBASIC( GetStdLib(), mbDocMgr ); @@ -1468,7 +1468,7 @@ BasicLibInfo* BasicManager::FindLibInfo( StarBASIC* pBasic ) return rpLib.get(); } } - return NULL; + return nullptr; } @@ -1618,13 +1618,13 @@ namespace } } } - return 0; + return nullptr; } } bool BasicManager::HasMacro( OUString const& i_fullyQualifiedName ) const { - return ( NULL != lcl_queryMacro( const_cast< BasicManager* >( this ), i_fullyQualifiedName ) ); + return ( nullptr != lcl_queryMacro( const_cast< BasicManager* >( this ), i_fullyQualifiedName ) ); } ErrCode BasicManager::ExecuteMacro( OUString const& i_fullyQualifiedName, SbxArray* i_arguments, SbxValue* i_retValue ) @@ -1828,7 +1828,7 @@ uno::Type ModuleContainer_Impl::getElementType() sal_Bool ModuleContainer_Impl::hasElements() throw(uno::RuntimeException, std::exception) { - SbxArray* pMods = mpLib ? mpLib->GetModules() : NULL; + SbxArray* pMods = mpLib ? mpLib->GetModules() : nullptr; return pMods && pMods->Count() > 0; } @@ -1836,7 +1836,7 @@ sal_Bool ModuleContainer_Impl::hasElements() uno::Any ModuleContainer_Impl::getByName( const OUString& aName ) throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException, std::exception) { - SbModule* pMod = mpLib ? mpLib->FindModule( aName ) : NULL; + SbModule* pMod = mpLib ? mpLib->FindModule( aName ) : nullptr; if( !pMod ) throw container::NoSuchElementException(); uno::Reference< script::XStarBasicModuleInfo > xMod = static_cast<XStarBasicModuleInfo*>(new ModuleInfo_Impl @@ -1849,7 +1849,7 @@ uno::Any ModuleContainer_Impl::getByName( const OUString& aName ) uno::Sequence< OUString > ModuleContainer_Impl::getElementNames() throw(uno::RuntimeException, std::exception) { - SbxArray* pMods = mpLib ? mpLib->GetModules() : NULL; + SbxArray* pMods = mpLib ? mpLib->GetModules() : nullptr; sal_uInt16 nMods = pMods ? pMods->Count() : 0; uno::Sequence< OUString > aRetSeq( nMods ); OUString* pRetSeq = aRetSeq.getArray(); @@ -1864,8 +1864,8 @@ uno::Sequence< OUString > ModuleContainer_Impl::getElementNames() sal_Bool ModuleContainer_Impl::hasByName( const OUString& aName ) throw(uno::RuntimeException, std::exception) { - SbModule* pMod = mpLib ? mpLib->FindModule( aName ) : NULL; - bool bRet = (pMod != NULL); + SbModule* pMod = mpLib ? mpLib->FindModule( aName ) : nullptr; + bool bRet = (pMod != nullptr); return bRet; } @@ -1897,7 +1897,7 @@ void ModuleContainer_Impl::insertByName( const OUString& aName, const uno::Any& void ModuleContainer_Impl::removeByName( const OUString& Name ) throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException, std::exception) { - SbModule* pMod = mpLib ? mpLib->FindModule( Name ) : NULL; + SbModule* pMod = mpLib ? mpLib->FindModule( Name ) : nullptr; if( !pMod ) { throw container::NoSuchElementException(); @@ -1983,7 +1983,7 @@ sal_Bool DialogContainer_Impl::hasElements() for( sal_Int16 nObj = 0; nObj < nCount ; nObj++ ) { SbxVariable* pVar = mpLib->GetObjects()->Get( nObj ); - if ( 0 != dynamic_cast<const SbxObject*>( pVar) && ( static_cast<SbxObject*>(pVar)->GetSbxId() == SBXID_DIALOG ) ) + if ( nullptr != dynamic_cast<const SbxObject*>( pVar) && ( static_cast<SbxObject*>(pVar)->GetSbxId() == SBXID_DIALOG ) ) { bRet = true; break; @@ -1997,7 +1997,7 @@ uno::Any DialogContainer_Impl::getByName( const OUString& aName ) throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException, std::exception) { SbxVariable* pVar = mpLib->GetObjects()->Find( aName, SbxCLASS_DONTCARE ); - if( !( pVar && 0 != dynamic_cast<const SbxObject*>( pVar) && + if( !( pVar && nullptr != dynamic_cast<const SbxObject*>( pVar) && ( static_cast<SbxObject*>(pVar)->GetSbxId() == SBXID_DIALOG ) ) ) { throw container::NoSuchElementException(); @@ -2023,7 +2023,7 @@ uno::Sequence< OUString > DialogContainer_Impl::getElementNames() for( sal_Int16 nObj = 0; nObj < nCount ; nObj++ ) { SbxVariable* pVar = mpLib->GetObjects()->Get( nObj ); - if ( 0 != dynamic_cast<const SbxObject*>( pVar) && ( static_cast<SbxObject*>(pVar)->GetSbxId() == SBXID_DIALOG ) ) + if ( nullptr != dynamic_cast<const SbxObject*>( pVar) && ( static_cast<SbxObject*>(pVar)->GetSbxId() == SBXID_DIALOG ) ) { pRetSeq[ nDialogCounter ] = OUString( pVar->GetName() ); nDialogCounter++; @@ -2038,7 +2038,7 @@ sal_Bool DialogContainer_Impl::hasByName( const OUString& aName ) { bool bRet = false; SbxVariable* pVar = mpLib->GetObjects()->Find( aName, SbxCLASS_DONTCARE ); - if( pVar && 0 != dynamic_cast<const SbxObject*>( pVar) && + if( pVar && nullptr != dynamic_cast<const SbxObject*>( pVar) && ( static_cast<SbxObject*>(pVar)->GetSbxId() == SBXID_DIALOG ) ) { bRet = true; @@ -2078,7 +2078,7 @@ void DialogContainer_Impl::removeByName( const OUString& Name ) { (void)Name; SbxVariable* pVar = mpLib->GetObjects()->Find( Name, SbxCLASS_DONTCARE ); - if( !( pVar && 0 != dynamic_cast<const SbxObject*>( pVar) && + if( !( pVar && nullptr != dynamic_cast<const SbxObject*>( pVar) && ( static_cast<SbxObject*>(pVar)->GetSbxId() == SBXID_DIALOG ) ) ) { throw container::NoSuchElementException(); |