diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-01-27 09:42:33 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2021-01-27 12:12:39 +0100 |
commit | 8a461913ee1191562b32fbb24b47d276a93b208c (patch) | |
tree | 9c44ae35777b262aa76e5873e94f672f47443c59 | |
parent | 97e929a61c2d1679c02eb9fb4c13f54a5f0f1988 (diff) |
cid#1472566 silence Unintended sign extension
and hopefully also
cid#1472568 Division or modulo by zero
Change-Id: Ic774b11fc17f8635c769df912bba4fff69f87d0e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110007
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | sc/inc/document.hxx | 4 | ||||
-rw-r--r-- | sc/inc/table.hxx | 2 | ||||
-rw-r--r-- | sc/source/core/data/document.cxx | 2 | ||||
-rw-r--r-- | sc/source/core/data/table2.cxx | 8 |
4 files changed, 8 insertions, 8 deletions
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index c49cfa6ccfa5..e7ebb3653138 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -1886,7 +1886,7 @@ public: * grid, return the first visible row whose top position is below the * specified height. */ - SCROW GetRowForHeight( SCTAB nTab, tools::Long nHeight ) const; + SCROW GetRowForHeight( SCTAB nTab, sal_uLong nHeight ) const; sal_uLong GetScaledRowHeight( SCROW nStartRow, SCROW nEndRow, SCTAB nTab, double fScale, const sal_uLong* pnMaxHeight = nullptr ) const; SC_DLLPUBLIC sal_uLong GetColOffset( SCCOL nCol, SCTAB nTab, bool bHiddenAsZero = true ) const; SC_DLLPUBLIC sal_uLong GetRowOffset( SCROW nRow, SCTAB nTab, bool bHiddenAsZero = true ) const; @@ -1910,7 +1910,7 @@ public: void UpdateAllRowHeights( sc::RowHeightContext& rCxt, const ScMarkData* pTabMark ); - tools::Long GetNeededSize( SCCOL nCol, SCROW nRow, SCTAB nTab, + tools::Long GetNeededSize( SCCOL nCol, SCROW nRow, SCTAB nTab, OutputDevice* pDev, double nPPTX, double nPPTY, const Fraction& rZoomX, const Fraction& rZoomY, diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index 9dbca1bb1ae7..1962290cb862 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -826,7 +826,7 @@ public: * * @return SCROW last row of the range within specified height. */ - SCROW GetRowForHeight(tools::Long nHeight) const; + SCROW GetRowForHeight(sal_uLong nHeight) const; sal_uInt16 GetOriginalWidth( SCCOL nCol ) const; sal_uInt16 GetOriginalHeight( SCROW nRow ) const; diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index 8dfbe0be3252..5bbdd06266ee 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -4188,7 +4188,7 @@ sal_uLong ScDocument::GetRowHeight( SCROW nStartRow, SCROW nEndRow, SCTAB nTab, return 0; } -SCROW ScDocument::GetRowForHeight( SCTAB nTab, tools::Long nHeight ) const +SCROW ScDocument::GetRowForHeight( SCTAB nTab, sal_uLong nHeight ) const { return maTabs[nTab]->GetRowForHeight(nHeight); } diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx index e8b0211a5f58..0d8ccaac55ce 100644 --- a/sc/source/core/data/table2.cxx +++ b/sc/source/core/data/table2.cxx @@ -3966,9 +3966,9 @@ sal_uLong ScTable::GetRowOffset( SCROW nRow, bool bHiddenAsZero ) const return n; } -SCROW ScTable::GetRowForHeight(tools::Long nHeight) const +SCROW ScTable::GetRowForHeight(sal_uLong nHeight) const { - tools::Long nSum = 0; + sal_uLong nSum = 0; ScFlatBoolRowSegments::RangeData aData; @@ -4002,8 +4002,8 @@ SCROW ScTable::GetRowForHeight(tools::Long nHeight) const SCROW nCommon = nLastCommon - nRow + 1; // how much further to go ? - tools::Long nPixelsLeft = nHeight - nSum; - tools::Long nCommonPixels = aRowHeightRange.mnValue * nCommon; + sal_uLong nPixelsLeft = nHeight - nSum; + sal_uLong nCommonPixels = static_cast<sal_uLong>(aRowHeightRange.mnValue) * nCommon; // are we in the zone ? if (nCommonPixels > nPixelsLeft) |