[Libreoffice-commits] core.git: sot/source
Noel Grandin
noelgrandin at gmail.com
Mon Apr 4 09:16:15 UTC 2016
sot/source/sdstor/ucbstorage.cxx | 5 +++--
sot/source/unoolestorage/xolesimplestorage.cxx | 2 --
2 files changed, 3 insertions(+), 4 deletions(-)
New commits:
commit 3900df378ccce285b49a71dbbc3e7bc23c9e7d64
Author: Noel Grandin <noelgrandin at gmail.com>
Date: Fri Apr 1 08:06:17 2016 +0200
remove some unnecessary realloc'ing
Change-Id: If3ba03d5928d3c8267ab14e26e5a5afbc37afef5
Reviewed-on: https://gerrit.libreoffice.org/23756
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin at gmail.com>
diff --git a/sot/source/sdstor/ucbstorage.cxx b/sot/source/sdstor/ucbstorage.cxx
index d3b53a7..ec3003b 100644
--- a/sot/source/sdstor/ucbstorage.cxx
+++ b/sot/source/sdstor/ucbstorage.cxx
@@ -145,13 +145,14 @@ sal_Int32 SAL_CALL FileStreamWrapper_Impl::readBytes(Sequence< sal_Int8 >& aData
::osl::MutexGuard aGuard( m_aMutex );
- aData.realloc(nBytesToRead);
+ if (aData.getLength() < nBytesToRead)
+ aData.realloc(nBytesToRead);
sal_uInt32 nRead = m_pSvStream->Read(static_cast<void*>(aData.getArray()), nBytesToRead);
checkError();
// Wenn gelesene Zeichen < MaxLength, Sequence anpassen
- if (nRead < (sal_uInt32)nBytesToRead)
+ if ((sal_Int32)nRead < aData.getLength())
aData.realloc( nRead );
return nRead;
diff --git a/sot/source/unoolestorage/xolesimplestorage.cxx b/sot/source/unoolestorage/xolesimplestorage.cxx
index fd23760..76f2b76 100644
--- a/sot/source/unoolestorage/xolesimplestorage.cxx
+++ b/sot/source/unoolestorage/xolesimplestorage.cxx
@@ -203,8 +203,6 @@ void OLESimpleStorage::InsertInputStreamToStorage_Impl( BaseStorage* pStorage, c
do
{
nRead = xInputStream->readBytes( aData, nBytesCount );
- if ( nRead < nBytesCount )
- aData.realloc( nRead );
sal_Int32 nWritten = pNewStream->Write( aData.getArray(), nRead );
if ( nWritten < nRead )
More information about the Libreoffice-commits
mailing list