summaryrefslogtreecommitdiff
path: root/unotools/source/ucbhelper
diff options
context:
space:
mode:
Diffstat (limited to 'unotools/source/ucbhelper')
-rw-r--r--unotools/source/ucbhelper/XTempFile.hxx3
-rw-r--r--unotools/source/ucbhelper/xtempfile.cxx15
2 files changed, 17 insertions, 1 deletions
diff --git a/unotools/source/ucbhelper/XTempFile.hxx b/unotools/source/ucbhelper/XTempFile.hxx
index 2b0ec33cb42a..456dd7da186e 100644
--- a/unotools/source/ucbhelper/XTempFile.hxx
+++ b/unotools/source/ucbhelper/XTempFile.hxx
@@ -46,7 +46,7 @@ typedef ::cppu::WeakImplHelper< css::io::XTempFile
, css::beans::XPropertyAccess
, css::lang::XServiceInfo> OTempFileBase;
-class OTempFileService : public OTempFileBase
+class OTempFileService : public OTempFileBase, public comphelper::ByteReader
{
std::optional<utl::TempFileNamed> mpTempFile;
std::mutex maMutex;
@@ -112,6 +112,7 @@ public:
virtual ::css::uno::Sequence< ::css::beans::PropertyValue > SAL_CALL getPropertyValues() override;
virtual void SAL_CALL setPropertyValues( const ::css::uno::Sequence< ::css::beans::PropertyValue >& aProps ) override;
+ virtual sal_Int32 readSomeBytes(sal_Int8* aData, sal_Int32 nBytesToRead) override;
virtual ~OTempFileService () override;
};
diff --git a/unotools/source/ucbhelper/xtempfile.cxx b/unotools/source/ucbhelper/xtempfile.cxx
index 35462587ff84..7e27b7f4d24f 100644
--- a/unotools/source/ucbhelper/xtempfile.cxx
+++ b/unotools/source/ucbhelper/xtempfile.cxx
@@ -147,6 +147,21 @@ sal_Int32 SAL_CALL OTempFileService::readSomeBytes( css::uno::Sequence< sal_Int8
}
return readBytes(aData, nMaxBytesToRead);
}
+sal_Int32 OTempFileService::readSomeBytes( sal_Int8* aData, sal_Int32 nBytesToRead )
+{
+ std::unique_lock aGuard( maMutex );
+ if ( mbInClosed )
+ throw css::io::NotConnectedException ( OUString(), getXWeak() );
+
+ checkConnected();
+ if (nBytesToRead < 0)
+ throw css::io::BufferSizeExceededException( OUString(), getXWeak());
+
+ sal_uInt32 nRead = mpStream->ReadBytes(static_cast<void*>(aData), nBytesToRead);
+ checkError();
+
+ return nRead;
+}
void SAL_CALL OTempFileService::skipBytes( sal_Int32 nBytesToSkip )
{
std::unique_lock aGuard( maMutex );