From e542dea54ef194c36d5815bfe18a1b7e0615d02b Mon Sep 17 00:00:00 2001 From: "Serge A. Zaitsev" Date: Mon, 3 Sep 2012 19:54:40 +0300 Subject: [PATCH] changed return value to jsmnerr_t, fixed warning about signed/unsigned values --- jsmn.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/jsmn.c b/jsmn.c index cc300e3..761a604 100644 --- a/jsmn.c +++ b/jsmn.c @@ -31,7 +31,7 @@ static void jsmn_fill_token(jsmntok_t *token, jsmntype_t type, /** * 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 *token; int start; @@ -72,7 +72,7 @@ found: /** * 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 *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, unsigned int num_tokens) { - int r; + jsmnerr_t r; int i; + unsigned int tokindex; jsmntok_t *token; /* initialize the rest of tokens (they could be reallocated) */ - for (i = parser->toknext; i < num_tokens; i++) { - jsmn_fill_token(&tokens[i], JSMN_PRIMITIVE, -1, -1); + for (tokindex = parser->toknext; tokindex < num_tokens; tokindex++) { + jsmn_fill_token(&tokens[tokindex], JSMN_PRIMITIVE, -1, -1); } for (; js[parser->pos] != '\0'; parser->pos++) {