summaryrefslogtreecommitdiffstats
path: root/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2011-09-18 13:36:11 +0100
committerCaolán McNamara <caolanm@redhat.com>2011-09-19 09:59:21 +0100
commit94d8c0975852d7b12e4c8acf4ab1c7f1c1a73f61 (patch)
tree1d83a03cca3e821eb88b53146367bb3995c577a5 /vcl
parentrework this in terms of read_uInt8s_AsOString (diff)
downloadcore-94d8c0975852d7b12e4c8acf4ab1c7f1c1a73f61.tar.gz
core-94d8c0975852d7b12e4c8acf4ab1c7f1c1a73f61.zip
rework this in terms of read_uInt8s_AsOString
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/gdi/cvtsvm.cxx35
1 files changed, 22 insertions, 13 deletions
diff --git a/vcl/source/gdi/cvtsvm.cxx b/vcl/source/gdi/cvtsvm.cxx
index 119029068b3c..b09e9d4e9eb3 100644
--- a/vcl/source/gdi/cvtsvm.cxx
+++ b/vcl/source/gdi/cvtsvm.cxx
@@ -882,33 +882,39 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
case( GDI_TEXT_ACTION ):
{
- ByteString aByteStr;
sal_Int32 nIndex, nLen;
rIStm >> aPt >> nIndex >> nLen >> nTmp;
if ( nTmp && ( static_cast< sal_uInt32 >( nTmp ) < ( SAL_MAX_UINT16 - 1 ) ) )
- {
- rIStm.Read( aByteStr.AllocBuffer( (sal_uInt16)nTmp ), nTmp + 1 );
- UniString aStr( aByteStr, eActualCharSet );
+ {
+ rtl::OString aByteStr = read_uInt8s_AsOString(rIStm, nTmp);
+ sal_uInt8 nTerminator = 0;
+ rIStm >> nTerminator;
+ DBG_ASSERT( nTerminator == 0, "expected string to be NULL terminated" );
+
+ UniString aStr(rtl::OStringToOUString(aByteStr, eActualCharSet));
if ( nUnicodeCommentActionNumber == i )
ImplReadUnicodeComment( nUnicodeCommentStreamPos, rIStm, aStr );
rMtf.AddAction( new MetaTextAction( aPt, aStr, (sal_uInt16) nIndex, (sal_uInt16) nLen ) );
}
- rIStm.Seek( nActBegin + nActionSize );
+ rIStm.Seek( nActBegin + nActionSize );
}
break;
case( GDI_TEXTARRAY_ACTION ):
{
- ByteString aByteStr;
sal_Int32* pDXAry = NULL;
sal_Int32 nIndex, nLen, nAryLen;
rIStm >> aPt >> nIndex >> nLen >> nTmp >> nAryLen;
if ( nTmp && ( static_cast< sal_uInt32 >( nTmp ) < ( SAL_MAX_UINT16 - 1 ) ) )
{
- rIStm.Read( aByteStr.AllocBuffer( (sal_uInt16)nTmp ), nTmp + 1 );
- UniString aStr( aByteStr, eActualCharSet );
+ rtl::OString aByteStr = read_uInt8s_AsOString(rIStm, nTmp);
+ sal_uInt8 nTerminator = 0;
+ rIStm >> nTerminator;
+ DBG_ASSERT( nTerminator == 0, "expected string to be NULL terminated" );
+
+ UniString aStr(rtl::OStringToOUString(aByteStr, eActualCharSet));
if( nAryLen > 0L )
{
@@ -955,25 +961,28 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
if( pDXAry )
delete[] pDXAry;
}
- rIStm.Seek( nActBegin + nActionSize );
+ rIStm.Seek( nActBegin + nActionSize );
}
break;
case( GDI_STRETCHTEXT_ACTION ):
{
- ByteString aByteStr;
sal_Int32 nIndex, nLen, nWidth;
rIStm >> aPt >> nIndex >> nLen >> nTmp >> nWidth;
if ( nTmp && ( static_cast< sal_uInt32 >( nTmp ) < ( SAL_MAX_INT16 - 1 ) ) )
{
- rIStm.Read( aByteStr.AllocBuffer( (sal_uInt16)nTmp ), nTmp + 1 );
- UniString aStr( aByteStr, eActualCharSet );
+ rtl::OString aByteStr = read_uInt8s_AsOString(rIStm, nTmp);
+ sal_uInt8 nTerminator = 0;
+ rIStm >> nTerminator;
+ DBG_ASSERT( nTerminator == 0, "expected string to be NULL terminated" );
+
+ UniString aStr(rtl::OStringToOUString(aByteStr, eActualCharSet));
if ( nUnicodeCommentActionNumber == i )
ImplReadUnicodeComment( nUnicodeCommentStreamPos, rIStm, aStr );
rMtf.AddAction( new MetaStretchTextAction( aPt, nWidth, aStr, (sal_uInt16) nIndex, (sal_uInt16) nLen ) );
}
- rIStm.Seek( nActBegin + nActionSize );
+ rIStm.Seek( nActBegin + nActionSize );
}
break;