From: sparky4 Date: Sun, 22 Mar 2015 20:42:35 +0000 (-0500) Subject: new file: src/lib/jsmn/example/MAPTEST2.EXE X-Git-Url: http://4ch.mooo.com/gitweb/?a=commitdiff_plain;h=57aa59c0ea066dd3df8321d29871f6c9303ecf49;p=16.git new file: src/lib/jsmn/example/MAPTEST2.EXE modified: src/lib/jsmn/example/jsondump.c new file: src/lib/jsmn/example/maptest2 modified: src/lib/jsmn/example/maptest2.c --- diff --git a/src/lib/jsmn/example/MAPTEST2.EXE b/src/lib/jsmn/example/MAPTEST2.EXE new file mode 100644 index 00000000..55724432 Binary files /dev/null and b/src/lib/jsmn/example/MAPTEST2.EXE differ diff --git a/src/lib/jsmn/example/jsondump.c b/src/lib/jsmn/example/jsondump.c index 04d9f5ae..e0f99858 100644 --- a/src/lib/jsmn/example/jsondump.c +++ b/src/lib/jsmn/example/jsondump.c @@ -50,7 +50,7 @@ int main() { int eof_expected = 0; char *js = NULL; size_t jslen = 0; - char buf[BUFSIZ]; + char buf[BUFSIZ-256]; jsmn_parser p; jsmntok_t *tok; diff --git a/src/lib/jsmn/example/maptest2 b/src/lib/jsmn/example/maptest2 new file mode 100644 index 00000000..4a861d3b Binary files /dev/null and b/src/lib/jsmn/example/maptest2 differ diff --git a/src/lib/jsmn/example/maptest2.c b/src/lib/jsmn/example/maptest2.c index 018078ee..ae663a2f 100644 --- a/src/lib/jsmn/example/maptest2.c +++ b/src/lib/jsmn/example/maptest2.c @@ -13,6 +13,7 @@ "\"groups\": [\"users\", \"wheel\", \"audio\", \"video\"]}";*/ char *JSON_STRING; +char JSON_S[BUFSIZ]; long int filesize(FILE *fp) { @@ -39,15 +40,14 @@ int main() { jsmn_parser p; FILE *fh = fopen("../../../../data/test.map", "r"); jsmntok_t *t; /* We expect no more than 128 tokens */ - size_t tokcount = 2; + size_t tokcount = 2048; /* Allocate some tokens as a start */ t = malloc(sizeof(*t) * tokcount); - char JSON_S[BUFSIZ]; - memset(JSON_S, 0, sizeof(JSON_S)); + //memset(JSON_S, 0, sizeof(JSON_S)); if(fh != NULL) { - fread(JSON_S, sizeof(char), filesize(fh), fh); + fread(JSON_S, 1, filesize(fh), fh); // we can now close the file //printf("]%s[\n", JSON_S); JSON_STRING=JSON_S;