[Libreoffice-commits] core.git: sd/source sfx2/source

Caolán McNamara caolanm at redhat.com
Sat Oct 21 16:01:11 UTC 2017


 sd/source/filter/ppt/propread.cxx |   17 ++++++-----------
 sfx2/source/doc/oleprops.cxx      |    2 +-
 2 files changed, 7 insertions(+), 12 deletions(-)

New commits:
commit 92c940a530c1b43ed1ba2ff10343024f2bf2d69b
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Oct 21 15:38:38 2017 +0100

    check seeks earlier
    
    Change-Id: Id392f2299b6bdacb9a71e94959d24d02417d571e
    Reviewed-on: https://gerrit.libreoffice.org/43657
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sd/source/filter/ppt/propread.cxx b/sd/source/filter/ppt/propread.cxx
index e473e1566e31..ed1f9e4923d2 100644
--- a/sd/source/filter/ppt/propread.cxx
+++ b/sd/source/filter/ppt/propread.cxx
@@ -321,12 +321,8 @@ void Section::GetDictionary(Dictionary& rDict)
 
 void Section::Read( SotStorageStream *pStrm )
 {
-    sal_uInt32 nSecOfs, nPropSize, nStrmSize;
-    nSecOfs = pStrm->Tell();
-
-    pStrm->Seek( STREAM_SEEK_TO_END );
-    nStrmSize = pStrm->Tell();
-    pStrm->Seek( nSecOfs );
+    sal_uInt32 nSecOfs = pStrm->Tell();
+    sal_uInt32 nStrmSize = pStrm->remainingSize();
 
     mnTextEnc = RTL_TEXTENCODING_MS_1252;
     sal_uInt32 nSecSize(0), nPropCount(0);
@@ -339,15 +335,14 @@ void Section::Read( SotStorageStream *pStrm )
             break;
         auto nCurrent = pStrm->Tell();
         sal_uInt64 nOffset = nPropOfs + nSecOfs;
-        if (nOffset != pStrm->Seek(nOffset))
+        if (!checkSeek(*pStrm, nOffset))
             break;
         if ( nPropId )                  // do not read dictionary
         {
             sal_uInt32 nPropType(0), nVectorCount(0);
             pStrm->ReadUInt32(nPropType);
 
-            nPropSize = 4;
-
+            sal_uInt32 nPropSize = 4;
             if ( nPropType & VT_VECTOR )
             {
                 pStrm->ReadUInt32( nVectorCount );
@@ -436,7 +431,7 @@ void Section::Read( SotStorageStream *pStrm )
                     if ( ( nVectorCount - i ) > 1 )
                     {
                         nOffset = nPropOfs + nSecOfs + nPropSize;
-                        if (nOffset != pStrm->Seek(nOffset))
+                        if (!checkSeek(*pStrm, nOffset))
                             break;
                     }
                 }
@@ -503,7 +498,7 @@ void Section::Read( SotStorageStream *pStrm )
                 if (!pStrm->good())
                     break;
                 sal_uInt64 nPos = pStrm->Tell() + nSize;
-                if (nPos != pStrm->Seek(nPos))
+                if (!checkSeek(*pStrm, nPos))
                     break;
             }
             sal_uInt32 nSize = pStrm->Tell();
diff --git a/sfx2/source/doc/oleprops.cxx b/sfx2/source/doc/oleprops.cxx
index 7e412e6e2c9e..3045a90ba8c8 100644
--- a/sfx2/source/doc/oleprops.cxx
+++ b/sfx2/source/doc/oleprops.cxx
@@ -943,7 +943,7 @@ void SfxOleSection::ImplLoad( SvStream& rStrm )
     // read property ID/position pairs
     typedef ::std::map< sal_Int32, sal_uInt32 > SfxOlePropPosMap;
     SfxOlePropPosMap aPropPosMap;
-    for( sal_Int32 nPropIdx = 0; (nPropIdx < nPropCount) && (rStrm.GetErrorCode() == ERRCODE_NONE) && !rStrm.IsEof(); ++nPropIdx )
+    for (sal_Int32 nPropIdx = 0; nPropIdx < nPropCount && rStrm.good(); ++nPropIdx)
     {
         sal_Int32 nPropId(0);
         sal_uInt32 nPropPos(0);


More information about the Libreoffice-commits mailing list