summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-03-23 16:35:01 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-03-27 09:54:37 +0200
commit0f87f895380833084b64145c686f0ba5993737ca (patch)
tree2c6948b33006a19310c5e5f9ae2e5cd59013ea29
parent2c4d84e93901571ead79c85aa3894ef4e10bf5af (diff)
loplugin:useuniqueptr in ScMultipleReadHeader
Change-Id: I517593a910ed5783f256722bad915be2232f290e Reviewed-on: https://gerrit.libreoffice.org/51913 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--sc/inc/rechead.hxx3
-rw-r--r--sc/source/core/tool/rechead.cxx6
2 files changed, 5 insertions, 4 deletions
diff --git a/sc/inc/rechead.hxx b/sc/inc/rechead.hxx
index 950620276fae..c6839e750b80 100644
--- a/sc/inc/rechead.hxx
+++ b/sc/inc/rechead.hxx
@@ -53,7 +53,8 @@ private:
SvStream& rStream;
std::unique_ptr<sal_uInt8[]>
pBuf;
- SvMemoryStream* pMemStream;
+ std::unique_ptr<SvMemoryStream>
+ pMemStream;
sal_uLong nEndPos;
sal_uLong nEntryEnd;
sal_uLong nTotalEnd;
diff --git a/sc/source/core/tool/rechead.cxx b/sc/source/core/tool/rechead.cxx
index 42b2b4cf6f0e..5e2262d4d8a6 100644
--- a/sc/source/core/tool/rechead.cxx
+++ b/sc/source/core/tool/rechead.cxx
@@ -41,7 +41,7 @@ ScMultipleReadHeader::ScMultipleReadHeader(SvStream& rNewStream) :
rStream.SetError( SVSTREAM_FILEFORMAT_ERROR );
// everything to 0, so BytesLeft() aborts at least
- pBuf = nullptr; pMemStream = nullptr;
+ pBuf = nullptr; pMemStream.reset();
nEntryEnd = nDataPos;
}
else
@@ -50,7 +50,7 @@ ScMultipleReadHeader::ScMultipleReadHeader(SvStream& rNewStream) :
rStream.ReadUInt32( nSizeTableLen );
pBuf.reset( new sal_uInt8[nSizeTableLen] );
rStream.ReadBytes( pBuf.get(), nSizeTableLen );
- pMemStream = new SvMemoryStream( pBuf.get(), nSizeTableLen, StreamMode::READ );
+ pMemStream.reset(new SvMemoryStream( pBuf.get(), nSizeTableLen, StreamMode::READ ));
}
nEndPos = rStream.Tell();
@@ -65,7 +65,7 @@ ScMultipleReadHeader::~ScMultipleReadHeader()
if ( rStream.GetError() == ERRCODE_NONE )
rStream.SetError( SCWARN_IMPORT_INFOLOST );
}
- delete pMemStream;
+ pMemStream.reset();
rStream.Seek(nEndPos);
}