From f9d522eaa9f678a118d8b490d9a16b2783850708 Mon Sep 17 00:00:00 2001 From: Nigel Horne Date: Mon, 11 Dec 2006 09:38:06 +0000 Subject: [PATCH] Fix warning messages git-svn: trunk@2550 --- clamav-devel/ChangeLog | 4 ++++ clamav-devel/clamav-milter/clamav-milter.c | 16 ++++++++++------ clamav-devel/libclamav/pst.c | 22 ++++++++++++---------- 3 files changed, 26 insertions(+), 16 deletions(-) diff --git a/clamav-devel/ChangeLog b/clamav-devel/ChangeLog index a96e39107..bd250104e 100644 --- a/clamav-devel/ChangeLog +++ b/clamav-devel/ChangeLog @@ -1,3 +1,7 @@ +Mon Dec 11 09:37:27 GMT 2006 (njh) +---------------------------------- + * libclamav/pst.c, clamav-milter: Fixed some compiler warning messages + Sun Dec 10 15:21:28 CET 2006 (acab) ----------------------------------- * libclamav: various memleaks fixes (thanks Edvin) diff --git a/clamav-devel/clamav-milter/clamav-milter.c b/clamav-devel/clamav-milter/clamav-milter.c index fed26e898..ddd52795b 100644 --- a/clamav-devel/clamav-milter/clamav-milter.c +++ b/clamav-devel/clamav-milter/clamav-milter.c @@ -24,9 +24,9 @@ * * For installation instructions see the file INSTALL that came with this file */ -static char const rcsid[] = "$Id: clamav-milter.c,v 1.302 2006/12/06 14:53:24 njh Exp $"; +static char const rcsid[] = "$Id: clamav-milter.c,v 1.303 2006/12/11 09:36:02 njh Exp $"; -#define CM_VERSION "devel-061206" +#define CM_VERSION "devel-111206" #if HAVE_CONFIG_H #include "clamav-config.h" @@ -1455,7 +1455,11 @@ main(int argc, char **argv) } #ifndef SESSION - if(serverIPs[i] == (int)inet_addr("127.0.0.1")) { +#if HAVE_IN_ADDR_T + if(serverIPs[i] == (in_addr_t)inet_addr("127.0.0.1")) { +#else + if(serverIPs[i] == (long)inet_addr("127.0.0.1")) { +#endif /* * Fudge to allow clamd to come up on * our local machine @@ -1853,7 +1857,7 @@ main(int argc, char **argv) tableInsert(blacklist, "127.0.0.1", 0); if(wont_blacklist) { - const char *w; + char *w; i = 0; while((w = cli_strtok(wont_blacklist, i++, ",")) != NULL) { @@ -2239,7 +2243,7 @@ findServer(void) for(i = 0; i < numServers; i++) { struct try_server_struct *rc; - pthread_join(tids[i], &rc); + pthread_join(tids[i], (void **)&rc); assert(rc->sock == socks[i].sock); if(rc->rc == 0) { close(rc->sock); @@ -5303,7 +5307,7 @@ loadDatabase(void) #ifdef HAVE_CTIME_R_2 snprintf(clamav_version, VERSION_LENGTH, - "ClamAV %s/%d/%s", VERSION, d->version, + "ClamAV %s/%u/%s", VERSION, d->version, ctime_r(&t, buf)); #else snprintf(clamav_version, VERSION_LENGTH, diff --git a/clamav-devel/libclamav/pst.c b/clamav-devel/libclamav/pst.c index e70c4cadd..89fb928b5 100644 --- a/clamav-devel/libclamav/pst.c +++ b/clamav-devel/libclamav/pst.c @@ -36,7 +36,7 @@ * TODO: Remove the vcard handling * FIXME: The code does little error checking of OOM scenarios */ -static char const rcsid[] = "$Id: pst.c,v 1.40 2006/12/09 08:36:01 njh Exp $"; +static char const rcsid[] = "$Id: pst.c,v 1.41 2006/12/11 09:37:13 njh Exp $"; #if HAVE_CONFIG_H #include "clamav-config.h" /* must come first */ @@ -436,7 +436,7 @@ int32_t _pst_free_id2(pst_index2_ll * head); int32_t _pst_free_id (pst_index_ll *head); int32_t _pst_free_desc (pst_desc_ll *head); int32_t _pst_free_xattrib(pst_x_attrib_ll *x); -int32_t _pst_getBlockOffset(char *buf, int32_t i_offset, int32_t offset, pst_block_offset *p); +int32_t _pst_getBlockOffset(unsigned char *buf, int32_t i_offset, int32_t offset, pst_block_offset *p); pst_index2_ll * _pst_build_id2(pst_file *pf, pst_index_ll* list, pst_index2_ll* head_ptr); pst_index_ll * _pst_getID(pst_file* pf, u_int32_t id); 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) if (block_hdr.type == 0xBCEC) { //type 1 block_type = 1; - _pst_getBlockOffset((char *)buf, ind_ptr, block_hdr.offset, &block_offset); + _pst_getBlockOffset(buf, ind_ptr, block_hdr.offset, &block_offset); fr_ptr = block_offset.from; 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) return NULL; } - _pst_getBlockOffset((char *)buf, ind_ptr, table_rec.value, &block_offset); + _pst_getBlockOffset(buf, ind_ptr, table_rec.value, &block_offset); list_start = fr_ptr = block_offset.from; to_ptr = block_offset.to; 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) } else if (block_hdr.type == 0x7CEC) { //type 2 block_type = 2; - _pst_getBlockOffset((char *)buf, ind_ptr, block_hdr.offset, &block_offset); + _pst_getBlockOffset(buf, ind_ptr, block_hdr.offset, &block_offset); fr_ptr = block_offset.from; //now got pointer to "7C block" memset(&seven_c_blk, 0, sizeof(seven_c_blk)); 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) num_list = seven_c_blk.item_count; cli_dbgmsg("b5 offset = %#x\n", seven_c_blk.b_five_offset); - _pst_getBlockOffset((char *)buf, ind_ptr, seven_c_blk.b_five_offset, &block_offset); + _pst_getBlockOffset(buf, ind_ptr, seven_c_blk.b_five_offset, &block_offset); fr_ptr = block_offset.from; memcpy(&table_rec, &(buf[fr_ptr]), sizeof(table_rec)); 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) return NULL; } - _pst_getBlockOffset((char *)buf, ind_ptr, table_rec.value, &block_offset); + _pst_getBlockOffset(buf, ind_ptr, table_rec.value, &block_offset); num_recs = (block_offset.to - block_offset.from) / 6; // this will give the number of records in this block - _pst_getBlockOffset((char *)buf, ind_ptr, seven_c_blk.ind2_offset, &block_offset); + _pst_getBlockOffset(buf, ind_ptr, seven_c_blk.ind2_offset, &block_offset); ind2_ptr = block_offset.from; } else { 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) na_ptr->items[x] = NULL; continue; } - if (_pst_getBlockOffset((char *)buf, ind_ptr, table_rec.value, &block_offset)) { + if (_pst_getBlockOffset(buf, ind_ptr, table_rec.value, &block_offset)) { cli_dbgmsg("failed to get block offset for table_rec.value of %#x\n", table_rec.value); na_ptr->count_item --; //we will be skipping a row @@ -4113,7 +4113,9 @@ void _pst_freeItem(pst_item *item) { } } -int32_t _pst_getBlockOffset(char *buf, int32_t i_offset, int32_t offset, pst_block_offset *p) { +int32_t +_pst_getBlockOffset(unsigned char *buf, int32_t i_offset, int32_t offset, pst_block_offset *p) +{ int32_t of1; if (p == NULL || buf == NULL || offset == 0) { cli_dbgmsg("p is NULL or buf is NULL or offset is 0 (%p, %p, %#x)\n", p, buf, offset);