[Libreoffice-commits] core.git: vcl/source

Michael Stahl mstahl at redhat.com
Sun Mar 9 16:16:03 PDT 2014


 vcl/source/gdi/metaact.cxx |   40 +++++++++++++++++++++++++---------------
 vcl/source/gdi/outdev3.cxx |    3 +++
 2 files changed, 28 insertions(+), 15 deletions(-)

New commits:
commit 02abb559fb506e3d3911bbf058c9a60d28b0a3b5
Author: Michael Stahl <mstahl at redhat.com>
Date:   Sun Mar 9 23:51:12 2014 +0100

    vcl: MetaText*Action: revert unwanted file format changes
    
    Horrible things happen while loading bugdoc from rhbz#1069030.
    
    (regression from 30bb1eddba2b4a36b4354303ffcb37a3a15f38a6)
    
    Change-Id: I7f71a41289f57598861c3c005c1e23cbfb4f8111

diff --git a/vcl/source/gdi/metaact.cxx b/vcl/source/gdi/metaact.cxx
index ebf9eb8..eaa511f 100644
--- a/vcl/source/gdi/metaact.cxx
+++ b/vcl/source/gdi/metaact.cxx
@@ -1258,8 +1258,8 @@ void MetaTextAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
     WRITE_BASE_COMPAT( rOStm, 2, pData );
     WritePair( rOStm, maPt );
     rOStm.WriteUniOrByteString( maStr, pData->meActualCharSet );
-    rOStm.WriteInt32(mnIndex);
-    rOStm.WriteInt32(mnLen);
+    rOStm.WriteUInt16(mnIndex);
+    rOStm.WriteUInt16(mnLen);
 
     write_uInt16_lenPrefixed_uInt16s_FromOUString(rOStm, maStr); // version 2
 }
@@ -1271,8 +1271,11 @@ void MetaTextAction::Read( SvStream& rIStm, ImplMetaReadData* pData )
     COMPAT( rIStm );
     ReadPair( rIStm, maPt );
     maStr = rIStm.ReadUniOrByteString(pData->meActualCharSet);
-    rIStm  .ReadInt32( mnIndex );
-    rIStm  .ReadInt32( mnLen );
+    sal_uInt16 nTmp(0);
+    rIStm.ReadUInt16(nTmp);
+    mnIndex = nTmp;
+    rIStm.ReadUInt16(nTmp);
+    mnLen = nTmp;
 
     if ( aCompat.GetVersion() >= 2 )                            // Version 2
         maStr = read_uInt16_lenPrefixed_uInt16s_ToOUString(rIStm);
@@ -1395,9 +1398,9 @@ void MetaTextArrayAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
     WRITE_BASE_COMPAT( rOStm, 2, pData );
     WritePair( rOStm, maStartPt );
     rOStm.WriteUniOrByteString( maStr, pData->meActualCharSet );
-    rOStm.WriteInt32(mnIndex);
-    rOStm.WriteInt32(mnLen);
-    rOStm.WriteInt32(nAryLen);
+    rOStm.WriteUInt16(mnIndex);
+    rOStm.WriteUInt16(mnLen);
+    rOStm.WriteUInt16(nAryLen);
 
     for (sal_Int32 i = 0; i < nAryLen; ++i)
         rOStm.WriteInt32( mpDXAry[ i ] );
@@ -1416,9 +1419,13 @@ void MetaTextArrayAction::Read( SvStream& rIStm, ImplMetaReadData* pData )
     COMPAT( rIStm );
     ReadPair( rIStm, maStartPt );
     maStr = rIStm.ReadUniOrByteString(pData->meActualCharSet);
-    rIStm  .ReadInt32( mnIndex );
-    rIStm  .ReadInt32( mnLen );
-    rIStm  .ReadInt32( nAryLen );
+    sal_uInt16 nTmp(0);
+    rIStm.ReadUInt16(nTmp);
+    mnIndex = nTmp;
+    rIStm.ReadUInt16(nTmp);
+    mnLen = nTmp;
+    rIStm.ReadUInt16(nTmp);
+    nAryLen = nTmp;
 
     if ( mnIndex + mnLen > maStr.getLength() )
     {
@@ -1533,8 +1540,8 @@ void MetaStretchTextAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
     WritePair( rOStm, maPt );
     rOStm.WriteUniOrByteString( maStr, pData->meActualCharSet );
     rOStm.WriteUInt32( mnWidth );
-    rOStm.WriteInt32( mnIndex );
-    rOStm.WriteInt32( mnLen );
+    rOStm.WriteUInt16( mnIndex );
+    rOStm.WriteUInt16( mnLen );
 
     write_uInt16_lenPrefixed_uInt16s_FromOUString(rOStm, maStr); // version 2
 }
@@ -1546,9 +1553,12 @@ void MetaStretchTextAction::Read( SvStream& rIStm, ImplMetaReadData* pData )
     COMPAT( rIStm );
     ReadPair( rIStm, maPt );
     maStr = rIStm.ReadUniOrByteString(pData->meActualCharSet);
-    rIStm  .ReadUInt32( mnWidth );
-    rIStm  .ReadInt32( mnIndex );
-    rIStm  .ReadInt32( mnLen );
+    rIStm.ReadUInt32( mnWidth );
+    sal_uInt16 nTmp(0);
+    rIStm.ReadUInt16(nTmp);
+    mnIndex = nTmp;
+    rIStm.ReadUInt16(nTmp);
+    mnLen = nTmp;
 
     if ( aCompat.GetVersion() >= 2 )                            // Version 2
         maStr = read_uInt16_lenPrefixed_uInt16s_ToOUString(rIStm);
diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx
index 74cd8e7..628d309 100644
--- a/vcl/source/gdi/outdev3.cxx
+++ b/vcl/source/gdi/outdev3.cxx
@@ -5680,6 +5680,9 @@ ImplLayoutArgs OutputDevice::ImplPrepareLayoutArgs( OUString& rStr,
                                        const sal_Int32 nMinIndex, const sal_Int32 nLen,
                                        long nPixelWidth, const sal_Int32* pDXArray ) const
 {
+    assert(nMinIndex >= 0);
+    assert(nLen >= 0);
+
     // get string length for calculating extents
     sal_Int32 nEndIndex = rStr.getLength();
     if( nMinIndex + nLen < nEndIndex )


More information about the Libreoffice-commits mailing list