include/o3tl/typed_flags_set.hxx        |  109 ++++++++++++++------------------
 include/o3tl/underlyingenumvalue.hxx    |   28 ++++++++
 sc/inc/address.hxx                      |    5 -
 sc/source/core/tool/address.cxx         |    4 -
 sc/source/core/tool/reffind.cxx         |    6 +
 xmlsecurity/qa/unit/signing/signing.cxx |   45 ++++---------
 6 files changed, 103 insertions(+), 94 deletions(-)

New commits:
commit b612cf0e06de231b7f936269db3b51a7f0e8ae3b
Author:     Stephan Bergmann <sberg...@redhat.com>
AuthorDate: Tue Mar 5 15:41:18 2019 +0100
Commit:     Stephan Bergmann <sberg...@redhat.com>
CommitDate: Tue Mar 5 22:11:48 2019 +0100

    Introduce o3tl::underlyingEnumValue
    
    Change-Id: I6554eb86326159b0da707539f45c411f61c0f3de
    Reviewed-on: https://gerrit.libreoffice.org/68761
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sberg...@redhat.com>

diff --git a/include/o3tl/typed_flags_set.hxx b/include/o3tl/typed_flags_set.hxx
index 188258febc58..bf795908bad5 100644
--- a/include/o3tl/typed_flags_set.hxx
+++ b/include/o3tl/typed_flags_set.hxx
@@ -25,6 +25,7 @@
 #include <cassert>
 #include <type_traits>
 
+#include <o3tl/underlyingenumvalue.hxx>
 #include <sal/types.h>
 
 namespace o3tl {
@@ -104,10 +105,10 @@ template<typename E>
 constexpr typename o3tl::typed_flags<E>::Wrap operator ~(E rhs) {
     assert(
         o3tl::detail::isNonNegative(
-            static_cast<typename std::underlying_type<E>::type>(rhs)));
+            o3tl::underlyingEnumValue(rhs)));
     return static_cast<typename o3tl::typed_flags<E>::Wrap>(
         o3tl::typed_flags<E>::mask
-        & ~static_cast<typename std::underlying_type<E>::type>(rhs));
+        & ~o3tl::underlyingEnumValue(rhs));
 }
 
 template<typename E> constexpr typename o3tl::typed_flags<E>::Wrap operator ~(
@@ -115,7 +116,7 @@ template<typename E> constexpr typename 
o3tl::typed_flags<E>::Wrap operator ~(
 {
     return static_cast<typename o3tl::typed_flags<E>::Wrap>(
         o3tl::typed_flags<E>::mask
-        & ~static_cast<typename std::underlying_type<E>::type>(rhs));
+        & ~o3tl::underlyingEnumValue<E>(rhs));
 }
 
 template<typename E> constexpr typename o3tl::typed_flags<E>::Wrap operator ^(
@@ -123,13 +124,13 @@ template<typename E> constexpr typename 
o3tl::typed_flags<E>::Wrap operator ^(
 {
     assert(
         o3tl::detail::isNonNegative(
-            static_cast<typename std::underlying_type<E>::type>(lhs)));
+            o3tl::underlyingEnumValue(lhs)));
     assert(
         o3tl::detail::isNonNegative(
-            static_cast<typename std::underlying_type<E>::type>(rhs)));
+            o3tl::underlyingEnumValue(rhs)));
     return static_cast<typename o3tl::typed_flags<E>::Wrap>(
-        static_cast<typename std::underlying_type<E>::type>(lhs)
-        ^ static_cast<typename std::underlying_type<E>::type>(rhs));
+        o3tl::underlyingEnumValue(lhs)
+        ^ o3tl::underlyingEnumValue(rhs));
 }
 
 template<typename E> constexpr typename o3tl::typed_flags<E>::Wrap operator ^(
@@ -137,10 +138,10 @@ template<typename E> constexpr typename 
o3tl::typed_flags<E>::Wrap operator ^(
 {
     assert(
         o3tl::detail::isNonNegative(
-            static_cast<typename std::underlying_type<E>::type>(lhs)));
+            o3tl::underlyingEnumValue(lhs)));
     return static_cast<typename o3tl::typed_flags<E>::Wrap>(
-        static_cast<typename std::underlying_type<E>::type>(lhs)
-        ^ static_cast<typename std::underlying_type<E>::type>(rhs));
+        o3tl::underlyingEnumValue(lhs)
+        ^ o3tl::underlyingEnumValue<E>(rhs));
 }
 
 template<typename E> constexpr typename o3tl::typed_flags<E>::Wrap operator ^(
@@ -148,10 +149,10 @@ template<typename E> constexpr typename 
o3tl::typed_flags<E>::Wrap operator ^(
 {
     assert(
         o3tl::detail::isNonNegative(
-            static_cast<typename std::underlying_type<E>::type>(rhs)));
+            o3tl::underlyingEnumValue(rhs)));
     return static_cast<typename o3tl::typed_flags<E>::Wrap>(
-        static_cast<typename std::underlying_type<E>::type>(lhs)
-        ^ static_cast<typename std::underlying_type<E>::type>(rhs));
+        o3tl::underlyingEnumValue<E>(lhs)
+        ^ o3tl::underlyingEnumValue(rhs));
 }
 
 template<typename W> constexpr
