From 48dee8d2531d3b6be4d767513046063fcff3844f Mon Sep 17 00:00:00 2001 From: Jens-Heiner Rechtien Date: Tue, 13 Apr 2004 11:03:37 +0000 Subject: INTEGRATION: CWS unopkg1 (1.27.28); FILE MERGED 2003/11/28 12:42:26 dbo 1.27.28.1: insertNewcontent(): providing an empty input stream instead of null reference --- ucbhelper/source/client/content.cxx | 60 ++++++++++++++++++++++++++++++++++--- 1 file changed, 56 insertions(+), 4 deletions(-) (limited to 'ucbhelper') diff --git a/ucbhelper/source/client/content.cxx b/ucbhelper/source/client/content.cxx index 5ac1f9e343e6..38dc4a96490d 100644 --- a/ucbhelper/source/client/content.cxx +++ b/ucbhelper/source/client/content.cxx @@ -2,9 +2,9 @@ * * $RCSfile: content.cxx,v $ * - * $Revision: 1.27 $ + * $Revision: 1.28 $ * - * last change: $Author: vg $ $Date: 2003-07-25 11:36:37 $ + * last change: $Author: hr $ $Date: 2004-04-13 12:03:37 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -78,6 +78,8 @@ #include #endif +#include + #ifndef _COM_SUN_STAR_UCB_CONTENTCREATIONERROR_HPP_ #include #endif @@ -188,6 +190,56 @@ using namespace com::sun::star::uno; namespace ucb { +class EmptyInputStream : public ::cppu::WeakImplHelper1< XInputStream > +{ +public: + virtual sal_Int32 SAL_CALL readBytes( + Sequence< sal_Int8 > & data, sal_Int32 nBytesToRead ) + throw (IOException, RuntimeException); + virtual sal_Int32 SAL_CALL readSomeBytes( + Sequence< sal_Int8 > & data, sal_Int32 nMaxBytesToRead ) + throw (IOException, RuntimeException); + virtual void SAL_CALL skipBytes( sal_Int32 nBytesToSkip ) + throw (IOException, RuntimeException); + virtual sal_Int32 SAL_CALL available() + throw (IOException, RuntimeException); + virtual void SAL_CALL closeInput() + throw (IOException, RuntimeException); +}; + +sal_Int32 EmptyInputStream::readBytes( + Sequence< sal_Int8 > & data, sal_Int32 nBytesToRead ) + throw (IOException, RuntimeException) +{ + data.realloc( 0 ); + return 0; +} + +sal_Int32 EmptyInputStream::readSomeBytes( + Sequence< sal_Int8 > & data, sal_Int32 nMaxBytesToRead ) + throw (IOException, RuntimeException) +{ + data.realloc( 0 ); + return 0; +} + +void EmptyInputStream::skipBytes( sal_Int32 nBytesToSkip ) + throw (IOException, RuntimeException) +{ +} + +sal_Int32 EmptyInputStream::available() + throw (IOException, RuntimeException) +{ + return 0; +} + +void EmptyInputStream::closeInput() + throw (IOException, RuntimeException) +{ +} + + //========================================================================= //========================================================================= // @@ -1272,7 +1324,7 @@ sal_Bool Content::insertNewContent( const rtl::OUString& rContentType, return insertNewContent( rContentType, rPropertyNames, rPropertyValues, - Reference< XInputStream >(), + new EmptyInputStream, rNewContent ); } @@ -1287,7 +1339,7 @@ sal_Bool Content::insertNewContent( const rtl::OUString& rContentType, return insertNewContent( rContentType, nPropertyHandles, rPropertyValues, - Reference< XInputStream >(), + new EmptyInputStream, rNewContent ); } -- cgit