diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2018-09-15 17:46:07 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-09-19 08:46:29 +0200 |
commit | 52ac0bf2a3d0a030da2b1a0478727e5e2871e05b (patch) | |
tree | 724afd682eb024826d46663828ff6c4d36eea073 | |
parent | 9fec5ac89d0675d2229b3adf425202fd93f11f8e (diff) |
loplugin:useuniqueptr in PDFWriterImpl::writeG4Stream
Change-Id: I1a596162180f4aef40b88ee7eccc7b2af9ece608
Reviewed-on: https://gerrit.libreoffice.org/60701
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | vcl/source/gdi/pdfwriter_impl2.cxx | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/vcl/source/gdi/pdfwriter_impl2.cxx b/vcl/source/gdi/pdfwriter_impl2.cxx index e87f2acfbd0d..adef14351404 100644 --- a/vcl/source/gdi/pdfwriter_impl2.cxx +++ b/vcl/source/gdi/pdfwriter_impl2.cxx @@ -1938,8 +1938,9 @@ void PDFWriterImpl::writeG4Stream( BitmapReadAccess const * i_pBitmap ) BitStreamState aBitState; // the first reference line is virtual and completely empty - const Scanline pFirstRefLine = static_cast<Scanline>(rtl_allocateZeroMemory( nW/8 + 1 )); - Scanline pRefLine = pFirstRefLine; + std::unique_ptr<sal_uInt8[]> pFirstRefLine(new sal_uInt8[nW/8 + 1]); + memset(pFirstRefLine.get(), 0, nW/8 + 1); + Scanline pRefLine = pFirstRefLine.get(); for( long nY = 0; nY < nH; nY++ ) { const Scanline pCurLine = i_pBitmap->GetScanline( nY ); @@ -2012,8 +2013,6 @@ void PDFWriterImpl::writeG4Stream( BitmapReadAccess const * i_pBitmap ) writeBuffer( &aBitState.getByte(), 1 ); aBitState.flush(); } - - std::free( pFirstRefLine ); } static bool lcl_canUsePDFAxialShading(const Gradient& rGradient) { |