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 e16fa715c4 "Handle
wchar_t as native C++11 type on windows"

Change-Id: Id423dd6235bf14823fa5611b804c0974edbe64b3
This commit is contained in:
Stephan Bergmann 2016-05-30 14:31:24 +02:00
parent 46d5d475b1
commit e630df7853
5 changed files with 9 additions and 12 deletions

View file

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

View file

@ -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() ) )
{

View file

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

View file

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

View file

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