]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Cleanup: Replace 'voidp' with 'void *'
authorHans Kristian Rosbach <hk-git@circlestorm.org>
Sun, 26 Apr 2015 19:06:49 +0000 (21:06 +0200)
committerHans Kristian Rosbach <hk-git@circlestorm.org>
Sun, 26 Apr 2015 19:08:25 +0000 (21:08 +0200)
compress.c
deflate.c
gzread.c
infback.c
inflate.c
test/example.c
zlib.h
zutil.c

index cdb603c4a6c2b814f74fa70a363da888b770e0e0..ba296773fc03b86ef18a9683c6566ca91b50cf6b 100644 (file)
@@ -37,7 +37,7 @@ int ZEXPORT compress2 (dest, destLen, source, sourceLen, level)
 
     stream.zalloc = (alloc_func)0;
     stream.zfree = (free_func)0;
-    stream.opaque = (voidp)0;
+    stream.opaque = (void *)0;
 
     err = deflateInit(&stream, level);
     if (err != Z_OK) return err;
index b5af395b38bc640355ff2a0242dfe93b9fbecfe0..74e81007a16d0ef6b094900ccbc3ad34398b9e25 100644 (file)
--- a/deflate.c
+++ b/deflate.c
@@ -280,7 +280,7 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
         return Z_STREAM_ERROR;
 #else
         strm->zalloc = zcalloc;
-        strm->opaque = (voidp)0;
+        strm->opaque = (void *)0;
 #endif
     }
     if (strm->zfree == (free_func)0)
@@ -1074,12 +1074,12 @@ int ZEXPORT deflateCopy (dest, source)
 
     ss = source->state;
 
-    memcpy((voidp)dest, (voidp)source, sizeof(z_stream));
+    memcpy((void *)dest, (void *)source, sizeof(z_stream));
 
     ds = (deflate_state *) ZALLOC(dest, 1, sizeof(deflate_state));
     if (ds == Z_NULL) return Z_MEM_ERROR;
     dest->state = (struct internal_state *) ds;
-    memcpy((voidp)ds, (voidp)ss, sizeof(deflate_state));
+    memcpy((void *)ds, (void *)ss, sizeof(deflate_state));
     ds->strm = dest;
 
     ds->window = (Byte *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte));
@@ -1095,8 +1095,8 @@ int ZEXPORT deflateCopy (dest, source)
     }
 
     memcpy(ds->window, ss->window, ds->w_size * 2 * sizeof(Byte));
-    memcpy((voidp)ds->prev, (voidp)ss->prev, ds->w_size * sizeof(Pos));
-    memcpy((voidp)ds->head, (voidp)ss->head, ds->hash_size * sizeof(Pos));
+    memcpy((void *)ds->prev, (void *)ss->prev, ds->w_size * sizeof(Pos));
+    memcpy((void *)ds->head, (void *)ss->head, ds->hash_size * sizeof(Pos));
     memcpy(ds->pending_buf, ss->pending_buf, (uInt)ds->pending_buf_size);
 
     ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf);
index 63067fdef08bd4c5ccd4e1ec81c0c12da4b67b1a..1f7a2e7e8b5ed17f511d8a97cb7a71257d92e83d 100644 (file)
--- a/gzread.c
+++ b/gzread.c
@@ -277,7 +277,7 @@ local int gz_skip(gz_statep state, z_off64_t len)
 /* -- see zlib.h -- */
 int ZEXPORT gzread(file, buf, len)
     gzFile file;
-    voidbuf;
+    void *buf;
     unsigned len;
 {
     unsigned got, n;
index f723fb755a14c533ca59c0d35807e213a11d2ca0..5df2221241783de8086d89a4a3fdd28284bd38e1 100644 (file)
--- a/infback.c
+++ b/infback.c
@@ -46,7 +46,7 @@ int stream_size;
         return Z_STREAM_ERROR;
 #else
         strm->zalloc = zcalloc;
-        strm->opaque = (voidp)0;
+        strm->opaque = (void *)0;
 #endif
     }
     if (strm->zfree == (free_func)0)
