[master] 1ba1773f6 Monday Morning FlexeLinting
Poul-Henning Kamp
phk at FreeBSD.org
Mon Dec 2 08:53:07 UTC 2019
commit 1ba1773f6507c2cdd34d8e0e095298562c41c878
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Mon Dec 2 08:52:21 2019 +0000
Monday Morning FlexeLinting
diff --git a/bin/varnishd/cache/cache_shmlog.c b/bin/varnishd/cache/cache_shmlog.c
index f3765ff70..4eb9ed30b 100644
--- a/bin/varnishd/cache/cache_shmlog.c
+++ b/bin/varnishd/cache/cache_shmlog.c
@@ -509,7 +509,7 @@ vsm_vsmw_unlock(void)
void
VSM_Init(void)
{
- int i;
+ unsigned u;
assert(UINT_MAX % VSL_SEGMENTS == VSL_SEGMENTS - 1);
@@ -543,8 +543,8 @@ VSM_Init(void)
vsl_head->segsize = vsl_segsize;
vsl_head->offset[0] = 0;
vsl_head->segment_n = vsl_segment_n;
- for (i = 1; i < VSL_SEGMENTS; i++)
- vsl_head->offset[i] = -1;
+ for (u = 1; u < VSL_SEGMENTS; u++)
+ vsl_head->offset[u] = -1;
VWMB();
memcpy(vsl_head->marker, VSL_HEAD_MARKER, sizeof vsl_head->marker);
}
diff --git a/bin/varnishd/cache/cache_wrk.c b/bin/varnishd/cache/cache_wrk.c
index dd032850f..3fd20eee2 100644
--- a/bin/varnishd/cache/cache_wrk.c
+++ b/bin/varnishd/cache/cache_wrk.c
@@ -165,7 +165,7 @@ pool_addstat(struct VSC_main_wrk *dst, struct VSC_main_wrk *src)
memset(src, 0, sizeof *src);
}
-static inline int
+static unsigned
pool_reserve(void)
{
unsigned lim;
@@ -508,7 +508,7 @@ pool_herder(void *priv)
double t_idle;
struct worker *wrk;
double delay;
- int wthread_min;
+ unsigned wthread_min;
uintmax_t dq = (1ULL << 31);
vtim_mono dqt = 0;
diff --git a/bin/varnishd/http2/cache_http2_session.c b/bin/varnishd/http2/cache_http2_session.c
index 0fce32bd8..8480692f0 100644
--- a/bin/varnishd/http2/cache_http2_session.c
+++ b/bin/varnishd/http2/cache_http2_session.c
@@ -163,16 +163,15 @@ h2_del_sess(struct worker *wrk, struct h2_sess *h2, enum sess_close reason)
enum htc_status_e v_matchproto_(htc_complete_f)
H2_prism_complete(struct http_conn *htc)
{
- ptrdiff_t l;
+ size_t sz;
CHECK_OBJ_NOTNULL(htc, HTTP_CONN_MAGIC);
- l = htc->rxbuf_e - htc->rxbuf_b;
- if (l >= sizeof(H2_prism) &&
- !memcmp(htc->rxbuf_b, H2_prism, sizeof(H2_prism)))
- return (HTC_S_COMPLETE);
- if (l < sizeof(H2_prism) && !memcmp(htc->rxbuf_b, H2_prism, l))
- return (HTC_S_MORE);
- return (HTC_S_JUNK);
+ sz = sizeof(H2_prism);
+ if (htc->rxbuf_b + sz > htc->rxbuf_e)
+ sz = htc->rxbuf_e - htc->rxbuf_b;
+ if (memcmp(htc->rxbuf_b, H2_prism, sz))
+ return (HTC_S_JUNK);
+ return (sz == sizeof(H2_prism) ? HTC_S_COMPLETE : HTC_S_MORE);
}
diff --git a/bin/varnishd/mgt/mgt_param.c b/bin/varnishd/mgt/mgt_param.c
index 93afb9d35..03d707ee6 100644
--- a/bin/varnishd/mgt/mgt_param.c
+++ b/bin/varnishd/mgt/mgt_param.c
@@ -565,8 +565,8 @@ MCF_AddParams(struct parspec *ps)
exit(4);
}
mcf_addpar(pp);
- if (strlen(pp->name) + 1L > margin2)
- margin2 = strlen(pp->name) + 1;
+ if ((int)strlen(pp->name) + 1 > margin2)
+ margin2 = (int)strlen(pp->name) + 1;
}
}
diff --git a/bin/varnishd/mgt/mgt_vcl.c b/bin/varnishd/mgt/mgt_vcl.c
index 8478887ae..81751b8ca 100644
--- a/bin/varnishd/mgt/mgt_vcl.c
+++ b/bin/varnishd/mgt/mgt_vcl.c
@@ -55,7 +55,7 @@ struct vclstate {
static const struct vclstate VCL_STATE_LABEL[1] = {{ "label" }};
-static int vcl_count;
+static unsigned vcl_count;
struct vclproghead vclhead = VTAILQ_HEAD_INITIALIZER(vclhead);
struct vmodfilehead vmodhead = VTAILQ_HEAD_INITIALIZER(vmodhead);
diff --git a/bin/varnishd/storage/storage_persistent.h b/bin/varnishd/storage/storage_persistent.h
index 7fe612fba..48fe8c0c5 100644
--- a/bin/varnishd/storage/storage_persistent.h
+++ b/bin/varnishd/storage/storage_persistent.h
@@ -230,7 +230,7 @@ struct smp_sc {
const struct stevedore *stevedore;
int fd;
const char *filename;
- off_t mediasize;
+ uint64_t mediasize;
uintptr_t align;
uint32_t granularity;
uint32_t unique;
diff --git a/bin/varnishd/storage/storage_simple.c b/bin/varnishd/storage/storage_simple.c
index 83e8d713c..962756cdd 100644
--- a/bin/varnishd/storage/storage_simple.c
+++ b/bin/varnishd/storage/storage_simple.c
@@ -45,7 +45,7 @@
/*-------------------------------------------------------------------*/
static struct storage *
-sml_stv_alloc(const struct stevedore *stv, size_t size, int flags)
+sml_stv_alloc(const struct stevedore *stv, ssize_t size, int flags)
{
struct storage *st;
@@ -74,7 +74,7 @@ sml_stv_alloc(const struct stevedore *stv, size_t size, int flags)
if (size <= cache_param->fetch_chunksize)
break;
- size >>= 1;
+ size /= 2;
}
CHECK_OBJ_ORNULL(st, STORAGE_MAGIC);
return (st);
@@ -343,7 +343,7 @@ sml_iterator(struct worker *wrk, struct objcore *oc,
*/
static struct storage *
-objallocwithnuke(struct worker *wrk, const struct stevedore *stv, size_t size,
+objallocwithnuke(struct worker *wrk, const struct stevedore *stv, ssize_t size,
int flags)
{
struct storage *st = NULL;
More information about the varnish-commit
mailing list