diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2013-05-15 10:41:03 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2013-05-15 10:41:03 (GMT) |
commit | f4d3ebde2af3c5df88de0299af83dddf06c41822 (patch) | |
tree | e41acfb37b7397d31cf5d91943a5ebf8bd2f7ca6 /compat/zlib/gzread.c | |
parent | 1eacac1aa2e8e1f6a11ad280d4d5ac4774672c81 (diff) | |
parent | 1d99d2af062fbf3e3af72e1347840eb3555250dc (diff) | |
download | tcl-f4d3ebde2af3c5df88de0299af83dddf06c41822.zip tcl-f4d3ebde2af3c5df88de0299af83dddf06c41822.tar.gz tcl-f4d3ebde2af3c5df88de0299af83dddf06c41822.tar.bz2 |
merge trunkdkf_bcc_optimize
Diffstat (limited to 'compat/zlib/gzread.c')
-rw-r--r-- | compat/zlib/gzread.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/compat/zlib/gzread.c b/compat/zlib/gzread.c index 3493d34..bf4538e 100644 --- a/compat/zlib/gzread.c +++ b/compat/zlib/gzread.c @@ -1,5 +1,5 @@ /* gzread.c -- zlib functions for reading gzip files - * Copyright (C) 2004, 2005, 2010, 2011, 2012 Mark Adler + * Copyright (C) 2004, 2005, 2010, 2011, 2012, 2013 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -58,7 +58,8 @@ local int gz_avail(state) return -1; if (state->eof == 0) { if (strm->avail_in) { /* copy what's there to the start */ - unsigned char *p = state->in, *q = strm->next_in; + unsigned char *p = state->in; + unsigned const char *q = strm->next_in; unsigned n = strm->avail_in; do { *p++ = *q++; @@ -90,8 +91,8 @@ local int gz_look(state) /* allocate read buffers and inflate memory */ if (state->size == 0) { /* allocate buffers */ - state->in = malloc(state->want); - state->out = malloc(state->want << 1); + state->in = (unsigned char *)malloc(state->want); + state->out = (unsigned char *)malloc(state->want << 1); if (state->in == NULL || state->out == NULL) { if (state->out != NULL) free(state->out); @@ -352,14 +353,14 @@ int ZEXPORT gzread(file, buf, len) /* large len -- read directly into user buffer */ else if (state->how == COPY) { /* read directly */ - if (gz_load(state, buf, len, &n) == -1) + if (gz_load(state, (unsigned char *)buf, len, &n) == -1) return -1; } /* large len -- decompress directly into user buffer */ else { /* state->how == GZIP */ strm->avail_out = len; - strm->next_out = buf; + strm->next_out = (unsigned char *)buf; if (gz_decomp(state) == -1) return -1; n = state->x.have; @@ -378,7 +379,11 @@ int ZEXPORT gzread(file, buf, len) } /* -- see zlib.h -- */ -#undef gzgetc +#ifdef Z_PREFIX_SET +# undef z_gzgetc +#else +# undef gzgetc +#endif int ZEXPORT gzgetc(file) gzFile file; { @@ -518,7 +523,7 @@ char * ZEXPORT gzgets(file, buf, len) /* look for end-of-line in current output buffer */ n = state->x.have > left ? left : state->x.have; - eol = memchr(state->x.next, '\n', n); + eol = (unsigned char *)memchr(state->x.next, '\n', n); if (eol != NULL) n = (unsigned)(eol - state->x.next) + 1; |