| 82 | static acl_pthread_once_t __decode_token_once = ACL_PTHREAD_ONCE_INIT; |
| 83 | |
| 84 | static 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 | |
| 115 | int acl_html_decode(const char *in, ACL_VSTRING *out) |
| 116 | { |
no test coverage detected
searching dependent graphs…