summaryrefslogtreecommitdiff
path: root/io/source
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-01-16 14:15:13 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-01-17 08:34:42 +0000
commit7a60e90ef05c84923f83882efc01c33fef1ed305 (patch)
tree4c49f1ab14fda2a79e0d8efdb731d4d6fe924eba /io/source
parenta9367c1b39600d5a5e2d0067113f06ad59cc37a1 (diff)
new loplugin: useuniqueptr: helpcompiler..io
Change-Id: I6b394163c144e6b5540cb160abb613d56fe327de Reviewed-on: https://gerrit.libreoffice.org/33165 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'io/source')
-rw-r--r--io/source/stm/omark.cxx12
-rw-r--r--io/source/stm/opipe.cxx21
2 files changed, 10 insertions, 23 deletions
diff --git a/io/source/stm/omark.cxx b/io/source/stm/omark.cxx
index 9cb1fa402001..31d07604cbf0 100644
--- a/io/source/stm/omark.cxx
+++ b/io/source/stm/omark.cxx
@@ -19,6 +19,7 @@
#include <map>
+#include <memory>
#include <vector>
#include <com/sun/star/io/XMarkableStream.hpp>
@@ -75,7 +76,6 @@ class OMarkableOutputStream :
{
public:
OMarkableOutputStream( );
- virtual ~OMarkableOutputStream() override;
public: // XOutputStream
virtual void SAL_CALL writeBytes(const Sequence< sal_Int8 >& aData)
@@ -138,7 +138,7 @@ private:
Reference< XOutputStream > m_output;
bool m_bValidStream;
- MemRingBuffer *m_pBuffer;
+ std::unique_ptr<MemRingBuffer> m_pBuffer;
map<sal_Int32,sal_Int32,less< sal_Int32 > > m_mapMarks;
sal_Int32 m_nCurrentPos;
sal_Int32 m_nCurrentMark;
@@ -148,18 +148,12 @@ private:
OMarkableOutputStream::OMarkableOutputStream( )
: m_bValidStream(false)
+ , m_pBuffer( new MemRingBuffer )
, m_nCurrentPos(0)
, m_nCurrentMark(0)
{
- m_pBuffer = new MemRingBuffer;
-}
-
-OMarkableOutputStream::~OMarkableOutputStream()
-{
- delete m_pBuffer;
}
-
// XOutputStream
void OMarkableOutputStream::writeBytes(const Sequence< sal_Int8 >& aData)
throw ( NotConnectedException,
diff --git a/io/source/stm/opipe.cxx b/io/source/stm/opipe.cxx
index be0905a08786..4d70e6709ad3 100644
--- a/io/source/stm/opipe.cxx
+++ b/io/source/stm/opipe.cxx
@@ -34,6 +34,7 @@
#include <osl/mutex.hxx>
#include <limits>
+#include <memory>
#include <string.h>
using namespace ::osl;
@@ -55,7 +56,6 @@ class OPipeImpl :
{
public:
OPipeImpl( );
- virtual ~OPipeImpl() override;
public: // XInputStream
virtual sal_Int32 SAL_CALL readBytes(Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead)
@@ -118,24 +118,18 @@ private:
osl::Condition m_conditionBytesAvail;
Mutex m_mutexAccess;
- MemFIFO *m_pFIFO;
+ std::unique_ptr<MemFIFO> m_pFIFO;
};
OPipeImpl::OPipeImpl()
+ : m_nBytesToSkip(0 )
+ , m_bOutputStreamClosed(false )
+ , m_bInputStreamClosed( false )
+ , m_pFIFO( new MemFIFO )
{
- m_nBytesToSkip = 0;
-
- m_bOutputStreamClosed = false;
- m_bInputStreamClosed = false;
-
- m_pFIFO = new MemFIFO;
}
-OPipeImpl::~OPipeImpl()
-{
- delete m_pFIFO;
-}
sal_Int32 OPipeImpl::readBytes(Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead)
@@ -261,8 +255,7 @@ void OPipeImpl::closeInput()
m_bInputStreamClosed = true;
- delete m_pFIFO;
- m_pFIFO = nullptr;
+ m_pFIFO.reset();
// readBytes may throw an exception
m_conditionBytesAvail.set();