line |
true |
false |
branch |
127
|
32959 |
67 |
for (ii = 0; ii < jsn->levels_max; ii++) { |
135
|
26 |
0 |
if (jsn) { |
227
|
7533 |
43 |
for (; nbytes; nbytes--, jsn->pos++, c++) { |
231
|
13 |
7520 |
if (jsn->in_escape) { |
233
|
0 |
13 |
if (!is_allowed_escape(CUR_CHAR)) { |
234
|
0 |
0 |
INVOKE_ERROR(ESCAPE_INVALID); |
235
|
4 |
9 |
} else if (CUR_CHAR == 'u') { |
236
|
0 |
4 |
DO_CALLBACK(UESCAPE, UESCAPE); |
|
0 |
0 |
DO_CALLBACK(UESCAPE, UESCAPE); |
|
0 |
0 |
DO_CALLBACK(UESCAPE, UESCAPE); |
|
0 |
0 |
DO_CALLBACK(UESCAPE, UESCAPE); |
|
0 |
0 |
DO_CALLBACK(UESCAPE, UESCAPE); |
|
0 |
0 |
DO_CALLBACK(UESCAPE, UESCAPE); |
237
|
0 |
4 |
if (jsn->return_UESCAPE) { |
248
|
1633 |
5887 |
if (state_type & JSONSL_Tf_STRINGY) { |
252
|
506 |
1127 |
if ( |
259
|
1113 |
14 |
} else if (CUR_CHAR == '"') { |
261
|
13 |
1 |
} else if (CUR_CHAR == '\\') { |
264
|
0 |
0 |
INVOKE_ERROR(WEIRD_WHITESPACE); |
268
|
137 |
5750 |
} else if (state_type == JSONSL_T_SPECIAL) { |
270
|
113 |
24 |
if (IS_NORMAL_NUMBER) { |
|
7 |
106 |
if (IS_NORMAL_NUMBER) { |
271
|
7 |
24 |
if (isdigit(CUR_CHAR)) { |
278
|
7 |
99 |
} else if (state->special_flags == JSONSL_SPECIALf_DASH) { |
279
|
1 |
6 |
if (!isdigit(CUR_CHAR)) { |
280
|
0 |
0 |
INVOKE_ERROR(INVALID_NUMBER); |
283
|
2 |
4 |
if (CUR_CHAR == '0') { |
285
|
4 |
0 |
} else if (isdigit(CUR_CHAR)) { |
289
|
0 |
0 |
INVOKE_ERROR(INVALID_NUMBER); |
294
|
7 |
92 |
} else if (state->special_flags == JSONSL_SPECIALf_ZERO) { |
295
|
2 |
5 |
if (isdigit(CUR_CHAR)) { |
297
|
0 |
0 |
INVOKE_ERROR(INVALID_NUMBER); |
300
|
0 |
5 |
if (state->special_flags & JSONSL_SPECIALf_SIGNED) { |
308
|
61 |
31 |
if (state->special_flags & JSONSL_SPECIALf_NUMERIC) { |
316
|
0 |
9 |
if (state->special_flags & JSONSL_SPECIALf_FLOAT) { |
317
|
0 |
0 |
INVOKE_ERROR(INVALID_NUMBER); |
325
|
0 |
9 |
if (state->special_flags & JSONSL_SPECIALf_EXPONENT) { |
326
|
0 |
0 |
INVOKE_ERROR(INVALID_NUMBER); |
334
|
0 |
4 |
if (STATE_NUM_LAST != 'e') { |
335
|
0 |
0 |
INVOKE_ERROR(INVALID_NUMBER); |
341
|
31 |
0 |
if (is_special_end(CUR_CHAR)) { |
344
|
0 |
0 |
INVOKE_ERROR(INVALID_NUMBER); |
349
|
24 |
7 |
if (!is_special_end(CUR_CHAR)) { |
353
|
6 |
18 |
if (state->special_flags == JSONSL_SPECIALf_TRUE) { |
354
|
0 |
6 |
VERIFY_SPECIAL("true"); |
|
0 |
0 |
VERIFY_SPECIAL("true"); |
355
|
8 |
10 |
} else if (state->special_flags == JSONSL_SPECIALf_FALSE) { |
356
|
0 |
8 |
VERIFY_SPECIAL("false"); |
|
0 |
0 |
VERIFY_SPECIAL("false"); |
357
|
10 |
0 |
} else if (state->special_flags == JSONSL_SPECIALf_NULL) { |
358
|
1 |
9 |
VERIFY_SPECIAL("null"); |
|
0 |
0 |
VERIFY_SPECIAL("null"); |
365
|
23 |
15 |
if (IS_NORMAL_NUMBER) { |
|
21 |
2 |
if (IS_NORMAL_NUMBER) { |
367
|
21 |
0 |
} else if (state->special_flags == JSONSL_SPECIALf_ZERO || |
|
0 |
21 |
} else if (state->special_flags == JSONSL_SPECIALf_ZERO || |
371
|
0 |
21 |
} else if (state->special_flags == JSONSL_SPECIALf_DASH) { |
373
|
0 |
0 |
INVOKE_ERROR(INVALID_NUMBER); |
374
|
14 |
7 |
} else if (state->special_flags & JSONSL_SPECIALf_NUMERIC) { |
376
|
2 |
12 |
if (STATE_NUM_LAST != '1') { |
377
|
0 |
0 |
INVOKE_ERROR(INVALID_NUMBER); |
379
|
2 |
5 |
} else if (state->special_flags == JSONSL_SPECIALf_TRUE) { |
380
|
0 |
2 |
if (STATE_SPECIAL_LENGTH != 4) { |
381
|
0 |
0 |
INVOKE_ERROR(SPECIAL_INCOMPLETE); |
384
|
2 |
3 |
} else if (state->special_flags == JSONSL_SPECIALf_FALSE) { |
385
|
0 |
2 |
if (STATE_SPECIAL_LENGTH != 5) { |
386
|
0 |
0 |
INVOKE_ERROR(SPECIAL_INCOMPLETE); |
388
|
3 |
0 |
} else if (state->special_flags == JSONSL_SPECIALf_NULL) { |
389
|
0 |
3 |
if (STATE_SPECIAL_LENGTH != 4) { |
390
|
0 |
0 |
INVOKE_ERROR(SPECIAL_INCOMPLETE); |
393
|
36 |
0 |
SPECIAL_POP; |
|
36 |
0 |
SPECIAL_POP; |
|
36 |
0 |
SPECIAL_POP; |
|
36 |
0 |
SPECIAL_POP; |
|
0 |
0 |
SPECIAL_POP; |
|
0 |
36 |
SPECIAL_POP; |
395
|
2 |
34 |
if (is_allowed_whitespace(CUR_CHAR)) { |
406
|
247 |
5503 |
} else if (is_allowed_whitespace(CUR_CHAR)) { |
412
|
42 |
5461 |
} else if (extract_special(CUR_CHAR)) { |
419
|
1116 |
4345 |
if (CUR_CHAR == '"') { |
426
|
31 |
0 |
CALLBACK_AND_POP(STRING); |
|
31 |
0 |
CALLBACK_AND_POP(STRING); |
|
31 |
0 |
CALLBACK_AND_POP(STRING); |
|
31 |
0 |
CALLBACK_AND_POP(STRING); |
|
0 |
0 |
CALLBACK_AND_POP(STRING); |
|
0 |
31 |
CALLBACK_AND_POP(STRING); |
429
|
1082 |
0 |
CALLBACK_AND_POP(HKEY); |
|
1082 |
0 |
CALLBACK_AND_POP(HKEY); |
|
1082 |
0 |
CALLBACK_AND_POP(HKEY); |
|
1082 |
0 |
CALLBACK_AND_POP(HKEY); |
|
0 |
0 |
CALLBACK_AND_POP(HKEY); |
|
0 |
1082 |
CALLBACK_AND_POP(HKEY); |
434
|
24 |
1083 |
if ( (state->nelem-1) % 2 ) { |
436
|
0 |
24 |
if (jsn->tok_last != ':') { |
437
|
0 |
0 |
INVOKE_ERROR(MISSING_TOKEN); |
442
|
0 |
24 |
STACK_PUSH; |
444
|
24 |
0 |
DO_CALLBACK(STRING, PUSH); |
|
24 |
0 |
DO_CALLBACK(STRING, PUSH); |
|
24 |
0 |
DO_CALLBACK(STRING, PUSH); |
|
24 |
0 |
DO_CALLBACK(STRING, PUSH); |
|
0 |
0 |
DO_CALLBACK(STRING, PUSH); |
|
0 |
24 |
DO_CALLBACK(STRING, PUSH); |
448
|
0 |
1083 |
if (jsn->expecting != '"') { |
449
|
0 |
0 |
INVOKE_ERROR(STRAY_TOKEN); |
454
|
1 |
1082 |
STACK_PUSH; |
456
|
1082 |
0 |
DO_CALLBACK(HKEY, PUSH); |
|
1082 |
0 |
DO_CALLBACK(HKEY, PUSH); |
|
1082 |
0 |
DO_CALLBACK(HKEY, PUSH); |
|
1082 |
0 |
DO_CALLBACK(HKEY, PUSH); |
|
0 |
0 |
DO_CALLBACK(HKEY, PUSH); |
|
0 |
1082 |
DO_CALLBACK(HKEY, PUSH); |
462
|
0 |
9 |
STACK_PUSH; |
466
|
9 |
0 |
DO_CALLBACK(STRING, PUSH); |
|
9 |
0 |
DO_CALLBACK(STRING, PUSH); |
|
9 |
0 |
DO_CALLBACK(STRING, PUSH); |
|
9 |
0 |
DO_CALLBACK(STRING, PUSH); |
|
0 |
0 |
DO_CALLBACK(STRING, PUSH); |
|
0 |
9 |
DO_CALLBACK(STRING, PUSH); |
470
|
0 |
0 |
INVOKE_ERROR(STRAY_TOKEN); |
474
|
0 |
0 |
INVOKE_ERROR(STRING_OUTSIDE_CONTAINER); |
477
|
0 |
4345 |
} else if (CUR_CHAR == '\\') { |
481
|
0 |
13 |
if ( (state->type & JSONSL_Tf_STRINGY) == 0 ) { |
482
|
0 |
0 |
INVOKE_ERROR(ESCAPE_OUTSIDE_STRING); |
493
|
0 |
1082 |
if (jsn->expecting != CUR_CHAR) { |
494
|
0 |
0 |
INVOKE_ERROR(STRAY_TOKEN); |
509
|
0 |
29 |
if (jsn->expecting != CUR_CHAR) { |
513
|
0 |
0 |
INVOKE_ERROR(STRAY_TOKEN); |
516
|
17 |
12 |
if (state->type == JSONSL_T_OBJECT) { |
532
|
0 |
2152 |
if (!jsn->can_insert) { |
533
|
0 |
0 |
INVOKE_ERROR(CANT_INSERT); |
536
|
1117 |
1035 |
ENSURE_HVAL; |
|
0 |
1117 |
ENSURE_HVAL; |
|
0 |
0 |
ENSURE_HVAL; |
539
|
1 |
2151 |
STACK_PUSH; |
544
|
1066 |
1085 |
if (CUR_CHAR == '{') { |
548
|
1066 |
1085 |
if (CUR_CHAR == JSONSL_T_OBJECT) { |
549
|
1066 |
0 |
DO_CALLBACK(OBJECT, PUSH); |
|
1066 |
0 |
DO_CALLBACK(OBJECT, PUSH); |
|
1066 |
0 |
DO_CALLBACK(OBJECT, PUSH); |
|
1051 |
15 |
DO_CALLBACK(OBJECT, PUSH); |
|
15 |
0 |
DO_CALLBACK(OBJECT, PUSH); |
|
0 |
1066 |
DO_CALLBACK(OBJECT, PUSH); |
551
|
1085 |
0 |
DO_CALLBACK(LIST, PUSH); |
|
1085 |
0 |
DO_CALLBACK(LIST, PUSH); |
|
1085 |
0 |
DO_CALLBACK(LIST, PUSH); |
|
1078 |
7 |
DO_CALLBACK(LIST, PUSH); |
|
7 |
0 |
DO_CALLBACK(LIST, PUSH); |
|
0 |
1085 |
DO_CALLBACK(LIST, PUSH); |
560
|
0 |
1111 |
if (jsn->tok_last == ',' && jsn->options.allow_trailing_comma == 0) { |
|
0 |
0 |
if (jsn->tok_last == ',' && jsn->options.allow_trailing_comma == 0) { |
561
|
0 |
0 |
INVOKE_ERROR(TRAILING_COMMA); |
568
|
572 |
539 |
if (CUR_CHAR == ']') { |
569
|
0 |
572 |
if (state->type != '[') { |
570
|
0 |
0 |
INVOKE_ERROR(BRACKET_MISMATCH); |
572
|
572 |
0 |
DO_CALLBACK(LIST, POP); |
|
572 |
0 |
DO_CALLBACK(LIST, POP); |
|
572 |
0 |
DO_CALLBACK(LIST, POP); |
|
572 |
0 |
DO_CALLBACK(LIST, POP); |
|
0 |
0 |
DO_CALLBACK(LIST, POP); |
|
0 |
572 |
DO_CALLBACK(LIST, POP); |
574
|
0 |
539 |
if (state->type != '{') { |
575
|
0 |
0 |
INVOKE_ERROR(BRACKET_MISMATCH); |
576
|
539 |
0 |
} else if (state->nelem && state->nelem % 2 != 0) { |
|
0 |
539 |
} else if (state->nelem && state->nelem % 2 != 0) { |
577
|
0 |
0 |
INVOKE_ERROR(VALUE_EXPECTED); |
579
|
539 |
0 |
DO_CALLBACK(OBJECT, POP); |
|
539 |
0 |
DO_CALLBACK(OBJECT, POP); |
|
539 |
0 |
DO_CALLBACK(OBJECT, POP); |
|
539 |
0 |
DO_CALLBACK(OBJECT, POP); |
|
0 |
0 |
DO_CALLBACK(OBJECT, POP); |
|
0 |
539 |
DO_CALLBACK(OBJECT, POP); |
593
|
47 |
0 |
if (state->type != JSONSL_T_SPECIAL) { |
595
|
5 |
42 |
if (!special_flags) { |
600
|
0 |
5 |
if (CUR_CHAR == '\0') { |
601
|
0 |
0 |
INVOKE_ERROR(FOUND_NULL_BYTE); |
602
|
1 |
4 |
} else if (CUR_CHAR < 0x20) { |
603
|
0 |
0 |
INVOKE_ERROR(WEIRD_WHITESPACE); |
605
|
0 |
0 |
INVOKE_ERROR(SPECIAL_EXPECTED); |
608
|
18 |
24 |
ENSURE_HVAL; |
|
0 |
18 |
ENSURE_HVAL; |
|
0 |
0 |
ENSURE_HVAL; |
610
|
0 |
42 |
if (!jsn->can_insert) { |
611
|
0 |
0 |
INVOKE_ERROR(CANT_INSERT); |
613
|
0 |
42 |
STACK_PUSH; |
618
|
20 |
22 |
if (special_flags == JSONSL_SPECIALf_UNSIGNED) { |
625
|
42 |
0 |
DO_CALLBACK(SPECIAL, PUSH); |
|
42 |
0 |
DO_CALLBACK(SPECIAL, PUSH); |
|
42 |
0 |
DO_CALLBACK(SPECIAL, PUSH); |
|
42 |
0 |
DO_CALLBACK(SPECIAL, PUSH); |
|
0 |
0 |
DO_CALLBACK(SPECIAL, PUSH); |
|
0 |
42 |
DO_CALLBACK(SPECIAL, PUSH); |
638
|
0 |
15 |
if (err == JSONSL_ERROR_SUCCESS) { |
644
|
0 |
15 |
JSONSL_XERR; |
|
5 |
10 |
JSONSL_XERR; |
|
0 |
10 |
JSONSL_XERR; |
|
0 |
10 |
JSONSL_XERR; |
|
0 |
10 |
JSONSL_XERR; |
|
0 |
10 |
JSONSL_XERR; |
|
0 |
10 |
JSONSL_XERR; |
|
0 |
10 |
JSONSL_XERR; |
|
0 |
10 |
JSONSL_XERR; |
|
0 |
10 |
JSONSL_XERR; |
|
2 |
8 |
JSONSL_XERR; |
|
0 |
8 |
JSONSL_XERR; |
|
0 |
8 |
JSONSL_XERR; |
|
2 |
6 |
JSONSL_XERR; |
|
0 |
6 |
JSONSL_XERR; |
|
1 |
5 |
JSONSL_XERR; |
|
0 |
5 |
JSONSL_XERR; |
|
5 |
0 |
JSONSL_XERR; |
|
0 |
0 |
JSONSL_XERR; |
|
0 |
0 |
JSONSL_XERR; |
|
0 |
0 |
JSONSL_XERR; |
|
0 |
0 |
JSONSL_XERR; |
|
0 |
0 |
JSONSL_XERR; |
|
0 |
0 |
JSONSL_XERR; |
655
|
0 |
0 |
JSONSL_XTYPE |
|
0 |
0 |
JSONSL_XTYPE |
|
0 |
0 |
JSONSL_XTYPE |
|
0 |
0 |
JSONSL_XTYPE |
|
0 |
0 |
JSONSL_XTYPE |
|
0 |
0 |
JSONSL_XTYPE |
680
|
5 |
0 |
if (*next == NULL || *(*next) == '\0') { |
|
0 |
5 |
if (*next == NULL || *(*next) == '\0') { |
686
|
1 |
4 |
if (*next != NULL) { |
699
|
4 |
1 |
if (*in == JSONSL_PATH_WILDCARD_CHAR && input_len == 1) { |
|
4 |
0 |
if (*in == JSONSL_PATH_WILDCARD_CHAR && input_len == 1) { |
703
|
0 |
1 |
} else if (isdigit(*in)) { |
707
|
0 |
0 |
if (endptr && *endptr == '\0') { |
|
0 |
0 |
if (endptr && *endptr == '\0') { |
715
|
8 |
1 |
for (c = outp = in; c < end; c++, outp++) { |
717
|
8 |
0 |
if (*c != '%') { |
725
|
0 |
0 |
if (c+2 >= end) { |
729
|
0 |
0 |
if (! (isxdigit(*(c+1)) && isxdigit(*(c+2))) ) { |
|
0 |
0 |
if (! (isxdigit(*(c+1)) && isxdigit(*(c+2))) ) { |
748
|
0 |
1 |
for (; outp < c; outp++) { |
754
|
1 |
4 |
if (ret != JSONSL_PATH_WILDCARD) { |
773
|
0 |
4 |
if (errp == NULL) { |
777
|
4 |
0 |
if (path == NULL || *path != '/') { |
|
0 |
4 |
if (path == NULL || *path != '/') { |
786
|
12 |
4 |
for (; *c; c++) { |
787
|
1 |
11 |
if (*c == '/') { |
789
|
0 |
1 |
if (*(c+1) == '/') { |
795
|
4 |
0 |
if(*path) { |
801
|
0 |
4 |
if (!components) { |
806
|
0 |
4 |
if (!my_copy) { |
814
|
4 |
0 |
if (*my_copy) { |
818
|
9 |
0 |
while (pathret > 0 && curidx < count) { |
|
5 |
4 |
while (pathret > 0 && curidx < count) { |
820
|
5 |
0 |
if (pathret > 0) { |
827
|
0 |
4 |
if (pathret == JSONSL_PATH_INVALID) { |
837
|
0 |
4 |
if (!ret) { |
841
|
0 |
4 |
if (!ret->orig) { |
855
|
0 |
0 |
if (ret) { |
884
|
0 |
18 |
if (parent_level >= jpr->ncomponents) { |
889
|
6 |
12 |
if (parent_level == 0) { |
890
|
0 |
6 |
if (jpr->ncomponents == 1) { |
898
|
9 |
3 |
if (p_component->ptype == JSONSL_PATH_WILDCARD) { |
899
|
6 |
3 |
if (parent_level == jpr->ncomponents-1) { |
908
|
0 |
3 |
if (p_component->ptype == JSONSL_PATH_NUMERIC) { |
909
|
0 |
0 |
if (parent_type == JSONSL_T_LIST) { |
910
|
0 |
0 |
if (p_component->idx != nkey) { |
914
|
0 |
0 |
if (parent_level == jpr->ncomponents-1) { |
922
|
0 |
0 |
} else if (p_component->is_arridx) { |
927
|
0 |
3 |
} else if (parent_type == JSONSL_T_LIST) { |
932
|
1 |
2 |
if (p_component->len != nkey) { |
938
|
2 |
0 |
if (cmpret == 0) { |
939
|
2 |
0 |
if (parent_level == jpr->ncomponents-1) { |
955
|
0 |
4 |
if (njprs == 0) { |
965
|
4 |
4 |
for (ii = 0; ii < njprs; ii++) { |
973
|
20 |
4 |
if (jsn->jpr_count == 0) { |
1011
|
54 |
18 |
if (!jsn->jpr_root) { |
1020
|
0 |
18 |
if (*pjmptable == 0) { |
1028
|
5 |
13 |
if (parent_state->type == JSONSL_T_LIST) { |
1036
|
18 |
10 |
for (ii = 0; ii < jsn->jpr_count; ii++) { |
1038
|
18 |
0 |
if (jmp_cur) { |
1044
|
8 |
10 |
if (*out == JSONSL_MATCH_COMPLETE) { |
1048
|
9 |
1 |
} else if (*out == JSONSL_MATCH_POSSIBLE) { |
1056
|
1 |
9 |
if (!*jmptable) { |
1068
|
0 |
0 |
JSONSL_XMATCH |
|
0 |
0 |
JSONSL_XMATCH |
|
0 |
0 |
JSONSL_XMATCH |
|
0 |
0 |
JSONSL_XMATCH |
1092
|
14 |
0 |
if (oflags) { |
1102
|
93 |
13 |
for (; len; len--, c++, out++) { |
1104
|
2 |
91 |
if (in_escape) { |
1110
|
75 |
16 |
if (*c != '\\') { |
1115
|
0 |
16 |
if (len < 2) { |
1116
|
0 |
0 |
UNESCAPE_BAIL(ESCAPE_INVALID, 0); |
1118
|
1 |
15 |
if (!is_allowed_escape(c[1])) { |
1119
|
1 |
0 |
UNESCAPE_BAIL(ESCAPE_INVALID, 1) |
1121
|
2 |
13 |
if ((toEscape[(unsigned char)c[1] & 0x7f] == 0 && |
|
2 |
0 |
if ((toEscape[(unsigned char)c[1] & 0x7f] == 0 && |
1122
|
2 |
0 |
c[1] != '\\' && c[1] != '"')) { |
1130
|
7 |
6 |
if (c[1] != 'u') { |
1136
|
5 |
2 |
if (esctmp) { |
1151
|
0 |
6 |
if (len < 6) { |
1155
|
0 |
0 |
UNESCAPE_BAIL(UESCAPE_TOOSHORT, -1); |
1158
|
0 |
6 |
if (sscanf((const char*)(c+2), "%02x%02x", uesc_val, uesc_val+1) != 2) { |
1160
|
0 |
0 |
UNESCAPE_BAIL(UESCAPE_TOOSHORT, -1); |
1171
|
5 |
1 |
if (uesc_val[0] == 0) { |
1176
|
5 |
0 |
if (oflags && *(unsigned char*)out > 0x7f) { |
|
0 |
5 |
if (oflags && *(unsigned char*)out > 0x7f) { |
1183
|
1 |
0 |
if (oflags && (uesc_val[0] > 0x7f || uesc_val[1] > 0x7f)) { |
|
0 |
1 |
if (oflags && (uesc_val[0] > 0x7f || uesc_val[1] > 0x7f)) { |
|
0 |
0 |
if (oflags && (uesc_val[0] > 0x7f || uesc_val[1] > 0x7f)) { |
1353
|
5570 |
216 |
return c == ' ' || Allowed_Whitespace[c & 0xff]; |
|
33 |
5537 |
return c == ' ' || Allowed_Whitespace[c & 0xff]; |