[Libreoffice-commits] core.git: basic/source pyuno/source stoc/source testtools/source

Stephan Bergmann sbergman at redhat.com
Mon May 30 12:33:25 UTC 2016


 basic/source/classes/sbunoobj.cxx          |    3 +--
 pyuno/source/module/pyuno_runtime.cxx      |    3 +--
 stoc/source/typeconv/convert.cxx           |    8 ++++----
 testtools/source/bridgetest/bridgetest.cxx |    2 +-
 testtools/source/bridgetest/cppobj.cxx     |    5 ++---
 5 files changed, 9 insertions(+), 12 deletions(-)

New commits:
commit e630df7853a62225cd77fc4262689ef5607d2907
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Mon May 30 14:31:24 2016 +0200

    Just use Any::operator <<= for sal_Unicode values
    
    ...now that sal_Unicode no longer clashes with sal_uInt16 on any platform (in
    LIBO_INTERNAL_ONLY code), after e16fa715c43dcdf836ce8c400b6d54eae87b627d "Handle
    wchar_t as native C++11 type on windows"
    
    Change-Id: Id423dd6235bf14823fa5611b804c0974edbe64b3

diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx
index 4d8bc81..8154782 100644
--- a/basic/source/classes/sbunoobj.cxx
+++ b/basic/source/classes/sbunoobj.cxx
@@ -1418,8 +1418,7 @@ Any sbxToUnoValue( const SbxValue* pVar, const Type& rType, Property* pUnoProper
         }
         case TypeClass_CHAR:
         {
-            sal_Unicode c = pVar->GetChar();
-            aRetVal.setValue( &c , cppu::UnoType<cppu::UnoCharType>::get() );
+            aRetVal <<= pVar->GetChar();
             break;
         }
         case TypeClass_STRING:          aRetVal <<= pVar->GetOUString(); break;
diff --git a/pyuno/source/module/pyuno_runtime.cxx b/pyuno/source/module/pyuno_runtime.cxx
index 468d21f..7d7cfeb 100644
--- a/pyuno/source/module/pyuno_runtime.cxx
+++ b/pyuno/source/module/pyuno_runtime.cxx
@@ -810,8 +810,7 @@ Any Runtime::pyObject2Any ( const PyRef & source, enum ConversionMode mode ) con
         }
         else if( PyObject_IsInstance( o, getCharClass( runtime ).get() ) )
         {
-            sal_Unicode c = PyChar2Unicode( o );
-            a.setValue( &c, cppu::UnoType<cppu::UnoCharType>::get());
+            a <<= PyChar2Unicode( o );
         }
         else if( PyObject_IsInstance( o, getAnyClass( runtime ).get() ) )
         {
diff --git a/stoc/source/typeconv/convert.cxx b/stoc/source/typeconv/convert.cxx
index e7795c5..2a6cc73 100644
--- a/stoc/source/typeconv/convert.cxx
+++ b/stoc/source/typeconv/convert.cxx
@@ -761,14 +761,14 @@ Any TypeConverter_Impl::convertToSimpleType( const Any& rVal, TypeClass aDestina
     {
         if (aSourceClass==TypeClass_STRING)
         {
-            if ((*static_cast<const OUString *>(rVal.getValue())).getLength() == 1)      // single char
-                aRet.setValue( (*static_cast<const OUString *>(rVal.getValue())).getStr(), cppu::UnoType<cppu::UnoCharType>::get() );
+            auto const s = static_cast<const OUString *>(rVal.getValue());
+            if (s->getLength() == 1)      // single char
+                aRet <<= (*s)[0];
         }
         else if (aSourceClass!=TypeClass_ENUM &&        // exclude enums, chars
                  aSourceClass!=TypeClass_CHAR)
         {
-             sal_Unicode cRet = (sal_Unicode)toHyper( rVal, 0, 0xffff );    // range
-            aRet.setValue( &cRet, cppu::UnoType<cppu::UnoCharType>::get() );
+            aRet <<= sal_Unicode(toHyper( rVal, 0, 0xffff ));    // range
         }
         break;
     }
diff --git a/testtools/source/bridgetest/bridgetest.cxx b/testtools/source/bridgetest/bridgetest.cxx
index b426194..207e1e3 100644
--- a/testtools/source/bridgetest/bridgetest.cxx
+++ b/testtools/source/bridgetest/bridgetest.cxx
@@ -275,7 +275,7 @@ static bool performAnyTest( const Reference< XBridgeTest > &xLBT, const TestData
     }
 
     {
-        a.setValue( &(data.Char) , cppu::UnoType<cppu::UnoCharType>::get() );
+        a <<= data.Char;
         OSL_ASSERT( xLBT->transportAny( a ) == a );
     }
 
diff --git a/testtools/source/bridgetest/cppobj.cxx b/testtools/source/bridgetest/cppobj.cxx
index a5ca8bc..8101f1e 100644
--- a/testtools/source/bridgetest/cppobj.cxx
+++ b/testtools/source/bridgetest/cppobj.cxx
@@ -1003,8 +1003,7 @@ void Test_Impl::testConstructorsService(
     args[7] <<= SAL_MAX_UINT64;
     args[8] <<= 0.123f;
     args[9] <<= 0.456;
-    sal_Unicode arg10c = 'X';
-    args[10].setValue(&arg10c, UnoType< UnoCharType >::get());
+    args[10] <<= sal_Unicode('X');
     args[11] <<= OUString("test");
     args[12] <<= UnoType< Any >::get();
     args[13] <<= true;
@@ -1018,7 +1017,7 @@ void Test_Impl::testConstructorsService(
     args[21] <<= arg21;
     args[22] <<= arg22;
     args[23] <<= arg23;
-    args[24].setValue(&arg24, UnoType< UnoSequenceType< UnoCharType > >::get());
+    args[24] <<= arg24;
     args[25] <<= arg25;
     args[26] <<= arg26;
     args[27] <<= arg27;


More information about the Libreoffice-commits mailing list