diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-07-13 20:42:04 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-07-14 10:13:46 +0200 |
commit | 8e39ef66928a3e37c618d3a70a631e71266db274 (patch) | |
tree | 8cab0264e58c885ae7d78a77d90fd041bcdbe15d /filter | |
parent | d7e06e46acc2ee17101cef63e59b9f5efcbfab14 (diff) |
extend loplugin useuniqueptr to POD types
Change-Id: I6ff24f048bd8f75bf87a78b718f37b57855d4781
Reviewed-on: https://gerrit.libreoffice.org/39932
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'filter')
-rw-r--r-- | filter/source/graphicfilter/itga/itga.cxx | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/filter/source/graphicfilter/itga/itga.cxx b/filter/source/graphicfilter/itga/itga.cxx index bb16e1000626..6eaafe722932 100644 --- a/filter/source/graphicfilter/itga/itga.cxx +++ b/filter/source/graphicfilter/itga/itga.cxx @@ -83,9 +83,12 @@ private: SvStream& m_rTGA; BitmapWriteAccess* mpAcc; - TGAFileHeader* mpFileHeader; - TGAFileFooter* mpFileFooter; - TGAExtension* mpExtension; + std::unique_ptr<TGAFileHeader> + mpFileHeader; + std::unique_ptr<TGAFileFooter> + mpFileFooter; + std::unique_ptr<TGAExtension> + mpExtension; std::unique_ptr<sal_uInt32[]> mpColorMap; @@ -102,7 +105,6 @@ private: public: explicit TGAReader(SvStream &rTGA); - ~TGAReader(); bool ReadTGA(Graphic &rGraphic); }; @@ -123,14 +125,6 @@ TGAReader::TGAReader(SvStream &rTGA) { } -TGAReader::~TGAReader() -{ - delete mpFileHeader; - delete mpExtension; - delete mpFileFooter; -} - - bool TGAReader::ReadTGA(Graphic & rGraphic) { if ( m_rTGA.GetError() ) @@ -175,7 +169,7 @@ bool TGAReader::ReadTGA(Graphic & rGraphic) bool TGAReader::ImplReadHeader() { - mpFileHeader = new TGAFileHeader; + mpFileHeader.reset( new TGAFileHeader ); m_rTGA.ReadUChar( mpFileHeader->nImageIDLength ).ReadUChar( mpFileHeader->nColorMapType ).ReadUChar( mpFileHeader->nImageType ). ReadUInt16( mpFileHeader->nColorMapFirstEntryIndex ).ReadUInt16( mpFileHeader->nColorMapLength ).ReadUChar( mpFileHeader->nColorMapEntrySize ). ReadUInt16( mpFileHeader->nColorMapXOrigin ).ReadUInt16( mpFileHeader->nColorMapYOrigin ).ReadUInt16( mpFileHeader->nImageWidth ). ReadUInt16( mpFileHeader->nImageHeight ).ReadUChar( mpFileHeader->nPixelDepth ).ReadUChar( mpFileHeader->nImageDescriptor ); @@ -188,8 +182,8 @@ bool TGAReader::ImplReadHeader() mbIndexing = true; // first we want to get the version - mpFileFooter = new TGAFileFooter; // read the TGA-File-Footer to determine whether - // we got an old TGA format or the new one + mpFileFooter.reset( new TGAFileFooter ); // read the TGA-File-Footer to determine whether + // we got an old TGA format or the new one sal_uLong nCurStreamPos = m_rTGA.Tell(); m_rTGA.Seek( STREAM_SEEK_TO_END ); @@ -208,7 +202,7 @@ bool TGAReader::ImplReadHeader() mpFileFooter->nSignature[ 2 ] == (('O'<<24)|('N'<<16)|('-'<<8)|'X') && mpFileFooter->nSignature[ 3 ] == (('F'<<24)|('I'<<16)|('L'<<8)|'E') ) { - mpExtension = new TGAExtension; + mpExtension.reset( new TGAExtension ); m_rTGA.Seek( mpFileFooter->nExtensionFileOffset ); m_rTGA.ReadUInt16( mpExtension->nExtensionSize ); |