From 0ea9722f72c1bece218013cce4c5d9097994408f Mon Sep 17 00:00:00 2001 From: David Ostrovsky Date: Sat, 20 Sep 2014 16:48:56 +0200 Subject: fdo#84090: Remove maUniName from oox::TokenMap Change-Id: I8165def0b6291bfd7bb109e1cdaeb4198ed696b7 Reviewed-on: https://gerrit.libreoffice.org/11560 Reviewed-by: David Ostrovsky Tested-by: David Ostrovsky --- oox/source/token/tokenmap.cxx | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'oox/source/token') diff --git a/oox/source/token/tokenmap.cxx b/oox/source/token/tokenmap.cxx index 327dab0c9af6..79969df70636 100644 --- a/oox/source/token/tokenmap.cxx +++ b/oox/source/token/tokenmap.cxx @@ -58,8 +58,7 @@ TokenMap::TokenMap() : for( TokenNameVector::iterator aIt = maTokenNames.begin(), aEnd = maTokenNames.end(); aIt != aEnd; ++aIt, ++ppcTokenName ) { OString aUtf8Token( *ppcTokenName ); - aIt->maUniName = OStringToOUString( aUtf8Token, RTL_TEXTENCODING_UTF8 ); - aIt->maUtf8Name = Sequence< sal_Int8 >( reinterpret_cast< const sal_Int8* >( aUtf8Token.getStr() ), aUtf8Token.getLength() ); + *aIt = Sequence< sal_Int8 >( reinterpret_cast< const sal_Int8* >( aUtf8Token.getStr() ), aUtf8Token.getLength() ); } for (unsigned char c = 'a'; c <= 'z'; c++) @@ -76,9 +75,14 @@ TokenMap::~TokenMap() OUString TokenMap::getUnicodeTokenName( sal_Int32 nToken ) const { - if( (0 <= nToken) && (static_cast< size_t >( nToken ) < maTokenNames.size()) ) - return maTokenNames[ static_cast< size_t >( nToken ) ].maUniName; - return OUString(); + Sequence< sal_Int8 > rUtf8Name = getUtf8TokenName(nToken); + if (rUtf8Name.getLength() == 0) + return OUString(); + + return OUString(reinterpret_cast< const char * >( + rUtf8Name.getConstArray() ), + rUtf8Name.getLength(), + RTL_TEXTENCODING_UTF8); } sal_Int32 TokenMap::getTokenFromUnicode( const OUString& rUnicodeName ) const @@ -91,7 +95,7 @@ sal_Int32 TokenMap::getTokenFromUnicode( const OUString& rUnicodeName ) const Sequence< sal_Int8 > TokenMap::getUtf8TokenName( sal_Int32 nToken ) const { if( (0 <= nToken) && (static_cast< size_t >( nToken ) < maTokenNames.size()) ) - return maTokenNames[ static_cast< size_t >( nToken ) ].maUtf8Name; + return maTokenNames[ static_cast< size_t >( nToken ) ]; return Sequence< sal_Int8 >(); } -- cgit