MCPcopy Create free account
hub / github.com/acl-dev/acl / markup_unescape

Function markup_unescape

lib_acl/src/code/acl_xmlcode.c:126–155  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

124static acl_pthread_once_t __token_once = ACL_PTHREAD_ONCE_INIT;
125
126static const char* markup_unescape(const char* in, ACL_VSTRING* out)
127{
128 unsigned int n;
129 char temp[2], buf[7];
130
131 while (*in != 0) {
132 if (*in == '&' && *(in + 1) == '#'
133 && (sscanf(in, "&#%u%1[;]", &n, temp) == 2
134 || sscanf(in, "&#x%x%1[;]", &n, temp) == 2)
135 && n != 0)
136 {
137 int buflen = uni2utf8(n, buf, sizeof(buf));
138
139 buf[buflen] = '\0';
140 acl_vstring_strcat(out, buf);
141
142 n = *(in + 2) == 'x' ? 3 : 2;
143 while (isxdigit((int) in[n]))
144 n++;
145 if(in[n] == ';')
146 n++;
147 in += n;
148 } else {
149 ACL_VSTRING_ADDCH(out, (unsigned char) (*in));
150 in++;
151 }
152 }
153
154 return in;
155}
156
157int acl_xml_decode(const char *in, ACL_VSTRING *out)
158{

Callers 1

acl_xml_decodeFunction · 0.70

Calls 2

uni2utf8Function · 0.85
acl_vstring_strcatFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…