소스 검색

[zbin] Fix compilation warnings for util/zbin.c

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>
tags/v0.9.9
Thomas Miletich 14 년 전
부모
커밋
78e54426c0
1개의 변경된 파일5개의 추가작업 그리고 5개의 파일을 삭제
  1. 5
    5
      src/util/zbin.c

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

@@ -197,7 +197,7 @@ static int process_zinfo_pack ( struct input_file *input,
197 197
 	if ( DEBUG ) {
198 198
 		fprintf ( stderr, "PACK [%#zx,%#zx) to [%#zx,%#zx)\n",
199 199
 			  offset, ( offset + len ), output->len,
200
-			  ( output->len + packed_len ) );
200
+			  ( size_t )( output->len + packed_len ) );
201 201
 	}
202 202
 
203 203
 	output->len += packed_len;
@@ -252,18 +252,18 @@ static int process_zinfo_add ( struct input_file *input,
252 252
 		 ( ( 1UL << ( 8 * datasize ) ) - 1 ) : ~0UL );
253 253
 
254 254
 	if ( val < 0 ) {
255
-		fprintf ( stderr, "Add %s%#lx+%#lx at %#zx %sflows field\n",
255
+		fprintf ( stderr, "Add %s%#x+%#lx at %#zx %sflows field\n",
256 256
 			  ( ( addend < 0 ) ? "-" : "" ), abs ( addend ), size,
257 257
 			  offset, ( ( addend < 0 ) ? "under" : "over" ) );
258 258
 		return -1;
259 259
 	}
260 260
 
261 261
 	if ( val & ~mask ) {
262
-		fprintf ( stderr, "Add %s%#lx+%#lx at %#zx overflows %d-byte "
262
+		fprintf ( stderr, "Add %s%#x+%#lx at %#zx overflows %d-byte "
263 263
 			  "field (%d bytes too big)\n",
264 264
 			  ( ( addend < 0 ) ? "-" : "" ), abs ( addend ), size,
265 265
 			  offset, datasize,
266
-			  ( ( val - mask - 1 ) * add->divisor ) );
266
+			  ( int )( ( val - mask - 1 ) * add->divisor ) );
267 267
 		return -1;
268 268
 	}
269 269
 
@@ -280,7 +280,7 @@ static int process_zinfo_add ( struct input_file *input,
280 280
 	}
281 281
 
282 282
 	if ( DEBUG ) {
283
-		fprintf ( stderr, "ADDx [%#zx,%#zx) (%s%#lx+(%#lx/%#x)) = "
283
+		fprintf ( stderr, "ADDx [%#zx,%#zx) (%s%#x+(%#x/%#x)) = "
284 284
 			  "%#lx\n", offset, ( offset + datasize ),
285 285
 			  ( ( addend < 0 ) ? "-" : "" ), abs ( addend ),
286 286
 			  output->len, add->divisor, val );

Loading…
취소
저장