diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2022-07-18 16:53:14 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2022-07-19 08:33:27 +0200 |
commit | 94efbeca0ae9757f706f3618d633eadeb7b37442 (patch) | |
tree | 72af52dc5de41017928f52aeb4bdfb480be2d256 /comphelper/source | |
parent | a2c5a29f76fa75d920b27149f1dffca1ca84177d (diff) |
Consolidate writeBytes functions
Change-Id: I44db198967a37f8b11f1b185a8b093b0de2d500d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137205
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'comphelper/source')
-rw-r--r-- | comphelper/source/streaming/memorystream.cxx | 20 |
1 files changed, 1 insertions, 19 deletions
diff --git a/comphelper/source/streaming/memorystream.cxx b/comphelper/source/streaming/memorystream.cxx index bc40826e0b33..97480a3aad64 100644 --- a/comphelper/source/streaming/memorystream.cxx +++ b/comphelper/source/streaming/memorystream.cxx @@ -206,25 +206,7 @@ sal_Int64 SAL_CALL UNOMemoryStream::getLength() // XOutputStream void SAL_CALL UNOMemoryStream::writeBytes( const Sequence< sal_Int8 >& aData ) { - const sal_Int32 nBytesToWrite( aData.getLength() ); - if( !nBytesToWrite ) - return; - - sal_Int64 nNewSize = static_cast<sal_Int64>(mnCursor) + nBytesToWrite; - if( nNewSize > SAL_MAX_INT32 ) - { - OSL_ASSERT(false); - throw IOException("this implementation does not support more than 2GB!", static_cast<OWeakObject*>(this) ); - } - - if( o3tl::make_unsigned( nNewSize ) > maData.size() ) - maData.resize( nNewSize ); - - sal_Int8* pData = &(*maData.begin()); - sal_Int8* pCursor = &(pData[mnCursor]); - memcpy(pCursor, aData.getConstArray(), nBytesToWrite); - - mnCursor += nBytesToWrite; + writeBytes(aData.getConstArray(), aData.getLength()); } void UNOMemoryStream::writeBytes( const sal_Int8* pInData, sal_Int32 nBytesToWrite ) |