Przeglądaj źródła

[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 lat temu
rodzic
commit
78e54426c0
1 zmienionych plików z 5 dodań i 5 usunięć
  1. 5
    5
      src/util/zbin.c

+ 5
- 5
src/util/zbin.c Wyświetl plik

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

Ładowanie…
Anuluj
Zapisz