diff options
author | Caolán McNamara <caolan.mcnamara@collabora.com> | 2023-12-09 19:32:40 +0000 |
---|---|---|
committer | Caolán McNamara <caolan.mcnamara@collabora.com> | 2023-12-09 22:38:50 +0100 |
commit | a58c0d4cefe4de132af32d910ec797a2efb3ee3a (patch) | |
tree | 184accf354eb592ebba452567a0e80d1c0351f1a | |
parent | cid#1546275 Using invalid iterator (diff) | |
download | core-a58c0d4cefe4de132af32d910ec797a2efb3ee3a.tar.gz core-a58c0d4cefe4de132af32d910ec797a2efb3ee3a.zip |
cid#1556778 COPY_INSTEAD_OF_MOVE
and
cid#1546474 COPY_INSTEAD_OF_MOVE
cid#1546473 COPY_INSTEAD_OF_MOVE
cid#1546469 COPY_INSTEAD_OF_MOVE
cid#1546467 COPY_INSTEAD_OF_MOVE
cid#1546458 COPY_INSTEAD_OF_MOVE
cid#1546448 COPY_INSTEAD_OF_MOVE
cid#1546446 COPY_INSTEAD_OF_MOVE
cid#1546441 COPY_INSTEAD_OF_MOVE
cid#1546424 COPY_INSTEAD_OF_MOVE
cid#1546377 COPY_INSTEAD_OF_MOVE
cid#1546374 COPY_INSTEAD_OF_MOVE
cid#1546352 COPY_INSTEAD_OF_MOVE
cid#1546334 COPY_INSTEAD_OF_MOVE
cid#1546328 COPY_INSTEAD_OF_MOVE
cid#1546310 COPY_INSTEAD_OF_MOVE
cid#1546303 COPY_INSTEAD_OF_MOVE
Change-Id: I8a43fdd574857ba1d3ec416f23c8269a9a08e12f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160515
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
21 files changed, 34 insertions, 51 deletions
diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx index c619bbf1fb6a..934297af3862 100644 --- a/basic/source/basmgr/basmgr.cxx +++ b/basic/source/basmgr/basmgr.cxx @@ -301,18 +301,17 @@ void SAL_CALL BasMgrContainerListenerImpl::elementRemoved( const container::Cont } BasicError::BasicError( ErrCodeMsg nId, BasicErrorReason nR ) + : nErrorId(std::move(nId)) + , nReason(nR) { - nErrorId = nId; - nReason = nR; } BasicError::BasicError( const BasicError& rErr ) + : nErrorId(rErr.nErrorId) + , nReason(rErr.nReason) { - nErrorId = rErr.nErrorId; - nReason = rErr.nReason; } - class BasicLibInfo { private: diff --git a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx index e8da99f3c103..85786e63535c 100644 --- a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx +++ b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx @@ -665,13 +665,12 @@ void UpdateDialog::notifyMenubar( bool bPrepareOnly, bool bRecheckOnly ) dp_gui::UpdateData aUpdData = m_enabledUpdates[ p->m_nIndex ]; dp_misc::DescriptionInfoset aInfoset( m_context, aUpdData.aUpdateInfo ); - uno::Sequence< OUString > aItem + aItemList.realloc(nCount + 1); + aItemList.getArray()[nCount] = { dp_misc::getIdentifier( aUpdData.aInstalledPackage ), aInfoset.getVersion() }; - aItemList.realloc( nCount + 1 ); - aItemList.getArray()[ nCount ] = aItem; nCount += 1; } else diff --git a/filter/source/xsltfilter/XSLTFilter.cxx b/filter/source/xsltfilter/XSLTFilter.cxx index 771b5a37f8fc..b3e34925484a 100644 --- a/filter/source/xsltfilter/XSLTFilter.cxx +++ b/filter/source/xsltfilter/XSLTFilter.cxx @@ -481,7 +481,6 @@ namespace XSLT // create pipe css::uno::Reference<XOutputStream> pipeout = Pipe::create(m_xContext); - css::uno::Reference<XInputStream> pipein(pipeout, UNO_QUERY); //connect transformer to pipe m_tcontrol->setOutputStream(pipeout); @@ -490,7 +489,7 @@ namespace XSLT InputSource aInput; aInput.sSystemId = aURL; aInput.sPublicId = aURL; - aInput.aInputStream = pipein; + aInput.aInputStream.set(pipeout, UNO_QUERY); // transform m_tcontrol->start(); diff --git a/lotuswordpro/source/filter/lwplayout.cxx b/lotuswordpro/source/filter/lwplayout.cxx index 895137e282f2..78eacd9c285a 100644 --- a/lotuswordpro/source/filter/lwplayout.cxx +++ b/lotuswordpro/source/filter/lwplayout.cxx @@ -1367,9 +1367,7 @@ rtl::Reference<LwpVirtualLayout> LwpMiddleLayout::GetWaterMarkLayout() { return xLay; } - rtl::Reference<LwpVirtualLayout> xNext( - dynamic_cast<LwpVirtualLayout*>(xLay->GetNext().obj().get())); - xLay = xNext; + xLay.set(dynamic_cast<LwpVirtualLayout*>(xLay->GetNext().obj().get())); } return rtl::Reference<LwpVirtualLayout>(); } diff --git a/sc/inc/scmatrix.hxx b/sc/inc/scmatrix.hxx index 8eb4ae7fde76..72388f14bb03 100644 --- a/sc/inc/scmatrix.hxx +++ b/sc/inc/scmatrix.hxx @@ -413,7 +413,7 @@ public: /** Apply binary operation to values from two input matrices, storing result into this matrix. */ void ExecuteBinaryOp(SCSIZE nMaxCol, SCSIZE nMaxRow, const ScMatrix& rInputMat1, const ScMatrix& rInputMat2, - ScInterpreter* pInterpreter, CalculateOpFunction op); + ScInterpreter* pInterpreter, const CalculateOpFunction& op); #if DEBUG_MATRIX void Dump() const; diff --git a/sc/source/core/tool/interpr5.cxx b/sc/source/core/tool/interpr5.cxx index ae499ec492d1..f091e7264a2c 100644 --- a/sc/source/core/tool/interpr5.cxx +++ b/sc/source/core/tool/interpr5.cxx @@ -1151,7 +1151,7 @@ static SCSIZE lcl_GetMinExtent( SCSIZE n1, SCSIZE n2 ) } static ScMatrixRef lcl_MatrixCalculation( - const ScMatrix& rMat1, const ScMatrix& rMat2, ScInterpreter* pInterpreter, ScMatrix::CalculateOpFunction Op) + const ScMatrix& rMat1, const ScMatrix& rMat2, ScInterpreter* pInterpreter, const ScMatrix::CalculateOpFunction& Op) { SCSIZE nC1, nC2, nMinC; SCSIZE nR1, nR2, nMinR; diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx index f62990b76b18..4f351b06b510 100644 --- a/sc/source/core/tool/scmatrix.cxx +++ b/sc/source/core/tool/scmatrix.cxx @@ -340,7 +340,7 @@ public: SvNumberFormatter& rFormatter, svl::SharedStringPool& rPool); void ExecuteBinaryOp(SCSIZE nMaxCol, SCSIZE nMaxRow, const ScMatrix& rInputMat1, const ScMatrix& rInputMat2, - ScInterpreter* pInterpreter, ScMatrix::CalculateOpFunction op); + ScInterpreter* pInterpreter, const ScMatrix::CalculateOpFunction& op); bool IsValueOrEmpty( const MatrixImplType::const_position_type & rPos ) const; double GetDouble( const MatrixImplType::const_position_type & rPos) const; FormulaError GetErrorIfNotString( const MatrixImplType::const_position_type & rPos ) const; @@ -2890,7 +2890,7 @@ bool ScMatrixImpl::IsStringOrEmpty(const MatrixImplType::const_position_type & r } void ScMatrixImpl::ExecuteBinaryOp(SCSIZE nMaxCol, SCSIZE nMaxRow, const ScMatrix& rInputMat1, const ScMatrix& rInputMat2, - ScInterpreter* pInterpreter, ScMatrix::CalculateOpFunction Op) + ScInterpreter* pInterpreter, const ScMatrix::CalculateOpFunction& Op) { // Check output matrix size, otherwise output iterator logic will be wrong. assert(maMat.size().row == nMaxRow && maMat.size().column == nMaxCol @@ -3638,7 +3638,7 @@ void ScMatrix::MatConcat(SCSIZE nMaxCol, SCSIZE nMaxRow, } void ScMatrix::ExecuteBinaryOp(SCSIZE nMaxCol, SCSIZE nMaxRow, const ScMatrix& rInputMat1, const ScMatrix& rInputMat2, - ScInterpreter* pInterpreter, CalculateOpFunction op) + ScInterpreter* pInterpreter, const CalculateOpFunction& op) { pImpl->ExecuteBinaryOp(nMaxCol, nMaxRow, rInputMat1, rInputMat2, pInterpreter, op); } diff --git a/sd/source/core/drawdoc4.cxx b/sd/source/core/drawdoc4.cxx index 577859d957bc..6fb432ee4f82 100644 --- a/sd/source/core/drawdoc4.cxx +++ b/sd/source/core/drawdoc4.cxx @@ -641,11 +641,10 @@ void SdDrawDocument::CreateDefaultCellStyles() OUString aURL("$BRAND_BASE_DIR/" LIBO_SHARE_FOLDER "/config/soffice.cfg/simpress/styles.xml"); rtl::Bootstrap::expandMacros(aURL); SvFileStream aFile(aURL, StreamMode::READ); - Reference<css::io::XInputStream> xInputStream(new utl::OInputStreamWrapper(aFile)); css::xml::sax::InputSource aParserInput; aParserInput.sPublicId = aURL; - aParserInput.aInputStream = xInputStream; + aParserInput.aInputStream.set(new utl::OInputStreamWrapper(aFile)); Reference<css::xml::sax::XFastParser> xFastParser(xImporter, UNO_QUERY); if (xFastParser) xFastParser->parseStream(aParserInput); diff --git a/sd/source/ui/app/sdmod2.cxx b/sd/source/ui/app/sdmod2.cxx index 8a6424d16263..d1d2d2998778 100644 --- a/sd/source/ui/app/sdmod2.cxx +++ b/sd/source/ui/app/sdmod2.cxx @@ -199,11 +199,9 @@ IMPL_LINK(SdModule, CalcFieldValueHdl, EditFieldInfo*, pInfo, void) if( pAuthorField->GetType() != SvxAuthorType::Fix ) { SvtUserOptions aUserOptions; - SvxAuthorField aAuthorField( + *const_cast< SvxAuthorField* >(pAuthorField) = SvxAuthorField( aUserOptions.GetFirstName(), aUserOptions.GetLastName(), aUserOptions.GetID(), - pAuthorField->GetType(), pAuthorField->GetFormat() ); - - *const_cast< SvxAuthorField* >(pAuthorField) = aAuthorField; + pAuthorField->GetType(), pAuthorField->GetFormat()); } pInfo->SetRepresentation( pAuthorField->GetFormatted() ); diff --git a/starmath/inc/ElementsDockingWindow.hxx b/starmath/inc/ElementsDockingWindow.hxx index 6bbb4a542756..971c2f3b6fb2 100644 --- a/starmath/inc/ElementsDockingWindow.hxx +++ b/starmath/inc/ElementsDockingWindow.hxx @@ -46,7 +46,7 @@ class SmElementsControl std::vector<std::unique_ptr<ElementData>> maItemDatas; std::unique_ptr<weld::IconView> mpIconView; - Link<OUString, void> maSelectHdlLink; + Link<const OUString&, void> maSelectHdlLink; void addElement(const OUString& aElementVisual, const OUString& aElementSource, const OUString& aHelpText); void addElements(int nCategory); @@ -69,7 +69,7 @@ public: void setSmSyntaxVersion(sal_Int16 nSmSyntaxVersion); - void SetSelectHdl(const Link<OUString, void>& rLink) { maSelectHdlLink = rLink; } + void SetSelectHdl(const Link<const OUString&, void>& rLink) { maSelectHdlLink = rLink; } static Color GetTextColor(); static Color GetControlBackground(); diff --git a/starmath/source/SmElementsPanel.cxx b/starmath/source/SmElementsPanel.cxx index dec685787c3a..a28813cf041a 100644 --- a/starmath/source/SmElementsPanel.cxx +++ b/starmath/source/SmElementsPanel.cxx @@ -73,7 +73,7 @@ IMPL_LINK(SmElementsPanel, CategorySelectedHandle, weld::ComboBox&, rList, void) mxElementsControl->setSmSyntaxVersion(pViewSh->GetDoc()->GetSmSyntaxVersion()); } -IMPL_LINK(SmElementsPanel, ElementClickHandler, OUString, ElementSource, void) +IMPL_LINK(SmElementsPanel, ElementClickHandler, const OUString&, ElementSource, void) { if (SmViewShell* pViewSh = GetView()) { diff --git a/starmath/source/SmElementsPanel.hxx b/starmath/source/SmElementsPanel.hxx index d7e4609a4246..c3dde01c6724 100644 --- a/starmath/source/SmElementsPanel.hxx +++ b/starmath/source/SmElementsPanel.hxx @@ -41,7 +41,7 @@ public: private: DECL_LINK(CategorySelectedHandle, weld::ComboBox&, void); - DECL_LINK(ElementClickHandler, OUString, void); + DECL_LINK(ElementClickHandler, const OUString&, void); SmViewShell* GetView() const; diff --git a/stoc/source/invocation/invocation.cxx b/stoc/source/invocation/invocation.cxx index 7da24b3ae0d0..1b119085cb84 100644 --- a/stoc/source/invocation/invocation.cxx +++ b/stoc/source/invocation/invocation.cxx @@ -920,8 +920,7 @@ void Invocation_Impl::fillInfoForMethod rInfo.aName = xMethod->getName(); rInfo.eMemberType = MemberType_METHOD; Reference< XIdlClass > xReturnClass = xMethod->getReturnType(); - Type aReturnType( xReturnClass->getTypeClass(), xReturnClass->getName() ); - rInfo.aType = aReturnType; + rInfo.aType = Type(xReturnClass->getTypeClass(), xReturnClass->getName()); Sequence<ParamInfo> aParamInfos = xMethod->getParameterInfos(); sal_Int32 nParamCount = aParamInfos.getLength(); if( nParamCount <= 0 ) diff --git a/svl/source/misc/sharecontrolfile.cxx b/svl/source/misc/sharecontrolfile.cxx index 7c8fd854b294..205d905ae134 100644 --- a/svl/source/misc/sharecontrolfile.cxx +++ b/svl/source/misc/sharecontrolfile.cxx @@ -71,10 +71,9 @@ ShareControlFile::ShareControlFile( std::u16string_view aOrigURL ) if ( e.Code == ucb::IOErrorCode_NOT_EXISTING ) { // Create file... - SvMemoryStream aStream(0,0); - uno::Reference< io::XInputStream > xInput( new ::utl::OInputStreamWrapper( aStream ) ); ucb::InsertCommandArgument aInsertArg; - aInsertArg.Data = xInput; + SvMemoryStream aStream(0,0); + aInsertArg.Data.set(new ::utl::OInputStreamWrapper(aStream)); aInsertArg.ReplaceExisting = false; aContent.executeCommand( "insert", uno::Any( aInsertArg ) ); diff --git a/sw/source/core/doc/DocumentDeviceManager.cxx b/sw/source/core/doc/DocumentDeviceManager.cxx index b90474082c92..29eeb9eec5f3 100644 --- a/sw/source/core/doc/DocumentDeviceManager.cxx +++ b/sw/source/core/doc/DocumentDeviceManager.cxx @@ -236,8 +236,7 @@ const SwPrintData & DocumentDeviceManager::getPrintData() const const SwDocShell *pDocSh = m_rDoc.GetDocShell(); OSL_ENSURE( pDocSh, "pDocSh is 0, can't determine if this is a WebDoc or not" ); bool bWeb = dynamic_cast< const SwWebDocShell * >(pDocSh) != nullptr; - SwPrintOptions aPrintOptions( bWeb ); - *pThis->mpPrtData = aPrintOptions; + *pThis->mpPrtData = SwPrintOptions(bWeb); } assert(mpPrtData && "this will always be set by now"); return *mpPrtData; diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx index b5077e6c775f..7d122dda2497 100644 --- a/sw/source/core/text/itrform2.cxx +++ b/sw/source/core/text/itrform2.cxx @@ -1168,7 +1168,6 @@ SwTextPortion *SwTextFormatter::WhichTextPor( SwTextFormatInfo &rInf ) const { if (rInf.GetOpt().IsFieldName()) { - OUString aFieldName = SwFieldType::GetTypeStr(SwFieldTypesEnum::Input); // assume this is only the *first* portion and follows will be created elsewhere => input field must start at Idx assert(rInf.GetText()[sal_Int32(rInf.GetIdx())] == CH_TXT_ATR_INPUTFIELDSTART); TextFrameIndex nFieldLen(-1); @@ -1182,7 +1181,7 @@ SwTextPortion *SwTextFormatter::WhichTextPor( SwTextFormatInfo &rInf ) const } } assert(2 <= sal_Int32(nFieldLen)); - pPor = new SwFieldPortion(aFieldName, nullptr, nFieldLen); + pPor = new SwFieldPortion(SwFieldType::GetTypeStr(SwFieldTypesEnum::Input), nullptr, nFieldLen); } else { diff --git a/sw/source/uibase/dbui/mailmergehelper.cxx b/sw/source/uibase/dbui/mailmergehelper.cxx index 4e6f7534da9a..a82ba2c3d7fe 100644 --- a/sw/source/uibase/dbui/mailmergehelper.cxx +++ b/sw/source/uibase/dbui/mailmergehelper.cxx @@ -199,7 +199,6 @@ OUString SwAddressPreview::FillData( rConfigItem.GetCurrentDBData() ); const OUString* pAssignment = aAssignment.getConstArray(); const std::vector<std::pair<OUString, int>>& rDefHeaders = rConfigItem.GetDefaultAddressHeaders(); - OUString sNotAssigned = "<" + SwResId(STR_NOTASSIGNED) + ">"; bool bIncludeCountry = rConfigItem.IsIncludeCountry(); const OUString rExcludeCountry = rConfigItem.GetExcludeCountry(); @@ -269,7 +268,7 @@ OUString SwAddressPreview::FillData( } else { - aItem.sText = sNotAssigned; + aItem.sText = "<" + SwResId(STR_NOTASSIGNED) + ">"; } } diff --git a/toolkit/source/controls/stdtabcontrollermodel.cxx b/toolkit/source/controls/stdtabcontrollermodel.cxx index 43fd80f1702c..07ea5c3d3977 100644 --- a/toolkit/source/controls/stdtabcontrollermodel.cxx +++ b/toolkit/source/controls/stdtabcontrollermodel.cxx @@ -189,9 +189,8 @@ static css::uno::Sequence< css::uno::Reference< css::awt::XControlModel > > Impl css::uno::Sequence< css::uno::Reference< css::awt::XControlModel > > aSeq( nCtrls ); for ( sal_uInt32 n = 0; n < nCtrls; n++ ) { - css::uno::Reference< css::io::XPersistObject > xObj = InStream->readObject(); - css::uno::Reference< css::awt::XControlModel > xI( xObj, css::uno::UNO_QUERY ); - aSeq.getArray()[n] = xI; + css::uno::Reference<css::io::XPersistObject> xObj = InStream->readObject(); + aSeq.getArray()[n].set(xObj, css::uno::UNO_QUERY); } // Skip remainder if more data exists than this version recognizes diff --git a/vcl/source/filter/ipdf/pdfread.cxx b/vcl/source/filter/ipdf/pdfread.cxx index ac4bceaf45d3..b8a6687827cb 100644 --- a/vcl/source/filter/ipdf/pdfread.cxx +++ b/vcl/source/filter/ipdf/pdfread.cxx @@ -184,9 +184,6 @@ findAnnotations(const std::unique_ptr<vcl::pdf::PDFiumPage>& pPage, basegfx::B2D || eSubtype == vcl::pdf::PDFAnnotationSubType::Highlight || eSubtype == vcl::pdf::PDFAnnotationSubType::Line) { - OUString sAuthor = pAnnotation->getString(vcl::pdf::constDictionaryKeyTitle); - OUString sText = pAnnotation->getString(vcl::pdf::constDictionaryKeyContents); - basegfx::B2DRectangle rRectangle = pAnnotation->getRectangle(); basegfx::B2DRectangle rRectangleHMM( convertPointToMm100(rRectangle.getMinX()), @@ -210,8 +207,10 @@ findAnnotations(const std::unique_ptr<vcl::pdf::PDFiumPage>& pPage, basegfx::B2D auto& rPDFGraphicAnnotation = aPDFGraphicAnnotations.back(); rPDFGraphicAnnotation.maRectangle = rRectangleHMM; - rPDFGraphicAnnotation.maAuthor = sAuthor; - rPDFGraphicAnnotation.maText = sText; + rPDFGraphicAnnotation.maAuthor + = pAnnotation->getString(vcl::pdf::constDictionaryKeyTitle); + rPDFGraphicAnnotation.maText + = pAnnotation->getString(vcl::pdf::constDictionaryKeyContents); rPDFGraphicAnnotation.maDateTime = aDateTime; rPDFGraphicAnnotation.meSubType = eSubtype; rPDFGraphicAnnotation.maColor = aColor; diff --git a/writerfilter/source/dmapper/TableManager.hxx b/writerfilter/source/dmapper/TableManager.hxx index fbace0cfe10b..446fb20f8da5 100644 --- a/writerfilter/source/dmapper/TableManager.hxx +++ b/writerfilter/source/dmapper/TableManager.hxx @@ -140,7 +140,7 @@ class TableManager : public virtual SvRefBase mpRowProps.clear(); } - void setRowProps(TablePropertyMapPtr pProps) + void setRowProps(const TablePropertyMapPtr& pProps) { mpRowProps = pProps; } diff --git a/xmloff/source/text/txtlists.cxx b/xmloff/source/text/txtlists.cxx index 9b3b46f175e7..1d8d7ebe5dac 100644 --- a/xmloff/source/text/txtlists.cxx +++ b/xmloff/source/text/txtlists.cxx @@ -143,10 +143,8 @@ void XMLTextListsHelper::KeepListAsProcessed( const OUString& sListId, if ( mpMapListIdToListStyleDefaultListId->find( sListStyleName ) == mpMapListIdToListStyleDefaultListId->end() ) { - ::std::pair< OUString, OUString > - aListIdMapData( sListId, sListStyleDefaultListId ); (*mpMapListIdToListStyleDefaultListId)[ sListStyleName ] = - aListIdMapData; + ::std::pair<OUString, OUString>(sListId, sListStyleDefaultListId); } } |