diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-06-01 13:41:49 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-06-02 18:23:45 +0200 |
commit | 6783afe24d43a1bfd0b0239d3ebb97046177111d (patch) | |
tree | 03c717a9a6353bafb2fe2b278a307fddf75f494f | |
parent | 3d9bf9eea5803184da8e5e11477b6eb2f55aff3f (diff) |
no need to allocate these on the heap
Change-Id: Ie11353c8711e970cc20059227d8283c79e4b126d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116586
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | forms/source/xforms/submission/submission_get.cxx | 8 | ||||
-rw-r--r-- | fpicker/source/office/fileview.cxx | 8 | ||||
-rw-r--r-- | helpcompiler/source/HelpLinker.cxx | 4 | ||||
-rw-r--r-- | helpcompiler/source/HelpLinker_main.cxx | 4 | ||||
-rw-r--r-- | reportdesign/source/ui/misc/UITools.cxx | 4 | ||||
-rw-r--r-- | sc/source/core/data/documen8.cxx | 4 | ||||
-rw-r--r-- | sc/source/core/data/simpleformulacalc.cxx | 4 | ||||
-rw-r--r-- | sc/source/core/data/stlpool.cxx | 42 | ||||
-rw-r--r-- | sc/source/core/tool/chgtrack.cxx | 4 | ||||
-rw-r--r-- | sc/source/core/tool/interpr4.cxx | 6 |
10 files changed, 44 insertions, 44 deletions
diff --git a/forms/source/xforms/submission/submission_get.cxx b/forms/source/xforms/submission/submission_get.cxx index 22825328b6cd..880eb1d4df3e 100644 --- a/forms/source/xforms/submission/submission_get.cxx +++ b/forms/source/xforms/submission/submission_get.cxx @@ -47,11 +47,11 @@ CSubmissionGet::CSubmissionGet(const OUString& aURL, const css::uno::Reference< CSubmission::SubmissionResult CSubmissionGet::submit(const css::uno::Reference< css::task::XInteractionHandler >& aInteractionHandler) { // GET always uses application/x-www-formurlencoded - std::unique_ptr< CSerialization > apSerialization(new CSerializationURLEncoded()); - apSerialization->setSource(m_aFragment); - apSerialization->serialize(); + CSerializationURLEncoded aSerialization; + aSerialization.setSource(m_aFragment); + aSerialization.serialize(); - css::uno::Reference< XInputStream > aInStream = apSerialization->getInputStream(); + css::uno::Reference< XInputStream > aInStream = aSerialization.getInputStream(); // create a commandEnvironment and use the default interaction handler rtl::Reference<CCommandEnvironmentHelper> pHelper = new CCommandEnvironmentHelper; diff --git a/fpicker/source/office/fileview.cxx b/fpicker/source/office/fileview.cxx index 548b49c3cd1d..87d134c3edbd 100644 --- a/fpicker/source/office/fileview.cxx +++ b/fpicker/source/office/fileview.cxx @@ -1218,13 +1218,13 @@ FileViewResult SvtFileView_Impl::GetFolderContent_Impl( m_aCurrentAsyncActionHandler = Link<void*,void>(); // minimum time to wait - std::unique_ptr< TimeValue > pTimeout( new TimeValue ); + TimeValue aTimeout; sal_Int32 nMinTimeout = pAsyncDescriptor->nMinTimeout; OSL_ENSURE( nMinTimeout > 0, "SvtFileView_Impl::GetFolderContent_Impl: invalid minimum timeout!" ); if ( nMinTimeout <= 0 ) nMinTimeout = sal_Int32( 1000 ); - pTimeout->Seconds = nMinTimeout / 1000; - pTimeout->Nanosec = ( nMinTimeout % 1000 ) * 1000000; + aTimeout.Seconds = nMinTimeout / 1000; + aTimeout.Nanosec = ( nMinTimeout % 1000 ) * 1000000; m_xContentEnumerator->enumerateFolderContent( _rFolder, this ); @@ -1240,7 +1240,7 @@ FileViewResult SvtFileView_Impl::GetFolderContent_Impl( SolarMutexReleaser aSolarRelease; // now wait. Note that if we didn't get a pAsyncDescriptor, then this is an infinite wait. - eResult = m_aAsyncActionFinished.wait( pTimeout.get() ); + eResult = m_aAsyncActionFinished.wait( &aTimeout ); } ::osl::MutexGuard aGuard2( maMutex ); diff --git a/helpcompiler/source/HelpLinker.cxx b/helpcompiler/source/HelpLinker.cxx index b272d2c010e5..f7acc30ecc7d 100644 --- a/helpcompiler/source/HelpLinker.cxx +++ b/helpcompiler/source/HelpLinker.cxx @@ -881,8 +881,8 @@ bool compileExtensionHelp xmlSetStructuredErrorFunc( nullptr, StructuredXMLErrorFunction ); try { - std::unique_ptr<HelpLinker> pHelpLinker(new HelpLinker()); - pHelpLinker->main( args, &aStdStrExtensionPath, &aStdStrDestination, &aOfficeHelpPath ); + HelpLinker aHelpLinker; + aHelpLinker.main( args, &aStdStrExtensionPath, &aStdStrDestination, &aOfficeHelpPath ); } catch( const HelpProcessingException& e ) { diff --git a/helpcompiler/source/HelpLinker_main.cxx b/helpcompiler/source/HelpLinker_main.cxx index 5c8fe8807336..75ac9f3d3ba1 100644 --- a/helpcompiler/source/HelpLinker_main.cxx +++ b/helpcompiler/source/HelpLinker_main.cxx @@ -30,8 +30,8 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) args.push_back(std::string(argv[i])); try { - std::unique_ptr<HelpLinker> pHelpLinker(new HelpLinker()); - pHelpLinker->main(args); + HelpLinker aHelpLinker; + aHelpLinker.main(args); } catch (const HelpProcessingException& e) { diff --git a/reportdesign/source/ui/misc/UITools.cxx b/reportdesign/source/ui/misc/UITools.cxx index 2cf762e48f8c..6be0594813f6 100644 --- a/reportdesign/source/ui/misc/UITools.cxx +++ b/reportdesign/source/ui/misc/UITools.cxx @@ -645,7 +645,7 @@ bool openCharDialog( const uno::Reference<report::XReportControlFormat >& _rxRep { SID_ATTR_CHAR_CTL_POSTURE, true }, { SID_ATTR_CHAR_CTL_WEIGHT, true } }; - ::std::unique_ptr<FontList> pFontList(new FontList(Application::GetDefaultDevice())); + FontList aFontList(Application::GetDefaultDevice()); XColorListRef pColorList( XColorList::CreateStdColorList() ); const Graphic aNullGraphic; const ::Color aNullLineCol(COL_DEFAULT_SHAPE_STROKE); // #i121448# Use defined default color @@ -691,7 +691,7 @@ bool openCharDialog( const uno::Reference<report::XReportControlFormat >& _rxRep new SvxKerningItem(0,ITEMID_KERNING), new SvxCaseMapItem(SvxCaseMap::NotMapped,ITEMID_CASEMAP), new SvxEscapementItem(ITEMID_ESCAPEMENT), - new SvxFontListItem(pFontList.get(),ITEMID_FONTLIST), + new SvxFontListItem(&aFontList,ITEMID_FONTLIST), new SvxAutoKernItem(false,ITEMID_AUTOKERN), new SvxColorListItem(pColorList,ITEMID_COLOR_TABLE), new SvxBlinkItem(false,ITEMID_BLINK), diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx index 0e7761d7b087..d9321a6634cb 100644 --- a/sc/source/core/data/documen8.cxx +++ b/sc/source/core/data/documen8.cxx @@ -570,7 +570,7 @@ bool ScDocument::IdleCalcTextWidth() // true = try next again aScope.setCol(pTab->ClampToAllocatedColumns(aScope.Col())); // Start at specified cell position (nCol, nRow, nTab). ScColumn* pCol = &pTab->aCol[aScope.Col()]; - std::unique_ptr<ScColumnTextWidthIterator> pColIter(new ScColumnTextWidthIterator(*this, *pCol, aScope.Row(), MaxRow())); + std::optional<ScColumnTextWidthIterator> pColIter(std::in_place, *this, *pCol, aScope.Row(), MaxRow()); OutputDevice* pDev = nullptr; sal_uInt16 nRestart = 0; @@ -667,7 +667,7 @@ bool ScDocument::IdleCalcTextWidth() // true = try next again if ( nZoom > 0 ) { pCol = &pTab->aCol[aScope.Col()]; - pColIter.reset(new ScColumnTextWidthIterator(*this, *pCol, aScope.Row(), MaxRow())); + pColIter.emplace(*this, *pCol, aScope.Row(), MaxRow()); } else { diff --git a/sc/source/core/data/simpleformulacalc.cxx b/sc/source/core/data/simpleformulacalc.cxx index ad26a135c98c..5959d08318d2 100644 --- a/sc/source/core/data/simpleformulacalc.cxx +++ b/sc/source/core/data/simpleformulacalc.cxx @@ -50,8 +50,8 @@ void ScSimpleFormulaCalculator::Calculate() if (mbMatrixFormula) aInt.AssertFormulaMatrix(); - std::unique_ptr<sfx2::LinkManager> pNewLinkMgr( new sfx2::LinkManager(mrDoc.GetDocumentShell()) ); - aInt.SetLinkManager( pNewLinkMgr.get() ); + sfx2::LinkManager aNewLinkMgr( mrDoc.GetDocumentShell() ); + aInt.SetLinkManager( &aNewLinkMgr ); formula::StackVar aIntType = aInt.Interpret(); if ( aIntType == formula::svMatrixCell ) diff --git a/sc/source/core/data/stlpool.cxx b/sc/source/core/data/stlpool.cxx index 51e7f6c09e1c..3939978633f3 100644 --- a/sc/source/core/data/stlpool.cxx +++ b/sc/source/core/data/stlpool.cxx @@ -217,9 +217,9 @@ void ScStyleSheetPool::CreateStandardStyles() const OUString aHelpFile;//which text??? SfxItemSet* pSet = nullptr; SfxItemSet* pHFSet = nullptr; - std::unique_ptr<ScEditEngineDefaulter> pEdEngine(new ScEditEngineDefaulter( EditEngine::CreatePool().get(), true )); - pEdEngine->SetUpdateMode( false ); - std::unique_ptr<EditTextObject> pEmptyTxtObj = pEdEngine->CreateTextObject(); + ScEditEngineDefaulter aEdEngine( EditEngine::CreatePool().get(), true ); + aEdEngine.SetUpdateMode( false ); + std::unique_ptr<EditTextObject> pEmptyTxtObj = aEdEngine.CreateTextObject(); std::unique_ptr<EditTextObject> pTxtObj; ScPageHFItem aHeaderItem( ATTR_PAGE_HEADERRIGHT ); ScPageHFItem aFooterItem( ATTR_PAGE_FOOTERRIGHT ); @@ -284,9 +284,9 @@ void ScStyleSheetPool::CreateStandardStyles() // Header: // [empty][\sheet\][empty] - pEdEngine->SetTextCurrentDefaults(EMPTY_OUSTRING); - pEdEngine->QuickInsertField( SvxFieldItem(SvxTableField(), EE_FEATURE_FIELD), ESelection() ); - pTxtObj = pEdEngine->CreateTextObject(); + aEdEngine.SetTextCurrentDefaults(EMPTY_OUSTRING); + aEdEngine.QuickInsertField( SvxFieldItem(SvxTableField(), EE_FEATURE_FIELD), ESelection() ); + pTxtObj = aEdEngine.CreateTextObject(); aHeaderItem.SetLeftArea ( *pEmptyTxtObj ); aHeaderItem.SetCenterArea( *pTxtObj ); aHeaderItem.SetRightArea ( *pEmptyTxtObj ); @@ -296,10 +296,10 @@ void ScStyleSheetPool::CreateStandardStyles() // [empty][Page \STR_PAGE\][empty] aStr = SCSTR( STR_PAGE ) + " "; - pEdEngine->SetTextCurrentDefaults( aStr ); + aEdEngine.SetTextCurrentDefaults( aStr ); nStrLen = aStr.getLength(); - pEdEngine->QuickInsertField( SvxFieldItem(SvxPageField(), EE_FEATURE_FIELD), ESelection(0,nStrLen,0,nStrLen) ); - pTxtObj = pEdEngine->CreateTextObject(); + aEdEngine.QuickInsertField( SvxFieldItem(SvxPageField(), EE_FEATURE_FIELD), ESelection(0,nStrLen,0,nStrLen) ); + pTxtObj = aEdEngine.CreateTextObject(); aFooterItem.SetLeftArea ( *pEmptyTxtObj ); aFooterItem.SetCenterArea( *pTxtObj ); aFooterItem.SetRightArea ( *pEmptyTxtObj ); @@ -342,18 +342,18 @@ void ScStyleSheetPool::CreateStandardStyles() // [\TABLE\ (\DATA\)][empty][\DATE\, \TIME\] aStr = " ()"; - pEdEngine->SetTextCurrentDefaults( aStr ); - pEdEngine->QuickInsertField( SvxFieldItem(SvxFileField(), EE_FEATURE_FIELD), ESelection(0,2,0,2) ); - pEdEngine->QuickInsertField( SvxFieldItem(SvxTableField(), EE_FEATURE_FIELD), ESelection() ); - pTxtObj = pEdEngine->CreateTextObject(); + aEdEngine.SetTextCurrentDefaults( aStr ); + aEdEngine.QuickInsertField( SvxFieldItem(SvxFileField(), EE_FEATURE_FIELD), ESelection(0,2,0,2) ); + aEdEngine.QuickInsertField( SvxFieldItem(SvxTableField(), EE_FEATURE_FIELD), ESelection() ); + pTxtObj = aEdEngine.CreateTextObject(); aHeaderItem.SetLeftArea( *pTxtObj ); aHeaderItem.SetCenterArea( *pEmptyTxtObj ); aStr = ", "; - pEdEngine->SetTextCurrentDefaults( aStr ); - pEdEngine->QuickInsertField( SvxFieldItem(SvxTimeField(), EE_FEATURE_FIELD), ESelection(0,2,0,2) ); - pEdEngine->QuickInsertField( SvxFieldItem(SvxDateField(Date( Date::SYSTEM ),SvxDateType::Var), EE_FEATURE_FIELD), + aEdEngine.SetTextCurrentDefaults( aStr ); + aEdEngine.QuickInsertField( SvxFieldItem(SvxTimeField(), EE_FEATURE_FIELD), ESelection(0,2,0,2) ); + aEdEngine.QuickInsertField( SvxFieldItem(SvxDateField(Date( Date::SYSTEM ),SvxDateType::Var), EE_FEATURE_FIELD), ESelection() ); - pTxtObj = pEdEngine->CreateTextObject(); + pTxtObj = aEdEngine.CreateTextObject(); aHeaderItem.SetRightArea( *pTxtObj ); pSet->Put( aHeaderItem ); @@ -364,10 +364,10 @@ void ScStyleSheetPool::CreateStandardStyles() nStrLen = aStr.getLength(); aStr += " / "; sal_Int32 nStrLen2 = aStr.getLength(); - pEdEngine->SetTextCurrentDefaults( aStr ); - pEdEngine->QuickInsertField( SvxFieldItem(SvxPagesField(), EE_FEATURE_FIELD), ESelection(0,nStrLen2,0,nStrLen2) ); - pEdEngine->QuickInsertField( SvxFieldItem(SvxPageField(), EE_FEATURE_FIELD), ESelection(0,nStrLen,0,nStrLen) ); - pTxtObj = pEdEngine->CreateTextObject(); + aEdEngine.SetTextCurrentDefaults( aStr ); + aEdEngine.QuickInsertField( SvxFieldItem(SvxPagesField(), EE_FEATURE_FIELD), ESelection(0,nStrLen2,0,nStrLen2) ); + aEdEngine.QuickInsertField( SvxFieldItem(SvxPageField(), EE_FEATURE_FIELD), ESelection(0,nStrLen,0,nStrLen) ); + pTxtObj = aEdEngine.CreateTextObject(); aFooterItem.SetLeftArea ( *pEmptyTxtObj ); aFooterItem.SetCenterArea( *pTxtObj ); aFooterItem.SetRightArea ( *pEmptyTxtObj ); diff --git a/sc/source/core/tool/chgtrack.cxx b/sc/source/core/tool/chgtrack.cxx index ebe614ed7b81..d68009446dcc 100644 --- a/sc/source/core/tool/chgtrack.cxx +++ b/sc/source/core/tool/chgtrack.cxx @@ -1746,8 +1746,8 @@ void ScChangeActionContent::GetFormulaString( else { OSL_FAIL( "ScChangeActionContent::GetFormulaString: aPos != pCell->aPos" ); - std::unique_ptr<ScFormulaCell> pNew(new ScFormulaCell( *pCell, pCell->GetDocument(), aPos )); - pNew->GetFormula( rStr ); + ScFormulaCell aNew( *pCell, pCell->GetDocument(), aPos ); + aNew.GetFormula( rStr ); } } diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx index da1edb25c922..288d01d2eacc 100644 --- a/sc/source/core/tool/interpr4.cxx +++ b/sc/source/core/tool/interpr4.cxx @@ -3572,7 +3572,7 @@ void ScInterpreter::ScTableOp() PushIllegalParameter(); return; } - std::unique_ptr<ScInterpreterTableOpParams> pTableOp(new ScInterpreterTableOpParams); + std::optional<ScInterpreterTableOpParams> pTableOp(std::in_place); if (nParamCount == 5) { PopSingleRef( pTableOp->aNew2 ); @@ -3583,7 +3583,7 @@ void ScInterpreter::ScTableOp() PopSingleRef( pTableOp->aFormulaPos ); pTableOp->bValid = true; - mrDoc.m_TableOpList.push_back(pTableOp.get()); + mrDoc.m_TableOpList.push_back(&*pTableOp); mrDoc.IncInterpreterTableOpLevel(); bool bReuseLastParams = (mrDoc.aLastTableOpParams == *pTableOp); @@ -3621,7 +3621,7 @@ void ScInterpreter::ScTableOp() } auto const itr = - ::std::find(mrDoc.m_TableOpList.begin(), mrDoc.m_TableOpList.end(), pTableOp.get()); + ::std::find(mrDoc.m_TableOpList.begin(), mrDoc.m_TableOpList.end(), &*pTableOp); if (itr != mrDoc.m_TableOpList.end()) { mrDoc.m_TableOpList.erase(itr); |