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>
This commit is contained in:
Noel Grandin
2016-04-01 08:06:17 +02:00
parent 3efd7a07cb
commit 3900df378c
2 changed files with 3 additions and 4 deletions

View File

@@ -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;

View File

@@ -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 )