summaryrefslogtreecommitdiff
path: root/package/source/xstor/owriteablestream.cxx
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2022-07-18 11:28:34 +0200
committerStephan Bergmann <sbergman@redhat.com>2022-07-18 13:09:51 +0200
commitfd2e907e448991e5c8b54acbe7e31bff24c8e875 (patch)
treefb5fcca1568589e4f430259ae3f451bf7eaf148b /package/source/xstor/owriteablestream.cxx
parentaaebfb9baf53e4ed221a9bb8e1772fcbb7b921ab (diff)
comphelper::ByteWriter::writeSomeBytes always writes all bytes
...so rename it to writeBytes for clarity, and drop the redundant return value. Also clarify that it has a narrow interface and requires nBytesToWrite to be non-negative. Change-Id: I76dee83fecd6350f473f55dcffb950c16aa22d93 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137169 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'package/source/xstor/owriteablestream.cxx')
-rw-r--r--package/source/xstor/owriteablestream.cxx12
1 files changed, 7 insertions, 5 deletions
diff --git a/package/source/xstor/owriteablestream.cxx b/package/source/xstor/owriteablestream.cxx
index 6ecdb35b848f..e380d971c770 100644
--- a/package/source/xstor/owriteablestream.cxx
+++ b/package/source/xstor/owriteablestream.cxx
@@ -17,8 +17,10 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include <memory>
#include <sal/config.h>
+
+#include <cassert>
+#include <memory>
#include <sal/log.hxx>
#include <com/sun/star/packages/NoEncryptionException.hpp>
@@ -2099,8 +2101,10 @@ void SAL_CALL OWriteStream::writeBytes( const uno::Sequence< sal_Int8 >& aData )
ModifyParentUnlockMutex_Impl( aGuard );
}
-sal_Int32 OWriteStream::writeSomeBytes( const sal_Int8* pData, sal_Int32 nBytesToWrite )
+void OWriteStream::writeBytes( const sal_Int8* pData, sal_Int32 nBytesToWrite )
{
+ assert(nBytesToWrite >= 0);
+
osl::ClearableMutexGuard aGuard(m_pData->m_xSharedMutex->GetMutex());
// the write method makes initialization itself, since it depends from the aData length
@@ -2162,7 +2166,7 @@ sal_Int32 OWriteStream::writeSomeBytes( const sal_Int8* pData, sal_Int32 nBytesT
if (xOutputTunnel)
pByteWriter = reinterpret_cast< comphelper::ByteWriter* >( xOutputTunnel->getSomething( comphelper::ByteWriter::getUnoTunnelId() ) );
if (pByteWriter)
- nBytesToWrite = pByteWriter->writeSomeBytes(pData, nBytesToWrite);
+ pByteWriter->writeBytes(pData, nBytesToWrite);
else
{
uno::Sequence<sal_Int8> aData(pData, nBytesToWrite);
@@ -2171,8 +2175,6 @@ sal_Int32 OWriteStream::writeSomeBytes( const sal_Int8* pData, sal_Int32 nBytesT
m_pImpl->m_bHasDataToFlush = true;
ModifyParentUnlockMutex_Impl( aGuard );
-
- return nBytesToWrite;
}
sal_Int64 SAL_CALL OWriteStream::getSomething( const css::uno::Sequence< sal_Int8 >& rIdentifier )