MCPcopy Create free account
hub / github.com/axmolengine/axmol / jsonUnescape

Function jsonUnescape

core/ui/UIWebView/UIWebViewCommon.h:45–106  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43}
44
45inline int jsonUnescape(const char* s, size_t n, char* out)
46{
47 int r = 0;
48 if (*s++ != '"')
49 {
50 return -1;
51 }
52 while (n > 2)
53 {
54 char c = *s;
55 if (c == '\\')
56 {
57 s++;
58 n--;
59 switch (*s)
60 {
61 case 'b':
62 c = '\b';
63 break;
64 case 'f':
65 c = '\f';
66 break;
67 case 'n':
68 c = '\n';
69 break;
70 case 'r':
71 c = '\r';
72 break;
73 case 't':
74 c = '\t';
75 break;
76 case '\\':
77 c = '\\';
78 break;
79 case '/':
80 c = '/';
81 break;
82 case '\"':
83 c = '\"';
84 break;
85 default: // TODO: support unicode decoding
86 return -1;
87 }
88 }
89 if (out != NULL)
90 {
91 *out++ = c;
92 }
93 s++;
94 n--;
95 r++;
96 }
97 if (*s != '"')
98 {
99 return -1;
100 }
101 if (out != NULL)
102 {

Callers 1

jsonParseFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected