]> 4ch.mooo.com Git - 16.git/commitdiff
new file: src/lib/jsmn/example/MAPTEST2.EXE
authorsparky4 <sparky4@cock.li>
Sun, 22 Mar 2015 20:42:35 +0000 (15:42 -0500)
committersparky4 <sparky4@cock.li>
Sun, 22 Mar 2015 20:42:35 +0000 (15:42 -0500)
modified:   src/lib/jsmn/example/jsondump.c
new file:   src/lib/jsmn/example/maptest2
modified:   src/lib/jsmn/example/maptest2.c

src/lib/jsmn/example/MAPTEST2.EXE [new file with mode: 0644]
src/lib/jsmn/example/jsondump.c
src/lib/jsmn/example/maptest2 [new file with mode: 0644]
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 (file)
index 0000000..5572443
Binary files /dev/null and b/src/lib/jsmn/example/MAPTEST2.EXE differ
index 04d9f5aea28bff16fca984c9c43d366ec4e73d53..e0f998589c08bab88cf3f6fb474cec3fa23a5756 100644 (file)
@@ -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 (file)
index 0000000..4a861d3
Binary files /dev/null and b/src/lib/jsmn/example/maptest2 differ
index 018078eef7e298e3ea23bd588b13ee32a8498473..ae663a2fad9c308484e04de583b7700749b0fd0b 100644 (file)
@@ -13,6 +13,7 @@
        "\"groups\": [\"users\", \"wheel\", \"audio\", \"video\"]}";*/
 
 char *JSON_STRING;
+char JSON_S[BUFSIZ];
 
 long int filesize(FILE *fp)\r
 {\r
@@ -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;