Community
Participate
Working Groups
Created attachment 223137 [details] my changes to the json.c file to ignore white space Hi, I found and error in the json.c parsing functions which do not ignore white space before values. I am using the json parsing routines in tcf-c-core/agent/tcf/framework/json.c to parse OCD board files. The board files I formatted using the python -mjson.tool which I also use to verify the JSON syntax. This is very useful to identify syntax errors and simple to use. I simply cat the board file through python using this command. $ cat <board-file> | python -mjson.tool It will produce one of the following outputs 1) stderr: an error message stating invalid or unexpected characters 2) stdout: a nicely formatted JSON text Once I resolved the errors, I simply redirect stdout to a temp file which I then overwirte the original board file. I'm attaching my changes to the json.c file and two examples of boardfiles (one original and one after formatting) thanks, Jerry
Created attachment 223138 [details] original boardfile
Created attachment 223139 [details] board file formatted by python -mjson.tool
Created attachment 223177 [details] git patch of my changes to json.c NOTE: this patch is slightly different from the full source file I originally attached on friday. The only diff is that the patch is using 'isspace()' instead of individual char comparisons in the macro ignore_whitespace().
I have committed the patch. Thanks!
Comment on attachment 223177 [details] git patch of my changes to json.c iplog- since author is in git: http://git.eclipse.org/c/tcf/org.eclipse.tcf.agent.git/commit?id=f2062bef86a3d63d12519325887cfbd8975b0595