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

loplugin:useuniqueptr in PCXReader::ImplReadBody

Change-Id: I8aa249fbd5fd05fb9b5ca0dd1cddf3e0111cf201
Reviewed-on: https://gerrit.libreoffice.org/61110
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst e79b7a51
......@@ -206,13 +206,14 @@ void PCXReader::ImplReadHeader()
void PCXReader::ImplReadBody()
{
sal_uInt8 *pPlane[ 4 ], * pDest;
std::unique_ptr<sal_uInt8[]> pPlane[ 4 ];
sal_uInt8 * pDest;
sal_uLong i, nx, ny, np, nCount, nPercent;
sal_uLong nLastPercent = 0;
sal_uInt8 nDat = 0, nCol = 0;
for( np = 0; np < nPlanes; np++ )
pPlane[ np ] = new sal_uInt8[ nBytesPerPlaneLin ];
pPlane[ np ].reset(new sal_uInt8[ nBytesPerPlaneLin ]);
nCount = 0;
for ( ny = 0; ny < nHeight; ny++ )
......@@ -230,10 +231,10 @@ void PCXReader::ImplReadBody()
for ( np = 0; np < nPlanes; np++)
{
if ( nEncoding == 0)
m_rPCX.ReadBytes( static_cast<void *>(pPlane[ np ]), nBytesPerPlaneLin );
m_rPCX.ReadBytes( static_cast<void *>(pPlane[ np ].get()), nBytesPerPlaneLin );
else
{
pDest = pPlane[ np ];
pDest = pPlane[ np ].get();
nx = nBytesPerPlaneLin;
while ( nCount > 0 && nx > 0)
{
......@@ -277,10 +278,10 @@ void PCXReader::ImplReadBody()
}
}
}
sal_uInt8 *pSource1 = pPlane[ 0 ];
sal_uInt8 *pSource2 = pPlane[ 1 ];
sal_uInt8 *pSource3 = pPlane[ 2 ];
sal_uInt8 *pSource4 = pPlane[ 3 ];
sal_uInt8 *pSource1 = pPlane[ 0 ].get();
sal_uInt8 *pSource2 = pPlane[ 1 ].get();
sal_uInt8 *pSource3 = pPlane[ 2 ].get();
sal_uInt8 *pSource4 = pPlane[ 3 ].get();
switch ( nBitsPerPlanePix + ( nPlanes << 8 ) )
{
// 2 colors
......@@ -375,8 +376,6 @@ void PCXReader::ImplReadBody()
break;
}
}
for ( np = 0; np < nPlanes; np++ )
delete[] pPlane[ np ];
}
void PCXReader::ImplReadPalette( sal_uLong nCol )
......
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