From: sparky4 Date: Sun, 22 Mar 2015 20:10:15 +0000 (-0500) Subject: modified: src/lib/jsmn/example/MAPTEST2.EXE X-Git-Url: http://4ch.mooo.com/gitweb/?a=commitdiff_plain;h=1255c7c4c9a6ef6608ac271f71f2d8cbafefe4cf;p=16.git modified: src/lib/jsmn/example/MAPTEST2.EXE modified: src/lib/jsmn/example/maptest2.c --- diff --git a/src/lib/jsmn/example/MAPTEST2.EXE b/src/lib/jsmn/example/MAPTEST2.EXE index 7c9d253b..5773caa3 100644 Binary files a/src/lib/jsmn/example/MAPTEST2.EXE and b/src/lib/jsmn/example/MAPTEST2.EXE differ diff --git a/src/lib/jsmn/example/maptest2.c b/src/lib/jsmn/example/maptest2.c index 41e2544a..cde3f0df 100644 --- a/src/lib/jsmn/example/maptest2.c +++ b/src/lib/jsmn/example/maptest2.c @@ -14,8 +14,10 @@ static int dump(const char *js, jsmntok_t *t, size_t count, int indent) { if (count == 0) { return 0; } + //what the fuck is going on here? if (t->type == JSMN_PRIMITIVE) { printf("%.*s", t->end - t->start, js+t->start); + printf("%s\n", js+t->start); return 1; } else if (t->type == JSMN_STRING) { printf("'%.*s'", t->end - t->start, js+t->start); @@ -45,6 +47,14 @@ static int dump(const char *js, jsmntok_t *t, size_t count, int indent) { return 0; } +static int jsoneq(const char *json, jsmntok_t *tok, const char *s) { + if (tok->type == JSMN_STRING && (int) strlen(s) == tok->end - tok->start && + strncmp(json + tok->start, s, tok->end - tok->start) == 0) { + return 0; + } + return -1; +} + int main() { FILE *fh = fopen("../../../../data/test.map", "r"); int r;