summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--unotools/source/streaming/streamhelper.cxx5
-rw-r--r--unotools/source/streaming/streamwrap.cxx5
-rw-r--r--unotools/source/ucbhelper/xtempfile.cxx5
3 files changed, 9 insertions, 6 deletions
diff --git a/unotools/source/streaming/streamhelper.cxx b/unotools/source/streaming/streamhelper.cxx
index 40bc0664f73b..25137c66081f 100644
--- a/unotools/source/streaming/streamhelper.cxx
+++ b/unotools/source/streaming/streamhelper.cxx
@@ -42,7 +42,8 @@ sal_Int32 SAL_CALL OInputStreamHelper::readBytes(css::uno::Sequence< sal_Int8 >&
throw css::io::BufferSizeExceededException(OUString(), static_cast<css::uno::XWeak*>(this));
::osl::MutexGuard aGuard( m_aMutex );
- aData.realloc(nBytesToRead);
+ if (aData.getLength() < nBytesToRead)
+ aData.realloc(nBytesToRead);
sal_Size nRead(0);
ErrCode nError = m_xLockBytes->ReadAt(m_nActPos, static_cast<void*>(aData.getArray()), nBytesToRead, &nRead);
@@ -52,7 +53,7 @@ sal_Int32 SAL_CALL OInputStreamHelper::readBytes(css::uno::Sequence< sal_Int8 >&
throw css::io::IOException(OUString(), static_cast<css::uno::XWeak*>(this));
// adjust sequence if data read is lower than the desired data
- if (nRead < (sal_uInt32)nBytesToRead)
+ if (nRead < (sal_Size)aData.getLength())
aData.realloc( nRead );
return nRead;
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;
diff --git a/unotools/source/ucbhelper/xtempfile.cxx b/unotools/source/ucbhelper/xtempfile.cxx
index e0afe6b107e5..5193dd814819 100644
--- a/unotools/source/ucbhelper/xtempfile.cxx
+++ b/unotools/source/ucbhelper/xtempfile.cxx
@@ -162,12 +162,13 @@ throw (css::io::NotConnectedException, css::io::BufferSizeExceededException, css
if (nBytesToRead < 0)
throw css::io::BufferSizeExceededException( OUString(), static_cast< css::uno::XWeak * >(this));
- aData.realloc(nBytesToRead);
+ if (aData.getLength() < nBytesToRead)
+ aData.realloc(nBytesToRead);
sal_uInt32 nRead = mpStream->Read(static_cast < void* > ( aData.getArray() ), nBytesToRead);
checkError();
- if (nRead < static_cast < sal_uInt32 > ( nBytesToRead ) )
+ if (nRead < (sal_Size)aData.getLength())
aData.realloc( nRead );
if ( sal::static_int_cast<sal_uInt32>(nBytesToRead) > nRead )