Browse code

fix some warnings

Tomasz Kojm authored on 2010/01/28 00:06:12
Showing 12 changed files
... ...
@@ -620,7 +620,6 @@ int
620 620
 fileblobScan(const fileblob *fb)
621 621
 {
622 622
 	int rc;
623
-	cli_file_t ftype;
624 623
 	struct stat sb;
625 624
 
626 625
 	if(fb->isInfected)
... ...
@@ -61,7 +61,7 @@ static char cli_ndecode(unsigned char value)
61 61
     return -1;
62 62
 }
63 63
 
64
-unsigned char *cli_decodesig(const char *sig, unsigned int plen, mp_int e, mp_int n)
64
+static unsigned char *cli_decodesig(const char *sig, unsigned int plen, mp_int e, mp_int n)
65 65
 {
66 66
 	int i, slen = strlen(sig), dec;
67 67
 	unsigned char *plain;
... ...
@@ -47,7 +47,6 @@ CLAMAV_PRIVATE {
47 47
     cli_rmdirs;
48 48
     cli_chomp;
49 49
     cli_rndnum;
50
-    cli_decodesig;
51 50
 
52 51
     cli_calloc;
53 52
     cli_ole2_extract;
... ...
@@ -1256,7 +1256,7 @@ int cli_ac_scanbuff(const unsigned char *buffer, uint32_t length, const char **v
1256 1256
 
1257 1257
 static int qcompare(const void *a, const void *b)
1258 1258
 {
1259
-    return *(unsigned char *)a - *(unsigned char *)b;
1259
+    return *(const unsigned char *)a - *(const unsigned char *)b;
1260 1260
 }
1261 1261
 
1262 1262
 /* FIXME: clean up the code */
... ...
@@ -1633,7 +1633,7 @@ int cli_ac_addsig(struct cli_matcher *root, const char *virname, const char *hex
1633 1633
     if(new->length > root->maxpatlen)
1634 1634
 	root->maxpatlen = new->length;
1635 1635
 
1636
-    new->virname = cli_mpool_virname(root->mempool, (char *) virname, options & CL_DB_OFFICIAL);
1636
+    new->virname = cli_mpool_virname(root->mempool, virname, options & CL_DB_OFFICIAL);
1637 1637
     if(!new->virname) {
1638 1638
 	mpool_free(root->mempool, new->prefix ? new->prefix : new->pattern);
1639 1639
 	mpool_ac_free_special(root->mempool, new);
... ...
@@ -329,7 +329,7 @@ cli_mbox(const char *dir, int desc, cli_ctx *ctx)
329 329
 static int
330 330
 cli_parse_mbox(const char *dir, int desc, cli_ctx *ctx)
331 331
 {
332
-	int retcode, i;
332
+	int retcode;
333 333
 	message *body;
334 334
 	char buffer[RFC2821LENGTH + 1];
335 335
 	mbox_ctx mctx;
... ...
@@ -121,7 +121,6 @@ static lt_dlhandle lt_dlfind(const char *name, const char *featurename)
121 121
     const lt_dlinfo *info;
122 122
     char modulename[128];
123 123
     lt_dlhandle rhandle;
124
-    int canretry=1;
125 124
     unsigned i;
126 125
 
127 126
     if (lt_dladdsearchdir(SEARCH_LIBDIR)) {
... ...
@@ -253,7 +253,6 @@ cli_pdf(const char *dir, cli_ctx *ctx, off_t offset)
253 253
 					 */
254 254
 					if((bytesleft > 11) && strncmp(q, " 0 R", 4) == 0) {
255 255
 						const char *r, *nq;
256
-						size_t len;
257 256
 						char b[14];
258 257
 
259 258
 						q += 4;
... ...
@@ -34,6 +34,7 @@
34 34
 
35 35
 #include "platform.h"
36 36
 #include "cltypes.h"
37
+#include "others.h"
37 38
 
38 39
 static inline char	*med3(char *, char *, char *, int (*)(const void *, const void *));
39 40
 static inline void	 swapfunc(char *, char *, int, int);
... ...
@@ -155,11 +156,11 @@ loop:	SWAPINIT(a, es);
155 155
 	pn = (char *) a + n * es;
156 156
 	r = MIN(pa - (char *)a, pb - pa);
157 157
 	vecswap(a, pb - r, r);
158
-	r = MIN(pd - pc, pn - pd - es);
158
+	r = MIN((size_t) (pd - pc), (size_t) (pn - pd - es));
159 159
 	vecswap(pb, pn - r, r);
160
-	if ((r = pb - pa) > es)
160
+	if ((size_t) (r = pb - pa) > es)
161 161
 		cli_qsort(a, r / es, es, cmp);
162
-	if ((r = pd - pc) > es) { 
162
+	if ((size_t) (r = pd - pc) > es) { 
163 163
 		/* Iterate rather than recurse to save stack space */
164 164
 		a = pn - r;
165 165
 		n = r / es;
... ...
@@ -1984,7 +1984,7 @@ static int cli_loadmd(FILE *fs, struct cl_engine *engine, unsigned int *signo, i
1984 1984
 
1985 1985
 	/* tokens[6] - not used */
1986 1986
 
1987
-	new->filepos[0] = new->filepos[1] = strcmp(tokens[7], "*") ? atoi(tokens[7]) : CLI_OFF_ANY;
1987
+	new->filepos[0] = new->filepos[1] = strcmp(tokens[7], "*") ? atoi(tokens[7]) : (int) CLI_OFF_ANY;
1988 1988
 
1989 1989
 	/* tokens[8] - not used */
1990 1990
 
... ...
@@ -47,7 +47,7 @@
47 47
 
48 48
 int cli_check_mydoom_log(int desc, cli_ctx *ctx)
49 49
 {
50
-	int32_t record[8], check;
50
+	uint32_t record[8], check;
51 51
 	int i, retval=CL_VIRUS, j;
52 52
 
53 53
     cli_dbgmsg("in cli_check_mydoom_log()\n");
... ...
@@ -90,7 +90,7 @@ static const enum normalize_action char_action[256] = {
90 90
 /* Normalizes the text at @buf of length @buf_len, @buf can include \0 characters.
91 91
  * Stores the normalized text in @state's buffer. 
92 92
  * Returns how many bytes it consumed of the input. */
93
-ssize_t text_normalize_buffer(struct text_norm_state *state, const unsigned char *buf, const size_t buf_len)
93
+size_t text_normalize_buffer(struct text_norm_state *state, const unsigned char *buf, const size_t buf_len)
94 94
 {
95 95
 	size_t i;
96 96
 	const unsigned char *out_end = state->out + state->out_len;
... ...
@@ -118,6 +118,6 @@ ssize_t text_normalize_buffer(struct text_norm_state *state, const unsigned char
118 118
 		}
119 119
 	}
120 120
 	state->out_pos = p - state->out;
121
-	return (ssize_t)i;
121
+	return i;
122 122
 }
123 123
 
... ...
@@ -29,4 +29,4 @@ struct text_norm_state {
29 29
 
30 30
 int text_normalize_init(struct text_norm_state *state, unsigned char *out, size_t out_len);
31 31
 void text_normalize_reset(struct text_norm_state* state);
32
-ssize_t text_normalize_buffer(struct text_norm_state *state, const unsigned char *buf, const size_t buf_len);
32
+size_t text_normalize_buffer(struct text_norm_state *state, const unsigned char *buf, const size_t buf_len);