diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-03-11 09:06:08 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-03-11 09:58:36 +0000 |
commit | 556373c41fddbac6cbee1c89e7707631270a1852 (patch) | |
tree | 026862690693419beb8810fdc6671ae30c72a026 /tools/source/stream | |
parent | 62b124b2704adf11a63681164d05a8eb49dfb105 (diff) |
V668 no sense in testing the result of new against null
Change-Id: I4a33bd92fc8448638a4bfe1eab7e5041a4c5cc39
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 { |