Browse code

Fix warnings

git-svn: trunk@2694

Nigel Horne authored on 2007/02/10 23:23:52
Showing 6 changed files
... ...
@@ -1,3 +1,8 @@
1
+Sat Feb 10 14:22:29 GMT 2007 (njh)
2
+----------------------------------
3
+  * libclamav:	Removed warnings introduced by the stricter argument checks
4
+	in others.h and output.h
5
+
1 6
 Sat Feb 10 14:38:20 CET 2007 (tk)
2 7
 ---------------------------------
3 8
   * libclamav/others.h, shared/output.h: try to check coding styles for output
... ...
@@ -18,7 +23,7 @@ Fri Feb  9 22:25:24 CET 2007 (tk)
18 18
 Fri Feb  9 21:12:28 CET 2007 (acab)
19 19
 -----------------------------------
20 20
   * libclamav: Fix win32 compilation error in upack and mew - thanks Nigel
21
-  
21
+ 
22 22
 Fri Feb  9 17:57:15 GMT 2007 (njh)
23 23
 ----------------------------------
24 24
   * libclamav/lockdb.c:	Fix compilation error, bug 234
... ...
@@ -16,7 +16,7 @@
16 16
  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17 17
  *  MA 02110-1301, USA.
18 18
  */
19
-static	char	const	rcsid[] = "$Id: blob.c,v 1.61 2007/02/01 12:42:18 njh Exp $";
19
+static	char	const	rcsid[] = "$Id: blob.c,v 1.62 2007/02/10 14:21:46 njh Exp $";
20 20
 
21 21
 #if HAVE_CONFIG_H
22 22
 #include "clamav-config.h"
... ...
@@ -198,7 +198,7 @@ blobAddData(blob *b, const unsigned char *data, size_t len)
198 198
 
199 199
 		b->size = growth;
200 200
 		b->data = cli_malloc(growth);