@@ -159,25 +160,21 @@ typename o3tl::typed_flags<typename 
W::Unwrapped::Self>::Wrap operator ^(
     W lhs, W rhs)
 {
     return static_cast<W>(
-        static_cast<
-            typename std::underlying_type<typename W::Unwrapped::Self>::type>(
-                lhs)
-        ^ static_cast<
-            typename std::underlying_type<typename W::Unwrapped::Self>::type>(
-                rhs));
+        o3tl::underlyingEnumValue<typename W::Unwrapped::Self>(lhs)
+        ^ o3tl::underlyingEnumValue<typename W::Unwrapped::Self>(rhs));
 }
 
 template<typename E>
 constexpr typename o3tl::typed_flags<E>::Wrap operator &(E lhs, E rhs) {
     assert(
         o3tl::detail::isNonNegative(
-            static_cast<typename std::underlying_type<E>::type>(lhs)));
+            o3tl::underlyingEnumValue(lhs)));
     assert(
         o3tl::detail::isNonNegative(
-            static_cast<typename std::underlying_type<E>::type>(rhs)));
+            o3tl::underlyingEnumValue(rhs)));
     return static_cast<typename o3tl::typed_flags<E>::Wrap>(
-        static_cast<typename std::underlying_type<E>::type>(lhs)
-        & static_cast<typename std::underlying_type<E>::type>(rhs));
+        o3tl::underlyingEnumValue(lhs)
+        & o3tl::underlyingEnumValue(rhs));
 }
 
 template<typename E> constexpr typename o3tl::typed_flags<E>::Wrap operator &(
@@ -185,10 +182,10 @@ template<typename E> constexpr typename 
o3tl::typed_flags<E>::Wrap operator &(
 {
     assert(
         o3tl::detail::isNonNegative(
-            static_cast<typename std::underlying_type<E>::type>(lhs)));
+            o3tl::underlyingEnumValue(lhs)));
     return static_cast<typename o3tl::typed_flags<E>::Wrap>(
-        static_cast<typename std::underlying_type<E>::type>(lhs)
-        & static_cast<typename std::underlying_type<E>::type>(rhs));
+        o3tl::underlyingEnumValue(lhs)
+        & o3tl::underlyingEnumValue<E>(rhs));
 }
 
 template<typename E> constexpr typename o3tl::typed_flags<E>::Wrap operator &(
@@ -196,10 +193,10 @@ template<typename E> constexpr typename 
o3tl::typed_flags<E>::Wrap operator &(
 {
     assert(
         o3tl::detail::isNonNegative(
-            static_cast<typename std::underlying_type<E>::type>(rhs)));
+            o3tl::underlyingEnumValue(rhs)));
     return static_cast<typename o3tl::typed_flags<E>::Wrap>(
-        static_cast<typename std::underlying_type<E>::type>(lhs)
-        & static_cast<typename std::underlying_type<E>::type>(rhs));
+        o3tl::underlyingEnumValue<E>(lhs)
+        & o3tl::underlyingEnumValue(rhs));
 }
 
 template<typename W> constexpr
