]> err.no Git - varnish/commitdiff
Technically speaking, vsb_len() could return -1, except it won't because
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Sat, 19 Jul 2008 12:04:25 +0000 (12:04 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Sat, 19 Jul 2008 12:04:25 +0000 (12:04 +0000)
of the vsb_overflow() assert.

Make this explicit for FlexeLint.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2967 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/bin/varnishd/cache_fetch.c
varnish-cache/bin/varnishd/cache_vary.c
varnish-cache/bin/varnishd/flint.lnt
varnish-cache/bin/varnishd/flint.sh
varnish-cache/bin/varnishd/storage_file.c
varnish-cache/bin/varnishd/varnishd.c

index 29c4d15e1afc42ffc835dff5141d19a5fa254a6b..e098dcf731725c940bab4d8db7110941fb0dd740 100644 (file)
@@ -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 @@ fetch_chunked(struct sess *sp, struct http_conn *htc)
 /*--------------------------------------------------------------------*/
 
 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 @@ fetch_eof(struct sess *sp, struct http_conn *htc)
                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 @@ FetchReqBody(struct sess *sp)
        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 @@ FetchReqBody(struct sess *sp)
                /* 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 @@ Fetch(struct sess *sp)
                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);
index abac54218faedd5b0aa2b2101f79126e25568959..d76353035b8ce2ef8c9571c9c35717790e15108b 100644 (file)
@@ -67,7 +67,7 @@ VRY_Create(const struct sess *sp)
 {
        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 @@ VRY_Create(const struct sess *sp)
        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);
index 8140aee63bee32a32e9788d0c04a434f58b06b9f..bba9de2f780c4a73f5a7aa82da3bd19b3ae833b9 100644 (file)
@@ -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
index 29279b67bfcebe3aa93afaa67a2b1d4d26c9b40f..25c35176250d98f1aa58f7f8d4bd0c1341c93787 100755 (executable)
@@ -8,7 +8,7 @@ flexelint \
        -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
index fb6ffde48992b50b92bae87e452c4727beb6905d..889f65f56ed8292ee4b828f8464f22c2a9dd9544 100644 (file)
@@ -170,6 +170,7 @@ smf_calcsize(struct smf_sc *sc, const char *size, int newfile)
                 */
                l = st.st_size;
        } else {
+               AN(size);
                q = str2bytes(size, &l, fssize);
 
                if (q != NULL)
index 1b6df279080e6e9d5995f575e80cc7d0a2cfe6e6..8bcb35ccba58c4d755575ea7cfb107bf395efdd6 100644 (file)
@@ -401,7 +401,7 @@ cli_check(const struct cli *cli)
 /*--------------------------------------------------------------------*/
 
 int
-main(int argc, char *argv[])
+main(int argc, char * const *argv)
 {
        int o;
        unsigned C_flag = 0;