summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-05-03 15:05:21 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-05-07 08:32:21 +0200
commit2834d503d683c7a125b24e49f0127d43cb2501e9 (patch)
treef0a5b868dbac15e843256b1c303fcebe3c8bd2fd
parent6e155026b1c123045def6e1a72ac268e78b4262e (diff)
loplugin:useuniqueptr in TIFFWriter
Change-Id: I119e280f43e38c9ada64ce5a59dcee2aa0dc2e94 Reviewed-on: https://gerrit.libreoffice.org/53872 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--filter/source/graphicfilter/etiff/etiff.cxx12
1 files changed, 6 insertions, 6 deletions
diff --git a/filter/source/graphicfilter/etiff/etiff.cxx b/filter/source/graphicfilter/etiff/etiff.cxx
index 643f44031fb0..9663cb669abc 100644
--- a/filter/source/graphicfilter/etiff/etiff.cxx
+++ b/filter/source/graphicfilter/etiff/etiff.cxx
@@ -79,7 +79,7 @@ private:
sal_uInt32 mnBitmapPos;
sal_uInt32 mnStripByteCountPos;
- TIFFLZWCTreeNode* pTable;
+ std::unique_ptr<TIFFLZWCTreeNode[]> pTable;
TIFFLZWCTreeNode* pPrefix;
sal_uInt16 nDataSize;
sal_uInt16 nClearCode;
@@ -499,7 +499,7 @@ void TIFFWriter::StartCompression()
nOffset = 32; // number of free bits in dwShift
dwShift = 0;
- pTable = new TIFFLZWCTreeNode[ 4096 ];
+ pTable.reset(new TIFFLZWCTreeNode[ 4096 ]);
for ( i = 0; i < 4096; i++)
{
@@ -520,7 +520,7 @@ void TIFFWriter::Compress( sal_uInt8 nCompThis )
if( !pPrefix )
{
- pPrefix = pTable + nCompThis;
+ pPrefix = &pTable[nCompThis];
}
else
{
@@ -552,14 +552,14 @@ void TIFFWriter::Compress( sal_uInt8 nCompThis )
if( nTableSize == static_cast<sal_uInt16>( ( 1 << nCodeSize ) - 1 ) )
nCodeSize++;
- p = pTable + ( nTableSize++ );
+ p = &pTable[ nTableSize++ ];
p->pBrother = pPrefix->pFirstChild;
pPrefix->pFirstChild = p;
p->nValue = nV;
p->pFirstChild = nullptr;
}
- pPrefix = pTable + nV;
+ pPrefix = &pTable[nV];
}
}
}
@@ -571,7 +571,7 @@ void TIFFWriter::EndCompression()
WriteBits( pPrefix->nCode, nCodeSize );
WriteBits( nEOICode, nCodeSize );
- delete[] pTable;
+ pTable.reset();
}