summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2020-01-27 08:51:23 +0100
committerStephan Bergmann <sbergman@redhat.com>2020-01-27 11:05:19 +0100
commit9e539380aea76543b7c1a7880c3eaec00bb5561e (patch)
tree74da9b8193ae0ab97e295005a11b1747969f2855
parent2d089b2adc1fc67a7621c3078b6b37c5e997789c (diff)
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@redhat.com>
-rw-r--r--svtools/source/filter/exportdialog.cxx9
1 files 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 <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