[Libreoffice-commits] core.git: vcl/source vcl/unx

Stephan Bergmann sbergman at redhat.com
Mon Jun 27 12:58:38 UTC 2016


 vcl/source/gdi/bitmapex.cxx       |    3 ++-
 vcl/source/gdi/configsettings.cxx |    4 ++--
 vcl/unx/generic/dtrans/config.cxx |    4 ++--
 3 files changed, 6 insertions(+), 5 deletions(-)

New commits:
commit de243e8e134c8780e54ebe8402a8a930962852fc
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Mon Jun 27 14:58:15 2016 +0200

    Clean up uses of Any::getValue() in vcl
    
    Change-Id: Id835d8d11abcd49320c2ea01ec0ad60402f9e759

diff --git a/vcl/source/gdi/bitmapex.cxx b/vcl/source/gdi/bitmapex.cxx
index 7030f8e..2066c1b 100644
--- a/vcl/source/gdi/bitmapex.cxx
+++ b/vcl/source/gdi/bitmapex.cxx
@@ -21,6 +21,7 @@
 #include <rtl/crc.h>
 #include <rtl/strbuf.hxx>
 
+#include <o3tl/any.hxx>
 #include <tools/stream.hxx>
 #include <tools/debug.hxx>
 #include <tools/rc.h>
@@ -792,7 +793,7 @@ bool BitmapEx::Create( const css::uno::Reference< css::rendering::XBitmapCanvas
     {
         // 0 means get BitmapEx
         uno::Any aAny = xFastPropertySet->getFastPropertyValue( 0 );
-        std::unique_ptr<BitmapEx> xBitmapEx(reinterpret_cast<BitmapEx*>( *static_cast<const sal_Int64*>(aAny.getValue())));
+        std::unique_ptr<BitmapEx> xBitmapEx(reinterpret_cast<BitmapEx*>(*o3tl::doAccess<sal_Int64>(aAny)));
         if( xBitmapEx )
         {
             *this = *xBitmapEx;
diff --git a/vcl/source/gdi/configsettings.cxx b/vcl/source/gdi/configsettings.cxx
index f8d72e9..27cc888 100644
--- a/vcl/source/gdi/configsettings.cxx
+++ b/vcl/source/gdi/configsettings.cxx
@@ -24,6 +24,7 @@
 #include <com/sun/star/uno/Any.hxx>
 #include <com/sun/star/uno/Sequence.hxx>
 #include <com/sun/star/beans/PropertyValue.hpp>
+#include <o3tl/any.hxx>
 
 using namespace utl;
 using namespace vcl;
@@ -111,9 +112,8 @@ void SettingsConfigItem::getValues()
         const Any* pValue = aValues.getConstArray();
         for( int i = 0; i < aValues.getLength(); i++, pValue++ )
         {
-            if( pValue->getValueTypeClass() == TypeClass_STRING )
+            if( auto pLine = o3tl::tryAccess<OUString>(*pValue) )
             {
-                const OUString* pLine = static_cast<const OUString*>(pValue->getValue());
                 if( !pLine->isEmpty() )
                     m_aSettings[ aKeyName ][ pFrom[i] ] = *pLine;
 #if OSL_DEBUG_LEVEL > 2
diff --git a/vcl/unx/generic/dtrans/config.cxx b/vcl/unx/generic/dtrans/config.cxx
index 863522b..cf7bb68 100644
--- a/vcl/unx/generic/dtrans/config.cxx
+++ b/vcl/unx/generic/dtrans/config.cxx
@@ -18,6 +18,7 @@
  */
 
 #include <cstdio>
+#include <o3tl/any.hxx>
 #include <unotools/configitem.hxx>
 
 #include "X11_selection.hxx"
@@ -78,9 +79,8 @@ DtransX11ConfigItem::DtransX11ConfigItem() :
     Any* pValue = aValues.getArray();
     for( int i = 0; i < aValues.getLength(); i++, pValue++ )
     {
-        if( pValue->getValueTypeClass() == TypeClass_STRING )
+        if( auto pLine = o3tl::tryAccess<OUString>(*pValue) )
         {
-            const OUString* pLine = static_cast<const OUString*>(pValue->getValue());
             if( !pLine->isEmpty() )
             {
                 m_nSelectionTimeout = pLine->toInt32();


More information about the Libreoffice-commits mailing list