# HG changeset patch # User jbe # Date 1406891355 -7200 # Node ID c055d6d6458656139e572827bdf3166d679de37a # Parent 681367a16657f9492ea43466dab1c8cf1f105054 Bugfix in json.import function to process bytes >= 128 correctly diff -r 681367a16657 -r c055d6d64586 libraries/json/json.c --- a/libraries/json/json.c Fri Aug 01 05:12:21 2014 +0200 +++ b/libraries/json/json.c Fri Aug 01 13:09:15 2014 +0200 @@ -145,7 +145,7 @@ size_t pos = 0; // current position in string to parse size_t level = 0; // nested levels of objects/arrays currently being processed int mode = JSON_STATE_VALUE; // state of parser (i.e. "what's expected next?") - char c; // variable to store a single character to be processed + unsigned char c; // variable to store a single character to be processed (unsigned!) luaL_Buffer luabuf; // Lua buffer to decode JSON string values char *cbuf; // C buffer to decode JSON string values size_t outlen; // maximum length or write position of C buffer @@ -175,6 +175,7 @@ c == '\t' || c == '\v' ) pos++; + // NOTE: variable c needs to be unsigned in the following code // switch statement to handle certain (single) characters: switch (c) { // handle end of JSON document: