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

Caolán McNamara caolanm at redhat.com
Tue Feb 6 09:24:09 UTC 2018


 sot/source/sdstor/stgstrms.cxx |   10 ++++------
 sot/source/sdstor/stgstrms.hxx |    2 +-
 2 files changed, 5 insertions(+), 7 deletions(-)

New commits:
commit 523fc71115071b6f74c8f05c1f8aeeeed775f8af
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Feb 6 09:22:50 2018 +0000

    pOptionalCalcSize is never null
    
    Change-Id: I830d02cbac6d281ab7fbeaf43e7af6136896b503

diff --git a/sot/source/sdstor/stgstrms.cxx b/sot/source/sdstor/stgstrms.cxx
index 17958544d880..8e5093fe9a91 100644
--- a/sot/source/sdstor/stgstrms.cxx
+++ b/sot/source/sdstor/stgstrms.cxx
@@ -353,7 +353,7 @@ void StgStrm::SetEntry( StgDirEntry& r )
  * for this each time build a simple flat in-memory vector list
  * of pages.
  */
-void StgStrm::scanBuildPageChainCache(sal_Int32 *pOptionalCalcSize)
+sal_Int32 StgStrm::scanBuildPageChainCache()
 {
     if (m_nSize > 0)
         m_aPagesCache.reserve(m_nSize/m_nPageSize);
@@ -384,12 +384,10 @@ void StgStrm::scanBuildPageChainCache(sal_Int32 *pOptionalCalcSize)
     if (bError)
     {
         SAL_WARN("sot", "returning wrong format error");
-        if (pOptionalCalcSize)
-            m_rIo.SetError( ERRCODE_IO_WRONGFORMAT );
+        m_rIo.SetError( ERRCODE_IO_WRONGFORMAT );
         m_aPagesCache.clear();
     }
-    if (pOptionalCalcSize)
-        *pOptionalCalcSize = nOptSize;
+    return nOptSize;
 }
 
 // Compute page number and offset for the given byte position.
@@ -851,7 +849,7 @@ void StgDataStrm::Init( sal_Int32 nBgn, sal_Int32 nLen )
     {
         // determine the actual size of the stream by scanning
         // the FAT chain and counting the # of pages allocated
-        scanBuildPageChainCache( &m_nSize );
+        m_nSize = scanBuildPageChainCache();
     }
 }
 
diff --git a/sot/source/sdstor/stgstrms.hxx b/sot/source/sdstor/stgstrms.hxx
index 0a6589f204f7..a2c8ca6de383 100644
--- a/sot/source/sdstor/stgstrms.hxx
+++ b/sot/source/sdstor/stgstrms.hxx
@@ -73,7 +73,7 @@ protected:
     short m_nOffset;                      // offset into current page
     short m_nPageSize;                    // logical page size
     std::vector<sal_Int32> m_aPagesCache;
-    void scanBuildPageChainCache(sal_Int32 *pOptionalCalcSize);
+    sal_Int32 scanBuildPageChainCache();
     bool  Copy( sal_Int32 nFrom, sal_Int32 nBytes );
     explicit StgStrm( StgIo& );
 public:


More information about the Libreoffice-commits mailing list