[Libreoffice-commits] core.git: include/oox oox/source
David Ostrovsky
david at ostrovsky.org
Mon Sep 22 23:08:49 PDT 2014
include/oox/token/tokenmap.hxx | 7 +------
oox/source/token/tokenmap.cxx | 16 ++++++++++------
2 files changed, 11 insertions(+), 12 deletions(-)
New commits:
commit 0ea9722f72c1bece218013cce4c5d9097994408f
Author: David Ostrovsky <david at ostrovsky.org>
Date: Sat Sep 20 16:48:56 2014 +0200
fdo#84090: Remove maUniName from oox::TokenMap
Change-Id: I8165def0b6291bfd7bb109e1cdaeb4198ed696b7
Reviewed-on: https://gerrit.libreoffice.org/11560
Reviewed-by: David Ostrovsky <David.Ostrovsky at gmx.de>
Tested-by: David Ostrovsky <David.Ostrovsky at gmx.de>
diff --git a/include/oox/token/tokenmap.hxx b/include/oox/token/tokenmap.hxx
index 122d51e..a00475f 100644
--- a/include/oox/token/tokenmap.hxx
+++ b/include/oox/token/tokenmap.hxx
@@ -70,12 +70,7 @@ public:
private:
sal_Int32 getTokenPerfectHash( const char *pToken, sal_Int32 nLength ) const;
- struct TokenName
- {
- OUString maUniName;
- ::com::sun::star::uno::Sequence< sal_Int8 > maUtf8Name;
- };
- typedef ::std::vector< TokenName > TokenNameVector;
+ typedef ::std::vector< ::com::sun::star::uno::Sequence< sal_Int8 > > TokenNameVector;
TokenNameVector maTokenNames;
sal_Int32 mnAlphaTokens[26];
diff --git a/oox/source/token/tokenmap.cxx b/oox/source/token/tokenmap.cxx
index 327dab0..79969df 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 >();
}
More information about the Libreoffice-commits
mailing list