[linux-dvb] 64-bit warnings when compiling v4l-dvb
js at linuxtv.org
Thu Dec 8 01:18:10 CET 2005
On Wed, Dec 07, 2005 at 10:55:27PM +0100, Peter Beutner wrote:
> Johannes Stezenbach schrieb:
> > Thanks for the report. See also:
> > http://linuxtv.org/pipermail/linux-dvb/2005-October/005630.html
> > I haven't had time to look into it, and still would welcome
> > patches from others to fix these issues.
> It's not really an issue(besides the compiler warning).
> The problem is:
> err = fe->ops->dishnetwork_send_legacy_command(fe, (unsigned int)parg);
> ^^^^^^^^^^^^^^^^ (where parg is void*)
> But parg is never greater than 32bit in this case because we misuse the pointer to pass an
> integer, so casting from a 64bit pointer to 32bit integer doesn't harm here. We know that
> but the compiler doesn't know ;)
> We could write it as:
> err = fe->ops->dishnetwork_send_legacy_command(fe, (unsigned long)parg);
> which shuts up the warnung, and the compiler then automatically casts from long->int.
> But which isn't really nice either imo.
> Or to make it clearer:
> unsigned long val = (unsigned long) parg;
> err = fe->ops->dishnetwork_send_legacy_command(fe, (unsigned int)val);
> which is even more ugly.
> Or convert dishnetwork_send_legacy_command in all to drivers to accept a long instead of
> an int.Don't know if it's worth the effort though.
> Or just live with the warning ;)
> Dunno which way you would prefer?
IMHO if dishnetwork_send_legacy_command() takes the ioctl parg argument it
should be changed to take an unsigned long.
More information about the linux-dvb