Kaydet (Commit) fe0ae0ef authored tarafından Noel Grandin's avatar Noel Grandin

loplugin:useuniqueptr in PngHelper::createPng

Change-Id: I55ec28c88a89eab927a46ec666c3698065b151d2
Reviewed-on: https://gerrit.libreoffice.org/59995
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 1fd49278
...@@ -245,11 +245,11 @@ void PngHelper::createPng( OutputBuffer& o_rOutputBuf, ...@@ -245,11 +245,11 @@ void PngHelper::createPng( OutputBuffer& o_rOutputBuf,
Guchar *p, *pm; Guchar *p, *pm;
GfxRGB rgb; GfxRGB rgb;
GfxGray alpha; GfxGray alpha;
ImageStream* imgStr = std::unique_ptr<ImageStream> imgStr(
new ImageStream(str, new ImageStream(str,
width, width,
colorMap->getNumPixelComps(), colorMap->getNumPixelComps(),
colorMap->getBits()); colorMap->getBits()));
imgStr->reset(); imgStr->reset();
// create scan line data buffer // create scan line data buffer
...@@ -281,11 +281,11 @@ void PngHelper::createPng( OutputBuffer& o_rOutputBuf, ...@@ -281,11 +281,11 @@ void PngHelper::createPng( OutputBuffer& o_rOutputBuf,
// the other, too. Hence the two passes are imperative ! // the other, too. Hence the two passes are imperative !
// initialize mask stream // initialize mask stream
ImageStream* imgStrMask = std::unique_ptr<ImageStream> imgStrMask(
new ImageStream(maskStr, new ImageStream(maskStr,
maskWidth, maskWidth,
maskColorMap->getNumPixelComps(), maskColorMap->getNumPixelComps(),
maskColorMap->getBits()); maskColorMap->getBits()));
imgStrMask->reset(); imgStrMask->reset();
for( int y = 0; y < maskHeight; ++y ) for( int y = 0; y < maskHeight; ++y )
...@@ -302,8 +302,8 @@ void PngHelper::createPng( OutputBuffer& o_rOutputBuf, ...@@ -302,8 +302,8 @@ void PngHelper::createPng( OutputBuffer& o_rOutputBuf,
} }
} }
delete imgStr; imgStr.reset();
delete imgStrMask; imgStrMask.reset();
// begind IDAT chunk for scanline data // begind IDAT chunk for scanline data
size_t nIdx = startChunk( "IDAT", o_rOutputBuf ); size_t nIdx = startChunk( "IDAT", o_rOutputBuf );
...@@ -330,11 +330,11 @@ void PngHelper::createPng( OutputBuffer& o_rOutputBuf, ...@@ -330,11 +330,11 @@ void PngHelper::createPng( OutputBuffer& o_rOutputBuf,
// initialize stream // initialize stream
Guchar *p; Guchar *p;
GfxRGB rgb; GfxRGB rgb;
ImageStream* imgStr = std::unique_ptr<ImageStream> imgStr(
new ImageStream(str, new ImageStream(str,
width, width,
colorMap->getNumPixelComps(), colorMap->getNumPixelComps(),
colorMap->getBits()); colorMap->getBits()));
imgStr->reset(); imgStr->reset();
// create scan line data buffer // create scan line data buffer
...@@ -366,8 +366,8 @@ void PngHelper::createPng( OutputBuffer& o_rOutputBuf, ...@@ -366,8 +366,8 @@ void PngHelper::createPng( OutputBuffer& o_rOutputBuf,
// the other, too. Hence the two passes are imperative ! // the other, too. Hence the two passes are imperative !
// initialize mask stream // initialize mask stream
ImageStream* imgStrMask = std::unique_ptr<ImageStream> imgStrMask(
new ImageStream(maskStr, maskWidth, 1, 1); new ImageStream(maskStr, maskWidth, 1, 1));
imgStrMask->reset(); imgStrMask->reset();
for( int y = 0; y < maskHeight; ++y ) for( int y = 0; y < maskHeight; ++y )
...@@ -386,8 +386,8 @@ void PngHelper::createPng( OutputBuffer& o_rOutputBuf, ...@@ -386,8 +386,8 @@ void PngHelper::createPng( OutputBuffer& o_rOutputBuf,
} }
} }
delete imgStr; imgStr.reset();
delete imgStrMask; imgStrMask.reset();
// begind IDAT chunk for scanline data // begind IDAT chunk for scanline data
size_t nIdx = startChunk( "IDAT", o_rOutputBuf ); size_t nIdx = startChunk( "IDAT", o_rOutputBuf );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment