]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Type cleanup...
authorMika Lindqvist <postmaster@raasu.org>
Fri, 17 Feb 2017 07:55:52 +0000 (09:55 +0200)
committerHans Kristian Rosbach <hk-git@circlestorm.org>
Sat, 25 Feb 2017 11:52:11 +0000 (12:52 +0100)
* gz_statep -> gz_state *

gzclose.c
gzguts.h
gzlib.c
gzread.c
gzwrite.c

index 48d6a86f04b6ea57f7158c19694023a9948438da..395f123979f16d90394fb826923589181376555b 100644 (file)
--- a/gzclose.c
+++ b/gzclose.c
    unneeded compression or decompression routines. */
 int ZEXPORT gzclose(gzFile file) {
 #ifndef NO_GZCOMPRESS
-    gz_statestate;
+    gz_state *state;
 
     if (file == NULL)
         return Z_STREAM_ERROR;
-    state = (gz_statep)file;
+    state = (gz_state *)file;
 
     return state->mode == GZ_READ ? gzclose_r(file) : gzclose_w(file);
 #else
index 89bd3ecbacd42a97f16c6c3f88bb9e875a35fa52..d7abe217366813880e54aa894c8de1b1e239f20e 100644 (file)
--- a/gzguts.h
+++ b/gzguts.h
@@ -138,7 +138,7 @@ typedef struct {
 typedef gz_state *gz_statep;
 
 /* shared functions */
-void ZLIB_INTERNAL gz_error(gz_statep, int, const char *);
+void ZLIB_INTERNAL gz_error(gz_state *, int, const char *);
 
 /* GT_OFF(x), where x is an unsigned value, is true if x > maximum z_off64_t
    value -- needed when comparing unsigned to z_off64_t, which is signed
diff --git a/gzlib.c b/gzlib.c
index 61f71da118b026b20c5d472d97b92b37e65c110d..4c62fdacb0d4533f3783f605861adb192b1cb9c3 100644 (file)
--- a/gzlib.c
+++ b/gzlib.c
 #endif
 
 /* Local functions */
-static void gz_reset(gz_statep);
+static void gz_reset(gz_state *);
 static gzFile gz_open(const void *, int, const char *);
 
 /* Reset gzip file state */
-static void gz_reset(gz_statestate) {
+static void gz_reset(gz_state *state) {
     state->x.have = 0;              /* no output data available */
     if (state->mode == GZ_READ) {   /* for reading ... */
         state->eof = 0;             /* not at end of file */
@@ -35,7 +35,7 @@ static void gz_reset(gz_statep state) {
 
 /* Open a gzip file either by name or file descriptor. */
 static gzFile gz_open(const void *path, int fd, const char *mode) {
-    gz_statestate;
+    gz_state *state;
     size_t len;
     int oflag;
 #ifdef O_CLOEXEC
@@ -50,7 +50,7 @@ static gzFile gz_open(const void *path, int fd, const char *mode) {
         return NULL;
 
     /* allocate gzFile structure to return */
-    state = (gz_statep)malloc(sizeof(gz_state));
+    state = (gz_state *)malloc(sizeof(gz_state));
     if (state == NULL)
         return NULL;
     state->size = 0;            /* no buffers allocated yet */
@@ -239,12 +239,12 @@ gzFile ZEXPORT gzopen_w(const wchar_t *path, const char *mode) {
 
 /* -- see zlib.h -- */
 int ZEXPORT gzbuffer(gzFile file, unsigned size) {
-    gz_statestate;
+    gz_state *state;
 
     /* get internal structure and check integrity */
     if (file == NULL)
         return -1;
-    state = (gz_statep)file;
+    state = (gz_state *)file;
     if (state->mode != GZ_READ && state->mode != GZ_WRITE)
         return -1;
 
@@ -263,12 +263,12 @@ int ZEXPORT gzbuffer(gzFile file, unsigned size) {
 
 /* -- see zlib.h -- */
 int ZEXPORT gzrewind(gzFile file) {
-    gz_statestate;
+    gz_state *state;
 
     /* get internal structure */
     if (file == NULL)
         return -1;
-    state = (gz_statep)file;
+    state = (gz_state *)file;
 
     /* check that we're reading and that there's no error */
     if (state->mode != GZ_READ || (state->err != Z_OK && state->err != Z_BUF_ERROR))
@@ -285,12 +285,12 @@ int ZEXPORT gzrewind(gzFile file) {
 z_off64_t ZEXPORT gzseek64(gzFile file, z_off64_t offset, int whence) {
     unsigned n;
     z_off64_t ret;
-    gz_statestate;
+    gz_state *state;
 
     /* get internal structure and check integrity */
     if (file == NULL)
         return -1;
-    state = (gz_statep)file;
+    state = (gz_state *)file;
     if (state->mode != GZ_READ && state->mode != GZ_WRITE)
         return -1;
 
@@ -362,12 +362,12 @@ z_off_t ZEXPORT gzseek(gzFile file, z_off_t offset, int whence) {
 
 /* -- see zlib.h -- */
 z_off64_t ZEXPORT gztell64(gzFile file) {
-    gz_statestate;
+    gz_state *state;
 
     /* get internal structure and check integrity */
     if (file == NULL)
         return -1;
-    state = (gz_statep)file;
+    state = (gz_state *)file;
     if (state->mode != GZ_READ && state->mode != GZ_WRITE)
         return -1;
 
@@ -386,12 +386,12 @@ z_off_t ZEXPORT gztell(gzFile file) {
 /* -- see zlib.h -- */
 z_off64_t ZEXPORT gzoffset64(gzFile file) {
     z_off64_t offset;
-    gz_statestate;
+    gz_state *state;
 
     /* get internal structure and check integrity */
     if (file == NULL)
         return -1;
-    state = (gz_statep)file;
+    state = (gz_state *)file;
     if (state->mode != GZ_READ && state->mode != GZ_WRITE)
         return -1;
 
@@ -414,12 +414,12 @@ z_off_t ZEXPORT gzoffset(gzFile file) {
 
 /* -- see zlib.h -- */
 int ZEXPORT gzeof(gzFile file) {
-    gz_statestate;
+    gz_state *state;
 
     /* get internal structure and check integrity */
     if (file == NULL)
         return 0;
-    state = (gz_statep)file;
+    state = (gz_state *)file;
     if (state->mode != GZ_READ && state->mode != GZ_WRITE)
         return 0;
 
@@ -429,12 +429,12 @@ int ZEXPORT gzeof(gzFile file) {
 
 /* -- see zlib.h -- */
 const char * ZEXPORT gzerror(gzFile file, int *errnum) {
-    gz_statestate;
+    gz_state *state;
 
     /* get internal structure and check integrity */
     if (file == NULL)
         return NULL;
-    state = (gz_statep)file;
+    state = (gz_state *)file;
     if (state->mode != GZ_READ && state->mode != GZ_WRITE)
         return NULL;
 
@@ -446,12 +446,12 @@ const char * ZEXPORT gzerror(gzFile file, int *errnum) {
 
 /* -- see zlib.h -- */
 void ZEXPORT gzclearerr(gzFile file) {
-    gz_statestate;
+    gz_state *state;
 
     /* get internal structure and check integrity */
     if (file == NULL)
         return;
-    state = (gz_statep)file;
+    state = (gz_state *)file;
     if (state->mode != GZ_READ && state->mode != GZ_WRITE)
         return;
 
@@ -469,7 +469,7 @@ void ZEXPORT gzclearerr(gzFile file) {
    memory).  Simply save the error message as a static string.  If there is an
    allocation failure constructing the error message, then convert the error to
    out of memory. */
-void ZLIB_INTERNAL gz_error(gz_statestate, int err, const char *msg) {
+void ZLIB_INTERNAL gz_error(gz_state *state, int err, const char *msg) {
     /* free previously allocated message and clear */
     if (state->msg != NULL) {
         if (state->err != Z_MEM_ERROR)
index 50b924447870f04c70477aa7beb70aa136b725b7..c8ec08fbd6c4575cd0a30d281bf3101b51ff13a9 100644 (file)
--- a/gzread.c
+++ b/gzread.c
@@ -6,19 +6,19 @@
 #include "gzguts.h"
 
 /* Local functions */
-static int gz_load(gz_statep, unsigned char *, unsigned, unsigned *);
-static int gz_avail(gz_statep);
-static int gz_look(gz_statep);
-static int gz_decomp(gz_statep);
-static int gz_fetch(gz_statep);
-static int gz_skip(gz_statep, z_off64_t);
-static size_t gz_read(gz_statep, void *, size_t);
+static int gz_load(gz_state *, unsigned char *, unsigned, unsigned *);
+static int gz_avail(gz_state *);
+static int gz_look(gz_state *);
+static int gz_decomp(gz_state *);
+static int gz_fetch(gz_state *);
+static int gz_skip(gz_state *, z_off64_t);
+static size_t gz_read(gz_state *, void *, size_t);
 
 /* Use read() to load a buffer -- return -1 on error, otherwise 0.  Read from
    state->fd, and update state->eof, state->err, and state->msg as appropriate.
    This function needs to loop on read(), since read() is not guaranteed to
    read the number of bytes requested, depending on the type of descriptor. */
-static int gz_load(gz_statestate, unsigned char *buf, unsigned len, unsigned *have) {
+static int gz_load(gz_state *state, unsigned char *buf, unsigned len, unsigned *have) {
     ssize_t ret;
 
     *have = 0;
@@ -44,7 +44,7 @@ static int gz_load(gz_statep state, unsigned char *buf, unsigned len, unsigned *
    If strm->avail_in != 0, then the current data is moved to the beginning of
    the input buffer, and then the remainder of the buffer is loaded with the
    available data from the input file. */
-static int gz_avail(gz_statestate) {
+static int gz_avail(gz_state *state) {
     unsigned got;
     z_stream *strm = &(state->strm);
 
@@ -76,7 +76,7 @@ static int gz_avail(gz_statep state) {
    case, all further file reads will be directly to either the output buffer or
    a user buffer.  If decompressing, the inflate state will be initialized.
    gz_look() will return 0 on success or -1 on failure. */
-static int gz_look(gz_statestate) {
+static int gz_look(gz_state *state) {
     z_stream *strm = &(state->strm);
 
     /* allocate read buffers and inflate memory */
@@ -158,7 +158,7 @@ static int gz_look(gz_statep state) {
    data.  If the gzip stream completes, state->how is reset to LOOK to look for
    the next gzip stream or raw data, once state->x.have is depleted.  Returns 0
    on success, -1 on failure. */
-static int gz_decomp(gz_statestate) {
+static int gz_decomp(gz_state *state) {
     int ret = Z_OK;
     unsigned had;
     z_stream *strm = &(state->strm);
@@ -208,7 +208,7 @@ static int gz_decomp(gz_statep state) {
    looked for to determine whether to copy or decompress.  Returns -1 on error,
    otherwise 0.  gz_fetch() will leave state->how as COPY or GZIP unless the
    end of the input file has been reached and all data has been processed.  */
-static int gz_fetch(gz_statestate) {
+static int gz_fetch(gz_state *state) {
     z_stream *strm = &(state->strm);
 
     do {
@@ -236,7 +236,7 @@ static int gz_fetch(gz_statep state) {
 }
 
 /* Skip len uncompressed bytes of output.  Return -1 on error, 0 on success. */
-static int gz_skip(gz_statestate, z_off64_t len) {
+static int gz_skip(gz_state *state, z_off64_t len) {
     unsigned n;
 
     /* skip over len bytes or reach end-of-file, whichever comes first */
@@ -265,7 +265,7 @@ static int gz_skip(gz_statep state, z_off64_t len) {
    input.  Return the number of bytes read.  If zero is returned, either the
    end of file was reached, or there was an error.  state->err must be
    consulted in that case to determine which. */
-static size_t gz_read(gz_statestate, void *buf, size_t len) {
+static size_t gz_read(gz_state *state, void *buf, size_t len) {
     size_t got;
     unsigned n;
 
@@ -343,12 +343,12 @@ static size_t gz_read(gz_statep state, void *buf, size_t len) {
 
 /* -- see zlib.h -- */
 int ZEXPORT gzread(gzFile file, void *buf, unsigned len) {
-    gz_statestate;
+    gz_state *state;
 
     /* get internal structure */
     if (file == NULL)
         return -1;
-    state = (gz_statep)file;
+    state = (gz_state *)file;
 
     /* check that we're reading and that there's no (serious) error */
     if (state->mode != GZ_READ ||
@@ -376,12 +376,12 @@ int ZEXPORT gzread(gzFile file, void *buf, unsigned len) {
 /* -- see zlib.h -- */
 size_t ZEXPORT gzfread(void *buf, size_t size, size_t nitems, gzFile file) {
     size_t len;
-    gz_statestate;
+    gz_state *state;
 
     /* get internal structure */
     if (file == NULL)
         return 0;
-    state = (gz_statep)file;
+    state = (gz_state *)file;
 
     /* check that we're reading and that there's no (serious) error */
     if (state->mode != GZ_READ ||
@@ -404,12 +404,12 @@ size_t ZEXPORT gzfread(void *buf, size_t size, size_t nitems, gzFile file) {
 int ZEXPORT gzgetc(gzFile file) {
     int ret;
     unsigned char buf[1];
-    gz_statestate;
+    gz_state *state;
 
     /* get internal structure */
     if (file == NULL)
         return -1;
-    state = (gz_statep)file;
+    state = (gz_state *)file;
 
     /* check that we're reading and that there's no (serious) error */
     if (state->mode != GZ_READ || (state->err != Z_OK && state->err != Z_BUF_ERROR))
@@ -433,12 +433,12 @@ int ZEXPORT gzgetc_(gzFile file) {
 
 /* -- see zlib.h -- */
 int ZEXPORT gzungetc(int c, gzFile file) {
-    gz_statestate;
+    gz_state *state;
 
     /* get internal structure */
     if (file == NULL)
         return -1;
-    state = (gz_statep)file;
+    state = (gz_state *)file;
 
     /* check that we're reading and that there's no (serious) error */
     if (state->mode != GZ_READ || (state->err != Z_OK && state->err != Z_BUF_ERROR))
@@ -492,12 +492,12 @@ char * ZEXPORT gzgets(gzFile file, char *buf, int len) {
     unsigned left, n;
     char *str;
     unsigned char *eol;
-    gz_statestate;
+    gz_state *state;
 
     /* check parameters and get internal structure */
     if (file == NULL || buf == NULL || len < 1)
         return NULL;
-    state = (gz_statep)file;
+    state = (gz_state *)file;
 
     /* check that we're reading and that there's no (serious) error */
     if (state->mode != GZ_READ || (state->err != Z_OK && state->err != Z_BUF_ERROR))
@@ -548,13 +548,13 @@ char * ZEXPORT gzgets(gzFile file, char *buf, int len) {
 
 /* -- see zlib.h -- */
 int ZEXPORT gzdirect(gzFile file) {
-    gz_statestate;
+    gz_state *state;
 
     /* get internal structure */
     if (file == NULL)
         return 0;
 
-    state = (gz_statep)file;
+    state = (gz_state *)file;
 
     /* if the state is not known, but we can find out, then do so (this is
        mainly for right after a gzopen() or gzdopen()) */
@@ -568,13 +568,13 @@ int ZEXPORT gzdirect(gzFile file) {
 /* -- see zlib.h -- */
 int ZEXPORT gzclose_r(gzFile file) {
     int ret, err;
-    gz_statestate;
+    gz_state *state;
 
     /* get internal structure */
     if (file == NULL)
         return Z_STREAM_ERROR;
 
-    state = (gz_statep)file;
+    state = (gz_state *)file;
 
     /* check that we're reading */
     if (state->mode != GZ_READ)
index 0ebc32f7b29fd08b69be9b3ad658716493db463c..80305261b24c82cfae65461fa1dd12d27277c76b 100644 (file)
--- a/gzwrite.c
+++ b/gzwrite.c
@@ -7,15 +7,15 @@
 #include "gzguts.h"
 
 /* Local functions */
-static int gz_init(gz_statep);
-static int gz_comp(gz_statep, int);
-static int gz_zero(gz_statep, z_off64_t);
-static size_t gz_write(gz_statep, void const *, size_t);
+static int gz_init(gz_state *);
+static int gz_comp(gz_state *, int);
+static int gz_zero(gz_state *, z_off64_t);
+static size_t gz_write(gz_state *, void const *, size_t);
 
 /* Initialize state for writing a gzip file.  Mark initialization by setting
    state->size to non-zero.  Return -1 on a memory allocation failure, or 0 on
    success. */
-static int gz_init(gz_statestate) {
+static int gz_init(gz_state *state) {
     int ret;
     z_stream *strm = &(state->strm);
 
@@ -68,7 +68,7 @@ static int gz_init(gz_statep state) {
    deflate() flush value.  If flush is Z_FINISH, then the deflate() state is
    reset to start a new gzip stream.  If gz->direct is true, then simply write
    to the output file without compressing, and ignore flush. */
-static int gz_comp(gz_statestate, int flush) {
+static int gz_comp(gz_state *state, int flush) {
     int ret;
     ssize_t got;
     unsigned have;
@@ -128,7 +128,7 @@ static int gz_comp(gz_statep state, int flush) {
 
 /* Compress len zeros to output.  Return -1 on a write error or memory
    allocation failure by gz_comp(), or 0 on success. */
-static int gz_zero(gz_statestate, z_off64_t len) {
+static int gz_zero(gz_state *state, z_off64_t len) {
     int first;
     unsigned n;
     z_stream *strm = &(state->strm);
@@ -157,7 +157,7 @@ static int gz_zero(gz_statep state, z_off64_t len) {
 
 /* Write len bytes from buf to file.  Return the number of bytes written.  If
    the returned value is less than len, then there was an error. */
-static size_t gz_write(gz_statestate, void const *buf, size_t len) {
+static size_t gz_write(gz_state *state, void const *buf, size_t len) {
     size_t put = len;
 
     /* if len is zero, avoid unnecessary operations */
@@ -221,12 +221,12 @@ static size_t gz_write(gz_statep state, void const *buf, size_t len) {
 
 /* -- see zlib.h -- */
 int ZEXPORT gzwrite(gzFile file, void const *buf, unsigned len) {
-    gz_statestate;
+    gz_state *state;
 
     /* get internal structure */
     if (file == NULL)
         return 0;
-    state = (gz_statep)file;
+    state = (gz_state *)file;
 
     /* check that we're writing and that there's no error */
     if (state->mode != GZ_WRITE || state->err != Z_OK)
@@ -246,12 +246,12 @@ int ZEXPORT gzwrite(gzFile file, void const *buf, unsigned len) {
 /* -- see zlib.h -- */
 size_t ZEXPORT gzfwrite(void const *buf, size_t size, size_t nitems, gzFile file) {
     size_t len;
-    gz_statestate;
+    gz_state *state;
 
     /* get internal structure */
     if (file == NULL)
         return 0;
-    state = (gz_statep)file;
+    state = (gz_state *)file;
 
     /* check that we're writing and that there's no error */
     if (state->mode != GZ_WRITE || state->err != Z_OK)
@@ -272,13 +272,13 @@ size_t ZEXPORT gzfwrite(void const *buf, size_t size, size_t nitems, gzFile file
 int ZEXPORT gzputc(gzFile file, int c) {
     unsigned have;
     unsigned char buf[1];
-    gz_statestate;
+    gz_state *state;
     z_stream *strm;
 
     /* get internal structure */
     if (file == NULL)
         return -1;
-    state = (gz_statep)file;
+    state = (gz_state *)file;
     strm = &(state->strm);
 
     /* check that we're writing and that there's no error */
@@ -317,12 +317,12 @@ int ZEXPORT gzputc(gzFile file, int c) {
 int ZEXPORT gzputs(gzFile file, const char *str) {
     int ret;
     size_t len;
-    gz_statestate;
+    gz_state *state;
 
     /* get internal structure */
     if (file == NULL)
         return -1;
-    state = (gz_statep)file;
+    state = (gz_state *)file;
 
     /* check that we're writing and that there's no error */
     if (state->mode != GZ_WRITE || state->err != Z_OK)
@@ -339,13 +339,13 @@ int ZEXPORTVA gzvprintf(gzFile file, const char *format, va_list va) {
     int len;
     unsigned left;
     char *next;
-    gz_statestate;
+    gz_state *state;
     z_stream *strm;
 
     /* get internal structure */
     if (file == NULL)
         return Z_STREAM_ERROR;
-    state = (gz_statep)file;
+    state = (gz_state *)file;
     strm = &(state->strm);
 
     /* check that we're writing and that there's no error */
@@ -403,12 +403,12 @@ int ZEXPORTVA gzprintf(gzFile file, const char *format, ...) {
 
 /* -- see zlib.h -- */
 int ZEXPORT gzflush(gzFile file, int flush) {
-    gz_statestate;
+    gz_state *state;
 
     /* get internal structure */
     if (file == NULL)
         return Z_STREAM_ERROR;
-    state = (gz_statep)file;
+    state = (gz_state *)file;
 
     /* check that we're writing and that there's no error */
     if (state->mode != GZ_WRITE || state->err != Z_OK)
@@ -432,13 +432,13 @@ int ZEXPORT gzflush(gzFile file, int flush) {
 
 /* -- see zlib.h -- */
 int ZEXPORT gzsetparams(gzFile file, int level, int strategy) {
-    gz_statestate;
+    gz_state *state;
     z_stream *strm;
 
     /* get internal structure */
     if (file == NULL)
         return Z_STREAM_ERROR;
-    state = (gz_statep)file;
+    state = (gz_state *)file;
     strm = &(state->strm);
 
     /* check that we're writing and that there's no error */
@@ -471,12 +471,12 @@ int ZEXPORT gzsetparams(gzFile file, int level, int strategy) {
 /* -- see zlib.h -- */
 int ZEXPORT gzclose_w(gzFile file) {
     int ret = Z_OK;
-    gz_statestate;
+    gz_state *state;
 
     /* get internal structure */
     if (file == NULL)
         return Z_STREAM_ERROR;
-    state = (gz_statep)file;
+    state = (gz_state *)file;
 
     /* check that we're writing */
     if (state->mode != GZ_WRITE)