Browse code

fix printing of size_t and off_t vars (bb#444)

git-svn: trunk@3493

Tomasz Kojm authored on 2008/01/10 23:45:07
Showing 5 changed files
... ...
@@ -1,3 +1,8 @@
1
+Thu Jan 10 15:17:19 CET 2008 (tk)
2
+---------------------------------
3
+  * libclamav: fix printing of size_t and off_t vars (bb#444);
4
+	       reported by Anton Yuzhaninov <citrin*rambler-co.ru>
5
+
1 6
 Thu Jan 10 14:29:28 CET 2008 (tk)
2 7
 ---------------------------------
3 8
   * clamdscan: remove dependendcy on libclamav (bb#750), patch from Edwin
... ...
@@ -823,7 +823,7 @@ int cli_chm_extract_file(int fd, char *dirname, chm_metadata_t *metadata)
823 823
 		return CL_EIO;
824 824
 	}
825 825
 	if (chm_copy_file_data(metadata->ufd, metadata->ofd, metadata->file_length) != metadata->file_length) {
826
-		cli_dbgmsg("failed to copy %lu bytes\n", (long unsigned int) metadata->file_length);
826
+		cli_dbgmsg("failed to copy %ju bytes\n", (uintmax_t) metadata->file_length);
827 827
 		close(metadata->ofd);
828 828
 		return CL_EIO;
829 829
 	}
... ...
@@ -234,11 +234,11 @@ int cli_validatesig(cli_file_t ftype, const char *offstr, off_t fileoff, struct
234 234
 
235 235
 	if(maxshift) {
236 236
 	    if((fileoff < offset) || (fileoff > offset + (off_t) maxshift)) {
237
-		cli_dbgmsg("Signature offset: %lu, expected: [%lu..%lu] (%s)\n", fileoff, offset, offset + maxshift, virname);
237
+		cli_dbgmsg("Signature offset: %ju, expected: [%ju..%ju] (%s)\n", (uintmax_t) fileoff, (uintmax_t) offset, (uintmax_t) (offset + maxshift), virname);
238 238
 		return 0;
239 239
 	    }
240 240
 	} else if(fileoff != offset) {
241
-	    cli_dbgmsg("Signature offset: %lu, expected: %lu (%s)\n", fileoff, offset, virname);
241
+	    cli_dbgmsg("Signature offset: %ju, expected: %ju (%s)\n", (uintmax_t) fileoff, (uintmax_t) offset, virname);
242 242
 	    return 0;
243 243
 	}
244 244
     }
... ...
@@ -610,7 +610,7 @@ static int handler_writefile(int fd, ole2_header_t *hdr, property_t *prop, const
610 610
 		if (!name) {
611 611
 			return FALSE;
612 612
 		}
613
-		snprintf(name, 11, "%.10ld", i + (long int) prop);
613
+		snprintf(name, 11, "%.10jd", (intmax_t) (i + (long int) prop));
614 614
 	} else {
615 615
 		/* Sanitize the file name */
616 616
 		sanitiseName(name);
... ...
@@ -304,7 +304,7 @@ static int rtf_object_process(struct rtf_state* state, const unsigned char* inpu
304 304
 						 cli_dbgmsg("RTF: waiting for magic\n");
305 305
 						 for(i=0; i<out_cnt && data->bread < rtf_data_magic_len; i++, data->bread++)
306 306
 							 if(rtf_data_magic[data->bread] != out_data[i]) {
307
-								 cli_dbgmsg("Warning: rtf objdata magic number not matched, expected:%d, got: %d, at pos:%lu\n",rtf_data_magic[i],out_data[i],data->bread);
307
+								 cli_dbgmsg("Warning: rtf objdata magic number not matched, expected:%d, got: %d, at pos:%ju\n",rtf_data_magic[i],out_data[i], (uintmax_t) data->bread);
308 308
 							 }
309 309
 						 out_cnt  -= i;
310 310
 						 if(data->bread == rtf_data_magic_len) {
... ...
@@ -324,7 +324,7 @@ static int rtf_object_process(struct rtf_state* state, const unsigned char* inpu
324 324
 							    out_data += i;
325 325
 							    data->bread=0;
326 326
 							    if(data->desc_len > 64) {
327
-								    cli_dbgmsg("Description length too big (%lu), showing only 64 bytes of it\n",data->desc_len);
327
+								    cli_dbgmsg("Description length too big (%ju), showing only 64 bytes of it\n", (uintmax_t) data->desc_len);
328 328
 								    data->desc_name = cli_malloc(65);
329 329
 							    }
330 330
 							    else
... ...
@@ -333,7 +333,7 @@ static int rtf_object_process(struct rtf_state* state, const unsigned char* inpu
333 333
 								    return CL_EMEM;
334 334
 							    }
335 335
 							    data->internal_state = WAIT_DESC;
336
-							    cli_dbgmsg("RTF: description length:%lu\n",data->desc_len);
336
+							    cli_dbgmsg("RTF: description length:%ju\n", (uintmax_t) data->desc_len);
337 337
 						    }
338 338
 						    break;
339 339
 					    }
... ...
@@ -392,7 +392,7 @@ static int rtf_object_process(struct rtf_state* state, const unsigned char* inpu
392 392
 						    if(data->bread == 4) {
393 393
 							    out_data += i;
394 394
 							    data->bread=0;
395
-							    cli_dbgmsg("Dumping rtf embedded object of size:%lu\n",data->desc_len);
395
+							    cli_dbgmsg("Dumping rtf embedded object of size:%ju\n", (uintmax_t) data->desc_len);
396 396
 							    if((ret = cli_gentempfd(data->tmpdir, &data->name, &data->fd)))
397 397
 								    return ret;
398 398
 							    data->internal_state = DUMP_DATA;