summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2014-05-21 14:26:27 +0200
committerStephan Bergmann <sbergman@redhat.com>2014-05-21 15:30:17 +0200
commit2993c7c0000d32933bc7ca7fabe975a91b672edf (patch)
tree9193c8c996a9a28a72cf96f534039db70e04f422
parent0696dd9a3d3f3aead4c8cc350eb48cb955173adb (diff)
ZCodec instances can be allocated on the stack just fine
Change-Id: Id115af34011fbedc93a1fea1734ea6b1e7cfafd0
-rw-r--r--vcl/source/gdi/pngread.cxx16
1 files changed, 7 insertions, 9 deletions
diff --git a/vcl/source/gdi/pngread.cxx b/vcl/source/gdi/pngread.cxx
index cae7b38e4bc0..6198c482cb12 100644
--- a/vcl/source/gdi/pngread.cxx
+++ b/vcl/source/gdi/pngread.cxx
@@ -78,7 +78,7 @@ private:
Bitmap* mpMaskBmp;
AlphaMask* mpAlphaMask;
BitmapWriteAccess* mpMaskAcc;
- ZCodec* mpZCodec;
+ ZCodec mpZCodec;
sal_uInt8* mpInflateInBuf; // as big as the size of a scanline + alphachannel + 1
sal_uInt8* mpScanPrior; // pointer to the latest scanline
sal_uInt8* mpTransTab; // for transparency in images with palette colortype
@@ -169,7 +169,6 @@ PNGReaderImpl::PNGReaderImpl( SvStream& rPNGStream )
mpMaskBmp ( NULL ),
mpAlphaMask ( NULL ),
mpMaskAcc ( NULL ),
- mpZCodec ( new ZCodec ),
mpInflateInBuf ( NULL ),
mpScanPrior ( NULL ),
mpTransTab ( NULL ),
@@ -241,7 +240,7 @@ PNGReaderImpl::~PNGReaderImpl()
mrPNGStream.SetNumberFormatInt( mnOrigStreamMode );
if ( mbzCodecInUse )
- mpZCodec->EndCompression();
+ mpZCodec.EndCompression();
if( mpColorTable != mpDefaultColorTable )
delete[] mpColorTable;
@@ -252,7 +251,6 @@ PNGReaderImpl::~PNGReaderImpl()
delete[] mpTransTab;
delete[] mpInflateInBuf;
delete[] mpScanPrior;
- delete mpZCodec;
delete[] mpScanline;
delete[] mpScanlineAlpha;
@@ -900,16 +898,16 @@ void PNGReaderImpl::ImplReadIDAT()
if ( !mbzCodecInUse )
{
mbzCodecInUse = true;
- mpZCodec->BeginCompression( ZCODEC_NO_COMPRESSION, true );
+ mpZCodec.BeginCompression( ZCODEC_NO_COMPRESSION, true );
}
- mpZCodec->SetBreak( mnChunkLen );
+ mpZCodec.SetBreak( mnChunkLen );
SvMemoryStream aIStrm( &(*maDataIter), mnChunkLen, STREAM_READ );
- while ( ( mpZCodec->GetBreak() ) )
+ while ( ( mpZCodec.GetBreak() ) )
{
// get bytes needed to fill the current scanline
sal_Int32 nToRead = mnScansize - (mpScanCurrent - mpInflateInBuf);
- sal_Int32 nRead = mpZCodec->ReadAsynchron( aIStrm, mpScanCurrent, nToRead );
+ sal_Int32 nRead = mpZCodec.ReadAsynchron( aIStrm, mpScanCurrent, nToRead );
if ( nRead < 0 )
{
mbStatus = false;
@@ -942,7 +940,7 @@ void PNGReaderImpl::ImplReadIDAT()
if( mbIDAT )
{
- mpZCodec->EndCompression();
+ mpZCodec.EndCompression();
mbzCodecInUse = false;
}
}