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

Noel Grandin noel.grandin at collabora.co.uk
Thu Mar 2 08:15:04 UTC 2017


 sw/source/core/unocore/swunohelper.cxx |   17 +++++------------
 1 file changed, 5 insertions(+), 12 deletions(-)

New commits:
commit 6af6a5fa3bf58e42bdaf693e8b5baf8961ce6311
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Thu Mar 2 10:12:45 2017 +0200

    bypass exception throwing and catching
    
    instead of needlessly catching the exception that
    comphelper::getEnumAsINT32 generates, let's just call the same function
    that comphelper::getEnumAsINT32 uses
    
    Change-Id: Ibc7d79cc15c13d4124f5bd62a038804209cf5b07

diff --git a/sw/source/core/unocore/swunohelper.cxx b/sw/source/core/unocore/swunohelper.cxx
index 3e947d1..c6dd8fb 100644
--- a/sw/source/core/unocore/swunohelper.cxx
+++ b/sw/source/core/unocore/swunohelper.cxx
@@ -28,7 +28,7 @@
 #include <com/sun/star/sdbc/XRow.hpp>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <comphelper/processfactory.hxx>
-#include <comphelper/types.hxx>
+#include <comphelper/extract.hxx>
 #include <o3tl/any.hxx>
 #include <tools/urlobj.hxx>
 #include <tools/datetime.hxx>
@@ -50,17 +50,10 @@ namespace SWUnoHelper
 
 sal_Int32 GetEnumAsInt32( const css::uno::Any& rVal )
 {
-    sal_Int32 eVal;
-    try
-    {
-        eVal = comphelper::getEnumAsINT32( rVal );
-    }
-    catch( css::uno::Exception & )
-    {
-        eVal = 0;
-        OSL_FAIL( "can't get EnumAsInt32" );
-    }
-    return eVal;
+    sal_Int32 nReturn = 0;
+    if (! ::cppu::enum2int(nReturn,rVal) )
+         OSL_FAIL( "can't get EnumAsInt32" );
+    return nReturn;
 }
 
 // methods for UCB actions


More information about the Libreoffice-commits mailing list