revert previous. we don't want to change upstream code.

This commit is contained in:
christos 2019-02-19 00:26:57 +00:00
parent e3f676fd0b
commit f26e8b9db6

View File

@ -1,4 +1,4 @@
/* $NetBSD: zlib.c,v 1.35 2019/02/18 23:13:14 christos Exp $ */ /* $NetBSD: zlib.c,v 1.36 2019/02/19 00:26:57 christos Exp $ */
/* /*
* This file is derived from various .h and .c files from the zlib-1.0.4 * This file is derived from various .h and .c files from the zlib-1.0.4
* distribution by Jean-loup Gailly and Mark Adler, with some additions * distribution by Jean-loup Gailly and Mark Adler, with some additions
@ -11,7 +11,7 @@
* - added inflateIncomp and deflateOutputPending * - added inflateIncomp and deflateOutputPending
* - allow strm->next_out to be NULL, meaning discard the output * - allow strm->next_out to be NULL, meaning discard the output
* *
* $Id: zlib.c,v 1.35 2019/02/18 23:13:14 christos Exp $ * $Id: zlib.c,v 1.36 2019/02/19 00:26:57 christos Exp $
*/ */
/* /*
@ -22,7 +22,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: zlib.c,v 1.35 2019/02/18 23:13:14 christos Exp $"); __KERNEL_RCSID(0, "$NetBSD: zlib.c,v 1.36 2019/02/19 00:26:57 christos Exp $");
#define NO_DUMMY_DECL #define NO_DUMMY_DECL
#define NO_ZCFUNCS #define NO_ZCFUNCS
@ -45,7 +45,7 @@ __KERNEL_RCSID(0, "$NetBSD: zlib.c,v 1.35 2019/02/18 23:13:14 christos Exp $");
subject to change. Applications should only use zlib.h. subject to change. Applications should only use zlib.h.
*/ */
/* @(#) $Id: zlib.c,v 1.35 2019/02/18 23:13:14 christos Exp $ */ /* @(#) $Id: zlib.c,v 1.36 2019/02/19 00:26:57 christos Exp $ */
#ifndef _Z_UTIL_H #ifndef _Z_UTIL_H
#define _Z_UTIL_H #define _Z_UTIL_H
@ -294,7 +294,7 @@ void zcfree(voidpf opaque, voidpf ptr);
subject to change. Applications should only use zlib.h. subject to change. Applications should only use zlib.h.
*/ */
/* @(#) $Id: zlib.c,v 1.35 2019/02/18 23:13:14 christos Exp $ */ /* @(#) $Id: zlib.c,v 1.36 2019/02/19 00:26:57 christos Exp $ */
#ifndef _DEFLATE_H #ifndef _DEFLATE_H
#define _DEFLATE_H #define _DEFLATE_H
@ -656,7 +656,7 @@ void _tr_stored_type_only(deflate_state *);
* *
*/ */
/* @(#) $Id: zlib.c,v 1.35 2019/02/18 23:13:14 christos Exp $ */ /* @(#) $Id: zlib.c,v 1.36 2019/02/19 00:26:57 christos Exp $ */
/* #include "deflate.h" */ /* #include "deflate.h" */
@ -1999,7 +1999,7 @@ local block_state deflate_slow(deflate_state *s, int flush)
* Addison-Wesley, 1983. ISBN 0-201-06672-6. * Addison-Wesley, 1983. ISBN 0-201-06672-6.
*/ */
/* @(#) $Id: zlib.c,v 1.35 2019/02/18 23:13:14 christos Exp $ */ /* @(#) $Id: zlib.c,v 1.36 2019/02/19 00:26:57 christos Exp $ */
/* #define GEN_TREES_H */ /* #define GEN_TREES_H */
@ -3529,7 +3529,6 @@ int ZEXPORT inflate(z_streamp z, int f)
break; break;
} }
z->state->mode = FLAG; z->state->mode = FLAG;
/*FALLTHROUGH*/
case FLAG: case FLAG:
NEEDBYTE NEEDBYTE
b = NEXTBYTE; b = NEXTBYTE;
@ -3547,22 +3546,18 @@ int ZEXPORT inflate(z_streamp z, int f)
break; break;
} }
z->state->mode = DICT4; z->state->mode = DICT4;
/*FALLTHROUGH*/
case DICT4: case DICT4:
NEEDBYTE NEEDBYTE
z->state->sub.check.need = (uLong)NEXTBYTE << 24; z->state->sub.check.need = (uLong)NEXTBYTE << 24;
z->state->mode = DICT3; z->state->mode = DICT3;
/*FALLTHROUGH*/
case DICT3: case DICT3:
NEEDBYTE NEEDBYTE
z->state->sub.check.need += (uLong)NEXTBYTE << 16; z->state->sub.check.need += (uLong)NEXTBYTE << 16;
z->state->mode = DICT2; z->state->mode = DICT2;
/*FALLTHROUGH*/
case DICT2: case DICT2:
NEEDBYTE NEEDBYTE
z->state->sub.check.need += (uLong)NEXTBYTE << 8; z->state->sub.check.need += (uLong)NEXTBYTE << 8;
z->state->mode = DICT1; z->state->mode = DICT1;
/*FALLTHROUGH*/
case DICT1: case DICT1:
NEEDBYTE NEEDBYTE
z->state->sub.check.need += (uLong)NEXTBYTE; z->state->sub.check.need += (uLong)NEXTBYTE;
@ -3596,22 +3591,18 @@ int ZEXPORT inflate(z_streamp z, int f)
break; break;
} }
z->state->mode = CHECK4; z->state->mode = CHECK4;
/*FALLTHROUGH*/
case CHECK4: case CHECK4:
NEEDBYTE NEEDBYTE
z->state->sub.check.need = (uLong)NEXTBYTE << 24; z->state->sub.check.need = (uLong)NEXTBYTE << 24;
z->state->mode = CHECK3; z->state->mode = CHECK3;
/*FALLTHROUGH*/
case CHECK3: case CHECK3:
NEEDBYTE NEEDBYTE
z->state->sub.check.need += (uLong)NEXTBYTE << 16; z->state->sub.check.need += (uLong)NEXTBYTE << 16;
z->state->mode = CHECK2; z->state->mode = CHECK2;
/*FALLTHROUGH*/
case CHECK2: case CHECK2:
NEEDBYTE NEEDBYTE
z->state->sub.check.need += (uLong)NEXTBYTE << 8; z->state->sub.check.need += (uLong)NEXTBYTE << 8;
z->state->mode = CHECK1; z->state->mode = CHECK1;
/*FALLTHROUGH*/
case CHECK1: case CHECK1:
NEEDBYTE NEEDBYTE
z->state->sub.check.need += (uLong)NEXTBYTE; z->state->sub.check.need += (uLong)NEXTBYTE;
@ -3625,7 +3616,6 @@ int ZEXPORT inflate(z_streamp z, int f)
} }
Tracev((stderr, "inflate: zlib check ok\n")); Tracev((stderr, "inflate: zlib check ok\n"));
z->state->mode = DONE; z->state->mode = DONE;
/*FALLTHROUGH*/
case DONE: case DONE:
return Z_STREAM_END; return Z_STREAM_END;
case BAD: case BAD:
@ -4207,7 +4197,6 @@ int inflate_blocks(inflate_blocks_statef *s, z_streamp z, int r)
s->sub.trees.index = 0; s->sub.trees.index = 0;
Tracev((stderr, "inflate: bits tree ok\n")); Tracev((stderr, "inflate: bits tree ok\n"));
s->mode = DTREE; s->mode = DTREE;
/*FALLTHROUGH*/
case DTREE: case DTREE:
while (t = s->sub.trees.table, while (t = s->sub.trees.table,
s->sub.trees.index < 258 + (t & 0x1f) + ((t >> 5) & 0x1f)) s->sub.trees.index < 258 + (t & 0x1f) + ((t >> 5) & 0x1f))
@ -4283,7 +4272,6 @@ int inflate_blocks(inflate_blocks_statef *s, z_streamp z, int r)
} }
ZFREE(z, s->sub.trees.blens); ZFREE(z, s->sub.trees.blens);
s->mode = CODES; s->mode = CODES;
/*FALLTHROUGH*/
case CODES: case CODES:
UPDATE UPDATE
if ((r = inflate_codes(s, z, r)) != Z_STREAM_END) if ((r = inflate_codes(s, z, r)) != Z_STREAM_END)
@ -4300,13 +4288,11 @@ int inflate_blocks(inflate_blocks_statef *s, z_streamp z, int r)
break; break;
} }
s->mode = DRY; s->mode = DRY;
/*FALLTHROUGH*/
case DRY: case DRY:
FLUSH FLUSH
if (s->read != s->write) if (s->read != s->write)
LEAVE LEAVE
s->mode = DONEB; s->mode = DONEB;
/*FALLTHROUGH*/
case DONEB: case DONEB:
r = Z_STREAM_END; r = Z_STREAM_END;
LEAVE LEAVE
@ -5169,7 +5155,6 @@ int inflate_codes(inflate_blocks_statef *s, z_streamp z, int r)
c->sub.code.need = c->lbits; c->sub.code.need = c->lbits;
c->sub.code.tree = c->ltree; c->sub.code.tree = c->ltree;
c->mode = LEN; c->mode = LEN;
/*FALLTHROUGH*/
case LEN: /* i: get length/literal/eob next */ case LEN: /* i: get length/literal/eob next */
j = c->sub.code.need; j = c->sub.code.need;
NEEDBITS(j) NEEDBITS(j)
@ -5217,7 +5202,6 @@ int inflate_codes(inflate_blocks_statef *s, z_streamp z, int r)
c->sub.code.tree = c->dtree; c->sub.code.tree = c->dtree;
Tracevv((stderr, "inflate: length %u\n", c->len)); Tracevv((stderr, "inflate: length %u\n", c->len));
c->mode = DIST; c->mode = DIST;
/*FALLTHROUGH*/
case DIST: /* i: get distance next */ case DIST: /* i: get distance next */
j = c->sub.code.need; j = c->sub.code.need;
NEEDBITS(j) NEEDBITS(j)
@ -5248,7 +5232,6 @@ int inflate_codes(inflate_blocks_statef *s, z_streamp z, int r)
DUMPBITS(j) DUMPBITS(j)
Tracevv((stderr, "inflate: distance %u\n", c->sub.copy.dist)); Tracevv((stderr, "inflate: distance %u\n", c->sub.copy.dist));
c->mode = COPY; c->mode = COPY;
/*FALLTHROUGH*/
case COPY: /* o: copying bytes in window, waiting for space */ case COPY: /* o: copying bytes in window, waiting for space */
f = q - c->sub.copy.dist; f = q - c->sub.copy.dist;
while (f < s->window) /* modulo window size-"while" instead */ while (f < s->window) /* modulo window size-"while" instead */
@ -5280,7 +5263,6 @@ int inflate_codes(inflate_blocks_statef *s, z_streamp z, int r)
if (s->read != s->write) if (s->read != s->write)
LEAVE LEAVE
c->mode = END; c->mode = END;
/*FALLTHROUGH*/
case END: case END:
r = Z_STREAM_END; r = Z_STREAM_END;
LEAVE LEAVE
@ -5831,7 +5813,7 @@ void zcfree (opaque, ptr)
* For conditions of distribution and use, see copyright notice in zlib.h * For conditions of distribution and use, see copyright notice in zlib.h
*/ */
/* @(#) $Id: zlib.c,v 1.35 2019/02/18 23:13:14 christos Exp $ */ /* @(#) $Id: zlib.c,v 1.36 2019/02/19 00:26:57 christos Exp $ */
/* #include "zlib.h" */ /* #include "zlib.h" */