summaryrefslogtreecommitdiff
path: root/sot
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2016-04-01 08:06:17 +0200
committerNoel Grandin <noelgrandin@gmail.com>2016-04-04 09:15:50 +0000
commit3900df378ccce285b49a71dbbc3e7bc23c9e7d64 (patch)
tree76d62ea34c0396010fe55ab178749f45918b42d5 /sot
parent3efd7a07cbccd03ecb289e95fb9343460ace4a7f (diff)
remove some unnecessary realloc'ing
Change-Id: If3ba03d5928d3c8267ab14e26e5a5afbc37afef5 Reviewed-on: https://gerrit.libreoffice.org/23756 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'sot')
-rw-r--r--sot/source/sdstor/ucbstorage.cxx5
-rw-r--r--sot/source/unoolestorage/xolesimplestorage.cxx2
2 files changed, 3 insertions, 4 deletions
diff --git a/sot/source/sdstor/ucbstorage.cxx b/sot/source/sdstor/ucbstorage.cxx
index d3b53a710863..ec3003bc9ff4 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 fd2376010ed3..76f2b76af79d 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 )