diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-03-19 14:26:15 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-03-20 07:45:49 +0100 |
commit | 9bac723400d3007c771f8a780a92d40bdaf4b3c1 (patch) | |
tree | 2e3f78f5adea16745d8a6395b15cda70136ee53a | |
parent | 70d2fd4823353550a0e7ffd61585ec1a8a51e907 (diff) |
loplugin:useuniqueptr in Sprite
Change-Id: I55eb8f931cdfd1898ff5a74868dc97f31ce1ae7c
Reviewed-on: https://gerrit.libreoffice.org/51551
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | filter/source/flash/swfwriter.cxx | 2 | ||||
-rw-r--r-- | filter/source/flash/swfwriter.hxx | 4 | ||||
-rw-r--r-- | filter/source/flash/swfwriter2.cxx | 13 |
3 files changed, 7 insertions, 12 deletions
diff --git a/filter/source/flash/swfwriter.cxx b/filter/source/flash/swfwriter.cxx index 4d3921158e68..366b156eb7f6 100644 --- a/filter/source/flash/swfwriter.cxx +++ b/filter/source/flash/swfwriter.cxx @@ -248,7 +248,7 @@ void Writer::endTag() if( mpSprite && ( (nTag == TAG_END) || (nTag == TAG_SHOWFRAME) || (nTag == TAG_DOACTION) || (nTag == TAG_STARTSOUND) || (nTag == TAG_PLACEOBJECT) || (nTag == TAG_PLACEOBJECT2) || (nTag == TAG_REMOVEOBJECT2) || (nTag == TAG_FRAMELABEL) ) ) { - mpSprite->addTag( mpTag.release() ); + mpSprite->addTag( std::move(mpTag) ); } else { diff --git a/filter/source/flash/swfwriter.hxx b/filter/source/flash/swfwriter.hxx index 34982a1c588a..61972b30b9d3 100644 --- a/filter/source/flash/swfwriter.hxx +++ b/filter/source/flash/swfwriter.hxx @@ -196,10 +196,10 @@ public: ~Sprite(); void write( SvStream& out ); - void addTag( Tag* pNewTag ); + void addTag( std::unique_ptr<Tag> pNewTag ); private: - std::vector< Tag* > maTags; + std::vector< std::unique_ptr<Tag> > maTags; sal_uInt16 mnId; sal_uInt32 mnFrames; }; diff --git a/filter/source/flash/swfwriter2.cxx b/filter/source/flash/swfwriter2.cxx index 85df61b7bd43..512e34654753 100644 --- a/filter/source/flash/swfwriter2.cxx +++ b/filter/source/flash/swfwriter2.cxx @@ -334,8 +334,6 @@ Sprite::Sprite( sal_uInt16 nId ) Sprite::~Sprite() { - for (auto const& tag : maTags) - delete tag; } @@ -358,15 +356,12 @@ void Sprite::write( SvStream& out ) } -void Sprite::addTag( Tag* pNewTag ) +void Sprite::addTag( std::unique_ptr<Tag> pNewTag ) { - if( pNewTag ) - { - if( pNewTag->getTagId() == TAG_SHOWFRAME ) - mnFrames++; + if( pNewTag->getTagId() == TAG_SHOWFRAME ) + mnFrames++; - maTags.push_back( pNewTag ); - } + maTags.push_back( std::move(pNewTag) ); } |