X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/774ef68f00d3b83a869119720af93b6d57731041..feaa89c410544775afc19eac4a966e8345d5134a:/lib/zlib.c diff --git a/lib/zlib.c b/lib/zlib.c index 82e82c75..a4cf064e 100644 --- a/lib/zlib.c +++ b/lib/zlib.c @@ -252,7 +252,7 @@ typedef struct deflate_state { * hash_shift * MIN_MATCH >= hash_bits */ - long block_start; + Long block_start; /* Window position at the beginning of the current output block. Gets * negative when the window is moved backwards. */ @@ -600,6 +600,7 @@ int deflateInit2 (strm, level, method, windowBits, memLevel, strategy) } s = (deflate_state *) ZALLOC(strm, 1, sizeof(deflate_state)); if (s == Z_NULL) return Z_MEM_ERROR; + bzero(s, sizeof(*s)); strm->state = (struct internal_state FAR *)s; s->strm = strm; @@ -1121,7 +1122,7 @@ local void fill_window(s) s->match_start -= wsize; s->strstart -= wsize; /* we now have strstart >= MAX_DIST */ - s->block_start -= (long) wsize; + s->block_start -= (Long) wsize; /* Slide the hash table (could be avoided with 32 bit values at the expense of memory usage): @@ -1186,7 +1187,7 @@ local void fill_window(s) #define FLUSH_BLOCK_ONLY(s, flush) { \ ct_flush_block(s, (s->block_start >= 0L ? \ (charf *)&s->window[(unsigned)s->block_start] : \ - (charf *)Z_NULL), (long)s->strstart - s->block_start, (flush)); \ + (charf *)Z_NULL), (Long)s->strstart - s->block_start, (flush)); \ s->block_start = s->strstart; \ flush_pending(s->strm); \ Tracev((stderr,"[FLUSH]")); \ @@ -1906,8 +1907,8 @@ local void gen_bitlen(s, desc) if (m > max_code) continue; if (tree[m].Len != (unsigned) bits) { Trace((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits)); - s->opt_len += ((long)bits - (long)tree[m].Len) - *(long)tree[m].Freq; + s->opt_len += ((Long)bits - (Long)tree[m].Len) + *(Long)tree[m].Freq; tree[m].Len = (ush)bits; } n--; @@ -3089,9 +3090,9 @@ struct inflate_blocks_state { /* output bytes */ #define WAVAIL (qread?s->read-q-1:s->end-q) #define LOADOUT {q=s->write;m=WAVAIL;} -#define WRAP {if(q==s->end&&s->read!=s->window){q=s->window;m=WAVAIL;}} +#define ZWRAP {if(q==s->end&&s->read!=s->window){q=s->window;m=WAVAIL;}} #define FLUSH {UPDOUT r=inflate_flush(s,z,r); LOADOUT} -#define NEEDOUT {if(m==0){WRAP if(m==0){FLUSH WRAP if(m==0) LEAVE}}r=Z_OK;} +#define NEEDOUT {if(m==0){ZWRAP if(m==0){FLUSH ZWRAP if(m==0) LEAVE}}r=Z_OK;} #define OUTBYTE(a) {*q++=(Byte)(a);m--;} /* load local pointers */ #define LOAD {LOADIN LOADOUT} @@ -3552,7 +3553,7 @@ z_stream *z; n -= t; z->total_out += t; s->read = q; /* drag read pointer forward */ -/* WRAP */ /* expand WRAP macro by hand to handle s->read */ +/* ZWRAP */ /* expand ZWRAP macro by hand to handle s->read */ if (q == s->end) { s->read = q = s->window; m = WAVAIL; @@ -4577,8 +4578,8 @@ uLong adler32(adler, buf, len) Bytef *buf; uInt len; { - unsigned long s1 = adler & 0xffff; - unsigned long s2 = (adler >> 16) & 0xffff; + uLong s1 = adler & 0xffff; + uLong s2 = (adler >> 16) & 0xffff; int k; if (buf == Z_NULL) return 1L;