diff --git a/io/source/stm/opump.cxx b/io/source/stm/opump.cxx index fc751b677f95..df3e6132319d 100644 --- a/io/source/stm/opump.cxx +++ b/io/source/stm/opump.cxx @@ -263,14 +263,14 @@ void Pump::run() if( ! rInput.is() ) { - throw NotConnectedException( "no input stream set", static_cast(this) ); + throw NotConnectedException( "no input stream set", getXWeak() ); } Sequence< sal_Int8 > aData; while( rInput->readSomeBytes( aData, 65536 ) ) { if( ! rOutput.is() ) { - throw NotConnectedException( "no output stream set", static_cast(this) ); + throw NotConnectedException( "no output stream set", getXWeak() ); } rOutput->writeBytes( aData ); osl_yieldThread(); diff --git a/io/test/stm/datatest.cxx b/io/test/stm/datatest.cxx index a085bf6d7d5b..ef31f099d496 100644 --- a/io/test/stm/datatest.cxx +++ b/io/test/stm/datatest.cxx @@ -326,8 +326,7 @@ void ODataStreamTest::testSimple( const Reference < XDataInputStream > &rInput **/ Reference < XInterface > SAL_CALL ODataStreamTest_CreateInstance( const Reference < XMultiServiceFactory > & rSMgr ) throw(Exception) { - ODataStreamTest *p = new ODataStreamTest( rSMgr ); - return Reference < XInterface > ( (static_cast< OWeakObject * >(p)) ); + return getXWeak(new ODataStreamTest( rSMgr )); } Sequence ODataStreamTest_getSupportedServiceNames( int i) throw () @@ -596,8 +595,7 @@ Reference < XInterface > SAL_CALL OMyPersistObject_CreateInstance( const Reference < XMultiServiceFactory > & rSMgr ) throw(Exception) { - MyPersistObject *p = new MyPersistObject( ); - return Reference < XInterface > ( (static_cast< OWeakObject * >(p)) ); + return getXWeak(new MyPersistObject( )); } Sequence OMyPersistObject_getSupportedServiceNames( ) throw () @@ -1040,8 +1038,7 @@ void OObjectStreamTest::testObject( const Reference< XObjectOutputStream > Reference < XInterface > SAL_CALL OObjectStreamTest_CreateInstance( const Reference < XMultiServiceFactory > & rSMgr ) throw(Exception) { - OObjectStreamTest *p = new OObjectStreamTest( rSMgr ); - return Reference < XInterface > ( (static_cast< OWeakObject * >(p)) ); + return getXWeak(new OObjectStreamTest( rSMgr )); } Sequence OObjectStreamTest_getSupportedServiceNames( int i) throw () diff --git a/io/test/stm/marktest.cxx b/io/test/stm/marktest.cxx index fbfc2008214f..0dd01a7f7747 100644 --- a/io/test/stm/marktest.cxx +++ b/io/test/stm/marktest.cxx @@ -360,8 +360,7 @@ void OMarkableOutputStreamTest::testSimple( const Reference< XOutputStream > **/ Reference < XInterface > SAL_CALL OMarkableOutputStreamTest_CreateInstance( const Reference< XMultiServiceFactory > & rSMgr ) throw(Exception) { - OMarkableOutputStreamTest *p = new OMarkableOutputStreamTest( rSMgr ); - return Reference < XInterface > ( (static_cast< OWeakObject * >(p)) ); + return getXWeak(new OMarkableOutputStreamTest( rSMgr )); } @@ -619,8 +618,7 @@ void OMarkableInputStreamTest::testSimple( const Reference< XOutputStream > **/ Reference < XInterface > SAL_CALL OMarkableInputStreamTest_CreateInstance( const Reference< XMultiServiceFactory > & rSMgr ) throw(Exception) { - OMarkableInputStreamTest *p = new OMarkableInputStreamTest( rSMgr ); - return Reference < XInterface > ( (static_cast< OWeakObject * >(p)) ); + return getXWeak(new OMarkableInputStreamTest( rSMgr )); } diff --git a/io/test/stm/pipetest.cxx b/io/test/stm/pipetest.cxx index 46637f3f245a..da5c5f20ba49 100644 --- a/io/test/stm/pipetest.cxx +++ b/io/test/stm/pipetest.cxx @@ -392,9 +392,7 @@ void OPipeTest::testMultithreading( const Reference < XInterface > &r ) **/ Reference < XInterface > SAL_CALL OPipeTest_CreateInstance( const Reference< XMultiServiceFactory> & rSMgr ) throw (Exception) { - OPipeTest *p = new OPipeTest( rSMgr ); - Reference< XInterface > x ( (static_cast< OWeakObject * >(p)) ); - return x; + return getXWeak(new OPipeTest( rSMgr )); }