index d683760d07f36eea09faa6ebb2d478245699eb1a..4e3b9e743b1b4a90b01dda42907db5701eeaf88d 100644 (file)
--- a/inflate.c
+++ b/inflate.c
@@ -194,7 +194,7 @@ int stream_size;
         return Z_STREAM_ERROR;
 #else
         strm->zalloc = zcalloc;
-        strm->opaque = (voidp)0;
+        strm->opaque = (void *)0;
 #endif
     }
     if (strm->zfree == (free_func)0)
@@ -1456,8 +1456,8 @@ z_streamp source;
     }
 
     /* copy state */
-    memcpy((voidp)dest, (voidp)source, sizeof(z_stream));
-    memcpy((voidp)copy, (voidp)state, sizeof(struct inflate_state));
+    memcpy((void *)dest, (void *)source, sizeof(z_stream));
+    memcpy((void *)copy, (void *)state, sizeof(struct inflate_state));
     if (state->lencode >= state->codes &&
         state->lencode <= state->codes + ENOUGH - 1) {
         copy->lencode = copy->codes + (state->lencode - state->codes);
index 611f89c78ab6231102c360f403c8c6744980f334..50fc370a9cb0a02560656fafeff832e2240eb1de 100644 (file)
@@ -187,7 +187,7 @@ void test_deflate(Byte *compr, uLong comprLen)
 
     c_stream.zalloc = zalloc;
     c_stream.zfree = zfree;
-    c_stream.opaque = (voidp)0;
+    c_stream.opaque = (void *)0;
 
     err = deflateInit(&c_stream, Z_DEFAULT_COMPRESSION);
     CHECK_ERR(err, "deflateInit");
@@ -224,7 +224,7 @@ void test_inflate(Byte *compr, uLong comprLen, Byte *uncompr, uLong uncomprLen)
 
     d_stream.zalloc = zalloc;
     d_stream.zfree = zfree;
-    d_stream.opaque = (voidp)0;
+    d_stream.opaque = (void *)0;
 
     d_stream.next_in  = compr;
     d_stream.avail_in = 0;
@@ -261,7 +261,7 @@ void test_large_deflate(Byte *compr, uLong comprLen, Byte *uncompr, uLong uncomp
 
     c_stream.zalloc = zalloc;
     c_stream.zfree = zfree;
-    c_stream.opaque = (voidp)0;
+    c_stream.opaque = (void *)0;
 
     err = deflateInit(&c_stream, Z_BEST_SPEED);
     CHECK_ERR(err, "deflateInit");
@@ -316,7 +316,7 @@ void test_large_inflate(Byte *compr, uLong comprLen, Byte *uncompr, uLong uncomp
 
     d_stream.zalloc = zalloc;
     d_stream.zfree = zfree;
-    d_stream.opaque = (voidp)0;
+    d_stream.opaque = (void *)0;
 
     d_stream.next_in  = compr;
     d_stream.avail_in = (uInt)comprLen;
@@ -354,7 +354,7 @@ void test_flush(Byte *compr, uLong *comprLen)
 
     c_stream.zalloc = zalloc;
     c_stream.zfree = zfree;
-    c_stream.opaque = (voidp)0;
+    c_stream.opaque = (void *)0;
 
     err = deflateInit(&c_stream, Z_DEFAULT_COMPRESSION);
     CHECK_ERR(err, "deflateInit");
@@ -391,7 +391,7 @@ void test_sync(Byte *compr, uLong comprLen, Byte *uncompr, uLong uncomprLen)
 
     d_stream.zalloc = zalloc;
     d_stream.zfree = zfree;
-    d_stream.opaque = (voidp)0;
+    d_stream.opaque = (void *)0;
 
     d_stream.next_in  = compr;
     d_stream.avail_in = 2; /* just read the zlib header */
@@ -431,7 +431,7 @@ void test_dict_deflate(Byte *compr, uLong comprLen)
 
     c_stream.zalloc = zalloc;
     c_stream.zfree = zfree;
-    c_stream.opaque = (voidp)0;
+    c_stream.opaque = (void *)0;
 
     err = deflateInit(&c_stream, Z_BEST_COMPRESSION);
     CHECK_ERR(err, "deflateInit");
@@ -468,7 +468,7 @@ void test_dict_inflate(Byte *compr, uLong comprLen, Byte *uncompr, uLong uncompr
 
     d_stream.zalloc = zalloc;
     d_stream.zfree = zfree;
-    d_stream.opaque = (voidp)0;
+    d_stream.opaque = (void *)0;
 
     d_stream.next_in  = compr;
     d_stream.avail_in = (uInt)comprLen;
diff --git a/zlib.h b/zlib.h
index e5499ee7911363e41b127c8985f8ccb54aeda4b9..2a240f9a5aa0dde87fc9b71792831a08e6af511e 100644 (file)
--- a/zlib.h
+++ b/zlib.h
@@ -84,8 +84,8 @@ extern "C" {
   even in case of corrupted input.
 */
 
-typedef voidp  (*alloc_func) (voidp opaque, uInt items, uInt size);
-typedef void   (*free_func)  (voidp opaque, voidp address);
+typedef void *(*alloc_func) (void *opaque, uInt items, uInt size);
+typedef void  (*free_func)  (void *opaque, void *address);
 
 struct internal_state;
 
@@ -103,7 +103,7 @@ typedef struct z_stream_s {
 
     alloc_func zalloc;  /* used to allocate the internal state */
     free_func  zfree;   /* used to free the internal state */
-    voidp      opaque;  /* private data object passed to zalloc and zfree */
+    void      *opaque;  /* private data object passed to zalloc and zfree */
 
     int     data_type;  /* best guess about the data type: binary or text */
     uLong   adler;      /* adler32 value of the uncompressed data */
@@ -1108,7 +1108,7 @@ ZEXTERN uLong ZEXPORT zlibCompileFlags (void);
     Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other:
      1.0: size of uInt
      3.2: size of uLong
-     5.4: size of voidp (pointer)
+     5.4: size of void * (pointer)
      7.6: size of z_off_t
 
     Compiler, assembler, and debug options:
@@ -1308,7 +1308,7 @@ ZEXTERN int ZEXPORT gzsetparams (gzFile file, int level, int strategy);
    opened for writing.
 */
 
-ZEXTERN int ZEXPORT gzread (gzFile file, voidbuf, unsigned len);
+ZEXTERN int ZEXPORT gzread (gzFile file, void *buf, unsigned len);
 /*
      Reads the given number of uncompressed bytes from the compressed file.  If
    the input file is not in gzip format, gzread copies the given number of
diff --git a/zutil.c b/zutil.c
index adb470f878559212cd19a8bd33dc8de4dc347ad1..ada99dd3bf7b31bef41f066b71c767f7cda2cdec 100644 (file)
--- a/zutil.c
+++ b/zutil.c
@@ -47,7 +47,7 @@ uLong ZEXPORT zlibCompileFlags()
     case 8:     flags += 2 << 2;        break;
     default:    flags += 3 << 2;
     }
-    switch ((int)(sizeof(voidp))) {
+    switch ((int)(sizeof(void *))) {
     case 2:     break;
     case 4:     flags += 1 << 4;        break;
     case 8:     flags += 2 << 4;        break;
@@ -111,14 +111,14 @@ const char * ZEXPORT zError(err)
 
 #ifndef MY_ZCALLOC /* Any system without a special alloc function */
 
-voidp ZLIB_INTERNAL zcalloc (voidp opaque, unsigned items, unsigned size)
+void ZLIB_INTERNAL *zcalloc (void *opaque, unsigned items, unsigned size)
 {
     if (opaque) items += size - size; /* make compiler happy */
-    return sizeof(uInt) > 2 ? (voidp)malloc(items * size) :
-                              (voidp)calloc(items, size);
+    return sizeof(uInt) > 2 ? (void *)malloc(items * size) :
+                              (void *)calloc(items, size);
 }
 
-void ZLIB_INTERNAL zcfree (voidp opaque, voidp ptr)
+void ZLIB_INTERNAL zcfree (void *opaque, void *ptr)
 {
     free(ptr);
     if (opaque) return; /* make compiler happy */