summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2021-08-24 15:58:15 +0200
committerMike Kaganski <mike.kaganski@collabora.com>2021-08-25 17:12:14 +0200
commite9ab5a5e4e725a348a4276b72fda63cdac2a131c (patch)
tree9579178de0f9a8af32474c93a4a85a5c7c91d828 /oox
parentc1ad429d925855c1baacbdeca1ef42f4486eb9c2 (diff)
Introduce o3tl::saturating_cast for floating-point->integer conversion
Change-Id: I73191e5ab25fdd9fd8a788db9858b5eb9d3ab955 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120885 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'oox')
-rw-r--r--oox/source/vml/vmlformatting.cxx9
1 files changed, 1 insertions, 8 deletions
diff --git a/oox/source/vml/vmlformatting.cxx b/oox/source/vml/vmlformatting.cxx
index b7dc37b5e940..ef7e692838fe 100644
--- a/oox/source/vml/vmlformatting.cxx
+++ b/oox/source/vml/vmlformatting.cxx
@@ -201,14 +201,7 @@ sal_Int64 ConversionHelper::decodeMeasureToEmu( const GraphicHelper& rGraphicHel
OSL_FAIL( "ConversionHelper::decodeMeasureToEmu - unknown measure unit" );
fValue = nRefValue;
}
- fValue += 0.5;
- if (!o3tl::convertsToAtMost(fValue, std::numeric_limits<sal_Int64>::max())) {
- return std::numeric_limits<sal_Int64>::max();
- }
- if (!o3tl::convertsToAtLeast(fValue, std::numeric_limits<sal_Int64>::min())) {
- return std::numeric_limits<sal_Int64>::min();
- }
- return static_cast< sal_Int64 >( fValue );
+ return o3tl::saturating_cast< sal_Int64 >( fValue + 0.5 );
}
sal_Int32 ConversionHelper::decodeMeasureToHmm( const GraphicHelper& rGraphicHelper,