--- libelwix/src/json.c 2017/11/28 11:14:00 1.1.2.6 +++ libelwix/src/json.c 2017/11/28 13:42:22 1.1.2.7 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: json.c,v 1.1.2.6 2017/11/28 11:14:00 misho Exp $ +* $Id: json.c,v 1.1.2.7 2017/11/28 13:42:22 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -428,8 +428,8 @@ json_token2val(const char *jstr, jtok_t * __restrict t if (!v) return NULL; - AIT_SET_STRSIZ(v, tok->tok_end - tok->tok_start); - strncpy(AIT_GET_STR(v), jstr + tok->tok_start, AIT_LEN(v) - 1); + AIT_SET_STRSIZ(v, json_toklen(tok)); + strncpy(AIT_GET_STR(v), json_tokstr(jstr, tok), AIT_LEN(v) - 1); return v; } @@ -450,12 +450,12 @@ json_token2str(const char *jstr, jtok_t * __restrict t if (!jstr || !tok) return NULL; - len = tok->tok_end - tok->tok_start; + len = json_toklen(tok); str = e_malloc(len + 1); if (!str) return NULL; else { - strncpy(str, jstr + tok->tok_start, len); + strncpy(str, json_tokstr(jstr, tok), len); str[len] = 0; }