basegfx/source/polygon/b2dsvgpolypolygon.cxx | 6 ++++-- scaddins/source/analysis/analysis.cxx | 2 +- sfx2/source/view/lokcharthelper.cxx | 3 ++- svl/source/numbers/zformat.cxx | 2 +- svx/source/svdraw/svdpage.cxx | 2 +- sw/source/core/crsr/trvlfnfl.cxx | 9 +++++---- sw/source/core/doc/DocumentStylePoolManager.cxx | 5 ++++- sw/source/core/doc/doccomp.cxx | 2 +- sw/source/core/doc/docftn.cxx | 2 +- sw/source/uibase/dochdl/gloshdl.cxx | 8 ++++---- 10 files changed, 24 insertions(+), 17 deletions(-)
New commits: commit 35dfb73889a084fc4a428071471429396a7d1287 Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Tue Sep 17 17:02:10 2024 +0100 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Wed Sep 18 21:24:57 2024 +0200 cid#1607355 silence Overflowed constant and cid#1607426 Overflowed constant cid#1608151 Overflowed constant cid#1608163 Overflowed constant cid#1608208 Overflowed constant cid#1608228 Overflowed constant cid#1608299 Overflowed constant cid#1608549 Overflowed constant cid#1607982 Overflowed constant cid#1608078 Overflowed return value Change-Id: Id4ccc03b610f4dcf7912c239c7c079da1aef4ba2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173615 Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> Tested-by: Caolán McNamara <caolan.mcnam...@collabora.com> diff --git a/basegfx/source/polygon/b2dsvgpolypolygon.cxx b/basegfx/source/polygon/b2dsvgpolypolygon.cxx index fe4f646eb3ba..9728a3896de6 100644 --- a/basegfx/source/polygon/b2dsvgpolypolygon.cxx +++ b/basegfx/source/polygon/b2dsvgpolypolygon.cxx @@ -265,15 +265,17 @@ namespace basegfx::utils } // ensure existence of start point - if(!aCurrPoly.count()) + sal_uInt32 nCurrPolyCount = aCurrPoly.count(); + if (nCurrPolyCount == 0) { aCurrPoly.append(B2DPoint(nLastX, nLastY)); + nCurrPolyCount = 1; } // get first control point. It's the reflection of the PrevControlPoint // of the last point. If not existent, use current point (see SVG) B2DPoint aPrevControl(nLastX, nLastY); - const sal_uInt32 nIndex(aCurrPoly.count() - 1); + const sal_uInt32 nIndex(nCurrPolyCount - 1); if(aCurrPoly.areControlPointsUsed() && aCurrPoly.isPrevControlPointUsed(nIndex)) { diff --git a/scaddins/source/analysis/analysis.cxx b/scaddins/source/analysis/analysis.cxx index 249946f3699c..81e12782a320 100644 --- a/scaddins/source/analysis/analysis.cxx +++ b/scaddins/source/analysis/analysis.cxx @@ -407,7 +407,7 @@ sal_Int32 SAL_CALL AnalysisAddIn::getWeeknum( const uno::Reference< beans::XProp DaysToDate( nDate, nDay, nMonth, nYear ); sal_Int32 nFirstInYear = DateToDays( 1, 1, nYear ); - sal_uInt16 nFirstDayInYear = GetDayOfWeek( nFirstInYear ); + sal_Int16 nFirstDayInYear = GetDayOfWeek( nFirstInYear ); return ( nDate - nFirstInYear + ( ( nMode == 1 )? ( nFirstDayInYear + 1 ) % 7 : nFirstDayInYear ) ) / 7 + 1; } diff --git a/sfx2/source/view/lokcharthelper.cxx b/sfx2/source/view/lokcharthelper.cxx index f8e8ec47ea4e..f8b31f7c4f10 100644 --- a/sfx2/source/view/lokcharthelper.cxx +++ b/sfx2/source/view/lokcharthelper.cxx @@ -85,8 +85,9 @@ vcl::Window* LokChartHelper::GetWindow() if (pParent) { sal_uInt16 nTotChildren = pParent->GetChildCount(); - while (nTotChildren--) + while (nTotChildren > 0) { + --nTotChildren; vcl::Window* pChildWin = pParent->GetChild(nTotChildren); if (pChildWin && pChildWin->IsChart()) { diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx index 31991e8c20b5..eda77fc62859 100644 --- a/svl/source/numbers/zformat.cxx +++ b/svl/source/numbers/zformat.cxx @@ -1554,7 +1554,7 @@ OUString SvNumberformat::LocaleType::generateCode() const { aBuf.append(toUniChar(n)); } - n16 = n16 << 4; + n16 = (n16 << 4) & 0xFFFF; } return aBuf.makeStringAndClear(); diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx index 7618c51c825a..db4a041c577d 100644 --- a/svx/source/svdraw/svdpage.cxx +++ b/svx/source/svdraw/svdpage.cxx @@ -684,7 +684,7 @@ void SdrObjList::sort( std::vector<sal_Int32>& sortOrder) { if (nPrev != aDuplicates[i]) aNewSortOrder[i] = aDuplicates[i] + aIncrements[aDuplicates[i]]; - else + else if (i > 0) aNewSortOrder[i] = aNewSortOrder[i-1] + 1; nPrev = aDuplicates[i]; diff --git a/sw/source/core/crsr/trvlfnfl.cxx b/sw/source/core/crsr/trvlfnfl.cxx index 098bad4b3435..46ba4a95002a 100644 --- a/sw/source/core/crsr/trvlfnfl.cxx +++ b/sw/source/core/crsr/trvlfnfl.cxx @@ -296,13 +296,14 @@ bool SwCursor::GotoPrevFootnoteAnchor() } } } - else if( nPos ) + else if (nPos > 0) { // search backwards pTextFootnote = nullptr; - while( nPos ) + while (nPos > 0) { - pTextFootnote = rFootnoteArr[ --nPos ]; + --nPos; + pTextFootnote = rFootnoteArr[nPos]; if( CmpL( *pTextFootnote, nNdPos, nCntPos )) break; // found pTextFootnote = nullptr; @@ -311,7 +312,7 @@ bool SwCursor::GotoPrevFootnoteAnchor() else pTextFootnote = nullptr; } - else if( nPos ) + else if (nPos > 0) pTextFootnote = rFootnoteArr[ nPos-1 ]; if( pTextFootnote == nullptr ) diff --git a/sw/source/core/doc/DocumentStylePoolManager.cxx b/sw/source/core/doc/DocumentStylePoolManager.cxx index 15f463dd29c2..31ca9b0a27a7 100644 --- a/sw/source/core/doc/DocumentStylePoolManager.cxx +++ b/sw/source/core/doc/DocumentStylePoolManager.cxx @@ -2556,13 +2556,16 @@ bool DocumentStylePoolManager::IsPoolFormatUsed( sal_uInt16 nId ) const if( bFnd ) { bFnd = false; - while( nArrCnt-- && !bFnd ) + while (nArrCnt > 0 && !bFnd) + { + --nArrCnt; for( size_t n = 0; !bFnd && n < (*pArray[nArrCnt]).GetFormatCount(); ++n ) { pNewFormat = (*pArray[ nArrCnt ] ).GetFormat( n ); if( nId == pNewFormat->GetPoolFormatId() ) bFnd = true; } + } } // Not found or no dependencies? diff --git a/sw/source/core/doc/doccomp.cxx b/sw/source/core/doc/doccomp.cxx index d813e08965a4..17999886deb1 100644 --- a/sw/source/core/doc/doccomp.cxx +++ b/sw/source/core/doc/doccomp.cxx @@ -1975,7 +1975,7 @@ sal_uInt16 SaveMergeRedline::InsertRedline(SwPaM* pLastDestRedline) SwRedlineTable::size_type n = 0; // find the first redline for StartPos - if( !rDoc.getIDocumentRedlineAccess().GetRedline( *pDStt, &n ) && n ) + if (!rDoc.getIDocumentRedlineAccess().GetRedline( *pDStt, &n ) && n > 0) --n; const SwRedlineTable& rRedlineTable = rDoc.getIDocumentRedlineAccess().GetRedlineTable(); diff --git a/sw/source/core/doc/docftn.cxx b/sw/source/core/doc/docftn.cxx index 690eff41bae0..28ef3c47bcab 100644 --- a/sw/source/core/doc/docftn.cxx +++ b/sw/source/core/doc/docftn.cxx @@ -508,7 +508,7 @@ bool SwDoc::SetCurFootnote( const SwPaM& rPam, const OUString& rNumStr, } nPos = nPosSave; // There are more in the front! - while( nPos ) + while (nPos > 0) { SwTextFootnote* pTextFootnote = rFootnoteArr[ --nPos ]; SwNodeOffset nIdx = SwTextFootnote_GetIndex(pTextFootnote); diff --git a/sw/source/uibase/dochdl/gloshdl.cxx b/sw/source/uibase/dochdl/gloshdl.cxx index c30defd08df8..2e52e68b95d4 100644 --- a/sw/source/uibase/dochdl/gloshdl.cxx +++ b/sw/source/uibase/dochdl/gloshdl.cxx @@ -396,9 +396,9 @@ bool SwGlossaryHdl::Expand(weld::Window* pParent, const OUString& rShortName, // search for text block // - don't prefer current group depending on configuration setting const SvxAutoCorrCfg& rCfg = SvxAutoCorrCfg::Get(); - sal_uInt16 nFound = !rCfg.IsSearchInAllCategories() ? pGlossary->GetIndex( aShortName ) : -1; + sal_uInt16 nFound = !rCfg.IsSearchInAllCategories() ? pGlossary->GetIndex( aShortName ) : USHRT_MAX; // if not found then search in all groups - if( nFound == sal_uInt16(-1) ) + if (nFound == USHRT_MAX) { const ::utl::TransliterationWrapper& rSCmp = GetAppCmpStrIgnore(); SwGlossaryList* pGlossaryList = ::GetGlossaryList(); @@ -454,7 +454,7 @@ bool SwGlossaryHdl::Expand(weld::Window* pParent, const OUString& rShortName, } else { - nFound = sal_uInt16(-1); + nFound = USHRT_MAX; bCancel = true; } } @@ -462,7 +462,7 @@ bool SwGlossaryHdl::Expand(weld::Window* pParent, const OUString& rShortName, } // not found - if( nFound == sal_uInt16(-1) ) + if (nFound == USHRT_MAX) { if( !bCancel ) {