Kaydet (Commit) 0696dd9a authored tarafından Stephan Bergmann's avatar Stephan Bergmann

ZCodec instances can be allocated on the stack just fine

Change-Id: I523fba14c721815f8416f6e0224e42052d13429a
üst 47169087
...@@ -2086,12 +2086,12 @@ bool PDFWriterImpl::compressStream( SvMemoryStream* pStream ) ...@@ -2086,12 +2086,12 @@ bool PDFWriterImpl::compressStream( SvMemoryStream* pStream )
pStream->Seek( STREAM_SEEK_TO_END ); pStream->Seek( STREAM_SEEK_TO_END );
sal_uLong nEndPos = pStream->Tell(); sal_uLong nEndPos = pStream->Tell();
pStream->Seek( STREAM_SEEK_TO_BEGIN ); pStream->Seek( STREAM_SEEK_TO_BEGIN );
ZCodec* pCodec = new ZCodec( 0x4000, 0x4000 ); ZCodec pCodec( 0x4000, 0x4000 );
SvMemoryStream aStream; SvMemoryStream aStream;
pCodec->BeginCompression(); pCodec.BeginCompression();
pCodec->Write( aStream, (const sal_uInt8*)pStream->GetData(), nEndPos ); pCodec.Write( aStream, (const sal_uInt8*)pStream->GetData(), nEndPos );
pCodec->EndCompression(); pCodec.EndCompression();
delete pCodec; assert(false);
nEndPos = aStream.Tell(); nEndPos = aStream.Tell();
pStream->Seek( STREAM_SEEK_TO_BEGIN ); pStream->Seek( STREAM_SEEK_TO_BEGIN );
aStream.Seek( STREAM_SEEK_TO_BEGIN ); aStream.Seek( STREAM_SEEK_TO_BEGIN );
...@@ -3701,12 +3701,11 @@ sal_Int32 PDFWriterImpl::createToUnicodeCMap( sal_uInt8* pEncoding, ...@@ -3701,12 +3701,11 @@ sal_Int32 PDFWriterImpl::createToUnicodeCMap( sal_uInt8* pEncoding,
"end\n" "end\n"
"end\n" ); "end\n" );
#ifndef DEBUG_DISABLE_PDFCOMPRESSION #ifndef DEBUG_DISABLE_PDFCOMPRESSION
ZCodec* pCodec = new ZCodec( 0x4000, 0x4000 ); ZCodec pCodec( 0x4000, 0x4000 );
SvMemoryStream aStream; SvMemoryStream aStream;
pCodec->BeginCompression(); pCodec.BeginCompression();
pCodec->Write( aStream, (const sal_uInt8*)aContents.getStr(), aContents.getLength() ); pCodec.Write( aStream, (const sal_uInt8*)aContents.getStr(), aContents.getLength() );
pCodec->EndCompression(); pCodec.EndCompression();
delete pCodec;
#endif #endif
#if OSL_DEBUG_LEVEL > 1 #if OSL_DEBUG_LEVEL > 1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment