[Libreoffice-commits] core.git: 2 commits - sc/source

Michael Stahl mstahl at redhat.com
Sat Mar 29 07:03:43 PDT 2014


 sc/source/filter/excel/xestream.cxx |   13 +++----------
 sc/source/filter/inc/xestream.hxx   |    2 +-
 2 files changed, 4 insertions(+), 11 deletions(-)

New commits:
commit b03b1113d82147093762923bb9b350e52fe08ffe
Author: Michael Stahl <mstahl at redhat.com>
Date:   Sat Mar 29 14:58:45 2014 +0100

    sc: actually CopyFromStream() can just use remainingSize()
    
    Change-Id: I16e60caa7a1baeb2b05cbe5dc8ae24a67751c390

diff --git a/sc/source/filter/excel/xestream.cxx b/sc/source/filter/excel/xestream.cxx
index f44bedd..e741e09 100644
--- a/sc/source/filter/excel/xestream.cxx
+++ b/sc/source/filter/excel/xestream.cxx
@@ -280,12 +280,8 @@ void XclExpStream::WriteZeroBytesToRecord( sal_Size nBytes )
 
 void XclExpStream::CopyFromStream(SvStream& rInStrm, sal_uInt64 const nBytes)
 {
-    sal_uInt64 const nStrmPos = rInStrm.Tell();
-    rInStrm.Seek( STREAM_SEEK_TO_END );
-    sal_uInt64 const nStrmSize = rInStrm.Tell();
-    rInStrm.Seek( nStrmPos );
-
-    sal_uInt64 nBytesLeft = ::std::min( nBytes, nStrmSize - nStrmPos );
+    sal_uInt64 const nRemaining(rInStrm.remainingSize());
+    sal_uInt64 nBytesLeft = ::std::min(nBytes, nRemaining);
     if( nBytesLeft > 0 )
     {
         const sal_Size nMaxBuffer = 4096;
commit fd76aa7ea8cf4d8e75c50f27a9fb57626198ba5f
Author: Michael Stahl <mstahl at redhat.com>
Date:   Sat Mar 29 14:55:09 2014 +0100

    sc: adapt XclExpStream::CopyFromStream() to SvStream change
    
    Change-Id: I58c183fe2b8e7b64ec0678e5eb136b9a467f1eb4

diff --git a/sc/source/filter/excel/xestream.cxx b/sc/source/filter/excel/xestream.cxx
index fc511a0..f44bedd 100644
--- a/sc/source/filter/excel/xestream.cxx
+++ b/sc/source/filter/excel/xestream.cxx
@@ -278,15 +278,14 @@ void XclExpStream::WriteZeroBytesToRecord( sal_Size nBytes )
         *this << nZero;
 }
 
-sal_Size XclExpStream::CopyFromStream( SvStream& rInStrm, sal_Size nBytes )
+void XclExpStream::CopyFromStream(SvStream& rInStrm, sal_uInt64 const nBytes)
 {
-    sal_Size nStrmPos = rInStrm.Tell();
+    sal_uInt64 const nStrmPos = rInStrm.Tell();
     rInStrm.Seek( STREAM_SEEK_TO_END );
-    sal_Size nStrmSize = rInStrm.Tell();
+    sal_uInt64 const nStrmSize = rInStrm.Tell();
     rInStrm.Seek( nStrmPos );
 
-    sal_Size nBytesLeft = ::std::min( nBytes, nStrmSize - nStrmPos );
-    sal_Size nRet = 0;
+    sal_uInt64 nBytesLeft = ::std::min( nBytes, nStrmSize - nStrmPos );
     if( nBytesLeft > 0 )
     {
         const sal_Size nMaxBuffer = 4096;
@@ -299,12 +298,10 @@ sal_Size XclExpStream::CopyFromStream( SvStream& rInStrm, sal_Size nBytes )
             rInStrm.Read( pBuffer, nWriteLen );
             sal_Size nWriteRet = Write( pBuffer, nWriteLen );
             bValid = (nWriteLen == nWriteRet);
-            nRet += nWriteRet;
             nBytesLeft -= nWriteRet;
         }
         delete[] pBuffer;
     }
-    return nRet;
 }
 
 void XclExpStream::WriteUnicodeBuffer( const ScfUInt16Vec& rBuffer, sal_uInt8 nFlags )
diff --git a/sc/source/filter/inc/xestream.hxx b/sc/source/filter/inc/xestream.hxx
index 5971bc4..2d1d3ae 100644
--- a/sc/source/filter/inc/xestream.hxx
+++ b/sc/source/filter/inc/xestream.hxx
@@ -122,7 +122,7 @@ public:
 
     /** Copies nBytes bytes from current position of the stream rInStrm.
         @descr  Omitting the second parameter means: read to end of stream. */
-    sal_Size            CopyFromStream( SvStream& rInStrm, sal_Size nBytes = STREAM_SEEK_TO_END );
+    void                CopyFromStream( SvStream& rInStrm, sal_uInt64 nBytes = STREAM_SEEK_TO_END );
 
     // *** unicode string export is realized with helper class XclExpString ***
     // (slice length setting has no effect here -> disabled automatically)


More information about the Libreoffice-commits mailing list