@@ -207,25 +204,21 @@ typename o3tl::typed_flags<typename 
W::Unwrapped::Self>::Wrap operator &(
     W lhs, W rhs)
 {
     return static_cast<W>(
-        static_cast<
-            typename std::underlying_type<typename W::Unwrapped::Self>::type>(
-                lhs)
-        & static_cast<
-            typename std::underlying_type<typename W::Unwrapped::Self>::type>(
-                rhs));
+        o3tl::underlyingEnumValue<typename W::Unwrapped::Self>(lhs)
+        & o3tl::underlyingEnumValue<typename W::Unwrapped::Self>(rhs));
 }
 
 template<typename E>
 constexpr typename o3tl::typed_flags<E>::Wrap operator |(E lhs, E rhs) {
     assert(
         o3tl::detail::isNonNegative(
-            static_cast<typename std::underlying_type<E>::type>(lhs)));
+            o3tl::underlyingEnumValue(lhs)));
     assert(
         o3tl::detail::isNonNegative(
-            static_cast<typename std::underlying_type<E>::type>(rhs)));
+            o3tl::underlyingEnumValue(rhs)));
     return static_cast<typename o3tl::typed_flags<E>::Wrap>(
-        static_cast<typename std::underlying_type<E>::type>(lhs)
-        | static_cast<typename std::underlying_type<E>::type>(rhs));
+        o3tl::underlyingEnumValue(lhs)
+        | o3tl::underlyingEnumValue(rhs));
 }
 
 template<typename E> constexpr typename o3tl::typed_flags<E>::Wrap operator |(
@@ -233,10 +226,10 @@ template<typename E> constexpr typename 
o3tl::typed_flags<E>::Wrap operator |(
 {
     assert(
         o3tl::detail::isNonNegative(
-            static_cast<typename std::underlying_type<E>::type>(lhs)));
+            o3tl::underlyingEnumValue(lhs)));
     return static_cast<typename o3tl::typed_flags<E>::Wrap>(
-        static_cast<typename std::underlying_type<E>::type>(lhs)
-        | static_cast<typename std::underlying_type<E>::type>(rhs));
+        o3tl::underlyingEnumValue(lhs)
+        | o3tl::underlyingEnumValue<E>(rhs));
 }
 
 template<typename E> constexpr typename o3tl::typed_flags<E>::Wrap operator |(
@@ -244,10 +237,10 @@ template<typename E> constexpr typename 
o3tl::typed_flags<E>::Wrap operator |(
 {
     assert(
         o3tl::detail::isNonNegative(
-            static_cast<typename std::underlying_type<E>::type>(rhs)));
+            o3tl::underlyingEnumValue(rhs)));
     return static_cast<typename o3tl::typed_flags<E>::Wrap>(
-        static_cast<typename std::underlying_type<E>::type>(lhs)
-        | static_cast<typename std::underlying_type<E>::type>(rhs));
+        o3tl::underlyingEnumValue<E>(lhs)
+        | o3tl::underlyingEnumValue(rhs));
 }
 
 template<typename W> constexpr
@@ -255,22 +248,18 @@ typename o3tl::typed_flags<typename 
W::Unwrapped::Self>::Wrap operator |(
     W lhs, W rhs)
 {
     return static_cast<W>(
-        static_cast<
-            typename std::underlying_type<typename W::Unwrapped::Self>::type>(
-                lhs)
-        | static_cast<
-            typename std::underlying_type<typename W::Unwrapped::Self>::type>(
-                rhs));
+        o3tl::underlyingEnumValue<typename W::Unwrapped::Self>(lhs)
+        | o3tl::underlyingEnumValue<typename W::Unwrapped::Self>(rhs));
 }
 
 template<typename E>
 inline typename o3tl::typed_flags<E>::Self operator &=(E & lhs, E rhs) {
     assert(
         o3tl::detail::isNonNegative(
-            static_cast<typename std::underlying_type<E>::type>(lhs)));
+            o3tl::underlyingEnumValue(lhs)));
     assert(
         o3tl::detail::isNonNegative(
-            static_cast<typename std::underlying_type<E>::type>(rhs)));
+            o3tl::underlyingEnumValue(rhs)));
     lhs = lhs & rhs;
     return lhs;
 }
@@ -281,7 +270,7 @@ inline typename o3tl::typed_flags<E>::Self operator &=(
 {
     assert(
         o3tl::detail::isNonNegative(
-            static_cast<typename std::underlying_type<E>::type>(lhs)));
+            o3tl::underlyingEnumValue(lhs)));
     lhs = lhs & rhs;
     return lhs;
 }
