Kaydet (Commit) 4b4a870b authored tarafından Fridrich Štrba's avatar Fridrich Štrba

Avoid some memcpy when not necessary

Change-Id: I9b838fc8392bc61be4ed911fb1423a1e97af2356
üst 52263eb4
...@@ -310,9 +310,7 @@ const unsigned char *WPXSvInputStream::read(unsigned long numBytes, unsigned lon ...@@ -310,9 +310,7 @@ const unsigned char *WPXSvInputStream::read(unsigned long numBytes, unsigned lon
mpImpl->mnReadBufferLength = mpImpl->mnLength - curpos; mpImpl->mnReadBufferLength = mpImpl->mnLength - curpos;
} }
else else
mpImpl->mnReadBufferLength = numBytes; return mpImpl->read(numBytes, numBytesRead);
mpImpl->seek((long) curpos);
mpImpl->mpReadBuffer = new unsigned char[mpImpl->mnReadBufferLength]; mpImpl->mpReadBuffer = new unsigned char[mpImpl->mnReadBufferLength];
unsigned long tmpNumBytes(0); unsigned long tmpNumBytes(0);
...@@ -360,7 +358,7 @@ int WPXSvInputStream::seek(long offset, WPX_SEEK_TYPE seekType) ...@@ -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) if (tmpOffset < mpImpl->tell() && (unsigned long)tmpOffset >= (unsigned long)mpImpl->tell() - mpImpl->mnReadBufferLength)
{ {
mpImpl->mnReadBufferPos = (unsigned long)(tmpOffset + (long) mpImpl->mnReadBufferLength - (long) mpImpl->tell()); mpImpl->mnReadBufferPos = (unsigned long)(tmpOffset + (long) mpImpl->mnReadBufferLength - (long) mpImpl->tell());
return 0; return retVal;
} }
mpImpl->invalidateReadBuffer(); mpImpl->invalidateReadBuffer();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment