From 7654978b8373aa2ae77c2313bb871e403babbd34 Mon Sep 17 00:00:00 2001 From: phk Date: Sat, 19 Jul 2008 12:38:28 +0000 Subject: [PATCH] More assorted FlexeLint polishing git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2968 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/bin/varnishd/cache_backend.c | 2 +- varnish-cache/bin/varnishd/cache_center.c | 1 - varnish-cache/bin/varnishd/cache_dir_random.c | 2 ++ .../bin/varnishd/cache_dir_round_robin.c | 2 ++ varnish-cache/bin/varnishd/cache_dir_simple.c | 2 ++ varnish-cache/bin/varnishd/cache_http.c | 19 ++++++++++--------- varnish-cache/bin/varnishd/cache_vary.c | 3 ++- 7 files changed, 19 insertions(+), 12 deletions(-) diff --git a/varnish-cache/bin/varnishd/cache_backend.c b/varnish-cache/bin/varnishd/cache_backend.c index fffa9e95..2db08561 100644 --- a/varnish-cache/bin/varnishd/cache_backend.c +++ b/varnish-cache/bin/varnishd/cache_backend.c @@ -98,7 +98,7 @@ VBE_TryConnect(const struct sess *sp, int pf, const struct sockaddr *sa, socklen tmo = params->connect_timeout; if (sp->backend->connect_timeout > 10e-3) - tmo = sp->backend->connect_timeout * 1000; + tmo = (int)(sp->backend->connect_timeout * 1000); if (tmo > 0) i = TCP_connect(s, sa, salen, tmo); diff --git a/varnish-cache/bin/varnishd/cache_center.c b/varnish-cache/bin/varnishd/cache_center.c index 61d76333..37414481 100644 --- a/varnish-cache/bin/varnishd/cache_center.c +++ b/varnish-cache/bin/varnishd/cache_center.c @@ -72,7 +72,6 @@ DOT acceptor -> start [style=bold,color=green,weight=4] #include "shmlog.h" #include "vcl.h" -#include "cli.h" #include "cli_priv.h" #include "cache.h" diff --git a/varnish-cache/bin/varnishd/cache_dir_random.c b/varnish-cache/bin/varnishd/cache_dir_random.c index f2d5c983..f2890c38 100644 --- a/varnish-cache/bin/varnishd/cache_dir_random.c +++ b/varnish-cache/bin/varnishd/cache_dir_random.c @@ -61,6 +61,7 @@ struct vdi_random { }; +/*lint -e{818} not const-able */ static struct backend * vdi_random_choose(struct sess *sp) { @@ -81,6 +82,7 @@ vdi_random_choose(struct sess *sp) return (NULL); } +/*lint -e{818} not const-able */ static void vdi_random_fini(struct director *d) { diff --git a/varnish-cache/bin/varnishd/cache_dir_round_robin.c b/varnish-cache/bin/varnishd/cache_dir_round_robin.c index 47663f09..728691c6 100644 --- a/varnish-cache/bin/varnishd/cache_dir_round_robin.c +++ b/varnish-cache/bin/varnishd/cache_dir_round_robin.c @@ -60,6 +60,7 @@ struct vdi_round_robin { }; +/*lint -e{818} not const-able */ static struct backend * vdi_round_robin_choose(struct sess *sp) { @@ -75,6 +76,7 @@ vdi_round_robin_choose(struct sess *sp) return (backend); } +/*lint -e{818} not const-able */ static void vdi_round_robin_fini(struct director *d) { diff --git a/varnish-cache/bin/varnishd/cache_dir_simple.c b/varnish-cache/bin/varnishd/cache_dir_simple.c index bbea2194..672d4d55 100644 --- a/varnish-cache/bin/varnishd/cache_dir_simple.c +++ b/varnish-cache/bin/varnishd/cache_dir_simple.c @@ -54,6 +54,7 @@ struct vdi_simple { struct backend *backend; }; +/*lint -e{818} not const-able */ static struct backend * vdi_simple_choose(struct sess *sp) { @@ -64,6 +65,7 @@ vdi_simple_choose(struct sess *sp) return (vs->backend); } +/*lint -e{818} not const-able */ static void vdi_simple_fini(struct director *d) { diff --git a/varnish-cache/bin/varnishd/cache_http.c b/varnish-cache/bin/varnishd/cache_http.c index 175081ae..3d67ad4e 100644 --- a/varnish-cache/bin/varnishd/cache_http.c +++ b/varnish-cache/bin/varnishd/cache_http.c @@ -53,6 +53,7 @@ #include "http_headers.h" #undef HTTPH +/*lint -save -e773 not () */ #define LOGMTX2(ax, bx, cx) [bx] = SLT_##ax##cx #define LOGMTX1(ax) { \ @@ -69,6 +70,7 @@ static enum shmlogtag logmtx[][HTTP_HDR_FIRST + 1] = { [HTTP_Tx] = LOGMTX1(Tx), [HTTP_Obj] = LOGMTX1(Obj) }; +/*lint -restore */ static enum shmlogtag http2shmlog(const struct http *hp, int t) @@ -551,20 +553,20 @@ http_copyh(struct http *to, const struct http *fm, unsigned n) } static void -http_copyreq(struct http *to, const struct http *fm, int transparent) +http_copyreq(struct http *to, const struct http *fm, int how) { CHECK_OBJ_NOTNULL(fm, HTTP_MAGIC); CHECK_OBJ_NOTNULL(to, HTTP_MAGIC); - if (transparent) + + if ((how == HTTPH_R_PIPE) || (how == HTTPH_R_PASS)) { http_copyh(to, fm, HTTP_HDR_REQ); - else - http_SetH(to, HTTP_HDR_REQ, "GET"); - http_copyh(to, fm, HTTP_HDR_URL); - if (transparent) http_copyh(to, fm, HTTP_HDR_PROTO); - else + } else { + http_SetH(to, HTTP_HDR_REQ, "GET"); http_SetH(to, HTTP_HDR_PROTO, "HTTP/1.1"); + } + http_copyh(to, fm, HTTP_HDR_URL); } void @@ -645,8 +647,7 @@ http_FilterHeader(struct sess *sp, unsigned how) hp = bereq->http; hp->logtag = HTTP_Tx; - http_copyreq(hp, sp->http, - (how == HTTPH_R_PIPE) || (how == HTTPH_R_PASS)); + http_copyreq(hp, sp->http, how); http_FilterFields(sp->wrk, sp->fd, hp, sp->http, how); http_PrintfHeader(sp->wrk, sp->fd, hp, "X-Varnish: %u", sp->xid); http_PrintfHeader(sp->wrk, sp->fd, hp, diff --git a/varnish-cache/bin/varnishd/cache_vary.c b/varnish-cache/bin/varnishd/cache_vary.c index d7635303..852c8f55 100644 --- a/varnish-cache/bin/varnishd/cache_vary.c +++ b/varnish-cache/bin/varnishd/cache_vary.c @@ -107,7 +107,8 @@ VRY_Create(const struct sess *sp) e--; /* Encode two byte length and contents */ l = e - h; - vsb_printf(sb, "%c%c", l >> 8, l & 0xff); + assert(!(l & ~0xffff)); + vsb_printf(sb, "%c%c", (unsigned)l >> 8, l & 0xff); vsb_bcat(sb, h, e - h); } else { /* Mark as "not present" */ -- 2.39.5