svx/source/dialog/compressgraphicdialog.cxx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
New commits: commit 086a546c2f30e918dad8793834559ae930d11e7a Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Thu Apr 20 11:47:43 2023 +0200 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Thu Apr 20 14:40:14 2023 +0200 tdf#153190 Compressing tool calculates compression rate wrong on large images calculation used sal_Int32, which overflowed on large values, rather use floating point to do the calculation Change-Id: I15974c5bf785a800a8f71711acfa9895361bad7d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150683 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> (cherry picked from commit b167bc073b6b83110242bfbace107f6978e5bca7) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150627 Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/svx/source/dialog/compressgraphicdialog.cxx b/svx/source/dialog/compressgraphicdialog.cxx index 91399497c48e..a8be5ed6c5e8 100644 --- a/svx/source/dialog/compressgraphicdialog.cxx +++ b/svx/source/dialog/compressgraphicdialog.cxx @@ -377,7 +377,11 @@ IMPL_LINK_NOARG( CompressGraphicsDialog, CalculateClickHdl, weld::Button&, void { OUString aSizeAsString = OUString::number(aSize / 1024); - OUString aReductionSizeAsString = OUString::number( m_aNativeSize > 0 ? (m_aNativeSize - aSize) * 100 / m_aNativeSize : 0 ); + OUString aReductionSizeAsString; + if (m_aNativeSize > 0 ) + aReductionSizeAsString = OUString::number( static_cast<sal_Int32>((m_aNativeSize - aSize) * 100.0 / m_aNativeSize) ); + else + aReductionSizeAsString = "0"; OUString aNewSizeString = SvxResId(STR_IMAGE_CAPACITY_WITH_REDUCTION); aNewSizeString = aNewSizeString.replaceAll("$(CAPACITY)", aSizeAsString);