Hi Mikhail, I have integrated the registration, please check the new comphelper.patch, thanks! :-)
I got troubles removing m_xFactory from SequenceOutputStreamService this time, an error occurs compiling facreg.cxx, it appears that the function, to which the 3rd parameter of createSingleFactory() points to, has to have a const uno::Reference< lang::XMultiServiceFactory > & xFactory parameter, or the compilation fails. Could you check comphelper.noFactory.patch and error.log and give me some suggestions? By the way I noticed in the C++ UNO Reference createSingleFactory() is described as a deprecated method, maybe it is better we integrate in a another way? Best Regards, Felix. Mikhail Voitenko 写道: > Hi Felix, > > The patch looks very good, now the service should be correctly > registered. Please integrate the registration of the service into > comphelper/source/misc/facreg.cxx. You can search for the > "SequenceInputStreamService" to see an example of the registration. > > As for the m_xFactory member, you are right, it is not used so it can be > removed. If it will be necessary in future, it can be easily inserted. > > Best Regards, > Mikhail. > > Zhang Xiaofei wrote: > >> Hi Mikhail, >> >> Thanks very much for your suggestions, I've modified the implementation >> and made 2 new patches, could you help to review them please? >> >> And I might need your help on the following question: >> - About The private member SequenceInputStreamService::m_xFactory, I >> could not find it being used in any existing member functions, I tried >> to remove it from the implementation and find nothing affected. Could >> you please tell me for what the purpose does was it there, reserved for >> future use, I suppose? Should we keep it in SequenceOutputStreamService' >> implementation, too? >> >> Thanks and Best Regards :-) , >> Felix. >> >> >> Mikhail Voitenko 写道: >> >> >>> Hi Felix, >>> >>> The implementation looks good, except one problem you have already >>> mentioned. You are completely right, it is not allowed to have >>> out-parameter in the constructor. Sorry, my failure. The attached >>> implementation fills the sequence correctly, but unfortunately not the >>> original sequence provided from outside. So we should design it in >>> different way. I would suggest the following changes: >>> - introduce a new interface XSequenceOutputStream derived from >>> XOutputStream, that implements an additional method, kind of "sequence< >>> byte > getWrittenBytes() throws ( NotConnectedException, IOException )" >>> - let the service be derived from the interface >>> - let the service get no arguments in constructor, the sequence will be >>> just an internal member in the implementation >>> >>> Thus, the user will create the service, that will fill internal sequence >>> while being written, and then return the sequence. Before returning of >>> the stream, the sequence must get the correct length, since for >>> optimization reasons OSequenceOutputStream can let the sequence be >>> longer during the writing. Currently it is done in >>> OSequenceOutputStream::closeOutput(), but we do not need to close the >>> internal stream in case of getWrittenBytes() call. So I would suggest to >>> fix OSequenceOutputStream::flush() so that it sets the correct size to >>> the sequence, and use this method in getWrittenBytes() call. >>> >>> >>> As for the 'O' prefix, it is has no special meaning. There is no name >>> convention regarding class names of service implementations, so it is a >>> matter of taste. :) >>> >>> Best Regards, >>> Mikhail. >>> >>> >>> Zhang Xiaofei wrote: >>> >>> >>> >>>> Hi Mikhail, >>>> >>>> The attachment is the patches to udkapi and comphelper projects, the >>>> compilation to udkapi, offapi, offuh, comphelper projects all passed, >>>> and the application seems running fine after I delivered >>>> comphelp4MSC.dll explicitly to the install directory. Could you help >>>> to review them please? >>>> >>>> This time I have some questions as well: >>>> >>>> The first is about the ctor of SequenceOutputStream, I'm not sure if I >>>> got your statement in our last IRC meeting, that the service >>>> constructor should take sequence of bytes as output parameter, in the >>>> right way. At first I declared the ctor as: >>>> >>>> /_createStreamFromSequence( [out] sequence<byte> aData ); >>>> >>>> _/But then I was informed by the compiler that a parameter of a ctor >>>> may *not* be /out /or /inout, /I modified it to: >>>> >>>> /_createStreamFromSequence( [in] sequence<byte> aData ); >>>> >>>> _/then the compilation passed. However I don't know if this is >>>> semantically correct. Could you please give me some instructions here?/_ >>>> _/ >>>> The second is about naming conventions on classes, I find sometimes a >>>> class has an 'O' before its name, just like OSequenceOutputStream in >>>> /compehelper/inc/seqstream.hxx, and OTempFileService in our first >>>> task, too; but sometimes there isn't, like SequenceInputStream in >>>> seqstream.hxx, what does the 'O' stand for and when is it appropriate >>>> to have it? >>>> Does it has something to do with the class deriving from a typedef-ed >>>> base class, like OSequenceOutputStream_Base and OTempFileBase, I suppose? >>>> >>>> Best Regards, >>>> Felix. >>>> >>>> >>>> >>>> >>> >>> >>> > >
diff -urNpw @comphelper/source/misc/facreg.cxx comphelper/source/misc/facreg.cxx --- @comphelper/source/misc/facreg.cxx 2007-06-27 00:10:54.000000000 +0800 +++ comphelper/source/misc/facreg.cxx 2007-09-13 10:43:30.000000000 +0800 @@ -87,7 +87,10 @@ extern uno::Sequence< OUString > SAL_CAL extern OUString SAL_CALL SequenceInputStreamService_getImplementationName() throw(); extern uno::Reference< uno::XInterface > SAL_CALL SequenceInputStreamService_createInstance(const uno::Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception ); - +//SequenceOutputStreamService +extern uno::Sequence< OUString > SAL_CALL SequenceOutputStreamService_getSupportedServiceNames() throw(); +extern OUString SAL_CALL SequenceOutputStreamService_getImplementationName() throw(); +extern uno::Reference< uno::XInterface > SAL_CALL SequenceOutputStreamService_createInstance(const uno::Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception ); // @@ -146,6 +149,8 @@ SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL c writeInfo( pKey, OInstanceLocker::impl_staticGetImplementationName(), OInstanceLocker::impl_staticGetSupportedServiceNames() ); // SequenceInputStreamService writeInfo( pKey, SequenceInputStreamService_getImplementationName(), SequenceInputStreamService_getSupportedServiceNames() ); + // SequenceOutputStreamService + writeInfo( pKey, SequenceOutputStreamService_getImplementationName(), SequenceOutputStreamService_getSupportedServiceNames() ); } catch (registry::InvalidRegistryException &) @@ -208,6 +213,13 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL com SequenceInputStreamService_createInstance, SequenceInputStreamService_getSupportedServiceNames() ); } + else if ( SequenceOutputStreamService_getImplementationName().equalsAsciiL( pImplName, nImplNameLen ) ) + { + xFactory = ::cppu::createSingleFactory( xMSF, + SequenceOutputStreamService_getImplementationName(), + SequenceOutputStreamService_createInstance, + SequenceOutputStreamService_getSupportedServiceNames() ); + } if( xFactory.is()) { diff -urNpw @comphelper/source/streaming/makefile.mk comphelper/source/streaming/makefile.mk --- @comphelper/source/streaming/makefile.mk 2007-06-27 00:11:08.000000000 +0800 +++ comphelper/source/streaming/makefile.mk 2007-09-11 13:39:14.000000000 +0800 @@ -50,6 +50,7 @@ SLOFILES= $(SLO)$/basicio.obj \ $(SLO)$/oslfile2streamwrap.obj \ $(SLO)$/seqstream.obj \ $(SLO)$/seqinputstreamserv.obj \ + $(SLO)$/seqoutputstreamserv.obj \ $(SLO)$/streamsection.obj \ $(SLO)$/seekableinput.obj \ $(SLO)$/otransactedfilestream.obj \ diff -urNpw @comphelper/source/streaming/seqoutputstreamserv.cxx comphelper/source/streaming/seqoutputstreamserv.cxx --- @comphelper/source/streaming/seqoutputstreamserv.cxx 1970-01-01 08:00:00.000000000 +0800 +++ comphelper/source/streaming/seqoutputstreamserv.cxx 2007-09-13 10:42:12.000000000 +0800 @@ -0,0 +1,179 @@ +/************************************************************************* +* +* OpenOffice.org - a multi-platform office productivity suite +* +* $RCSfile: seqinputstreamserv.cxx,v $ +* +* $Revision: 1.2 $ +* +* last change: $Author: hr $ $Date: 2007/06/26 16:11:17 $ +* +* The Contents of this file are made available subject to +* the terms of GNU Lesser General Public License Version 2.1. +* +* +* GNU Lesser General Public License Version 2.1 +* ============================================= +* Copyright 2005 by Sun Microsystems, Inc. +* 901 San Antonio Road, Palo Alto, CA 94303, USA +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License version 2.1, as published by the Free Software Foundation. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +* +************************************************************************/ + +#include "precompiled_comphelper.hxx" + +#include <sal/config.h> +#include <osl/mutex.hxx> +#include <cppuhelper/factory.hxx> +#include <cppuhelper/implementationentry.hxx> +#include <cppuhelper/implbase2.hxx> +#include <comphelper/seqstream.hxx> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/io/XSequenceOutputStream.hpp> + +using namespace ::com::sun::star; + +::rtl::OUString SAL_CALL SequenceOutputStreamService_getImplementationName(); +uno::Sequence< ::rtl::OUString > SAL_CALL SequenceOutputStreamService_getSupportedServiceNames(); +uno::Reference< uno::XInterface > SAL_CALL SequenceOutputStreamService_createInstance( const uno::Reference< lang::XMultiServiceFactory > & xFactory ) SAL_THROW( (uno::Exception ) ); + + +namespace { + +class SequenceOutputStreamService: +public ::cppu::WeakImplHelper2 < lang::XServiceInfo, io::XOutputStream> +{ +public: + explicit SequenceOutputStreamService( uno::Reference< lang::XMultiServiceFactory > const & xFactory ); + + // ::com::sun::star::lang::XServiceInfo: + virtual ::rtl::OUString SAL_CALL getImplementationName() throw ( uno::RuntimeException ); + virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString & ServiceName ) throw ( uno::RuntimeException ); + virtual uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw ( uno::RuntimeException ); + + // ::com::sun::star::io::XOutputStream: + virtual void SAL_CALL writeBytes( const uno::Sequence< ::sal_Int8 > & aData ) throw ( io::NotConnectedException, io::BufferSizeExceededException, io::IOException, uno::RuntimeException ); + virtual void SAL_CALL flush() throw ( uno::RuntimeException, io::NotConnectedException, io::BufferSizeExceededException, io::IOException ); + virtual void SAL_CALL closeOutput() throw ( uno::RuntimeException, io::NotConnectedException, io::BufferSizeExceededException, io::IOException ); + + // ::com::sun::star::io::XSequenceOutputStream: + virtual uno::Sequence< ::sal_Int8 > SAL_CALL getWrittenBytes( ) throw ( io::NotConnectedException, io::IOException, uno::RuntimeException); + +private: + SequenceOutputStreamService( SequenceOutputStreamService & ); //not defined + void operator =( SequenceOutputStreamService & ); //not defined + + virtual ~SequenceOutputStreamService() {}; + + + ::osl::Mutex m_aMutex; + uno::Reference< lang::XMultiServiceFactory > m_xFactory; + uno::Reference< io::XOutputStream > m_xOutputStream; + uno::Sequence< ::sal_Int8 > m_aSequence; +}; + +SequenceOutputStreamService::SequenceOutputStreamService( uno::Reference< lang::XMultiServiceFactory > const & xFactory ) +: m_xFactory( xFactory ) +{} + +// com.sun.star.uno.XServiceInfo: +::rtl::OUString SAL_CALL SequenceOutputStreamService::getImplementationName() throw ( uno::RuntimeException ) +{ + return SequenceOutputStreamService_getImplementationName(); +} + +::sal_Bool SAL_CALL SequenceOutputStreamService::supportsService( ::rtl::OUString const & serviceName ) throw ( uno::RuntimeException ) +{ + uno::Sequence< ::rtl::OUString > serviceNames = SequenceOutputStreamService_getSupportedServiceNames(); + for ( ::sal_Int32 i = 0; i < serviceNames.getLength(); ++i ) { + if ( serviceNames[i] == serviceName ) + return sal_True; + } + return sal_False; +} + +uno::Sequence< ::rtl::OUString > SAL_CALL SequenceOutputStreamService::getSupportedServiceNames() throw ( uno::RuntimeException ) +{ + return SequenceOutputStreamService_getSupportedServiceNames(); +} + +// ::com::sun::star::io::XOutputStream: +void SAL_CALL SequenceOutputStreamService::writeBytes( const uno::Sequence< ::sal_Int8 > & aData ) throw ( uno::RuntimeException, io::NotConnectedException, io::BufferSizeExceededException, io::IOException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if ( !m_xOutputStream.is() ) + throw io::NotConnectedException(); + + m_xOutputStream->writeBytes( aData ); + m_aSequence = aData; +} + +void SAL_CALL SequenceOutputStreamService::flush() throw ( uno::RuntimeException, io::NotConnectedException, io::BufferSizeExceededException, io::IOException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if ( !m_xOutputStream.is() ) + throw io::NotConnectedException(); + + m_xOutputStream->flush(); +}; + +void SAL_CALL SequenceOutputStreamService::closeOutput() throw ( uno::RuntimeException, io::NotConnectedException, io::BufferSizeExceededException, io::IOException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if ( !m_xOutputStream.is() ) + throw io::NotConnectedException(); + + m_xOutputStream->closeOutput(); + m_xOutputStream = uno::Reference< io::XOutputStream >(); +} + +// ::com::sun::star::io::XSequenceOutputStream: +uno::Sequence< ::sal_Int8 > SAL_CALL SequenceOutputStreamService::getWrittenBytes() throw ( io::NotConnectedException, io::IOException, uno::RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if ( !m_xOutputStream.is() ) + throw io::NotConnectedException(); + + m_xOutputStream->flush(); + return m_aSequence; +} + +} // anonymous namespace + +::rtl::OUString SAL_CALL SequenceOutputStreamService_getImplementationName() { + return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.comp.SequenceOutputStreamService" ) ); +} + +uno::Sequence< ::rtl::OUString > SAL_CALL SequenceOutputStreamService_getSupportedServiceNames() +{ + uno::Sequence< ::rtl::OUString > s( 1 ); + s[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.io.SequenceOutputStream" ) ); + return s; +} + +uno::Reference< uno::XInterface > SAL_CALL SequenceOutputStreamService_createInstance( + const uno::Reference< lang::XMultiServiceFactory > & xFactory ) + SAL_THROW( (uno::Exception ) ) +{ + return static_cast< ::cppu::OWeakObject * >( new SequenceOutputStreamService( xFactory ) ); +} + + + + + diff -urNpw @comphelper/source/streaming/seqstream.cxx comphelper/source/streaming/seqstream.cxx --- @comphelper/source/streaming/seqstream.cxx 2006-09-18 01:21:22.000000000 +0800 +++ comphelper/source/streaming/seqstream.cxx 2007-09-12 10:43:52.000000000 +0800 @@ -234,7 +234,8 @@ void SAL_CALL OSequenceOutputStream::flu if (!m_bConnected) throw NotConnectedException(); - // nothing to do here + // cut the sequence to the real size + m_rSequence.realloc(m_nSize); }
diff -urNpw @comphelper/source/misc/facreg.cxx comphelper/source/misc/facreg.cxx --- @comphelper/source/misc/facreg.cxx 2007-06-27 00:10:54.000000000 +0800 +++ comphelper/source/misc/facreg.cxx 2007-09-13 11:05:40.000000000 +0800 @@ -87,7 +87,10 @@ extern uno::Sequence< OUString > SAL_CAL extern OUString SAL_CALL SequenceInputStreamService_getImplementationName() throw(); extern uno::Reference< uno::XInterface > SAL_CALL SequenceInputStreamService_createInstance(const uno::Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception ); - +//SequenceOutputStreamService +extern uno::Sequence< OUString > SAL_CALL SequenceOutputStreamService_getSupportedServiceNames() throw(); +extern OUString SAL_CALL SequenceOutputStreamService_getImplementationName() throw(); +extern uno::Reference< uno::XInterface > SAL_CALL SequenceOutputStreamService_createInstance() throw( uno::Exception ); // @@ -146,6 +149,8 @@ SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL c writeInfo( pKey, OInstanceLocker::impl_staticGetImplementationName(), OInstanceLocker::impl_staticGetSupportedServiceNames() ); // SequenceInputStreamService writeInfo( pKey, SequenceInputStreamService_getImplementationName(), SequenceInputStreamService_getSupportedServiceNames() ); + // SequenceOutputStreamService + writeInfo( pKey, SequenceOutputStreamService_getImplementationName(), SequenceOutputStreamService_getSupportedServiceNames() ); } catch (registry::InvalidRegistryException &) @@ -208,6 +213,13 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL com SequenceInputStreamService_createInstance, SequenceInputStreamService_getSupportedServiceNames() ); } + else if ( SequenceOutputStreamService_getImplementationName().equalsAsciiL( pImplName, nImplNameLen ) ) + { + xFactory = ::cppu::createSingleFactory( xMSF, + SequenceOutputStreamService_getImplementationName(), + SequenceOutputStreamService_createInstance, + SequenceOutputStreamService_getSupportedServiceNames() ); + } if( xFactory.is()) { diff -urNpw @comphelper/source/streaming/makefile.mk comphelper/source/streaming/makefile.mk --- @comphelper/source/streaming/makefile.mk 2007-06-27 00:11:08.000000000 +0800 +++ comphelper/source/streaming/makefile.mk 2007-09-11 13:39:14.000000000 +0800 @@ -50,6 +50,7 @@ SLOFILES= $(SLO)$/basicio.obj \ $(SLO)$/oslfile2streamwrap.obj \ $(SLO)$/seqstream.obj \ $(SLO)$/seqinputstreamserv.obj \ + $(SLO)$/seqoutputstreamserv.obj \ $(SLO)$/streamsection.obj \ $(SLO)$/seekableinput.obj \ $(SLO)$/otransactedfilestream.obj \ diff -urNpw @comphelper/source/streaming/seqoutputstreamserv.cxx comphelper/source/streaming/seqoutputstreamserv.cxx --- @comphelper/source/streaming/seqoutputstreamserv.cxx 1970-01-01 08:00:00.000000000 +0800 +++ comphelper/source/streaming/seqoutputstreamserv.cxx 2007-09-13 11:03:28.000000000 +0800 @@ -0,0 +1,175 @@ +/************************************************************************* +* +* OpenOffice.org - a multi-platform office productivity suite +* +* $RCSfile: seqinputstreamserv.cxx,v $ +* +* $Revision: 1.2 $ +* +* last change: $Author: hr $ $Date: 2007/06/26 16:11:17 $ +* +* The Contents of this file are made available subject to +* the terms of GNU Lesser General Public License Version 2.1. +* +* +* GNU Lesser General Public License Version 2.1 +* ============================================= +* Copyright 2005 by Sun Microsystems, Inc. +* 901 San Antonio Road, Palo Alto, CA 94303, USA +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License version 2.1, as published by the Free Software Foundation. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +* +************************************************************************/ + +#include "precompiled_comphelper.hxx" + +#include <sal/config.h> +#include <osl/mutex.hxx> +#include <cppuhelper/implementationentry.hxx> +#include <cppuhelper/implbase2.hxx> +#include <comphelper/seqstream.hxx> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/io/XSequenceOutputStream.hpp> + +using namespace ::com::sun::star; + +::rtl::OUString SAL_CALL SequenceOutputStreamService_getImplementationName(); +uno::Sequence< ::rtl::OUString > SAL_CALL SequenceOutputStreamService_getSupportedServiceNames(); +uno::Reference< uno::XInterface > SAL_CALL SequenceOutputStreamService_createInstance() SAL_THROW( (uno::Exception ) ); + + +namespace { + +class SequenceOutputStreamService: +public ::cppu::WeakImplHelper2 < lang::XServiceInfo, io::XOutputStream> +{ +public: + explicit SequenceOutputStreamService(); + + // ::com::sun::star::lang::XServiceInfo: + virtual ::rtl::OUString SAL_CALL getImplementationName() throw ( uno::RuntimeException ); + virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString & ServiceName ) throw ( uno::RuntimeException ); + virtual uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw ( uno::RuntimeException ); + + // ::com::sun::star::io::XOutputStream: + virtual void SAL_CALL writeBytes( const uno::Sequence< ::sal_Int8 > & aData ) throw ( io::NotConnectedException, io::BufferSizeExceededException, io::IOException, uno::RuntimeException ); + virtual void SAL_CALL flush() throw ( uno::RuntimeException, io::NotConnectedException, io::BufferSizeExceededException, io::IOException ); + virtual void SAL_CALL closeOutput() throw ( uno::RuntimeException, io::NotConnectedException, io::BufferSizeExceededException, io::IOException ); + + // ::com::sun::star::io::XSequenceOutputStream: + virtual uno::Sequence< ::sal_Int8 > SAL_CALL getWrittenBytes( ) throw ( io::NotConnectedException, io::IOException, uno::RuntimeException); + +private: + SequenceOutputStreamService( SequenceOutputStreamService & ); //not defined + void operator =( SequenceOutputStreamService & ); //not defined + + virtual ~SequenceOutputStreamService() {}; + + + ::osl::Mutex m_aMutex; + uno::Reference< io::XOutputStream > m_xOutputStream; + uno::Sequence< ::sal_Int8 > m_aSequence; +}; + +SequenceOutputStreamService::SequenceOutputStreamService() +{} + +// com.sun.star.uno.XServiceInfo: +::rtl::OUString SAL_CALL SequenceOutputStreamService::getImplementationName() throw ( uno::RuntimeException ) +{ + return SequenceOutputStreamService_getImplementationName(); +} + +::sal_Bool SAL_CALL SequenceOutputStreamService::supportsService( ::rtl::OUString const & serviceName ) throw ( uno::RuntimeException ) +{ + uno::Sequence< ::rtl::OUString > serviceNames = SequenceOutputStreamService_getSupportedServiceNames(); + for ( ::sal_Int32 i = 0; i < serviceNames.getLength(); ++i ) { + if ( serviceNames[i] == serviceName ) + return sal_True; + } + return sal_False; +} + +uno::Sequence< ::rtl::OUString > SAL_CALL SequenceOutputStreamService::getSupportedServiceNames() throw ( uno::RuntimeException ) +{ + return SequenceOutputStreamService_getSupportedServiceNames(); +} + +// ::com::sun::star::io::XOutputStream: +void SAL_CALL SequenceOutputStreamService::writeBytes( const uno::Sequence< ::sal_Int8 > & aData ) throw ( uno::RuntimeException, io::NotConnectedException, io::BufferSizeExceededException, io::IOException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if ( !m_xOutputStream.is() ) + throw io::NotConnectedException(); + + m_xOutputStream->writeBytes( aData ); + m_aSequence = aData; +} + +void SAL_CALL SequenceOutputStreamService::flush() throw ( uno::RuntimeException, io::NotConnectedException, io::BufferSizeExceededException, io::IOException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if ( !m_xOutputStream.is() ) + throw io::NotConnectedException(); + + m_xOutputStream->flush(); +}; + +void SAL_CALL SequenceOutputStreamService::closeOutput() throw ( uno::RuntimeException, io::NotConnectedException, io::BufferSizeExceededException, io::IOException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if ( !m_xOutputStream.is() ) + throw io::NotConnectedException(); + + m_xOutputStream->closeOutput(); + m_xOutputStream = uno::Reference< io::XOutputStream >(); +} + +// ::com::sun::star::io::XSequenceOutputStream: +uno::Sequence< ::sal_Int8 > SAL_CALL SequenceOutputStreamService::getWrittenBytes() throw ( io::NotConnectedException, io::IOException, uno::RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if ( !m_xOutputStream.is() ) + throw io::NotConnectedException(); + + m_xOutputStream->flush(); + return m_aSequence; +} + +} // anonymous namespace + +::rtl::OUString SAL_CALL SequenceOutputStreamService_getImplementationName() { + return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.comp.SequenceOutputStreamService" ) ); +} + +uno::Sequence< ::rtl::OUString > SAL_CALL SequenceOutputStreamService_getSupportedServiceNames() +{ + uno::Sequence< ::rtl::OUString > s( 1 ); + s[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.io.SequenceOutputStream" ) ); + return s; +} + +uno::Reference< uno::XInterface > SAL_CALL SequenceOutputStreamService_createInstance() + SAL_THROW( (uno::Exception ) ) +{ + return static_cast< ::cppu::OWeakObject * >( new SequenceOutputStreamService() ); +} + + + + + diff -urNpw @comphelper/source/streaming/seqstream.cxx comphelper/source/streaming/seqstream.cxx --- @comphelper/source/streaming/seqstream.cxx 2006-09-18 01:21:22.000000000 +0800 +++ comphelper/source/streaming/seqstream.cxx 2007-09-12 10:43:52.000000000 +0800 @@ -234,7 +234,8 @@ void SAL_CALL OSequenceOutputStream::flu if (!m_bConnected) throw NotConnectedException(); - // nothing to do here + // cut the sequence to the real size + m_rSequence.realloc(m_nSize); }
build -- version: 1.157 ============= Building project comphelper ============= /cygdrive/g/OOo/SRC680_m225/comphelper/inc ------------- /cygdrive/g/OOo/SRC680_m225/comphelper/source/compare ------------- /cygdrive/g/OOo/SRC680_m225/comphelper/source/container ------------- /cygdrive/g/OOo/SRC680_m225/comphelper/source/eventattachermgr ------------- /cygdrive/g/OOo/SRC680_m225/comphelper/source/misc ------------------------------ Making: ../../wntmsci10.pro/slo/facreg.obj guw.exe /cygdrive/c/PROGRA~1/MICROS~1.NET/Vc7/bin/cl.exe -Zm500 -Zc:forScope -GR -c -nologo -Gs -Gy -Ob1 -Oxs -Oy- -Gd -I. -I../../wntmsci10.pro/inc/misc -I../inc -I../../inc/pch -I../../inc -I../../WIN/inc -I../../wntmsci10.pro/inc -I. -I/cygdrive/g/OOo/SRC680_m225/solver/680/wntmsci10.pro/inc/stl -I/cygdrive/g/OOo/SRC680_m225/solver/680/wntmsci10.pro/inc/external -I/cygdrive/g/OOo/SRC680_m225/solver/680/wntmsci10.pro/inc -I/cygdrive/g/OOo/SRC680_m225/solenv/wntmsci10/inc -I/cygdrive/g/OOo/SRC680_m225/solenv/inc -I/cygdrive/g/OOo/SRC680_m225/res -I/cygdrive/g/OOo/SRC680_m225/solver/680/wntmsci10.pro/inc/stl -I/cygdrive/d/OOEnv/J2SDK1~1.2_0/include/win32 -I/cygdrive/d/OOEnv/J2SDK1~1.2_0/include -I/cygdrive/d/OOEnv/PSDK/include -I/cygdrive/c/PROGRA~1/MICROS~1.NET/Vc7/include -I/cygdrive/d/OOEnv/DXSDK2~1/include -I/cygdrive/d/OOEnv/DXSDK2~1/include -I/cygdrive/g/OOo/SRC680_m225/solver/680/wntmsci10.pro/inc/offuh -I. -I../../res -I. -Wall -wd4061 -wd4063 -wd4127 -wd4191 -wd4217 -wd4250 -wd4251 -wd4275 -wd4290 -wd4292 -wd4294 -wd4344 -wd4347 -wd4355 -wd4503 -wd4511 -wd4512 -wd4514 -wd4611 -wd4619 -wd4625 -wd4626 -wd4640 -wd4675 -wd4686 -wd4710 -wd4711 -wd4786 -wd4800 -wd4820 -DWNT -DWNT -DNT351 -DMSC -DM1310 -DINTEL -D_X86_=1 -DFULL_DESK -DSTLPORT_VERSION=400 -DWINVER=0x400 -D_WIN32_IE=0x400 -D_MT -DCPPU_ENV=msci -DSUPD=680 -DPRODUCT -DNDEBUG -DPRODUCT_FULL -DOSL_DEBUG_LEVEL=0 -DOPTIMIZE -DCUI -DSOLAR_JAVA -DSRC680=SRC680 -DCOMPHELPER_DLLIMPLEMENTATION -DSHAREDLIB -D_DLL_ -DWIN32 -D_MT -D_DLL -DWIN32 -D_MT -D_DLL -GX -DEXCEPTIONS_ON -Fo../../wntmsci10.pro/slo/facreg.obj /cygdrive/g/OOo/SRC680_m225/comphelper/source/misc/facreg.cxx guw.exe /cygdrive/c/PROGRA~1/MICROS~1.NET/Vc7/bin/cl.exe @/tmp/mkRwdSiV facreg.cxx g:\OOo\SRC680_m225\comphelper\source\misc\facreg.cxx(221) : error C2664: 'cppu::createSingleFactory' : cannot convert parameter 3 from 'com::sun::star::uno::Reference<interface_type> (void) throw(com::sun::star::uno::Exception)' to 'cppu::ComponentInstantiation' with [ interface_type=com::sun::star::uno::XInterface ] None of the functions with this name in scope match the target type dmake: Error code 2, while making '../../wntmsci10.pro/slo/facreg.obj' ---* tg_merge.mk *--- ERROR: Error 65280 occurred while making /cygdrive/g/OOo/SRC680_m225/comphelper/source/misc
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]