prs_uint32 applied to pointers?
Jeremy Allison
jra at samba.org
Thu May 17 00:32:34 GMT 2007
On Wed, May 16, 2007 at 03:24:58PM -0400, Mikhail T. wrote:
> Hello!
>
> Trying to build Samba on my FreeBSD/amd64 machine, I noticed a scary
> warning about a pointer getting cast to an integer of lesser width.
>
> Indeed, the following code seems to stick the file path /pointer/ into a
> 32-bit number:
>
> uni_p = fl3->path ? (uint32)fl3->path : 0;
> if(!prs_uint32("ptr", ps, depth, &uni_p))
> return False;
>
> Although the 32-bit systems will not notice, the code does not seem
> right for 64-bit ones, where pointers are 64-bit wide. Can someone,
> please, comment? Silencing the warning is easy, but there may be a
> genuine problem pointed out here.
Actually it should be putting "1" here as all that matters is
that the pointer is non-zero.
Jeremy.
More information about the samba-technical
mailing list