]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[zbin] Fix compiler warning with GCC 9
authorMichael Brown <mcb30@ipxe.org>
Mon, 21 Jan 2019 11:17:04 +0000 (11:17 +0000)
committerMichael Brown <mcb30@ipxe.org>
Mon, 21 Jan 2019 11:17:04 +0000 (11:17 +0000)
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>
src/util/zbin.c

index 75fba583fc6163a8ab074fd00ba975ee6fa07ab4..3a4670b88159a104966778a31838347fa5509521 100644 (file)
@@ -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 );
        }