lib/uzlib: Add a source_read_data var to pass to source_read_cb.

For better abstraction for users of this API.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This commit is contained in:
Jim Mussared
2023-06-29 11:56:08 +10:00
committed by Damien George
parent 7f16bfca9f
commit e6c290c3d1
3 changed files with 6 additions and 3 deletions

View File

@@ -185,7 +185,7 @@ unsigned char uzlib_get_byte(uzlib_uncomp_t *d)
read next byte using it. (Note: the callback can also update ->source
and ->source_limit). */
if (d->source_read_cb && !d->eof) {
int val = d->source_read_cb(d);
int val = d->source_read_cb(d->source_read_data);
if (val >= 0) {
return (unsigned char)val;
}

View File

@@ -84,7 +84,8 @@ typedef struct _uzlib_uncomp_t {
also return -1 in case of EOF (or irrecoverable error). Note that
besides returning the next byte, it may also update source and
source_limit fields, thus allowing for buffered operation. */
int (*source_read_cb)(struct _uzlib_uncomp_t *uncomp);
void *source_read_data;
int (*source_read_cb)(void *);
unsigned int tag;
unsigned int bitcount;