Flexelinting

parent f758abf0
......@@ -9,3 +9,8 @@
// constructors not referenced
-esym(528, init_*)
-esym(528, assert_*)
// redundant declaration
-esym(763, vmod_*)
-e747 // prot coersion
\ No newline at end of file
......@@ -32,7 +32,6 @@
#include <string.h>
#include <cache/cache.h>
#include <vsb.h>
#include "vsbjson.h"
#include "vcc_j_if.h"
......@@ -276,8 +275,7 @@ vmod_string(VRT_CTX, VCL_STRANDS s, VCL_ENUM esc)
struct strands sc;
struct vsb vsb[1];
const char *p, *e;
ssize_t sl;
size_t l;
ssize_t l;
int i;
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
......@@ -316,9 +314,9 @@ vmod_string(VRT_CTX, VCL_STRANDS s, VCL_ENUM esc)
if (esc == VENUM(none)) {
for (i = 0; i < sc.n - 1; i++)
(void)VSB_bcat(vsb, sc.p[i], strlen(sc.p[i]));
(void)VSB_bcat(vsb, sc.p[i], (ssize_t)strlen(sc.p[i]));
assert(i == sc.n - 1);
l = strlen(sc.p[i]);
l = (ssize_t)strlen(sc.p[i]);
AN(l);
if (sc.p[i][l - 1] == '"')
l--;
......@@ -345,7 +343,7 @@ vmod_string(VRT_CTX, VCL_STRANDS s, VCL_ENUM esc)
WRONG("esc enum");
(void)VSB_putc(vsb, '"');
sl = VSB_len(vsb);
l = VSB_len(vsb);
p = WS_VSB_finish(vsb, ctx->ws, NULL);
if (p == NULL) {
VRT_fail(ctx, "j.string(): out of workspace");
......@@ -355,7 +353,7 @@ vmod_string(VRT_CTX, VCL_STRANDS s, VCL_ENUM esc)
e = NULL;
AZ(is_jquot(p + 2, &e));
// validation succeeds if error points to the final "
if (e == p + sl - 1)
if (e == p + l - 1)
assert(*e == '"');
else if (esc == VENUM(none)) {
VRT_fail(ctx,
......
......@@ -33,7 +33,6 @@
#include <vdef.h>
#include <vas.h>
#include <vsb.h>
#include <assert.h>
#include "vsbjson.h"
......
......@@ -96,10 +96,10 @@ unhex16(const uint8_t *p)
{
struct unhex16_r r;
unsigned u;
uint8_t t;
uint8_t s, t;
r.value = 0;
for (u = 0; u < 4; u++) {
for (u = 0, s = 12; u < 4; u++, s -= 4) {
if (p[u] >= '0' && p[u] <= '9')
t = p[u] - '0';
else if (p[u] >= 'a' && p[u] <= 'f')
......@@ -108,7 +108,8 @@ unhex16(const uint8_t *p)
t = 0xa + p[u] - 'A';
else
break; // XXX illegal hex;
r.value |= t << (12 - (4 * u));
assert(s <= 12);
r.value |= (uint32_t)t << s;
}
r.len = u;
return (r);
......@@ -179,22 +180,22 @@ vsbjunquot(struct vsb *vsb, const char *pa, const char **err)
return (0);
}
else if (code < 0x800) {
t[0] = 0xc0 | (code >> 6);
t[1] = 0x80 | (code & ((1<<6) - 1));
t[0] = 0xc0 | ((code >> 6) & ((1<<5) - 1));
t[1] = 0x80 | (code & ((1<<6) - 1));
if (VSB_bcat(vsb, t, 2))
return (0);
}
else if (code >= 0xd800 && code <= 0xdfff)
return (jerr(p, err));
else if (code < 0x10000) {
t[0] = 0xe0 | (code >> 12);
t[1] = 0x80 | ((code >> 6) & ((1<<6) - 1));
t[2] = 0x80 | (code & ((1<<6) - 1));
t[0] = 0xe0 | ((code >> 12) & ((1<<4) - 1));
t[1] = 0x80 | ((code >> 6) & ((1<<6) - 1));
t[2] = 0x80 | (code & ((1<<6) - 1));
if (VSB_bcat(vsb, t, 3))
return (0);
}
else if (code < 0x110000) {
t[0] = 0xf0 | (code >> 18);
t[0] = 0xf0 | ((code >> 18) & ((1<<3) - 1));
t[1] = 0x80 | ((code >> 12) & ((1<<6) - 1));
t[2] = 0x80 | ((code >> 6) & ((1<<6) - 1));
t[3] = 0x80 | (code & ((1<<6) - 1));
......@@ -316,6 +317,7 @@ is_jquot(const char *pa, const char **err)
const uint8_t *p = (uint8_t *)pa;
unsigned u;
//lint -e{850} // loop variable modified in body
for (; *p; p++) {
if (*p < 0x20 || *p == '"')
return (jerr(p, err));
......
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