Fix warning messages

git-svn: trunk@2550
remotes/push_mirror/metadata
Nigel Horne 19 years ago
parent 1ff5f3b8ce
commit f9d522eaa9
  1. 4
      clamav-devel/ChangeLog
  2. 16
      clamav-devel/clamav-milter/clamav-milter.c
  3. 22
      clamav-devel/libclamav/pst.c

@ -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) Sun Dec 10 15:21:28 CET 2006 (acab)
----------------------------------- -----------------------------------
* libclamav: various memleaks fixes (thanks Edvin) * libclamav: various memleaks fixes (thanks Edvin)

@ -24,9 +24,9 @@
* *
* For installation instructions see the file INSTALL that came with this file * 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 #if HAVE_CONFIG_H
#include "clamav-config.h" #include "clamav-config.h"
@ -1455,7 +1455,11 @@ main(int argc, char **argv)
} }
#ifndef SESSION #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 * Fudge to allow clamd to come up on
* our local machine * our local machine
@ -1853,7 +1857,7 @@ main(int argc, char **argv)
tableInsert(blacklist, "127.0.0.1", 0); tableInsert(blacklist, "127.0.0.1", 0);
if(wont_blacklist) { if(wont_blacklist) {
const char *w; char *w;
i = 0; i = 0;
while((w = cli_strtok(wont_blacklist, i++, ",")) != NULL) { while((w = cli_strtok(wont_blacklist, i++, ",")) != NULL) {
@ -2239,7 +2243,7 @@ findServer(void)
for(i = 0; i < numServers; i++) { for(i = 0; i < numServers; i++) {
struct try_server_struct *rc; struct try_server_struct *rc;
pthread_join(tids[i], &rc); pthread_join(tids[i], (void **)&rc);
assert(rc->sock == socks[i].sock); assert(rc->sock == socks[i].sock);
if(rc->rc == 0) { if(rc->rc == 0) {
close(rc->sock); close(rc->sock);
@ -5303,7 +5307,7 @@ loadDatabase(void)
#ifdef HAVE_CTIME_R_2 #ifdef HAVE_CTIME_R_2
snprintf(clamav_version, VERSION_LENGTH, snprintf(clamav_version, VERSION_LENGTH,
"ClamAV %s/%d/%s", VERSION, d->version, "ClamAV %s/%u/%s", VERSION, d->version,
ctime_r(&t, buf)); ctime_r(&t, buf));
#else #else
snprintf(clamav_version, VERSION_LENGTH, snprintf(clamav_version, VERSION_LENGTH,

@ -36,7 +36,7 @@
* TODO: Remove the vcard handling * TODO: Remove the vcard handling
* FIXME: The code does little error checking of OOM scenarios * 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 #if HAVE_CONFIG_H
#include "clamav-config.h" /* must come first */ #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_id (pst_index_ll *head);
int32_t _pst_free_desc (pst_desc_ll *head); int32_t _pst_free_desc (pst_desc_ll *head);
int32_t _pst_free_xattrib(pst_x_attrib_ll *x); 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_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); 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); 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 if (block_hdr.type == 0xBCEC) { //type 1
block_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; fr_ptr = block_offset.from;
memcpy(&table_rec, &(buf[fr_ptr]), sizeof(table_rec)); 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; 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; list_start = fr_ptr = block_offset.from;
to_ptr = block_offset.to; to_ptr = block_offset.to;
num_list = (to_ptr - fr_ptr)/sizeof(table_rec); 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 } else if (block_hdr.type == 0x7CEC) { //type 2
block_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" fr_ptr = block_offset.from; //now got pointer to "7C block"
memset(&seven_c_blk, 0, sizeof(seven_c_blk)); memset(&seven_c_blk, 0, sizeof(seven_c_blk));
memcpy(&seven_c_blk, &(buf[fr_ptr]), 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; num_list = seven_c_blk.item_count;
cli_dbgmsg("b5 offset = %#x\n", seven_c_blk.b_five_offset); 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; fr_ptr = block_offset.from;
memcpy(&table_rec, &(buf[fr_ptr]), sizeof(table_rec)); memcpy(&table_rec, &(buf[fr_ptr]), sizeof(table_rec));
cli_dbgmsg("before convert %#x\n", table_rec.type); 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; 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 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; ind2_ptr = block_offset.from;
} else { } else {
cli_warnmsg("ERROR: Unknown block constant - %#X for id %#x\n", block_hdr.type, block_id); 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; na_ptr->items[x] = NULL;
continue; 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", cli_dbgmsg("failed to get block offset for table_rec.value of %#x\n",
table_rec.value); table_rec.value);
na_ptr->count_item --; //we will be skipping a row 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; int32_t of1;
if (p == NULL || buf == NULL || offset == 0) { 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); cli_dbgmsg("p is NULL or buf is NULL or offset is 0 (%p, %p, %#x)\n", p, buf, offset);

Loading…
Cancel
Save