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.grandin@collabora.co.uk>
diff --git a/svx/source/dialog/compressgraphicdialog.cxx b/svx/source/dialog/compressgraphicdialog.cxx
index 9139949..a8be5ed 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);