2 * Author : Paul Marquess, <pmqs@cpan.org>
3 * Created : 22nd January 1996
6 * Copyright (c) 1995-2013 Paul Marquess. All rights reserved.
7 * This program is free software; you can redistribute it and/or
8 * modify it under the same terms as Perl itself.
12 /* Parts of this code are based on the files gzio.c and gzappend.c from
13 * the standard zlib source distribution. Below are the copyright statements
17 /* gzio.c -- IO on .gz files
18 * Copyright (C) 1995 Jean-loup Gailly.
19 * For conditions of distribution and use, see copyright notice in zlib.h
22 /* gzappend -- command to append to a gzip file
24 Copyright (C) 2003 Mark Adler, all rights reserved
25 version 1.1, 4 Nov 2003
29 #define PERL_NO_GET_CONTEXT
36 /* zlib prior to 1.06 doesn't know about z_off_t */
41 #if ! defined(ZLIB_VERNUM) || ZLIB_VERNUM < 0x1200
42 # define NEED_DUMMY_BYTE_AT_END
45 #if defined(ZLIB_VERNUM) && ZLIB_VERNUM >= 0x1210
47 # define AT_LEAST_ZLIB_1_2_1
50 #if defined(ZLIB_VERNUM) && ZLIB_VERNUM >= 0x1221
51 # define AT_LEAST_ZLIB_1_2_2_1
54 #if defined(ZLIB_VERNUM) && ZLIB_VERNUM >= 0x1222
55 # define AT_LEAST_ZLIB_1_2_2_2
58 #if defined(ZLIB_VERNUM) && ZLIB_VERNUM >= 0x1223
59 # define AT_LEAST_ZLIB_1_2_2_3
62 #if defined(ZLIB_VERNUM) && ZLIB_VERNUM >= 0x1230
63 # define AT_LEAST_ZLIB_1_2_3
66 #if defined(ZLIB_VERNUM) && ZLIB_VERNUM >= 0x1252
68 Use Z_SOLO to build source means need own malloc/free
70 # define AT_LEAST_ZLIB_1_2_5_2
73 #if defined(ZLIB_VERNUM) && ZLIB_VERNUM >= 0x1280
74 # define AT_LEAST_ZLIB_1_2_8
78 # define NEED_sv_2pvbyte
79 # define NEED_sv_2pv_nolen
80 # define NEED_sv_pvn_force_flags
84 #if PERL_REVISION == 5 && PERL_VERSION == 9
86 # define sv_pvbyte_force(sv,lp) sv_pvbyten_force(sv,lp)
89 #if PERL_REVISION == 5 && (PERL_VERSION < 8 || (PERL_VERSION == 8 && PERL_SUBVERSION < 4 ))
91 # ifdef SvPVbyte_force
92 # undef SvPVbyte_force
95 # define SvPVbyte_force(sv,lp) SvPV_force(sv,lp)
99 #ifndef SvPVbyte_nolen
100 # define SvPVbyte_nolen SvPV_nolen
106 # ifndef SvPVbyte_nolen
107 # define SvPVbyte_nolen SvPV_nolen
110 # ifndef SvPVbyte_force
111 # define SvPVbyte_force(sv,lp) SvPV_force(sv,lp)
115 #if PERL_REVISION == 5 && (PERL_VERSION >= 8 || (PERL_VERSION == 8 && PERL_SUBVERSION < 4 ))
116 # define UTF8_AVAILABLE
119 typedef int DualType ;
120 typedef int int_undef ;
122 typedef struct di_stream {
124 #define FLAG_APPEND 1
126 #define FLAG_ADLER32 4
127 #define FLAG_CONSUME_INPUT 8
128 #define FLAG_LIMIT_OUTPUT 16
139 bool deflateParams_out_valid ;
140 Bytef deflateParams_out_byte;
142 #define deflateParams_BUFFER_SIZE 0x4000
143 uLong deflateParams_out_length;
144 Bytef* deflateParams_out_buffer;
151 uLong bytesInflated ;
152 uLong compressedBytes ;
153 uLong uncompressedBytes ;
156 #define WINDOW_SIZE 32768U
158 bool matchedEndBlock;
160 int window_lastbit, window_left, window_full;
161 unsigned window_have;
162 off_t window_lastoff, window_end;
163 off_t window_endOffset;
165 uLong lastBlockOffset ;
166 unsigned char window_lastByte ;
172 typedef di_stream * deflateStream ;
173 typedef di_stream * Compress__Raw__Zlib__deflateStream ;
174 typedef di_stream * inflateStream ;
175 typedef di_stream * Compress__Raw__Zlib__inflateStream ;
176 typedef di_stream * Compress__Raw__Zlib__inflateScanStream ;
178 #define ZMALLOC(to, typ) ((to = (typ *)safemalloc(sizeof(typ))), \
181 /* Figure out the Operating System */
183 # define OS_CODE 0x00
186 #if defined(AMIGA) || defined(AMIGAOS)
187 # define OS_CODE 0x01
190 #if defined(VAXC) || defined(VMS)
191 # define OS_CODE 0x02
195 # define OS_CODE 0x04
198 #if defined(ATARI) || defined(atarist)
199 # define OS_CODE 0x05
203 # define OS_CODE 0x06
206 #if defined(MACOS) || defined(TARGET_OS_MAC)
207 # define OS_CODE 0x07
211 # define OS_CODE 0x08
215 # define OS_CODE 0x09
219 # define OS_CODE 0x0a
222 #ifdef WIN32 /* Window 95 & Windows NT */
223 # define OS_CODE 0x0b
227 # define OS_CODE 0x0c
230 #if 0 /* Acorn RISCOS */
231 # define OS_CODE 0x0d
235 # define OS_CODE 0x0e
238 #ifdef __50SERIES /* Prime/PRIMOS */
239 # define OS_CODE 0x0F
242 /* Default to UNIX */
244 # define OS_CODE 0x03 /* assume Unix */
248 # define GZIP_OS_CODE OS_CODE
251 #define adlerInitial adler32(0L, Z_NULL, 0)
252 #define crcInitial crc32(0L, Z_NULL, 0)
254 /* static const char * const my_z_errmsg[] = { */
255 static const char my_z_errmsg[][32] = {
256 "need dictionary", /* Z_NEED_DICT 2 */
257 "stream end", /* Z_STREAM_END 1 */
259 "file error", /* Z_ERRNO (-1) */
260 "stream error", /* Z_STREAM_ERROR (-2) */
261 "data error", /* Z_DATA_ERROR (-3) */
262 "insufficient memory", /* Z_MEM_ERROR (-4) */
263 "buffer error", /* Z_BUF_ERROR (-5) */
264 "incompatible version",/* Z_VERSION_ERROR(-6) */
267 #define setDUALstatus(var, err) \
268 sv_setnv(var, (double)err) ; \
269 sv_setpv(var, ((err) ? GetErrorString(err) : "")) ; \
273 #if defined(__SYMBIAN32__)
274 # define NO_WRITEABLE_DATA
277 #define TRACE_DEFAULT 0
279 #ifdef NO_WRITEABLE_DATA
280 # define trace TRACE_DEFAULT
282 static int trace = TRACE_DEFAULT ;
285 /* Dodge PerlIO hiding of these functions. */
290 GetErrorString(int error_no)
292 GetErrorString(error_no)
299 if (error_no == Z_ERRNO) {
300 errstr = Strerror(errno) ;
303 /* errstr = gzerror(fil, &error_no) ; */
304 errstr = (char*) my_z_errmsg[2 - error_no];
313 The following two functions are taken almost directly from
314 examples/gzappend.c. Only cosmetic changes have been made to conform to
315 the coding style of the rest of the code in this file.
319 /* return the greatest common divisor of a and b using Euclid's algorithm,
320 modified to be fast when one argument much greater than the other, and
321 coded to avoid unnecessary swapping */
324 gcd(unsigned a, unsigned b)
349 /* rotate list[0..len-1] left by rot positions, in place */
352 rotate(unsigned char *list, unsigned len, unsigned rot)
354 rotate(list, len, rot)
362 unsigned char *start, *last, *to, *from;
364 /* normalize rot and handle degenerate cases */
366 if (rot >= len) rot %= len;
367 if (rot == 0) return;
369 /* pointer to last entry in list */
370 last = list + (len - 1);
372 /* do simple left shift by one */
375 memcpy(list, list + 1, len - 1);
380 /* do simple right shift by one */
381 if (rot == len - 1) {
383 memmove(list + 1, list, len - 1);
388 /* otherwise do rotate as a set of cycles in place */
389 cycles = gcd(len, rot); /* number of cycles */
391 start = from = list + cycles; /* start index is arbitrary */
392 tmp = *from; /* save entry to be overwritten */
394 to = from; /* next step in cycle */
395 from += rot; /* go right rot positions */
396 if (from > last) from -= len; /* (pointer better not wrap) */
397 if (from == start) break; /* all but one shifted */
398 *to = *from; /* shift left */
400 *to = tmp; /* complete the circle */
404 #endif /* MAGIC_APPEND */
408 DispHex(void * ptr, int length)
415 char * p = (char*)ptr;
417 for (i = 0; i < length; ++i) {
418 printf(" %02x", 0xFF & *(p+i));
425 DispStream(di_stream * s, const char * message)
427 DispStream(s, message)
429 const char * message;
438 #define EnDis(f) (s->flags & f ? "Enabled" : "Disabled")
440 printf("DispStream %p", s) ;
442 printf("- %s \n", message) ;
446 printf(" stream pointer is NULL\n");
449 printf(" stream %p\n", &(s->stream));
450 printf(" zalloc %p\n", s->stream.zalloc);
451 printf(" zfree %p\n", s->stream.zfree);
452 printf(" opaque %p\n", s->stream.opaque);
453 printf(" state %p\n", s->stream.state);
455 printf(" msg %s\n", s->stream.msg);
458 printf(" next_in %p", s->stream.next_in);
459 if (s->stream.next_in){
461 DispHex(s->stream.next_in, 4);
465 printf(" next_out %p", s->stream.next_out);
466 if (s->stream.next_out){
468 DispHex(s->stream.next_out, 4);
472 printf(" avail_in %lu\n", (unsigned long)s->stream.avail_in);
473 printf(" avail_out %lu\n", (unsigned long)s->stream.avail_out);
474 printf(" total_in %ld\n", s->stream.total_in);
475 printf(" total_out %ld\n", s->stream.total_out);
476 printf(" adler %ld\n", s->stream.adler );
477 printf(" bufsize %ld\n", s->bufsize);
478 printf(" dictionary %p\n", s->dictionary);
479 printf(" dict_adler 0x%ld\n",s->dict_adler);
480 printf(" zip_mode %d\n", s->zip_mode);
481 printf(" crc32 0x%x\n", (unsigned)s->crc32);
482 printf(" adler32 0x%x\n", (unsigned)s->adler32);
483 printf(" flags 0x%x\n", s->flags);
484 printf(" APPEND %s\n", EnDis(FLAG_APPEND));
485 printf(" CRC32 %s\n", EnDis(FLAG_CRC32));
486 printf(" ADLER32 %s\n", EnDis(FLAG_ADLER32));
487 printf(" CONSUME %s\n", EnDis(FLAG_CONSUME_INPUT));
488 printf(" LIMIT %s\n", EnDis(FLAG_LIMIT_OUTPUT));
492 printf(" window %p\n", s->window);
499 #ifdef AT_LEAST_ZLIB_1_2_5_2
500 voidpf my_zcalloc (voidpf opaque, unsigned items, unsigned size)
502 PERL_UNUSED_VAR(opaque);
503 return safemalloc(items * size);
507 void my_zcfree (voidpf opaque, voidpf ptr)
509 PERL_UNUSED_VAR(opaque);
525 ZMALLOC(s, di_stream) ;
527 #ifdef AT_LEAST_ZLIB_1_2_5_2
528 s->stream.zalloc = my_zcalloc;
529 s->stream.zfree = my_zcfree;
537 PostInitStream(di_stream * s, int flags, int bufsize, int windowBits)
539 PostInitStream(s, flags, bufsize, windowBits)
546 s->bufsize = bufsize ;
548 s->uncompressedBytes =
551 s->zip_mode = (windowBits < 0) ;
552 if (flags & FLAG_CRC32)
553 s->crc32 = crcInitial ;
554 if (flags & FLAG_ADLER32)
555 s->adler32 = adlerInitial ;
561 deRef(SV * sv, const char * string)
578 croak("%s: buffer parameter is not a SCALAR reference", string);
583 croak("%s: buffer parameter is a reference to a reference", string) ;
587 sv = sv_2mortal(newSVpv("", 0));
594 deRef_l(SV * sv, const char * string)
617 croak("%s: buffer parameter is not a SCALAR reference", string);
622 croak("%s: buffer parameter is a reference to a reference", string) ;
625 if (SvREADONLY(sv) && PL_curcop != &PL_compiling)
626 croak("%s: buffer parameter is read-only", string);
628 SvUPGRADE(sv, SVt_PV);
633 (void)SvPVbyte_force(sv, na) ;
639 #include "constants.h"
641 MODULE = Compress::Raw::Zlib PACKAGE = Compress::Raw::Zlib PREFIX = Zip_
646 INCLUDE: constants.xs
649 /* Check this version of zlib is == 1 */
650 if (zlibVersion()[0] != '1')
651 croak("Compress::Raw::Zlib needs zlib version 1.x\n") ;
654 /* Create the $os_code scalar */
655 SV * os_code_sv = perl_get_sv("Compress::Raw::Zlib::gzip_os_code", GV_ADDMULTI) ;
656 sv_setiv(os_code_sv, GZIP_OS_CODE) ;
660 #define Zip_zlib_version() (const char*)zlib_version
668 RETVAL = ZLIB_VERNUM ;
670 /* 1.1.4 => 0x1140 */
671 RETVAL = (ZLIB_VERSION[0] - '0') << 12 ;
672 RETVAL += (ZLIB_VERSION[2] - '0') << 8 ;
673 RETVAL += (ZLIB_VERSION[4] - '0') << 4 ;
674 if (strlen(ZLIB_VERSION) > 5)
675 RETVAL += (ZLIB_VERSION[6] - '0') ;
681 #ifndef AT_LEAST_ZLIB_1_2_1
682 #define zlibCompileFlags() 0
687 MODULE = Compress::Raw::Zlib PACKAGE = Compress::Raw::Zlib PREFIX = Zip_
689 #define Zip_adler32(buf, adler) adler32(adler, buf, (uInt)len)
692 Zip_adler32(buf, adler=adlerInitial)
693 uLong adler = NO_INIT
695 Bytef * buf = NO_INIT
698 /* If the buffer is a reference, dereference it */
699 sv = deRef(sv, "adler32") ;
700 #ifdef UTF8_AVAILABLE
701 if (DO_UTF8(sv) && !sv_utf8_downgrade(sv, 1))
702 croak("Wide character in Compress::Raw::Zlib::adler32");
704 buf = (Byte*)SvPVbyte(sv, len) ;
707 adler = adlerInitial;
708 else if (SvOK(ST(1)))
709 adler = SvUV(ST(1)) ;
711 adler = adlerInitial;
715 #define Zip_crc32(buf, crc, offset) crc32(crc, buf+offset, (uInt)len-offset)
718 Zip_crc32(buf, crc=crcInitial, offset=0)
721 Bytef * buf = NO_INIT
725 /* If the buffer is a reference, dereference it */
726 sv = deRef(sv, "crc32") ;
727 #ifdef UTF8_AVAILABLE
728 if (DO_UTF8(sv) && !sv_utf8_downgrade(sv, 1))
729 croak("Wide character in Compress::Raw::Zlib::crc32");
731 buf = (Byte*)SvPVbyte(sv, len) ;
735 else if (SvOK(ST(1)))
741 crc32_combine(crc1, crc2, len2)
746 #ifndef AT_LEAST_ZLIB_1_2_2_1
747 crc1 = crc1; crc2 = crc2 ; len2 = len2; /* Silence -Wall */
748 croak("crc32_combine needs zlib 1.2.3 or better");
750 RETVAL = crc32_combine(crc1, crc2, len2);
757 adler32_combine(adler1, adler2, len2)
762 #ifndef AT_LEAST_ZLIB_1_2_2_1
763 adler1 = adler1; adler2 = adler2 ; len2 = len2; /* Silence -Wall */
764 croak("adler32_combine needs zlib 1.2.3 or better");
766 RETVAL = adler32_combine(adler1, adler2, len2);
772 MODULE = Compress::Raw::Zlib PACKAGE = Compress::Raw::Zlib
775 _deflateInit(flags,level, method, windowBits, memLevel, strategy, bufsize, dictionary)
789 warn("in _deflateInit(level=%d, method=%d, windowBits=%d, memLevel=%d, strategy=%d, bufsize=%ld dictionary=%p)\n",
790 level, method, windowBits, memLevel, strategy, bufsize, dictionary) ;
791 if ((s = InitStream() )) {
795 s->WindowBits = windowBits;
796 s->MemLevel = memLevel;
797 s->Strategy = strategy;
799 err = deflateInit2(&(s->stream), level,
800 method, windowBits, memLevel, strategy);
803 warn(" _deflateInit2 returned %d (state %p)\n", err, s);
804 DispStream(s, "INIT");
807 /* Check if a dictionary has been specified */
808 SvGETMAGIC(dictionary);
809 if (err == Z_OK && SvPOK(dictionary) && SvCUR(dictionary)) {
810 #ifdef UTF8_AVAILABLE
811 if (DO_UTF8(dictionary) && !sv_utf8_downgrade(dictionary, 1))
812 croak("Wide character in Compress::Raw::Zlib::Deflate::new dicrionary parameter");
814 err = deflateSetDictionary(&(s->stream), (const Bytef*) SvPVX(dictionary), SvCUR(dictionary)) ;
816 warn("deflateSetDictionary returned %d\n", err);
817 s->dict_adler = s->stream.adler ;
825 PostInitStream(s, flags, bufsize, windowBits) ;
832 SV* obj = sv_setref_pv(sv_newmortal(),
833 "Compress::Raw::Zlib::deflateStream", (void*)s);
836 if (GIMME == G_ARRAY) {
837 SV * sv = sv_2mortal(newSViv(err)) ;
838 setDUALstatus(sv, err);
843 _inflateInit(flags, windowBits, bufsize, dictionary)
856 croak("inflateScanInit needs zlib 1.2.1 or better");
859 warn("in _inflateInit(windowBits=%d, bufsize=%lu, dictionary=%lu\n",
860 windowBits, bufsize, (unsigned long)SvCUR(dictionary)) ;
861 if ((s = InitStream() )) {
863 s->WindowBits = windowBits;
865 err = inflateInit2(&(s->stream), windowBits);
870 else if (sv_len(dictionary)) {
871 #ifdef AT_LEAST_ZLIB_1_2_2_1
872 /* Zlib 1.2.2.1 or better allows a dictionary with raw inflate */
873 if (s->WindowBits < 0) {
875 const Bytef* b = (const Bytef*)SvPVbyte(dictionary, dlen);
876 err = inflateSetDictionary(&(s->stream),
885 /* Dictionary specified - take a copy for use in inflate */
886 s->dictionary = newSVsv(dictionary) ;
889 PostInitStream(s, flags, bufsize, windowBits) ;
893 s->window = (unsigned char *)safemalloc(WINDOW_SIZE);
902 SV* obj = sv_setref_pv(sv_newmortal(),
904 ? "Compress::Raw::Zlib::inflateScanStream"
905 : "Compress::Raw::Zlib::inflateStream",
909 if (GIMME == G_ARRAY) {
910 SV * sv = sv_2mortal(newSViv(err)) ;
911 setDUALstatus(sv, err);
917 MODULE = Compress::Raw::Zlib PACKAGE = Compress::Raw::Zlib::deflateStream
920 DispStream(s, message=NULL)
921 Compress::Raw::Zlib::deflateStream s
926 Compress::Raw::Zlib::deflateStream s
928 RETVAL = deflateReset(&(s->stream)) ;
929 if (RETVAL == Z_OK) {
930 PostInitStream(s, s->flags, s->bufsize, s->WindowBits) ;
936 deflate (s, buf, output)
937 Compress::Raw::Zlib::deflateStream s
940 uInt cur_length = NO_INIT
941 uInt increment = NO_INIT
942 uInt prefix = NO_INIT
944 uLong bufinc = NO_INIT
945 STRLEN origlen = NO_INIT
949 /* If the input buffer is a reference, dereference it */
950 buf = deRef(buf, "deflate") ;
952 /* initialise the input buffer */
953 #ifdef UTF8_AVAILABLE
954 if (DO_UTF8(buf) && !sv_utf8_downgrade(buf, 1))
955 croak("Wide character in Compress::Raw::Zlib::Deflate::deflate input parameter");
957 s->stream.next_in = (Bytef*)SvPV_nomg(buf, origlen) ;
958 s->stream.avail_in = origlen;
960 if (s->flags & FLAG_CRC32)
961 s->crc32 = crc32(s->crc32, s->stream.next_in, s->stream.avail_in) ;
963 if (s->flags & FLAG_ADLER32)
964 s->adler32 = adler32(s->adler32, s->stream.next_in, s->stream.avail_in) ;
966 /* and retrieve the output buffer */
967 output = deRef_l(output, "deflate") ;
968 #ifdef UTF8_AVAILABLE
969 if (DO_UTF8(output) && !sv_utf8_downgrade(output, 1))
970 croak("Wide character in Compress::Raw::Zlib::Deflate::deflate output parameter");
973 if((s->flags & FLAG_APPEND) != FLAG_APPEND) {
974 SvCUR_set(output, 0);
975 /* sv_setpvn(output, "", 0); */
977 prefix = cur_length = SvCUR(output) ;
978 s->stream.next_out = (Bytef*) SvPVX(output) + cur_length;
979 increment = SvLEN(output) - cur_length;
980 s->stream.avail_out = increment;
982 /* Check for saved output from deflateParams */
983 if (s->deflateParams_out_valid) {
984 *(s->stream.next_out) = s->deflateParams_out_byte;
985 ++ s->stream.next_out;
986 -- s->stream.avail_out ;
987 s->deflateParams_out_valid = FALSE;
990 /* Check for saved output from deflateParams */
991 if (s->deflateParams_out_length) {
992 uLong plen = s->deflateParams_out_length ;
993 /* printf("Copy %d bytes saved data\n", plen);*/
994 if (s->stream.avail_out < plen) {
995 /*printf("GROW from %d to %d\n", s->stream.avail_out,
996 SvLEN(output) + plen - s->stream.avail_out); */
997 Sv_Grow(output, SvLEN(output) + plen - s->stream.avail_out) ;
1000 Copy(s->stream.next_out, s->deflateParams_out_buffer, plen, Bytef) ;
1001 cur_length = cur_length + plen;
1002 SvCUR_set(output, cur_length);
1003 s->stream.next_out += plen ;
1004 s->stream.avail_out = SvLEN(output) - cur_length ;
1005 increment = s->stream.avail_out;
1006 s->deflateParams_out_length = 0;
1010 while (s->stream.avail_in != 0) {
1012 if (s->stream.avail_out == 0) {
1013 /* out of space in the output buffer so make it bigger */
1014 s->stream.next_out = (Bytef*) Sv_Grow(output, SvLEN(output) + bufinc) ;
1015 cur_length += increment ;
1016 s->stream.next_out += cur_length ;
1017 increment = bufinc ;
1018 s->stream.avail_out = increment;
1023 printf("DEFLATE Avail In %d, Out %d\n", s->stream.avail_in, s->stream.avail_out);
1024 DispStream(s, "BEFORE");
1025 /* Perl_sv_dump(output); */
1028 RETVAL = deflate(&(s->stream), Z_NO_FLUSH);
1031 printf("DEFLATE returned %d %s, avail in %d, out %d\n", RETVAL,
1032 GetErrorString(RETVAL), s->stream.avail_in, s->stream.avail_out);
1033 DispStream(s, "AFTER");
1040 s->compressedBytes += cur_length + increment - prefix - s->stream.avail_out ;
1041 s->uncompressedBytes += origlen - s->stream.avail_in ;
1043 s->last_error = RETVAL ;
1044 if (RETVAL == Z_OK) {
1046 SvCUR_set(output, cur_length + increment - s->stream.avail_out) ;
1055 Compress::Raw::Zlib::deflateStream s
1058 printf("Compress::Raw::Zlib::deflateStream::DESTROY %p\n", s);
1059 deflateEnd(&s->stream) ;
1061 SvREFCNT_dec(s->dictionary) ;
1063 if (s->deflateParams_out_buffer)
1064 Safefree(s->deflateParams_out_buffer);
1070 flush(s, output, f=Z_FINISH)
1071 Compress::Raw::Zlib::deflateStream s
1074 uInt cur_length = NO_INIT
1075 uInt increment = NO_INIT
1076 uInt prefix = NO_INIT
1077 uLong bufinc = NO_INIT
1078 uLong availableout = NO_INIT
1080 bufinc = s->bufsize;
1082 s->stream.avail_in = 0; /* should be zero already anyway */
1084 /* retrieve the output buffer */
1085 output = deRef_l(output, "flush") ;
1086 #ifdef UTF8_AVAILABLE
1087 if (DO_UTF8(output) && !sv_utf8_downgrade(output, 1))
1088 croak("Wide character in Compress::Raw::Zlib::Deflate::flush input parameter");
1090 if(! s->flags & FLAG_APPEND) {
1091 SvCUR_set(output, 0);
1092 /* sv_setpvn(output, "", 0); */
1094 prefix = cur_length = SvCUR(output) ;
1095 s->stream.next_out = (Bytef*) SvPVX(output) + cur_length;
1096 increment = SvLEN(output) - cur_length;
1097 s->stream.avail_out = increment;
1099 /* Check for saved output from deflateParams */
1100 if (s->deflateParams_out_valid) {
1101 *(s->stream.next_out) = s->deflateParams_out_byte;
1102 ++ s->stream.next_out;
1103 -- s->stream.avail_out ;
1104 s->deflateParams_out_valid = FALSE;
1107 /* Check for saved output from deflateParams */
1108 if (s->deflateParams_out_length) {
1109 uLong plen = s->deflateParams_out_length ;
1110 /* printf("Copy %d bytes saved data\n", plen); */
1111 if (s->stream.avail_out < plen) {
1112 /* printf("GROW from %d to %d\n", s->stream.avail_out,
1113 SvLEN(output) + plen - s->stream.avail_out); */
1114 Sv_Grow(output, SvLEN(output) + plen - s->stream.avail_out) ;
1117 Copy(s->stream.next_out, s->deflateParams_out_buffer, plen, Bytef) ;
1118 cur_length = cur_length + plen;
1119 SvCUR_set(output, cur_length);
1120 s->stream.next_out += plen ;
1121 s->stream.avail_out = SvLEN(output) - cur_length ;
1122 increment = s->stream.avail_out;
1123 s->deflateParams_out_length = 0;
1128 if (s->stream.avail_out == 0) {
1129 /* consumed all the available output, so extend it */
1130 s->stream.next_out = (Bytef*) Sv_Grow(output, SvLEN(output) + bufinc) ;
1131 cur_length += increment ;
1132 s->stream.next_out += cur_length ;
1133 increment = bufinc ;
1134 s->stream.avail_out = increment;
1138 availableout = s->stream.avail_out ;
1141 printf("flush (%d) DEFLATE Avail In %d, Out %d\n", f, s->stream.avail_in, s->stream.avail_out);
1142 DispStream(s, "BEFORE");
1143 /* Perl_sv_dump(output); */
1146 RETVAL = deflate(&(s->stream), f);
1149 printf("flush DEFLATE returned %d %s, avail in %d, out %d\n", RETVAL,
1150 GetErrorString(RETVAL), s->stream.avail_in, s->stream.avail_out);
1151 DispStream(s, "AFTER");
1154 /* Ignore the second of two consecutive flushes: */
1155 if (availableout == s->stream.avail_out && RETVAL == Z_BUF_ERROR)
1158 /* deflate has finished flushing only when it hasn't used up
1159 * all the available space in the output buffer:
1161 if (s->stream.avail_out != 0 || RETVAL != Z_OK )
1165 RETVAL = (RETVAL == Z_STREAM_END ? Z_OK : RETVAL) ;
1166 s->last_error = RETVAL ;
1168 s->compressedBytes += cur_length + increment - prefix - s->stream.avail_out ;
1170 if (RETVAL == Z_OK) {
1172 SvCUR_set(output, cur_length + increment - s->stream.avail_out) ;
1180 _deflateParams(s, flags, level, strategy, bufsize)
1181 Compress::Raw::Zlib::deflateStream s
1187 /* printf("_deflateParams(Flags %d Level %d Strategy %d Bufsize %d)\n", flags, level, strategy, bufsize);
1188 printf("Before -- Level %d, Strategy %d, Bufsize %d\n", s->Level, s->Strategy, s->bufsize); */
1192 s->Strategy = strategy ;
1194 s->bufsize = bufsize;
1196 /* printf("After -- Level %d, Strategy %d, Bufsize %d\n", s->Level, s->Strategy, s->bufsize);*/
1198 s->stream.avail_in = 0;
1199 s->stream.next_out = &(s->deflateParams_out_byte) ;
1200 s->stream.avail_out = 1;
1201 RETVAL = deflateParams(&(s->stream), s->Level, s->Strategy);
1202 s->deflateParams_out_valid =
1203 (RETVAL == Z_OK && s->stream.avail_out == 0) ;
1204 /* printf("RETVAL %d, avail out %d, byte %c\n", RETVAL, s->stream.avail_out, s->deflateParams_out_byte); */
1206 /* printf("Level %d Strategy %d, Prev Len %d\n",
1207 s->Level, s->Strategy, s->deflateParams_out_length); */
1208 s->stream.avail_in = 0;
1209 if (s->deflateParams_out_buffer == NULL)
1210 s->deflateParams_out_buffer = safemalloc(deflateParams_BUFFER_SIZE);
1211 s->stream.next_out = s->deflateParams_out_buffer ;
1212 s->stream.avail_out = deflateParams_BUFFER_SIZE;
1214 RETVAL = deflateParams(&(s->stream), s->Level, s->Strategy);
1215 s->deflateParams_out_length = deflateParams_BUFFER_SIZE - s->stream.avail_out;
1216 /* printf("RETVAL %d, length out %d, avail %d\n",
1217 RETVAL, s->deflateParams_out_length, s->stream.avail_out ); */
1225 Compress::Raw::Zlib::deflateStream s
1233 Compress::Raw::Zlib::deflateStream s
1235 RETVAL = s->Strategy ;
1242 Compress::Raw::Zlib::deflateStream s
1244 RETVAL = s->bufsize ;
1251 Compress::Raw::Zlib::deflateStream s
1253 RETVAL = s->last_error ;
1259 Compress::Raw::Zlib::deflateStream s
1267 Compress::Raw::Zlib::deflateStream s
1269 RETVAL = s->dict_adler ;
1275 Compress::Raw::Zlib::deflateStream s
1277 RETVAL = s->adler32 ;
1283 Compress::Raw::Zlib::deflateStream s
1285 RETVAL = s->compressedBytes;
1290 uncompressedBytes(s)
1291 Compress::Raw::Zlib::deflateStream s
1293 RETVAL = s->uncompressedBytes;
1299 Compress::Raw::Zlib::deflateStream s
1301 RETVAL = s->stream.total_in ;
1307 Compress::Raw::Zlib::deflateStream s
1309 RETVAL = s->stream.total_out ;
1315 Compress::Raw::Zlib::deflateStream s
1317 RETVAL = s->stream.msg;
1322 deflateTune(s, good_length, max_lazy, nice_length, max_chain)
1323 Compress::Raw::Zlib::deflateStream s
1329 #ifndef AT_LEAST_ZLIB_1_2_2_3
1330 good_length = good_length; max_lazy = max_lazy ; /* Silence -Wall */
1331 nice_length = nice_length; max_chain = max_chain; /* Silence -Wall */
1332 croak("deflateTune needs zlib 1.2.2.3 or better");
1334 RETVAL = deflateTune(&(s->stream), good_length, max_lazy, nice_length, max_chain);
1340 MODULE = Compress::Raw::Zlib PACKAGE = Compress::Raw::Zlib::inflateStream
1343 DispStream(s, message=NULL)
1344 Compress::Raw::Zlib::inflateStream s
1345 const char * message
1349 Compress::Raw::Zlib::inflateStream s
1351 RETVAL = inflateReset(&(s->stream)) ;
1352 if (RETVAL == Z_OK) {
1353 PostInitStream(s, s->flags, s->bufsize, s->WindowBits) ;
1359 inflate (s, buf, output, eof=FALSE)
1360 Compress::Raw::Zlib::inflateStream s
1364 uInt cur_length = 0;
1365 uInt prefix_length = 0;
1367 uLong bufinc = NO_INIT
1368 STRLEN na = NO_INIT ;
1370 #ifdef UTF8_AVAILABLE
1371 bool out_utf8 = FALSE;
1375 bufinc = s->bufsize;
1376 /* If the buffer is a reference, dereference it */
1377 buf = deRef(buf, "inflate") ;
1379 if (s->flags & FLAG_CONSUME_INPUT) {
1380 if (SvREADONLY(buf))
1381 croak("Compress::Raw::Zlib::Inflate::inflate input parameter cannot be read-only when ConsumeInput is specified");
1382 SvPV_force(buf, na);
1384 #ifdef UTF8_AVAILABLE
1385 if (DO_UTF8(buf) && !sv_utf8_downgrade(buf, 1))
1386 croak("Wide character in Compress::Raw::Zlib::Inflate::inflate input parameter");
1389 /* initialise the input buffer */
1390 s->stream.next_in = (Bytef*)SvPV_nomg(buf, origlen) ;
1391 s->stream.avail_in = origlen ;
1393 /* and retrieve the output buffer */
1394 output = deRef_l(output, "inflate") ;
1395 #ifdef UTF8_AVAILABLE
1396 if (DO_UTF8(output))
1398 if (DO_UTF8(output) && !sv_utf8_downgrade(output, 1))
1399 croak("Wide character in Compress::Raw::Zlib::Inflate::inflate output parameter");
1401 if((s->flags & FLAG_APPEND) != FLAG_APPEND) {
1402 SvCUR_set(output, 0);
1405 /* Assume no output buffer - the code below will update if there is any available */
1406 s->stream.avail_out = 0;
1409 if (SvLEN(output)) {
1410 prefix_length = cur_length = SvCUR(output) ;
1412 if (s->flags & FLAG_LIMIT_OUTPUT && SvLEN(output) - cur_length - 1 < bufinc)
1414 Sv_Grow(output, bufinc + cur_length + 1) ;
1417 /* Only setup the stream output pointers if there is spare
1418 capacity in the outout SV
1420 if (SvLEN(output) > cur_length + 1)
1422 s->stream.next_out = (Bytef*) SvPV_nomg_nolen(output) + cur_length;
1423 increment = SvLEN(output) - cur_length - 1;
1424 s->stream.avail_out = increment;
1429 s->bytesInflated = 0;
1433 while (RETVAL == Z_OK) {
1434 if (s->stream.avail_out == 0) {
1435 /* out of space in the output buffer so make it bigger */
1436 s->stream.next_out = (Bytef*) Sv_Grow(output, SvLEN(output) + bufinc +1) ;
1437 cur_length += increment ;
1438 s->stream.next_out += cur_length ;
1439 increment = bufinc ;
1440 s->stream.avail_out = increment;
1444 /* printf("INFLATE Availl In %d, Out %d\n", s->stream.avail_in,
1445 s->stream.avail_out);
1446 DispStream(s, "BEFORE");
1447 Perl_sv_dump(output); */
1448 RETVAL = inflate(&(s->stream), Z_SYNC_FLUSH);
1449 /* printf("INFLATE returned %d %s, avail in %d, out %d\n", RETVAL,
1450 GetErrorString(RETVAL), s->stream.avail_in, s->stream.avail_out); */
1453 if (RETVAL == Z_NEED_DICT && s->dictionary) {
1455 const Bytef* b = (const Bytef*)SvPV(s->dictionary, dlen) ;
1456 s->dict_adler = s->stream.adler ;
1457 RETVAL = inflateSetDictionary(&(s->stream),
1463 if (s->flags & FLAG_LIMIT_OUTPUT &&
1464 (RETVAL == Z_OK || RETVAL == Z_BUF_ERROR )) {
1465 if (s->stream.avail_out == 0)
1466 RETVAL = Z_BUF_ERROR;
1469 if (s->flags & FLAG_LIMIT_OUTPUT &&
1470 (RETVAL == Z_OK || RETVAL == Z_BUF_ERROR ))
1473 if (RETVAL == Z_STREAM_ERROR || RETVAL == Z_MEM_ERROR ||
1474 RETVAL == Z_DATA_ERROR || RETVAL == Z_STREAM_END )
1477 if (RETVAL == Z_BUF_ERROR) {
1478 if (s->stream.avail_out == 0)
1480 if (s->stream.avail_in == 0) {
1486 #ifdef NEED_DUMMY_BYTE_AT_END
1487 if (eof && RETVAL == Z_OK && s->flags & FLAG_LIMIT_OUTPUT == 0) {
1488 Bytef* nextIn = s->stream.next_in;
1489 uInt availIn = s->stream.avail_in;
1490 s->stream.next_in = (Bytef*) " ";
1491 s->stream.avail_in = 1;
1492 if (s->stream.avail_out == 0) {
1493 /* out of space in the output buffer so make it bigger */
1494 s->stream.next_out = Sv_Grow(output, SvLEN(output) + bufinc) ;
1495 cur_length += increment ;
1496 s->stream.next_out += cur_length ;
1497 increment = bufinc ;
1498 s->stream.avail_out = increment;
1501 RETVAL = inflate(&(s->stream), Z_SYNC_FLUSH);
1502 s->stream.next_in = nextIn ;
1503 s->stream.avail_in = availIn ;
1506 PERL_UNUSED_VAR(eof);
1509 s->last_error = RETVAL ;
1510 if (RETVAL == Z_OK || RETVAL == Z_STREAM_END || RETVAL == Z_BUF_ERROR || RETVAL == Z_DATA_ERROR) {
1513 s->bytesInflated = cur_length + increment - s->stream.avail_out - prefix_length;
1514 s->uncompressedBytes += s->bytesInflated ;
1515 s->compressedBytes += origlen - s->stream.avail_in ;
1518 SvCUR_set(output, prefix_length + s->bytesInflated) ;
1519 *SvEND(output) = '\0';
1520 #ifdef UTF8_AVAILABLE
1522 sv_utf8_upgrade(output);
1526 if (s->flags & FLAG_CRC32 )
1527 s->crc32 = crc32(s->crc32,
1528 (const Bytef*)SvPVX(output)+prefix_length,
1529 SvCUR(output)-prefix_length) ;
1531 if (s->flags & FLAG_ADLER32)
1532 s->adler32 = adler32(s->adler32,
1533 (const Bytef*)SvPVX(output)+prefix_length,
1534 SvCUR(output)-prefix_length) ;
1536 /* fix the input buffer */
1537 if (s->flags & FLAG_CONSUME_INPUT || s->flags & FLAG_LIMIT_OUTPUT) {
1538 in = s->stream.avail_in ;
1539 SvCUR_set(buf, in) ;
1541 Move(s->stream.next_in, SvPVX(buf), in, char) ;
1552 Compress::Raw::Zlib::inflateStream s
1554 RETVAL = s->bytesInflated;
1560 Compress::Raw::Zlib::inflateStream s
1562 RETVAL = s->compressedBytes;
1567 uncompressedBytes(s)
1568 Compress::Raw::Zlib::inflateStream s
1570 RETVAL = s->uncompressedBytes;
1576 inflateSync (s, buf)
1577 Compress::Raw::Zlib::inflateStream s
1581 /* If the buffer is a reference, dereference it */
1582 buf = deRef(buf, "inflateSync") ;
1583 #ifdef UTF8_AVAILABLE
1584 if (DO_UTF8(buf) && !sv_utf8_downgrade(buf, 1))
1585 croak("Wide character in Compress::Raw::Zlib::Inflate::inflateSync");
1588 /* initialise the input buffer */
1589 s->stream.next_in = (Bytef*)SvPV_force_nomg_nolen(buf) ;
1590 s->stream.avail_in = SvCUR(buf) ;
1592 /* inflateSync doesn't create any output */
1593 s->stream.next_out = (Bytef*) NULL;
1594 s->stream.avail_out = 0;
1596 RETVAL = inflateSync(&(s->stream));
1597 s->last_error = RETVAL ;
1599 /* fix the input buffer */
1601 unsigned in = s->stream.avail_in ;
1602 SvCUR_set(buf, in) ;
1604 Move(s->stream.next_in, SvPVX(buf), in, char) ;
1613 Compress::Raw::Zlib::inflateStream s
1615 inflateEnd(&s->stream) ;
1617 SvREFCNT_dec(s->dictionary) ;
1619 if (s->deflateParams_out_buffer)
1620 Safefree(s->deflateParams_out_buffer);
1624 Safefree(s->window);
1631 Compress::Raw::Zlib::inflateStream s
1633 RETVAL = s->last_error ;
1639 Compress::Raw::Zlib::inflateStream s
1647 Compress::Raw::Zlib::inflateStream s
1649 RETVAL = s->dict_adler ;
1655 Compress::Raw::Zlib::inflateStream s
1657 RETVAL = s->stream.total_in ;
1663 Compress::Raw::Zlib::inflateStream s
1665 RETVAL = s->adler32 ;
1671 Compress::Raw::Zlib::inflateStream s
1673 RETVAL = s->stream.total_out ;
1679 Compress::Raw::Zlib::inflateStream s
1681 RETVAL = s->stream.msg;
1688 Compress::Raw::Zlib::inflateStream s
1690 RETVAL = s->bufsize ;
1696 Compress::Raw::Zlib::inflateStream s
1699 RETVAL = ((s->flags & FLAG_APPEND) == FLAG_APPEND);
1701 s->flags |= FLAG_APPEND ;
1703 s->flags &= ~FLAG_APPEND ;
1707 MODULE = Compress::Raw::Zlib PACKAGE = Compress::Raw::Zlib::inflateScanStream
1711 Compress::Raw::Zlib::inflateScanStream s
1713 inflateEnd(&s->stream) ;
1715 SvREFCNT_dec(s->dictionary) ;
1717 if (s->deflateParams_out_buffer)
1718 Safefree(s->deflateParams_out_buffer);
1722 Safefree(s->window);
1727 DispStream(s, message=NULL)
1728 Compress::Raw::Zlib::inflateScanStream s
1729 const char * message
1733 Compress::Raw::Zlib::inflateScanStream s
1735 RETVAL = inflateReset(&(s->stream)) ;
1736 if (RETVAL == Z_OK) {
1737 PostInitStream(s, s->flags, s->bufsize, s->WindowBits) ;
1743 scan(s, buf, out=NULL, eof=FALSE)
1744 Compress::Raw::Zlib::inflateScanStream s
1748 bool eof_mode = FALSE;
1749 int start_len = NO_INIT
1751 PERL_UNUSED_VAR(out);
1752 PERL_UNUSED_VAR(eof);
1753 /* If the input buffer is a reference, dereference it */
1754 #ifndef MAGIC_APPEND
1756 croak("scan needs zlib 1.2.1 or better");
1758 buf = deRef(buf, "inflateScan") ;
1759 #ifdef UTF8_AVAILABLE
1760 if (DO_UTF8(buf) && !sv_utf8_downgrade(buf, 1))
1761 croak("Wide character in Compress::Raw::Zlib::InflateScan::scan input parameter");
1763 /* initialise the input buffer */
1764 s->stream.next_in = (Bytef*)SvPV_force_nomg_nolen(buf) ;
1765 s->stream.avail_in = SvCUR(buf) ;
1766 start_len = s->stream.avail_in ;
1767 s->bytesInflated = 0 ;
1770 if (s->stream.avail_in == 0) {
1775 /* set up output to next available section of sliding window */
1776 s->stream.avail_out = WINDOW_SIZE - s->window_have;
1777 s->stream.next_out = s->window + s->window_have;
1779 /* DispStream(s, "before inflate\n"); */
1781 /* inflate and check for errors */
1782 RETVAL = inflate(&(s->stream), Z_BLOCK);
1784 if (start_len > 1 && ! eof_mode)
1785 s->window_lastByte = *(s->stream.next_in - 1 ) ;
1787 if (RETVAL == Z_STREAM_ERROR || RETVAL == Z_MEM_ERROR ||
1788 RETVAL == Z_DATA_ERROR )
1791 if (s->flags & FLAG_CRC32 )
1792 s->crc32 = crc32(s->crc32, s->window + s->window_have,
1793 WINDOW_SIZE - s->window_have - s->stream.avail_out);
1795 if (s->flags & FLAG_ADLER32)
1796 s->adler32 = adler32(s->adler32, s->window + s->window_have,
1797 WINDOW_SIZE - s->window_have - s->stream.avail_out);
1799 s->uncompressedBytes =
1800 s->bytesInflated += WINDOW_SIZE - s->window_have - s->stream.avail_out;
1802 if (s->stream.avail_out)
1803 s->window_have = WINDOW_SIZE - s->stream.avail_out;
1809 /* process end of block */
1810 if (s->stream.data_type & 128) {
1811 if (s->stream.data_type & 64) {
1812 s->window_left = s->stream.data_type & 0x1f;
1815 s->window_lastbit = s->stream.data_type & 0x1f;
1816 s->lastBlockOffset = s->stream.total_in;
1820 } while (RETVAL != Z_STREAM_END);
1822 s->last_error = RETVAL ;
1823 s->window_lastoff = s->stream.total_in ;
1824 s->compressedBytes += SvCUR(buf) - s->stream.avail_in ;
1826 if (RETVAL == Z_STREAM_END)
1828 s->matchedEndBlock = 1 ;
1830 /* save the location of the end of the compressed data */
1831 s->window_end = SvCUR(buf) - s->stream.avail_in - 1 ;
1832 s->window_endOffset = s->stream.total_in ;
1835 -- s->window_endOffset ;
1838 /* if window wrapped, build dictionary from window by rotating */
1839 if (s->window_full) {
1840 rotate(s->window, WINDOW_SIZE, s->window_have);
1841 s->window_have = WINDOW_SIZE;
1844 /* if (s->flags & FLAG_CONSUME_INPUT) { */
1846 unsigned in = s->stream.avail_in ;
1847 SvCUR_set(buf, in) ;
1849 Move(s->stream.next_in, SvPVX(buf), in, char) ;
1861 Compress::Raw::Zlib::inflateScanStream s
1863 #ifndef MAGIC_APPEND
1864 croak("getEndOffset needs zlib 1.2.1 or better");
1866 RETVAL = s->window_endOffset;
1873 Compress::Raw::Zlib::inflateScanStream s
1875 #ifndef MAGIC_APPEND
1876 croak("inflateCount needs zlib 1.2.1 or better");
1878 RETVAL = s->bytesInflated;
1885 Compress::Raw::Zlib::inflateScanStream s
1887 RETVAL = s->compressedBytes;
1892 uncompressedBytes(s)
1893 Compress::Raw::Zlib::inflateScanStream s
1895 RETVAL = s->uncompressedBytes;
1901 getLastBlockOffset(s)
1902 Compress::Raw::Zlib::inflateScanStream s
1904 #ifndef MAGIC_APPEND
1905 croak("getLastBlockOffset needs zlib 1.2.1 or better");
1907 RETVAL = s->lastBlockOffset - (s->window_lastbit != 0);
1913 getLastBufferOffset(s)
1914 Compress::Raw::Zlib::inflateScanStream s
1916 #ifndef MAGIC_APPEND
1917 croak("getLastBufferOffset needs zlib 1.2.1 or better");
1919 RETVAL = s->window_lastoff;
1925 resetLastBlockByte(s, byte)
1926 Compress::Raw::Zlib::inflateScanStream s
1929 #ifndef MAGIC_APPEND
1930 croak("resetLastBlockByte needs zlib 1.2.1 or better");
1933 *byte = *byte ^ (1 << ((8 - s->window_lastbit) & 7));
1938 _createDeflateStream(inf_s, flags,level, method, windowBits, memLevel, strategy, bufsize)
1939 Compress::Raw::Zlib::inflateScanStream inf_s
1949 #ifndef MAGIC_APPEND
1953 windowBits = windowBits;
1954 memLevel = memLevel;
1955 strategy = strategy;
1957 croak("_createDeflateStream needs zlib 1.2.1 or better");
1963 warn("in _createDeflateStream(level=%d, method=%d, windowBits=%d, memLevel=%d, strategy=%d, bufsize=%lu\n",
1964 level, method, windowBits, memLevel, strategy, bufsize) ;
1965 if ((s = InitStream() )) {
1969 s->WindowBits = windowBits;
1970 s->MemLevel = memLevel;
1971 s->Strategy = strategy;
1973 err = deflateInit2(&(s->stream), level,
1974 method, windowBits, memLevel, strategy);
1977 err = deflateSetDictionary(&(s->stream), inf_s->window, inf_s->window_have);
1978 s->dict_adler = s->stream.adler ;
1986 PostInitStream(s, flags, bufsize, windowBits) ;
1987 s->crc32 = inf_s->crc32;
1988 s->adler32 = inf_s->adler32;
1989 s->stream.adler = inf_s->stream.adler ;
1990 /* s->stream.total_out = inf_s->bytesInflated ; */
1991 s->stream.total_in = inf_s->stream.total_out ;
1992 if (inf_s->window_left) {
1993 /* printf("** window_left %d, window_lastByte %d\n", inf_s->window_left, inf_s->window_lastByte); */
1994 deflatePrime(&(s->stream), 8 - inf_s->window_left, inf_s->window_lastByte);
2001 XPUSHs(sv_setref_pv(sv_newmortal(),
2002 "Compress::Raw::Zlib::deflateStream", (void*)s));
2003 if (GIMME == G_ARRAY) {
2004 SV * sv = sv_2mortal(newSViv(err)) ;
2005 setDUALstatus(sv, err);
2013 Compress::Raw::Zlib::inflateScanStream s
2015 RETVAL = s->last_error ;
2021 Compress::Raw::Zlib::inflateScanStream s
2030 Compress::Raw::Zlib::inflateScanStream s
2032 RETVAL = s->adler32 ;