[Zlib-devel] A few compiler warnings with 1.2.2.2
Gilles Vollant
info at winimage.com
Sun Feb 6 15:52:02 EST 2005
uInt is 32 bits , size_t is unsigned 64 bits
The other solution I found is :
In inflate.c
zmemcpy(window, state->window, ((size_t)1) << state->wbits);
In inftrees.c
next += ((size_t)1) << curr;
-----Original Message-----
From: Mark Adler [mailto:madler at alumni.caltech.edu]
Sent: Sunday, February 06, 2005 9:34 PM
To: zlib-devel at zlib.net
Subject: Re: [Zlib-devel] A few compiler warnings with 1.2.2.2
On Feb 5, 2005, at 7:59 PM, Gilles Vollant wrote:
> I've also these two warning in 64 bits compiling
> inftrees.c(265) : warning C4334: '<<' : result of 32-bit shift
> implicitly converted to 64 bits (was 64-bit shift intended?)
> inflate.c(1341) : warning C4334: '<<' : result of 32-bit shift
> implicitly converted to 64 bits (was 64-bit shift intended?)
Giles,
Let me know if the patches below help.
mark
gromit% diff -c ../zlib-1.2.2.2/inflate.c inflate.c
*** ../zlib-1.2.2.2/inflate.c Fri Nov 12 21:49:43 2004
--- inflate.c Sun Feb 6 12:29:02 2005
***************
*** 1338,1344 ****
copy->distcode = copy->codes + (state->distcode - state->codes);
copy->next = copy->codes + (state->next - state->codes);
if (window != Z_NULL)
! zmemcpy(window, state->window, 1U << state->wbits);
copy->window = window;
dest->state = (voidpf)copy;
return Z_OK;
--- 1338,1344 ----
copy->distcode = copy->codes + (state->distcode - state->codes);
copy->next = copy->codes + (state->next - state->codes);
if (window != Z_NULL)
! zmemcpy(window, state->window, ((uInt)1) << state->wbits);
copy->window = window;
dest->state = (voidpf)copy;
return Z_OK;
gromit% diff -c ../zlib-1.2.2.2/inftrees.c inftrees.c
*** ../zlib-1.2.2.2/inftrees.c Sun Oct 31 09:54:30 2004
--- inftrees.c Sun Feb 6 12:30:14 2005
***************
*** 262,268 ****
drop = root;
/* increment past last table */
! next += 1U << curr;
/* determine length of next table */
curr = len - drop;
--- 262,268 ----
drop = root;
/* increment past last table */
! next += ((unsigned)1) << curr;
/* determine length of next table */
curr = len - drop;
_______________________________________________
Zlib-devel mailing list
Zlib-devel at zlib.net
http://madler.net/mailman/listinfo/zlib-devel_madler.net
More information about the Zlib-devel
mailing list