[Zlib-devel] Allow read-only data as input
Lasse Collin
lasse.collin at tukaani.org
Mon Mar 28 12:02:48 EDT 2011
On 2011-03-28 Sebastian Huber wrote:
> 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.
I agree that it could have been nice to have the const there, but I
think it is too late to change it. Existing applications already have
the required casts. Adding the const now would require fixing
applications that assume that next_in isn't const.
--
Lasse Collin | IRC: Larhzu @ IRCnet & Freenode
More information about the Zlib-devel
mailing list