Browse code

Fix warning messages

git-svn: trunk@2550

Nigel Horne authored on 2006/12/11 18:38:06
Showing 3 changed files
... ...
@@ -1,3 +1,7 @@
1
+Mon Dec 11 09:37:27 GMT 2006 (njh)
2
+----------------------------------
3
+  * libclamav/pst.c, clamav-milter:	Fixed some compiler warning messages
4
+
1 5
 Sun Dec 10 15:21:28 CET 2006 (acab)
2 6
 -----------------------------------
3 7
   * libclamav: various memleaks fixes (thanks Edvin)
... ...
@@ -24,9 +24,9 @@
24 24
  *
25 25
  * For installation instructions see the file INSTALL that came with this file
26 26
  */
27
-static	char	const	rcsid[] = "$Id: clamav-milter.c,v 1.302 2006/12/06 14:53:24 njh Exp $";
27
+static	char	const	rcsid[] = "$Id: clamav-milter.c,v 1.303 2006/12/11 09:36:02 njh Exp $";
28 28
 
29
-#define	CM_VERSION	"devel-061206"
29
+#define	CM_VERSION	"devel-111206"
30 30
 
31 31
 #if HAVE_CONFIG_H
32 32
 #include "clamav-config.h"
... ...
@@ -1455,7 +1455,11 @@ main(int argc, char **argv)
1455 1455
 			}
1456 1456
 
1457 1457
 #ifndef	SESSION
