[Libreoffice-commits] core.git: extensions/source

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Tue Aug 13 12:28:07 UTC 2019


 extensions/source/propctrlr/standardcontrol.cxx |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit e5a6873aa9b95912f35baaf7fdb067c2fcb961b3
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Tue Aug 13 10:54:44 2019 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Tue Aug 13 14:27:25 2019 +0200

    Fix Clang 10 -Werror,-Wimplicit-int-float-conversion
    
    > extensions/source/propctrlr/standardcontrol.cxx:239:18: error: implicit conversion from 'std::__1::numeric_limits<long>::type' (aka 'long') to 'double' changes value from 9223372036854775807 to 9223372036854775808 [-Werror,-Wimplicit-int-float-conversion]
    >         if ( n > std::numeric_limits< long >::max() )
    >                ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    Change-Id: I2edca1baaf91734ab94dd49208d8608fc33b7fbe
    Reviewed-on: https://gerrit.libreoffice.org/77385
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/extensions/source/propctrlr/standardcontrol.cxx b/extensions/source/propctrlr/standardcontrol.cxx
index 948e97278adb..b5654c89eb11 100644
--- a/extensions/source/propctrlr/standardcontrol.cxx
+++ b/extensions/source/propctrlr/standardcontrol.cxx
@@ -28,6 +28,7 @@
 #include <com/sun/star/util/MeasureUnit.hpp>
 #include <com/sun/star/inspection/PropertyControlType.hpp>
 #include <comphelper/string.hxx>
+#include <o3tl/float_int_conversion.hxx>
 #include <rtl/math.hxx>
 #include <sfx2/objsh.hxx>
 
@@ -236,7 +237,7 @@ namespace pcr
         for ( sal_uInt16 d = 0; d < nDigits; ++d )
             n *= 10;
 
-        if ( n > std::numeric_limits< long >::max() )
+        if ( !o3tl::convertsToAtMost(n, std::numeric_limits< long >::max()) )
             return std::numeric_limits< long >::max();
         return static_cast<long>(n);
     }


More information about the Libreoffice-commits mailing list