diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-09-02 23:15:01 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-09-05 10:54:19 +0100 |
commit | 2e28244ad3cf526b99b1e555526b26bf89c5ce8d (patch) | |
tree | 7f9a24da525ced2845e97d6a013576094d3a417a /svtools | |
parent | tell me *what* failed (diff) | |
download | core-2e28244ad3cf526b99b1e555526b26bf89c5ce8d.tar.gz core-2e28244ad3cf526b99b1e555526b26bf89c5ce8d.zip |
bIsCompressed is always false
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/source/misc/filterutils.cxx | 38 |
1 files changed, 12 insertions, 26 deletions
diff --git a/svtools/source/misc/filterutils.cxx b/svtools/source/misc/filterutils.cxx index 3f47efb48c2c..d0d481a81988 100644 --- a/svtools/source/misc/filterutils.cxx +++ b/svtools/source/misc/filterutils.cxx @@ -10,41 +10,27 @@ namespace svt using namespace ::com::sun::star; - rtl::OUString lcl_createStringFromArray( const char* pcCharArr, sal_uInt32 nBufSize, bool bIsCompressed ) + rtl::OUString lcl_createStringFromArray( const char* pcCharArr, sal_uInt32 nBufSize ) { rtl::OUStringBuffer aBuffer; - if( bIsCompressed ) + // buffer contains Little-Endian Unicode + sal_Int32 nStrLen = static_cast< sal_Int32 >( nBufSize ) / 2; + aBuffer.setLength( nStrLen ); + const char* pcCurrChar = pcCharArr; + for( sal_Int32 nChar = 0; nChar < nStrLen; ++nChar ) { - // buffer contains compressed Unicode, not encoded bytestring - sal_Int32 nStrLen = static_cast< sal_Int32 >( nBufSize ); - aBuffer.setLength( nStrLen ); - const char* pcCurrChar = pcCharArr; - for( sal_Int32 nChar = 0; nChar < nStrLen; ++nChar, ++pcCurrChar ) - /* *pcCurrChar may contain negative values and therefore MUST be - casted to unsigned char, before assigned to a sal_Unicode. */ - aBuffer.setCharAt( nChar, static_cast< unsigned char >( *pcCurrChar ) ); - } - else - { - // buffer contains Little-Endian Unicode - sal_Int32 nStrLen = static_cast< sal_Int32 >( nBufSize ) / 2; - aBuffer.setLength( nStrLen ); - const char* pcCurrChar = pcCharArr; - for( sal_Int32 nChar = 0; nChar < nStrLen; ++nChar ) - { - /* *pcCurrChar may contain negative values and therefore MUST be - casted to unsigned char, before assigned to a sal_Unicode. */ - sal_Unicode cChar = static_cast< unsigned char >( *pcCurrChar++ ); - cChar |= (static_cast< unsigned char >( *pcCurrChar++ ) << 8); - aBuffer.setCharAt( nChar, cChar ); - } + /* *pcCurrChar may contain negative values and therefore MUST be + casted to unsigned char, before assigned to a sal_Unicode. */ + sal_Unicode cChar = static_cast< unsigned char >( *pcCurrChar++ ); + cChar |= (static_cast< unsigned char >( *pcCurrChar++ ) << 8); + aBuffer.setCharAt( nChar, cChar ); } return aBuffer.makeStringAndClear(); } rtl::OUString BinFilterUtils::CreateOUStringFromUniStringArray( const char* pcCharArr, sal_uInt32 nBufSize ) { - return lcl_createStringFromArray( pcCharArr, nBufSize, false ); + return lcl_createStringFromArray( pcCharArr, nBufSize ); } //........................................................................ } // namespace svt |