Skip to content

Commit

Permalink
[zbin] Fix compilation warnings for util/zbin.c
Browse files Browse the repository at this point in the history
Recent gcc versions generate warnings when compiling util/zbin.c
( tested with gcc-4.3.3 ):

util/zbin.c: In function ‘process_zinfo_pack’:
util/zbin.c:200: warning: format ‘%#zx’ expects type ‘size_t’, but argument 6
has type ‘long unsigned int’
util/zbin.c: In function ‘process_zinfo_add’:
util/zbin.c:257: warning: format ‘%#lx’ expects type ‘long unsigned int’, but
argument 4 has type ‘int’
util/zbin.c:266: warning: format ‘%#lx’ expects type ‘long unsigned int’, but
argument 4 has type ‘int’
util/zbin.c:266: warning: format ‘%d’ expects type ‘int’, but argument 8 has
type ‘long unsigned int’
util/zbin.c:286: warning: format ‘%#lx’ expects type ‘long unsigned int’, but
argument 6 has type ‘int’
util/zbin.c:286: warning: format ‘%#lx’ expects type ‘long unsigned int’, but
argument 7 has type ‘size_t’

This patch eliminates these warnings.

Tested with gcc-4.3.3 on Ubuntu 9.04 and gcc-4.1.2 on Debian Etch.

Signed-off-by: Marty Connor <mdc@etherboot.org>
  • Loading branch information
thomil authored and Marty Connor committed Oct 17, 2009
1 parent 7296f1f commit 78e5442
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/util/zbin.c
Expand Up @@ -197,7 +197,7 @@ static int process_zinfo_pack ( struct input_file *input,
if ( DEBUG ) {
fprintf ( stderr, "PACK [%#zx,%#zx) to [%#zx,%#zx)\n",
offset, ( offset + len ), output->len,
( output->len + packed_len ) );
( size_t )( output->len + packed_len ) );
}

output->len += packed_len;
Expand Down Expand Up @@ -252,18 +252,18 @@ static int process_zinfo_add ( struct input_file *input,
( ( 1UL << ( 8 * datasize ) ) - 1 ) : ~0UL );

if ( val < 0 ) {
fprintf ( stderr, "Add %s%#lx+%#lx at %#zx %sflows field\n",
fprintf ( stderr, "Add %s%#x+%#lx at %#zx %sflows field\n",
( ( addend < 0 ) ? "-" : "" ), abs ( addend ), size,
offset, ( ( addend < 0 ) ? "under" : "over" ) );
return -1;
}

if ( val & ~mask ) {
fprintf ( stderr, "Add %s%#lx+%#lx at %#zx overflows %d-byte "
fprintf ( stderr, "Add %s%#x+%#lx at %#zx overflows %d-byte "
"field (%d bytes too big)\n",
( ( addend < 0 ) ? "-" : "" ), abs ( addend ), size,
offset, datasize,
( ( val - mask - 1 ) * add->divisor ) );
( int )( ( val - mask - 1 ) * add->divisor ) );
return -1;
}

Expand All @@ -280,7 +280,7 @@ static int process_zinfo_add ( struct input_file *input,
}

if ( DEBUG ) {
fprintf ( stderr, "ADDx [%#zx,%#zx) (%s%#lx+(%#lx/%#x)) = "
fprintf ( stderr, "ADDx [%#zx,%#zx) (%s%#x+(%#x/%#x)) = "
"%#lx\n", offset, ( offset + datasize ),
( ( addend < 0 ) ? "-" : "" ), abs ( addend ),
output->len, add->divisor, val );
Expand Down

0 comments on commit 78e5442

Please sign in to comment.