r2967 - trunk/varnish-cache/bin/varnishd

phk at projects.linpro.no phk at projects.linpro.no
Sat Jul 19 14:04:25 CEST 2008


Author: phk
Date: 2008-07-19 14:04:25 +0200 (Sat, 19 Jul 2008)
New Revision: 2967

Modified:
   trunk/varnish-cache/bin/varnishd/cache_fetch.c
   trunk/varnish-cache/bin/varnishd/cache_vary.c
   trunk/varnish-cache/bin/varnishd/flint.lnt
   trunk/varnish-cache/bin/varnishd/flint.sh
   trunk/varnish-cache/bin/varnishd/storage_file.c
   trunk/varnish-cache/bin/varnishd/varnishd.c
Log:
Technically speaking, vsb_len() could return -1, except it won't because
of the vsb_overflow() assert.

Make this explicit for FlexeLint.



Modified: trunk/varnish-cache/bin/varnishd/cache_fetch.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_fetch.c	2008-07-19 12:03:16 UTC (rev 2966)
+++ trunk/varnish-cache/bin/varnishd/cache_fetch.c	2008-07-19 12:04:25 UTC (rev 2967)
@@ -40,7 +40,6 @@
 #include "shmlog.h"
 #include "cache.h"
 #include "stevedore.h"
-#include "cli.h"
 #include "cli_priv.h"
 
 static unsigned fetchfrag;
@@ -204,7 +203,7 @@
 /*--------------------------------------------------------------------*/
 
 static void
-dump_st(struct sess *sp, struct storage *st)
+dump_st(const struct sess *sp, const struct storage *st)
 {
 	txt t;
 
@@ -247,7 +246,7 @@
 		st->len += i;
 		sp->obj->len += i;
 	}
-	if (st != NULL && fetchfrag > 0)
+	if (fetchfrag > 0)
 		dump_st(sp, st);
 
 	if (st->len == 0) {
@@ -272,7 +271,7 @@
 	unsigned long content_length;
 	char buf[8192];
 	char *ptr, *endp;
-	int read;
+	int rdcnt;
 
 	if (http_GetHdr(sp->http, H_Content_Length, &ptr)) {
 
@@ -280,16 +279,16 @@
 		/* XXX should check result of conversion */
 		while (content_length) {
 			if (content_length > sizeof buf)
-				read = sizeof buf;
+				rdcnt = sizeof buf;
 			else
-				read = content_length;
-			read = HTC_Read(sp->htc, buf, read);
-			if (read <= 0)
+				rdcnt = content_length;
+			rdcnt = HTC_Read(sp->htc, buf, rdcnt);
+			if (rdcnt <= 0)
 				return (1);
-			content_length -= read;
+			content_length -= rdcnt;
 			if (!sp->sendbody)
 				continue;
-			WRK_Write(sp->wrk, buf, read);
+			WRK_Write(sp->wrk, buf, rdcnt);	/* XXX: stats ? */
 			if (WRK_Flush(sp->wrk))
 				return (2);
 		}
@@ -342,7 +341,7 @@
 		return (__LINE__);
 	TCP_blocking(vc->fd);	/* XXX: we should timeout instead */
 	WRK_Reset(w, &vc->fd);
-	http_Write(w, hp, 0);
+	http_Write(w, hp, 0);	/* XXX: stats ? */
 
 	/* Deal with any message-body the request might have */
 	i = FetchReqBody(sp);

Modified: trunk/varnish-cache/bin/varnishd/cache_vary.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_vary.c	2008-07-19 12:03:16 UTC (rev 2966)
+++ trunk/varnish-cache/bin/varnishd/cache_vary.c	2008-07-19 12:04:25 UTC (rev 2967)
@@ -67,7 +67,7 @@
 {
 	char *v, *p, *q, *h, *e;
 	struct vsb *sb, *sbh;
-	unsigned l;
+	int l;
 
 	/* No Vary: header, no worries */
 	if (!http_GetHdr(sp->obj->http, H_Vary, &v))
@@ -127,6 +127,7 @@
 	vsb_finish(sb);
 	AZ(vsb_overflowed(sb));
 	l = vsb_len(sb);
+	assert(l >= 0);
 	sp->obj->vary = malloc(l);
 	AN(sp->obj->vary);
 	memcpy(sp->obj->vary, vsb_data(sb), l);

Modified: trunk/varnish-cache/bin/varnishd/flint.lnt
===================================================================
--- trunk/varnish-cache/bin/varnishd/flint.lnt	2008-07-19 12:03:16 UTC (rev 2966)
+++ trunk/varnish-cache/bin/varnishd/flint.lnt	2008-07-19 12:04:25 UTC (rev 2967)
@@ -53,7 +53,8 @@
 -esym(534, strcpy)	// Ignoring return value of function
 -esym(534, strlcpy)	// Ignoring return value of function
 
--emacro(506, isnan)	// constant value boolean
+-emacro(506, isnan, isfinite)	// constant value boolean
+-emacro(736, isfinite)	// loss of precision
 -emacro(747, isnan)	// significant coersion
 -emacro(506, assert)	// constant value boolean
 -emacro(827, assert)	// loop not reachable

Modified: trunk/varnish-cache/bin/varnishd/flint.sh
===================================================================
--- trunk/varnish-cache/bin/varnishd/flint.sh	2008-07-19 12:03:16 UTC (rev 2966)
+++ trunk/varnish-cache/bin/varnishd/flint.sh	2008-07-19 12:04:25 UTC (rev 2967)
@@ -8,7 +8,7 @@
 	-I../.. \
 	-DVARNISH_STATE_DIR=\"foo\" \
 	flint.lnt \
-	*.c > $T 2>&1
+	*.c ../../lib/libvarnish/*.c > $T 2>&1
 
 for t in Error Warning Info Note
 do

Modified: trunk/varnish-cache/bin/varnishd/storage_file.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/storage_file.c	2008-07-19 12:03:16 UTC (rev 2966)
+++ trunk/varnish-cache/bin/varnishd/storage_file.c	2008-07-19 12:04:25 UTC (rev 2967)
@@ -170,6 +170,7 @@
 		 */
 		l = st.st_size;
 	} else {
+		AN(size);
 		q = str2bytes(size, &l, fssize);
 
 		if (q != NULL)

Modified: trunk/varnish-cache/bin/varnishd/varnishd.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/varnishd.c	2008-07-19 12:03:16 UTC (rev 2966)
+++ trunk/varnish-cache/bin/varnishd/varnishd.c	2008-07-19 12:04:25 UTC (rev 2967)
@@ -401,7 +401,7 @@
 /*--------------------------------------------------------------------*/
 
 int
-main(int argc, char *argv[])
+main(int argc, char * const *argv)
 {
 	int o;
 	unsigned C_flag = 0;




More information about the varnish-commit mailing list