@@ -290,10 +279,10 @@ template<typename E>
 inline typename o3tl::typed_flags<E>::Self operator |=(E & lhs, E rhs) {
     assert(
         o3tl::detail::isNonNegative(
-            static_cast<typename std::underlying_type<E>::type>(lhs)));
+            o3tl::underlyingEnumValue(lhs)));
     assert(
         o3tl::detail::isNonNegative(
-            static_cast<typename std::underlying_type<E>::type>(rhs)));
+            o3tl::underlyingEnumValue(rhs)));
     lhs = lhs | rhs;
     return lhs;
 }
@@ -304,7 +293,7 @@ inline typename o3tl::typed_flags<E>::Self operator |=(
 {
     assert(
         o3tl::detail::isNonNegative(
-            static_cast<typename std::underlying_type<E>::type>(lhs)));
+            o3tl::underlyingEnumValue(lhs)));
     lhs = lhs | rhs;
     return lhs;
 }
@@ -313,10 +302,10 @@ template<typename E>
 inline typename o3tl::typed_flags<E>::Self operator ^=(E & lhs, E rhs) {
     assert(
         o3tl::detail::isNonNegative(
-            static_cast<typename std::underlying_type<E>::type>(lhs)));
+            o3tl::underlyingEnumValue(lhs)));
     assert(
         o3tl::detail::isNonNegative(
-            static_cast<typename std::underlying_type<E>::type>(rhs)));
+            o3tl::underlyingEnumValue(rhs)));
     lhs = lhs ^ rhs;
     return lhs;
 }
@@ -327,7 +316,7 @@ inline typename o3tl::typed_flags<E>::Self operator ^=(
 {
     assert(
         o3tl::detail::isNonNegative(
-            static_cast<typename std::underlying_type<E>::type>(lhs)));
+            o3tl::underlyingEnumValue(lhs)));
     lhs = lhs ^ rhs;
     return lhs;
 }
