Alien-nghttp3
view release on metacpan or search on metacpan
vendor/nghttp3-1.18.0/lib/sfparse/sfparse.c view on Meta::CPAN
break;
}
*pc = c;
++*ppos;
return 0;
}
/* Start of utf8 dfa */
/* Copyright (c) 2008-2010 Bjoern Hoehrmann <bjoern@hoehrmann.de>
* See http://bjoern.hoehrmann.de/utf-8/decoder/dfa/ for details.
*
* Copyright (c) 2008-2009 Bjoern Hoehrmann <bjoern@hoehrmann.de>
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
vendor/nghttp3-1.18.0/lib/sfparse/sfparse.c view on Meta::CPAN
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#define UTF8_ACCEPT 0
#define UTF8_REJECT 12
/* clang-format off */
static const uint8_t utf8d[] = {
/*
* The first part of the table maps bytes to character classes that
* to reduce the size of the transition table and create bitmasks.
*/
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
vendor/nghttp3-1.18.0/lib/sfparse/sfparse.c view on Meta::CPAN
* of a state of the automaton and a character class to a state.
*/
0,12,24,36,60,96,84,12,12,12,48,72, 12,12,12,12,12,12,12,12,12,12,12,12,
12, 0,12,12,12,12,12, 0,12, 0,12,12, 12,24,12,12,12,12,12,24,12,24,12,12,
12,12,12,12,12,12,12,24,12,12,12,12, 12,24,12,12,12,12,12,12,12,24,12,12,
12,12,12,12,12,12,12,36,12,36,12,12, 12,36,12,12,12,12,12,36,12,36,12,12,
12,36,12,12,12,12,12,12,12,12,12,12,
};
/* clang-format on */
static void utf8_decode(uint32_t *state, uint8_t byte) {
*state = utf8d[256 + *state + utf8d[byte]];
}
/* End of utf8 dfa */
static const uint8_t dispstring_tbl[256] = {
[' '] = 1, ['!'] = 1, ['#'] = 1, ['$'] = 1, ['&'] = 1, ['\''] = 1, ['('] = 1,
[')'] = 1, ['*'] = 1, ['+'] = 1, [','] = 1, ['-'] = 1, ['.'] = 1, ['/'] = 1,
DIGITS(1), [':'] = 1, [';'] = 1, ['<'] = 1, ['='] = 1, ['>'] = 1, ['?'] = 1,
['@'] = 1, ALPHAS(1), ['['] = 1, ['\\'] = 1, [']'] = 1, ['^'] = 1, ['_'] = 1,
['`'] = 1, ['{'] = 1, ['|'] = 1, ['}'] = 1, ['~'] = 1, ['%'] = 2, ['"'] = 3,
};
static int parser_dispstring(sfparse_parser *sfp, sfparse_value *dest) {
const uint8_t *base;
uint8_t c;
uint32_t utf8state = UTF8_ACCEPT;
assert('%' == *sfp->pos);
++sfp->pos;
if (parser_eof(sfp) || *sfp->pos != '"') {
return SFPARSE_ERR_PARSE;
}
base = ++sfp->pos;
vendor/nghttp3-1.18.0/lib/sfparse/sfparse.c view on Meta::CPAN
break;
case 2:
for (;;) {
++sfp->pos;
if (sfp->pos + 2 > sfp->end || pctdecode(&c, &sfp->pos) != 0) {
return SFPARSE_ERR_PARSE;
}
utf8_decode(&utf8state, c);
if (utf8state == UTF8_ACCEPT) {
if (sfp->pos != sfp->end && *sfp->pos == '%') {
continue;
}
break;
}
if (utf8state == UTF8_REJECT || sfp->pos + 1 > sfp->end ||
*sfp->pos != '%') {
return SFPARSE_ERR_PARSE;
}
}
break;
case 3:
assert(utf8state == UTF8_ACCEPT);
if (dest) {
dest->type = SFPARSE_TYPE_DISPSTRING;
dest->flags = SFPARSE_VALUE_FLAG_NONE;
dest->vec.len = (size_t)(sfp->pos - base);
dest->vec.base = dest->vec.len == 0 ? NULL : (uint8_t *)base;
}
++sfp->pos;
( run in 0.913 second using v1.01-cache-2.11-cpan-234fa220139 )