summaryrefslogtreecommitdiff
path: root/filter
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2011-08-02 09:46:46 +0100
committerCaolán McNamara <caolanm@redhat.com>2011-08-02 11:06:46 +0100
commitfc0c96fb24bb08b184eb6f1340974bbf59af75fd (patch)
tree72817245fe107f658a7536991426bfa4e8aba514 /filter
parent113801b03ddcd6eca7e085f80225d445356c6cdc (diff)
convert in one pass, rather than point by point
Diffstat (limited to 'filter')
-rw-r--r--filter/source/msfilter/msdffimp.cxx18
1 files changed, 7 insertions, 11 deletions
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index b448f8a34ec4..29f811f44991 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -143,6 +143,7 @@
#include <com/sun/star/drawing/ProjectionMode.hpp>
#include "svx/EnhancedCustomShape2d.hxx"
#include <rtl/strbuf.hxx>
+#include <boost/scoped_array.hpp>
using namespace ::com::sun::star ;
using namespace ::com::sun::star::drawing;
@@ -4126,16 +4127,14 @@ void SvxMSDffManager::MSDFFReadZString( SvStream& rIn, String& rStr,
sal_uInt16 nLen = (sal_uInt16)nRecLen;
if( nLen )
{
- if ( bUniCode )
- nLen >>= 1;
-
String sBuf;
- sal_Unicode* pBuf = sBuf.AllocBuffer( nLen );
if( bUniCode )
{
- rIn.Read( (sal_Char*)pBuf, nLen << 1 );
+ nLen >>= 1;
+ sal_Unicode* pBuf = sBuf.AllocBuffer(nLen);
+ rIn.Read( (sal_Char*)pBuf, nLen << 1 );
#ifdef OSL_BIGENDIAN
for( sal_uInt16 n = 0; n < nLen; ++n, ++pBuf )
*pBuf = SWAPSHORT( *pBuf );
@@ -4143,12 +4142,9 @@ void SvxMSDffManager::MSDFFReadZString( SvStream& rIn, String& rStr,
}
else
{
- // use the String-Data as buffer for the 8bit characters and
- // change then all to unicode
- sal_Char* pReadPos = ((sal_Char*)pBuf) + nLen;
- rIn.Read( (sal_Char*)pReadPos, nLen );
- for( sal_uInt16 n = 0; n < nLen; ++n, ++pBuf, ++pReadPos )
- *pBuf = ByteString::ConvertToUnicode( *pReadPos, RTL_TEXTENCODING_MS_1252 );
+ boost::scoped_array<sal_Char> xBuffer(new sal_Char[nLen]);
+ nLen = rIn.Read(xBuffer.get(), nLen);
+ sBuf = rtl::OUString(xBuffer.get(), nLen, RTL_TEXTENCODING_MS_1252);
}
rStr = sBuf.EraseTrailingChars( 0 );