stoc/source/typeconv/convert.cxx |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 4f88a1d624a97f53b58d3cdf36b2f5cfc237da59
Author:     Tor Lillqvist <t...@collabora.com>
AuthorDate: Wed Nov 2 09:34:42 2022 +0200
Commit:     Tor Lillqvist <t...@collabora.com>
CommitDate: Wed Nov 2 11:21:21 2022 +0100

    Use o3tl::to_underlying() instead of static_cast<int>()
    
    sberg says it is better, and I trust him.
    
    Change-Id: I32b343cd899f807c0eb803e74e856b0eb9610074
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142132
    Tested-by: Tor Lillqvist <t...@collabora.com>
    Reviewed-by: Tor Lillqvist <t...@collabora.com>

diff --git a/stoc/source/typeconv/convert.cxx b/stoc/source/typeconv/convert.cxx
index 445163f923f1..51b857b424c6 100644
--- a/stoc/source/typeconv/convert.cxx
+++ b/stoc/source/typeconv/convert.cxx
@@ -22,6 +22,7 @@
 #include <o3tl/any.hxx>
 #include <o3tl/safeint.hxx>
 #include <o3tl/string_view.hxx>
+#include <o3tl/underlyingenumvalue.hxx>
 #include <osl/diagnose.h>
 #include <cppuhelper/implbase.hxx>
 #include <cppuhelper/supportsservice.hxx>
@@ -359,7 +360,7 @@ sal_Int64 TypeConverter_Impl::toHyper( const Any& rAny, 
sal_Int64 min, sal_uInt6
 
     default:
         throw CannotConvertException(
-            "Type " + OUString::number(static_cast<int>(aDestinationClass)) + 
" is not supported!",
+            "Type " + OUString::number(o3tl::to_underlying(aDestinationClass)) 
+ " is not supported!",
             Reference<XInterface>(), aDestinationClass, 
FailReason::TYPE_NOT_SUPPORTED, 0 );
     }
 
@@ -439,7 +440,7 @@ double TypeConverter_Impl::toDouble( const Any& rAny, 
double min, double max )
 
     default:
         throw CannotConvertException(
-            "Type " + OUString::number(static_cast<int>(aDestinationClass)) + 
" is not supported!",
+            "Type " + OUString::number(o3tl::to_underlying(aDestinationClass)) 
+ " is not supported!",
             Reference< XInterface >(), aDestinationClass, 
FailReason::TYPE_NOT_SUPPORTED, 0 );
     }
 

Reply via email to