summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ucb/source/ucp/gio/gio_content.cxx7
-rw-r--r--ucb/source/ucp/gio/gio_inputstream.cxx25
-rw-r--r--ucb/source/ucp/gio/gio_inputstream.hxx16
3 files changed, 13 insertions, 35 deletions
diff --git a/ucb/source/ucp/gio/gio_content.cxx b/ucb/source/ucp/gio/gio_content.cxx
index 2eb2219183eb..00f3fab9d9a0 100644
--- a/ucb/source/ucp/gio/gio_content.cxx
+++ b/ucb/source/ucp/gio/gio_content.cxx
@@ -59,6 +59,7 @@
#include <com/sun/star/ucb/XContentCreator.hpp>
#include <comphelper/processfactory.hxx>
+#include <comphelper/seekableinput.hxx>
#include <cppuhelper/exc_hlp.hxx>
#include <ucbhelper/contentidentifier.hxx>
#include <ucbhelper/propertyvalueset.hxx>
@@ -852,9 +853,9 @@ bool Content::feedSink( uno::Reference< uno::XInterface > xSink,
if (!pStream)
convertToException(pError, static_cast< cppu::OWeakObject * >(this));
- uno::Reference< io::XInputStream > xIn = new ::gio::InputStream(pStream);
- if ( !xIn.is() )
- return false;
+ uno::Reference< io::XInputStream > xIn(
+ new comphelper::OSeekableInputWrapper(
+ new ::gio::InputStream(pStream), m_xContext));
if ( xOut.is() )
copyData( xIn, xOut );
diff --git a/ucb/source/ucp/gio/gio_inputstream.cxx b/ucb/source/ucp/gio/gio_inputstream.cxx
index 4a14f22c4b15..e443277f7640 100644
--- a/ucb/source/ucp/gio/gio_inputstream.cxx
+++ b/ucb/source/ucp/gio/gio_inputstream.cxx
@@ -29,7 +29,7 @@ using namespace com::sun::star;
namespace gio
{
-InputStream::InputStream(GFileInputStream *pStream) : Seekable(G_SEEKABLE(pStream)), mpStream(pStream)
+InputStream::InputStream(GFileInputStream *pStream): mpStream(pStream)
{
if (!mpStream)
throw io::NotConnectedException();
@@ -57,16 +57,11 @@ void SAL_CALL InputStream::skipBytes( sal_Int32 nBytesToSkip )
throw( io::NotConnectedException, io::BufferSizeExceededException,
io::IOException, uno::RuntimeException, std::exception )
{
- if (!mpStream)
- throw io::NotConnectedException();
-
- if (!g_seekable_can_seek(G_SEEKABLE(mpStream)))
- throw io::IOException("Seek unsupported",
- static_cast< cppu::OWeakObject * >(this));
-
- GError *pError=NULL;
- if (!g_seekable_seek(G_SEEKABLE(mpStream), nBytesToSkip, G_SEEK_CUR, NULL, &pError))
- convertToIOException(pError, static_cast< cppu::OWeakObject * >(this));
+ // Conservatively call readBytes and discard the read data, but given this
+ // InputStream will always be wrapped in comphelper::OSeekableInputWrapper,
+ // this function will never be called anyway:
+ css::uno::Sequence<sal_Int8> data;
+ readBytes(data, nBytesToSkip);
}
sal_Int32 SAL_CALL InputStream::readBytes( uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead )
@@ -100,14 +95,6 @@ sal_Int32 SAL_CALL InputStream::readSomeBytes( uno::Sequence< sal_Int8 >& aData,
return readBytes(aData, nMaxBytesToRead);
}
-uno::Any InputStream::queryInterface( const uno::Type &type ) throw( uno::RuntimeException, std::exception )
-{
- uno::Any aRet = ::cppu::queryInterface ( type,
- static_cast< XInputStream * >( this ) );
-
- return aRet.hasValue() ? aRet : Seekable::queryInterface( type );
-}
-
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/ucb/source/ucp/gio/gio_inputstream.hxx b/ucb/source/ucp/gio/gio_inputstream.hxx
index d469787e1898..a0ffb1f70a74 100644
--- a/ucb/source/ucp/gio/gio_inputstream.hxx
+++ b/ucb/source/ucp/gio/gio_inputstream.hxx
@@ -22,20 +22,16 @@
#include <sal/types.h>
#include <rtl/ustring.hxx>
-#include <cppuhelper/weak.hxx>
+#include <cppuhelper/implbase1.hxx>
#include <com/sun/star/io/XInputStream.hpp>
-#include <com/sun/star/io/XTruncate.hpp>
-#include <com/sun/star/io/XSeekable.hpp>
-#include "gio_seekable.hxx"
+#include <gio/gio.h>
namespace gio
{
-class InputStream :
- public ::com::sun::star::io::XInputStream,
- public Seekable
+class InputStream: public cppu::WeakImplHelper1<css::io::XInputStream>
{
private:
GFileInputStream *mpStream;
@@ -44,12 +40,6 @@ public:
InputStream ( GFileInputStream *pStream );
virtual ~InputStream();
- // XInterface
- virtual com::sun::star::uno::Any SAL_CALL queryInterface(const ::com::sun::star::uno::Type & type )
- throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
- virtual void SAL_CALL acquire( void ) throw () SAL_OVERRIDE { OWeakObject::acquire(); }
- virtual void SAL_CALL release( void ) throw() SAL_OVERRIDE { OWeakObject::release(); }
-
// XInputStream
virtual sal_Int32 SAL_CALL readBytes( ::com::sun::star::uno::Sequence< sal_Int8 > & aData,
sal_Int32 nBytesToRead )