summaryrefslogtreecommitdiff
path: root/io
diff options
context:
space:
mode:
authorNoel <noel.grandin@collabora.co.uk>2021-02-10 13:23:28 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-02-11 07:57:56 +0100
commit14cb12bde07b8becf69b648ecc6642bdccf8a7cd (patch)
treee616a44bdeb412b518e8f4fcee20f9aaeb8574e9 /io
parent5128bf29d5febceaec51854595f23ae487a0cdec (diff)
loplugin:refcounting generalise type checking
Change-Id: Ia013878ac9c2918d8eaf9aab16b291d8211e708f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110700 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'io')
-rw-r--r--io/source/acceptor/acc_pipe.cxx5
-rw-r--r--io/source/acceptor/acc_socket.cxx5
-rw-r--r--io/source/connector/connector.cxx9
3 files changed, 11 insertions, 8 deletions
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 <osl/diagnose.h>
#include <osl/mutex.hxx>
#include <cppuhelper/implbase.hxx>
+#include <rtl/ref.hxx>
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<PipeConnection> pConn(new PipeConnection( m_sConnectionDescription ));
+ rtl::Reference<PipeConnection> 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<XConnection *>(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 <osl/mutex.hxx>
#include <rtl/ustrbuf.hxx>
+#include <rtl/ref.hxx>
#include <com/sun/star/connection/XConnection.hpp>
#include <com/sun/star/connection/XConnectionBroadcaster.hpp>
#include <com/sun/star/connection/ConnectionSetupException.hpp>
@@ -316,7 +317,7 @@ namespace io_acceptor {
Reference< XConnection > SocketAcceptor::accept( )
{
- std::unique_ptr<SocketConnection> pConn(new SocketConnection( m_sConnectionDescription ));
+ rtl::Reference<SocketConnection> 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<XConnection *>(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 <cppuhelper/supportsservice.hxx>
#include <cppuhelper/unourl.hxx>
#include <rtl/malformeduriexception.hxx>
+#include <rtl/ref.hxx>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/connection/ConnectionSetupException.hpp>
@@ -80,11 +81,11 @@ Reference< XConnection > SAL_CALL OConnector::connect( const OUString& sConnecti
{
OUString aName(aDesc.getParameter("name"));
- std::unique_ptr<stoc_connector::PipeConnection> pConn(new stoc_connector::PipeConnection( sConnectionDescription ));
+ rtl::Reference<stoc_connector::PipeConnection> pConn(new stoc_connector::PipeConnection( sConnectionDescription ));
if( pConn->m_pipe.create( aName.pData, osl_Pipe_OPEN, osl::Security() ) )
{
- r.set( static_cast<XConnection *>(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<stoc_connector::SocketConnection> pConn(new stoc_connector::SocketConnection( sConnectionDescription));
+ rtl::Reference<stoc_connector::SocketConnection> 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<XConnection *>(pConn.release()) );
+ r.set( pConn.get() );
}
else
{