From fe0ae0efe894ad2b313a5278f3c5ede03747bf4e Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 4 Sep 2018 11:53:06 +0200 Subject: loplugin:useuniqueptr in PngHelper::createPng Change-Id: I55ec28c88a89eab927a46ec666c3698065b151d2 Reviewed-on: https://gerrit.libreoffice.org/59995 Tested-by: Jenkins Reviewed-by: Noel Grandin --- sdext/source/pdfimport/xpdfwrapper/pnghelper.cxx | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'sdext') diff --git a/sdext/source/pdfimport/xpdfwrapper/pnghelper.cxx b/sdext/source/pdfimport/xpdfwrapper/pnghelper.cxx index 44f30c0bab28..4d9e3bb46b61 100644 --- a/sdext/source/pdfimport/xpdfwrapper/pnghelper.cxx +++ b/sdext/source/pdfimport/xpdfwrapper/pnghelper.cxx @@ -245,11 +245,11 @@ void PngHelper::createPng( OutputBuffer& o_rOutputBuf, Guchar *p, *pm; GfxRGB rgb; GfxGray alpha; - ImageStream* imgStr = + std::unique_ptr imgStr( new ImageStream(str, width, colorMap->getNumPixelComps(), - colorMap->getBits()); + colorMap->getBits())); imgStr->reset(); // create scan line data buffer @@ -281,11 +281,11 @@ void PngHelper::createPng( OutputBuffer& o_rOutputBuf, // the other, too. Hence the two passes are imperative ! // initialize mask stream - ImageStream* imgStrMask = + std::unique_ptr imgStrMask( new ImageStream(maskStr, maskWidth, maskColorMap->getNumPixelComps(), - maskColorMap->getBits()); + maskColorMap->getBits())); imgStrMask->reset(); for( int y = 0; y < maskHeight; ++y ) @@ -302,8 +302,8 @@ void PngHelper::createPng( OutputBuffer& o_rOutputBuf, } } - delete imgStr; - delete imgStrMask; + imgStr.reset(); + imgStrMask.reset(); // begind IDAT chunk for scanline data size_t nIdx = startChunk( "IDAT", o_rOutputBuf ); @@ -330,11 +330,11 @@ void PngHelper::createPng( OutputBuffer& o_rOutputBuf, // initialize stream Guchar *p; GfxRGB rgb; - ImageStream* imgStr = + std::unique_ptr imgStr( new ImageStream(str, width, colorMap->getNumPixelComps(), - colorMap->getBits()); + colorMap->getBits())); imgStr->reset(); // create scan line data buffer @@ -366,8 +366,8 @@ void PngHelper::createPng( OutputBuffer& o_rOutputBuf, // the other, too. Hence the two passes are imperative ! // initialize mask stream - ImageStream* imgStrMask = - new ImageStream(maskStr, maskWidth, 1, 1); + std::unique_ptr imgStrMask( + new ImageStream(maskStr, maskWidth, 1, 1)); imgStrMask->reset(); for( int y = 0; y < maskHeight; ++y ) @@ -386,8 +386,8 @@ void PngHelper::createPng( OutputBuffer& o_rOutputBuf, } } - delete imgStr; - delete imgStrMask; + imgStr.reset(); + imgStrMask.reset(); // begind IDAT chunk for scanline data size_t nIdx = startChunk( "IDAT", o_rOutputBuf ); -- cgit