1458
-			if(serverIPs[i] == (int)inet_addr("127.0.0.1")) {
1458
+#if	HAVE_IN_ADDR_T
1459
+			if(serverIPs[i] == (in_addr_t)inet_addr("127.0.0.1")) {
1460
+#else
1461
+			if(serverIPs[i] == (long)inet_addr("127.0.0.1")) {
1462
+#endif
1459 1463
 				/*
1460 1464
 				 * Fudge to allow clamd to come up on
1461 1465
 				 * our local machine
... ...
@@ -1853,7 +1857,7 @@ main(int argc, char **argv)
1853 1853
 			tableInsert(blacklist, "127.0.0.1", 0);
1854 1854
 
1855 1855
 		if(wont_blacklist) {
1856
-			const char *w;
1856
+			char *w;
1857 1857
 
1858 1858
 			i = 0;
1859 1859
 			while((w = cli_strtok(wont_blacklist, i++, ",")) != NULL) {
... ...
@@ -2239,7 +2243,7 @@ findServer(void)
2239 2239
 	for(i = 0; i < numServers; i++) {
2240 2240
 		struct try_server_struct *rc;
2241 2241
 
2242
-		pthread_join(tids[i], &rc);
2242
+		pthread_join(tids[i], (void **)&rc);
2243 2243
 		assert(rc->sock == socks[i].sock);
2244 2244
 		if(rc->rc == 0) {
2245 2245
 			close(rc->sock);
... ...
@@ -5303,7 +5307,7 @@ loadDatabase(void)
5303 5303
 
5304 5304
 #ifdef	HAVE_CTIME_R_2
5305 5305
 		snprintf(clamav_version, VERSION_LENGTH,
5306
-			"ClamAV %s/%d/%s", VERSION, d->version,
5306
+			"ClamAV %s/%u/%s", VERSION, d->version,
5307 5307
 			ctime_r(&t, buf));
5308 5308
 #else
5309 5309
 		snprintf(clamav_version, VERSION_LENGTH,
... ...
@@ -36,7 +36,7 @@
36 36
  * TODO: Remove the vcard handling
37 37
  * FIXME: The code does little error checking of OOM scenarios
38 38
  */
39
-static	char	const	rcsid[] = "$Id: pst.c,v 1.40 2006/12/09 08:36:01 njh Exp $";
39
+static	char	const	rcsid[] = "$Id: pst.c,v 1.41 2006/12/11 09:37:13 njh Exp $";
40 40
 
41 41
 #if HAVE_CONFIG_H
42 42
 #include "clamav-config.h"	/* must come first */
... ...
@@ -436,7 +436,7 @@ int32_t _pst_free_id2(pst_index2_ll * head);
436 436
 int32_t _pst_free_id (pst_index_ll *head);
437 437
 int32_t _pst_free_desc (pst_desc_ll *head);
438 438
 int32_t _pst_free_xattrib(pst_x_attrib_ll *x);
439
-int32_t _pst_getBlockOffset(char *buf, int32_t i_offset, int32_t offset, pst_block_offset *p);
439
+int32_t _pst_getBlockOffset(unsigned char *buf, int32_t i_offset, int32_t offset, pst_block_offset *p);
440 440
 pst_index2_ll * _pst_build_id2(pst_file *pf, pst_index_ll* list, pst_index2_ll* head_ptr);
441 441
 pst_index_ll * _pst_getID(pst_file* pf, u_int32_t id);
442 442
 static	pst_index_ll	*_pst_getID2(pst_index2_ll * ptr, u_int32_t id);
... ...
@@ -1756,7 +1756,7 @@ _pst_parse_block(pst_file *pf, u_int32_t block_id, pst_index2_ll *i2_head)
1756 1756
   if (block_hdr.type == 0xBCEC) { //type 1
1757 1757
     block_type = 1;
1758 1758
 
1759
-    _pst_getBlockOffset((char *)buf, ind_ptr, block_hdr.offset, &block_offset);
1759
+    _pst_getBlockOffset(buf, ind_ptr, block_hdr.offset, &block_offset);
1760 1760
     fr_ptr = block_offset.from;
1761 1761
 
1762 1762
     memcpy(&table_rec, &(buf[fr_ptr]), sizeof(table_rec));
... ...
@@ -1770,7 +1770,7 @@ _pst_parse_block(pst_file *pf, u_int32_t block_id, pst_index2_ll *i2_head)
1770 1770
       return NULL;
1771 1771
     }
1772 1772
 
1773
-    _pst_getBlockOffset((char *)buf, ind_ptr, table_rec.value, &block_offset);
1773
+    _pst_getBlockOffset(buf, ind_ptr, table_rec.value, &block_offset);
1774 1774
     list_start = fr_ptr = block_offset.from;
1775 1775
     to_ptr = block_offset.to;
1776 1776
     num_list = (to_ptr - fr_ptr)/sizeof(table_rec);
... ...
@@ -1779,7 +1779,7 @@ _pst_parse_block(pst_file *pf, u_int32_t block_id, pst_index2_ll *i2_head)
1779 1779
   } else if (block_hdr.type == 0x7CEC) { //type 2
1780 1780
     block_type = 2;
1781 1781
 
1782
-    _pst_getBlockOffset((char *)buf, ind_ptr, block_hdr.offset, &block_offset);
1782
+    _pst_getBlockOffset(buf, ind_ptr, block_hdr.offset, &block_offset);
1783 1783
     fr_ptr = block_offset.from; //now got pointer to "7C block"
1784 1784
     memset(&seven_c_blk, 0, sizeof(seven_c_blk));
1785 1785
     memcpy(&seven_c_blk, &(buf[fr_ptr]), sizeof(seven_c_blk));
... ...
@@ -1806,7 +1806,7 @@ _pst_parse_block(pst_file *pf, u_int32_t block_id, pst_index2_ll *i2_head)
1806 1806
     num_list = seven_c_blk.item_count;
1807 1807
     cli_dbgmsg("b5 offset = %#x\n", seven_c_blk.b_five_offset);
1808 1808
 
1809
-    _pst_getBlockOffset((char *)buf, ind_ptr, seven_c_blk.b_five_offset, &block_offset);
1809
+    _pst_getBlockOffset(buf, ind_ptr, seven_c_blk.b_five_offset, &block_offset);
1810 1810
     fr_ptr = block_offset.from;
1811 1811
     memcpy(&table_rec, &(buf[fr_ptr]), sizeof(table_rec));
1812 1812
     cli_dbgmsg("before convert %#x\n", table_rec.type);
... ...
@@ -1827,10 +1827,10 @@ _pst_parse_block(pst_file *pf, u_int32_t block_id, pst_index2_ll *i2_head)
1827 1827
 		return NULL;
1828 1828
 	}
1829 1829
 
1830
-    _pst_getBlockOffset((char *)buf, ind_ptr, table_rec.value, &block_offset);
1830
+    _pst_getBlockOffset(buf, ind_ptr, table_rec.value, &block_offset);
1831 1831
     num_recs = (block_offset.to - block_offset.from) / 6; // this will give the number of records in this block
1832 1832
 
1833
-    _pst_getBlockOffset((char *)buf, ind_ptr, seven_c_blk.ind2_offset, &block_offset);
1833
+    _pst_getBlockOffset(buf, ind_ptr, seven_c_blk.ind2_offset, &block_offset);
1834 1834
     ind2_ptr = block_offset.from;
1835 1835
   } else {
1836 1836
     cli_warnmsg("ERROR: Unknown block constant - %#X for id %#x\n", block_hdr.type, block_id);
... ...
@@ -1978,7 +1978,7 @@ _pst_parse_block(pst_file *pf, u_int32_t block_id, pst_index2_ll *i2_head)
1978 1978
 		na_ptr->items[x] = NULL;
1979 1979
 	    continue;
1980 1980
 	  }
1981
-	  if (_pst_getBlockOffset((char *)buf, ind_ptr, table_rec.value, &block_offset)) {
1981
+	  if (_pst_getBlockOffset(buf, ind_ptr, table_rec.value, &block_offset)) {
1982 1982
 	    cli_dbgmsg("failed to get block offset for table_rec.value of %#x\n",
1983 1983
 		  table_rec.value);
1984 1984
 	    na_ptr->count_item --; //we will be skipping a row
... ...
@@ -4113,7 +4113,9 @@ void _pst_freeItem(pst_item *item) {
4113 4113
   }
4114 4114
 }
4115 4115
 
4116
-int32_t _pst_getBlockOffset(char *buf, int32_t i_offset, int32_t offset, pst_block_offset *p) {
4116
+int32_t
4117
+_pst_getBlockOffset(unsigned char *buf, int32_t i_offset, int32_t offset, pst_block_offset *p)
4118
+{
4117 4119
   int32_t of1;
4118 4120
   if (p == NULL || buf == NULL || offset == 0) {
4119 4121
     cli_dbgmsg("p is NULL or buf is NULL or offset is 0 (%p, %p, %#x)\n", p, buf, offset);