Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libvmod-j
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
libvmod-j
Commits
7882fd78
Unverified
Commit
7882fd78
authored
Sep 08, 2023
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Flexelinting
parent
f758abf0
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
17 deletions
+21
-17
flint.lnt
src/flint.lnt
+5
-0
vmod_j.c
src/vmod_j.c
+5
-7
vsbjson-test.c
src/vsbjson-test.c
+0
-1
vsbjson.c
src/vsbjson.c
+11
-9
No files found.
src/flint.lnt
View file @
7882fd78
...
@@ -9,3 +9,8 @@
...
@@ -9,3 +9,8 @@
// constructors not referenced
// constructors not referenced
-esym(528, init_*)
-esym(528, init_*)
-esym(528, assert_*)
-esym(528, assert_*)
// redundant declaration
-esym(763, vmod_*)
-e747 // prot coersion
\ No newline at end of file
src/vmod_j.c
View file @
7882fd78
...
@@ -32,7 +32,6 @@
...
@@ -32,7 +32,6 @@
#include <string.h>
#include <string.h>
#include <cache/cache.h>
#include <cache/cache.h>
#include <vsb.h>
#include "vsbjson.h"
#include "vsbjson.h"
#include "vcc_j_if.h"
#include "vcc_j_if.h"
...
@@ -276,8 +275,7 @@ vmod_string(VRT_CTX, VCL_STRANDS s, VCL_ENUM esc)
...
@@ -276,8 +275,7 @@ vmod_string(VRT_CTX, VCL_STRANDS s, VCL_ENUM esc)
struct
strands
sc
;
struct
strands
sc
;
struct
vsb
vsb
[
1
];
struct
vsb
vsb
[
1
];
const
char
*
p
,
*
e
;
const
char
*
p
,
*
e
;
ssize_t
sl
;
ssize_t
l
;
size_t
l
;
int
i
;
int
i
;
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
...
@@ -316,9 +314,9 @@ vmod_string(VRT_CTX, VCL_STRANDS s, VCL_ENUM esc)
...
@@ -316,9 +314,9 @@ vmod_string(VRT_CTX, VCL_STRANDS s, VCL_ENUM esc)
if
(
esc
==
VENUM
(
none
))
{
if
(
esc
==
VENUM
(
none
))
{
for
(
i
=
0
;
i
<
sc
.
n
-
1
;
i
++
)
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
);
assert
(
i
==
sc
.
n
-
1
);
l
=
strlen
(
sc
.
p
[
i
]);
l
=
(
ssize_t
)
strlen
(
sc
.
p
[
i
]);
AN
(
l
);
AN
(
l
);
if
(
sc
.
p
[
i
][
l
-
1
]
==
'"'
)
if
(
sc
.
p
[
i
][
l
-
1
]
==
'"'
)
l
--
;
l
--
;
...
@@ -345,7 +343,7 @@ vmod_string(VRT_CTX, VCL_STRANDS s, VCL_ENUM esc)
...
@@ -345,7 +343,7 @@ vmod_string(VRT_CTX, VCL_STRANDS s, VCL_ENUM esc)
WRONG
(
"esc enum"
);
WRONG
(
"esc enum"
);
(
void
)
VSB_putc
(
vsb
,
'"'
);
(
void
)
VSB_putc
(
vsb
,
'"'
);
s
l
=
VSB_len
(
vsb
);
l
=
VSB_len
(
vsb
);
p
=
WS_VSB_finish
(
vsb
,
ctx
->
ws
,
NULL
);
p
=
WS_VSB_finish
(
vsb
,
ctx
->
ws
,
NULL
);
if
(
p
==
NULL
)
{
if
(
p
==
NULL
)
{
VRT_fail
(
ctx
,
"j.string(): out of workspace"
);
VRT_fail
(
ctx
,
"j.string(): out of workspace"
);
...
@@ -355,7 +353,7 @@ vmod_string(VRT_CTX, VCL_STRANDS s, VCL_ENUM esc)
...
@@ -355,7 +353,7 @@ vmod_string(VRT_CTX, VCL_STRANDS s, VCL_ENUM esc)
e
=
NULL
;
e
=
NULL
;
AZ
(
is_jquot
(
p
+
2
,
&
e
));
AZ
(
is_jquot
(
p
+
2
,
&
e
));
// validation succeeds if error points to the final "
// validation succeeds if error points to the final "
if
(
e
==
p
+
s
l
-
1
)
if
(
e
==
p
+
l
-
1
)
assert
(
*
e
==
'"'
);
assert
(
*
e
==
'"'
);
else
if
(
esc
==
VENUM
(
none
))
{
else
if
(
esc
==
VENUM
(
none
))
{
VRT_fail
(
ctx
,
VRT_fail
(
ctx
,
...
...
src/vsbjson-test.c
View file @
7882fd78
...
@@ -33,7 +33,6 @@
...
@@ -33,7 +33,6 @@
#include <vdef.h>
#include <vdef.h>
#include <vas.h>
#include <vas.h>
#include <vsb.h>
#include <assert.h>
#include <assert.h>
#include "vsbjson.h"
#include "vsbjson.h"
...
...
src/vsbjson.c
View file @
7882fd78
...
@@ -96,10 +96,10 @@ unhex16(const uint8_t *p)
...
@@ -96,10 +96,10 @@ unhex16(const uint8_t *p)
{
{
struct
unhex16_r
r
;
struct
unhex16_r
r
;
unsigned
u
;
unsigned
u
;
uint8_t
t
;
uint8_t
s
,
t
;
r
.
value
=
0
;
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'
)
if
(
p
[
u
]
>=
'0'
&&
p
[
u
]
<=
'9'
)
t
=
p
[
u
]
-
'0'
;
t
=
p
[
u
]
-
'0'
;
else
if
(
p
[
u
]
>=
'a'
&&
p
[
u
]
<=
'f'
)
else
if
(
p
[
u
]
>=
'a'
&&
p
[
u
]
<=
'f'
)
...
@@ -108,7 +108,8 @@ unhex16(const uint8_t *p)
...
@@ -108,7 +108,8 @@ unhex16(const uint8_t *p)
t
=
0xa
+
p
[
u
]
-
'A'
;
t
=
0xa
+
p
[
u
]
-
'A'
;
else
else
break
;
// XXX illegal hex;
break
;
// XXX illegal hex;
r
.
value
|=
t
<<
(
12
-
(
4
*
u
));
assert
(
s
<=
12
);
r
.
value
|=
(
uint32_t
)
t
<<
s
;
}
}
r
.
len
=
u
;
r
.
len
=
u
;
return
(
r
);
return
(
r
);
...
@@ -179,7 +180,7 @@ vsbjunquot(struct vsb *vsb, const char *pa, const char **err)
...
@@ -179,7 +180,7 @@ vsbjunquot(struct vsb *vsb, const char *pa, const char **err)
return
(
0
);
return
(
0
);
}
}
else
if
(
code
<
0x800
)
{
else
if
(
code
<
0x800
)
{
t
[
0
]
=
0xc0
|
(
code
>>
6
);
t
[
0
]
=
0xc0
|
(
(
code
>>
6
)
&
((
1
<<
5
)
-
1
)
);
t
[
1
]
=
0x80
|
(
code
&
((
1
<<
6
)
-
1
));
t
[
1
]
=
0x80
|
(
code
&
((
1
<<
6
)
-
1
));
if
(
VSB_bcat
(
vsb
,
t
,
2
))
if
(
VSB_bcat
(
vsb
,
t
,
2
))
return
(
0
);
return
(
0
);
...
@@ -187,14 +188,14 @@ vsbjunquot(struct vsb *vsb, const char *pa, const char **err)
...
@@ -187,14 +188,14 @@ vsbjunquot(struct vsb *vsb, const char *pa, const char **err)
else
if
(
code
>=
0xd800
&&
code
<=
0xdfff
)
else
if
(
code
>=
0xd800
&&
code
<=
0xdfff
)
return
(
jerr
(
p
,
err
));
return
(
jerr
(
p
,
err
));
else
if
(
code
<
0x10000
)
{
else
if
(
code
<
0x10000
)
{
t
[
0
]
=
0xe0
|
(
code
>>
12
);
t
[
0
]
=
0xe0
|
((
code
>>
12
)
&
((
1
<<
4
)
-
1
)
);
t
[
1
]
=
0x80
|
((
code
>>
6
)
&
((
1
<<
6
)
-
1
));
t
[
1
]
=
0x80
|
((
code
>>
6
)
&
((
1
<<
6
)
-
1
));
t
[
2
]
=
0x80
|
(
code
&
((
1
<<
6
)
-
1
));
t
[
2
]
=
0x80
|
(
code
&
((
1
<<
6
)
-
1
));
if
(
VSB_bcat
(
vsb
,
t
,
3
))
if
(
VSB_bcat
(
vsb
,
t
,
3
))
return
(
0
);
return
(
0
);
}
}
else
if
(
code
<
0x110000
)
{
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
[
1
]
=
0x80
|
((
code
>>
12
)
&
((
1
<<
6
)
-
1
));
t
[
2
]
=
0x80
|
((
code
>>
6
)
&
((
1
<<
6
)
-
1
));
t
[
2
]
=
0x80
|
((
code
>>
6
)
&
((
1
<<
6
)
-
1
));
t
[
3
]
=
0x80
|
(
code
&
((
1
<<
6
)
-
1
));
t
[
3
]
=
0x80
|
(
code
&
((
1
<<
6
)
-
1
));
...
@@ -316,6 +317,7 @@ is_jquot(const char *pa, const char **err)
...
@@ -316,6 +317,7 @@ is_jquot(const char *pa, const char **err)
const
uint8_t
*
p
=
(
uint8_t
*
)
pa
;
const
uint8_t
*
p
=
(
uint8_t
*
)
pa
;
unsigned
u
;
unsigned
u
;
//lint -e{850} // loop variable modified in body
for
(;
*
p
;
p
++
)
{
for
(;
*
p
;
p
++
)
{
if
(
*
p
<
0x20
||
*
p
==
'"'
)
if
(
*
p
<
0x20
||
*
p
==
'"'
)
return
(
jerr
(
p
,
err
));
return
(
jerr
(
p
,
err
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment