changed return value to jsmnerr_t, fixed warning about signed/unsigned values

master
Serge A. Zaitsev 12 years ago
parent af04595fe2
commit e542dea54e

@ -31,7 +31,7 @@ static void jsmn_fill_token(jsmntok_t *token, jsmntype_t type,
/** /**
* Fills next available token with JSON primitive. * Fills next available token with JSON primitive.
*/ */
static int jsmn_parse_primitive(jsmn_parser *parser, const char *js, static jsmnerr_t jsmn_parse_primitive(jsmn_parser *parser, const char *js,
jsmntok_t *tokens, size_t num_tokens) { jsmntok_t *tokens, size_t num_tokens) {
jsmntok_t *token; jsmntok_t *token;
int start; int start;
@ -72,7 +72,7 @@ found:
/** /**
* Filsl next token with JSON string. * Filsl next token with JSON string.
*/ */
static int jsmn_parse_string(jsmn_parser *parser, const char *js, static jsmnerr_t jsmn_parse_string(jsmn_parser *parser, const char *js,
jsmntok_t *tokens, size_t num_tokens) { jsmntok_t *tokens, size_t num_tokens) {
jsmntok_t *token; jsmntok_t *token;
@ -123,13 +123,14 @@ static int jsmn_parse_string(jsmn_parser *parser, const char *js,
*/ */
jsmnerr_t jsmn_parse(jsmn_parser *parser, const char *js, jsmntok_t *tokens, jsmnerr_t jsmn_parse(jsmn_parser *parser, const char *js, jsmntok_t *tokens,
unsigned int num_tokens) { unsigned int num_tokens) {
int r; jsmnerr_t r;
int i; int i;
unsigned int tokindex;
jsmntok_t *token; jsmntok_t *token;
/* initialize the rest of tokens (they could be reallocated) */ /* initialize the rest of tokens (they could be reallocated) */
for (i = parser->toknext; i < num_tokens; i++) { for (tokindex = parser->toknext; tokindex < num_tokens; tokindex++) {
jsmn_fill_token(&tokens[i], JSMN_PRIMITIVE, -1, -1); jsmn_fill_token(&tokens[tokindex], JSMN_PRIMITIVE, -1, -1);
} }
for (; js[parser->pos] != '\0'; parser->pos++) { for (; js[parser->pos] != '\0'; parser->pos++) {

Loading…
Cancel
Save