webmcp
changeset 170:c055d6d64586
Bugfix in json.import function to process bytes >= 128 correctly
author | jbe |
---|---|
date | Fri Aug 01 13:09:15 2014 +0200 (2014-08-01) |
parents | 681367a16657 |
children | ce208edffcc9 |
files | libraries/json/json.c |
line diff
1.1 --- a/libraries/json/json.c Fri Aug 01 05:12:21 2014 +0200 1.2 +++ b/libraries/json/json.c Fri Aug 01 13:09:15 2014 +0200 1.3 @@ -145,7 +145,7 @@ 1.4 size_t pos = 0; // current position in string to parse 1.5 size_t level = 0; // nested levels of objects/arrays currently being processed 1.6 int mode = JSON_STATE_VALUE; // state of parser (i.e. "what's expected next?") 1.7 - char c; // variable to store a single character to be processed 1.8 + unsigned char c; // variable to store a single character to be processed (unsigned!) 1.9 luaL_Buffer luabuf; // Lua buffer to decode JSON string values 1.10 char *cbuf; // C buffer to decode JSON string values 1.11 size_t outlen; // maximum length or write position of C buffer 1.12 @@ -175,6 +175,7 @@ 1.13 c == '\t' || 1.14 c == '\v' 1.15 ) pos++; 1.16 + // NOTE: variable c needs to be unsigned in the following code 1.17 // switch statement to handle certain (single) characters: 1.18 switch (c) { 1.19 // handle end of JSON document: