Skip to content

Commit 3b20633

Browse files
committed
Fix bug in checker
1 parent 8ea6150 commit 3b20633

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ If you want you can compile the library yourself, just use the `makefile` provid
3434

3535
# Changelog
3636

37+
* 1.8.2
38+
* Fix linter bug both in C & C++ version
3739
* 1.8.1
3840
* Fix strdup_s & wcsdup_s bug SEG-faulting on NULL string
3941
* 1.8

c/src/jsonParser.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -752,7 +752,7 @@ static inline void json_inner_checkValue(const char * restrict * restrict it, co
752752
assert(perr != NULL);
753753

754754
bool done = false;
755-
for (;*it != end; ++*it)
755+
for (; *it != end; ++*it)
756756
{
757757
switch (**it)
758758
{
@@ -997,12 +997,16 @@ static inline size_t json_inner_checkValues(const char * restrict * restrict it,
997997
case '\r':
998998
++*it;
999999
break;
1000+
case ']':
1001+
if (vals)
1002+
{
1003+
done = true;
1004+
break;
1005+
}
1006+
/* fall through */
10001007
case '}':
10011008
*perr = jsonErr_invalidTerminator;
10021009
break;
1003-
case ']':
1004-
done = true;
1005-
break;
10061010
default:
10071011
json_inner_checkValue(it, end, perr);
10081012
++vals;

cpp/include/jsonlite2.hpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1191,12 +1191,16 @@ namespace jsonlite2
11911191
case '\r':
11921192
++it;
11931193
break;
1194+
case ']':
1195+
if (vals)
1196+
{
1197+
done = true;
1198+
break;
1199+
}
1200+
/* fall through */
11941201
case '}':
11951202
err = error::invalidTerminator;
11961203
break;
1197-
case ']':
1198-
done = true;
1199-
break;
12001204
default:
12011205
json::p_checkValue(it, end, err);
12021206
++vals;

0 commit comments

Comments
 (0)