From: Mark Young Date: Tue, 14 Jun 2016 20:59:44 +0000 (-0600) Subject: loader: GH362 - Fix json output of escape chars X-Git-Tag: upstream/1.1.92~3040^2~9 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=db8517fa8168419bc3a410b499b108a920b82e65;p=platform%2Fupstream%2FVulkan-Tools.git loader: GH362 - Fix json output of escape chars The strings from the JSON file already add escape characters. So, \ becomes \\ in the JSON file strings. However, the cJSON library was adding \\ for ever encountered \ when converting to a string. This became messy as C:\\vulkanSDK\\layerfile.json became C:\\\\vulkanSDK\\\\layerfile.json. Change-Id: I006252e33d6e91e2bef704dd5dee0777105388a7 --- diff --git a/loader/cJSON.c b/loader/cJSON.c index f28eadb..fc3ba04 100644 --- a/loader/cJSON.c +++ b/loader/cJSON.c @@ -423,7 +423,6 @@ static char *print_string_ptr(const char *str, printbuffer *p) { if ((unsigned char)*ptr > 31 && *ptr != '\"' && *ptr != '\\') *ptr2++ = *ptr++; else { - *ptr2++ = '\\'; switch (token = *ptr++) { case '\\': *ptr2++ = '\\'; @@ -432,19 +431,19 @@ static char *print_string_ptr(const char *str, printbuffer *p) { *ptr2++ = '\"'; break; case '\b': - *ptr2++ = 'b'; + *ptr2++ = '\b'; break; case '\f': - *ptr2++ = 'f'; + *ptr2++ = '\f'; break; case '\n': - *ptr2++ = 'n'; + *ptr2++ = '\n'; break; case '\r': - *ptr2++ = 'r'; + *ptr2++ = '\r'; break; case '\t': - *ptr2++ = 't'; + *ptr2++ = '\t'; break; default: sprintf(ptr2, "u%04x", token);