From: Hans Kristian Rosbach Date: Sun, 26 Apr 2015 19:06:49 +0000 (+0200) Subject: Cleanup: Replace 'voidp' with 'void *' X-Git-Tag: 1.9.9-b1~875 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e5ee314ad46a9532256bfc63084fd6199fe5d5ec;p=thirdparty%2Fzlib-ng.git Cleanup: Replace 'voidp' with 'void *' --- diff --git a/compress.c b/compress.c index cdb603c4a..ba296773f 100644 --- a/compress.c +++ b/compress.c @@ -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; diff --git a/deflate.c b/deflate.c index b5af395b3..74e81007a 100644 --- 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); diff --git a/gzread.c b/gzread.c index 63067fdef..1f7a2e7e8 100644 --- 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; - voidp buf; + void *buf; unsigned len; { unsigned got, n; diff --git a/infback.c b/infback.c index f723fb755..5df222124 100644 --- 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) diff --git a/inflate.c b/inflate.c index d683760d0..4e3b9e743 100644 --- 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); diff --git a/test/example.c b/test/example.c index 611f89c78..50fc370a9 100644 --- a/test/example.c +++ b/test/example.c @@ -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 e5499ee79..2a240f9a5 100644 --- 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, voidp buf, 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 adb470f87..ada99dd3b 100644 --- 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 */