mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-21 22:09:23 +01:00
shared: Update JSMN to latest version
This commit is contained in:
parent
4ffcde8125
commit
ceda955ba7
@ -45,10 +45,10 @@ extern "C" {
|
|||||||
*/
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
JSMN_UNDEFINED = 0,
|
JSMN_UNDEFINED = 0,
|
||||||
JSMN_OBJECT = 1,
|
JSMN_OBJECT = 1 << 0,
|
||||||
JSMN_ARRAY = 2,
|
JSMN_ARRAY = 1 << 1,
|
||||||
JSMN_STRING = 3,
|
JSMN_STRING = 1 << 2,
|
||||||
JSMN_PRIMITIVE = 4
|
JSMN_PRIMITIVE = 1 << 3
|
||||||
} jsmntype_t;
|
} jsmntype_t;
|
||||||
|
|
||||||
enum jsmnerr {
|
enum jsmnerr {
|
||||||
@ -66,7 +66,7 @@ enum jsmnerr {
|
|||||||
* start start position in JSON data string
|
* start start position in JSON data string
|
||||||
* end end position in JSON data string
|
* end end position in JSON data string
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct jsmntok {
|
||||||
jsmntype_t type;
|
jsmntype_t type;
|
||||||
int start;
|
int start;
|
||||||
int end;
|
int end;
|
||||||
@ -80,7 +80,7 @@ typedef struct {
|
|||||||
* JSON parser. Contains an array of token blocks available. Also stores
|
* JSON parser. Contains an array of token blocks available. Also stores
|
||||||
* the string being parsed now and current position in that string.
|
* the string being parsed now and current position in that string.
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct jsmn_parser {
|
||||||
unsigned int pos; /* offset in the JSON string */
|
unsigned int pos; /* offset in the JSON string */
|
||||||
unsigned int toknext; /* next token to allocate */
|
unsigned int toknext; /* next token to allocate */
|
||||||
int toksuper; /* superior token node, e.g. parent object or array */
|
int toksuper; /* superior token node, e.g. parent object or array */
|
||||||
@ -154,6 +154,9 @@ static int jsmn_parse_primitive(jsmn_parser *parser, const char *js,
|
|||||||
case ']':
|
case ']':
|
||||||
case '}':
|
case '}':
|
||||||
goto found;
|
goto found;
|
||||||
|
default:
|
||||||
|
/* to quiet a warning from gcc*/
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if (js[parser->pos] < 32 || js[parser->pos] >= 127) {
|
if (js[parser->pos] < 32 || js[parser->pos] >= 127) {
|
||||||
parser->pos = start;
|
parser->pos = start;
|
||||||
@ -194,9 +197,9 @@ static int jsmn_parse_string(jsmn_parser *parser, const char *js,
|
|||||||
|
|
||||||
int start = parser->pos;
|
int start = parser->pos;
|
||||||
|
|
||||||
|
/* Skip starting quote */
|
||||||
parser->pos++;
|
parser->pos++;
|
||||||
|
|
||||||
/* Skip starting quote */
|
|
||||||
for (; parser->pos < len && js[parser->pos] != '\0'; parser->pos++) {
|
for (; parser->pos < len && js[parser->pos] != '\0'; parser->pos++) {
|
||||||
char c = js[parser->pos];
|
char c = js[parser->pos];
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user