summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--basegfx/source/polygon/b2dsvgpolypolygon.cxx6
-rw-r--r--scaddins/source/analysis/analysis.cxx2
-rw-r--r--sfx2/source/view/lokcharthelper.cxx3
-rw-r--r--svl/source/numbers/zformat.cxx2
-rw-r--r--svx/source/svdraw/svdpage.cxx2
-rw-r--r--sw/source/core/crsr/trvlfnfl.cxx9
-rw-r--r--sw/source/core/doc/DocumentStylePoolManager.cxx5
-rw-r--r--sw/source/core/doc/doccomp.cxx2
-rw-r--r--sw/source/core/doc/docftn.cxx2
-rw-r--r--sw/source/uibase/dochdl/gloshdl.cxx8
10 files changed, 24 insertions, 17 deletions
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 )
{