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

Fridrich Å trba fridrich.strba at bluewin.ch
Mon Jan 6 07:43:32 PST 2014


 writerperfect/source/common/WPXSvStream.cxx |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

New commits:
commit 4b4a870b176cf5ff9ee84fc5b16f4df1d8eeef94
Author: Fridrich Å trba <fridrich.strba at bluewin.ch>
Date:   Mon Jan 6 16:43:17 2014 +0100

    Avoid some memcpy when not necessary
    
    Change-Id: I9b838fc8392bc61be4ed911fb1423a1e97af2356

diff --git a/writerperfect/source/common/WPXSvStream.cxx b/writerperfect/source/common/WPXSvStream.cxx
index 3b33a17..86e835b 100644
--- a/writerperfect/source/common/WPXSvStream.cxx
+++ b/writerperfect/source/common/WPXSvStream.cxx
@@ -310,9 +310,7 @@ const unsigned char *WPXSvInputStream::read(unsigned long numBytes, unsigned lon
             mpImpl->mnReadBufferLength = mpImpl->mnLength - curpos;
     }
     else
-        mpImpl->mnReadBufferLength = numBytes;
-
-    mpImpl->seek((long) curpos);
+        return mpImpl->read(numBytes, numBytesRead);
 
     mpImpl->mpReadBuffer = new unsigned char[mpImpl->mnReadBufferLength];
     unsigned long tmpNumBytes(0);
@@ -360,7 +358,7 @@ int WPXSvInputStream::seek(long offset, WPX_SEEK_TYPE seekType)
     if (tmpOffset < mpImpl->tell() && (unsigned long)tmpOffset >= (unsigned long)mpImpl->tell() - mpImpl->mnReadBufferLength)
     {
         mpImpl->mnReadBufferPos = (unsigned long)(tmpOffset + (long) mpImpl->mnReadBufferLength - (long) mpImpl->tell());
-        return 0;
+        return retVal;
     }
 
     mpImpl->invalidateReadBuffer();


More information about the Libreoffice-commits mailing list