diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-05-03 15:10:21 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-05-07 08:32:41 +0200 |
commit | d655a8d2455c75921eba7a4431fa3d71048e8129 (patch) | |
tree | ff2f9de537a9cdf71abc964ce820c662e5281170 /filter | |
parent | 945642c28971efc89d3bbc5e474814b19ba2a76c (diff) |
loplugin:useuniqueptr in FlashExporter
Change-Id: Ie03889d482bc7504db2e35f9ee667157f18bcc3a
Reviewed-on: https://gerrit.libreoffice.org/53874
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'filter')
-rw-r--r-- | filter/source/flash/swfexporter.cxx | 15 | ||||
-rw-r--r-- | filter/source/flash/swfexporter.hxx | 3 |
2 files changed, 8 insertions, 10 deletions
diff --git a/filter/source/flash/swfexporter.cxx b/filter/source/flash/swfexporter.cxx index 2b9d8acd675b..185a382b5ba3 100644 --- a/filter/source/flash/swfexporter.cxx +++ b/filter/source/flash/swfexporter.cxx @@ -102,9 +102,7 @@ FlashExporter::~FlashExporter() void FlashExporter::Flush() { - delete mpWriter; - mpWriter = nullptr; - + mpWriter.reset(); maPagesMap.clear(); } @@ -148,8 +146,7 @@ bool FlashExporter::exportAll( const Reference< XComponent >& xDoc, Reference< X sal_Int32 nOutputWidth = 14400; sal_Int32 nOutputHeight = (nOutputWidth * mnDocHeight ) / mnDocWidth; - delete mpWriter; - mpWriter = new Writer( nOutputWidth, nOutputHeight, mnDocWidth, mnDocHeight, mnJPEGcompressMode ); + mpWriter.reset(new Writer( nOutputWidth, nOutputHeight, mnDocWidth, mnDocHeight, mnJPEGcompressMode )); } catch( const Exception& ) { @@ -264,12 +261,12 @@ bool FlashExporter::exportSlides( const Reference< XDrawPage >& xDrawPage, Refer try { - if( nullptr == mpWriter ) + if( !mpWriter ) { xPropSet->getPropertyValue( "Width" ) >>= mnDocWidth; xPropSet->getPropertyValue( "Height" ) >>= mnDocHeight; - mpWriter = new Writer( 14400, 10800, mnDocWidth, mnDocHeight, mnJPEGcompressMode ); + mpWriter.reset(new Writer( 14400, 10800, mnDocWidth, mnDocHeight, mnJPEGcompressMode )); } if( mbPresentation ) @@ -298,12 +295,12 @@ sal_uInt16 FlashExporter::exportBackgrounds( const Reference< XDrawPage >& xDraw if( !xDrawPage.is() || !xPropSet.is() ) return 0; - if( nullptr == mpWriter ) + if( !mpWriter ) { xPropSet->getPropertyValue( "Width" ) >>= mnDocWidth; xPropSet->getPropertyValue( "Height" ) >>= mnDocHeight; - mpWriter = new Writer( 14400, 10800, mnDocWidth, mnDocHeight, mnJPEGcompressMode ); + mpWriter.reset(new Writer( 14400, 10800, mnDocWidth, mnDocHeight, mnJPEGcompressMode )); } sal_uInt16 ret = exportBackgrounds(xDrawPage, nPage, bExportObjects); diff --git a/filter/source/flash/swfexporter.hxx b/filter/source/flash/swfexporter.hxx index 8e72bd6ef33c..f39f4c6a0a0b 100644 --- a/filter/source/flash/swfexporter.hxx +++ b/filter/source/flash/swfexporter.hxx @@ -28,6 +28,7 @@ #include <vector> #include <map> +#include <memory> typedef ::std::map<BitmapChecksum, sal_uInt16> ChecksumCache; @@ -115,7 +116,7 @@ private: bool getMetaFile( css::uno::Reference< css::lang::XComponent > const &xComponent, GDIMetaFile& rMtf, bool bOnlyBackground = false, bool bExportAsJPEG = false ); - Writer* mpWriter; + std::unique_ptr<Writer> mpWriter; sal_Int32 mnDocWidth; sal_Int32 mnDocHeight; |