summaryrefslogtreecommitdiff
path: root/stoc/test
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2023-04-23 20:14:54 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2023-06-18 11:10:20 +0200
commit0c2b2c9babfd781e0d9d68bb2a14a045b0c6ec4c (patch)
treefef431f10266f60a7941b71315b66932a29e568f /stoc/test
parent627984834cffbe6d1afce8b2be91277c221525b8 (diff)
Use getXWeak in stoc
Change-Id: Icd694eeae002ab28cbd06ba3097e9039e299de3b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150871 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'stoc/test')
-rw-r--r--stoc/test/javavm/jvm_interaction/interactionhandler.cxx5
-rw-r--r--stoc/test/registry_tdprovider/testregistrytdprovider.cxx2
-rw-r--r--stoc/test/tdmanager/testtdmanager.cxx2
-rw-r--r--stoc/test/testproxyfac.cxx10
4 files changed, 9 insertions, 10 deletions
diff --git a/stoc/test/javavm/jvm_interaction/interactionhandler.cxx b/stoc/test/javavm/jvm_interaction/interactionhandler.cxx
index b82ef594afda..f1c4baf863cf 100644
--- a/stoc/test/javavm/jvm_interaction/interactionhandler.cxx
+++ b/stoc/test/javavm/jvm_interaction/interactionhandler.cxx
@@ -75,8 +75,7 @@ Any SAL_CALL Context::getValueByName( const OUString& Name) throw (RuntimeExcept
Any retVal;
if( Name.equals( INTERACTION_HANDLER_NAME))
{
- Reference<XInteractionHandler> handler( static_cast<XWeak*>(new InteractionHandler()),
- UNO_QUERY);
+ Reference<XInteractionHandler> handler(new InteractionHandler());
retVal <<= handler;
}
return retVal;
@@ -119,7 +118,7 @@ void SAL_CALL InteractionHandler::handle( const Reference< XInteractionRequest >
sal_Bool test1(const Reference< XMultiServiceFactory > & xMgr )
{
sal_Bool retVal= sal_True;
- setCurrentContext( Reference<XCurrentContext>( static_cast<XWeak*>(new Context()), UNO_QUERY));
+ setCurrentContext(Reference<XCurrentContext>(new Context());
OUString sVMService("com.sun.star.java.JavaVirtualMachine");
Reference<XInterface> xXInt= xMgr->createInstance(sVMService);
diff --git a/stoc/test/registry_tdprovider/testregistrytdprovider.cxx b/stoc/test/registry_tdprovider/testregistrytdprovider.cxx
index 879859b92e27..46e3d0998b01 100644
--- a/stoc/test/registry_tdprovider/testregistrytdprovider.cxx
+++ b/stoc/test/registry_tdprovider/testregistrytdprovider.cxx
@@ -741,7 +741,7 @@ css::uno::Reference< css::uno::XInterface > Service::createInstance(
css::uno::Reference< css::uno::XComponentContext > const & context)
throw (css::uno::Exception)
{
- return static_cast< cppu::OWeakObject * >(new Service(context));
+ return cppu::getXWeak(new Service(context));
}
extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(char const * implName,
diff --git a/stoc/test/tdmanager/testtdmanager.cxx b/stoc/test/tdmanager/testtdmanager.cxx
index e466904b4314..7c9971d6aa64 100644
--- a/stoc/test/tdmanager/testtdmanager.cxx
+++ b/stoc/test/tdmanager/testtdmanager.cxx
@@ -275,7 +275,7 @@ css::uno::Reference< css::uno::XInterface > Service::createInstance(
css::uno::Reference< css::uno::XComponentContext > const & context)
throw (css::uno::Exception)
{
- return static_cast< cppu::OWeakObject * >(new Service(context));
+ return cppu::getXWeak(new Service(context));
}
extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(char const * implName,
diff --git a/stoc/test/testproxyfac.cxx b/stoc/test/testproxyfac.cxx
index 2388ac078b53..befc67ae8ee3 100644
--- a/stoc/test/testproxyfac.cxx
+++ b/stoc/test/testproxyfac.cxx
@@ -92,7 +92,7 @@ Any TargetObject::queryInterface( Type const & type )
return ret;
throw lang::DisposedException(
OUString( "my test exception" ),
- static_cast< OWeakObject * >(this) );
+ getXWeak() );
}
int TargetObject::s_obj = 0;
@@ -146,7 +146,7 @@ Reference< XInterface > TestMaster::create(
Reference< reflection::XProxyFactory > const & xProxyFac )
{
TestMaster * that = new TestMaster;
- Reference< XInterface > xRet( static_cast< OWeakObject * >( that ) );
+ Reference< XInterface > xRet( getXWeak( that ) );
{
Reference< XAggregation > xAgg( xProxyFac->createProxy( xTarget ) );
// ownership take over
@@ -162,7 +162,7 @@ Reference< XInterface > TestMaster::create(
Reference< reflection::XProxyFactory > const & xProxyFac )
{
return create(
- static_cast< OWeakObject * >( new TargetObject ), xProxyFac );
+ getXWeak( new TargetObject ), xProxyFac );
}
@@ -268,7 +268,7 @@ SAL_IMPLEMENT_MAIN()
Reference< XAggregation > x(
xProxyFac->createProxy(
- static_cast< OWeakObject * >( new TargetObject ) ) );
+ getXWeak( new TargetObject ) ) );
// no call
{
@@ -303,7 +303,7 @@ SAL_IMPLEMENT_MAIN()
test_proxyfac(
xProxyFac->createProxy(
- static_cast< OWeakObject * >( new TargetObject ) ),
+ getXWeak( new TargetObject ) ),
OUString( "target" ),
xProxyFac );
uno_dumpEnvironment( stdout, cpp_env.get(), 0 );