summaryrefslogtreecommitdiff
path: root/sot
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-01-18 13:57:55 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-01-19 09:35:21 +0000
commit0415cb335b953b9c10075fa524d7707db4aa55e5 (patch)
treef714106565c6c58a4711b21f966ecc09c8b83157 /sot
parentc3e6d12301b42a44bd0d4584005686e324533b60 (diff)
new loplugin: useuniqueptr: sot..tools
Change-Id: Ided435d016ae28e7c3f2726e41eedd981572ae10 Reviewed-on: https://gerrit.libreoffice.org/33263 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sot')
-rw-r--r--sot/source/sdstor/stgcache.cxx3
-rw-r--r--sot/source/sdstor/stgcache.hxx5
-rw-r--r--sot/source/sdstor/stgole.cxx3
-rw-r--r--sot/source/sdstor/stgole.hxx2
-rw-r--r--sot/source/sdstor/stgstrms.cxx7
-rw-r--r--sot/source/sdstor/stgstrms.hxx2
6 files changed, 10 insertions, 12 deletions
diff --git a/sot/source/sdstor/stgcache.cxx b/sot/source/sdstor/stgcache.cxx
index 2ee2c28ede39..409e4729a874 100644
--- a/sot/source/sdstor/stgcache.cxx
+++ b/sot/source/sdstor/stgcache.cxx
@@ -44,12 +44,11 @@ StgPage::StgPage( short nSize, sal_Int32 nPage )
OSL_ENSURE( mnSize >= 512, "Unexpected page size is provided!" );
// We will write this data to a permanent file later
// best to clear if first.
- memset( mpData, 0, mnSize );
+ memset( mpData.get(), 0, mnSize );
}
StgPage::~StgPage()
{
- delete [] mpData;
}
rtl::Reference< StgPage > StgPage::Create( short nData, sal_Int32 nPage )
diff --git a/sot/source/sdstor/stgcache.hxx b/sot/source/sdstor/stgcache.hxx
index 5a1ec3809607..59649023cc0c 100644
--- a/sot/source/sdstor/stgcache.hxx
+++ b/sot/source/sdstor/stgcache.hxx
@@ -96,7 +96,8 @@ public:
class StgPage : public salhelper::SimpleReferenceObject
{
const sal_Int32 mnPage; // page index
- sal_uInt8* mpData; // nSize bytes
+ std::unique_ptr<sal_uInt8>
+ mpData; // nSize bytes
short mnSize; // size of this page
StgPage( short nData, sal_Int32 nPage );
virtual ~StgPage() override;
@@ -106,7 +107,7 @@ public:
static rtl::Reference< StgPage > Create( short nData, sal_Int32 nPage );
sal_Int32 GetPage() { return mnPage; }
- void* GetData() { return mpData; }
+ void* GetData() { return mpData.get(); }
short GetSize() { return mnSize; }
public:
diff --git a/sot/source/sdstor/stgole.cxx b/sot/source/sdstor/stgole.cxx
index 9adfcac5fbd4..acec45204eac 100644
--- a/sot/source/sdstor/stgole.cxx
+++ b/sot/source/sdstor/stgole.cxx
@@ -36,7 +36,7 @@ StgInternalStream::StgInternalStream( BaseStorage& rStg, const OUString& rName,
StreamMode nMode = bWr
? StreamMode::WRITE | StreamMode::SHARE_DENYALL
: StreamMode::READ | StreamMode::SHARE_DENYWRITE | StreamMode::NOCREATE;
- m_pStrm = rStg.OpenStream( rName, nMode );
+ m_pStrm.reset( rStg.OpenStream( rName, nMode ) );
// set the error code right here in the stream
SetError( rStg.GetError() );
@@ -45,7 +45,6 @@ StgInternalStream::StgInternalStream( BaseStorage& rStg, const OUString& rName,
StgInternalStream::~StgInternalStream()
{
- delete m_pStrm;
}
std::size_t StgInternalStream::GetData(void* pData, std::size_t nSize)
diff --git a/sot/source/sdstor/stgole.hxx b/sot/source/sdstor/stgole.hxx
index cfe09b18ba63..0bdf50397ff6 100644
--- a/sot/source/sdstor/stgole.hxx
+++ b/sot/source/sdstor/stgole.hxx
@@ -27,7 +27,7 @@
class StgInternalStream : public SvStream
{
- BaseStorageStream* m_pStrm;
+ std::unique_ptr<BaseStorageStream> m_pStrm;
virtual std::size_t GetData(void* pData, std::size_t nSize) override;
virtual std::size_t PutData(const void* pData, std::size_t nSize) override;
virtual sal_uInt64 SeekPos( sal_uInt64 nPos ) override;
diff --git a/sot/source/sdstor/stgstrms.cxx b/sot/source/sdstor/stgstrms.cxx
index 7063a4ce99d3..3503421c341c 100644
--- a/sot/source/sdstor/stgstrms.cxx
+++ b/sot/source/sdstor/stgstrms.cxx
@@ -330,7 +330,6 @@ StgStrm::StgStrm( StgIo& r ) : m_rIo( r )
StgStrm::~StgStrm()
{
- delete m_pFat;
}
// Attach the stream to the given entry.
@@ -558,7 +557,7 @@ bool StgStrm::SetSize( sal_Int32 nBytes )
StgFATStrm::StgFATStrm( StgIo& r ) : StgStrm( r )
{
- m_pFat = new StgFAT( *this, true );
+ m_pFat.reset( new StgFAT( *this, true ) );
m_nSize = m_rIo.m_aHdr.GetFATSize() * m_nPageSize;
}
@@ -821,7 +820,7 @@ StgDataStrm::StgDataStrm( StgIo& r, StgDirEntry& p ) : StgStrm( r )
void StgDataStrm::Init( sal_Int32 nBgn, sal_Int32 nLen )
{
if ( m_rIo.m_pFAT )
- m_pFat = new StgFAT( *m_rIo.m_pFAT, true );
+ m_pFat.reset( new StgFAT( *m_rIo.m_pFAT, true ) );
OSL_ENSURE( m_pFat, "The pointer should not be empty!" );
@@ -1027,7 +1026,7 @@ StgSmallStrm::StgSmallStrm( StgIo& r, StgDirEntry& p ) : StgStrm( r )
void StgSmallStrm::Init( sal_Int32 nBgn, sal_Int32 nLen )
{
if ( m_rIo.m_pDataFAT )
- m_pFat = new StgFAT( *m_rIo.m_pDataFAT, false );
+ m_pFat.reset( new StgFAT( *m_rIo.m_pDataFAT, false ) );
m_pData = m_rIo.m_pDataStrm;
OSL_ENSURE( m_pFat && m_pData, "The pointers should not be empty!" );
diff --git a/sot/source/sdstor/stgstrms.hxx b/sot/source/sdstor/stgstrms.hxx
index e523e98a924f..9b9c41c30254 100644
--- a/sot/source/sdstor/stgstrms.hxx
+++ b/sot/source/sdstor/stgstrms.hxx
@@ -62,7 +62,7 @@ public:
class StgStrm { // base class for all streams
protected:
StgIo& m_rIo; // I/O system
- StgFAT* m_pFat; // FAT stream for allocations
+ std::unique_ptr<StgFAT> m_pFat; // FAT stream for allocations
StgDirEntry* m_pEntry; // dir entry (for ownership)
sal_Int32 m_nStart; // 1st data page
sal_Int32 m_nSize; // stream size in bytes