From 2f5de087235c4bdccd4c35b5ae1332e10fedbbd8 Mon Sep 17 00:00:00 2001 From: Martin Gallwey Date: Wed, 22 Nov 2000 15:55:27 +0000 Subject: [PATCH] #80556# Work around for flaw in XOutputStream (not being able to specify how much to write with the writeBytes method)...no longer write lots and lots of white space --- package/source/zipapi/ZipOutputStream.cxx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/package/source/zipapi/ZipOutputStream.cxx b/package/source/zipapi/ZipOutputStream.cxx index 894d75bf1ae6..56c8995cd2dd 100644 --- a/package/source/zipapi/ZipOutputStream.cxx +++ b/package/source/zipapi/ZipOutputStream.cxx @@ -2,9 +2,9 @@ * * $RCSfile: ZipOutputStream.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: mtg $ $Date: 2000-11-21 12:07:21 $ + * last change: $Author: mtg $ $Date: 2000-11-22 16:55:27 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -214,7 +214,11 @@ void SAL_CALL ZipOutputStream::write( const uno::Sequence< sal_Int8 >& rBuffer, } break; case STORED: - aChucker.writeBytes(rBuffer); + sal_Int32 nOldLength = rBuffer.getLength(); + uno::Sequence < sal_Int8 > *pBuffer = const_cast < uno::Sequence < sal_Int8 > *> (&rBuffer); + pBuffer->realloc(nNewLength); + aChucker.writeBytes(*pBuffer); + pBuffer->realloc(nOldLength); break; } aCRC.updateSegment(rBuffer, nNewOffset, nNewLength); @@ -240,9 +244,12 @@ void SAL_CALL ZipOutputStream::finish( ) void ZipOutputStream::doDeflate() { sal_Int32 nLength = aDeflater.doDeflateSegment(aBuffer, 0, aBuffer.getLength()); + sal_Int32 nOldLength = aBuffer.getLength(); if (nLength > 0 ) { + aBuffer.realloc(nLength); aChucker.writeBytes(aBuffer); + aBuffer.realloc(nOldLength); } } void ZipOutputStream::writeEND(sal_uInt32 nOffset, sal_uInt32 nLength)