From 9e539380aea76543b7c1a7880c3eaec00bb5561e Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Mon, 27 Jan 2020 08:51:23 +0100 Subject: 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 --- svtools/source/filter/exportdialog.cxx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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 +#include + +#include #include #include #include @@ -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 -- cgit