framework/source/services/dispatchhelper.cxx | 7 ++++--- sc/inc/viewuno.hxx | 5 +++-- sc/source/core/data/queryiter.cxx | 4 ++-- sc/source/ui/unoobj/viewuno.cxx | 4 ++-- starmath/source/mathml/export.cxx | 21 +++++++++------------ sw/inc/crsrsh.hxx | 3 ++- sw/source/core/crsr/crsrsh.cxx | 3 +-- sw/source/core/doc/doctxm.cxx | 2 +- sw/source/core/edit/eddel.cxx | 4 ++-- sw/source/core/edit/edglss.cxx | 4 ++-- sw/source/filter/ww8/ww8par5.cxx | 2 +- sw/source/filter/ww8/ww8par6.cxx | 5 ++--- sw/source/filter/ww8/ww8scan.hxx | 2 +- 13 files changed, 32 insertions(+), 34 deletions(-)
New commits: commit 5c783662b9eff425ecb1661f2de18ccaa1b1943c Author: Caolán McNamara <[email protected]> AuthorDate: Sun Jul 21 19:54:16 2024 +0100 Commit: Caolán McNamara <[email protected]> CommitDate: Sun Jul 21 22:40:30 2024 +0200 cid#1556239 Use of auto that causes a copy and cid#1557287 Use of auto that causes a copy cid#1558003 Use of auto that causes a copy cid#1557568 Use of auto that causes a copy cid#1556546 Use of auto that causes a copy cid#1557377 Use of auto that causes a copy cid#1608325 Use of auto that causes a copy Change-Id: I84e59d2b14bb1e5856f9cac521ad6542b1784243 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170821 Reviewed-by: Caolán McNamara <[email protected]> Tested-by: Jenkins diff --git a/framework/source/services/dispatchhelper.cxx b/framework/source/services/dispatchhelper.cxx index 109ceb0c6c7d..b743e5b5ba4d 100644 --- a/framework/source/services/dispatchhelper.cxx +++ b/framework/source/services/dispatchhelper.cxx @@ -113,9 +113,10 @@ css::uno::Any SAL_CALL DispatchHelper::executeDispatch( bool bOnMainThread = aDescriptor.getUnpackedValueOrDefault(u"OnMainThread"_ustr, false); if (bOnMainThread) - return vcl::solarthread::syncExecute([this, &xDispatch, &aURL, &lArguments]() { - return executeDispatch(xDispatch, aURL, true, lArguments); - }); + return vcl::solarthread::syncExecute( + [this, &xDispatch, &aURL, &lArguments]() -> css::uno::Any { + return executeDispatch(xDispatch, aURL, true, lArguments); + }); else return executeDispatch(xDispatch, aURL, true, lArguments); } diff --git a/sc/inc/viewuno.hxx b/sc/inc/viewuno.hxx index 483f9631551f..c1f75beeb2a9 100644 --- a/sc/inc/viewuno.hxx +++ b/sc/inc/viewuno.hxx @@ -142,11 +142,12 @@ class ScTabViewObj final : public ScViewPaneBase, public css::sheet::XSelectedSheetsSupplier { private: + typedef std::vector<css::uno::Reference<css::sheet::XRangeSelectionListener>> RangeSelListeners; + SfxItemPropertySet aPropSet; std::vector<css::uno::Reference<css::view::XSelectionChangeListener> > aSelectionChgListeners; - std::vector<css::uno::Reference<css::sheet::XRangeSelectionListener> > - aRangeSelListeners; + RangeSelListeners aRangeSelListeners; std::vector<css::uno::Reference<css::sheet::XRangeSelectionChangeListener> > aRangeChgListeners; std::vector<css::uno::Reference<css::beans::XPropertyChangeListener> > diff --git a/sc/source/core/data/queryiter.cxx b/sc/source/core/data/queryiter.cxx index ae8b5b2a38e8..cd167fb33280 100644 --- a/sc/source/core/data/queryiter.cxx +++ b/sc/source/core/data/queryiter.cxx @@ -572,8 +572,8 @@ bool ScQueryCellIteratorBase< accessType, queryType >::BinarySearch( SCCOLROW co return false; } - auto aIndexer = maParam.bByRow ? MakeBinarySearchIndexer(&pCol->maCells, nRow, maParam.nRow2) : - MakeBinarySearchIndexer(nullptr, nCol, maParam.nCol2); + auto aIndexer(maParam.bByRow ? MakeBinarySearchIndexer(&pCol->maCells, nRow, maParam.nRow2) : + MakeBinarySearchIndexer(nullptr, nCol, maParam.nCol2)); if (!aIndexer.isValid()) return false; diff --git a/sc/source/ui/unoobj/viewuno.cxx b/sc/source/ui/unoobj/viewuno.cxx index dc1169bfe871..31cf4dd6296f 100644 --- a/sc/source/ui/unoobj/viewuno.cxx +++ b/sc/source/ui/unoobj/viewuno.cxx @@ -2067,7 +2067,7 @@ void ScTabViewObj::RangeSelDone( const OUString& rText ) aEvent.RangeDescriptor = rText; // copy on the stack because listener could remove itself - auto const listeners(aRangeSelListeners); + const RangeSelListeners listeners(aRangeSelListeners); for (const auto& rListener : listeners) rListener->done( aEvent ); @@ -2080,7 +2080,7 @@ void ScTabViewObj::RangeSelAborted( const OUString& rText ) aEvent.RangeDescriptor = rText; // copy on the stack because listener could remove itself - auto const listeners(aRangeSelListeners); + const RangeSelListeners listeners(aRangeSelListeners); for (const auto& rListener : listeners) rListener->aborted( aEvent ); diff --git a/starmath/source/mathml/export.cxx b/starmath/source/mathml/export.cxx index 3241f42c9d9e..028ebcef76a7 100644 --- a/starmath/source/mathml/export.cxx +++ b/starmath/source/mathml/export.cxx @@ -753,9 +753,8 @@ void SmMLExport::exportMlAttributes(const SmMlElement* pMlElement) } case SmMlAttributeValueType::MlLspace: { - auto aSizeData = aAttribute.getMlLspace(); - auto aLengthData = aSizeData->m_aLengthValue; - exportMlAttributeLength(XML_LSPACE, aLengthData); + auto pSizeData = aAttribute.getMlLspace(); + exportMlAttributeLength(XML_LSPACE, pSizeData->m_aLengthValue); break; } case SmMlAttributeValueType::MlMathbackground: @@ -874,9 +873,8 @@ void SmMLExport::exportMlAttributes(const SmMlElement* pMlElement) } case SmMlAttributeValueType::MlMaxsize: { - auto aSizeData = aAttribute.getMlMaxsize(); - auto aLengthData = aSizeData->m_aLengthValue; - switch (aSizeData->m_aMaxsize) + auto pSizeData = aAttribute.getMlMaxsize(); + switch (pSizeData->m_aMaxsize) { case SmMlAttributeValueMaxsize::MlInfinity: { @@ -885,7 +883,7 @@ void SmMLExport::exportMlAttributes(const SmMlElement* pMlElement) } case SmMlAttributeValueMaxsize::MlFinite: { - exportMlAttributeLength(XML_MAXSIZE, aLengthData); + exportMlAttributeLength(XML_MAXSIZE, pSizeData->m_aLengthValue); break; } } @@ -893,9 +891,8 @@ void SmMLExport::exportMlAttributes(const SmMlElement* pMlElement) } case SmMlAttributeValueType::MlMinsize: { - auto aSizeData = aAttribute.getMlMinsize(); - auto aLengthData = aSizeData->m_aLengthValue; - exportMlAttributeLength(XML_MINSIZE, aLengthData); + auto pSizeData = aAttribute.getMlMinsize(); + exportMlAttributeLength(XML_MINSIZE, pSizeData->m_aLengthValue); break; } case SmMlAttributeValueType::MlMovablelimits: @@ -917,8 +914,8 @@ void SmMLExport::exportMlAttributes(const SmMlElement* pMlElement) } case SmMlAttributeValueType::MlRspace: { - auto aSizeData = aAttribute.getMlRspace(); - exportMlAttributeLength(XML_RSPACE, aSizeData->m_aLengthValue); + auto pSizeData = aAttribute.getMlRspace(); + exportMlAttributeLength(XML_RSPACE, pSizeData->m_aLengthValue); break; } case SmMlAttributeValueType::MlSeparator: diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx index 2417fb507cae..4727f92f79a1 100644 --- a/sw/inc/crsrsh.hxx +++ b/sw/inc/crsrsh.hxx @@ -345,7 +345,8 @@ public: // only for usage in special cases allowed! void ExtendedSelectAll(bool bFootnotes = true); /// If ExtendedSelectAll() was called and selection didn't change since then. - ::std::optional<::std::pair<SwNode const*, ::std::vector<SwTableNode*>>> ExtendedSelectedAll() const; + typedef std::optional<std::pair<SwNode const*, std::vector<SwTableNode*>>> ExtendedSelection; + ExtendedSelection ExtendedSelectedAll() const; enum class StartsWith { None, Table, HiddenPara, HiddenSection }; /// If document body starts with a table or starts/ends with hidden paragraph. StartsWith StartsWith_(); diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx index c4575aef2bc7..cb3ff93babd0 100644 --- a/sw/source/core/crsr/crsrsh.cxx +++ b/sw/source/core/crsr/crsrsh.cxx @@ -833,8 +833,7 @@ static typename SwCursorShell::StartsWith EndsWith(SwStartNode const& rStart) // return the node that is the start of the extended selection (to include table // or section start nodes; looks like extending for end nodes is not required) -::std::optional<::std::pair<SwNode const*, ::std::vector<SwTableNode*>>> -SwCursorShell::ExtendedSelectedAll() const +SwCursorShell::ExtendedSelection SwCursorShell::ExtendedSelectedAll() const { if (m_pTableCursor) { diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx index 6b22fcad413a..00d8e06eb0bb 100644 --- a/sw/source/core/doc/doctxm.cxx +++ b/sw/source/core/doc/doctxm.cxx @@ -1296,7 +1296,7 @@ void SwTOXBaseSection::UpdateMarks(const SwTOXInternational& rIntl, auto& rNode = rMark.get().GetTextNode(); if(IsFromChapter() && !IsHeadingContained(pOwnChapterNode, rNode)) continue; - auto rTOXMark = rMark.get().GetTOXMark(); + const SwTOXMark& rTOXMark = rMark.get().GetTOXMark(); if(TOX_INDEX == eTOXTyp) { // index entry mark diff --git a/sw/source/core/edit/eddel.cxx b/sw/source/core/edit/eddel.cxx index b8d6b0e39554..654b9b0fb547 100644 --- a/sw/source/core/edit/eddel.cxx +++ b/sw/source/core/edit/eddel.cxx @@ -36,9 +36,9 @@ void SwEditShell::DeleteSel(SwPaM& rPam, bool const isArtificialSelection, bool goLeft, bool* const pUndo) { - auto const oSelectAll(StartsWith_() != SwCursorShell::StartsWith::None + const ExtendedSelection oSelectAll(StartsWith_() != SwCursorShell::StartsWith::None ? ExtendedSelectedAll() - : ::std::optional<::std::pair<SwNode const*, ::std::vector<SwTableNode *>>>{}); + : ExtendedSelection{}); // only for selections if (!rPam.HasMark() || (*rPam.GetPoint() == *rPam.GetMark() diff --git a/sw/source/core/edit/edglss.cxx b/sw/source/core/edit/edglss.cxx index 535aaa23e806..846e8c2059c3 100644 --- a/sw/source/core/edit/edglss.cxx +++ b/sw/source/core/edit/edglss.cxx @@ -197,9 +197,9 @@ bool SwEditShell::CopySelToDoc( SwDoc& rInsDoc ) bool bColSel = GetCursor_()->IsColumnSelection(); if( bColSel && rInsDoc.IsClipBoard() ) rInsDoc.SetColumnSelection( true ); - auto const oSelectAll(StartsWith_() != SwCursorShell::StartsWith::None + const ExtendedSelection oSelectAll(StartsWith_() != SwCursorShell::StartsWith::None ? ExtendedSelectedAll() - : ::std::optional<::std::pair<SwNode const*, ::std::vector<SwTableNode*>>>{}); + : ExtendedSelection{}); { for(SwPaM& rPaM : GetCursor()->GetRingContainer()) { commit a97efa53de6037d4603582e10e6dd7818f2dd3a1 Author: Caolán McNamara <[email protected]> AuthorDate: Sun Jul 21 19:35:53 2024 +0100 Commit: Caolán McNamara <[email protected]> CommitDate: Sun Jul 21 22:40:22 2024 +0200 cid#1606961 silence Overflowed array index read and cid#1606751 Overflowed array index read Change-Id: If9681a61b14b68e6d1f12b0d4907ab23180972f2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170819 Tested-by: Caolán McNamara <[email protected]> Reviewed-by: Caolán McNamara <[email protected]> diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx index 7ab28e7a70ec..83b2ba301f53 100644 --- a/sw/source/filter/ww8/ww8par5.cxx +++ b/sw/source/filter/ww8/ww8par5.cxx @@ -938,7 +938,7 @@ tools::Long SwWW8ImplReader::Read_Field(WW8PLCFManResult* pRes) return 0; sal_uInt16 n = (aF.nId <= eMax) ? aF.nId : eMax; - sal_uInt16 nI = n / 32; // # of sal_uInt32 + sal_uInt32 nI = n / 32U; // # of sal_uInt32 sal_uInt32 nMask = 1 << ( n % 32 ); // Mask for bits if (SAL_N_ELEMENTS(m_nFieldTagAlways) <= nI) diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx index e772ed9017d1..727271b7d1a3 100644 --- a/sw/source/filter/ww8/ww8par6.cxx +++ b/sw/source/filter/ww8/ww8par6.cxx @@ -5437,9 +5437,8 @@ tools::Long SwWW8ImplReader::ImportExtSprm(WW8PLCFManResult* pRes) if( pRes->nSprmId < 280 ) { - sal_uInt8 nIdx = static_cast< sal_uInt8 >(pRes->nSprmId - eFTN); - if( nIdx < SAL_N_ELEMENTS(aWwSprmTab) - && aWwSprmTab[nIdx] ) + sal_uInt16 nIdx = pRes->nSprmId - eFTN; + if (nIdx < SAL_N_ELEMENTS(aWwSprmTab) && aWwSprmTab[nIdx]) return (this->*aWwSprmTab[nIdx])(pRes); else return 0; diff --git a/sw/source/filter/ww8/ww8scan.hxx b/sw/source/filter/ww8/ww8scan.hxx index b82cd1adb777..74f2efb2bead 100644 --- a/sw/source/filter/ww8/ww8scan.hxx +++ b/sw/source/filter/ww8/ww8scan.hxx @@ -385,7 +385,7 @@ public: enum ePLCFT{ CHP=0, PAP, SEP, /*HED, FNR, ENR,*/ PLCF_END }; //It's hardcoded that eFTN be the first one: a very poor hack, needs to be fixed -enum eExtSprm { eFTN = 256, eEDN = 257, eFLD = 258, eBKN = 259, eAND = 260, eATNBKN = 261, eFACTOIDBKN = 262 }; +enum eExtSprm : sal_uInt16 { eFTN = 256, eEDN = 257, eFLD = 258, eBKN = 259, eAND = 260, eATNBKN = 261, eFACTOIDBKN = 262 }; /* pure virtual:
