[Zlib-devel] Problem with inffast.S and inffas32.asm when NO_GZIP is #defined
Cosmin Truta
cosmin at cs.toronto.edu
Wed Oct 20 20:40:52 EDT 2004
On Wed, 20 Oct 2004, Chris Anderson wrote:
> On Wed, 2004-10-20 at 15:38, Cosmin Truta wrote:
> > I noticed the ASM inflation code fails when NO_GZIP is #defined. The
> > problem exists both in zlib 1.2.1 and 1.2.2 [...]
>
> Thanks. I think it may be the -DNO_GZIP was -DNO_GUNZIP at some point
> or somehow NO_GUNZIP got defined. inffas86.c is using the TYPE and
> BAD enums from inflate.h which change value with -DNO_GZIP, but
> inffast.S has an #ifdef NO_GUNZIP for those enum changes. I'll check
> to see if that's what is causing it... defining -DNO_GUNZIP as well as
> -DNO_GZIP should do it.
I see. I think there is an easier way out: to make the enum constants
independent on the particular configuration. This way, non-C
re-implementations (incl. the ASM one) do not have to check for
C-specific configuration hacks, such as the NO_GZIP macro.
This can be done without losing anything: nothing is gained by
#ifdef'ing out elements in an enum list, anyway.
[Testing...]
It works! You can remove the GUNZIP guard in inffast.S. I know that
inffast.S handles the C preprocessor macros just fine, but inffas32.asm
does not. This solution relieves the MASM users from an unnecessary
burden.
Best regards,
Cosmin
--- inflate.h~ Mon Sep 08 00:52:50 2003
+++ inflate.h Wed Oct 20 20:30:00 2004
@@ -19,7 +19,6 @@
/* Possible inflate modes between inflate() calls */
typedef enum {
HEAD, /* i: waiting for magic header */
-#ifdef GUNZIP
FLAGS, /* i: waiting for method and flags (gzip) */
TIME, /* i: waiting for modification time (gzip) */
OS, /* i: waiting for extra flags and operating system (gzip) */
@@ -28,7 +27,6 @@
NAME, /* i: waiting for end of file name (gzip) */
COMMENT, /* i: waiting for end of comment (gzip) */
HCRC, /* i: waiting for header crc (gzip) */
-#endif
DICTID, /* i: waiting for dictionary check value */
DICT, /* waiting for inflateSetDictionary() call */
TYPE, /* i: waiting for type bits, including last-flag bit */
@@ -45,9 +43,7 @@
MATCH, /* o: waiting for output space to copy string */
LIT, /* o: waiting for output space to write literal */
CHECK, /* i: waiting for 32-bit check value */
-#ifdef GUNZIP
LENGTH, /* i: waiting for 32-bit length (gzip) */
-#endif
DONE, /* finished check, done -- remain here until reset */
BAD, /* got a data error -- remain here until reset */
MEM, /* got an inflate() memory error -- remain here until reset */
More information about the Zlib-devel
mailing list