Browse code

fix gcc -W* warnings

git-svn: trunk@2929

Török Edvin authored on 2007/03/11 01:06:15
Showing 3 changed files
... ...
@@ -1,3 +1,7 @@
1
+Fri Mar  10 16:10:00 EET 2007 (edwin)
2
+----------------------------------
3
+  * libclamav/regex_list.c, entconv.c: fix gcc -W* warnings
4
+
1 5
 Fri Mar  9 23:24:24 GMT 2007 (njh)
2 6
 ----------------------------------
3 7
   * libclamav/pdf.c:	Fix fd leak on empty objects
... ...
@@ -101,7 +101,7 @@ unsigned char* entity_norm(const struct entity_conv* conv,const unsigned char* e
101 101
 int init_entity_converter(struct entity_conv* conv,const unsigned char* encoding,size_t buffer_size)
102 102
 {
103 103
 	if(buffer_size < MIN_BUFFER_SIZE) {
104
-		cli_warnmsg("Entity converter: Supplied buffer size:%ld, smaller than minimum required: %ld\n",buffer_size,MIN_BUFFER_SIZE);
104
+		cli_warnmsg("Entity converter: Supplied buffer size:%lu, smaller than minimum required: %d\n",(unsigned long)buffer_size,MIN_BUFFER_SIZE);
105 105
 		return CL_ENULLARG;
106 106
 	}
107 107
 	if(conv) {
... ...
@@ -519,7 +519,7 @@ void process_encoding_set(struct entity_conv* conv,const unsigned char* encoding
519 519
 	enum encodings tmp;
520 520
 	size_t new_size,old_size;
521 521
 
522
-	cli_dbgmsg("Setting encoding for %x  to %s, priority: %d\n",conv, encoding, prio);
522
+	cli_dbgmsg("Setting encoding for %p  to %s, priority: %d\n",(void*)conv, encoding, prio);
523 523
 	if(encoding == OTHER)
524 524
 		return;
525 525
 	if(conv->priority == CONTENT_TYPE)
... ...
@@ -532,14 +532,15 @@ void process_encoding_set(struct entity_conv* conv,const unsigned char* encoding
532 532
 	old_size = encoding_bytes(conv->encoding,&tmp);
533 533
 	new_size = encoding_bytes(tmp_encoding,&tmp);
534 534
 	if(old_size != new_size)  {
535
-		cli_dbgmsg("process_encoding_set: refusing to override encoding - new encoding size differs: %s(%ld) != %s(%ld)\n",conv->encoding,old_size,tmp_encoding,new_size);
535
+		/* on x86 gcc wants %u for size_t, on x86_64 it wants %lu for size_t. So just cast to unsigned long to make warnings go away. */
536
+		cli_dbgmsg("process_encoding_set: refusing to override encoding - new encoding size differs: %s(%lu) != %s(%lu)\n",conv->encoding,(unsigned long)old_size,tmp_encoding,(unsigned long)new_size);
536 537
 		free(tmp_encoding);
537 538
 		return;
538 539
 	}
539 540
 	}
540 541
 	free(conv->encoding);
541 542
 	conv->encoding = tmp_encoding;
542
-	cli_dbgmsg("New encoding for %x:%s\n",conv,conv->encoding);
543
+	cli_dbgmsg("New encoding for %p:%s\n",(void*)conv,conv->encoding);
543 544
 	/* reset stream */
544 545
 }
545 546
 
... ...
@@ -570,7 +571,7 @@ int entity_norm_done(struct entity_conv* conv)
570 570
 	return encoding_norm_done(conv);
571 571
 }
572 572
 
573
-static size_t read_raw(FILE *stream, m_area_t *m_area, unsigned int max_len, unsigned char* outbuff)
573
+static size_t read_raw(FILE *stream, m_area_t *m_area, int max_len, unsigned char* outbuff)
574 574
 {
575 575
 
576 576
 	/* Try and use the memory buffer first */
... ...
@@ -655,14 +656,14 @@ static void iconv_cache_init(struct iconv_cache* cache)
655 655
 /*	cache->tab = NULL;
656 656
 	cache->len = 0;
657 657
 	cache->used = 0; - already done by memset*/
658
-	cli_dbgmsg("Initializing iconv pool:%p\n",cache);
658
+	cli_dbgmsg("Initializing iconv pool:%p\n",(void*)cache);
659 659
 	hashtab_init(&cache->hashtab, 32);
660 660
 }
661 661
 
662 662
 static void iconv_cache_destroy(struct iconv_cache* cache)
663 663
 {
664 664
 	size_t i;
665
-	cli_dbgmsg("Destroying iconv pool:%p\n",cache);
665
+	cli_dbgmsg("Destroying iconv pool:%p\n",(void*)cache);
666 666
 	for(i=0;i < cache->last;i++) {
667 667
 		cli_dbgmsg("closing iconv:%p\n",cache->tab[i]);
668 668
 		iconv_close(cache->tab[i]);
... ...
@@ -898,7 +899,7 @@ unsigned char* encoding_norm_readline(struct entity_conv* conv, FILE* stream_in,
898 898
 #endif
899 899
 
900 900
 		if(rc==(size_t)-1 && errno != E2BIG) {
901
-				cli_dbgmsg("iconv error:%s, silently resuming (%ld,%ld,%ld,%ld)\n",strerror(errno),out-conv->out_area.buffer,tmpbuff-conv->tmp_area.buffer,inleft,outleft);
901
+				cli_dbgmsg("iconv error:%s, silently resuming (%ld,%ld,%lu,%lu)\n",strerror(errno),(long)(out-conv->out_area.buffer),(long)(tmpbuff-conv->tmp_area.buffer),(unsigned long)inleft,(unsigned long)outleft);
902 902
 				/* output raw byte, and resume at next byte */
903 903
 				*out++ = 0;
904 904
 				*out++ = *tmpbuff++;
... ...
@@ -459,7 +459,7 @@ static int functionality_level_check(char* line)
459 459
 			max = atoi(ptmax);
460 460
 
461 461
 		if(min > cl_retflevel()) {
462
-			cli_dbgmsg("regex list line %s not loaded (required f-level: %d)\n",line,min);
462
+			cli_dbgmsg("regex list line %s not loaded (required f-level: %u)\n",line,min);
463 463
 			return CL_EMALFDB; 
464 464
 		}
465 465