[syslinux] isohybrid.c:409: warning: cast from pointer to integer of different size
H. Peter Anvin
hpa at zytor.com
Tue May 4 10:41:55 PDT 2010
On 05/04/2010 01:30 AM, Geert Stappers wrote:
> Op 20100504 om 12:10 schreef P J P:
>> --- On Tue, 4/5/10, Geert Stappers <stappers at stappers.nl> wrote:
>>> $ gcc -o isohybrid isohybrid.c isohdpfx.c
>>> isohybrid.c: In function display_mbr:
>>> isohybrid.c:409: warning: cast from pointer to integer of different size
>>
>> I'm using gcc (GCC) 4.4.3 20100127 on F12, it doesn't show up here.
>> Anyway, I think casting to `intptr_t' instead of `unsigned int' should help.
>>
>> printf("%08x ", (intptr_t)(mbr + i));
>>
>
> Yes, the compile warning is gone.
>
This is doubly wrong from a portability point of view.
%x takes an argument of type "unsigned int", not "intptr_t", and
printing 8 hex characters probably won't make any sense.
The standard way to print a pointer is %p, but it makes no sense at all
in this case to print the actual pointer value; just print the offset (i).
+ const char banner[] = "\0CD001\1EL TORITO
SPECIFICATION\0\0\0\0\0\0\0\0" \
+
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
That should be "static const".
More information about the Syslinux
mailing list