[Libreoffice-commits] core.git: svtools/source
Stephan Bergmann (via logerrit)
logerrit at kemper.freedesktop.org
Mon Jan 27 10:05:55 UTC 2020
svtools/source/filter/exportdialog.cxx | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
New commits:
commit 9e539380aea76543b7c1a7880c3eaec00bb5561e
Author: Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Mon Jan 27 08:51:23 2020 +0100
Commit: Stephan Bergmann <sbergman at redhat.com>
CommitDate: Mon Jan 27 11:05:19 2020 +0100
Make sure MaxFilesizeForRealtimePreview read from configuration is non-negative
...thus justifying casting it to unsigned
Change-Id: I989f6860a484f7ac3ccd94b2ae83ba767fae6ed2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87483
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
diff --git a/svtools/source/filter/exportdialog.cxx b/svtools/source/filter/exportdialog.cxx
index fda3e68d731b..b355a16f8968 100644
--- a/svtools/source/filter/exportdialog.cxx
+++ b/svtools/source/filter/exportdialog.cxx
@@ -17,7 +17,11 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+#include <algorithm>
+
+#include <o3tl/safeint.hxx>
#include <tools/stream.hxx>
#include <tools/fract.hxx>
#include <vcl/graphicfilter.hxx>
@@ -540,7 +544,7 @@ sal_uInt32 ExportDialog::GetRawFileSize() const
// to determine the exact graphic output size and preview for jpg
bool ExportDialog::IsTempExportAvailable() const
{
- return GetRawFileSize() < static_cast< sal_uInt32 >( mnMaxFilesizeForRealtimePreview );
+ return GetRawFileSize() < o3tl::make_unsigned( mnMaxFilesizeForRealtimePreview );
}
ExportDialog::ExportDialog(FltCallDialogParameter& rPara,
@@ -622,7 +626,8 @@ ExportDialog::ExportDialog(FltCallDialogParameter& rPara,
? mpOptionsItem->ReadInt32("PixelExportUnit", UNIT_DEFAULT)
: mpOptionsItem->ReadInt32("VectorExportUnit", UNIT_DEFAULT);
- mnMaxFilesizeForRealtimePreview = mpOptionsItem->ReadInt32("MaxFilesizeForRealtimePreview", 0);
+ mnMaxFilesizeForRealtimePreview = std::max(
+ mpOptionsItem->ReadInt32("MaxFilesizeForRealtimePreview", 0), sal_Int32(0));
mxFtEstimatedSize->set_label(" \n ");
m_xDialog->set_title(m_xDialog->get_title().replaceFirst("%1", maExt)); //Set dialog title
More information about the Libreoffice-commits
mailing list