summaryrefslogtreecommitdiff
path: root/unotools/source/streaming/streamwrap.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2016-04-03 17:36:42 +0200
committerNoel Grandin <noelgrandin@gmail.com>2016-04-04 09:17:35 +0000
commitf13e80b8a596ef3215a53cd39c9d0fac3e0375b7 (patch)
treeee27db439fce884136d4b8817e27e2b73a11f1da /unotools/source/streaming/streamwrap.cxx
parent21eef3b4b0e7a1a1b1b3ce8a63eb6352f5eb6e62 (diff)
reduce unnecessary reallocing
Change-Id: I62368cf733ca6397099a843f3bbae3da08552798 Reviewed-on: https://gerrit.libreoffice.org/23761 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'unotools/source/streaming/streamwrap.cxx')
-rw-r--r--unotools/source/streaming/streamwrap.cxx5
1 files changed, 3 insertions, 2 deletions
diff --git a/unotools/source/streaming/streamwrap.cxx b/unotools/source/streaming/streamwrap.cxx
index 05d3d93daec8..7356fad4c863 100644
--- a/unotools/source/streaming/streamwrap.cxx
+++ b/unotools/source/streaming/streamwrap.cxx
@@ -55,13 +55,14 @@ sal_Int32 SAL_CALL OInputStreamWrapper::readBytes(css::uno::Sequence< sal_Int8 >
::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, css::uno::Sequence anpassen
- if (nRead < (sal_uInt32)nBytesToRead)
+ if (nRead < (sal_Size)aData.getLength())
aData.realloc( nRead );
return nRead;