[Zlib-devel] Allow read-only data as input

Sebastian Huber sebastian.huber at embedded-brains.de
Mon Mar 28 08:02:38 EDT 2011


Hello,

I suggest to change the z_stream structure as follows:

--- a/zlib.h
+++ b/zlib.h
@@ -83,7 +83,7 @@ typedef void   (*free_func)  OF((voidpf opaque, voidpf address));
 struct internal_state;

 typedef struct z_stream_s {
-    Bytef    *next_in;  /* next input byte */
+    const Bytef *next_in; /* next input byte */
     uInt     avail_in;  /* number of bytes available at next_in */
     uLong    total_in;  /* total nb of input bytes read so far */

This allows you to pass read-only data as input (without a nasty cast, e.g.
gzwrite.c line 210).  Please have a look at the attached patch.  The format is
quite broken with this patch.

Have a nice day!
	Sebastian Huber

-- 
Sebastian Huber, embedded brains GmbH

Address : Obere Lagerstr. 30, D-82178 Puchheim, Germany
Phone   : +49 89 18 90 80 79-6
Fax     : +49 89 18 90 80 79-9
E-Mail  : sebastian.huber at embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: next-in-const.patch
Type: text/x-patch
Size: 4186 bytes
Desc: not available
URL: <http://madler.net/pipermail/zlib-devel_madler.net/attachments/20110328/f7e6ac2d/attachment.bin>


More information about the Zlib-devel mailing list