diff options
Diffstat (limited to 'tools/source/stream/stream.cxx')
-rw-r--r-- | tools/source/stream/stream.cxx | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/tools/source/stream/stream.cxx b/tools/source/stream/stream.cxx index 21b317e774b9..e7d21d950e39 100644 --- a/tools/source/stream/stream.cxx +++ b/tools/source/stream/stream.cxx @@ -1632,13 +1632,9 @@ SvMemoryStream::SvMemoryStream( std::size_t nInitSize, std::size_t nResizeOffset pBuf = nullptr; if( nResize != 0 && nResize < 16 ) nResize = 16; - if( nInitSize && !AllocateMemory( nInitSize ) ) - { - SetError( SVSTREAM_OUTOFMEMORY ); - nSize = 0; - } - else - nSize = nInitSize; + if( nInitSize ) + AllocateMemory( nInitSize ); + nSize = nInitSize; SetBufferSize( 64 ); } @@ -1801,10 +1797,9 @@ void SvMemoryStream::ResetError() SvStream::ClearError(); } -bool SvMemoryStream::AllocateMemory( std::size_t nNewSize ) +void SvMemoryStream::AllocateMemory( std::size_t nNewSize ) { pBuf = new sal_uInt8[nNewSize]; - return( pBuf != nullptr ); } // (using Bozo algorithm) @@ -1887,13 +1882,8 @@ void* SvMemoryStream::SwitchBuffer() ResetError(); std::size_t nInitSize = 512; - if( !AllocateMemory(nInitSize) ) - { - SetError( SVSTREAM_OUTOFMEMORY ); - nSize = 0; - } - else - nSize = nInitSize; + AllocateMemory(nInitSize); + nSize = nInitSize; SetBufferSize( 64 ); return pRetVal; |