comphelper/source/streaming/memorystream.cxx | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-)
New commits: commit 94efbeca0ae9757f706f3618d633eadeb7b37442 Author: Stephan Bergmann <sberg...@redhat.com> AuthorDate: Mon Jul 18 16:53:14 2022 +0200 Commit: Stephan Bergmann <sberg...@redhat.com> CommitDate: Tue Jul 19 08:33:27 2022 +0200 Consolidate writeBytes functions Change-Id: I44db198967a37f8b11f1b185a8b093b0de2d500d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137205 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sberg...@redhat.com> 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 )