[Zlib-devel] GZ_NOCOMPRESS

Glenn Randers-Pehrson glennrp at comcast.net
Sat Jul 14 19:38:06 EDT 2007


The GZ_NOCOMPRESS macro isn't quite complete in zlib-1.2.3.3.  I was
using it to build a minimal PNG encoder and decoder (see today's
discussion on png-mng-implement, and contrib/pngminim/* in
libpng-1.2.19beta24), and ran into a couple of minor problems,
although was able to work around them.

deflate.c and compress.c should be wrapped in #ifndef NO_GZCOMPRESS/#endif.
In gzio.c there is a call to deflateParams() which should also be wrapped
in #ifndef NO_GZCOMPRESS, with an #else branch that returns Z_OK or something
when NO_GZCMPRESS is defined).

I worked around it by simply removing deflate.c and compress.c from my
working directory, and using -DdeflateParams(x,y)=Z_OK to remove the
deflateParams() invocation from gzio.c.

It would be useful to have a corrollary NO_GZUNCOMPRESS that could be
used when building a write-only library.  This would effectively remove
all of the inf*.[ch] files, and would remove a few invocations of inf*().
My workaround for this problem was to remove inf*.[ch] manually and
to create a dummy_inflate.c file that contains stubs for the few
functions that are called from elsewhere in zlib.

I can create a patch to do all of this if you like.

Glenn




More information about the Zlib-devel mailing list