diff --git a/include/o3tl/underlyingenumvalue.hxx 
b/include/o3tl/underlyingenumvalue.hxx
new file mode 100644
index 000000000000..1684b2da17d9
--- /dev/null
+++ b/include/o3tl/underlyingenumvalue.hxx
@@ -0,0 +1,28 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; 
fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_O3TL_UNDERLYINGENUMVALUE_HXX
+#define INCLUDED_O3TL_UNDERLYINGENUMVALUE_HXX
+
+#include <sal/config.h>
+
+#include <type_traits>
+
+namespace o3tl
+{
+// For a value e of an enumeration type T, return the corresponding value of 
T's underlying type:
+template <typename T> constexpr std::underlying_type_t<T> 
underlyingEnumValue(T e)
+{
+    return static_cast<std::underlying_type_t<T>>(e);
+}
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/sc/inc/address.hxx b/sc/inc/address.hxx
index 02a83a132d79..766135d614f9 100644
--- a/sc/inc/address.hxx
+++ b/sc/inc/address.hxx
@@ -32,6 +32,7 @@
 #include <formula/grammar.hxx>
 
 #include <o3tl/typed_flags_set.hxx>
+#include <o3tl/underlyingenumvalue.hxx>
 
 namespace com { namespace sun { namespace star {
     namespace sheet {
@@ -178,11 +179,11 @@ namespace o3tl
 }
 inline void applyStartToEndFlags(ScRefFlags &target,const ScRefFlags source)
 {
-    target |= 
ScRefFlags(static_cast<std::underlying_type<ScRefFlags>::type>(source) << 4);
+    target |= ScRefFlags(o3tl::underlyingEnumValue(source) << 4);
 }
 inline void applyStartToEndFlags(ScRefFlags &target)
 {
-    target |= 
ScRefFlags(static_cast<std::underlying_type<ScRefFlags>::type>(target) << 4);
+    target |= ScRefFlags(o3tl::underlyingEnumValue(target) << 4);
 }
 
 //  ScAddress
diff --git a/sc/source/core/tool/address.cxx b/sc/source/core/tool/address.cxx
index 9d076053df6b..666e22ad2910 100644
--- a/sc/source/core/tool/address.cxx
+++ b/sc/source/core/tool/address.cxx
@@ -28,7 +28,7 @@
 #include <externalrefmgr.hxx>
 
 #include <osl/diagnose.h>
-
+#include <o3tl/underlyingenumvalue.hxx>
 #include <com/sun/star/frame/XModel.hpp>
 #include <com/sun/star/sheet/ExternalLinkInfo.hpp>
 #include <com/sun/star/sheet/ExternalLinkType.hpp>
@@ -2219,7 +2219,7 @@ OUString ScRange::Format( ScRefFlags nFlags, const 
ScDocument* pDoc,
             lcl_RowAbsFlagDiffer( nFlags ))
         {
             // move flags of end reference to start reference, mask with BITS 
to exclude FORCE_DOC flag
-            nFlags = ScRefFlags::VALID | 
(ScRefFlags(static_cast<std::underlying_type<ScRefFlags>::type>(nFlags) >> 4) & 
ScRefFlags::BITS);
+            nFlags = ScRefFlags::VALID | 
(ScRefFlags(o3tl::underlyingEnumValue(nFlags) >> 4) & ScRefFlags::BITS);
             if ( bOneTab )
                 pDoc = nullptr;
             else
diff --git a/sc/source/core/tool/reffind.cxx b/sc/source/core/tool/reffind.cxx
index 970fa880b993..5896ec8dfd56 100644
--- a/sc/source/core/tool/reffind.cxx
+++ b/sc/source/core/tool/reffind.cxx
@@ -17,6 +17,10 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <sal/config.h>
+
+#include <o3tl/underlyingenumvalue.hxx>
+
 #include <reffind.hxx>
 #include <global.hxx>
 #include <compiler.hxx>
@@ -219,7 +223,7 @@ static ScRefFlags lcl_NextFlags( ScRefFlags nOld )
 {
     const ScRefFlags Mask_ABS = ScRefFlags::COL_ABS | ScRefFlags::ROW_ABS | 
ScRefFlags::TAB_ABS;
     ScRefFlags nNew = nOld & Mask_ABS;
-    nNew = ScRefFlags( 
static_cast<std::underlying_type<ScRefFlags>::type>(nNew) - 1 ) & Mask_ABS; // 
weiterzaehlen
+    nNew = ScRefFlags( o3tl::underlyingEnumValue(nNew) - 1 ) & Mask_ABS; // 
weiterzaehlen
 
     if (!(nOld & ScRefFlags::TAB_3D))
         nNew &= ~ScRefFlags::TAB_ABS; // not 3D -> never absolute!
diff --git a/xmlsecurity/qa/unit/signing/signing.cxx 
b/xmlsecurity/qa/unit/signing/signing.cxx
index 604d006b82d1..82890b2b8808 100644
--- a/xmlsecurity/qa/unit/signing/signing.cxx
+++ b/xmlsecurity/qa/unit/signing/signing.cxx
@@ -520,8 +520,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testODFGood)
     // We expect NOTVALIDATED in case the root CA is not imported on the 
system, and OK otherwise, so accept both.
     SignatureState nActual = pObjectShell->GetDocumentSignatureState();
     CPPUNIT_ASSERT_MESSAGE(
-        
(OString::number(static_cast<std::underlying_type<SignatureState>::type>(nActual))
-             .getStr()),
+        (OString::number(o3tl::underlyingEnumValue(nActual)).getStr()),
         (nActual == SignatureState::NOTVALIDATED || nActual == 
SignatureState::OK));
 }
 
@@ -561,11 +560,9 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testOOXMLPartial)
     // We expect NOTVALIDATED_PARTIAL_OK in case the root CA is not imported 
on the system, and PARTIAL_OK otherwise, so accept both.
     // But reject NOTVALIDATED, hiding incompleteness is not OK.
     SignatureState nActual = pObjectShell->GetDocumentSignatureState();
-    CPPUNIT_ASSERT_MESSAGE(
-        
(OString::number(static_cast<std::underlying_type<SignatureState>::type>(nActual))
-             .getStr()),
-        (nActual == SignatureState::NOTVALIDATED_PARTIAL_OK
-         || nActual == SignatureState::PARTIAL_OK));
+    
CPPUNIT_ASSERT_MESSAGE((OString::number(o3tl::underlyingEnumValue(nActual)).getStr()),
+                           (nActual == SignatureState::NOTVALIDATED_PARTIAL_OK
+                            || nActual == SignatureState::PARTIAL_OK));
 }
 
 /// Test a typical broken OOXML signature where one stream is corrupted.
@@ -594,8 +591,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testPDFGood)
     // We expect NOTVALIDATED in case the root CA is not imported on the 
system, and OK otherwise, so accept both.
     SignatureState nActual = pObjectShell->GetDocumentSignatureState();
     CPPUNIT_ASSERT_MESSAGE(
-        
(OString::number(static_cast<std::underlying_type<SignatureState>::type>(nActual))
-             .getStr()),
+        (OString::number(o3tl::underlyingEnumValue(nActual)).getStr()),
         (nActual == SignatureState::NOTVALIDATED || nActual == 
SignatureState::OK));
 }
 
