[Libreoffice-commits] core.git: vcl/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Wed Sep 19 06:46:54 UTC 2018
vcl/source/gdi/pdfwriter_impl2.cxx | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
New commits:
commit 52ac0bf2a3d0a030da2b1a0478727e5e2871e05b
Author: Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Sat Sep 15 17:46:07 2018 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Sep 19 08:46:29 2018 +0200
loplugin:useuniqueptr in PDFWriterImpl::writeG4Stream
Change-Id: I1a596162180f4aef40b88ee7eccc7b2af9ece608
Reviewed-on: https://gerrit.libreoffice.org/60701
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
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) {
More information about the Libreoffice-commits
mailing list