diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-01-15 14:34:05 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-01-17 10:16:35 +0200 |
commit | a903b9ba625b7fc09640007794d6f6a6fc6addba (patch) | |
tree | ca3f2d9a29cc756a7edbd3b830d9631a8ae4b42b | |
parent | f91c856e9be2f9a2dc15740b7cae78954d574d91 (diff) |
loplugin:useuniqueptr in GraphicFilter
Change-Id: Ib359da131c84c291504a9df210a3b222fd77bd0c
-rw-r--r-- | include/vcl/graphicfilter.hxx | 3 | ||||
-rw-r--r-- | vcl/qa/cppunit/graphicfilter/filters-test.cxx | 12 | ||||
-rw-r--r-- | vcl/source/filter/graphicfilter.cxx | 4 |
3 files changed, 10 insertions, 9 deletions
diff --git a/include/vcl/graphicfilter.hxx b/include/vcl/graphicfilter.hxx index e10afd1997d2..bc218851f412 100644 --- a/include/vcl/graphicfilter.hxx +++ b/include/vcl/graphicfilter.hxx @@ -30,6 +30,7 @@ #include <com/sun/star/uno/Sequence.h> #include <com/sun/star/beans/PropertyValue.hpp> +#include <memory> class FilterConfigCache; class SvStream; @@ -310,7 +311,7 @@ private: DECL_LINK( FilterCallback, ConvertData&, bool ); - FilterErrorEx* pErrorEx; + std::unique_ptr<FilterErrorEx> pErrorEx; bool bUseConfig; }; diff --git a/vcl/qa/cppunit/graphicfilter/filters-test.cxx b/vcl/qa/cppunit/graphicfilter/filters-test.cxx index bdfa85a403b0..a423a17081e8 100644 --- a/vcl/qa/cppunit/graphicfilter/filters-test.cxx +++ b/vcl/qa/cppunit/graphicfilter/filters-test.cxx @@ -25,11 +25,11 @@ class VclFiltersTest : public test::FiltersTest, public test::BootstrapFixture { - GraphicFilter mGraphicFilter; + std::unique_ptr<GraphicFilter> mpGraphicFilter; public: VclFiltersTest() : BootstrapFixture(true, false), - mGraphicFilter(GraphicFilter(false)) + mpGraphicFilter(new GraphicFilter(false)) {} virtual bool load(const OUString &, @@ -59,7 +59,7 @@ bool VclFiltersTest::load(const OUString &, { SvFileStream aFileStream(rURL, StreamMode::READ); Graphic aGraphic; - bool bRetval(ERRCODE_NONE == mGraphicFilter.ImportGraphic(aGraphic, rURL, aFileStream)); + bool bRetval(ERRCODE_NONE == mpGraphicFilter->ImportGraphic(aGraphic, rURL, aFileStream)); if (!bRetval) { @@ -116,15 +116,15 @@ void VclFiltersTest::checkExportImport(const OUString& aFilterShortName) aFilterData[ 2 ].Name = "Quality"; aFilterData[ 2 ].Value <<= sal_Int32(90); - sal_uInt16 aFilterType = mGraphicFilter.GetExportFormatNumberForShortName(aFilterShortName); - mGraphicFilter.ExportGraphic( aBitmap, OUString(), aStream, aFilterType, &aFilterData ); + sal_uInt16 aFilterType = mpGraphicFilter->GetExportFormatNumberForShortName(aFilterShortName); + mpGraphicFilter->ExportGraphic( aBitmap, OUString(), aStream, aFilterType, &aFilterData ); CPPUNIT_ASSERT(aStream.Tell() > 0); aStream.Seek( STREAM_SEEK_TO_BEGIN ); Graphic aLoadedGraphic; - mGraphicFilter.ImportGraphic( aLoadedGraphic, OUString(), aStream ); + mpGraphicFilter->ImportGraphic( aLoadedGraphic, OUString(), aStream ); BitmapEx aLoadedBitmapEx = aLoadedGraphic.GetBitmapEx(); Size aSize = aLoadedBitmapEx.GetSizePixel(); diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx index 56b5ab6d0ef5..4c0166716ddd 100644 --- a/vcl/source/filter/graphicfilter.cxx +++ b/vcl/source/filter/graphicfilter.cxx @@ -1100,7 +1100,7 @@ GraphicFilter::~GraphicFilter() } } - delete pErrorEx; + pErrorEx.reset(); } void GraphicFilter::ImplInit() @@ -1126,7 +1126,7 @@ void GraphicFilter::ImplInit() osl::FileBase::getSystemPathFromFileURL(url, aFilterPath); } - pErrorEx = new FilterErrorEx; + pErrorEx.reset( new FilterErrorEx ); } ErrCode GraphicFilter::ImplSetError( ErrCode nError, const SvStream* pStm ) |