201
-	} else if(b->size < b->len + len) {
201
+	} else if(b->size < b->len + (off_t)len) {
202 202
 		unsigned char *p = cli_realloc(b->data, b->size + growth);
203 203
 
204 204
 		if(p == NULL)
... ...
@@ -271,7 +271,7 @@ blobClose(blob *b)
271 271
 		if(b->len == 0) {	/* Not likely */
272 272
 			free(b->data);
273 273
 			b->data = NULL;
274
-			cli_dbgmsg("blobClose: recovered all %u bytes\n",
274
+			cli_dbgmsg("blobClose: recovered all %lu bytes\n",
275 275
 				b->size);
276 276
 			b->size = 0;
277 277
 		} else {
... ...
@@ -280,7 +280,7 @@ blobClose(blob *b)
280 280
 			if(ptr == NULL)
281 281
 				return;
282 282
 
283
-			cli_dbgmsg("blobClose: recovered %u bytes from %u\n",
283
+			cli_dbgmsg("blobClose: recovered %lu bytes from %lu\n",
284 284
 				b->size - b->len, b->size);
285 285
 			b->size = b->len;
286 286
 			b->data = ptr;
... ...
@@ -26,8 +26,8 @@
26 26
 typedef struct blob {
27 27
 	char	*name;	/* filename */
28 28
 	unsigned	char	*data;	/* the stuff itself */
29
-	size_t	len;	/* number of bytes of data so far */
30
-	size_t	size;	/* number of bytes allocated to data so far */
29
+	off_t	len;	/* number of bytes of data so far */
30
+	off_t	size;	/* number of bytes allocated to data so far */
31 31
 	int	isClosed;
32 32
 #ifdef	CL_DEBUG
33 33
 	object_type	magic;	/* verify that this is a blob */
... ...
@@ -16,7 +16,7 @@
16 16
  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17 17
  *  MA 02110-1301, USA.
18 18
  */
19
-static	char	const	rcsid[] = "$Id: message.c,v 1.193 2007/01/07 21:30:49 njh Exp $";
19
+static	char	const	rcsid[] = "$Id: message.c,v 1.194 2007/02/10 14:21:46 njh Exp $";
20 20
 
21 21
 #if HAVE_CONFIG_H
22 22
 #include "clamav-config.h"
... ...
@@ -1043,7 +1043,7 @@ messageExport(message *m, const char *dir, void *(*create)(void), void (*destroy
1043 1043
 
1044 1044
 	if((t_line = binhexBegin(m)) != NULL) {
1045 1045
 		unsigned char byte;
1046
-		size_t newlen = 0L, len, dataforklen, resourceforklen, l;
1046
+		unsigned long newlen = 0L, len, dataforklen, resourceforklen, l;
1047 1047
 		unsigned char *data;
1048 1048
 		char *ptr;
1049 1049
 		int bytenumber;
... ...
@@ -15,7 +15,7 @@
15 15
  *  along with this program; if not, write to the Free Software
16 16
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 17
  */
18
-static	char	const	rcsid[] = "$Id: pdf.c,v 1.59 2007/02/10 11:21:40 njh Exp $";
18
+static	char	const	rcsid[] = "$Id: pdf.c,v 1.60 2007/02/10 14:21:46 njh Exp $";
19 19
 
20 20
 #if HAVE_CONFIG_H
21 21
 #include "clamav-config.h"
... ...
@@ -50,8 +50,8 @@ static	char	const	rcsid[] = "$Id: pdf.c,v 1.59 2007/02/10 11:21:40 njh Exp $";
50 50
 #include "mbox.h"
51 51
 #include "pdf.h"
52 52
 
53
-static	int	flatedecode(const unsigned char *buf, size_t len, int fout, const cli_ctx *ctx);
54
-static	int	ascii85decode(const char *buf, size_t len, unsigned char *output);
53
+static	int	flatedecode(const unsigned char *buf, off_t len, int fout, const cli_ctx *ctx);
54
+static	int	ascii85decode(const char *buf, off_t len, unsigned char *output);
55 55
 static	const	char	*pdf_nextlinestart(const char *ptr, size_t len);
56 56
 static	const	char	*pdf_nextobject(const char *ptr, size_t len);
57 57
 static	const	char	*cli_pmemstr(const char *haystack, size_t hs, const char *needle, size_t ns);
... ...
@@ -390,7 +390,7 @@ cli_pdf(const char *dir, int desc, const cli_ctx *ctx)
390 390
 
391 391
 /* flate inflation - returns zlib status, e.g. Z_OK */
392 392
 static int
393
-flatedecode(const unsigned char *buf, size_t len, int fout, const cli_ctx *ctx)
393
+flatedecode(const unsigned char *buf, off_t len, int fout, const cli_ctx *ctx)
394 394
 {
395 395
 	int zstat;
396 396
 	off_t nbytes;
... ...
@@ -439,10 +439,10 @@ flatedecode(const unsigned char *buf, size_t len, int fout, const cli_ctx *ctx)
439 439
 				break;
440 440
 			default:
441 441
 				if(stream.msg)
442
-					cli_warnmsg("pdf: after writing %u bytes, got error \"%s\" inflating PDF attachment\n",
442
+					cli_warnmsg("pdf: after writing %lu bytes, got error \"%s\" inflating PDF attachment\n",
443 443
 						nbytes, stream.msg);
444 444
 				else
445
-					cli_warnmsg("pdf: after writing %u bytes, got error %d inflating PDF attachment\n",
445
+					cli_warnmsg("pdf: after writing %lu bytes, got error %d inflating PDF attachment\n",
446 446
 						nbytes, zstat);
447 447
 				inflateEnd(&stream);
448 448
 				return zstat;
... ...
@@ -477,7 +477,7 @@ flatedecode(const unsigned char *buf, size_t len, int fout, const cli_ctx *ctx)
477 477
  * See http://www.piclist.com/techref/method/encode.htm (look for base85)
478 478
  */
479 479
 static int
480
-ascii85decode(const char *buf, size_t len, unsigned char *output)
480
+ascii85decode(const char *buf, off_t len, unsigned char *output)
481 481
 {
482 482
 	const char *ptr;
483 483
 	uint32_t sum = 0;
... ...
@@ -489,7 +489,7 @@ ascii85decode(const char *buf, size_t len, unsigned char *output)
489 489
 
490 490
 	ptr = buf;
491 491
 
492
-	cli_dbgmsg("cli_pdf: ascii85decode %u bytes\n", len);
492
+	cli_dbgmsg("cli_pdf: ascii85decode %lu bytes\n", len);
493 493
 
494 494
 	while(len > 0) {
495 495
 		int byte = (len--) ? (int)*ptr++ : EOF;
... ...
@@ -20,7 +20,7 @@
20 20
  * Author: Charles G. Waldman (cgw@pgt.com),  Aug 4 1998
21 21
  * There are many tar files that this code cannot decode.
22 22
  */
23
-static	char	const	rcsid[] = "$Id: untar.c,v 1.33 2006/12/22 18:29:13 njh Exp $";
23
+static	char	const	rcsid[] = "$Id: untar.c,v 1.34 2007/02/10 14:21:46 njh Exp $";
24 24
 
25 25
 #if HAVE_CONFIG_H
26 26
 #include "clamav-config.h"
... ...
@@ -223,7 +223,7 @@ cli_untar(const char *dir, int desc, unsigned int posix, const struct cl_limits
223 223
 
224 224
 			if(fd < 0) {
225 225
 				cli_errmsg("Can't create temporary file %s: %s\n", fullname, strerror(errno));
226
-				cli_dbgmsg("%lu %d %d\n", suffixLen, sizeof(fullname), strlen(fullname));
226
+				cli_dbgmsg("%u %d %d\n", suffixLen, sizeof(fullname), strlen(fullname));
227 227
 				return CL_ETMPFILE;
228 228
 			}
229 229