22#include <com/sun/star/packages/zip/ZipConstants.hpp>
23#include <osl/diagnose.h>
26using namespace com::sun::star::packages::zip::ZipConstants;
44 switch (deflateInit2(
pStream.get(), nLevelArg, Z_DEFLATED, bNowrap? -MAX_WBITS : MAX_WBITS,
45 DEF_MEM_LEVEL, DEFAULT_STRATEGY))
68 init(nSetLevel, bNowrap);
75 pStream->next_out =
reinterpret_cast<unsigned char*
>(rBuffer.getArray())+nNewOffset;
77 pStream->avail_out = nNewLength;
78 auto nLastTotalIn =
pStream->total_in;
79 auto nLastTotalOut =
pStream->total_out;
84 nResult = z_deflate(
pStream.get(),
bFinish ? Z_FINISH : Z_NO_FLUSH);
88 if (
pStream->total_in < nLastTotalIn)
92 if (
pStream->total_out < nLastTotalOut)
104 return nNewLength -
pStream->avail_out;
127 OSL_ASSERT( !(nNewLength < 0 || nNewLength > rBuffer.getLength()));
sal_Int64 getTotalOut() const
sal_Int64 getTotalIn() const
sal_Int32 doDeflateSegment(css::uno::Sequence< sal_Int8 > &rBuffer, sal_Int32 nNewLength)
Deflater(sal_Int32 nSetLevel, bool bNowrap)
sal_Int32 doDeflateBytes(css::uno::Sequence< sal_Int8 > &rBuffer, sal_Int32 nNewOffset, sal_Int32 nNewLength)
void init(sal_Int32 nLevel, bool bNowrap)
void setInputSegment(const css::uno::Sequence< sal_Int8 > &rBuffer)
std::unique_ptr< z_stream > pStream
struct z_stream_s z_stream
css::uno::Sequence< sal_Int8 > sInBuffer