diff options
Diffstat (limited to 'tools/source/stream')
-rw-r--r-- | tools/source/stream/stream.cxx | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/tools/source/stream/stream.cxx b/tools/source/stream/stream.cxx index 9f6e15f28eff..e8a2a5dc54ad 100644 --- a/tools/source/stream/stream.cxx +++ b/tools/source/stream/stream.cxx @@ -1895,27 +1895,24 @@ bool SvMemoryStream::ReAllocateMemory( long nDiff ) { sal_uInt8* pNewBuf = new sal_uInt8[nNewSize]; - if( pNewBuf ) + bRetVal = true; // Success! + if( nNewSize < nSize ) // Are we shrinking? { - bRetVal = true; // Success! - if( nNewSize < nSize ) // Are we shrinking? - { - memcpy( pNewBuf, pBuf, (size_t)nNewSize ); - if( nPos > nNewSize ) - nPos = 0L; - if( nEndOfData >= nNewSize ) - nEndOfData = nNewSize-1L; - } - else - { - memcpy( pNewBuf, pBuf, (size_t)nSize ); - } + memcpy( pNewBuf, pBuf, (size_t)nNewSize ); + if( nPos > nNewSize ) + nPos = 0L; + if( nEndOfData >= nNewSize ) + nEndOfData = nNewSize-1L; + } + else + { + memcpy( pNewBuf, pBuf, (size_t)nSize ); + } - FreeMemory(); + FreeMemory(); - pBuf = pNewBuf; - nSize = nNewSize; - } + pBuf = pNewBuf; + nSize = nNewSize; } else { |