소스 검색

[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>
tags/v1.20.1
Michael Brown 5 년 전
부모
커밋
956f6a7227
1개의 변경된 파일6개의 추가작업 그리고 6개의 파일을 삭제
  1. 6
    6
      src/util/zbin.c

+ 6
- 6
src/util/zbin.c 파일 보기

@@ -386,16 +386,16 @@ static int process_zinfo_add ( struct input_file *input
386 386
 		 ( ( 1UL << ( 8 * datasize ) ) - 1 ) : ~0UL );
387 387
 
388 388
 	if ( val < 0 ) {
389
-		fprintf ( stderr, "Add %s%#x+%#lx at %#zx %sflows field\n",
390
-			  ( ( addend < 0 ) ? "-" : "" ), abs ( addend ), size,
389
+		fprintf ( stderr, "Add %s%#lx+%#lx at %#zx %sflows field\n",
390
+			  ( ( addend < 0 ) ? "-" : "" ), labs ( addend ), size,
391 391
 			  offset, ( ( addend < 0 ) ? "under" : "over" ) );
392 392
 		return -1;
393 393
 	}
394 394
 
395 395
 	if ( val & ~mask ) {
396
-		fprintf ( stderr, "Add %s%#x+%#lx at %#zx overflows %zd-byte "
396
+		fprintf ( stderr, "Add %s%#lx+%#lx at %#zx overflows %zd-byte "
397 397
 			  "field (%d bytes too big)\n",
398
-			  ( ( addend < 0 ) ? "-" : "" ), abs ( addend ), size,
398
+			  ( ( addend < 0 ) ? "-" : "" ), labs ( addend ), size,
399 399
 			  offset, datasize,
400 400
 			  ( int )( ( val - mask - 1 ) * add->divisor ) );
401 401
 		return -1;
@@ -414,9 +414,9 @@ static int process_zinfo_add ( struct input_file *input
414 414
 	}
415 415
 
416 416
 	if ( DEBUG ) {
417
-		fprintf ( stderr, "ADDx [%#zx,%#zx) (%s%#x+(%#zx/%#x)) = "
417
+		fprintf ( stderr, "ADDx [%#zx,%#zx) (%s%#lx+(%#zx/%#x)) = "
418 418
 			  "%#lx\n", offset, ( offset + datasize ),
419
-			  ( ( addend < 0 ) ? "-" : "" ), abs ( addend ),
419
+			  ( ( addend < 0 ) ? "-" : "" ), labs ( addend ),
420 420
 			  len, add->divisor, val );
421 421
 	}
422 422
 

Loading…
취소
저장