}
/* initial Adler-32 value (deferred check for len == 1 speed) */
- if (buf == Z_NULL)
+ if (buf == NULL)
return 1L;
/* in case short lengths are provided, keep it somewhat fast */
left = *destLen;
*destLen = 0;
- stream.zalloc = (alloc_func)0;
- stream.zfree = (free_func)0;
+ stream.zalloc = NULL;
+ stream.zfree = NULL;
stream.opaque = NULL;
err = deflateInit(&stream, level);
/* ========================================================================= */
uint32_t ZEXPORT crc32(uint32_t crc, const unsigned char *buf, z_off64_t len) {
- if (buf == Z_NULL) return 0;
+ if (buf == NULL) return 0;
#ifdef DYNAMIC_CRC_TABLE
if (crc_table_empty)
x86_check_features();
#endif
- if (version == Z_NULL || version[0] != my_version[0] || stream_size != sizeof(z_stream)) {
+ if (version == NULL || version[0] != my_version[0] || stream_size != sizeof(z_stream)) {
return Z_VERSION_ERROR;
}
- if (strm == Z_NULL)
+ if (strm == NULL)
return Z_STREAM_ERROR;
- strm->msg = Z_NULL;
- if (strm->zalloc == (alloc_func)0) {
+ strm->msg = NULL;
+ if (strm->zalloc == NULL) {
strm->zalloc = zcalloc;
strm->opaque = NULL;
}
- if (strm->zfree == (free_func)0)
+ if (strm->zfree == NULL)
strm->zfree = zcfree;
if (level == Z_DEFAULT_COMPRESSION)
#endif
s = (deflate_state *) ZALLOC(strm, 1, sizeof(deflate_state));
- if (s == Z_NULL)
+ if (s == NULL)
return Z_MEM_ERROR;
strm->state = (struct internal_state *)s;
s->strm = strm;
s->wrap = wrap;
- s->gzhead = Z_NULL;
+ s->gzhead = NULL;
s->w_bits = windowBits;
s->w_size = 1 << s->w_bits;
s->w_mask = s->w_size - 1;
s->pending_buf = (unsigned char *) overlay;
s->pending_buf_size = (unsigned long)s->lit_bufsize * (sizeof(uint16_t)+2L);
- if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL ||
- s->pending_buf == Z_NULL) {
+ if (s->window == NULL || s->prev == NULL || s->head == NULL ||
+ s->pending_buf == NULL) {
s->status = FINISH_STATE;
strm->msg = ERR_MSG(Z_MEM_ERROR);
deflateEnd(strm);
uint32_t avail;
const unsigned char *next;
- if (strm == Z_NULL || strm->state == Z_NULL || dictionary == Z_NULL)
+ if (strm == NULL || strm->state == NULL || dictionary == NULL)
return Z_STREAM_ERROR;
s = strm->state;
wrap = s->wrap;
int ZEXPORT deflateResetKeep(z_stream *strm) {
deflate_state *s;
- if (strm == Z_NULL || strm->state == Z_NULL || strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0) {
+ if (strm == NULL || strm->state == NULL || strm->zalloc == NULL || strm->zfree == NULL) {
return Z_STREAM_ERROR;
}
strm->total_in = strm->total_out = 0;
- strm->msg = Z_NULL; /* use zfree if we ever allocate msg dynamically */
+ strm->msg = NULL; /* use zfree if we ever allocate msg dynamically */
strm->data_type = Z_UNKNOWN;
s = (deflate_state *)strm->state;
}
s->status = s->wrap ? INIT_STATE : BUSY_STATE;
#ifdef GZIP
- strm->adler = s->wrap == 2 ? crc32(0L, Z_NULL, 0) : adler32(0L, Z_NULL, 0);
+ strm->adler = s->wrap == 2 ? crc32(0L, NULL, 0) : adler32(0L, NULL, 0);
#else
- strm->adler = adler32(0L, Z_NULL, 0);
+ strm->adler = adler32(0L, NULL, 0);
#endif
s->last_flush = Z_NO_FLUSH;
/* ========================================================================= */
int ZEXPORT deflateSetHeader(z_stream *strm, gz_headerp head) {
- if (strm == Z_NULL || strm->state == Z_NULL)
+ if (strm == NULL || strm->state == NULL)
return Z_STREAM_ERROR;
if (strm->state->wrap != 2)
return Z_STREAM_ERROR;
/* ========================================================================= */
int ZEXPORT deflatePending(z_stream *strm, uint32_t *pending, int *bits) {
- if (strm == Z_NULL || strm->state == Z_NULL)
+ if (strm == NULL || strm->state == NULL)
return Z_STREAM_ERROR;
- if (pending != Z_NULL)
+ if (pending != NULL)
*pending = strm->state->pending;
- if (bits != Z_NULL)
+ if (bits != NULL)
*bits = strm->state->bi_valid;
return Z_OK;
}
deflate_state *s;
int put;
- if (strm == Z_NULL || strm->state == Z_NULL)
+ if (strm == NULL || strm->state == NULL)
return Z_STREAM_ERROR;
s = strm->state;
if ((unsigned char *)(s->d_buf) < s->pending_out + ((Buf_size + 7) >> 3))
compress_func func;
int err = Z_OK;
- if (strm == Z_NULL || strm->state == Z_NULL)
+ if (strm == NULL || strm->state == NULL)
return Z_STREAM_ERROR;
s = strm->state;
int ZEXPORT deflateTune(z_stream *strm, int good_length, int max_lazy, int nice_length, int max_chain) {
deflate_state *s;
- if (strm == Z_NULL || strm->state == Z_NULL)
+ if (strm == NULL || strm->state == NULL)
return Z_STREAM_ERROR;
s = strm->state;
s->good_match = good_length;
complen = sourceLen + ((sourceLen + 7) >> 3) + ((sourceLen + 63) >> 6) + 5;
/* if can't get parameters, return conservative bound plus zlib wrapper */
- if (strm == Z_NULL || strm->state == Z_NULL)
+ if (strm == NULL || strm->state == NULL)
return complen + 6;
/* compute wrapper length */
break;
case 2: /* gzip wrapper */
wraplen = 18;
- if (s->gzhead != Z_NULL) { /* user-supplied gzip header */
- if (s->gzhead->extra != Z_NULL) {
+ if (s->gzhead != NULL) { /* user-supplied gzip header */
+ if (s->gzhead->extra != NULL) {
wraplen += 2 + s->gzhead->extra_len;
}
str = s->gzhead->name;
- if (str != Z_NULL) {
+ if (str != NULL) {
do {
wraplen++;
} while (*str++);
}
str = s->gzhead->comment;
- if (str != Z_NULL) {
+ if (str != NULL) {
do {
wraplen++;
} while (*str++);
int old_flush; /* value of flush param for previous deflate call */
deflate_state *s;
- if (strm == Z_NULL || strm->state == Z_NULL || flush > Z_BLOCK || flush < 0) {
+ if (strm == NULL || strm->state == NULL || flush > Z_BLOCK || flush < 0) {
return Z_STREAM_ERROR;
}
s = strm->state;
- if (strm->next_out == Z_NULL || (strm->avail_in != 0 && strm->next_in == Z_NULL) ||
+ if (strm->next_out == NULL || (strm->avail_in != 0 && strm->next_in == NULL) ||
(s->status == FINISH_STATE && flush != Z_FINISH)) {
ERR_RETURN(strm, Z_STREAM_ERROR);
}
put_byte(s, 31);
put_byte(s, 139);
put_byte(s, 8);
- if (s->gzhead == Z_NULL) {
+ if (s->gzhead == NULL) {
put_byte(s, 0);
put_byte(s, 0);
put_byte(s, 0);
} else {
put_byte(s, (s->gzhead->text ? 1 : 0) +
(s->gzhead->hcrc ? 2 : 0) +
- (s->gzhead->extra == Z_NULL ? 0 : 4) +
- (s->gzhead->name == Z_NULL ? 0 : 8) +
- (s->gzhead->comment == Z_NULL ? 0 : 16) );
+ (s->gzhead->extra == NULL ? 0 : 4) +
+ (s->gzhead->name == NULL ? 0 : 8) +
+ (s->gzhead->comment == NULL ? 0 : 16) );
put_byte(s, (unsigned char)(s->gzhead->time & 0xff));
put_byte(s, (unsigned char)((s->gzhead->time >> 8) & 0xff));
put_byte(s, (unsigned char)((s->gzhead->time >> 16) & 0xff));
(s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ?
4 : 0));
put_byte(s, s->gzhead->os & 0xff);
- if (s->gzhead->extra != Z_NULL) {
+ if (s->gzhead->extra != NULL) {
put_byte(s, s->gzhead->extra_len & 0xff);
put_byte(s, (s->gzhead->extra_len >> 8) & 0xff);
}
putShortMSB(s, (uint16_t)(strm->adler >> 16));
putShortMSB(s, (uint16_t)strm->adler);
}
- strm->adler = adler32(0L, Z_NULL, 0);
+ strm->adler = adler32(0L, NULL, 0);
}
}
#ifdef GZIP
if (s->status == EXTRA_STATE) {
- if (s->gzhead->extra != Z_NULL) {
+ if (s->gzhead->extra != NULL) {
uint32_t beg = s->pending; /* start of bytes to update crc */
while (s->gzindex < (s->gzhead->extra_len & 0xffff)) {
}
}
if (s->status == NAME_STATE) {
- if (s->gzhead->name != Z_NULL) {
+ if (s->gzhead->name != NULL) {
uint32_t beg = s->pending; /* start of bytes to update crc */
int val;
}
}
if (s->status == COMMENT_STATE) {
- if (s->gzhead->comment != Z_NULL) {
+ if (s->gzhead->comment != NULL) {
uint32_t beg = s->pending; /* start of bytes to update crc */
int val;
if (s->pending + 2 <= s->pending_buf_size) {
put_byte(s, (unsigned char)(strm->adler & 0xff));
put_byte(s, (unsigned char)((strm->adler >> 8) & 0xff));
- strm->adler = crc32(0L, Z_NULL, 0);
+ strm->adler = crc32(0L, NULL, 0);
s->status = BUSY_STATE;
}
} else {
int ZEXPORT deflateEnd(z_stream *strm) {
int status;
- if (strm == Z_NULL || strm->state == Z_NULL)
+ if (strm == NULL || strm->state == NULL)
return Z_STREAM_ERROR;
status = strm->state->status;
TRY_FREE(strm, strm->state->window);
ZFREE(strm, strm->state);
- strm->state = Z_NULL;
+ strm->state = NULL;
return status == BUSY_STATE ? Z_DATA_ERROR : Z_OK;
}
deflate_state *ss;
uint16_t *overlay;
- if (source == Z_NULL || dest == Z_NULL || source->state == Z_NULL) {
+ if (source == NULL || dest == NULL || source->state == NULL) {
return Z_STREAM_ERROR;
}
memcpy((void *)dest, (void *)source, sizeof(z_stream));
ds = (deflate_state *) ZALLOC(dest, 1, sizeof(deflate_state));
- if (ds == Z_NULL)
+ if (ds == NULL)
return Z_MEM_ERROR;
dest->state = (struct internal_state *) ds;
memcpy((void *)ds, (void *)ss, sizeof(deflate_state));
overlay = (uint16_t *) ZALLOC(dest, ds->lit_bufsize, sizeof(uint16_t)+2);
ds->pending_buf = (unsigned char *) overlay;
- if (ds->window == Z_NULL || ds->prev == Z_NULL || ds->head == Z_NULL || ds->pending_buf == Z_NULL) {
+ if (ds->window == NULL || ds->prev == NULL || ds->head == NULL || ds->pending_buf == NULL) {
deflateEnd(dest);
return Z_MEM_ERROR;
}
#define FLUSH_BLOCK_ONLY(s, last) { \
_tr_flush_block(s, (s->block_start >= 0L ? \
(char *)&s->window[(unsigned)s->block_start] : \
- (char *)Z_NULL), \
+ NULL), \
(ulg)((long)s->strstart - s->block_start), \
(last)); \
s->block_start = s->strstart; \
state->size = state->want;
/* allocate inflate memory */
- state->strm.zalloc = Z_NULL;
- state->strm.zfree = Z_NULL;
- state->strm.opaque = Z_NULL;
+ state->strm.zalloc = NULL;
+ state->strm.zfree = NULL;
+ state->strm.opaque = NULL;
state->strm.avail_in = 0;
- state->strm.next_in = Z_NULL;
+ state->strm.next_in = NULL;
if (inflateInit2(&(state->strm), 15 + 16) != Z_OK) { /* gunzip */
free(state->out);
free(state->in);
}
/* allocate deflate memory, set up for gzip compression */
- strm->zalloc = Z_NULL;
- strm->zfree = Z_NULL;
- strm->opaque = Z_NULL;
+ strm->zalloc = NULL;
+ strm->zfree = NULL;
+ strm->opaque = NULL;
ret = deflateInit2(strm, state->level, Z_DEFLATED, MAX_WBITS + 16, DEF_MEM_LEVEL, state->strategy);
if (ret != Z_OK) {
free(state->out);
/*
strm provides memory allocation functions in zalloc and zfree, or
- Z_NULL to use the library memory allocation functions.
+ NULL to use the library memory allocation functions.
windowBits is in the range 8..15, and window is a user-supplied
window and output buffer that is 2**windowBits bytes.
const char *version, int stream_size) {
struct inflate_state *state;
- if (version == Z_NULL || version[0] != ZLIB_VERSION[0] || stream_size != (int)(sizeof(z_stream)))
+ if (version == NULL || version[0] != ZLIB_VERSION[0] || stream_size != (int)(sizeof(z_stream)))
return Z_VERSION_ERROR;
- if (strm == Z_NULL || window == Z_NULL || windowBits < 8 || windowBits > 15)
+ if (strm == NULL || window == NULL || windowBits < 8 || windowBits > 15)
return Z_STREAM_ERROR;
- strm->msg = Z_NULL; /* in case we return an error */
- if (strm->zalloc == (alloc_func)0) {
+ strm->msg = NULL; /* in case we return an error */
+ if (strm->zalloc == NULL) {
strm->zalloc = zcalloc;
strm->opaque = NULL;
}
- if (strm->zfree == (free_func)0)
+ if (strm->zfree == NULL)
strm->zfree = zcfree;
state = (struct inflate_state *)ZALLOC(strm, 1, sizeof(struct inflate_state));
- if (state == Z_NULL)
+ if (state == NULL)
return Z_MEM_ERROR;
Tracev((stderr, "inflate: allocated\n"));
strm->state = (struct internal_state *)state;
if (have == 0) { \
have = in(in_desc, &next); \
if (have == 0) { \
- next = Z_NULL; \
+ next = NULL; \
ret = Z_BUF_ERROR; \
goto inf_leave; \
} \
in() should return zero on failure. out() should return non-zero on
failure. If either in() or out() fails, than inflateBack() returns a
- Z_BUF_ERROR. strm->next_in can be checked for Z_NULL to see whether it
+ Z_BUF_ERROR. strm->next_in can be checked for NULL to see whether it
was in() or out() that caused in the error. Otherwise, inflateBack()
returns Z_STREAM_END on success, Z_DATA_ERROR for an deflate format
error, or Z_MEM_ERROR if it could not allocate memory for the state.
inflateBack() can also return Z_STREAM_ERROR if the input parameters
- are not correct, i.e. strm is Z_NULL or the state was not initialized.
+ are not correct, i.e. strm is NULL or the state was not initialized.
*/
int ZEXPORT inflateBack(z_stream *strm, in_func in, void *in_desc, out_func out, void *out_desc) {
struct inflate_state *state;
{16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
/* Check that the strm exists and that the state was initialized */
- if (strm == Z_NULL || strm->state == Z_NULL)
+ if (strm == NULL || strm->state == NULL)
return Z_STREAM_ERROR;
state = (struct inflate_state *)strm->state;
/* Reset the state */
- strm->msg = Z_NULL;
+ strm->msg = NULL;
state->mode = TYPE;
state->last = 0;
state->whave = 0;
next = strm->next_in;
- have = next != Z_NULL ? strm->avail_in : 0;
+ have = next != NULL ? strm->avail_in : 0;
hold = 0;
bits = 0;
put = state->window;
}
int ZEXPORT inflateBackEnd(z_stream *strm) {
- if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0)
+ if (strm == NULL || strm->state == NULL || strm->zfree == NULL)
return Z_STREAM_ERROR;
ZFREE(strm, strm->state);
- strm->state = Z_NULL;
+ strm->state = NULL;
Tracev((stderr, "inflate: end\n"));
return Z_OK;
}
int ZEXPORT inflateResetKeep(z_stream *strm) {
struct inflate_state *state;
- if (strm == Z_NULL || strm->state == Z_NULL)
+ if (strm == NULL || strm->state == NULL)
return Z_STREAM_ERROR;
state = (struct inflate_state *)strm->state;
strm->total_in = strm->total_out = state->total = 0;
- strm->msg = Z_NULL;
+ strm->msg = NULL;
if (state->wrap) /* to support ill-conceived Java test suite */
strm->adler = state->wrap & 1;
state->mode = HEAD;
state->last = 0;
state->havedict = 0;
state->dmax = 32768U;
- state->head = Z_NULL;
+ state->head = NULL;
state->hold = 0;
state->bits = 0;
state->lencode = state->distcode = state->next = state->codes;
int ZEXPORT inflateReset(z_stream *strm) {
struct inflate_state *state;
- if (strm == Z_NULL || strm->state == Z_NULL)
+ if (strm == NULL || strm->state == NULL)
return Z_STREAM_ERROR;
state = (struct inflate_state *)strm->state;
state->wsize = 0;
struct inflate_state *state;
/* get the state */
- if (strm == Z_NULL || strm->state == Z_NULL)
+ if (strm == NULL || strm->state == NULL)
return Z_STREAM_ERROR;
state = (struct inflate_state *)strm->state;
/* set number of window bits, free window if different */
if (windowBits && (windowBits < 8 || windowBits > 15))
return Z_STREAM_ERROR;
- if (state->window != Z_NULL && state->wbits != (unsigned)windowBits) {
+ if (state->window != NULL && state->wbits != (unsigned)windowBits) {
ZFREE(strm, state->window);
- state->window = Z_NULL;
+ state->window = NULL;
}
/* update state and reset the rest of it */
int ret;
struct inflate_state *state;
- if (version == Z_NULL || version[0] != ZLIB_VERSION[0] || stream_size != (int)(sizeof(z_stream)))
+ if (version == NULL || version[0] != ZLIB_VERSION[0] || stream_size != (int)(sizeof(z_stream)))
return Z_VERSION_ERROR;
- if (strm == Z_NULL)
+ if (strm == NULL)
return Z_STREAM_ERROR;
- strm->msg = Z_NULL; /* in case we return an error */
- if (strm->zalloc == (alloc_func)0) {
+ strm->msg = NULL; /* in case we return an error */
+ if (strm->zalloc == NULL) {
strm->zalloc = zcalloc;
strm->opaque = NULL;
}
- if (strm->zfree == (free_func)0)
+ if (strm->zfree == NULL)
strm->zfree = zcfree;
state = (struct inflate_state *) ZALLOC(strm, 1, sizeof(struct inflate_state));
- if (state == Z_NULL)
+ if (state == NULL)
return Z_MEM_ERROR;
Tracev((stderr, "inflate: allocated\n"));
strm->state = (struct internal_state *)state;
- state->window = Z_NULL;
+ state->window = NULL;
ret = inflateReset2(strm, windowBits);
if (ret != Z_OK) {
ZFREE(strm, state);
- strm->state = Z_NULL;
+ strm->state = NULL;
}
return ret;
}
int ZEXPORT inflatePrime(z_stream *strm, int bits, int value) {
struct inflate_state *state;
- if (strm == Z_NULL || strm->state == Z_NULL)
+ if (strm == NULL || strm->state == NULL)
return Z_STREAM_ERROR;
state = (struct inflate_state *)strm->state;
if (bits < 0) {
state = (struct inflate_state *)strm->state;
/* if it hasn't been done already, allocate space for the window */
- if (state->window == Z_NULL) {
+ if (state->window == NULL) {
state->window = (unsigned char *) ZALLOC(strm, 1U << state->wbits, sizeof(unsigned char));
- if (state->window == Z_NULL)
+ if (state->window == NULL)
return 1;
}
static const uint16_t order[19] = /* permutation of code lengths */
{16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
- if (strm == Z_NULL || strm->state == Z_NULL || strm->next_out == Z_NULL ||
- (strm->next_in == Z_NULL && strm->avail_in != 0))
+ if (strm == NULL || strm->state == NULL || strm->next_out == NULL ||
+ (strm->next_in == NULL && strm->avail_in != 0))
return Z_STREAM_ERROR;
state = (struct inflate_state *)strm->state;
if ((state->wrap & 2) && hold == 0x8b1f) { /* gzip header */
if (state->wbits == 0)
state->wbits = 15;
- state->check = crc32(0L, Z_NULL, 0);
+ state->check = crc32(0L, NULL, 0);
CRC2(state->check, hold);
INITBITS();
state->mode = FLAGS;
break;
}
state->flags = 0; /* expect zlib header */
- if (state->head != Z_NULL)
+ if (state->head != NULL)
state->head->done = -1;
if (!(state->wrap & 1) || /* check if zlib header allowed */
#else
}
state->dmax = 1U << len;
Tracev((stderr, "inflate: zlib header ok\n"));
- strm->adler = state->check = adler32(0L, Z_NULL, 0);
+ strm->adler = state->check = adler32(0L, NULL, 0);
state->mode = hold & 0x200 ? DICTID : TYPE;
INITBITS();
break;
state->mode = BAD;
break;
}
- if (state->head != Z_NULL)
+ if (state->head != NULL)
state->head->text = (int)((hold >> 8) & 1);
if (state->flags & 0x0200)
CRC2(state->check, hold);
state->mode = TIME;
case TIME:
NEEDBITS(32);
- if (state->head != Z_NULL)
+ if (state->head != NULL)
state->head->time = hold;
if (state->flags & 0x0200)
CRC4(state->check, hold);
state->mode = OS;
case OS:
NEEDBITS(16);
- if (state->head != Z_NULL) {
+ if (state->head != NULL) {
state->head->xflags = (int)(hold & 0xff);
state->head->os = (int)(hold >> 8);
}
if (state->flags & 0x0400) {
NEEDBITS(16);
state->length = (uint16_t)hold;
- if (state->head != Z_NULL)
+ if (state->head != NULL)
state->head->extra_len = (uint16_t)hold;
if (state->flags & 0x0200)
CRC2(state->check, hold);
INITBITS();
- } else if (state->head != Z_NULL) {
- state->head->extra = Z_NULL;
+ } else if (state->head != NULL) {
+ state->head->extra = NULL;
}
state->mode = EXTRA;
case EXTRA:
if (copy > have)
copy = have;
if (copy) {
- if (state->head != Z_NULL &&
- state->head->extra != Z_NULL) {
+ if (state->head != NULL &&
+ state->head->extra != NULL) {
len = state->head->extra_len - state->length;
memcpy(state->head->extra + len, next,
len + copy > state->head->extra_max ?
copy = 0;
do {
len = (unsigned)(next[copy++]);
- if (state->head != Z_NULL && state->head->name != Z_NULL && state->length < state->head->name_max)
+ if (state->head != NULL && state->head->name != NULL && state->length < state->head->name_max)
state->head->name[state->length++] = len;
} while (len && copy < have);
if (state->flags & 0x0200)
next += copy;
if (len)
goto inf_leave;
- } else if (state->head != Z_NULL) {
- state->head->name = Z_NULL;
+ } else if (state->head != NULL) {
+ state->head->name = NULL;
}
state->length = 0;
state->mode = COMMENT;
copy = 0;
do {
len = (unsigned)(next[copy++]);
- if (state->head != Z_NULL && state->head->comment != Z_NULL
+ if (state->head != NULL && state->head->comment != NULL
&& state->length < state->head->comm_max)
state->head->comment[state->length++] = len;
} while (len && copy < have);
next += copy;
if (len)
goto inf_leave;
- } else if (state->head != Z_NULL) {
- state->head->comment = Z_NULL;
+ } else if (state->head != NULL) {
+ state->head->comment = NULL;
}
state->mode = HCRC;
case HCRC:
}
INITBITS();
}
- if (state->head != Z_NULL) {
+ if (state->head != NULL) {
state->head->hcrc = (int)((state->flags >> 9) & 1);
state->head->done = 1;
}
- strm->adler = state->check = crc32(0L, Z_NULL, 0);
+ strm->adler = state->check = crc32(0L, NULL, 0);
state->mode = TYPE;
break;
#endif
RESTORE();
return Z_NEED_DICT;
}
- strm->adler = state->check = adler32(0L, Z_NULL, 0);
+ strm->adler = state->check = adler32(0L, NULL, 0);
state->mode = TYPE;
case TYPE:
if (flush == Z_BLOCK || flush == Z_TREES)
int ZEXPORT inflateEnd(z_stream *strm) {
struct inflate_state *state;
- if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0)
+ if (strm == NULL || strm->state == NULL || strm->zfree == NULL)
return Z_STREAM_ERROR;
state = (struct inflate_state *)strm->state;
- if (state->window != Z_NULL)
+ if (state->window != NULL)
ZFREE(strm, state->window);
ZFREE(strm, strm->state);
- strm->state = Z_NULL;
+ strm->state = NULL;
Tracev((stderr, "inflate: end\n"));
return Z_OK;
}
struct inflate_state *state;
/* check state */
- if (strm == Z_NULL || strm->state == Z_NULL)
+ if (strm == NULL || strm->state == NULL)
return Z_STREAM_ERROR;
state = (struct inflate_state *)strm->state;
/* copy dictionary */
- if (state->whave && dictionary != Z_NULL) {
+ if (state->whave && dictionary != NULL) {
memcpy(dictionary, state->window + state->wnext, state->whave - state->wnext);
memcpy(dictionary + state->whave - state->wnext, state->window, state->wnext);
}
- if (dictLength != Z_NULL)
+ if (dictLength != NULL)
*dictLength = state->whave;
return Z_OK;
}
int ret;
/* check state */
- if (strm == Z_NULL || strm->state == Z_NULL)
+ if (strm == NULL || strm->state == NULL)
return Z_STREAM_ERROR;
state = (struct inflate_state *)strm->state;
if (state->wrap != 0 && state->mode != DICT)
/* check for correct dictionary identifier */
if (state->mode == DICT) {
- dictid = adler32(0L, Z_NULL, 0);
+ dictid = adler32(0L, NULL, 0);
dictid = adler32(dictid, dictionary, dictLength);
if (dictid != state->check)
return Z_DATA_ERROR;
struct inflate_state *state;
/* check state */
- if (strm == Z_NULL || strm->state == Z_NULL)
+ if (strm == NULL || strm->state == NULL)
return Z_STREAM_ERROR;
state = (struct inflate_state *)strm->state;
if ((state->wrap & 2) == 0)
struct inflate_state *state;
/* check parameters */
- if (strm == Z_NULL || strm->state == Z_NULL)
+ if (strm == NULL || strm->state == NULL)
return Z_STREAM_ERROR;
state = (struct inflate_state *)strm->state;
if (strm->avail_in == 0 && state->bits < 8)
int ZEXPORT inflateSyncPoint(z_stream *strm) {
struct inflate_state *state;
- if (strm == Z_NULL || strm->state == Z_NULL)
+ if (strm == NULL || strm->state == NULL)
return Z_STREAM_ERROR;
state = (struct inflate_state *)strm->state;
return state->mode == STORED && state->bits == 0;
unsigned wsize;
/* check input */
- if (dest == Z_NULL || source == Z_NULL || source->state == Z_NULL ||
- source->zalloc == (alloc_func)0 || source->zfree == (free_func)0)
+ if (dest == NULL || source == NULL || source->state == NULL ||
+ source->zalloc == NULL || source->zfree == NULL)
return Z_STREAM_ERROR;
state = (struct inflate_state *)source->state;
/* allocate space */
copy = (struct inflate_state *)
ZALLOC(source, 1, sizeof(struct inflate_state));
- if (copy == Z_NULL)
+ if (copy == NULL)
return Z_MEM_ERROR;
- window = Z_NULL;
- if (state->window != Z_NULL) {
+ window = NULL;
+ if (state->window != NULL) {
window = (unsigned char *) ZALLOC(source, 1U << state->wbits, sizeof(unsigned char));
- if (window == Z_NULL) {
+ if (window == NULL) {
ZFREE(source, copy);
return Z_MEM_ERROR;
}
copy->distcode = copy->codes + (state->distcode - state->codes);
}
copy->next = copy->codes + (state->next - state->codes);
- if (window != Z_NULL) {
+ if (window != NULL) {
wsize = 1U << state->wbits;
memcpy(window, state->window, wsize);
}
int ZEXPORT inflateUndermine(z_stream *strm, int subvert) {
struct inflate_state *state;
- if (strm == Z_NULL || strm->state == Z_NULL)
+ if (strm == NULL || strm->state == NULL)
return Z_STREAM_ERROR;
state = (struct inflate_state *)strm->state;
#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
long ZEXPORT inflateMark(z_stream *strm) {
struct inflate_state *state;
- if (strm == Z_NULL || strm->state == Z_NULL)
+ if (strm == NULL || strm->state == NULL)
return -1L << 16;
state = (struct inflate_state *)strm->state;
return ((long)(state->back) << 16) + (state->mode == COPY ? state->length :
int main (int argc, char *argv[]);
-static alloc_func zalloc = (alloc_func)0;
-static free_func zfree = (free_func)0;
+static alloc_func zalloc = NULL;
+static free_func zfree = NULL;
void test_compress (unsigned char *compr, size_t comprLen,
unsigned char *uncompr, size_t uncomprLen);
/* compr and uncompr are cleared to avoid reading uninitialized
* data and to ensure that uncompr compresses well.
*/
- if (compr == Z_NULL || uncompr == Z_NULL) {
+ if (compr == NULL || uncompr == NULL) {
printf("out of memory\n");
exit(1);
}
allocated, then "msg" and information about the
problem is printed to stderr. If everything is
normal, nothing is printed. mem_done resets the
- strm members to Z_NULL to use the default memory
+ strm members to NULL to use the default memory
allocation routines on the next zlib initialization
using strm.
*/
/* free the zone and delete from the stream */
free(zone);
- strm->opaque = Z_NULL;
- strm->zalloc = Z_NULL;
- strm->zfree = Z_NULL;
+ strm->opaque = NULL;
+ strm->zalloc = NULL;
+ strm->zfree = NULL;
}
/* -- inflate test routines -- */
mem_setup(&strm);
strm.avail_in = 0;
- strm.next_in = Z_NULL;
+ strm.next_in = NULL;
ret = inflateInit2(&strm, win);
if (ret != Z_OK) {
mem_done(&strm, what);
mem_setup(&strm);
strm.avail_in = 0;
- strm.next_in = Z_NULL;
+ strm.next_in = NULL;
ret = inflateInit(&strm); assert(ret == Z_OK);
mem_used(&strm, "inflate init");
ret = inflatePrime(&strm, 5, 31); assert(ret == Z_OK);
ret = inflatePrime(&strm, -1, 0); assert(ret == Z_OK);
- ret = inflateSetDictionary(&strm, Z_NULL, 0);
+ ret = inflateSetDictionary(&strm, NULL, 0);
assert(ret == Z_STREAM_ERROR);
ret = inflateEnd(&strm); assert(ret == Z_OK);
mem_done(&strm, "prime");
mem_setup(&strm);
strm.avail_in = 0;
- strm.next_in = Z_NULL;
+ strm.next_in = NULL;
ret = inflateInit_(&strm, ZLIB_VERSION + 1, (int)sizeof(z_stream));
assert(ret == Z_VERSION_ERROR);
mem_done(&strm, "wrong version");
strm.avail_in = 0;
- strm.next_in = Z_NULL;
+ strm.next_in = NULL;
ret = inflateInit(&strm); assert(ret == Z_OK);
ret = inflateEnd(&strm); assert(ret == Z_OK);
fputs("inflate built-in memory routines\n", stderr);
z_stream strm, copy;
unsigned char dict[257];
- ret = inflate(Z_NULL, 0); assert(ret == Z_STREAM_ERROR);
- ret = inflateEnd(Z_NULL); assert(ret == Z_STREAM_ERROR);
- ret = inflateCopy(Z_NULL, Z_NULL); assert(ret == Z_STREAM_ERROR);
+ ret = inflate(NULL, 0); assert(ret == Z_STREAM_ERROR);
+ ret = inflateEnd(NULL); assert(ret == Z_STREAM_ERROR);
+ ret = inflateCopy(NULL, NULL); assert(ret == Z_STREAM_ERROR);
fputs("inflate bad parameters\n", stderr);
inf("1f 8b 0 0", "bad gzip method", 0, 31, 0, Z_DATA_ERROR);
mem_setup(&strm);
strm.avail_in = 0;
- strm.next_in = Z_NULL;
+ strm.next_in = NULL;
ret = inflateInit2(&strm, -8);
strm.avail_in = 2;
strm.next_in = (void *)"\x63";
static unsigned char dat[] = {0x63, 0, 2, 0};
struct inflate_state *state;
- if (desc == Z_NULL) {
+ if (desc == NULL) {
next = 0;
return 0; /* no input (already provided at next_in) */
}
state = (void *)((z_stream *)desc)->state;
- if (state != Z_NULL)
+ if (state != NULL)
state->mode = SYNC; /* force an otherwise impossible situation */
return next < sizeof(dat) ? (*buf = dat + next++, 1) : 0;
}
static int push(void *desc, unsigned char *buf, unsigned len)
{
buf += len;
- return desc != Z_NULL; /* force error if desc not null */
+ return desc != NULL; /* force error if desc not null */
}
/* cover inflateBack() up to common deflate data cases and after those */
z_stream strm;
unsigned char win[32768];
- ret = inflateBackInit_(Z_NULL, 0, win, 0, 0);
+ ret = inflateBackInit_(NULL, 0, win, 0, 0);
assert(ret == Z_VERSION_ERROR);
- ret = inflateBackInit(Z_NULL, 0, win); assert(ret == Z_STREAM_ERROR);
- ret = inflateBack(Z_NULL, Z_NULL, Z_NULL, Z_NULL, Z_NULL);
+ ret = inflateBackInit(NULL, 0, win); assert(ret == Z_STREAM_ERROR);
+ ret = inflateBack(NULL, NULL, NULL, NULL, NULL);
assert(ret == Z_STREAM_ERROR);
- ret = inflateBackEnd(Z_NULL); assert(ret == Z_STREAM_ERROR);
+ ret = inflateBackEnd(NULL); assert(ret == Z_STREAM_ERROR);
fputs("inflateBack bad parameters\n", stderr);
mem_setup(&strm);
ret = inflateBackInit(&strm, 15, win); assert(ret == Z_OK);
strm.avail_in = 2;
strm.next_in = (void *)"\x03";
- ret = inflateBack(&strm, pull, Z_NULL, push, Z_NULL);
+ ret = inflateBack(&strm, pull, NULL, push, NULL);
assert(ret == Z_STREAM_END);
/* force output error */
strm.avail_in = 3;
strm.next_in = (void *)"\x63\x00";
- ret = inflateBack(&strm, pull, Z_NULL, push, &strm);
+ ret = inflateBack(&strm, pull, NULL, push, &strm);
assert(ret == Z_BUF_ERROR);
/* force mode error by mucking with state */
- ret = inflateBack(&strm, pull, &strm, push, Z_NULL);
+ ret = inflateBack(&strm, pull, &strm, push, NULL);
assert(ret == Z_STREAM_ERROR);
ret = inflateBackEnd(&strm); assert(ret == Z_OK);
mem_done(&strm, "inflateBack bad state");
strcat(prefix, "-late");
mem_setup(&strm);
strm.avail_in = 0;
- strm.next_in = Z_NULL;
+ strm.next_in = NULL;
ret = inflateInit2(&strm, err < 0 ? 47 : -15);
assert(ret == Z_OK);
strm.avail_in = len;
assert(ret == Z_OK);
strm.avail_in = len;
strm.next_in = in;
- ret = inflateBack(&strm, pull, Z_NULL, push, Z_NULL);
+ ret = inflateBack(&strm, pull, NULL, push, NULL);
assert(ret != Z_STREAM_ERROR);
if (err) {
assert(ret == Z_DATA_ERROR);
gz->write = strchr(mode, 'w') != NULL;
gz->strm.zalloc = myalloc;
gz->strm.zfree = myfree;
- gz->strm.opaque = Z_NULL;
+ gz->strm.opaque = NULL;
gz->buf = malloc(gz->write ? BUFLENW : BUFLEN);
if (gz->buf == NULL) {
if (gz->write)
ret = deflateInit2(&(gz->strm), level, 8, 15 + 16, 8, 0);
else {
- gz->strm.next_in = 0;
- gz->strm.avail_in = Z_NULL;
+ gz->strm.next_in = NULL;
+ gz->strm.avail_in = 0;
ret = inflateInit2(&(gz->strm), 15 + 16);
}
if (ret != Z_OK) {
return Z_STREAM_ERROR;
strm = &(gz->strm);
if (gz->write) {
- strm->next_in = Z_NULL;
+ strm->next_in = NULL;
strm->avail_in = 0;
do {
strm->next_out = gz->buf;
stream.next_in = (const unsigned char *)source;
stream.avail_in = 0;
- stream.zalloc = (alloc_func)0;
- stream.zfree = (free_func)0;
+ stream.zalloc = NULL;
+ stream.zfree = NULL;
stream.opaque = NULL;
err = inflateInit(&stream);
#include <sys/types.h> /* for off_t */
#include <stdarg.h> /* for va_list */
-#ifdef WIN32
-# include <stddef.h> /* for wchar_t */
-#endif
+#include <stddef.h> /* for wchar_t and NULL */
/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and
* "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even
unsigned long time; /* modification time */
int xflags; /* extra flags (not used when writing a gzip file) */
int os; /* operating system */
- unsigned char *extra; /* pointer to extra field or Z_NULL if none */
- unsigned int extra_len; /* extra field length (valid if extra != Z_NULL) */
+ unsigned char *extra; /* pointer to extra field or NULL if none */
+ unsigned int extra_len; /* extra field length (valid if extra != NULL) */
unsigned int extra_max; /* space at extra (only when reading header) */
- unsigned char *name; /* pointer to zero-terminated file name or Z_NULL */
+ unsigned char *name; /* pointer to zero-terminated file name or NULL */
unsigned int name_max; /* space at name (only when reading header) */
- unsigned char *comment; /* pointer to zero-terminated comment or Z_NULL */
+ unsigned char *comment; /* pointer to zero-terminated comment or NULL */
unsigned int comm_max; /* space at comment (only when reading header) */
int hcrc; /* true if there was or will be a header crc */
int done; /* true when done reading gzip header (not used when writing a gzip file) */
memory management. The compression library attaches no meaning to the
opaque value.
- zalloc must return Z_NULL if there is not enough memory for the object.
+ zalloc must return NULL if there is not enough memory for the object.
If zlib is used in a multi-threaded application, zalloc and zfree must be
thread safe.
#define Z_DEFLATED 8
/* The deflate compression method (the only one supported in this version) */
-#define Z_NULL 0 /* for initializing zalloc, zfree, opaque */
+#define Z_NULL NULL /* for compatibility with zlib, was for initializing zalloc, zfree, opaque */
#define zlib_version zlibVersion()
/* for compatibility with versions < 1.0.2 */
Initializes the internal stream state for compression. The fields
zalloc, zfree and opaque must be initialized before by the caller. If
- zalloc and zfree are set to Z_NULL, deflateInit updates them to use default
+ zalloc and zfree are set to NULL, deflateInit updates them to use default
allocation functions.
The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9:
processed or more output produced), Z_STREAM_END if all input has been
consumed and all output has been produced (only when flush is set to
Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example
- if next_in or next_out was Z_NULL), Z_BUF_ERROR if no progress is possible
+ if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible
(for example avail_in or avail_out was zero). Note that Z_BUF_ERROR is not
fatal, and deflate() can be called again with more input and more output
space to continue compressing.
Initializes the internal stream state for decompression. The fields
next_in, avail_in, zalloc, zfree and opaque must be initialized before by
- the caller. If next_in is not Z_NULL and avail_in is large enough (the
+ the caller. If next_in is not NULL and avail_in is large enough (the
exact value depends on the compression method), inflateInit determines the
compression method from the zlib header and allocates all data structures
accordingly; otherwise the allocation will be deferred to the first call of
- inflate. If zalloc and zfree are set to Z_NULL, inflateInit updates them to
+ inflate. If zalloc and zfree are set to NULL, inflateInit updates them to
use default allocation functions.
inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough
preset dictionary is needed at this point, Z_DATA_ERROR if the input data was
corrupted (input stream not conforming to the zlib format or incorrect check
value), Z_STREAM_ERROR if the stream structure was inconsistent (for example
- next_in or next_out was Z_NULL), Z_MEM_ERROR if there was not enough memory,
+ next_in or next_out was NULL), Z_MEM_ERROR if there was not enough memory,
Z_BUF_ERROR if no progress is possible or if there was not enough room in the
output buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and
inflate() can be called again with more input and more output space to
adler32 value is not computed and strm->adler is not set.
deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a
- parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is
+ parameter is invalid (e.g. dictionary being NULL) or the stream state is
inconsistent (for example if deflate has already been called for this stream
or if not at a block boundary for raw deflate). deflateSetDictionary does
not perform any compression: this will be done by deflate().
deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not
enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
- (such as zalloc being Z_NULL). msg is left unchanged in both source and
+ (such as zalloc being NULL). msg is left unchanged in both source and
destination.
*/
set unchanged.
deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
- stream state was inconsistent (such as zalloc or state being Z_NULL).
+ stream state was inconsistent (such as zalloc or state being NULL).
*/
ZEXTERN int ZEXPORT deflateParams(z_stream *strm, int level, int strategy);
provided would be due to the available output space having being consumed.
The number of bits of output not provided are between 0 and 7, where they
await more bits to join them in order to fill out a full byte. If pending
- or bits are Z_NULL, then those values are not set.
+ or bits are NULL, then those values are not set.
deflatePending returns Z_OK if success, or Z_STREAM_ERROR if the source
stream state was inconsistent.
deflate(). The text, time, os, extra field, name, and comment information
in the provided gz_header structure are written to the gzip header (xflag is
ignored -- the extra flags are set according to the compression level). The
- caller must assure that, if not Z_NULL, name and comment are terminated with
- a zero byte, and that if extra is not Z_NULL, that extra_len bytes are
+ caller must assure that, if not NULL, name and comment are terminated with
+ a zero byte, and that if extra is not NULL, that extra_len bytes are
available there. If hcrc is true, a gzip header crc is included. Note that
the current versions of the command-line version of gzip (up through version
1.3.x) do not support header crc's, and will report that it is a "multi-part
that was used for compression is provided.
inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a
- parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is
+ parameter is invalid (e.g. dictionary being NULL) or the stream state is
inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the
expected one (incorrect adler32 value). inflateSetDictionary does not
perform any decompression: this will be done by subsequent calls of
set to the number of bytes in the dictionary, and that many bytes are copied
to dictionary. dictionary must have enough space, where 32768 bytes is
always enough. If inflateGetDictionary() is called with dictionary equal to
- Z_NULL, then only the dictionary length is returned, and nothing is copied.
- Similary, if dictLength is Z_NULL, then it is not set.
+ NULL, then only the dictionary length is returned, and nothing is copied.
+ Similary, if dictLength is NULL, then it is not set.
inflateGetDictionary returns Z_OK on success, or Z_STREAM_ERROR if the
stream state is inconsistent.
inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not
enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
- (such as zalloc being Z_NULL). msg is left unchanged in both source and
+ (such as zalloc being NULL). msg is left unchanged in both source and
destination.
*/
stream will keep attributes that may have been set by inflateInit2.
inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
- stream state was inconsistent (such as zalloc or state being Z_NULL).
+ stream state was inconsistent (such as zalloc or state being NULL).
*/
ZEXTERN int ZEXPORT inflateReset2(z_stream *strm, int windowBits);
the same as it is for inflateInit2.
inflateReset2 returns Z_OK if success, or Z_STREAM_ERROR if the source
- stream state was inconsistent (such as zalloc or state being Z_NULL), or if
+ stream state was inconsistent (such as zalloc or state being NULL), or if
the windowBits parameter is invalid.
*/
The text, time, xflags, and os fields are filled in with the gzip header
contents. hcrc is set to true if there is a header CRC. (The header CRC
- was valid if done is set to one.) If extra is not Z_NULL, then extra_max
+ was valid if done is set to one.) If extra is not NULL, then extra_max
contains the maximum number of bytes to write to extra. Once done is true,
extra_len contains the actual extra field length, and extra contains the
extra field, or that field truncated if extra_max is less than extra_len.
- If name is not Z_NULL, then up to name_max characters are written there,
+ If name is not NULL, then up to name_max characters are written there,
terminated with a zero unless the length is greater than name_max. If
- comment is not Z_NULL, then up to comm_max characters are written there,
+ comment is not NULL, then up to comm_max characters are written there,
terminated with a zero unless the length is greater than comm_max. When any
- of extra, name, or comment are not Z_NULL and the respective field is not
- present in the header, then that field is set to Z_NULL to signal its
+ of extra, name, or comment are not NULL and the respective field is not
+ present in the header, then that field is set to NULL to signal its
absence. This allows the use of deflateSetHeader() with the returned
structure to duplicate the header. However if those fields are set to
allocated memory, then the application will need to save those pointers
Initialize the internal stream state for decompression using inflateBack()
calls. The fields zalloc, zfree and opaque in strm must be initialized
- before the call. If zalloc and zfree are Z_NULL, then the default library-
+ before the call. If zalloc and zfree are NULL, then the default library-
derived memory allocation routines are used. windowBits is the base two
logarithm of the window size, in the range 8..15. window is a caller
supplied buffer of that size. Except for special applications where it is
For convenience, inflateBack() can be provided input on the first call by
setting strm->next_in and strm->avail_in. If that input is exhausted, then
in() will be called. Therefore strm->next_in must be initialized before
- calling inflateBack(). If strm->next_in is Z_NULL, then in() will be called
- immediately for input. If strm->next_in is not Z_NULL, then strm->avail_in
+ calling inflateBack(). If strm->next_in is NULL, then in() will be called
+ immediately for input. If strm->next_in is not NULL, then strm->avail_in
must also be initialized, and then if strm->avail_in is not zero, input will
initially be taken from strm->next_in[0 .. strm->avail_in - 1].
in the deflate stream (in which case strm->msg is set to indicate the nature
of the error), or Z_STREAM_ERROR if the stream was not properly initialized.
In the case of Z_BUF_ERROR, an input or output error can be distinguished
- using strm->next_in which will be Z_NULL only if in() returned an error. If
- strm->next_in is not Z_NULL, then the Z_BUF_ERROR was due to out() returning
+ using strm->next_in which will be NULL only if in() returned an error. If
+ strm->next_in is not NULL, then the Z_BUF_ERROR was due to out() returning
non-zero. (in() will always be called before out(), so strm->next_in is
assured to be defined if out() returns non-zero.) Note that inflateBack()
cannot return Z_OK.
ZEXTERN uint32_t ZEXPORT adler32(uint32_t adler, const unsigned char *buf, uint32_t len);
/*
Update a running Adler-32 checksum with the bytes buf[0..len-1] and
- return the updated checksum. If buf is Z_NULL, this function returns the
+ return the updated checksum. If buf is NULL, this function returns the
required initial value for the checksum.
An Adler-32 checksum is almost as reliable as a CRC32 but can be computed
Usage example:
- uint32_t adler = adler32(0L, Z_NULL, 0);
+ uint32_t adler = adler32(0L, NULL, 0);
while (read_buffer(buffer, length) != EOF) {
adler = adler32(adler, buffer, length);
ZEXTERN uint32_t ZEXPORT crc32(uint32_t crc, const unsigned char *buf, z_off64_t len);
/*
Update a running CRC-32 with the bytes buf[0..len-1] and return the
- updated CRC-32. If buf is Z_NULL, this function returns the required
+ updated CRC-32. If buf is NULL, this function returns the required
initial value for the crc. Pre- and post-conditioning (one's complement) is
performed within this function so it shouldn't be done by the application.
Usage example:
- uint32_t crc = crc32(0L, Z_NULL, 0);
+ uint32_t crc = crc32(0L, NULL, 0);
while (read_buffer(buffer, length) != EOF) {
crc = crc32(crc, buffer, length);