Stricter flexelinting

Until now, we used the lnt file from varnish-cache, which suppressed
some errors which are actually interesting for us (e.g. the wrong
VSPLAY_FOREACH() was spotted by flexelint with stricter rules).
parent 2b162ae5
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
-efile(451, tbl*) -efile(451, tbl*)
-ecall(835, dlopen) -ecall(835, dlopen)
-e716 // while(1) ...
-e717 // do ... while(0);
-e801 // goto -e801 // goto
-ecall(840, VSB_bcat) -ecall(840, VSB_bcat)
-e793 // significant characters in an external identifier -e793 // significant characters in an external identifier
...@@ -19,9 +21,11 @@ ...@@ -19,9 +21,11 @@
-efile(766, *_if.c) -efile(766, *_if.c)
-esym(528, avoid_compiler_warnings) -esym(528, avoid_compiler_warnings)
-esym(528, vmod_priv_blob*, VGC_*) -esym(528, vmod_priv_blob*, VGC_*)
-esym(728, vmod_priv_blob*, VGC_*)
-esym(843, vmod_priv_blob*, VGC_*) -esym(843, vmod_priv_blob*, VGC_*)
-esym(844, vmod_priv_blob*, VGC_*) -esym(844, vmod_priv_blob*, VGC_*)
-esym(768, arg_vmod_blob*) -esym(768, arg_vmod_blob*)
-emacro(774, REPLACE) // 'if' always evaluates to False
// not fully understood // not fully understood
-efunc(413, *_VSPLAY_NEXT) -efunc(413, *_VSPLAY_NEXT)
......
...@@ -127,8 +127,8 @@ tus_chksum_init(VRT_CTX) { ...@@ -127,8 +127,8 @@ tus_chksum_init(VRT_CTX) {
if (digest_ ## t == NULL) \ if (digest_ ## t == NULL) \
break; \ break; \
if (first == 0) \ if (first == 0) \
VSB_cat(names, ","); \ AZ(VSB_cat(names, ",")); \
VSB_cat(names, #t); \ AZ(VSB_cat(names, #t)); \
first = 0; \ first = 0; \
} while (0); } while (0);
#include "tbl_hash_enum.h" #include "tbl_hash_enum.h"
...@@ -223,7 +223,7 @@ tus_chksum_new(VRT_CTX, struct vmod_blobdigest_digest *d) ...@@ -223,7 +223,7 @@ tus_chksum_new(VRT_CTX, struct vmod_blobdigest_digest *d)
AN(d); AN(d);
r = WS_Alloc(ctx->ws, sizeof *r); r = WS_Alloc(ctx->ws, (unsigned)sizeof *r);
if (r == NULL) { if (r == NULL) {
VRT_fail(ctx, "WS_Alloc failed"); VRT_fail(ctx, "WS_Alloc failed");
return (NULL); return (NULL);
...@@ -249,7 +249,8 @@ tus_chksum_hdr(VRT_CTX, const char *hdr) ...@@ -249,7 +249,8 @@ tus_chksum_hdr(VRT_CTX, const char *hdr)
if (sep == NULL) if (sep == NULL)
return (NULL); return (NULL);
d = tus_hash(hdr, (unsigned)(sep - hdr)); assert(sep >= hdr);
d = tus_hash(hdr, (size_t)(sep - hdr));
if (d == NULL) if (d == NULL)
return (NULL); return (NULL);
...@@ -259,7 +260,7 @@ tus_chksum_hdr(VRT_CTX, const char *hdr) ...@@ -259,7 +260,7 @@ tus_chksum_hdr(VRT_CTX, const char *hdr)
sep++; sep++;
expect = tus_b64_decode(ctx, sep, 0); expect = tus_b64_decode(ctx, sep, (size_t)0);
if (expect == NULL) if (expect == NULL)
return (NULL); return (NULL);
...@@ -273,7 +274,7 @@ tus_chksum_update(VRT_CTX, const struct tus_chksum *c, ...@@ -273,7 +274,7 @@ tus_chksum_update(VRT_CTX, const struct tus_chksum *c,
const void *ptr, size_t l) const void *ptr, size_t l)
{ {
struct vrt_blob b; struct vrt_blob b;
struct arg_vmod_blobdigest_digest_update a[1] = {{0}}; struct arg_vmod_blobdigest_digest_update a = {0};
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
CHECK_OBJ_NOTNULL(c, VMOD_TUS_CHKSUM_MAGIC); CHECK_OBJ_NOTNULL(c, VMOD_TUS_CHKSUM_MAGIC);
...@@ -283,10 +284,10 @@ tus_chksum_update(VRT_CTX, const struct tus_chksum *c, ...@@ -283,10 +284,10 @@ tus_chksum_update(VRT_CTX, const struct tus_chksum *c,
b.len = l; b.len = l;
b.blob = ptr; b.blob = ptr;
a->valid_msg = 1; a.valid_msg = 1;
a->msg = &b; a.msg = &b;
(void) vmod_blobdigest->f_digest_update(ctx, c->digest, a); (void) vmod_blobdigest->f_digest_update(ctx, c->digest, &a);
} }
VCL_BLOB VCL_BLOB
......
...@@ -40,8 +40,8 @@ ...@@ -40,8 +40,8 @@
*/ */
extern struct VSC_lck *lck_fcore; extern struct VSC_lck *lck_fcore;
#define TUS_PATH_MAX PATH_MAX #define TUS_PATH_MAX ((size_t)PATH_MAX)
#define TUS_METADATA_MAX 2048u // ballpark of AWS S3 metadata #define TUS_METADATA_MAX ((size_t)2048) // ballpark of AWS S3 metadata
enum tus_f_type { enum tus_f_type {
TUS_SINGLE = 0, TUS_SINGLE = 0,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment