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

Function markup_unescape

lib_acl/src/code/acl_htmlcode.c:84–113  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

82static acl_pthread_once_t __decode_token_once = ACL_PTHREAD_ONCE_INIT;
83
84static const char* markup_unescape(const char* in, ACL_VSTRING* out)
85{
86 unsigned int n;
87 char temp[2], buf[7];
88
89 while (*in != 0) {
90 if (*in == '&' && *(in + 1) == '#'
91 && (sscanf(in, "&#%u%1[;]", &n, temp) == 2
92 || sscanf(in, "&#x%x%1[;]", &n, temp) == 2)
93 && n != 0)
94 {
95 int buflen = uni2utf8((unsigned int) n,
96 buf, sizeof(buf));
97 buf[buflen] = '\0';
98 acl_vstring_strcat(out, buf);
99
100 n = *(in + 2) == 'x' ? 3 : 2;
101 while (isxdigit((int) in[n]))
102 n++;
103 if(in[n] == ';')
104 n++;
105 in += n;
106 } else {
107 ACL_VSTRING_ADDCH(out, (unsigned char) (*in));
108 in++;
109 }
110 }
111
112 return (in);
113}
114
115int acl_html_decode(const char *in, ACL_VSTRING *out)
116{

Callers 1

acl_html_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…