Skip to content

Commit

Permalink
Type cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
mtl1979 committed Dec 14, 2015
1 parent e478ddb commit 9c3a280
Show file tree
Hide file tree
Showing 24 changed files with 343 additions and 343 deletions.
2 changes: 1 addition & 1 deletion adler32.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ static uint32_t adler32_combine_(uint32_t adler1, uint32_t adler2, z_off64_t len
#endif

/* ========================================================================= */
uint32_t ZEXPORT adler32(uint32_t adler, const unsigned char *buf, uInt len) {
uint32_t ZEXPORT adler32(uint32_t adler, const unsigned char *buf, uint32_t len) {
uint32_t sum2;
unsigned n;

Expand Down
16 changes: 8 additions & 8 deletions arch/x86/fill_window_sse.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ ZLIB_INTERNAL void fill_window_sse(deflate_state *s) {
register unsigned n;
register Pos *p;
unsigned more; /* Amount of free space at the end of the window. */
uInt wsize = s->w_size;
unsigned int wsize = s->w_size;

Assert(s->lookahead < MIN_LOOKAHEAD, "already enough lookahead");

do {
more = (unsigned)(s->window_size -(ulg)s->lookahead -(ulg)s->strstart);
more = (unsigned)(s->window_size -(unsigned long)s->lookahead -(unsigned long)s->strstart);

/* Deal with !@#$% 64K limit: */
if (sizeof(int) <= 2) {
Expand Down Expand Up @@ -105,7 +105,7 @@ ZLIB_INTERNAL void fill_window_sse(deflate_state *s) {

/* Initialize the hash value now that we have some input: */
if (s->lookahead + s->insert >= MIN_MATCH) {
uInt str = s->strstart - s->insert;
unsigned int str = s->strstart - s->insert;
s->ins_h = s->window[str];
if (str >= 1)
UPDATE_HASH(s, s->ins_h, str + 1 - (MIN_MATCH-1));
Expand Down Expand Up @@ -135,8 +135,8 @@ ZLIB_INTERNAL void fill_window_sse(deflate_state *s) {
* routines allow scanning to strstart + MAX_MATCH, ignoring lookahead.
*/
if (s->high_water < s->window_size) {
ulg curr = s->strstart + (ulg)(s->lookahead);
ulg init;
unsigned long curr = s->strstart + (unsigned long)(s->lookahead);
unsigned long init;

if (s->high_water < curr) {
/* Previous high water mark below current data -- zero WIN_INIT
Expand All @@ -147,19 +147,19 @@ ZLIB_INTERNAL void fill_window_sse(deflate_state *s) {
init = WIN_INIT;
memset(s->window + curr, 0, (unsigned)init);
s->high_water = curr + init;
} else if (s->high_water < (ulg)curr + WIN_INIT) {
} else if (s->high_water < (unsigned long)curr + WIN_INIT) {
/* High water mark at or above current data, but below current data
* plus WIN_INIT -- zero out to current data plus WIN_INIT, or up
* to end of window, whichever is less.
*/
init = (ulg)curr + WIN_INIT - s->high_water;
init = (unsigned long)curr + WIN_INIT - s->high_water;
if (init > s->window_size - s->high_water)
init = s->window_size - s->high_water;
memset(s->window + s->high_water, 0, (unsigned)init);
s->high_water += init;
}
}

Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD, "not enough room for search");
Assert((unsigned long)s->strstart <= s->window_size - MIN_LOOKAHEAD, "not enough room for search");
}
#endif
23 changes: 11 additions & 12 deletions compress.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* compress.c -- compress a memory buffer
* Copyright (C) 1995-2005, 2014 Jean-loup Gailly, Mark Adler
* Copyright (C) 1995-2005, 2014 Jean-loup Gailly, Mark Adler.
* For conditions of distribution and use, see copyright notice in zlib.h
*/

Expand All @@ -19,12 +19,12 @@
memory, Z_BUF_ERROR if there was not enough room in the output buffer,
Z_STREAM_ERROR if the level parameter is invalid.
*/
int ZEXPORT compress2(unsigned char *dest, uLong *destLen, const unsigned char *source,
uLong sourceLen, int level) {
int ZEXPORT compress2(unsigned char *dest, unsigned long *destLen, const unsigned char *source,
unsigned long sourceLen, int level) {
z_stream stream;
int err;
const uInt max = (uInt)0 - 1;
uLong left;
const unsigned int max = (unsigned int)0 - 1;
unsigned long left;

left = *destLen;
*destLen = 0;
Expand All @@ -44,11 +44,11 @@ int ZEXPORT compress2(unsigned char *dest, uLong *destLen, const unsigned char *

do {
if (stream.avail_out == 0) {
stream.avail_out = left > (uLong)max ? max : (uInt)left;
stream.avail_out = left > (unsigned long)max ? max : (unsigned int)left;
left -= stream.avail_out;
}
if (stream.avail_in == 0) {
stream.avail_in = sourceLen > (uLong)max ? max : (uInt)sourceLen;
stream.avail_in = sourceLen > (unsigned long)max ? max : (unsigned int)sourceLen;
sourceLen -= stream.avail_in;
}
err = deflate(&stream, sourceLen ? Z_NO_FLUSH : Z_FINISH);
Expand All @@ -61,15 +61,14 @@ int ZEXPORT compress2(unsigned char *dest, uLong *destLen, const unsigned char *

/* ===========================================================================
*/
int ZEXPORT compress(unsigned char *dest, uLong *destLen, const unsigned char *source, uLong sourceLen) {
int ZEXPORT compress(unsigned char *dest, unsigned long *destLen, const unsigned char *source, unsigned long sourceLen) {
return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION);
}

/* ===========================================================================
If the default memLevel or windowBits for deflateInit() is changed, then
If the default memLevel or windowBits for deflateInit() is changed, then
this function needs to be updated.
*/
uLong ZEXPORT compressBound(uLong sourceLen) {
return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) +
(sourceLen >> 25) + 13;
unsigned long ZEXPORT compressBound(unsigned long sourceLen) {
return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + (sourceLen >> 25) + 13;
}
12 changes: 6 additions & 6 deletions crc32.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

#ifdef __MINGW32__
# include <sys/param.h>
#elif _WIN32
#elif defined(WIN32) || defined(_WIN32)
# define LITTLE_ENDIAN 1234
# define BIG_ENDIAN 4321
# if defined(_M_IX86) || defined(_M_AMD64) || defined(_M_IA64)
Expand Down Expand Up @@ -49,9 +49,9 @@
#include "deflate.h"

#if BYTE_ORDER == LITTLE_ENDIAN
static uint32_t crc32_little(uint32_t, const unsigned char *, unsigned);
static uint32_t crc32_little(uint32_t, const unsigned char *, z_off64_t);
#elif BYTE_ORDER == BIG_ENDIAN
static uint32_t crc32_big(uint32_t, const unsigned char *, unsigned);
static uint32_t crc32_big(uint32_t, const unsigned char *, z_off64_t);
#endif

/* Local functions for crc concatenation */
Expand Down Expand Up @@ -196,7 +196,7 @@ const uint32_t * ZEXPORT get_crc_table(void) {
#define DO4 DO1; DO1; DO1; DO1

/* ========================================================================= */
uint32_t ZEXPORT crc32(uint32_t crc, const unsigned char *buf, uInt len) {
uint32_t ZEXPORT crc32(uint32_t crc, const unsigned char *buf, z_off64_t len) {
if (buf == Z_NULL) return 0;

#ifdef DYNAMIC_CRC_TABLE
Expand Down Expand Up @@ -240,7 +240,7 @@ uint32_t ZEXPORT crc32(uint32_t crc, const unsigned char *buf, uInt len) {
#define DOLIT32 DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4

/* ========================================================================= */
static uint32_t crc32_little(uint32_t crc, const unsigned char *buf, unsigned len) {
static uint32_t crc32_little(uint32_t crc, const unsigned char *buf, z_off64_t len) {
register uint32_t c;
register const uint32_t *buf4;

Expand Down Expand Up @@ -282,7 +282,7 @@ static uint32_t crc32_little(uint32_t crc, const unsigned char *buf, unsigned le
#define DOBIG32 DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4

/* ========================================================================= */
static uint32_t crc32_big(uint32_t crc, const unsigned char *buf, unsigned len) {
static uint32_t crc32_big(uint32_t crc, const unsigned char *buf, z_off64_t len) {
register uint32_t c;
register const uint32_t *buf4;

Expand Down
Loading

0 comments on commit 9c3a280

Please sign in to comment.