From: sparky4 Date: Sun, 22 Mar 2015 23:55:52 +0000 (-0500) Subject: fucking shit! X-Git-Url: http://4ch.mooo.com/gitweb/?a=commitdiff_plain;h=538ffe16c49ea9e3a79f413c4259a38ddb5ddaf1;p=16.git fucking shit! modified: src/lib/jsmn/example/MAPTEST.EXE modified: src/lib/jsmn/example/maptest.c --- diff --git a/src/lib/jsmn/example/MAPTEST.EXE b/src/lib/jsmn/example/MAPTEST.EXE index a9a86352..b9a3eb59 100644 Binary files a/src/lib/jsmn/example/MAPTEST.EXE and b/src/lib/jsmn/example/MAPTEST.EXE differ diff --git a/src/lib/jsmn/example/maptest.c b/src/lib/jsmn/example/maptest.c index 2fdf04e0..7c305bff 100644 --- a/src/lib/jsmn/example/maptest.c +++ b/src/lib/jsmn/example/maptest.c @@ -39,13 +39,13 @@ int main() { jsmn_parser p; jsmntok_t t[2048]; /* We expect no more than 128 tokens */ FILE *fh = fopen("../../../../data/test.map", "r"); - char *json_string = malloc(filesize(fh)); //memset(json_string, 0, sizeof(*json_string)); if(fh != NULL) { z = fread(json_string, 1, filesize(fh), fh); + fclose(fh); fh = NULL; printf("[[%d]]\n", z); json_string[z] = '\0'; // we can now close the file @@ -54,10 +54,8 @@ int main() { //printf("[[%s]]\n", json_string); jsmn_init(&p); + r = jsmn_parse(&p, json_string, z, t, sizeof(t)/sizeof(t[0])); printf("[\n%s\n]", json_string); - r = jsmn_parse(&p, json_string, filesize(fh), t, sizeof(t)/sizeof(t[0])); - fclose(fh); fh = NULL; - //printf("[\n%s\n]", json_string); if (r < 0) { printf("Failed to parse JSON: %d\n", r); return 1;