24#if defined(MSDOS) || defined(OS2) || defined(WIN32) || defined(__CYGWIN__)
27# define SET_BINARY_MODE(file) setmode(fileno(file), O_BINARY)
29# define SET_BINARY_MODE(file)
61 *err = aprintf(__VA_ARGS__); \
104 unsigned long crc = 0;
105 unsigned long len = 0;
106 unsigned long buf = 0;
111 fwrite(
"\x1f\x8b\x08\0\0\0\0\0\0\xff", 1, 10,
out);
122 unsigned long long memb;
127 unsigned char dat[
CHUNK];
145 unsigned char scrap[
CHUNK];
150 BYE(
"out of memory");
152 BYE(
"input invalid: %s", strm.
msg);
154 BYE(
"internal error");
162 BYE(
"overflow error");
237 if (
num - prev < 3) {
244 unsigned long last = (
unsigned long)1 << prev;
246 if (((
buf >> prev) & 7) == 3) {
251 if (
num - prev < 10) {
259 if (((
buf >> prev) & 0x3ff) == 3) {
267 else if (((
buf >> prev) & 6) == 0) {
270 num = (prev + 10) & ~7;
309 unsigned char *end = strm.
next_in - mix;
315 buf += (unsigned)(*put++) <<
num;
321 fwrite(put, 1, end - put,
out);
329 buf += (unsigned)(*put++) <<
num;
388 part = (part >> 8) + ((
unsigned long)(*put++) << 24);
393 if (len2 < 0 || (
unsigned long long)len2 != memb)
394 BYE(
"overflow error");
398 else if (tail == 8) {
407 BYE(
"internal error");
425 if (
state != BETWEEN)
426 BYE(
"input invalid: incomplete gzip stream");
440 putc(crc >> 16,
out);
441 putc(crc >> 24,
out);
467 fprintf(stderr,
"gznorm error: %s\n",
err);
int bits(struct state *s, int need)
uLong ZEXPORT crc32_combine(uLong crc1, uLong crc2, z_off_t len2)
char str[HTML_ESCAPE_MAX_LEN+1]
unsigned in(void *in_desc, z_const unsigned char **buf)
#define SET_BINARY_MODE(file)
char * aprintf(char *fmt,...)
int gzip_normalize(FILE *in, FILE *out, char **err)
int ZEXPORT inflate(z_streamp strm, int flush)
int ZEXPORT inflateReset(z_streamp strm)
int ZEXPORT inflateEnd(z_streamp strm)
typedef long(ZCALLBACK *tell_file_func) OF((voidpf opaque
#define inflateInit2(strm, windowBits)