@@ -635,11 +631,9 @@ CPPUNIT_TEST_FIXTURE(SigningTest, test96097Calc)
     CPPUNIT_ASSERT_MESSAGE("Failed to access document shell", pObjectShell);
 
     SignatureState nActual = pObjectShell->GetScriptingSignatureState();
-    CPPUNIT_ASSERT_MESSAGE(
-        
(OString::number(static_cast<std::underlying_type<SignatureState>::type>(nActual))
-             .getStr()),
-        (nActual == SignatureState::OK || nActual == 
SignatureState::NOTVALIDATED
-         || nActual == SignatureState::INVALID));
+    
CPPUNIT_ASSERT_MESSAGE((OString::number(o3tl::underlyingEnumValue(nActual)).getStr()),
+                           (nActual == SignatureState::OK || nActual == 
SignatureState::NOTVALIDATED
+                            || nActual == SignatureState::INVALID));
 
     uno::Reference<frame::XStorable> xDocStorable(mxComponent, 
uno::UNO_QUERY_THROW);
 
@@ -674,11 +668,9 @@ CPPUNIT_TEST_FIXTURE(SigningTest, test96097Doc)
     CPPUNIT_ASSERT(pObjectShell);
 
     SignatureState nActual = pObjectShell->GetScriptingSignatureState();
-    CPPUNIT_ASSERT_MESSAGE(
-        
(OString::number(static_cast<std::underlying_type<SignatureState>::type>(nActual))
-             .getStr()),
-        (nActual == SignatureState::OK || nActual == 
SignatureState::NOTVALIDATED
-         || nActual == SignatureState::INVALID));
+    
CPPUNIT_ASSERT_MESSAGE((OString::number(o3tl::underlyingEnumValue(nActual)).getStr()),
+                           (nActual == SignatureState::OK || nActual == 
SignatureState::NOTVALIDATED
+                            || nActual == SignatureState::INVALID));
 
     uno::Reference<frame::XStorable> xDocStorable(mxComponent, 
uno::UNO_QUERY_THROW);
 
@@ -778,8 +770,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testXAdESGood)
     // We expect NOTVALIDATED in case the root CA is not imported on the 
system, and OK otherwise, so accept both.
     SignatureState nActual = pObjectShell->GetDocumentSignatureState();
     CPPUNIT_ASSERT_MESSAGE(
-        
(OString::number(static_cast<std::underlying_type<SignatureState>::type>(nActual))
-             .getStr()),
+        (OString::number(o3tl::underlyingEnumValue(nActual)).getStr()),
         (nActual == SignatureState::NOTVALIDATED || nActual == 
SignatureState::OK));
 }
 
@@ -840,10 +831,8 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testODFGoodGPG)
     // Our local gpg config fully trusts the signing cert, so in
     // contrast to the X509 test we can fail on NOTVALIDATED here
     SignatureState nActual = pObjectShell->GetDocumentSignatureState();
-    CPPUNIT_ASSERT_EQUAL_MESSAGE(
-        
(OString::number(static_cast<std::underlying_type<SignatureState>::type>(nActual))
-             .getStr()),
-        SignatureState::OK, nActual);
+    
CPPUNIT_ASSERT_EQUAL_MESSAGE((OString::number(o3tl::underlyingEnumValue(nActual)).getStr()),
+                                 SignatureState::OK, nActual);
 }
 
 /// Test a typical ODF where all streams are GPG-signed, but we don't trust 
the signature.
@@ -858,10 +847,8 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testODFUntrustedGoodGPG)
     // contrast to the X509 test we can fail everything but
     // NOTVALIDATED here
     SignatureState nActual = pObjectShell->GetDocumentSignatureState();
-    CPPUNIT_ASSERT_EQUAL_MESSAGE(
-        
(OString::number(static_cast<std::underlying_type<SignatureState>::type>(nActual))
-             .getStr()),
-        SignatureState::NOTVALIDATED, nActual);
+    
CPPUNIT_ASSERT_EQUAL_MESSAGE((OString::number(o3tl::underlyingEnumValue(nActual)).getStr()),
+                                 SignatureState::NOTVALIDATED, nActual);
 }
 
 /// Test a typical broken ODF signature where one stream is corrupted.
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to