cid#1606752 silence Overflowed return value

and

cid#1607158 Overflowed return value
cid#1607271 Overflowed return value
cid#1608107 Overflowed return value
cid#1606975 Overflowed return value
cid#1608009 Overflowed return value
cid#1608353 Overflowed return value
cid#1608486 Overflowed return value
cid#1607009 Overflowed return value
cid#1606780 Overflowed return value

its totally unclear what the source of these warnings is

Change-Id: If46cac6a329dec397bd784f57d9ffe5e53af9a1a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176683
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins
This commit is contained in:
Caolán McNamara 2024-11-14 13:12:46 +00:00
parent 0847c140a1
commit 2b8394b36b
4 changed files with 18 additions and 28 deletions

View file

@ -228,7 +228,9 @@ public:
tools::Long GetVisDocLeft() const { return maVisDocStartPos.X(); }
tools::Long GetVisDocTop() const { return maVisDocStartPos.Y(); }
// coverity[ tainted_data_return : FALSE ] version 2023.12.2
tools::Long GetVisDocRight() const { return maVisDocStartPos.X() + (!IsVertical() ? maOutArea.GetWidth() : maOutArea.GetHeight()); }
// coverity[ tainted_data_return : FALSE ] version 2023.12.2
tools::Long GetVisDocBottom() const { return maVisDocStartPos.Y() + (!IsVertical() ? maOutArea.GetHeight() : maOutArea.GetWidth()); }
tools::Rectangle GetVisDocArea() const;
@ -387,14 +389,10 @@ public:
tools::Long GetVisDocLeft() const { return maVisDocStartPos.X(); }
tools::Long GetVisDocTop() const { return maVisDocStartPos.Y(); }
tools::Long GetVisDocRight() const
{
return maVisDocStartPos.X() + ( !IsVertical() ? maOutputArea.GetWidth() : maOutputArea.GetHeight() );
}
tools::Long GetVisDocBottom() const
{
return maVisDocStartPos.Y() + ( !IsVertical() ? maOutputArea.GetHeight() : maOutputArea.GetWidth() );
}
// coverity[ tainted_data_return : FALSE ] version 2023.12.2
tools::Long GetVisDocRight() const { return maVisDocStartPos.X() + ( !IsVertical() ? maOutputArea.GetWidth() : maOutputArea.GetHeight() ); }
// coverity[ tainted_data_return : FALSE ] version 2023.12.2
tools::Long GetVisDocBottom() const { return maVisDocStartPos.Y() + ( !IsVertical() ? maOutputArea.GetHeight() : maOutputArea.GetWidth() ); }
tools::Rectangle GetVisDocArea() const;
const EditSelection& GetEditSelection() const { return maEditSelection; }

View file

@ -103,6 +103,7 @@ constexpr sal_Int64 MulDivSaturate(I n, sal_Int64 m, sal_Int64 d)
{
if (m > d && std::make_unsigned_t<I>(n) > sal_uInt64(SAL_MAX_INT64 / m * d - d_2))
return SAL_MAX_INT64; // saturate
// coverity[ tainted_data_return : FALSE ] version 2023.12.2
return saturating_add<sal_uInt64>(n, d_2) / d * m; // divide before multiplication
}
else if constexpr (std::is_signed_v<I>) // n < 0; don't compile for unsigned n

View file

@ -294,8 +294,11 @@ class SW_DLLPUBLIC SwView: public SfxViewShell
DECL_DLLPRIVATE_LINK( TimeoutHdl, Timer*, void );
inline tools::Long GetXScroll() const;
inline tools::Long GetYScroll() const;
// coverity[ tainted_data_return : FALSE ] version 2023.12.2
tools::Long GetXScroll() const { return (m_aVisArea.GetWidth() * nScrollX) / 100; }
// coverity[ tainted_data_return : FALSE ] version 2023.12.2
tools::Long GetYScroll() const { return (m_aVisArea.GetHeight() * nScrollY) / 100; }
SAL_DLLPRIVATE Point AlignToPixel(const Point& rPt) const;
SAL_DLLPRIVATE void CalcPt( Point* pPt,const tools::Rectangle& rRect,
sal_uInt16 nRangeX,
@ -590,9 +593,10 @@ public:
}
// hand over Shell
SfxShell *GetCurShell() { return m_pShell; }
SwDocShell *GetDocShell();
inline const SwDocShell *GetDocShell() const;
SfxShell *GetCurShell() { return m_pShell; }
SwDocShell *GetDocShell();
const SwDocShell *GetDocShell() const { return const_cast<SwView*>(this)->GetDocShell(); }
virtual FmFormShell *GetFormShell() override { return m_pFormShell; }
virtual const FmFormShell *GetFormShell() const override { return m_pFormShell; }
@ -738,21 +742,6 @@ public:
void BringToAttention(const SwNode* pNode);
};
inline tools::Long SwView::GetXScroll() const
{
return (m_aVisArea.GetWidth() * nScrollX) / 100;
}
inline tools::Long SwView::GetYScroll() const
{
return (m_aVisArea.GetHeight() * nScrollY) / 100;
}
inline const SwDocShell *SwView::GetDocShell() const
{
return const_cast<SwView*>(this)->GetDocShell();
}
std::unique_ptr<SfxTabPage> CreatePrintOptionsPage(weld::Container* pPage, weld::DialogController* pController,
const SfxItemSet &rOptions,
bool bPreview);

View file

@ -277,6 +277,7 @@ tools::Long OutputDevice::ImplLogicXToDevicePixel( tools::Long nX ) const
if ( !mbMap )
return nX+mnOutOffX;
// coverity[ tainted_data_return : FALSE ] version 2023.12.2
return ImplLogicToPixel( nX + maMapRes.mnMapOfsX, mnDPIX,
maMapRes.mnMapScNumX, maMapRes.mnMapScDenomX )+mnOutOffX+mnOutOffOrigX;
}
@ -286,6 +287,7 @@ tools::Long OutputDevice::ImplLogicYToDevicePixel( tools::Long nY ) const
if ( !mbMap )
return nY+mnOutOffY;
// coverity[ tainted_data_return : FALSE ] version 2023.12.2
return ImplLogicToPixel( nY + maMapRes.mnMapOfsY, mnDPIY,
maMapRes.mnMapScNumY, maMapRes.mnMapScDenomY )+mnOutOffY+mnOutOffOrigY;
}