From 14cb12bde07b8becf69b648ecc6642bdccf8a7cd Mon Sep 17 00:00:00 2001 From: Noel Date: Wed, 10 Feb 2021 13:23:28 +0200 Subject: loplugin:refcounting generalise type checking Change-Id: Ia013878ac9c2918d8eaf9aab16b291d8211e708f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110700 Tested-by: Jenkins Reviewed-by: Noel Grandin --- io/source/acceptor/acc_pipe.cxx | 5 +++-- io/source/acceptor/acc_socket.cxx | 5 +++-- io/source/connector/connector.cxx | 9 +++++---- 3 files changed, 11 insertions(+), 8 deletions(-) (limited to 'io') diff --git a/io/source/acceptor/acc_pipe.cxx b/io/source/acceptor/acc_pipe.cxx index 69f1cad79206..0718834e3115 100644 --- a/io/source/acceptor/acc_pipe.cxx +++ b/io/source/acceptor/acc_pipe.cxx @@ -26,6 +26,7 @@ #include #include #include +#include using namespace ::osl; using namespace ::cppu; @@ -151,7 +152,7 @@ namespace io_acceptor OUString error = "io.acceptor: pipe already closed" + m_sPipeName; throw ConnectionSetupException( error ); } - std::unique_ptr pConn(new PipeConnection( m_sConnectionDescription )); + rtl::Reference pConn(new PipeConnection( m_sConnectionDescription )); oslPipeError status = pipe.accept( pConn->m_pipe ); @@ -162,7 +163,7 @@ namespace io_acceptor } else if( osl_Pipe_E_None == status ) { - return Reference < XConnection > ( static_cast(pConn.release()) ); + return pConn.get(); } else { diff --git a/io/source/acceptor/acc_socket.cxx b/io/source/acceptor/acc_socket.cxx index 9700cd566bb8..57c8a179885b 100644 --- a/io/source/acceptor/acc_socket.cxx +++ b/io/source/acceptor/acc_socket.cxx @@ -23,6 +23,7 @@ #include #include +#include #include #include #include @@ -316,7 +317,7 @@ namespace io_acceptor { Reference< XConnection > SocketAcceptor::accept( ) { - std::unique_ptr pConn(new SocketConnection( m_sConnectionDescription )); + rtl::Reference pConn(new SocketConnection( m_sConnectionDescription )); if( m_socket.acceptConnection( pConn->m_socket )!= osl_Socket_Ok ) { @@ -342,7 +343,7 @@ namespace io_acceptor { sizeof( nTcpNoDelay ) , osl_Socket_LevelTcp ); } - return Reference < XConnection > ( static_cast(pConn.release()) ); + return pConn.get(); } void SocketAcceptor::stopAccepting() diff --git a/io/source/connector/connector.cxx b/io/source/connector/connector.cxx index c6f01e130814..6072afb9dbff 100644 --- a/io/source/connector/connector.cxx +++ b/io/source/connector/connector.cxx @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -80,11 +81,11 @@ Reference< XConnection > SAL_CALL OConnector::connect( const OUString& sConnecti { OUString aName(aDesc.getParameter("name")); - std::unique_ptr pConn(new stoc_connector::PipeConnection( sConnectionDescription )); + rtl::Reference pConn(new stoc_connector::PipeConnection( sConnectionDescription )); if( pConn->m_pipe.create( aName.pData, osl_Pipe_OPEN, osl::Security() ) ) { - r.set( static_cast(pConn.release()) ); + r.set( pConn.get() ); } else { @@ -108,7 +109,7 @@ Reference< XConnection > SAL_CALL OConnector::connect( const OUString& sConnecti bool bTcpNoDelay = aDesc.getParameter("tcpnodelay").toInt32() != 0; - std::unique_ptr pConn(new stoc_connector::SocketConnection( sConnectionDescription)); + rtl::Reference pConn(new stoc_connector::SocketConnection( sConnectionDescription)); SocketAddr AddrTarget( aHost.pData, nPort ); if(pConn->m_socket.connect(AddrTarget) != osl_Socket_Ok) @@ -127,7 +128,7 @@ Reference< XConnection > SAL_CALL OConnector::connect( const OUString& sConnecti sizeof( nTcpNoDelay ) , osl_Socket_LevelTcp ); } pConn->completeConnectionString(); - r.set( static_cast(pConn.release()) ); + r.set( pConn.get() ); } else { -- cgit