diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-01-10 11:44:28 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-01-11 07:37:16 +0100 |
commit | b27fee9e0ebb445ce82baeade3b249807dca392b (patch) | |
tree | ec602e834d8ac02c0495d1d25e2bed30fa22bfb3 /io | |
parent | 96d9bd226215194632b6b0b7b0153f41ade1fc47 (diff) |
loplugin:useuniqueptr cppu,idlc,io,ucbhelper
Change-Id: I6d8c24fabd52b39c66ce0b88b547df7ec85dad76
Reviewed-on: https://gerrit.libreoffice.org/47725
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'io')
-rw-r--r-- | io/source/acceptor/acceptor.cxx | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/io/source/acceptor/acceptor.cxx b/io/source/acceptor/acceptor.cxx index e27b83acd290..c9449f6eb146 100644 --- a/io/source/acceptor/acceptor.cxx +++ b/io/source/acceptor/acceptor.cxx @@ -36,6 +36,7 @@ #include <services.hxx> #include "acceptor.hxx" +#include <memory> #define IMPLEMENTATION_NAME "com.sun.star.comp.io.Acceptor" #define SERVICE_NAME "com.sun.star.connection.Acceptor" @@ -65,8 +66,8 @@ namespace io_acceptor virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; private: - PipeAcceptor *m_pPipe; - SocketAcceptor *m_pSocket; + std::unique_ptr<PipeAcceptor> m_pPipe; + std::unique_ptr<SocketAcceptor> m_pSocket; Mutex m_mutex; OUString m_sLastDescription; bool m_bInAccept; @@ -87,8 +88,7 @@ namespace io_acceptor OAcceptor::~OAcceptor() { - delete m_pPipe; - delete m_pSocket; + m_pPipe.reset(); } struct BeingInAccept @@ -138,7 +138,7 @@ namespace io_acceptor aDesc.getParameter( "name")); - m_pPipe = new PipeAcceptor(aName, sConnectionDescription); + m_pPipe.reset(new PipeAcceptor(aName, sConnectionDescription)); try { @@ -148,8 +148,7 @@ namespace io_acceptor { { MutexGuard g( m_mutex ); - delete m_pPipe; - m_pPipe = nullptr; + m_pPipe.reset(); } throw; } @@ -171,8 +170,8 @@ namespace io_acceptor = aDesc.getParameter( "tcpnodelay").toInt32() != 0; - m_pSocket = new SocketAcceptor( - aHost, nPort, bTcpNoDelay, sConnectionDescription); + m_pSocket.reset(new SocketAcceptor( + aHost, nPort, bTcpNoDelay, sConnectionDescription)); try { @@ -182,8 +181,7 @@ namespace io_acceptor { { MutexGuard g( m_mutex ); - delete m_pSocket; - m_pSocket = nullptr; + m_pSocket.reset(); } throw; } |