zlib1.2.3

Xueming Shen Xueming.Shen at Sun.COM
Mon Aug 24 04:56:26 UTC 2009


Martin Buchholz wrote:
> On Sat, Aug 22, 2009 at 20:37, Xueming Shen<Xueming.Shen at sun.com> wrote:
>   
>>> -------------
>>>  31 @@ -39,7 +63,7 @@
>>>  32         typedef unsigned int u4;
>>>  33  #    else
>>>  34  #      if (ULONG_MAX == 0xffffffffUL)
>>>  35 -         typedef unsigned long u4;
>>>  36 +         typedef uLong u4;
>>>  37  #      else
>>>  38  #        if (USHRT_MAX == 0xffffffffUL)
>>>  39             typedef unsigned short u4;
>>>
>>> Using uLong in the above is probably not right,
>>> since comparison against ULONG_MAX means
>>> the corresponding type is unsigned long
>>> (not that it matters)
>>>
>>>       
>
> #    if (UINT_MAX == 0xffffffffUL)
>        typedef unsigned int u4;
> #    else
> #      if (ULONG_MAX == 0xffffffffUL)
>          typedef unsigned long u4;
> #      else
> #        if (USHRT_MAX == 0xffffffffUL)
>            typedef unsigned short u4;
>
> I believe that on all platforms where the JDK will be built,
> the first test UINT_MAX == 0xffffffffUL will be true,
> so the suggested change will never pass the preprocessor.
> I believe it to both be wrong and to have no effect, and increase the
> size of local changes - but still OK to commit if you insist!
>   
Oh, I see your point. Are you saying this "local change" is not 
necessary since it never gets
preprocessed? OK, I admit I did the replace all in emacs:-) Maybe I 
should have touched
those that affected. But given the nature of crc32, I'm pretty sure a 
32-bit unsigned integer
is what it should be (and is intended,) as the code purposely defines 
the "u4".

An alternative is to keep the crc32.c/h untouched, change the crc32() 
declare in zlib.h to
unsigned long and then change the rest of jdk (our CRC.c and the pack 
code to prepare
a 64-bit unsigned long on 64-bits), is this the direction you would 
prefer to?

Sherman



More information about the core-libs-dev mailing list