summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Brown2019-01-21 12:17:04 +0100
committerMichael Brown2019-01-21 12:17:04 +0100
commit956f6a7227b62ce98d7840439af17bbca04f0c86 (patch)
tree15fe78dcbbab62dd59da95b9accb50f948de915d
parent[libc] Fix strcmp()/strncmp() to return proper values (diff)
downloadipxe-956f6a7227b62ce98d7840439af17bbca04f0c86.tar.gz
ipxe-956f6a7227b62ce98d7840439af17bbca04f0c86.tar.xz
ipxe-956f6a7227b62ce98d7840439af17bbca04f0c86.zip
[zbin] Fix compiler warning with GCC 9
GCC 9 warns that abs() may truncate its signed long argument. Fix by using labs() instead. Reported-by: Martin Liška <mliska@suse.cz> Signed-off-by: Michael Brown <mcb30@ipxe.org>
-rw-r--r--src/util/zbin.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/util/zbin.c b/src/util/zbin.c
index 75fba583..3a4670b8 100644
--- a/src/util/zbin.c
+++ b/src/util/zbin.c
@@ -386,16 +386,16 @@ static int process_zinfo_add ( struct input_file *input
( ( 1UL << ( 8 * datasize ) ) - 1 ) : ~0UL );
if ( val < 0 ) {
- fprintf ( stderr, "Add %s%#x+%#lx at %#zx %sflows field\n",
- ( ( addend < 0 ) ? "-" : "" ), abs ( addend ), size,
+ fprintf ( stderr, "Add %s%#lx+%#lx at %#zx %sflows field\n",
+ ( ( addend < 0 ) ? "-" : "" ), labs ( addend ), size,
offset, ( ( addend < 0 ) ? "under" : "over" ) );
return -1;
}
if ( val & ~mask ) {
- fprintf ( stderr, "Add %s%#x+%#lx at %#zx overflows %zd-byte "
+ fprintf ( stderr, "Add %s%#lx+%#lx at %#zx overflows %zd-byte "
"field (%d bytes too big)\n",
- ( ( addend < 0 ) ? "-" : "" ), abs ( addend ), size,
+ ( ( addend < 0 ) ? "-" : "" ), labs ( addend ), size,
offset, datasize,
( int )( ( val - mask - 1 ) * add->divisor ) );
return -1;
@@ -414,9 +414,9 @@ static int process_zinfo_add ( struct input_file *input
}
if ( DEBUG ) {
- fprintf ( stderr, "ADDx [%#zx,%#zx) (%s%#x+(%#zx/%#x)) = "
+ fprintf ( stderr, "ADDx [%#zx,%#zx) (%s%#lx+(%#zx/%#x)) = "
"%#lx\n", offset, ( offset + datasize ),
- ( ( addend < 0 ) ? "-" : "" ), abs ( addend ),
+ ( ( addend < 0 ) ? "-" : "" ), labs ( addend ),
len, add->divisor, val );
}