From 84cbd6a5434e119613d677370e7657ea77cd7767 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 8 Sep 2017 16:55:09 +0200 Subject: clang-tidy modernize-use-emplace in b* Change-Id: I51e0369ba2e1fe0b7c934531f71d3bda95ba09ec Reviewed-on: https://gerrit.libreoffice.org/42109 Tested-by: Jenkins Reviewed-by: Noel Grandin --- basic/source/basmgr/basmgr.cxx | 18 +++++++++--------- basic/source/classes/sb.cxx | 6 +++--- basic/source/classes/sbunoobj.cxx | 4 ++-- basic/source/runtime/runtime.cxx | 4 ++-- 4 files changed, 16 insertions(+), 16 deletions(-) (limited to 'basic') diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx index 823e2a04fd63..2342510bbd54 100644 --- a/basic/source/basmgr/basmgr.cxx +++ b/basic/source/basmgr/basmgr.cxx @@ -629,7 +629,7 @@ void BasicManager::ImpMgrNotLoaded( const OUString& rStorageName ) // pErrInf is only destroyed if the error os processed by an // ErrorHandler StringErrorInfo* pErrInf = new StringErrorInfo( ERRCODE_BASMGR_MGROPEN, rStorageName, DialogMask::ButtonsOk ); - aErrors.push_back(BasicError(*pErrInf, BasicErrorReason::OPENMGRSTREAM)); + aErrors.emplace_back(*pErrInf, BasicErrorReason::OPENMGRSTREAM); // Create a stdlib otherwise we crash! BasicLibInfo* pStdLibInfo = CreateLibInfo(); @@ -769,7 +769,7 @@ void BasicManager::LoadOldBasicManager( SotStorage& rStorage ) if (!ImplLoadBasic( *xManagerStream, mpImpl->aLibs.front()->GetLibRef() )) { StringErrorInfo* pErrInf = new StringErrorInfo( ERRCODE_BASMGR_MGROPEN, aStorName, DialogMask::ButtonsOk ); - aErrors.push_back(BasicError(*pErrInf, BasicErrorReason::OPENMGRSTREAM)); + aErrors.emplace_back(*pErrInf, BasicErrorReason::OPENMGRSTREAM); // and it proceeds ... } xManagerStream->Seek( nBasicEndOff+1 ); // +1: 0x00 as separator @@ -817,7 +817,7 @@ void BasicManager::LoadOldBasicManager( SotStorage& rStorage ) else { StringErrorInfo* pErrInf = new StringErrorInfo( ERRCODE_BASMGR_LIBLOAD, aStorName, DialogMask::ButtonsOk ); - aErrors.push_back(BasicError(*pErrInf, BasicErrorReason::STORAGENOTFOUND)); + aErrors.emplace_back(*pErrInf, BasicErrorReason::STORAGENOTFOUND); } } } @@ -900,7 +900,7 @@ bool BasicManager::ImpLoadLibrary( BasicLibInfo* pLibInfo, SotStorage* pCurStora if ( !xBasicStorage.is() || xBasicStorage->GetError() ) { StringErrorInfo* pErrInf = new StringErrorInfo( ERRCODE_BASMGR_MGROPEN, xStorage->GetName(), DialogMask::ButtonsOk ); - aErrors.push_back(BasicError(*pErrInf, BasicErrorReason::OPENLIBSTORAGE)); + aErrors.emplace_back(*pErrInf, BasicErrorReason::OPENLIBSTORAGE); } else { @@ -909,7 +909,7 @@ bool BasicManager::ImpLoadLibrary( BasicLibInfo* pLibInfo, SotStorage* pCurStora if ( !xBasicStream.is() || xBasicStream->GetError() ) { StringErrorInfo* pErrInf = new StringErrorInfo( ERRCODE_BASMGR_LIBLOAD , pLibInfo->GetLibName(), DialogMask::ButtonsOk ); - aErrors.push_back(BasicError(*pErrInf, BasicErrorReason::OPENLIBSTREAM)); + aErrors.emplace_back(*pErrInf, BasicErrorReason::OPENLIBSTREAM); } else { @@ -932,7 +932,7 @@ bool BasicManager::ImpLoadLibrary( BasicLibInfo* pLibInfo, SotStorage* pCurStora if ( !bLoaded ) { StringErrorInfo* pErrInf = new StringErrorInfo( ERRCODE_BASMGR_LIBLOAD, pLibInfo->GetLibName(), DialogMask::ButtonsOk ); - aErrors.push_back(BasicError(*pErrInf, BasicErrorReason::BASICLOADERROR)); + aErrors.emplace_back(*pErrInf, BasicErrorReason::BASICLOADERROR); } else { @@ -1116,7 +1116,7 @@ bool BasicManager::RemoveLib( sal_uInt16 nLib, bool bDelBasicFromStorage ) if( !nLib || nLib < mpImpl->aLibs.size() ) { StringErrorInfo* pErrInf = new StringErrorInfo( ERRCODE_BASMGR_REMOVELIB, OUString(), DialogMask::ButtonsOk ); - aErrors.push_back(BasicError(*pErrInf, BasicErrorReason::STDLIB)); + aErrors.emplace_back(*pErrInf, BasicErrorReason::STDLIB); return false; } @@ -1152,7 +1152,7 @@ bool BasicManager::RemoveLib( sal_uInt16 nLib, bool bDelBasicFromStorage ) if ( !xBasicStorage.is() || xBasicStorage->GetError() ) { StringErrorInfo* pErrInf = new StringErrorInfo( ERRCODE_BASMGR_REMOVELIB, OUString(), DialogMask::ButtonsOk ); - aErrors.push_back(BasicError(*pErrInf, BasicErrorReason::OPENLIBSTORAGE)); + aErrors.emplace_back(*pErrInf, BasicErrorReason::OPENLIBSTORAGE); } else if (xBasicStorage->IsStream((*itLibInfo)->GetLibName())) { @@ -1287,7 +1287,7 @@ bool BasicManager::LoadLib( sal_uInt16 nLib ) else { StringErrorInfo* pErrInf = new StringErrorInfo( ERRCODE_BASMGR_LIBLOAD, OUString(), DialogMask::ButtonsOk ); - aErrors.push_back(BasicError(*pErrInf, BasicErrorReason::LIBNOTFOUND)); + aErrors.emplace_back(*pErrInf, BasicErrorReason::LIBNOTFOUND); } return bDone; } diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx index 810eaaaf2e56..1614c12bda53 100644 --- a/basic/source/classes/sb.cxx +++ b/basic/source/classes/sb.cxx @@ -1064,7 +1064,7 @@ SbModule* StarBASIC::MakeModule( const OUString& rName, const ModuleInfo& mInfo, } p->SetSource32( rSrc ); p->SetParent( this ); - pModules.push_back(p); + pModules.emplace_back(p); SetModified( true ); return p; } @@ -1073,7 +1073,7 @@ void StarBASIC::Insert( SbxVariable* pVar ) { if( dynamic_cast(pVar) != nullptr) { - pModules.push_back(static_cast(pVar)); + pModules.emplace_back(static_cast(pVar)); pVar->SetParent( this ); StartListening( pVar->GetBroadcaster(), true ); } @@ -1862,7 +1862,7 @@ bool StarBASIC::LoadData( SvStream& r, sal_uInt16 nVer ) else { pMod->SetParent( this ); - pModules.push_back( pMod ); + pModules.emplace_back(pMod ); } } // HACK for SFX-Bullshit! diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx index 1edf4bb1c527..83a06ff0d370 100644 --- a/basic/source/classes/sbunoobj.cxx +++ b/basic/source/classes/sbunoobj.cxx @@ -458,7 +458,7 @@ static sal_uInt32 lcl_registerNativeObjectWrapper( SbxObject* pNativeObj ) { NativeObjectWrapperVector &rNativeObjectWrapperVector = GaNativeObjectWrapperVector::get(); sal_uInt32 nIndex = rNativeObjectWrapperVector.size(); - rNativeObjectWrapperVector.push_back( ObjectItem( pNativeObj ) ); + rNativeObjectWrapperVector.emplace_back( pNativeObj ); return nIndex; } @@ -4452,7 +4452,7 @@ void registerComponentToBeDisposedForBasic ( const Reference< XComponent >& xComponent, StarBASIC* pBasic ) { StarBasicDisposeItem* pItem = lcl_getOrCreateItemForBasic( pBasic ); - pItem->m_vComImplementsObjects.push_back( xComponent ); + pItem->m_vComImplementsObjects.emplace_back(xComponent ); } void registerComListenerVariableForBasic( SbxVariable* pVar, StarBASIC* pBasic ) diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx index 032e4d85128b..40e282d70868 100644 --- a/basic/source/runtime/runtime.cxx +++ b/basic/source/runtime/runtime.cxx @@ -3977,7 +3977,7 @@ void SbiRuntime::StepELEM( sal_uInt32 nOp1, sal_uInt32 nOp2 ) // #74254 now per list if( pObj ) { - aRefSaved.push_back( pObj ); + aRefSaved.emplace_back(pObj ); } PushVar( FindElement( pObj, nOp1, nOp2, ERRCODE_BASIC_NO_METHOD, false ) ); } @@ -4057,7 +4057,7 @@ void SbiRuntime::StepPARAM( sal_uInt32 nOp1, sal_uInt32 nOp2 ) else if( t != SbxVARIANT && (SbxDataType)(p->GetType() & 0x0FFF ) != t ) { SbxVariable* q = new SbxVariable( t ); - aRefSaved.push_back( q ); + aRefSaved.emplace_back(q ); *q = *p; p = q; if ( i ) -- cgit v1.2.3