[syslinux] isohybrid.c:409: warning: cast from pointer to integer of different size

Geert Stappers stappers at stappers.nl
Mon May 3 06:07:17 PDT 2010


Op 20100503 om 14:54 schreef Geert Stappers:
> Op 20100503 om 15:00 schreef P J P:
> > 
> > Please see: http://pjp.dgplug.org/tools/syslinux-3.86-isohybrid.patch.7
> > 
> 
> Find attached a reworked version of that patch
> 
> Changes:
>  - renamed hexdata into isohdpfx
>  - Makefile closer to Makefile in git HEAD
>  - Makefile uses isohdpfx.{head,tail} to avoid further changes to
>    isohdpfx.c being done in the Makefile
> 
> 
> To be continued ...
>
> diff --git a/utils/isohybrid.c b/utils/isohybrid.c
> new file mode 100644
> index 0000000..fbbfaeb
> --- /dev/null
> +++ b/utils/isohybrid.c
> @@ -0,0 +1,560 @@
> +/*
> + * isohybrid.c: Post process an ISO 9660 image generated with mkisofs or
> + * genisoimage to allow - hybrid booting - as a CD-ROM or as a hard
> + * disk.
> + *
    <snip/>
> +void
> +display_mbr(const uint8_t *mbr, size_t len)
> +{
> +    unsigned char c = 0;
> +    unsigned int i = 0, j = 0;
> +
> +    printf("sizeof(MBR): %d bytes\n", len);
> +    for (i = 0; i < len; i++)
> +    {
> +        if (!(i % 16))
> +            printf("%08x ", (unsigned int)(mbr + i));

That line yields at compile time:

| isohybrid.c: In function 'display_mbr':
| isohybrid.c:409: warning: cast from pointer to integer of different size

What should be done to avoid that warning?

> +
> +        if (!(i % 8))
> +            printf(" ");
> +
> +        c = mbr[i];
> +        printf("%02x ", c);
> +
> +        if (!((i + 1) % 16))
> +        {
> +            printf(" |");
> +            for (; j <= i; j++)
> +                printf("%c", isprint(mbr[j]) ? mbr[j] : '.');
> +            printf("|\n");
> +        }
> +    }
> +}


Geert Stappers
more Sysadmin then hard core C programmer




More information about the Syslinux mailing list