summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-08-29 15:06:36 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-08-30 08:31:30 +0200
commit6c99bca30449589a2904891939e12e6a474464eb (patch)
tree3706951f3b992408fe250b2ef982fa603387821f /vcl
parentab6da907521514cfa85eb8e5786a9c9bae3ceb2e (diff)
loplugin:useuniqueptr in InverseColorMap
Change-Id: I04801a912397ca0081201f52b756c37f83538be5 Reviewed-on: https://gerrit.libreoffice.org/59776 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/inc/octree.hxx4
-rw-r--r--vcl/source/gdi/octree.cxx14
2 files changed, 8 insertions, 10 deletions
diff --git a/vcl/inc/octree.hxx b/vcl/inc/octree.hxx
index 9178ce730381..ae819d858872 100644
--- a/vcl/inc/octree.hxx
+++ b/vcl/inc/octree.hxx
@@ -93,8 +93,8 @@ class VCL_PLUGIN_PUBLIC InverseColorMap
{
private:
- sal_uInt8* pBuffer;
- sal_uInt8* pMap;
+ std::unique_ptr<sal_uInt8[]> pBuffer;
+ std::unique_ptr<sal_uInt8[]> pMap;
const sal_uLong nBits;
SAL_DLLPRIVATE void ImplCreateBuffers( const sal_uLong nMax );
diff --git a/vcl/source/gdi/octree.cxx b/vcl/source/gdi/octree.cxx
index 3397a1fb08f3..21af8416fee9 100644
--- a/vcl/source/gdi/octree.cxx
+++ b/vcl/source/gdi/octree.cxx
@@ -262,8 +262,8 @@ InverseColorMap::InverseColorMap( const BitmapPalette& rPal ) :
const long cginc = ( xsqr - ( cGreen << nBits ) ) << 1;
const long cbinc = ( xsqr - ( cBlue << nBits ) ) << 1;
- sal_uLong* cdp = reinterpret_cast<sal_uLong*>(pBuffer);
- sal_uInt8* crgbp = pMap;
+ sal_uLong* cdp = reinterpret_cast<sal_uLong*>(pBuffer.get());
+ sal_uInt8* crgbp = pMap.get();
for( r = 0, rxx = crinc; r < nColorMax; rdist += rxx, r++, rxx += xsqr2 )
{
@@ -282,8 +282,6 @@ InverseColorMap::InverseColorMap( const BitmapPalette& rPal ) :
InverseColorMap::~InverseColorMap()
{
- std::free( pBuffer );
- std::free( pMap );
}
void InverseColorMap::ImplCreateBuffers( const sal_uLong nMax )
@@ -291,11 +289,11 @@ void InverseColorMap::ImplCreateBuffers( const sal_uLong nMax )
const sal_uLong nCount = nMax * nMax * nMax;
const sal_uLong nSize = nCount * sizeof( sal_uLong );
- pMap = static_cast<sal_uInt8*>(std::malloc( nCount ));
- memset( pMap, 0x00, nCount );
+ pMap.reset(new sal_uInt8[ nCount ]);
+ memset( pMap.get(), 0x00, nCount );
- pBuffer = static_cast<sal_uInt8*>(std::malloc( nSize ));
- memset( pBuffer, 0xff, nSize );
+ pBuffer.reset(new sal_uInt8[ nSize ]);
+ memset( pBuffer.get(), 0xff, nSize );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */