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 <tml@collabora.com>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
This commit is contained in:
Tor Lillqvist 2022-11-02 09:34:42 +02:00
parent c4f5d456e5
commit 4f88a1d624

View file

@ -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 );
}