Go to the documentation of this file.
5 #error must include stdint.h first
8 #if UINTPTR_MAX == 0xffffffff
9 #define UPB_SIZE(size32, size64) size32
11 #define UPB_SIZE(size32, size64) size64
14 #define UPB_FIELD_AT(msg, fieldtype, offset) \
15 *(fieldtype*)((const char*)(msg) + offset)
17 #define UPB_READ_ONEOF(msg, fieldtype, offset, case_offset, case_val, default) \
18 UPB_FIELD_AT(msg, int, case_offset) == case_val \
19 ? UPB_FIELD_AT(msg, fieldtype, offset) \
22 #define UPB_WRITE_ONEOF(msg, fieldtype, offset, value, case_offset, case_val) \
23 UPB_FIELD_AT(msg, int, case_offset) = case_val; \
24 UPB_FIELD_AT(msg, fieldtype, offset) = value;
162 {8,
UPB_SIZE(72, 112), 10, 0, 11, 1},
280 {11,
UPB_SIZE(44, 64), 13, 0, 9, 1},
288 {36,
UPB_SIZE(52, 80), 14, 0, 9, 1},
289 {37,
UPB_SIZE(60, 96), 15, 0, 9, 1},
290 {39,
UPB_SIZE(68, 112), 16, 0, 9, 1},
291 {40,
UPB_SIZE(76, 128), 17, 0, 9, 1},
292 {41,
UPB_SIZE(84, 144), 18, 0, 9, 1},
293 {42,
UPB_SIZE(24, 24), 10, 0, 8, 1},
294 {999,
UPB_SIZE(92, 160), 0, 0, 11, 3},
332 {999,
UPB_SIZE(28, 32), 0, 0, 11, 3},
408 {999,
UPB_SIZE(20, 24), 0, 0, 11, 3},
547 #define CHK(x) if (!(x)) { return false; }
552 int group_number,
char *msg,
559 const char *
p = *ptr;
563 CHK(bitpos < 70 &&
p < limit);
565 *
val |= (uint64_t)(
byte & 0x7F) << bitpos;
568 }
while (
byte & 0x80);
584 CHK(limit - *ptr >= 8);
585 memcpy(
val, *ptr, 8);
592 CHK(limit - *ptr >= 4);
593 memcpy(
val, *ptr, 4);
599 int *field_number,
int *wire_type) {
602 *field_number = tag >> 3;
603 *wire_type = tag & 7;
608 return (
n >> 1) ^ -(int32_t)(
n & 1);
612 return (
n >> 1) ^ -(int64_t)(
n & 1);
621 limit - *ptr >= (int32_t)
len);
629 memcpy((
char*)msg + ofs, &
val,
sizeof(
val));
639 int field_number,
int wire_type) {
668 size_t needed = arr->
len + elements;
675 while (new_size < needed) {
684 arr->
data = new_data;
685 arr->
size = new_size;
690 if (arr->
size - arr->
len < elements) {
698 arr->
len += elements;
726 int32_t hasbit =
field->presence;
728 frame->
msg[hasbit / 8] |= (1 << (hasbit % 8));
739 char *field_mem = frame->
msg +
field->offset;
756 }
else if (
field->presence < 0) {
758 }
else if (
field->presence > 0) {
768 char *submsg = *(
void **)submsg_slot;
777 *(
void**)submsg_slot = submsg;
786 const char *field_start,
798 memcpy(field_mem, &
val,
sizeof(
val));
803 uint32_t val32 =
val;
804 memcpy(field_mem, &val32,
sizeof(val32));
808 bool valbool =
val != 0;
809 memcpy(field_mem, &valbool,
sizeof(valbool));
814 memcpy(field_mem, &decoded,
sizeof(decoded));
819 memcpy(field_mem, &decoded,
sizeof(decoded));
831 const char *field_start,
844 memcpy(field_mem, &
val,
sizeof(
val));
855 const char *field_start,
868 memcpy(field_mem, &
val,
sizeof(
val));
880 int elements =
data.size / elem_size;
883 CHK((
size_t)(elements * elem_size) ==
data.size);
886 memcpy(field_mem,
data.data,
data.size);
891 const char *field_start,
896 #define VARINT_CASE(ctype, decode) { \
897 const char *ptr = val.data; \
898 const char *limit = ptr + val.size; \
899 while (ptr < limit) { \
903 CHK(upb_decode_varint(&ptr, limit, &val)); \
904 decoded = (decode)(val); \
905 field_mem = upb_array_add(arr, 1); \
907 memcpy(field_mem, &decoded, sizeof(ctype)); \
917 memcpy(field_mem, &
val,
sizeof(
val));
959 *(
void**)field_mem = submsg;
972 const char *field_start,
986 memcpy(field_mem, &
val,
sizeof(
val));
1004 uint32_t field_number) {
1019 const char *field_start =
d->ptr;
1026 switch (wire_type) {
1046 CHK(field_number != 0);
1054 const char *limit) {
1059 frame.
limit = limit;
1061 while (
d->ptr < frame.
limit) {
1073 int group_number,
char *msg,
1077 frame.
limit = limit;
1081 while (
d->ptr < frame.
limit) {
1111 if (!ret)
return NULL;
1217 uintptr_t num = (uintptr_t)upb_value_getconstptr(
v);
1218 return (num & 3) ==
type ? (
const void*)(num & ~3) :
NULL;
1222 uintptr_t num = (uintptr_t)ptr |
type;
1223 return upb_value_constptr((
const void*)num);
1228 return c >= low && c <= high;
1244 for (
i = 0;
i <
len;
i++) {
1247 if (
start || !full) {
1255 s,
"invalid name: path components must start with a letter (%s)",
1274 if (fullname ==
NULL) {
1276 }
else if ((
p = strrchr(fullname,
'.')) ==
NULL) {
1289 const uint32_t high_bit = 1 << 30;
1314 m->submsg_field_count = 0;
1324 m->submsg_field_count = 0;
1331 m->submsg_field_count++;
1339 for (
i = 0;
i <
n;
i++) {
1345 m->selector_count = selector;
1351 if (upb_handlers_getselector(f, type, &sel)) { upb_inttable_insert(&t, sel, v); }
1358 v = upb_value_bool(
true);
1405 if (!strcmp(
name,
"google.protobuf.Any")) {
1407 }
else if (!strcmp(
name,
"google.protobuf.FieldMask")) {
1409 }
else if (!strcmp(
name,
"google.protobuf.Duration")) {
1411 }
else if (!strcmp(
name,
"google.protobuf.Timestamp")) {
1413 }
else if (!strcmp(
name,
"google.protobuf.DoubleValue")) {
1415 }
else if (!strcmp(
name,
"google.protobuf.FloatValue")) {
1417 }
else if (!strcmp(
name,
"google.protobuf.Int64Value")) {
1419 }
else if (!strcmp(
name,
"google.protobuf.UInt64Value")) {
1421 }
else if (!strcmp(
name,
"google.protobuf.Int32Value")) {
1423 }
else if (!strcmp(
name,
"google.protobuf.UInt32Value")) {
1425 }
else if (!strcmp(
name,
"google.protobuf.BoolValue")) {
1427 }
else if (!strcmp(
name,
"google.protobuf.StringValue")) {
1429 }
else if (!strcmp(
name,
"google.protobuf.BytesValue")) {
1431 }
else if (!strcmp(
name,
"google.protobuf.Value")) {
1433 }
else if (!strcmp(
name,
"google.protobuf.ListValue")) {
1435 }
else if (!strcmp(
name,
"google.protobuf.Struct")) {
1475 size_t len, int32_t *num) {
1480 if (num) *num = upb_value_getint32(
v);
1487 upb_value_getcstr(
v) :
NULL;
1502 return f->full_name;
1557 return f->is_extension_;
1573 return f->selector_base;
1579 bool ucase_next =
false;
1581 #define WRITE(byte) \
1583 if (dst < len) buf[dst - 1] = byte; \
1584 else if (dst == len) buf[dst - 1] = '\0'
1630 return f->defaultval.sint;
1635 return f->defaultval.sint;
1640 return f->defaultval.uint;
1645 return f->defaultval.uint;
1650 return f->defaultval.boolean;
1655 return f->defaultval.flt;
1660 return f->defaultval.dbl;
1679 return f->sub.msgdef;
1684 return f->sub.enumdef;
1719 static bool between(int32_t
x, int32_t low, int32_t high) {
1720 return x >= low &&
x <= high;
1734 return m->full_name;
1746 return m->file->syntax;
1750 return m->selector_count;
1754 return m->submsg_field_count;
1760 upb_value_getconstptr(
val) :
NULL;
1810 return m->map_entry;
1814 return m->well_known_type;
1938 #define CHK(x) if (!(x)) { return false; }
1939 #define CHK_OOM(x) if (!(x)) { upb_status_setoom(ctx->status); return false; }
1955 return n == strlen(
b) && memcmp(
a,
b,
n) == 0;
1971 memcpy(&ret[
n + 1],
name.data,
name.size);
1972 ret[
n + 1 +
name.size] =
'\0';
1999 if(sym.
data[0] ==
'.') {
2011 "type mismatch when resolving field %s, name %s",
2012 f->full_name, sym.
data);
2090 f->defaultval.sint =
val;
2097 f->defaultval.sint =
val;
2104 f->defaultval.sint =
val;
2108 unsigned long val = strtoul(
str, &
end, 0);
2110 f->defaultval.uint =
val;
2115 unsigned long long val = strtoul(
str, &
end, 0);
2117 f->defaultval.uint =
val;
2123 f->defaultval.dbl =
val;
2130 f->defaultval.flt =
val;
2135 f->defaultval.boolean =
false;
2137 f->defaultval.boolean =
true;
2161 f->defaultval.sint = 0;
2165 f->defaultval.uint = 0;
2169 f->defaultval.dbl = 0;
2176 f->defaultval.boolean =
false;
2190 const char *full_name;
2192 uint32_t field_number;
2217 f->is_extension_ =
false;
2220 v = upb_value_constptr(
f);
2239 f->full_name = full_name;
2240 f->file = ctx->
file;
2243 f->number_ = field_number;
2249 f->sub.unresolved = field_proto;
2265 "fields in oneof must have OPTIONAL label (%s)",
2272 "oneof_index provided for extension field (%s)",
2277 if (oneof_index >=
m->oneof_count) {
2329 "enums must contain at least one value (%s)",
2334 for (
i = 0;
i <
n;
i++) {
2343 "for proto3, the first enum value must be zero (%s)",
2389 m->file = ctx->
file;
2390 m->map_entry =
false;
2401 for (
i = 0;
i <
n;
i++) {
2408 for (
i = 0;
i <
n;
i++) {
2419 for (
i = 0;
i <
n;
i++) {
2424 for (
i = 0;
i <
n;
i++) {
2445 for (
i = 0;
i <
n;
i++) {
2463 for (
i = 0;
i <
n;
i++) {
2479 if (
f->is_extension_) {
2482 "extension for field '%s' had no extendee",
2506 CHK(
f->sub.enumdef);
2517 "proto3 fields cannot have explicit defaults (%s)",
2524 "message fields cannot have explicit defaults (%s)",
2582 google_protobuf_FileDescriptorProto_package(file_proto);
2607 if (file_options_proto) {
2624 for (
i = 0;
i <
n;
i++) {
2628 dep_name.
size, &
v)) {
2631 "', but it has not been loaded",
2635 file->
deps[
i] = upb_value_getconstptr(
v);
2640 for (
i = 0;
i <
n;
i++) {
2646 for (
i = 0;
i <
n;
i++) {
2654 for (
i = 0;
i <
n;
i++) {
2666 for (j = 0; j <
m->field_count; j++) {
2681 upb_value_constptr(file), alloc));
2705 return f->phpprefix;
2709 return f->phpnamespace;
2717 return f->msg_count;
2721 return f->dep_count;
2725 return f->enum_count;
2733 return i < 0 || i >=
f->msg_count ?
NULL : &
f->msgs[
i];
2737 return i < 0 || i >=
f->enum_count ?
NULL : &
f->enums[
i];
2835 for (; *deps; deps++) {
2840 init->descriptor.data,
init->descriptor.size, arena);
2845 "Failed to parse compiled-in descriptor for file '%s'. This should "
2857 fprintf(stderr,
"Error loading compiled-in descriptor: %s\n",
2869 #define UPB_PB_VARINT_MAX_LEN 10
2870 #define CHK(x) do { if (!(x)) { return false; } } while(0)
2897 if (
val < 128) {
buf[0] =
val;
return 1; }
2900 uint8_t
byte =
val & 0x7fU;
2902 if (
val)
byte |= 0x80U;
2918 while (ret <
bytes) {
2925 size_t old_size = e->
limit - e->
buf;
2931 memmove(new_buf + new_size - old_size, e->
buf, old_size);
2933 e->
ptr = new_buf + new_size - (e->
limit - e->
ptr);
2934 e->
limit = new_buf + new_size;
2979 UPB_ASSERT(
sizeof(
double) ==
sizeof(uint64_t));
2980 memcpy(&u64, &
d,
sizeof(uint64_t));
2986 UPB_ASSERT(
sizeof(
float) ==
sizeof(uint32_t));
2987 memcpy(&u32, &
d,
sizeof(uint32_t));
2993 uint32_t
offset = ~
f->presence;
2994 memcpy(&ret, msg +
offset,
sizeof(ret));
2999 uint32_t hasbit =
f->presence;
3001 return msg[hasbit / 8] & (1 << (hasbit % 8));
3022 if (arr ==
NULL || arr->
len == 0) {
3028 #define VARINT_CASE(ctype, encode) { \
3029 ctype *start = arr->data; \
3030 ctype *ptr = start + arr->len; \
3031 size_t pre_len = e->limit - e->ptr; \
3034 CHK(upb_put_varint(e, encode)); \
3035 } while (ptr != start); \
3036 CHK(upb_put_varint(e, e->limit - e->ptr - pre_len)); \
3041 switch (
f->descriptortype) {
3079 }
while (ptr !=
start);
3092 }
while (ptr !=
start);
3105 }
while (ptr !=
start);
3120 bool skip_zero_value) {
3121 #define CASE(ctype, type, wire_type, encodeval) do { \
3122 ctype val = *(ctype*)field_mem; \
3123 if (skip_zero_value && val == 0) { \
3126 return upb_put_ ## type(e, encodeval) && \
3127 upb_put_tag(e, f->number, wire_type); \
3130 switch (
f->descriptortype) {
3158 if (skip_zero_value && view.
size == 0) {
3167 void *submsg = *(
void **)field_mem;
3169 if (submsg ==
NULL) {
3178 void *submsg = *(
void **)field_mem;
3180 if (submsg ==
NULL) {
3195 size_t pre_len = e->
limit - e->
ptr;
3196 const char *unknown;
3197 size_t unknown_size;
3199 for (
i =
m->field_count - 1;
i >= 0;
i--) {
3205 bool skip_empty =
false;
3206 if (
f->presence == 0) {
3209 }
else if (
f->presence > 0) {
3280 memset(mem, 0,
size);
3291 #define SUBH(h, selector) (h->sub[selector])
3294 #define SUBH_F(h, f) SUBH(h, upb_fielddef_index(f))
3325 const void *closure_type;
3326 const void **context_closure_type;
3345 context_closure_type = &
h->top_closure_type;
3348 if (closure_type && *context_closure_type &&
3349 closure_type != *context_closure_type) {
3354 *context_closure_type = closure_type;
3360 const void *table_return_type =
h->table[sel].attr.return_closure_type;
3361 if (return_type && table_return_type && return_type != table_return_type) {
3365 if (table_return_type && !return_type) {
3371 h->table[sel].attr = set_attr;
3387 ret =
h->top_closure_type;
3393 ret =
h->table[sel].attr.return_closure_type;
3398 ret =
h->table[sel].attr.return_closure_type;
3416 const void *closure_type;
3418 const void *return_closure_type;
3421 if (
h->table[sel].func)
return true;
3423 attr = &
h->table[sel].attr;
3425 if (closure_type && return_closure_type &&
3426 closure_type != return_closure_type) {
3440 if (!
h)
return NULL;
3448 if (!
h->sub)
return NULL;
3459 #define SETTER(name, handlerctype, handlertype) \
3460 bool upb_handlers_set##name(upb_handlers *h, const upb_fielddef *f, \
3461 handlerctype func, \
3462 const upb_handlerattr *attr) { \
3463 int32_t sel = trygetsel(h, f, handlertype); \
3464 return doset(h, sel, f, handlertype, (upb_func *)func, attr); \
3521 const void **handler_data) {
3523 if (ret && handler_data) {
3524 *handler_data =
h->table[
s].attr.handler_data;
3533 *attr =
h->table[sel].attr;
3583 *
s = selector_base + 3;
3590 *
s = selector_base + 1;
3597 *
s = selector_base + 2;
3604 *
s = selector_base - 2;
3608 *
s = selector_base - 1;
3662 return upb_value_getptr(
v);
3666 v = upb_value_ptr(
h);
3668 if (!
h)
return NULL;
3684 if (!sub_mh)
return NULL;
3695 const void *closure) {
3698 if (!cache)
return NULL;
3756 #define MSG_WRITER(type, ctype) \
3757 bool upb_msg_set ## type (void *c, const void *hd, ctype val) { \
3759 const upb_msg_handlerdata *d = hd; \
3760 if (d->hasbit > 0) \
3761 *(uint8_t*)&m[d->hasbit / 8] |= 1 << (d->hasbit % 8); \
3762 *(ctype*)&m[d->offset] = val; \
3775 size_t offset, int32_t hasbit) {
3780 if (!
d)
return false;
3788 #define TYPE(u, l) \
3789 case UPB_TYPE_##u: \
3790 ok = upb_handlers_set##l(h, f, upb_msg_set##l, &attr); break;
3800 TYPE(DOUBLE,
double);
3839 *hasbit =
d->hasbit;
3851 #define PTR_AT(msg, ofs, type) (type*)((char*)msg + ofs)
3852 #define VOIDPTR_AT(msg, ofs) PTR_AT(msg, ofs, void)
3853 #define ENCODE_MAX_NESTING 64
3854 #define CHECK_TRUE(x) if (!(x)) { return false; }
3889 return sizeof(
void*);
3899 return sizeof(
void*);
3946 #define DEREF(msg, ofs, type) *PTR_AT(msg, ofs, type)
4007 UPB_ASSERT(field_index >= 0 && field_index < l->field_count);
4008 return &l->
fields[field_index];
4012 return field->presence < 0;
4039 memset(msg, 0, l->
size);
4071 uint32_t hasbit =
field->presence;
4072 return DEREF(msg, hasbit / 8,
char) | (1 << (hasbit % 8));
4093 #define DEREF_ARR(arr, i, type) ((type*)arr->data)[i]
4129 if (
i == arr->
len) {
4132 if (
i == arr->
size) {
4145 arr->
data = new_data;
4146 arr->
size = new_size;
4169 const char **out_key,
size_t *out_len) {
4173 *out_key =
key->str.data;
4174 *out_len =
key->str.size;
4182 *out_key = (
const char*)
key;
4227 map->key_type = ktype;
4228 map->val_type = vtype;
4243 return map->key_type;
4247 return map->val_type;
4252 const char *key_str;
4259 memcpy(
val, &tabval,
sizeof(tabval));
4267 const char *key_str;
4278 memcpy(&removed, &removedtabval,
sizeof(removed));
4285 const char *key_str;
4307 i->key_type =
map->key_type;
4352 return (
val & (
val - 1)) == 0;
4358 return (
val + align - 1) & ~(align - 1);
4362 return (
n +
d - 1) /
d;
4379 return sizeof(
void*);
4389 return sizeof(
void*);
4417 size_t submsg_count = 0;
4430 memset(l, 0,
sizeof(*l));
4433 submsgs =
upb_gmalloc(submsg_count *
sizeof(*submsgs));
4436 (!submsgs && submsg_count)) {
4471 field->submsg_index = submsg_count++;
4472 submsgs[
field->submsg_index] = sub_layout;
4476 field->presence = (hasbit++);
4478 field->presence = 0;
4507 size_t case_size =
sizeof(uint32_t);
4508 size_t field_size = 0;
4509 uint32_t case_offset;
4510 uint32_t data_offset;
4581 return upb_value_getptr(
v);
4596 #error must include stdint.h first
4599 #if UINTPTR_MAX == 0xffffffff
4600 #define UPB_SIZE(size32, size64) size32
4602 #define UPB_SIZE(size32, size64) size64
4605 #define UPB_FIELD_AT(msg, fieldtype, offset) \
4606 *(fieldtype*)((const char*)(msg) + offset)
4608 #define UPB_READ_ONEOF(msg, fieldtype, offset, case_offset, case_val, default) \
4609 UPB_FIELD_AT(msg, int, case_offset) == case_val \
4610 ? UPB_FIELD_AT(msg, fieldtype, offset) \
4613 #define UPB_WRITE_ONEOF(msg, fieldtype, offset, value, case_offset, case_val) \
4614 UPB_FIELD_AT(msg, int, case_offset) = case_val; \
4615 UPB_FIELD_AT(msg, fieldtype, offset) = value;
4619 #undef UPB_READ_ONEOF
4620 #undef UPB_WRITE_ONEOF
4629 if (ret &&
len != 0) {
4646 #define UPB_MAXARRSIZE 16
4649 #define ARRAY_SIZE(x) \
4650 ((sizeof(x)/sizeof(0[x])) / ((size_t)(!(sizeof(x) % sizeof(0[x])))))
4670 while (
v >>= 1) ret++;
4671 ret = pow2 ? ret : ret + 1;
4684 if (
len == SIZE_MAX)
return NULL;
4750 if (!t->
entries)
return false;
4780 if (eql(e->
key,
key))
return e;
4825 if (chain == mainpos_e) {
4829 mainpos_e->
next = new_e;
4835 *new_e = *mainpos_e;
4836 while (chain->
next != mainpos_e) {
4840 chain->
next = new_e;
4845 our_e->
key = tabkey;
4854 if (eql(chain->
key,
key)) {
4858 if (removed) *removed = chain->
key;
4878 if (removed) *removed =
rm->key;
4908 uint32_t
len = (uint32_t)
k2.str.len;
4911 memcpy(
str, &
len,
sizeof(uint32_t));
4912 memcpy(
str +
sizeof(uint32_t),
k2.str.str,
k2.str.len + 1);
4913 return (uintptr_t)
str;
4925 return len ==
k2.str.len && memcmp(
str,
k2.str.str,
len) == 0;
4929 return init(&t->
t, ctype, 2,
a);
4978 if (tabkey == 0)
return false;
5006 return &
i->t->t.entries[
i->index];
5015 i->index =
next(&
i->t->t,
i->index);
5019 if (!
i->t)
return true;
5043 i->index = SIZE_MAX;
5062 return k1 ==
k2.num;
5070 if (key < t->array_size) {
5090 #if defined(UPB_DEBUG_TABLE) && !defined(NDEBUG)
5108 if (!
init(&t->
t, ctype, hsize_lg2,
a))
return false;
5141 if (key < t->array_size) {
5178 if (!table_v)
return false;
5185 if (!table_v)
return false;
5192 if (key < t->array_size) {
5264 for (size_lg2 =
ARRAY_SIZE(counts) - 1; size_lg2 > 0; size_lg2--) {
5265 if (counts[size_lg2] == 0) {
5268 }
else if (arr_count >= (1 << size_lg2) *
MIN_DENSITY) {
5272 arr_count -= counts[size_lg2];
5279 size_t arr_size = max[size_lg2] + 1;
5281 size_t hash_size = hash_count ? (hash_count /
MAX_LOAD) + 1 : 0;
5282 size_t hashsize_lg2 =
log2ceil(hash_size);
5301 return &
i->t->t.entries[
i->index];
5306 return i->t->array[
i->index];
5312 i->array_part =
true;
5332 if (!
i->t)
return true;
5333 if (
i->array_part) {
5334 return i->index >=
i->t->array_size ||
5356 i->index = SIZE_MAX;
5357 i->array_part =
false;
5368 #if defined(UPB_UNALIGNED_READS_OK) || defined(__s390x__)
5382 const uint32_t
m = 0x5bd1e995;
5383 const int32_t
r = 24;
5386 uint32_t
h = seed ^
len;
5389 const uint8_t *
data = (
const uint8_t *)
key;
5391 uint32_t k = *(uint32_t *)
data;
5406 case 3:
h ^=
data[2] << 16;
5407 case 2:
h ^=
data[1] << 8;
5428 #define MIX(h,k,m) { k *= m; k ^= k >> r; k *= m; h *= m; h ^= k; }
5431 const uint32_t
m = 0x5bd1e995;
5432 const int32_t
r = 24;
5433 const uint8_t *
data = (
const uint8_t *)
key;
5434 uint32_t
h = seed ^
len;
5435 uint8_t align = (uintptr_t)
data & 3;
5437 if(align && (
len >= 4)) {
5439 uint32_t t = 0,
d = 0;
5444 case 1: t |=
data[2] << 16;
5445 case 2: t |=
data[1] << 8;
5446 case 3: t |=
data[0];
5462 d = *(uint32_t *)
data;
5463 t = (t >> sr) | (
d << sl);
5483 case 3:
d |=
data[2] << 16;
5484 case 2:
d |=
data[1] << 8;
5485 case 1:
d |=
data[0];
5488 k = (t >> sr) | (
d << sl);
5498 case 3:
h ^=
data[2] << 16;
5499 case 2:
h ^=
data[1] << 8;
5504 case 3:
d |=
data[2] << 16;
5505 case 2:
d |=
data[1] << 8;
5506 case 1:
d |=
data[0];
5507 case 0:
h ^= (t >> sr) | (
d << sl);
h *=
m;
5518 uint32_t k = *(uint32_t *)
data;
5530 case 3:
h ^=
data[2] << 16;
5531 case 2:
h ^=
data[1] << 8;
5559 const char *ellipsis =
"...";
5560 size_t len = strlen(ellipsis);
5562 memcpy(status->
msg +
sizeof(status->
msg) -
len, ellipsis,
len);
5568 if (!status)
return;
5570 status->
msg[0] =
'\0';
5578 if (!status)
return;
5580 strncpy(status->
msg, msg,
sizeof(status->
msg));
5592 if (!status)
return;
5594 _upb_vsnprintf(status->
msg,
sizeof(status->
msg),
fmt,
args);
5608 return realloc(ptr,
size);
5661 block->
next =
a->block_head;
5664 block->
owned = owned;
5666 a->block_head = block;
5680 a->next_block_size =
UPB_MIN(block_size * 2,
a->max_block_size);
5708 ret = (
char*)block + block->
used;
5712 memcpy(ret, ptr, oldsize);
5717 a->bytes_allocated +=
size;
5723 #define upb_alignof(type) offsetof (struct { char c; type member; }, member)
5734 if (
n < first_block_overhead) {
5736 n = first_block_overhead + 256;
5743 a = (
void*)((
char*)mem +
n -
sizeof(*a));
5748 a->bytes_allocated = 0;
5749 a->next_block_size = 256;
5750 a->max_block_size = 16384;
5751 a->cleanup_head =
NULL;
5752 a->block_head =
NULL;
5753 a->block_alloc = alloc;
5793 ent->
next =
a->cleanup_head;
5794 a->cleanup_head = ent;
5800 return a->bytes_allocated;
5813 #ifdef UPB_DUMP_BYTECODE
5818 #define EMPTYLABEL -1
5841 return m->dest_handlers_;
5850 return m->is_native_;
5873 g->bytecode_end =
NULL;
5913 switch (
getop(instr)) {
5922 switch (
getop(instruction)) {
5939 static int32_t
getofs(uint32_t instruction) {
5941 return (int32_t)instruction >> 8;
5943 return (int8_t)(instruction >> 8);
5947 static void setofs(uint32_t *instruction, int32_t ofs) {
5949 *instruction =
getop(*instruction) | ofs << 8;
5951 *instruction = (*instruction & ~0xff00) | ((ofs & 0xff) << 8);
5969 int ofs =
getofs(*codep);
5971 codep = ofs ? codep + ofs :
NULL;
5990 }
else if (
label < 0) {
6005 if (c->
pc ==
g->bytecode_end) {
6007 size_t oldsize =
g->bytecode_end -
g->bytecode;
6008 size_t newsize =
UPB_MAX(oldsize * 2, 64);
6010 g->bytecode =
upb_grealloc(
g->bytecode, oldsize *
sizeof(uint32_t),
6011 newsize *
sizeof(uint32_t));
6012 g->bytecode_end =
g->bytecode + newsize;
6013 c->
pc =
g->bytecode + ofs;
6024 uintptr_t ptr = (uintptr_t)va_arg(ap,
void*);
6027 if (
sizeof(uintptr_t) >
sizeof(uint32_t))
6028 put32(c, (uint64_t)ptr >> 32);
6041 case OP_PARSE_DOUBLE:
6042 case OP_PARSE_FLOAT:
6043 case OP_PARSE_INT64:
6044 case OP_PARSE_UINT64:
6045 case OP_PARSE_INT32:
6046 case OP_PARSE_FIXED64:
6047 case OP_PARSE_FIXED32:
6049 case OP_PARSE_UINT32:
6050 case OP_PARSE_SFIXED32:
6051 case OP_PARSE_SFIXED64:
6052 case OP_PARSE_SINT32:
6053 case OP_PARSE_SINT64:
6066 put32(c, va_arg(ap,
int));
6075 uint32_t instruction = op;
6076 int label = va_arg(ap,
int);
6078 put32(c, instruction);
6083 int label = va_arg(ap,
int);
6084 uint64_t tag = va_arg(ap, uint64_t);
6085 uint32_t instruction = op | (tag << 16);
6088 put32(c, instruction);
6092 int label = va_arg(ap,
int);
6093 uint64_t tag = va_arg(ap, uint64_t);
6096 put32(c, instruction);
6098 put32(c, tag >> 32);
6106 #if defined(UPB_DUMP_BYTECODE)
6110 #define EXPAND_AND_QUOTE(x) QUOTE(x)
6111 #define OPNAME(x) OP_##x
6112 #define OP(x) case OPNAME(x): return EXPAND_AND_QUOTE(OPNAME(x));
6113 #define T(x) OP(PARSE_##x)
6116 T(DOUBLE)
T(FLOAT)
T(INT64)
T(UINT64)
T(INT32)
T(FIXED64)
T(FIXED32)
6117 T(BOOL)
T(UINT32)
T(SFIXED32)
T(SFIXED64)
T(SINT32)
T(SINT64)
6118 OP(STARTMSG) OP(ENDMSG) OP(STARTSEQ) OP(ENDSEQ) OP(STARTSUBMSG)
6119 OP(ENDSUBMSG) OP(STARTSTR) OP(STRING) OP(ENDSTR) OP(CALL) OP(RET)
6120 OP(PUSHLENDELIM) OP(PUSHTAGDELIM) OP(SETDELIM) OP(CHECKDELIM)
6121 OP(BRANCH) OP(TAG1) OP(TAG2) OP(TAGN) OP(SETDISPATCH) OP(POP)
6122 OP(SETBIGGROUPNUM) OP(DISPATCH) OP(HALT)
6124 return "<unknown op>";
6131 #ifdef UPB_DUMP_BYTECODE
6133 static void dumpbc(uint32_t *
p, uint32_t *
end, FILE *
f) {
6138 fprintf(
f,
"%p %8tx",
p,
p -
begin);
6139 uint32_t instr = *
p++;
6140 uint8_t op =
getop(instr);
6163 case OP_PARSE_DOUBLE:
6164 case OP_PARSE_FLOAT:
6165 case OP_PARSE_INT64:
6166 case OP_PARSE_UINT64:
6167 case OP_PARSE_INT32:
6168 case OP_PARSE_FIXED64:
6169 case OP_PARSE_FIXED32:
6171 case OP_PARSE_UINT32:
6172 case OP_PARSE_SFIXED32:
6173 case OP_PARSE_SFIXED64:
6174 case OP_PARSE_SINT32:
6175 case OP_PARSE_SINT64:
6184 fprintf(
f,
" %d", instr >> 8);
6187 fprintf(
f,
" %d", *
p++);
6196 fprintf(
f,
" tag:0x%x", instr >> 16);
6203 uint64_t tag = *
p++;
6204 tag |= (uint64_t)*
p++ << 32;
6205 fprintf(
f,
" tag:0x%llx", (
long long)tag);
6206 fprintf(
f,
" n:%d", instr >> 16);
6228 int wire_type,
int dest) {
6273 uint64_t repacked =
repack(upb_value_getuint64(
v), wire_type);
6287 if (fn >= 1 << 24) {
6303 ? upb_value_getptr(
v)
6334 #define LABEL_LOOPSTART 1
6335 #define LABEL_LOOPBREAK 2
6336 #define LABEL_FIELD 3
6337 #define LABEL_ENDMSG 4
6470 putop(c, parse_type, sel);
6477 putop(c, parse_type, sel);
6489 putop(c, parse_type, sel);
6535 if (c->
pc == start_pc) {
6611 m->code_base.ptr =
g->bytecode +
m->code_base.ofs;
6641 g->bytecode_end = c->
pc;
6644 #ifdef UPB_DUMP_BYTECODE
6646 FILE *
f = fopen(
"/tmp/upb-bytecode",
"w");
6648 dumpbc(
g->bytecode,
g->bytecode_end, stderr);
6649 dumpbc(
g->bytecode,
g->bytecode_end,
f);
6652 f = fopen(
"/tmp/upb-bytecode.bin",
"wb");
6654 fwrite(
g->bytecode, 1,
g->bytecode_end -
g->bytecode,
f);
6669 if (!c)
return NULL;
6725 return upb_value_getptr(
v);
6742 #include <inttypes.h>
6745 #ifdef UPB_DUMP_BYTECODE
6749 #define CHECK_SUSPEND(x) if (!(x)) return upb_pbdecoder_suspend(d);
6754 "Submessage end extends past enclosing submessage.";
6802 #ifdef UPB_USE_JIT_X64
6803 if (
d->method_->is_native_) {
6806 size_t ret = entries *
sizeof(
void*) * 2;
6807 ret +=
sizeof(
void*) * 10;
6812 return entries *
sizeof(uint32_t*);
6843 return d->data_end -
d->ptr;
6848 return d->end -
d->ptr;
6853 return d->bufstart_ofs + (
d->ptr -
d->buf);
6858 return d->top->end_ofs -
offset(
d);
6872 return in_buf(
p,
d->residual,
d->residual_end);
6878 size_t delim_ofs =
d->top->end_ofs -
d->bufstart_ofs;
6879 if (delim_ofs <= (
size_t)(
d->end -
d->buf)) {
6880 d->delim_end =
d->buf + delim_ofs;
6881 d->data_end =
d->delim_end;
6883 d->data_end =
d->end;
6884 d->delim_end =
NULL;
6897 d->bufstart_ofs += (
d->end -
d->buf);
6906 d->checkpoint =
d->ptr;
6919 seterr(
d,
"Skipped value extended beyond enclosing submessage.");
6930 d->bufstart_ofs += (
d->end -
d->buf);
6931 d->residual_end =
d->residual;
6933 return d->size_param +
d->skip;
6949 d->size_param =
size;
6955 if (
d->skip &&
d->skip >=
size) {
6957 d->bufstart_ofs +=
size;
6972 seterr(
d,
"Passed NULL buffer over non-skippable region.");
6976 if (
d->residual_end >
d->residual) {
6983 d->checkpoint =
d->ptr;
6987 size_t skip_bytes =
d->skip;
6994 if (
d->top->groupnum < 0) {
7006 if (
d->checkpoint ==
d->residual) {
7008 d->ptr =
d->residual;
7011 size_t ret =
d->size_param - (
d->end -
d->checkpoint);
7015 d->bufstart_ofs += (
d->checkpoint -
d->buf);
7016 d->residual_end =
d->residual;
7031 if (
d->checkpoint ==
d->residual) {
7033 UPB_ASSERT((
d->residual_end -
d->residual) +
d->size_param <=
7034 sizeof(
d->residual));
7036 d->bufstart_ofs -= (
d->residual_end -
d->residual);
7038 memcpy(
d->residual_end,
d->buf_param,
d->size_param);
7039 d->residual_end +=
d->size_param;
7045 d->ptr =
d->checkpoint;
7048 memcpy(
d->residual,
d->ptr, save);
7049 d->residual_end =
d->residual + save;
7054 return d->size_param;
7081 }
else if (
d->data_end ==
d->delim_end) {
7082 seterr(
d,
"Submessage ended in the middle of a value or group");
7106 memcpy(
buf,
d->ptr, ret);
7109 memcpy((
char *)
buf + ret,
d->buf_param, copy);
7132 uint8_t
byte = 0x80;
7135 for(bitpos = 0; bitpos < 70 && (
byte & 0x80); bitpos += 7) {
7137 *u64 |= (uint64_t)(
byte & 0x7F) << bitpos;
7139 if(bitpos == 70 && (
byte & 0x80)) {
7174 if (ret >= 0)
return ret;
7176 seterr(
d,
"Unterminated 32-bit varint");
7222 }
else if (fr ==
d->limit) {
7242 d->top->groupnum = arg;
7250 uint64_t expected) {
7254 if (read ==
bytes &&
data == expected) {
7259 }
else if (read <
bytes && memcmp(&
data, &expected, read) == 0) {
7267 uint8_t wire_type) {
7274 wire_type = tag & 0x7;
7275 fieldnum = tag >> 3;
7278 if (fieldnum == 0) {
7279 seterr(
d,
"Saw invalid field number (0)");
7283 switch (wire_type) {
7305 if (fieldnum == -
d->top->groupnum) {
7307 }
else if (fieldnum ==
d->top->groupnum) {
7310 seterr(
d,
"Unmatched ENDGROUP tag.");
7315 seterr(
d,
"Invalid wire type");
7319 if (
d->top->groupnum >= 0) {
7334 d->pc =
d->top->base + upb_value_getuint64(
v);
7353 wire_type = tag & 0x7;
7354 fieldnum = tag >> 3;
7360 uint64_t
v = upb_value_getuint64(
val);
7361 if (wire_type == (
v & 0xff)) {
7362 d->pc =
d->top->base + (
v >> 16);
7364 }
else if (wire_type == ((
v >> 8) & 0xff)) {
7368 d->pc =
d->top->base + upb_value_getuint64(
val);
7409 #define VMCASE(op, code) \
7410 case op: { code; if (consumes_input(op)) checkpoint(d); break; }
7411 #define PRIMITIVE_OP(type, wt, name, convfunc, ctype) \
7412 VMCASE(OP_PARSE_ ## type, { \
7414 CHECK_RETURN(decode_ ## wt(d, &val)); \
7415 upb_sink_put ## name(d->top->sink, arg, (convfunc)(val)); \
7419 int32_t instruction;
7425 instruction = *
d->pc++;
7426 op =
getop(instruction);
7427 arg = instruction >> 8;
7431 #ifdef UPB_DUMP_BYTECODE
7432 fprintf(stderr,
"s_ofs=%d buf_ofs=%d data_rem=%d buf_rem=%d delim_rem=%d "
7435 (
int)(
d->ptr -
d->buf),
7436 (
int)(
d->data_end -
d->ptr),
7437 (
int)(
d->end -
d->ptr),
7438 (
int)((
d->top->end_ofs -
d->bufstart_ofs) - (
d->ptr -
d->buf)),
7439 (
int)(
d->pc - 1 -
group->bytecode),
7462 d->top->base =
d->pc - 1;
7463 memcpy(&
d->top->dispatch,
d->pc,
sizeof(
void*));
7464 d->pc +=
sizeof(
void*) /
sizeof(uint32_t);
7499 seterr(
d,
"Tried to skip past end of string.");
7502 int32_t ret =
skip(
d,
n);
7523 d->top->groupnum = *
d->pc++;
7543 if (
d->ptr ==
d->delim_end)
7547 d->callstack[
d->call_len++] =
d->pc;
7552 d->pc =
d->callstack[--
d->call_len];
7560 expected = (arg >> 8) & 0xff;
7561 if (*
d->ptr == expected) {
7578 expected = (arg >> 8) & 0xffff;
7581 memcpy(&actual,
d->ptr, 2);
7582 if (expected == actual) {
7590 if (result >= 0)
return result;
7596 memcpy(&expected,
d->pc, 8);
7600 if (result >= 0)
return result;
7606 return d->size_param;
7619 d->bufstart_ofs = 0;
7621 d->callstack[0] = &
halt;
7632 d->bufstart_ofs = 0;
7644 if (
d->residual_end >
d->residual) {
7645 seterr(
d,
"Unexpected EOF: decoder still has buffered unparsed data");
7650 seterr(
d,
"Unexpected EOF inside skipped data");
7655 seterr(
d,
"Unexpected EOF inside delimited string");
7661 d->top->end_ofs =
end;
7663 #ifdef UPB_USE_JIT_X64
7664 if (
method->is_native_) {
7666 if (
d->top !=
d->stack)
7667 d->stack->end_ofs = 0;
7672 const uint32_t *
p =
d->pc;
7673 d->stack->end_ofs =
end;
7675 if (
p !=
method->code_base.ptr)
p--;
7687 if (
d->call_len != 0) {
7688 seterr(
d,
"Unexpected EOF inside submessage or group");
7710 d->top->groupnum = 0;
7711 d->ptr =
d->residual;
7712 d->buf =
d->residual;
7713 d->end =
d->residual;
7714 d->residual_end =
d->residual;
7719 const size_t default_max_nesting = 64;
7725 if (!
d)
return NULL;
7730 if (!
d->stack || !
d->callstack) {
7735 d->limit =
d->stack + default_max_nesting - 1;
7736 d->stack_size = default_max_nesting;
7742 if (
d->method_->dest_handlers_) {
7743 if (sink.
handlers !=
d->method_->dest_handlers_)
7746 d->top->sink = sink;
7767 return d->stack_size;
7773 if (max < (
size_t)(
d->top -
d->stack)) {
7778 if (max >
d->stack_size) {
7796 d->stack_size = max;
7799 d->limit =
d->stack + max - 1;
7944 size_t old_size = e->
limit - e->
buf;
7946 size_t new_size = old_size;
7948 while (new_size < needed) {
7954 if (new_buf ==
NULL) {
7960 e->
limit = new_buf + new_size;
8030 size_t new_size = old_size * 2;
8034 if (new_buf ==
NULL) {
8068 const char *ptr = e->
buf;
8069 for (
s = e->
segbuf; s <= e->segptr;
s++) {
8138 memcpy(&ret, &
d,
sizeof(uint64_t));
8144 memcpy(&ret, &
d,
sizeof(uint32_t));
8154 if (e->
depth++ == 0) {
8164 if (--e->
depth == 0) {
8206 #define T(type, ctype, convert, encode) \
8207 static bool encode_scalar_##type(void *e, const void *hd, ctype val) { \
8208 return encode_tag(e, hd) && encode(e, (convert)(val)) && commit(e); \
8210 static bool encode_packed_##type(void *e, const void *hd, ctype val) { \
8212 return encode(e, (convert)(val)); \
8236 static void newhandlers_callback(
const void *closure,
upb_handlers *
h) {
8266 #define T(upper, lower, upbtype) \
8267 case UPB_DESCRIPTOR_TYPE_##upper: \
8269 upb_handlers_set##upbtype(h, f, encode_packed_##lower, &attr); \
8271 upb_handlers_set##upbtype(h, f, encode_scalar_##lower, &attr); \
8276 T(DOUBLE,
double,
double);
8277 T(FLOAT,
float,
float);
8282 T(BOOL,
bool,
bool);
8286 T(SFIXED32, sfixed32,
int32);
8287 T(SFIXED64, sfixed64,
int64);
8288 T(SINT32, sint32,
int32);
8289 T(SINT64, sint64,
int64);
8331 const size_t initial_bufsize = 256;
8332 const size_t initial_segbufsize = 16;
8334 const size_t stack_size = 64;
8340 if (!e)
return NULL;
8350 e->
limit = e->
buf + initial_bufsize;
8379 #include <inttypes.h>
8393 #define CHECK(x) if ((x) < 0) goto err;
8396 const char *last = strrchr(longname,
'.');
8397 return last ? last + 1 : longname;
8402 if (!
p->single_line_)
8403 for (
i = 0;
i <
p->indent_depth_;
i++)
8409 const char ch = (
p->single_line_ ?
' ' :
'\n');
8415 bool preserve_utf8) {
8417 char dstbuf[4096], *
dst = dstbuf, *dstend = dstbuf +
sizeof(dstbuf);
8422 const bool use_hex =
false;
8423 bool last_hex_escape =
false;
8428 if (dstend -
dst < 4) {
8433 is_hex_escape =
false;
8435 case '\n': *(
dst++) =
'\\'; *(
dst++) =
'n';
break;
8436 case '\r': *(
dst++) =
'\\'; *(
dst++) =
'r';
break;
8437 case '\t': *(
dst++) =
'\\'; *(
dst++) =
't';
break;
8438 case '\"': *(
dst++) =
'\\'; *(
dst++) =
'\"';
break;
8439 case '\'': *(
dst++) =
'\\'; *(
dst++) =
'\'';
break;
8440 case '\\': *(
dst++) =
'\\'; *(
dst++) =
'\\';
break;
8445 if ((!preserve_utf8 || (uint8_t)*
buf < 0x80) &&
8447 sprintf(
dst, (use_hex ?
"\\x%02x" :
"\\%03o"), (uint8_t)*
buf);
8448 is_hex_escape = use_hex;
8454 last_hex_escape = is_hex_escape;
8472 _upb_va_copy(args_copy,
args);
8473 len = _upb_vsnprintf(
NULL, 0,
fmt, args_copy);
8478 if (!
str)
return false;
8494 if (
p->indent_depth_ == 0) {
8504 if (
p->indent_depth_ == 0) {
8510 #define TYPE(name, ctype, fmt) \
8511 static bool textprinter_put ## name(void *closure, const void *handler_data, \
8513 upb_textprinter *p = closure; \
8514 const upb_fielddef *f = handler_data; \
8516 putf(p, "%s: " fmt, upb_fielddef_name(f), val); \
8517 CHECK(endfield(p)); \
8535 #define STRINGIFY_HELPER(x) #x
8536 #define STRINGIFY_MACROVAL(x) STRINGIFY_HELPER(x)
8559 if (!textprinter_putint32(closure, handler_data,
val))
8596 const char *
name = handler_data;
8598 putf(
p,
"%s {%c",
name,
p->single_line_ ?
' ' :
'\n');
8677 p->single_line_ = single_line;
8678 p->indent_depth_ = 0;
8687 if (!
p)
return NULL;
8703 p->single_line_ = single_line;
8736 const char *
p =
r.p;
8737 uint32_t low = (uint32_t)
r.val;
8740 b = *(
p++); low |= (
b & 0x7fU) << 14;
if (!(
b & 0x80))
goto done;
8741 b = *(
p++); low |= (
b & 0x7fU) << 21;
if (!(
b & 0x80))
goto done;
8742 b = *(
p++); low |= (
b & 0x7fU) << 28;
8743 high = (
b & 0x7fU) >> 4;
if (!(
b & 0x80))
goto done;
8744 b = *(
p++); high |= (
b & 0x7fU) << 3;
if (!(
b & 0x80))
goto done;
8745 b = *(
p++); high |= (
b & 0x7fU) << 10;
if (!(
b & 0x80))
goto done;
8746 b = *(
p++); high |= (
b & 0x7fU) << 17;
if (!(
b & 0x80))
goto done;
8747 b = *(
p++); high |= (
b & 0x7fU) << 24;
if (!(
b & 0x80))
goto done;
8748 b = *(
p++); high |= (
b & 0x7fU) << 31;
if (!(
b & 0x80))
goto done;
8752 r.val = ((uint64_t)high << 32) | low;
8759 const char *
p =
r.p;
8760 uint64_t
val =
r.val;
8763 b = *(
p++);
val |= (
b & 0x7fU) << 14;
if (!(
b & 0x80))
goto done;
8764 b = *(
p++);
val |= (
b & 0x7fU) << 21;
if (!(
b & 0x80))
goto done;
8765 b = *(
p++);
val |= (
b & 0x7fU) << 28;
if (!(
b & 0x80))
goto done;
8766 b = *(
p++);
val |= (
b & 0x7fU) << 35;
if (!(
b & 0x80))
goto done;
8767 b = *(
p++);
val |= (
b & 0x7fU) << 42;
if (!(
b & 0x80))
goto done;
8768 b = *(
p++);
val |= (
b & 0x7fU) << 49;
if (!(
b & 0x80))
goto done;
8769 b = *(
p++);
val |= (
b & 0x7fU) << 56;
if (!(
b & 0x80))
goto done;
8770 b = *(
p++);
val |= (
b & 0x7fU) << 63;
if (!(
b & 0x80))
goto done;
8779 #line 1 "upb/json/parser.rl"
8813 #define UPB_JSON_MAX_DEPTH 64
8872 size_t parse(
void *closure,
const void *hd,
const char *
buf,
size_t size,
8874 static bool end(
void *closure,
const void *hd);
8898 size_t new_size = sink->
size;
8903 while (sink->
len +
len > new_size) {
8907 if (new_size != sink->
size) {
8908 sink->
ptr = realloc(sink->
ptr, new_size);
8909 sink->
size = new_size;
8912 memcpy(sink->
ptr + sink->
len, ptr,
len);
8926 sink->
ptr = malloc(sink->
size);
9076 #define PARSER_CHECK_RETURN(x) if (!(x)) return false
9113 p->status,
p->ignore_json_unknown);
9177 if ((
p->top + 1) ==
p->limit) {
9193 method = upb_value_getconstptr(
v);
9202 if (SIZE_MAX -
a <
b)
return false;
9210 if (
b != 0 && ret /
b !=
a) {
9222 -1, -1, -1, -1, -1, -1, -1, -1,
9223 -1, -1, -1, -1, -1, -1, -1, -1,
9224 -1, -1, -1, -1, -1, -1, -1, -1,
9225 -1, -1, -1, -1, -1, -1, -1, -1,
9226 -1, -1, -1, -1, -1, -1, -1, -1,
9227 -1, -1, -1, 62, -1, -1, -1, 63,
9228 52, 53, 54, 55, 56, 57, 58, 59,
9229 60, 61, -1, -1, -1, -1, -1, -1,
9230 -1, 0, 1, 2, 3, 4, 5, 6,
9231 07, 8, 9, 10, 11, 12, 13, 14,
9232 15, 16, 17, 18, 19, 20, 21, 22,
9233 23, 24, 25, -1, -1, -1, -1, -1,
9234 -1, 26, 27, 28, 29, 30, 31, 32,
9235 33, 34, 35, 36, 37, 38, 39, 40,
9236 41, 42, 43, 44, 45, 46, 47, 48,
9237 49, 50, 51, -1, -1, -1, -1, -1,
9238 -1, -1, -1, -1, -1, -1, -1, -1,
9239 -1, -1, -1, -1, -1, -1, -1, -1,
9240 -1, -1, -1, -1, -1, -1, -1, -1,
9241 -1, -1, -1, -1, -1, -1, -1, -1,
9242 -1, -1, -1, -1, -1, -1, -1, -1,
9243 -1, -1, -1, -1, -1, -1, -1, -1,
9244 -1, -1, -1, -1, -1, -1, -1, -1,
9245 -1, -1, -1, -1, -1, -1, -1, -1,
9246 -1, -1, -1, -1, -1, -1, -1, -1,
9247 -1, -1, -1, -1, -1, -1, -1, -1,
9248 -1, -1, -1, -1, -1, -1, -1, -1,
9249 -1, -1, -1, -1, -1, -1, -1, -1,
9250 -1, -1, -1, -1, -1, -1, -1, -1,
9251 -1, -1, -1, -1, -1, -1, -1, -1,
9252 -1, -1, -1, -1, -1, -1, -1, -1,
9253 -1, -1, -1, -1, -1, -1, -1, -1
9267 const char *limit = ptr +
len;
9268 for (; ptr < limit; ptr += 4) {
9272 if (limit - ptr < 4) {
9274 "Base64 input for bytes field not a multiple of 4: %s",
9285 if (
val & 0x80000000) {
9300 "Non-base64 characters in bytes field: %s",
9303 }
if (ptr[2] ==
'=') {
9308 if (ptr[0] ==
'=' || ptr[1] ==
'=' || ptr[3] !=
'=') {
9324 if (ptr[0] ==
'=' || ptr[1] ==
'=' || ptr[2] ==
'=') {
9340 "Incorrect base64 padding for field: %s (%.*s)",
9373 p->accumulated =
NULL;
9374 p->accumulated_len = 0;
9380 size_t old_size =
p->accumulate_buf_size;
9381 size_t new_size =
UPB_MAX(old_size, 128);
9382 while (new_size < need) {
9392 p->accumulate_buf = mem;
9393 p->accumulate_buf_size = new_size;
9404 if (!
p->accumulated && can_alias) {
9405 p->accumulated =
buf;
9406 p->accumulated_len =
len;
9419 if (
p->accumulated !=
p->accumulate_buf) {
9420 memcpy(
p->accumulate_buf,
p->accumulated,
p->accumulated_len);
9421 p->accumulated =
p->accumulate_buf;
9424 memcpy(
p->accumulate_buf +
p->accumulated_len,
buf,
len);
9425 p->accumulated_len +=
len;
9434 *
len =
p->accumulated_len;
9435 return p->accumulated;
9481 p->string_selector = sel;
9486 switch (
p->multipart_state) {
9489 p->status,
"Internal error: unexpected state MULTIPART_INACTIVE");
9543 if (!
p->capture)
return;
9576 case 'r':
return '\r';
9577 case 't':
return '\t';
9578 case 'n':
return '\n';
9579 case 'f':
return '\f';
9580 case 'b':
return '\b';
9581 case '/':
return '/';
9582 case '"':
return '"';
9583 case '\\':
return '\\';
9604 if (
ch >=
'0' &&
ch <=
'9') {
9605 p->digit += (
ch -
'0');
9606 }
else if (
ch >=
'a' &&
ch <=
'f') {
9607 p->digit += ((
ch -
'a') + 10);
9610 p->digit += ((
ch -
'A') + 10);
9615 uint32_t codepoint =
p->digit;
9620 if (codepoint <= 0x7F) {
9621 utf8[0] = codepoint;
9623 }
else if (codepoint <= 0x07FF) {
9624 utf8[1] = (codepoint & 0x3F) | 0x80;
9626 utf8[0] = (codepoint & 0x1F) | 0xC0;
9629 utf8[2] = (codepoint & 0x3F) | 0x80;
9631 utf8[1] = (codepoint & 0x3F) | 0x80;
9633 utf8[0] = (codepoint & 0x0F) | 0xE0;
9683 if (
p->top->f ==
NULL) {
9719 size_t len = strlen(
buf);
9720 const char *bufend =
buf +
len;
9725 double inf = 1.0 / 0.0;
9729 if (
len == 0 ||
buf[0] ==
' ') {
9741 if (
errno == ERANGE ||
end != bufend) {
9751 unsigned long val = strtoul(
buf, &
end, 0);
9752 if (
end != bufend) {
9765 if (
errno == ERANGE ||
end != bufend) {
9773 unsigned long val = strtoul(
p->accumulated, &
end, 0);
9774 if (
end != bufend) {
9776 }
else if (
errno == ERANGE) {
9792 if (
len == strlen(
"Infinity") && strcmp(
buf,
"Infinity") == 0) {
9795 }
else if (
len == strlen(
"-Infinity") && strcmp(
buf,
"-Infinity") == 0) {
9799 if (
errno == ERANGE ||
end != bufend) {
9805 #define CASE(capitaltype, smalltype, ctype, min, max) \
9806 case UPB_TYPE_ ## capitaltype: { \
9807 if (modf(val, &dummy) != 0 || val > max || val < min) { \
9810 upb_sink_put ## smalltype(p->top->sink, parser_getsel(p), \
9863 if (
p->top->f ==
NULL) {
9869 "Boolean value specified for non-bool field: %s",
9901 if (
p->top->is_unknown_field) {
9929 const char *zero_ptr =
"0";
10004 if (
p->top->f ==
NULL) {
10009 if (
p->top->is_any) {
10024 inner->
m =
p->top->m;
10025 inner->
f =
p->top->f;
10049 "String specified for bool or submessage field: %s",
10063 inner =
p->top + 1;
10075 if (strncmp(
buf,
"type.googleapis.com/", 20) == 0 &&
len > 20) {
10081 if (payload_type ==
NULL) {
10083 p->status,
"Cannot find packed type: %.*s\n", (
int)
len,
buf);
10092 p->status,
"Invalid type url: %.*s\n", (
int)
len,
buf);
10106 if (
p->top->f ==
NULL) {
10111 if (
p->top->is_any) {
10118 p->accumulated,
p->accumulated_len)) {
10137 int32_t int_val = 0;
10142 upb_sink_putint32(
p->top->sink, sel, int_val);
10222 char seconds_buf[14];
10223 char nanos_buf[12];
10225 int64_t seconds = 0;
10228 const char *seconds_membername =
"seconds";
10229 const char *nanos_membername =
"nanos";
10230 size_t fraction_start;
10238 memset(seconds_buf, 0, 14);
10239 memset(nanos_buf, 0, 12);
10244 for (fraction_start = 0; fraction_start <
len &&
buf[fraction_start] !=
'.';
10248 memcpy(seconds_buf,
buf, fraction_start);
10249 seconds = strtol(seconds_buf, &
end, 10);
10250 if (
errno == ERANGE ||
end != seconds_buf + fraction_start) {
10256 if (seconds > 315576000000) {
10258 "maximum acceptable value is "
10263 if (seconds < -315576000000) {
10265 "minimum acceptable value is "
10271 nanos_buf[0] =
'0';
10272 memcpy(nanos_buf + 1,
buf + fraction_start,
len - fraction_start);
10273 val = strtod(nanos_buf, &
end);
10274 if (
errno == ERANGE ||
end != nanos_buf +
len - fraction_start + 1) {
10280 nanos =
val * 1000000000;
10281 if (seconds < 0) nanos = -nanos;
10399 memset(&
p->tm, 0,
sizeof(
struct tm));
10409 char nanos_buf[12];
10413 const char *nanos_membername =
"nanos";
10415 memset(nanos_buf, 0, 12);
10425 "error parsing timestamp: at most 9-digit fraction.");
10430 nanos_buf[0] =
'0';
10431 memcpy(nanos_buf + 1,
buf,
len);
10432 val = strtod(nanos_buf, &
end);
10434 if (
errno == ERANGE ||
end != nanos_buf +
len + 1) {
10440 nanos =
val * 1000000000;
10463 #define EPOCH_YEAR 1970
10464 #define TM_YEAR_BASE 1900
10467 return (year % 4) == 0 && (year % 100 != 0 || (year % 400) == 0);
10472 { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 },
10474 { 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 }
10477 int64_t
epoch(
int year,
int yday,
int hour,
int min,
int sec) {
10480 int64_t leap_days = years / 4 - years / 100 + years / 400;
10482 int64_t days = years * 365 + yday + leap_days;
10483 int64_t hours = days * 24 + hour;
10484 int64_t mins = hours * 60 + min;
10485 int64_t secs = mins * 60 + sec;
10491 int sec = tp->tm_sec;
10492 int min = tp->tm_min;
10493 int hour = tp->tm_hour;
10494 int mday = tp->tm_mday;
10495 int mon = tp->tm_mon;
10500 int yday = mon_yday + mday;
10502 return epoch(year, yday, hour, min, sec);
10510 const char *seconds_membername =
"seconds";
10518 if (
buf[0] !=
'Z') {
10519 if (sscanf(
buf + 1,
"%2d:00", &hours) != 1) {
10524 if (
buf[0] ==
'+') {
10528 p->tm.tm_hour += hours;
10535 if (seconds < -62135596800) {
10537 "minimum acceptable value is "
10538 "0001-01-01T00:00:00Z");
10578 inner->
m =
p->top->m;
10579 inner->
f =
p->top->f;
10588 const char *limit = ptr +
len;
10590 for (;ptr < limit; ptr++) {
10591 if (*ptr >=
'A' && *ptr <=
'Z' && !
first) {
10592 char lower = tolower(*ptr);
10608 p->accumulated,
p->accumulated_len)) {
10639 if (
p->top->f ==
NULL) {
10654 if (
len == 4 && !strncmp(
buf,
"true", 4)) {
10658 }
else if (
len == 5 && !strncmp(
buf,
"false", 5)) {
10664 "Map bool key not 'true' or 'false'");
10709 mapfield =
p->top->mapfield;
10713 p->top->f = mapfield;
10716 inner->
m = mapentrymsg;
10733 p->top->is_mapentry =
true;
10734 p->top->mapfield = mapfield;
10735 if (
p->top->f ==
NULL) {
10747 p->top->is_unknown_field =
true;
10752 if (
p->top->is_any) {
10754 }
else if (
p->top->is_map) {
10762 p->top->f = upb_value_getconstptr(
v);
10766 }
else if (
p->ignore_json_unknown) {
10767 p->top->is_unknown_field =
true;
10782 if (
len == 5 && strncmp(
buf,
"@type",
len) == 0) {
10784 p->top->f = upb_value_getconstptr(
v);
10788 p->top->is_unknown_field =
true;
10796 if (
p->top->is_mapentry) {
10804 mapfield =
p->top->mapfield;
10814 p->top->is_unknown_field =
false;
10828 if (
p->top->is_unknown_field) {
10869 p->top->is_any =
true;
10872 p->top->is_any =
false;
10873 p->top->any_frame =
NULL;
10879 "Object specified for non-message/group field: %s",
10914 if (
p->top->is_map) {
10921 bool is_unknown =
p->top->m ==
NULL;
10964 p->top->is_repeated)) {
10969 p->top->is_repeated)) {
10976 if (
p->top->is_unknown_field) {
10986 "Array specified for non-repeated field: %s",
10996 inner->
m =
p->top->m;
10997 inner->
f =
p->top->f;
11011 if (
p->top->is_unknown_field) {
11034 if (!
p->top->is_map &&
p->top->m !=
NULL) {
11040 if (!
p->top->is_map &&
p->top->m !=
NULL) {
11047 p->top->any_frame->before_type_url_start = ptr;
11048 p->top->any_frame->before_type_url_end = ptr;
11052 const char *value_membername =
"value";
11053 bool is_well_known_packed =
false;
11054 const char *packed_end = ptr + 1;
11067 is_well_known_packed =
true;
11070 p->top->any_frame->before_type_url_start =
11071 memchr(
p->top->any_frame->before_type_url_start,
':',
11072 p->top->any_frame->before_type_url_end -
11073 p->top->any_frame->before_type_url_start);
11074 if (
p->top->any_frame->before_type_url_start ==
NULL) {
11078 p->top->any_frame->before_type_url_start++;
11082 p->top->any_frame->after_type_url_start =
11083 memchr(
p->top->any_frame->after_type_url_start,
':',
11085 p->top->any_frame->after_type_url_start);
11086 if (
p->top->any_frame->after_type_url_start ==
NULL) {
11090 p->top->any_frame->after_type_url_start++;
11097 p->top->any_frame->before_type_url_start,
11098 p->top->any_frame->before_type_url_end -
11099 p->top->any_frame->before_type_url_start,
NULL)) {
11103 if (!is_well_known_packed) {
11119 p->top->any_frame->after_type_url_start,
11120 packed_end -
p->top->any_frame->after_type_url_start,
NULL)) {
11124 if (!is_well_known_packed) {
11131 if (!
end(
p->top->any_frame->parser,
NULL)) {
11135 p->top->is_any =
false;
11144 inner =
p->top + 1;
11150 p->top->any_frame->stringsink.len,
NULL);
11176 const char *membername =
"paths";
11196 const char *membername =
"value";
11213 const char *nullmember =
"null_value";
11214 const char *numbermember =
"number_value";
11215 const char *stringmember =
"string_value";
11216 const char *boolmember =
"bool_value";
11217 const char *structmember =
"struct_value";
11218 const char *listmember =
"list_value";
11219 const char *membername =
"";
11223 membername = nullmember;
11226 membername = numbermember;
11229 membername = stringmember;
11232 membername = boolmember;
11235 membername = structmember;
11238 membername = listmember;
11257 const char *membername =
"values";
11274 const char *membername =
"fields";
11291 return p->top ==
p->stack &&
p->top->f ==
NULL && !
p->top->is_unknown_field;
11299 return p->top->f !=
NULL &&
11306 return p->top->f !=
NULL &&
11320 return p->top->f !=
NULL &&
11334 return p->top->f !=
NULL &&
11343 #define CHECK_RETURN_TOP(x) if (!(x)) goto error
11364 #line 2749 "upb/json/parser.rl"
11368 #line 2552 "upb/json/parser.c"
11370 0, 1, 0, 1, 1, 1, 3, 1,
11371 4, 1, 6, 1, 7, 1, 8, 1,
11372 9, 1, 11, 1, 12, 1, 13, 1,
11373 14, 1, 15, 1, 16, 1, 17, 1,
11374 18, 1, 19, 1, 20, 1, 22, 1,
11375 23, 1, 24, 1, 35, 1, 37, 1,
11376 39, 1, 40, 1, 42, 1, 43, 1,
11377 44, 1, 46, 1, 48, 1, 49, 1,
11378 50, 1, 51, 1, 53, 1, 54, 2,
11379 4, 9, 2, 5, 6, 2, 7, 3,
11380 2, 7, 9, 2, 21, 26, 2, 25,
11381 10, 2, 27, 28, 2, 29, 30, 2,
11382 32, 34, 2, 33, 31, 2, 38, 36,
11383 2, 40, 42, 2, 45, 2, 2, 46,
11384 54, 2, 47, 36, 2, 49, 54, 2,
11385 50, 54, 2, 51, 54, 2, 52, 41,
11386 2, 53, 54, 3, 32, 34, 35, 4,
11391 0, 0, 12, 13, 18, 23, 28, 29,
11392 30, 31, 32, 33, 34, 35, 36, 37,
11393 38, 43, 44, 48, 53, 58, 63, 67,
11394 71, 74, 77, 79, 83, 87, 89, 91,
11395 96, 98, 100, 109, 115, 121, 127, 133,
11396 135, 139, 142, 144, 146, 149, 150, 154,
11397 156, 158, 160, 162, 163, 165, 167, 168,
11398 170, 172, 173, 175, 177, 178, 180, 182,
11399 183, 185, 187, 191, 193, 195, 196, 197,
11400 198, 199, 201, 206, 208, 210, 212, 221,
11401 222, 222, 222, 227, 232, 237, 238, 239,
11402 240, 241, 241, 242, 243, 244, 244, 245,
11403 246, 247, 247, 252, 253, 257, 262, 267,
11404 272, 276, 276, 279, 282, 285, 288, 291,
11405 294, 294, 294, 294, 294, 294
11409 32, 34, 45, 91, 102, 110, 116, 123,
11410 9, 13, 48, 57, 34, 32, 93, 125,
11411 9, 13, 32, 44, 93, 9, 13, 32,
11412 93, 125, 9, 13, 97, 108, 115, 101,
11413 117, 108, 108, 114, 117, 101, 32, 34,
11414 125, 9, 13, 34, 32, 58, 9, 13,
11415 32, 93, 125, 9, 13, 32, 44, 125,
11416 9, 13, 32, 44, 125, 9, 13, 32,
11417 34, 9, 13, 45, 48, 49, 57, 48,
11418 49, 57, 46, 69, 101, 48, 57, 69,
11419 101, 48, 57, 43, 45, 48, 57, 48,
11420 57, 48, 57, 46, 69, 101, 48, 57,
11421 34, 92, 34, 92, 34, 47, 92, 98,
11422 102, 110, 114, 116, 117, 48, 57, 65,
11423 70, 97, 102, 48, 57, 65, 70, 97,
11424 102, 48, 57, 65, 70, 97, 102, 48,
11425 57, 65, 70, 97, 102, 34, 92, 45,
11426 48, 49, 57, 48, 49, 57, 46, 115,
11427 48, 57, 115, 48, 57, 34, 46, 115,
11428 48, 57, 48, 57, 48, 57, 48, 57,
11429 48, 57, 45, 48, 57, 48, 57, 45,
11430 48, 57, 48, 57, 84, 48, 57, 48,
11431 57, 58, 48, 57, 48, 57, 58, 48,
11432 57, 48, 57, 43, 45, 46, 90, 48,
11433 57, 48, 57, 58, 48, 48, 34, 48,
11434 57, 43, 45, 90, 48, 57, 34, 44,
11435 34, 44, 34, 44, 34, 45, 91, 102,
11436 110, 116, 123, 48, 57, 34, 32, 93,
11437 125, 9, 13, 32, 44, 93, 9, 13,
11438 32, 93, 125, 9, 13, 97, 108, 115,
11439 101, 117, 108, 108, 114, 117, 101, 32,
11440 34, 125, 9, 13, 34, 32, 58, 9,
11441 13, 32, 93, 125, 9, 13, 32, 44,
11442 125, 9, 13, 32, 44, 125, 9, 13,
11443 32, 34, 9, 13, 32, 9, 13, 32,
11444 9, 13, 32, 9, 13, 32, 9, 13,
11445 32, 9, 13, 32, 9, 13, 0
11449 0, 8, 1, 3, 3, 3, 1, 1,
11450 1, 1, 1, 1, 1, 1, 1, 1,
11451 3, 1, 2, 3, 3, 3, 2, 2,
11452 1, 3, 0, 2, 2, 0, 0, 3,
11453 2, 2, 9, 0, 0, 0, 0, 2,
11454 2, 1, 2, 0, 1, 1, 2, 0,
11455 0, 0, 0, 1, 0, 0, 1, 0,
11456 0, 1, 0, 0, 1, 0, 0, 1,
11457 0, 0, 4, 0, 0, 1, 1, 1,
11458 1, 0, 3, 2, 2, 2, 7, 1,
11459 0, 0, 3, 3, 3, 1, 1, 1,
11460 1, 0, 1, 1, 1, 0, 1, 1,
11461 1, 0, 3, 1, 2, 3, 3, 3,
11462 2, 0, 1, 1, 1, 1, 1, 1,
11467 0, 2, 0, 1, 1, 1, 0, 0,
11468 0, 0, 0, 0, 0, 0, 0, 0,
11469 1, 0, 1, 1, 1, 1, 1, 1,
11470 1, 0, 1, 1, 1, 1, 1, 1,
11471 0, 0, 0, 3, 3, 3, 3, 0,
11472 1, 1, 0, 1, 1, 0, 1, 1,
11473 1, 1, 1, 0, 1, 1, 0, 1,
11474 1, 0, 1, 1, 0, 1, 1, 0,
11475 1, 1, 0, 1, 1, 0, 0, 0,
11476 0, 1, 1, 0, 0, 0, 1, 0,
11477 0, 0, 1, 1, 1, 0, 0, 0,
11478 0, 0, 0, 0, 0, 0, 0, 0,
11479 0, 0, 1, 0, 1, 1, 1, 1,
11480 1, 0, 1, 1, 1, 1, 1, 1,
11485 0, 0, 11, 13, 18, 23, 28, 30,
11486 32, 34, 36, 38, 40, 42, 44, 46,
11487 48, 53, 55, 59, 64, 69, 74, 78,
11488 82, 85, 89, 91, 95, 99, 101, 103,
11489 108, 111, 114, 124, 128, 132, 136, 140,
11490 143, 147, 150, 153, 155, 158, 160, 164,
11491 166, 168, 170, 172, 174, 176, 178, 180,
11492 182, 184, 186, 188, 190, 192, 194, 196,
11493 198, 200, 202, 207, 209, 211, 213, 215,
11494 217, 219, 221, 226, 229, 232, 235, 244,
11495 246, 247, 248, 253, 258, 263, 265, 267,
11496 269, 271, 272, 274, 276, 278, 279, 281,
11497 283, 285, 286, 291, 293, 297, 302, 307,
11498 312, 316, 317, 320, 323, 326, 329, 332,
11499 335, 336, 337, 338, 339, 340
11503 0, 2, 3, 4, 5, 6, 7, 8,
11504 0, 3, 1, 9, 1, 11, 12, 1,
11505 11, 10, 13, 14, 12, 13, 1, 14,
11506 1, 1, 14, 10, 15, 1, 16, 1,
11507 17, 1, 18, 1, 19, 1, 20, 1,
11508 21, 1, 22, 1, 23, 1, 24, 1,
11509 25, 26, 27, 25, 1, 28, 1, 29,
11510 30, 29, 1, 30, 1, 1, 30, 31,
11511 32, 33, 34, 32, 1, 35, 36, 27,
11512 35, 1, 36, 26, 36, 1, 37, 38,
11513 39, 1, 38, 39, 1, 41, 42, 42,
11514 40, 43, 1, 42, 42, 43, 40, 44,
11515 44, 45, 1, 45, 1, 45, 40, 41,
11516 42, 42, 39, 40, 47, 48, 46, 50,
11517 51, 49, 52, 52, 52, 52, 52, 52,
11518 52, 52, 53, 1, 54, 54, 54, 1,
11519 55, 55, 55, 1, 56, 56, 56, 1,
11520 57, 57, 57, 1, 59, 60, 58, 61,
11521 62, 63, 1, 64, 65, 1, 66, 67,
11522 1, 68, 1, 67, 68, 1, 69, 1,
11523 66, 67, 65, 1, 70, 1, 71, 1,
11524 72, 1, 73, 1, 74, 1, 75, 1,
11525 76, 1, 77, 1, 78, 1, 79, 1,
11526 80, 1, 81, 1, 82, 1, 83, 1,
11527 84, 1, 85, 1, 86, 1, 87, 1,
11528 88, 1, 89, 89, 90, 91, 1, 92,
11529 1, 93, 1, 94, 1, 95, 1, 96,
11530 1, 97, 1, 98, 1, 99, 99, 100,
11531 98, 1, 102, 1, 101, 104, 105, 103,
11532 1, 1, 101, 106, 107, 108, 109, 110,
11533 111, 112, 107, 1, 113, 1, 114, 115,
11534 117, 118, 1, 117, 116, 119, 120, 118,
11535 119, 1, 120, 1, 1, 120, 116, 121,
11536 1, 122, 1, 123, 1, 124, 1, 125,
11537 126, 1, 127, 1, 128, 1, 129, 130,
11538 1, 131, 1, 132, 1, 133, 134, 135,
11539 136, 134, 1, 137, 1, 138, 139, 138,
11540 1, 139, 1, 1, 139, 140, 141, 142,
11541 143, 141, 1, 144, 145, 136, 144, 1,
11542 145, 135, 145, 1, 146, 147, 147, 1,
11543 148, 148, 1, 149, 149, 1, 150, 150,
11544 1, 151, 151, 1, 152, 152, 1, 1,
11549 1, 0, 2, 107, 3, 6, 10, 13,
11550 16, 106, 4, 3, 106, 4, 5, 7,
11551 8, 9, 108, 11, 12, 109, 14, 15,
11552 110, 16, 17, 111, 18, 18, 19, 20,
11553 21, 22, 111, 21, 22, 24, 25, 31,
11554 112, 26, 28, 27, 29, 30, 33, 113,
11555 34, 33, 113, 34, 32, 35, 36, 37,
11556 38, 39, 33, 113, 34, 41, 42, 46,
11557 42, 46, 43, 45, 44, 114, 48, 49,
11558 50, 51, 52, 53, 54, 55, 56, 57,
11559 58, 59, 60, 61, 62, 63, 64, 65,
11560 66, 67, 73, 72, 68, 69, 70, 71,
11561 72, 115, 74, 67, 72, 76, 116, 76,
11562 116, 77, 79, 81, 82, 85, 90, 94,
11563 98, 80, 117, 117, 83, 82, 80, 83,
11564 84, 86, 87, 88, 89, 117, 91, 92,
11565 93, 117, 95, 96, 97, 117, 98, 99,
11566 105, 100, 100, 101, 102, 103, 104, 105,
11567 103, 104, 117, 106, 106, 106, 106, 106,
11572 0, 0, 113, 107, 53, 0, 0, 0,
11573 125, 59, 45, 0, 55, 0, 0, 0,
11574 0, 0, 0, 0, 0, 0, 0, 0,
11575 0, 0, 101, 51, 47, 0, 0, 45,
11576 49, 49, 104, 0, 0, 0, 0, 0,
11577 3, 0, 0, 0, 0, 0, 5, 15,
11578 0, 0, 71, 7, 13, 0, 74, 9,
11579 9, 9, 77, 80, 11, 37, 37, 37,
11580 0, 0, 0, 39, 0, 41, 86, 0,
11581 0, 0, 17, 19, 0, 21, 23, 0,
11582 25, 27, 0, 29, 31, 0, 33, 35,
11583 0, 135, 83, 135, 0, 0, 0, 0,
11584 0, 92, 0, 89, 89, 98, 43, 0,
11585 131, 95, 113, 107, 53, 0, 0, 0,
11586 125, 59, 69, 110, 45, 0, 55, 0,
11587 0, 0, 0, 0, 0, 119, 0, 0,
11588 0, 122, 0, 0, 0, 116, 0, 101,
11589 51, 47, 0, 0, 45, 49, 49, 104,
11590 0, 0, 128, 0, 57, 63, 65, 61,
11595 0, 0, 0, 0, 0, 0, 0, 0,
11596 0, 0, 0, 0, 0, 0, 0, 0,
11597 0, 0, 0, 0, 0, 0, 0, 0,
11598 0, 1, 0, 1, 0, 0, 1, 1,
11599 0, 0, 0, 0, 0, 0, 0, 0,
11600 0, 0, 0, 0, 0, 0, 0, 0,
11601 0, 0, 0, 0, 0, 0, 0, 0,
11602 0, 0, 0, 0, 0, 0, 0, 0,
11603 0, 0, 0, 0, 0, 0, 0, 0,
11604 0, 0, 0, 0, 0, 0, 0, 0,
11605 0, 0, 0, 0, 0, 0, 0, 0,
11606 0, 0, 0, 0, 0, 0, 0, 0,
11607 0, 0, 0, 0, 0, 0, 0, 0,
11608 0, 0, 0, 57, 63, 65, 61, 67,
11623 #line 2752 "upb/json/parser.rl"
11630 int cs =
parser->current_state;
11631 int *stack =
parser->parser_stack;
11634 const char *
p =
buf;
11636 const char *eof = &
eof_ch;
11638 parser->handle = handle;
11646 #line 2830 "upb/json/parser.c"
11649 unsigned int _trans;
11651 unsigned int _nacts;
11664 const char *_lower = _keys;
11666 const char *_upper = _keys + _klen - 1;
11668 if ( _upper < _lower )
11671 _mid = _lower + ((_upper-_lower) >> 1);
11672 if ( (*
p) < *_mid )
11674 else if ( (*
p) > *_mid )
11677 _trans += (
unsigned int)(_mid - _keys);
11687 const char *_lower = _keys;
11689 const char *_upper = _keys + (_klen<<1) - 2;
11691 if ( _upper < _lower )
11694 _mid = _lower + (((_upper-_lower) >> 1) & ~1);
11695 if ( (*
p) < _mid[0] )
11697 else if ( (*
p) > _mid[1] )
11700 _trans += (
unsigned int)((_mid - _keys)>>1);
11715 _nacts = (
unsigned int) *_acts++;
11716 while ( _nacts-- > 0 )
11718 switch ( *_acts++ )
11721 #line 2557 "upb/json/parser.rl"
11722 {
p--; {cs = stack[--
top];
goto _again;} }
11725 #line 2559 "upb/json/parser.rl"
11726 {
p--; {stack[
top++] = cs; cs = 23;
goto _again;} }
11729 #line 2563 "upb/json/parser.rl"
11733 #line 2564 "upb/json/parser.rl"
11737 #line 2570 "upb/json/parser.rl"
11741 #line 2571 "upb/json/parser.rl"
11745 #line 2572 "upb/json/parser.rl"
11749 #line 2578 "upb/json/parser.rl"
11753 #line 2584 "upb/json/parser.rl"
11754 {
p--; {cs = stack[--
top];
goto _again;} }
11757 #line 2589 "upb/json/parser.rl"
11761 #line 2590 "upb/json/parser.rl"
11765 #line 2594 "upb/json/parser.rl"
11769 #line 2595 "upb/json/parser.rl"
11773 #line 2599 "upb/json/parser.rl"
11777 #line 2600 "upb/json/parser.rl"
11781 #line 2604 "upb/json/parser.rl"
11785 #line 2605 "upb/json/parser.rl"
11789 #line 2609 "upb/json/parser.rl"
11793 #line 2610 "upb/json/parser.rl"
11797 #line 2614 "upb/json/parser.rl"
11801 #line 2615 "upb/json/parser.rl"
11805 #line 2620 "upb/json/parser.rl"
11809 #line 2621 "upb/json/parser.rl"
11813 #line 2623 "upb/json/parser.rl"
11814 {
p--; {cs = stack[--
top];
goto _again;} }
11817 #line 2628 "upb/json/parser.rl"
11821 #line 2630 "upb/json/parser.rl"
11825 #line 2631 "upb/json/parser.rl"
11829 #line 2633 "upb/json/parser.rl"
11833 #line 2634 "upb/json/parser.rl"
11837 #line 2636 "upb/json/parser.rl"
11838 {
p--; {cs = stack[--
top];
goto _again;} }
11841 #line 2641 "upb/json/parser.rl"
11845 #line 2642 "upb/json/parser.rl"
11849 #line 2647 "upb/json/parser.rl"
11853 #line 2648 "upb/json/parser.rl"
11857 #line 2654 "upb/json/parser.rl"
11858 {
p--; {cs = stack[--
top];
goto _again;} }
11861 #line 2659 "upb/json/parser.rl"
11864 {stack[
top++] = cs; cs = 47;
goto _again;}
11866 {stack[
top++] = cs; cs = 40;
goto _again;}
11868 {stack[
top++] = cs; cs = 75;
goto _again;}
11870 {stack[
top++] = cs; cs = 32;
goto _again;}
11875 #line 2672 "upb/json/parser.rl"
11876 {
p--; {stack[
top++] = cs; cs = 78;
goto _again;} }
11879 #line 2677 "upb/json/parser.rl"
11889 #line 2684 "upb/json/parser.rl"
11893 #line 2687 "upb/json/parser.rl"
11903 #line 2698 "upb/json/parser.rl"
11913 #line 2707 "upb/json/parser.rl"
11923 #line 2719 "upb/json/parser.rl"
11927 #line 2723 "upb/json/parser.rl"
11931 #line 2728 "upb/json/parser.rl"
11935 #line 2729 "upb/json/parser.rl"
11939 #line 2731 "upb/json/parser.rl"
11943 #line 2732 "upb/json/parser.rl"
11947 #line 2734 "upb/json/parser.rl"
11951 #line 2736 "upb/json/parser.rl"
11955 #line 2738 "upb/json/parser.rl"
11959 #line 2740 "upb/json/parser.rl"
11963 #line 2741 "upb/json/parser.rl"
11967 #line 2746 "upb/json/parser.rl"
11968 {
p--; {cs = stack[--
top];
goto _again;} }
11970 #line 3154 "upb/json/parser.c"
11983 unsigned int __nacts = (
unsigned int) *__acts++;
11984 while ( __nacts-- > 0 ) {
11985 switch ( *__acts++ ) {
11987 #line 2555 "upb/json/parser.rl"
11988 {
p--; {cs = stack[--
top];
if (
p == pe )
11993 #line 2729 "upb/json/parser.rl"
11997 #line 2734 "upb/json/parser.rl"
12001 #line 2736 "upb/json/parser.rl"
12005 #line 2738 "upb/json/parser.rl"
12009 #line 2741 "upb/json/parser.rl"
12012 #line 3196 "upb/json/parser.c"
12020 #line 2774 "upb/json/parser.rl"
12030 parser->current_state = cs;
12036 static bool end(
void *closure,
const void *hd) {
12051 return parser->current_state >= 106;
12063 #line 3247 "upb/json/parser.c"
12069 #line 2816 "upb/json/parser.rl"
12070 p->current_state = cs;
12071 p->parser_top =
top;
12075 p->accumulated =
NULL;
12132 if (!
p)
return false;
12136 p->status = status;
12138 p->accumulate_buf =
NULL;
12139 p->accumulate_buf_size = 0;
12146 p->top->is_any =
true;
12149 p->top->is_any =
false;
12150 p->top->any_frame =
NULL;
12200 return upb_value_getconstptr(
v);
12204 v = upb_value_constptr(
m);
12206 if (!
m)
return NULL;
12221 if (!sub_method)
return NULL;
12234 #include <stdint.h>
12235 #include <string.h>
12283 bool preserve_fieldnames) {
12286 if (preserve_fieldnames) {
12288 ret->
len = strlen(ret->
ptr);
12321 if (!
p->first_elem_[
p->depth_]) {
12324 p->first_elem_[
p->depth_] =
false;
12334 unsigned char uc = (
unsigned char)c;
12340 case '"':
return "\\\"";
12341 case '\\':
return "\\\\";
12342 case '\b':
return "\\b";
12343 case '\f':
return "\\f";
12344 case '\n':
return "\\n";
12345 case '\r':
return "\\r";
12346 case '\t':
return "\\t";
12347 default:
return NULL;
12355 const char* unescaped_run =
NULL;
12357 for (
i = 0;
i <
len;
i++) {
12365 char escape_buf[8];
12367 unsigned char byte = (
unsigned char)c;
12368 _upb_snprintf(escape_buf,
sizeof(escape_buf),
"\\u%04x", (
int)
byte);
12377 if (unescaped_run) {
12379 unescaped_run =
NULL;
12385 if (unescaped_run ==
NULL) {
12386 unescaped_run = &
buf[
i];
12392 if (unescaped_run) {
12397 #define CHKLENGTH(x) if (!(x)) return -1;
12404 const char inf[] =
"\"Infinity\"";
12407 if (
val == (1.0 / 0.0)) {
12410 return strlen(
inf);
12411 }
else if (
val == (-1.0 / 0.0)) {
12429 size_t n = _upb_snprintf(
buf,
length,
"%s", (
val ?
"true" :
"false"));
12462 static bool putkey(
void *closure,
const void *handler_data) {
12472 #define CHKFMT(val) if ((val) == (size_t)-1) return false;
12473 #define CHK(val) if (!(val)) return false;
12475 #define TYPE_HANDLERS(type, fmt_func) \
12476 static bool put##type(void *closure, const void *handler_data, type val) { \
12477 upb_json_printer *p = closure; \
12479 size_t length = fmt_func(val, data, sizeof(data)); \
12480 UPB_UNUSED(handler_data); \
12482 print_data(p, data, length); \
12485 static bool scalar_##type(void *closure, const void *handler_data, \
12487 CHK(putkey(closure, handler_data)); \
12488 CHK(put##type(closure, handler_data, val)); \
12491 static bool repeated_##type(void *closure, const void *handler_data, \
12493 upb_json_printer *p = closure; \
12495 CHK(put##type(closure, handler_data, val)); \
12499 #define TYPE_HANDLERS_MAPKEY(type, fmt_func) \
12500 static bool putmapkey_##type(void *closure, const void *handler_data, \
12502 upb_json_printer *p = closure; \
12504 size_t length = fmt_func(val, data, sizeof(data)); \
12505 UPB_UNUSED(handler_data); \
12506 print_data(p, "\"", 1); \
12507 print_data(p, data, length); \
12508 print_data(p, "\":", 2); \
12527 #undef TYPE_HANDLERS
12528 #undef TYPE_HANDLERS_MAPKEY
12539 const char *symbolic_name;
12544 if (symbolic_name) {
12546 putstring(
p, symbolic_name, strlen(symbolic_name));
12549 putint32_t(closure,
NULL,
val);
12559 if (symbolic_name) {
12561 putstring(
p, symbolic_name, strlen(symbolic_name));
12602 p->first_elem_[
p->depth_] =
true;
12614 if (
p->depth_ == 0) {
12626 if (
p->depth_ == 0) {
12632 static void *
startseq(
void *closure,
const void *handler_data) {
12636 p->first_elem_[
p->depth_] =
true;
12641 static bool endseq(
void *closure,
const void *handler_data) {
12649 static void *
startmap(
void *closure,
const void *handler_data) {
12653 p->first_elem_[
p->depth_] =
true;
12658 static bool endmap(
void *closure,
const void *handler_data) {
12666 static size_t putstr(
void *closure,
const void *handler_data,
const char *
str,
12676 static size_t putbytes(
void *closure,
const void *handler_data,
const char *
str,
12681 static const char base64[] =
12682 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
12686 const char *limit =
data +
sizeof(
data);
12687 const unsigned char *from = (
const unsigned char*)
str;
12689 size_t remaining =
len;
12697 while (remaining > 2) {
12698 if (limit - to < 4) {
12704 to[0] =
base64[from[0] >> 2];
12705 to[1] =
base64[((from[0] & 0x3) << 4) | (from[1] >> 4)];
12706 to[2] =
base64[((from[1] & 0xf) << 2) | (from[2] >> 6)];
12707 to[3] =
base64[from[2] & 0x3f];
12714 switch (remaining) {
12716 to[0] =
base64[from[0] >> 2];
12717 to[1] =
base64[((from[0] & 0x3) << 4) | (from[1] >> 4)];
12718 to[2] =
base64[(from[1] & 0xf) << 2];
12724 to[0] =
base64[from[0] >> 2];
12725 to[1] =
base64[((from[0] & 0x3) << 4)];
12740 size_t size_hint) {
12750 const char *
str,
size_t len,
12764 size_t size_hint) {
12774 const char *
str,
size_t len,
12788 size_t size_hint) {
12797 const char *
str,
size_t len,
12818 const char *
str,
size_t len,
12826 const char *
str,
size_t len,
12835 const char *
str,
size_t len,
12845 bool preserve_fieldnames,
12941 set_enum_hd(
h, value_field, preserve_fieldnames, &enum_attr);
12955 p->seconds = seconds;
12960 static bool putnanos(
void *closure,
const void *handler_data,
12969 size_t size_hint) {
12978 const char *
str,
size_t len,
12993 p->first_elem_[
p->depth_] =
true;
13002 p->first_elem_[
p->depth_] =
true;
13014 void *closure,
const void *handler_data,
13015 size_t size_hint) {
13024 void *closure,
const void *handler_data,
13025 const char *
str,
size_t len,
13027 const char* limit =
str +
len;
13028 bool upper =
false;
13029 size_t result_len = 0;
13030 for (;
str < limit;
str++) {
13035 if (upper && *
str >=
'a' && *
str <=
'z') {
13036 char upper_char = toupper(*
str);
13037 CHK(
putstr(closure, handler_data, &upper_char, 1, handle));
13051 p->first_elem_[
p->depth_] =
true;
13056 static bool putnull(
void *closure,
const void *handler_data,
13068 if (
p->depth_ == 0) {
13074 #define UPB_DURATION_MAX_JSON_LEN 23
13075 #define UPB_DURATION_MAX_NANO_LEN 9
13087 if (
p->seconds < -315576000000) {
13089 "minimum acceptable value is "
13094 if (
p->seconds > 315576000000) {
13096 "maximum acceptable value is "
13101 _upb_snprintf(
buffer,
sizeof(
buffer),
"%ld", (
long)
p->seconds);
13102 base_len = strlen(
buffer);
13104 if (
p->nanos != 0) {
13106 _upb_snprintf(nanos_buffer,
sizeof(nanos_buffer),
"%.9f",
13107 p->nanos / 1000000000.0);
13110 nanos_buffer[
i] ==
'0';
i--) {
13111 nanos_buffer[
i] = 0;
13113 strcpy(
buffer + base_len, nanos_buffer + 1);
13117 strcpy(
buffer + curr,
"s");
13126 if (
p->depth_ == 0) {
13137 if (
p->depth_ == 0) {
13143 #define UPB_TIMESTAMP_MAX_JSON_LEN 31
13144 #define UPB_TIMESTAMP_BEFORE_NANO_LEN 19
13145 #define UPB_TIMESTAMP_MAX_NANO_LEN 9
13151 time_t time =
p->seconds;
13154 size_t year_length =
13157 if (
p->seconds < -62135596800) {
13159 "minimum acceptable value is "
13160 "0001-01-01T00:00:00Z");
13164 if (
p->seconds > 253402300799) {
13166 "maximum acceptable value is "
13167 "9999-12-31T23:59:59Z");
13172 for (
i = 0;
i < 4 - year_length;
i++) {
13177 "%Y-%m-%dT%H:%M:%S", gmtime(&time));
13178 if (
p->nanos != 0) {
13180 _upb_snprintf(nanos_buffer,
sizeof(nanos_buffer),
"%.9f",
13181 p->nanos / 1000000000.0);
13184 nanos_buffer[
i] ==
'0';
i--) {
13185 nanos_buffer[
i] = 0;
13191 strcpy(
buffer + curr,
"Z");
13200 if (
p->depth_ == 0) {
13212 if (
p->depth_ == 0) {
13219 void *closure,
const void *handler_data,
upb_status *s) {
13223 if (
p->depth_ == 0) {
13230 void *closure,
const void *handler_data) {
13233 if (
p->depth_ == 0) {
13241 void *closure,
const void *handler_data,
upb_status *s) {
13246 if (
p->depth_ == 0) {
13253 void *closure,
const void *handler_data,
size_t size_hint) {
13392 #define WRAPPER_SETHANDLERS(wrapper, type, putmethod) \
13393 void printer_sethandlers_##wrapper(const void *closure, upb_handlers *h) { \
13394 const upb_msgdef *md = upb_handlers_msgdef(h); \
13395 const upb_fielddef* f = upb_msgdef_itof(md, 1); \
13396 upb_handlerattr empty_attr = UPB_HANDLERATTR_INIT; \
13397 upb_handlers_setstartmsg(h, printer_startmsg_noframe, &empty_attr); \
13398 upb_handlers_setendmsg(h, printer_endmsg_noframe, &empty_attr); \
13399 upb_handlers_set##type(h, f, putmethod, &empty_attr); \
13400 UPB_UNUSED(closure); \
13413 #undef WRAPPER_SETHANDLERS
13488 #define WRAPPER(wellknowntype, name) \
13489 case wellknowntype: \
13490 printer_sethandlers_##name(closure, h); \
13509 #define TYPE(type, name, ctype) \
13511 if (upb_fielddef_isseq(f)) { \
13512 upb_handlers_set##name(h, f, repeated_##ctype, &empty_attr); \
13514 upb_handlers_set##name(h, f, scalar_##ctype, &name_attr); \
13603 if (!
p)
return NULL;
13632 #undef UPB_FIELD_AT
13633 #undef UPB_READ_ONEOF
13634 #undef UPB_WRITE_ONEOF
bool upb_pbdecoder_end(void *closure, const void *handler_data)
bool upb_double_handlerfunc(void *c, const void *hd, double val)
static bool putkey(void *closure, const void *handler_data)
bool upb_strtable_resize(upb_strtable *t, size_t size_lg2, upb_alloc *a)
const UPB_INLINE google_protobuf_OneofDescriptorProto *const * google_protobuf_DescriptorProto_oneof_decl(const google_protobuf_DescriptorProto *msg, size_t *len)
size_t upb_pbdecoder_decode(void *decoder, const void *group, const char *buf, size_t size, const upb_bufhandle *handle)
static bool is_string_wrapper_object(upb_json_parser *p)
UPB_INLINE upb_decoderet upb_vdecode_fast(const char *p)
int32_t upb_enum_iter_number(upb_enum_iter *iter)
upb_bytessink upb_pbdecoder_input(upb_pbdecoder *d)
static bool json_parser_any_frame_has_type_url(upb_jsonparser_any_frame *frame)
static bool create_fielddef(const symtab_addctx *ctx, const char *prefix, upb_msgdef *m, const google_protobuf_FieldDescriptorProto *field_proto)
struct google_protobuf_OneofDescriptorProto google_protobuf_OneofDescriptorProto
#define PTR_AT(msg, ofs, type)
upb_sink upb_pb_encoder_input(upb_pb_encoder *e)
static const upb_enumdef enums[5]
const upb_msglayout google_protobuf_FileDescriptorSet_msginit
struct google_protobuf_DescriptorProto google_protobuf_DescriptorProto
uint32_t upb_oneofdef_index(const upb_oneofdef *o)
void upb_mapiter_begin(upb_mapiter *i, const upb_map *map)
static upb_selector_t parser_getsel(upb_json_parser *p)
static bool lookup(const upb_table *t, lookupkey_t key, upb_value *v, uint32_t hash, eqlfunc_t *eql)
size_t upb_arena_bytesallocated(const upb_arena *a)
const upb_enumdef * enums
static void start_month(upb_json_parser *p, const char *ptr)
#define UPB_MAX_HANDLER_DEPTH
upb_handlercache * encoder_handlercache
int64_t upb_fielddef_defaultint64(const upb_fielddef *f)
uint64_t upb_fielddef_defaultuint64(const upb_fielddef *f)
static bool start_any_stringval(upb_json_parser *p)
bool upb_inttable_init2(upb_inttable *t, upb_ctype_t ctype, upb_alloc *a)
bool upb_int32_handlerfunc(void *c, const void *hd, int32_t val)
const upb_filedef * upb_filedef_dep(const upb_filedef *f, int i)
const uint8_t upb_desctype_to_fieldtype[]
static void end_member(upb_json_parser *p)
const upb_json_codecache * cache
@ UPB_DESCRIPTOR_TYPE_UINT64
static bool isleap(int year)
upb_arena * upb_arena_init(void *mem, size_t n, upb_alloc *alloc)
void upb_msg_set(upb_msg *msg, int field_index, upb_msgval val, const upb_msglayout *l)
static UPB_NORETURN void oom(tarjan *t)
static bool is_string_wrapper(const upb_msgdef *m)
const upb_handlers ** sub
const upb_oneofdef * upb_msg_iter_oneof(const upb_msg_oneof_iter *iter)
uint64_t upb_pbdecoder_bytesparsed(const upb_pbdecoder *d)
void upb_enum_next(upb_enum_iter *iter)
void upb_status_seterrf(upb_status *status, const char *fmt,...)
GLuint const GLchar * name
bool upb_handlers_getselector(const upb_fielddef *f, upb_handlertype_t type, upb_selector_t *s)
static bool streql(upb_tabkey k1, lookupkey_t k2)
void printer_sethandlers_mapentry(const void *closure, bool preserve_fieldnames, upb_handlers *h)
const upb_pbdecodermethod * upb_pbdecoder_method(const upb_pbdecoder *d)
struct cleanup_ent * next
const upb_msglayout google_protobuf_MethodOptions_msginit
struct upb_arena upb_arena
uint32_t field_rank(const upb_fielddef *f)
const upb_enumdef * upb_symtab_lookupenum(const upb_symtab *s, const char *sym)
static bool start_stringval(upb_json_parser *p)
bool upb_pbdecoder_setmaxnesting(upb_pbdecoder *d, size_t max)
static UPB_FORCEINLINE int32_t decode_varint(upb_pbdecoder *d, uint64_t *u64)
UPB_INLINE bool upb_inttable_insertptr(upb_inttable *t, const void *key, upb_value val)
void freestrpc(void *ptr)
static size_t repeated_str_fieldmask(void *closure, const void *handler_data, const char *str, size_t len, const upb_bufhandle *handle)
static mem_block * upb_arena_allocblock(upb_arena *a, size_t size)
bool upb_strtable_iter_isequal(const upb_strtable_iter *i1, const upb_strtable_iter *i2)
static const char * kUnterminatedVarint
void * upb_startfield_handlerfunc(void *c, const void *hd)
static const upb_tabval * inttable_val_const(const upb_inttable *t, uintptr_t key)
static UPB_FORCEINLINE int32_t getbytes(upb_pbdecoder *d, void *buf, size_t bytes)
#define MSG_WRITER(type, ctype)
void upb_stringsink_uninit(upb_stringsink *sink)
void upb_status_clear(upb_status *status)
UPB_INLINE int32_t upb_zzdec_32(uint32_t n)
uint32_t upb_handlers_selectorcount(const upb_fielddef *f)
upb_msgval upb_msg_get(const upb_msg *msg, int field_index, const upb_msglayout *l)
const upb_enumdef * enumdef
int32_t upb_pbdecoder_skipunknown(upb_pbdecoder *d, int32_t fieldnum, uint8_t wire_type)
static void advancetobuf(upb_pbdecoder *d, const char *buf, size_t len)
static const upb_msglayout *const google_protobuf_UninterpretedOption_submsgs[1]
static void insert(upb_table *t, lookupkey_t key, upb_tabkey tabkey, upb_value val, uint32_t hash, hashfunc_t *hashfunc, eqlfunc_t *eql)
@ UPB_DESCRIPTOR_TYPE_FIXED32
bool upb_handlers_setunknown(upb_handlers *h, upb_unknown_handlerfunc *func, const upb_handlerattr *attr)
static bool printer_starttimestampmsg(void *closure, const void *handler_data)
static bool does_fieldmask_start(upb_json_parser *p)
static upb_selector_t getsel(const upb_fielddef *f, upb_handlertype_t type)
#define UPB_BUFHANDLE_INIT
bool upb_inttable_remove(upb_inttable *t, uintptr_t key, upb_value *val)
int upb_filedef_msgcount(const upb_filedef *f)
@ UPB_HANDLER_STARTSUBMSG
const upb_msglayout_field * fields
static const upb_msglayout_field google_protobuf_FileDescriptorSet__fields[1]
bool upb_inttable_done(const upb_inttable_iter *i)
struct mem_block mem_block
bool nonbase64(unsigned char ch)
static const char dummy_char
static const upb_msglayout_field google_protobuf_ExtensionRangeOptions__fields[1]
@ UPB_DESCRIPTOR_TYPE_FIXED64
static upb_msg_internal * upb_msg_getinternal(upb_msg *msg)
char * upb_strdup(const char *s, upb_alloc *a)
UPB_INLINE upb_strview const * google_protobuf_FileDescriptorProto_dependency(const google_protobuf_FileDescriptorProto *msg, size_t *len)
static size_t putbytes(void *closure, const void *handler_data, const char *str, size_t len, const upb_bufhandle *handle)
static void * encode_startdelimfield(void *c, const void *hd)
UPB_INLINE int64_t upb_zzdec_64(uint64_t n)
int cmp_fields(const void *p1, const void *p2)
@ UPB_DESCRIPTOR_TYPE_INT64
static void putsel(compiler *c, opcode op, upb_selector_t sel, const upb_handlers *h)
@ UPB_WELLKNOWN_STRINGVALUE
@ UPB_WELLKNOWN_UINT64VALUE
static const double MAX_LOAD
const upb_msglayout google_protobuf_EnumDescriptorProto_msginit
static const upb_msglayout *const google_protobuf_DescriptorProto_submsgs[8]
UPB_INLINE upb_arena * upb_arena_new()
bool upb_msgdef_mapentry(const upb_msgdef *m)
void printer_sethandlers_structvalue(const void *closure, upb_handlers *h)
UPB_INLINE upb_strview google_protobuf_OneofDescriptorProto_name(const google_protobuf_OneofDescriptorProto *msg)
bool upb_handlers_setstartmsg(upb_handlers *h, upb_startmsg_handlerfunc *func, const upb_handlerattr *attr)
static bool lower_camel_push(upb_json_parser *p, upb_selector_t sel, const char *ptr, size_t len)
upb_pb_encoder * upb_pb_encoder_create(upb_arena *arena, const upb_handlers *h, upb_bytessink output)
upb_syntax_t upb_filedef_syntax(const upb_filedef *f)
static bool symtab_add(const symtab_addctx *ctx, const char *name, upb_value v)
const upb_handlers * upb_handlers_getsubhandlers_sel(const upb_handlers *h, upb_selector_t sel)
static bool encode_varint(upb_pb_encoder *e, uint64_t val)
static bool printer_endtimestampmsg(void *closure, const void *handler_data, upb_status *s)
size_t parse(void *closure, const void *hd, const char *buf, size_t size, const upb_bufhandle *handle)
static const char _json_actions[]
upb_wellknowntype_t well_known_type
bool upb_inttable_iter_isequal(const upb_inttable_iter *i1, const upb_inttable_iter *i2)
static bool upb_decode_64bitfield(upb_decstate *d, upb_decframe *frame, const char *field_start, const upb_msglayout_field *field)
static const double MIN_DENSITY
UPB_INLINE upb_strview google_protobuf_FileDescriptorProto_name(const google_protobuf_FileDescriptorProto *msg)
static void accumulate(upb_pb_encoder *e)
const upb_oneofdef * upb_msgdef_ntoo(const upb_msgdef *m, const char *name, size_t len)
size_t accumulate_buf_size
uint32_t submsg_field_count
static void textprinter_reset(upb_textprinter *p, bool single_line)
size_t upb_strtable_iter_keylength(const upb_strtable_iter *i)
static bool is_wellknown_field(upb_json_parser *p, upb_wellknowntype_t type)
static const upb_msglayout *const google_protobuf_OneofOptions_submsgs[1]
static bool upb_put_fixed32(upb_encstate *e, uint32_t val)
#define UPB_TABVALUE_EMPTY_INIT
const upb_msglayout google_protobuf_OneofDescriptorProto_msginit
upb_bytessink upb_json_parser_input(upb_json_parser *p)
static bool upb_decode_toarray(upb_decstate *d, upb_decframe *frame, const char *field_start, const upb_msglayout_field *field, upb_strview val)
static int indent(upb_textprinter *p)
static bool upb_isletter(char c)
static void json_printer_reset(upb_json_printer *p)
void upb_inttable_begin(upb_inttable_iter *i, const upb_inttable *t)
static bool end_any_stringval(upb_json_parser *p)
GLenum GLuint GLenum GLsizei length
static const upb_msglayout *const google_protobuf_EnumDescriptorProto_submsgs[3]
upb_pb_encoder_segment * segbuf
#define UPB_DURATION_MAX_NANO_LEN
static bool end_minute(upb_json_parser *p, const char *ptr)
@ UPB_WELLKNOWN_TIMESTAMP
static const upb_msglayout *const google_protobuf_EnumValueOptions_submsgs[1]
static void start_object(upb_json_parser *p)
#define upb_alignof(type)
size_t upb_pbdecoder_suspend(upb_pbdecoder *d)
bool upb_fielddef_packed(const upb_fielddef *f)
upb_descriptortype_t upb_fielddef_descriptortype(const upb_fielddef *f)
static bool rm(upb_table *t, lookupkey_t key, upb_value *val, upb_tabkey *removed, uint32_t hash, eqlfunc_t *eql)
UPB_INLINE int upb_value_size(uint64_t val)
const char * upb_enumdef_iton(const upb_enumdef *def, int32_t num)
static bool consumes_input(opcode op)
size_t upb_inttable_count(const upb_inttable *t)
const upb_fielddef * upb_oneofdef_itof(const upb_oneofdef *o, uint32_t num)
static bool escape(upb_json_parser *p, const char *ptr)
bool upb_array_set(upb_array *arr, size_t i, upb_msgval val)
void upb_msg_field_begin(upb_msg_field_iter *iter, const upb_msgdef *m)
const void * effective_closure_type(upb_handlers *h, const upb_fielddef *f, upb_handlertype_t type)
size_t upb_mapiter_sizeof()
upb_handlercache * upb_pb_encoder_newcache()
static void set_default_default(const symtab_addctx *ctx, upb_fielddef *f)
bool upb_strtable_insert3(upb_strtable *t, const char *k, size_t len, upb_value v, upb_alloc *a)
bool upb_arena_addcleanup(upb_arena *a, void *ud, upb_cleanup_func *func)
static bool assign_msg_indices(upb_msgdef *m, upb_status *s)
upb_pb_encoder_segment * seglimit
static UPB_NOINLINE size_t peekbytes_slow(upb_pbdecoder *d, void *buf, size_t bytes)
static uint32_t * upb_msg_oneofcase(const upb_msg *msg, int field_index, const upb_msglayout *l)
static void * startseq_nokey(void *closure, const void *handler_data)
upb_json_parser * upb_json_parser_create(upb_arena *arena, const upb_json_parsermethod *method, const upb_symtab *symtab, upb_sink output, upb_status *status, bool ignore_json_unknown)
static void checkpoint(upb_pbdecoder *d)
const upb_filedef * upb_msgdef_file(const upb_msgdef *m)
static bool end_stringval(upb_json_parser *p)
bool upb_handlers_setstartseq(upb_handlers *h, const upb_fielddef *f, upb_startfield_handlerfunc *func, const upb_handlerattr *attr)
const char * upb_enumdef_name(const upb_enumdef *e)
static void end_fieldmask_object(upb_json_parser *p)
static bool encode_fixed64(upb_pb_encoder *e, uint64_t val)
upb_byteshandler input_handler_
upb_textprinter * upb_textprinter_create(upb_arena *arena, const upb_handlers *h, upb_bytessink output)
static void encoder_advance(upb_pb_encoder *e, size_t bytes)
static bool printer_enddurationmsg(void *closure, const void *handler_data, upb_status *s)
static bool end_second(upb_json_parser *p, const char *ptr)
bool upb_fielddef_issubmsg(const upb_fielddef *f)
@ UPB_DESCRIPTOR_TYPE_SFIXED32
bool upb_handlers_setendstr(upb_handlers *h, const upb_fielddef *f, upb_endfield_handlerfunc *func, const upb_handlerattr *attr)
const upb_json_parsermethod * method
static bool upb_msglayout_init(const upb_msgdef *m, upb_msglayout *l, upb_msgfactory *factory)
static const upb_msglayout *const google_protobuf_MethodDescriptorProto_submsgs[1]
static void start_listvalue_object(upb_json_parser *p)
#define STRINGIFY_MACROVAL(x)
static bool parse_number_from_buffer(upb_json_parser *p, const char *buf, bool is_quoted)
static const upb_msglayout *const google_protobuf_ServiceOptions_submsgs[1]
GLuint GLsizei const GLchar * label
char * upb_encode(const void *msg, const upb_msglayout *m, upb_arena *arena, size_t *size)
UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_default_value(const google_protobuf_FieldDescriptorProto *msg)
bool upb_fielddef_checkdescriptortype(int32_t type)
size_t upb_array_size(const upb_array *arr)
static const upb_msglayout_field google_protobuf_FileDescriptorProto__fields[12]
static void start_duration_base(upb_json_parser *p, const char *ptr)
const upb_msgdef * upb_symtab_lookupmsg2(const upb_symtab *s, const char *sym, size_t len)
upb_json_printer * upb_json_printer_create(upb_arena *a, const upb_handlers *h, upb_bytessink output)
uint32_t upb_fielddef_selectorbase(const upb_fielddef *f)
static size_t upb_msgval_sizeof2(upb_fieldtype_t type)
bool upb_endfield_handlerfunc(void *c, const void *hd)
@ UPB_DESCRIPTOR_TYPE_FLOAT
union upb_fielddef::@87 sub
const upb_json_parsermethod * upb_json_codecache_get(upb_json_codecache *c, const upb_msgdef *md)
static bool json_parser_any_frame_has_value_after_type_url(upb_jsonparser_any_frame *frame)
static void find_methods(compiler *c, const upb_handlers *h)
static upb_tabent * findentry_mutable(upb_table *t, lookupkey_t key, uint32_t hash, eqlfunc_t *eql)
static void count_types_in_msg(const google_protobuf_DescriptorProto *msg_proto, decl_counts *counts)
static void * textprinter_startsubmsg(void *closure, const void *handler_data)
UPB_INLINE bool upb_inttable_init(upb_inttable *table, upb_ctype_t ctype)
static bool encode_unknown(void *c, const void *hd, const char *buf, size_t len)
bool upb_msg_getscalarhandlerdata(const upb_handlers *h, upb_selector_t s, upb_fieldtype_t *type, size_t *offset, int32_t *hasbit)
static const upb_msglayout_field * upb_msg_checkfield(int field_index, const upb_msglayout *l)
static bool is_power_of_two(size_t val)
bool upb_byteshandler_setendstr(upb_byteshandler *h, upb_endfield_handlerfunc *func, void *d)
UPB_INLINE upb_strview google_protobuf_FieldDescriptorProto_extendee(const google_protobuf_FieldDescriptorProto *msg)
struct _upb_tabent upb_tabent
static void freemethod(upb_pbdecodermethod *method)
static void maybeput(compiler *c, opcode op, const upb_handlers *h, const upb_fielddef *f, upb_handlertype_t type)
static bool end_fieldmask_path(upb_json_parser *p)
static const int json_en_fieldmask_machine
static void * repeated_startstr(void *closure, const void *handler_data, size_t size_hint)
bool upb_strtable_init2(upb_strtable *t, upb_ctype_t ctype, upb_alloc *a)
const UPB_INLINE google_protobuf_MessageOptions * google_protobuf_DescriptorProto_options(const google_protobuf_DescriptorProto *msg)
const UPB_INLINE google_protobuf_EnumDescriptorProto *const * google_protobuf_FileDescriptorProto_enum_type(const google_protobuf_FileDescriptorProto *msg, size_t *len)
const UPB_INLINE google_protobuf_FieldOptions * google_protobuf_FieldDescriptorProto_options(const google_protobuf_FieldDescriptorProto *msg)
bool upb_int64_handlerfunc(void *c, const void *hd, int64_t val)
#define UPB_UNKNOWN_SELECTOR
#define UPB_STATIC_SELECTOR_COUNT
static bool end_timestamp_zone(upb_json_parser *p, const char *ptr)
bool eqlfunc_t(upb_tabkey k1, lookupkey_t k2)
static void * upb_arena_doalloc(upb_alloc *alloc, void *ptr, size_t oldsize, size_t size)
bool first_elem_[UPB_MAX_HANDLER_DEPTH *2]
void upb_mapiter_next(upb_mapiter *i)
struct upb_mapiter upb_mapiter
void upb_msg_addunknown(upb_msg *msg, const char *data, size_t len)
static bool upb_decode_varintfield(upb_decstate *d, upb_decframe *frame, const char *field_start, const upb_msglayout_field *field)
static void upb_sethasbit(upb_decframe *frame, const upb_msglayout_field *field)
static bool init(upb_table *t, upb_ctype_t ctype, uint8_t size_lg2, upb_alloc *a)
static bool in_residual_buf(const upb_pbdecoder *d, const char *p)
const UPB_INLINE google_protobuf_FieldDescriptorProto *const * google_protobuf_FileDescriptorProto_extension(const google_protobuf_FileDescriptorProto *msg, size_t *len)
static void multipart_start(upb_json_parser *p, upb_selector_t sel)
static const int json_en_number_machine
static void * startmap(void *closure, const void *handler_data)
static upb_json_parsermethod * parsermethod_new(upb_json_codecache *c, const upb_msgdef *md)
const UPB_INLINE google_protobuf_FieldDescriptorProto *const * google_protobuf_DescriptorProto_extension(const google_protobuf_DescriptorProto *msg, size_t *len)
UPB_INLINE size_t upb_vencode64(uint64_t val, char *buf)
static uint64_t repack(uint64_t dispatch, int new_wt2)
void printer_sethandlers_duration(const void *closure, upb_handlers *h)
size_t upb_msgdef_selectorcount(const upb_msgdef *m)
UPB_INLINE size_t upb_sink_putstring(upb_sink s, upb_selector_t sel, const char *buf, size_t n, const upb_bufhandle *handle)
static void upb_set32(void *msg, size_t ofs, uint32_t val)
const void * symtab_resolve(const symtab_addctx *ctx, const upb_fielddef *f, const char *base, upb_strview sym, upb_deftype_t type)
PHP_PROTO_OBJECT_FREE_END PHP_PROTO_OBJECT_DTOR_END if(!upb_strtable_init(&intern->table, UPB_CTYPE_UINT64))
static void * encode_startstr(void *c, const void *hd, size_t size_hint)
void upb_status_seterrmsg(upb_status *status, const char *msg)
static const char _json_trans_keys[]
upb_selector_t string_selector
static bool putnull(void *closure, const void *handler_data, int32_t null)
UPB_INLINE bool google_protobuf_FileOptions_has_php_namespace(const google_protobuf_FileOptions *msg)
const upb_fielddef * fields
static char encoder[85+1]
bool upb_handlercache_addcleanup(upb_handlercache *c, void *p, upb_handlerfree *func)
const upb_enumdef * upb_fielddef_enumsubdef(const upb_fielddef *f)
void printer_sethandlers_timestamp(const void *closure, upb_handlers *h)
UPB_INLINE opcode getop(uint32_t instr)
static const upb_tabent * int_tabent(const upb_inttable_iter *i)
int upb_oneofdef_numfields(const upb_oneofdef *o)
const upb_msglayout google_protobuf_FieldOptions_msginit
const upb_msglayout google_protobuf_MessageOptions_msginit
upb_value upb_inttable_iter_value(const upb_inttable_iter *i)
upb_value upb_inttable_pop(upb_inttable *t)
bool upb_fielddef_isprimitive(const upb_fielddef *f)
void upb_mapiter_setdone(upb_mapiter *i)
upb_jsonparser_any_frame * any_frame
static upb_value pack_def(const void *ptr, upb_deftype_t type)
const upb_msglayout google_protobuf_GeneratedCodeInfo_Annotation_msginit
bool upb_handlers_setbool(upb_handlers *h, const upb_fielddef *f, upb_bool_handlerfunc *func, const upb_handlerattr *attr)
static const uint8_t upb_desctype_to_fieldtype2[]
UPB_INLINE bool upb_inttable_lookup32(const upb_inttable *t, uint32_t key, upb_value *v)
const upb_msglayout google_protobuf_SourceCodeInfo_msginit
upb_jsonparser_frame * top
static size_t fmt_bool(bool val, char *buf, size_t length)
static const upb_msglayout_field google_protobuf_GeneratedCodeInfo_Annotation__fields[4]
const UPB_INLINE char * json_nice_escape(char c)
size_t upb_map_size(const upb_map *map)
static void print_comma(upb_json_printer *p)
upb_symtab * upb_symtab_new()
static bool upb_decode_32bitfield(upb_decstate *d, upb_decframe *frame, const char *field_start, const upb_msglayout_field *field)
static void * mapkeyval_startstr(void *closure, const void *handler_data, size_t size_hint)
static size_t fmt_int64_as_string(long long val, char *buf, size_t length)
static size_t mapkey_bytes(void *closure, const void *handler_data, const char *str, size_t len, const upb_bufhandle *handle)
void printer_sethandlers(const void *closure, upb_handlers *h)
static bool printer_endmsg(void *closure, const void *handler_data, upb_status *s)
#define UPB_ASSERT_DEBUGVAR(expr)
static void start_minute(upb_json_parser *p, const char *ptr)
upb_handlertype_t upb_handlers_getprimitivehandlertype(const upb_fielddef *f)
union upb_fielddef::@86 defaultval
static int32_t dispatch(upb_pbdecoder *d)
static const char * accumulate_getptr(upb_json_parser *p, size_t *len)
static void * encode_startgroup(void *c, const void *hd)
const upb_msglayout google_protobuf_ServiceDescriptorProto_msginit
static void dispatchtarget(compiler *c, upb_pbdecodermethod *method, const upb_fielddef *f, int wire_type)
uintptr_t upb_inttable_iter_key(const upb_inttable_iter *i)
void printer_sethandlers_fieldmask(const void *closure, upb_handlers *h)
upb_handlercache * upb_json_printer_newcache(bool preserve_proto_fieldnames)
static char suspend_capture
UPB_INLINE void * upb_arena_malloc(upb_arena *a, size_t size)
const upb_handlers * handlers
static bool base64_push(upb_json_parser *p, upb_selector_t sel, const char *ptr, size_t len)
static upb_tabent * getentry_mutable(upb_table *t, uint32_t hash)
int upb_filedef_depcount(const upb_filedef *f)
upb_arena * upb_msg_arena(const upb_msg *msg)
static bool inteql(upb_tabkey k1, lookupkey_t k2)
static bool upb_encode_reserve(upb_encstate *e, size_t bytes)
static int32_t labelref(compiler *c, int label)
UPB_INLINE upb_value _upb_value_val(uint64_t val, upb_ctype_t ctype)
UPB_INLINE bool google_protobuf_FileDescriptorProto_has_package(const google_protobuf_FileDescriptorProto *msg)
static const upb_msglayout_field google_protobuf_SourceCodeInfo__fields[1]
static bool multipart_text(upb_json_parser *p, const char *buf, size_t len, bool can_alias)
static char * strviewdup(const symtab_addctx *ctx, upb_strview view)
static bool upb_isbetween(char c, char low, char high)
UPB_INLINE size_t upb_varint_size(uint64_t val)
bool upb_fieldtype_mapkeyok(upb_fieldtype_t type)
void upb_pbdecoder_seterr(upb_pbdecoder *d, const char *msg)
bool upb_bool_handlerfunc(void *c, const void *hd, bool val)
static bool start_subobject_full(upb_json_parser *p)
static const upb_msglayout_field google_protobuf_FieldDescriptorProto__fields[10]
static size_t fmt_float(float val, char *buf, size_t length)
bool upb_msg_oneof_iter_isequal(const upb_msg_oneof_iter *iter1, const upb_msg_oneof_iter *iter2)
uint64_t offset(const upb_pbdecoder *d)
const mgroup * mgroup_new(const upb_handlers *dest, bool allowjit, bool lazy)
upb_msg * upb_msg_new(const upb_msglayout *l, upb_arena *a)
static bool endseq(void *closure, const void *handler_data)
static void put32(compiler *c, uint32_t v)
static size_t callstacksize(upb_pbdecoder *d, size_t entries)
static lookupkey_t strkey2(const char *str, size_t len)
const upb_msglayout google_protobuf_MethodDescriptorProto_msginit
double upb_fielddef_defaultdouble(const upb_fielddef *f)
const upb_msgdef * upb_handlers_msgdef(const upb_handlers *h)
static upb_tabval * inttable_val(upb_inttable *t, uintptr_t key)
static void start_second(upb_json_parser *p, const char *ptr)
static int32_t upb_zzdecode_32(uint32_t n)
static bool end_delim(upb_pb_encoder *e)
static const upb_msglayout_field google_protobuf_FieldOptions__fields[7]
struct cleanup_ent cleanup_ent
static const upb_msglayout_field google_protobuf_UninterpretedOption_NamePart__fields[2]
static const upb_msglayout *const google_protobuf_FieldDescriptorProto_submsgs[1]
static size_t align_up(size_t val, size_t align)
static bool printer_endmsg_fieldmask(void *closure, const void *handler_data, upb_status *s)
static int parse_timestamp_number(upb_json_parser *p)
static bool doset(upb_handlers *h, int32_t sel, const upb_fielddef *f, upb_handlertype_t type, upb_func *func, const upb_handlerattr *attr)
static bool encode_tag(upb_pb_encoder *e, const tag_t *tag)
bool upb_map_del(upb_map *map, upb_msgval key)
int64_t epoch(int year, int yday, int hour, int min, int sec)
const UPB_INLINE google_protobuf_DescriptorProto *const * google_protobuf_FileDescriptorProto_message_type(const google_protobuf_FileDescriptorProto *msg, size_t *len)
upb_msgval upb_mapiter_key(const upb_mapiter *i)
bool upb_fielddef_isstring(const upb_fielddef *f)
static bool upb_append_unknown(upb_decstate *d, upb_decframe *frame, const char *start)
upb_handlercache * upb_textprinter_newcache()
static void * repeated_startsubmsg(void *closure, const void *handler_data)
bool upb_handlers_setendsubmsg(upb_handlers *h, const upb_fielddef *f, upb_endfield_handlerfunc *func, const upb_handlerattr *attr)
upb_handlercache * upb_handlercache_new(upb_handlers_callback *callback, const void *closure)
GLboolean GLboolean GLboolean b
static void start_member(upb_json_parser *p)
#define UPB_ENDSTR_SELECTOR
static void * upb_calloc(upb_arena *arena, size_t size)
static void * scalar_startsubmsg(void *closure, const void *handler_data)
static upb_selector_t handlers_getsel(upb_handlers *h, const upb_fielddef *f, upb_handlertype_t type)
static void chkdefaulttype(const upb_fielddef *f, int ctype)
const upb_msglayout google_protobuf_GeneratedCodeInfo_msginit
bool upb_handlers_setstartstr(upb_handlers *h, const upb_fielddef *f, upb_startstr_handlerfunc *func, const upb_handlerattr *attr)
static void start_year(upb_json_parser *p, const char *ptr)
UPB_INLINE bool upb_sink_startstr(upb_sink s, upb_selector_t sel, size_t size_hint, upb_sink *sub)
void upb_mapiter_free(upb_mapiter *i, upb_alloc *a)
upb_pb_encoder_segment * segptr
static void start_frame(upb_json_printer *p)
bool upb_fielddef_isseq(const upb_fielddef *f)
GLenum GLsizei GLsizei GLint * values
@ UPB_WELLKNOWN_BYTESVALUE
const upb_fielddef * upb_oneofdef_ntof(const upb_oneofdef *o, const char *name, size_t length)
static void end_wrapper_object(upb_json_parser *p)
static char escape_char(char in)
static bool end_stringval_nontop(upb_json_parser *p)
static bool encode_enddelimfield(void *c, const void *hd)
UPB_INLINE bool is_json_escaped(char c)
static bool upb_put_fixedarray(upb_encstate *e, const upb_array *arr, size_t size)
static const upb_msglayout *const google_protobuf_EnumValueDescriptorProto_submsgs[1]
static void capture_resume(upb_json_parser *p, const char *ptr)
static uint32_t strhash(upb_tabkey key)
static bool upb_isident(upb_strview name, bool full, upb_status *s)
bool upb_pbcodecache_allowjit(const upb_pbcodecache *c)
UPB_INLINE bool upb_arrhas(upb_tabval key)
static bool upb_decode_message(upb_decstate *d, const char *limit, int group_number, char *msg, const upb_msglayout *l)
UPB_INLINE uint64_t upb_vencode32(uint32_t val)
static size_t begin(const upb_table *t)
static bool upb_skip_unknownfielddata(upb_decstate *d, upb_decframe *frame, int field_number, int wire_type)
struct google_protobuf_FileDescriptorProto google_protobuf_FileDescriptorProto
static void end_array(upb_json_parser *p)
UPB_INLINE void upb_pbdecoder_unpackdispatch(uint64_t dispatch, uint64_t *ofs, uint8_t *wt1, uint8_t *wt2)
static const int json_en_value_machine
float upb_fielddef_defaultfloat(const upb_fielddef *f)
static bool start_subobject(upb_json_parser *p)
static upb_pbdecodermethod * newmethod(const upb_handlers *dest_handlers, mgroup *group)
static void generate_primitivefield(compiler *c, const upb_fielddef *f, upb_pbdecodermethod *method)
#define SETTER(name, handlerctype, handlertype)
static bool end_any_membername(upb_json_parser *p)
static lookupkey_t intkey(uintptr_t key)
void printer_sethandlers_listvalue(const void *closure, upb_handlers *h)
#define UPB_ENDMSG_SELECTOR
@ UPB_WIRE_TYPE_START_GROUP
void upb_strtable_next(upb_strtable_iter *i)
static size_t stacksize(upb_pbdecoder *d, size_t entries)
static size_t saturating_multiply(size_t a, size_t b)
static UPB_FORCEINLINE int32_t decode_fixed32(upb_pbdecoder *d, uint32_t *u32)
static void assert_accumulate_empty(upb_json_parser *p)
const char * upb_pbdecoder_getopname(unsigned int op)
static void start_timestamp_fraction(upb_json_parser *p, const char *ptr)
UPB_INLINE bool google_protobuf_FileDescriptorProto_has_name(const google_protobuf_FileDescriptorProto *msg)
@ UPB_WELLKNOWN_BOOLVALUE
static upb_tabval * mutable_array(upb_inttable *t)
UPB_INLINE upb_strview google_protobuf_FileOptions_php_class_prefix(const google_protobuf_FileOptions *msg)
bool upb_handlers_setsubhandlers(upb_handlers *h, const upb_fielddef *f, const upb_handlers *sub)
static bool between(int32_t x, int32_t low, int32_t high)
bool upb_uint64_handlerfunc(void *c, const void *hd, uint64_t val)
#define CASE(ctype, type, wire_type, encodeval)
static const upb_msglayout_field google_protobuf_MethodDescriptorProto__fields[6]
UPB_INLINE bool upb_sink_putunknown(upb_sink s, const char *buf, size_t n)
const upb_byteshandler * upb_pbdecodermethod_inputhandler(const upb_pbdecodermethod *m)
static const unsigned char _json_indicies[]
bool upb_fielddef_isextension(const upb_fielddef *f)
upb_handlers_tabent table[1]
UPB_INLINE bool google_protobuf_FileDescriptorProto_has_syntax(const google_protobuf_FileDescriptorProto *msg)
static void start_timestamp_base(upb_json_parser *p)
static bool accumulate_realloc(upb_json_parser *p, size_t need)
const char * upb_filedef_package(const upb_filedef *f)
#define UPB_MAPENTRY_VALUE
UPB_INLINE bool upb_sink_endseq(upb_sink s, upb_selector_t sel)
int upb_enumdef_numvals(const upb_enumdef *e)
UPB_INLINE void upb_free(upb_alloc *alloc, void *ptr)
#define UPB_TIMESTAMP_NANOS
const char * upb_fielddef_fullname(const upb_fielddef *f)
static bool upb_array_grow(upb_array *arr, size_t elements)
bool upb_strtable_done(const upb_strtable_iter *i)
upb_msgval upb_mapiter_value(const upb_mapiter *i)
static void putbuf(upb_pb_encoder *e, const char *buf, size_t len)
static bool is_fieldmask(const upb_msgdef *m)
struct google_protobuf_EnumDescriptorProto google_protobuf_EnumDescriptorProto
const upb_msglayout google_protobuf_ServiceOptions_msginit
static upb_msgval upb_map_fromkey(upb_fieldtype_t type, const char *key, size_t len)
void upb_pbdecoder_reset(upb_pbdecoder *d)
UPB_INLINE void upb_gfree(void *ptr)
UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_options(const google_protobuf_FieldDescriptorProto *msg)
static int putescaped(upb_textprinter *p, const char *buf, size_t len, bool preserve_utf8)
static uint8_t upb_msg_fieldsize(const upb_msglayout_field *field)
int32_t upb_pbdecoder_decode_f32(upb_pbdecoder *d, uint32_t *u32)
static bool end_fieldmask_path_text(upb_json_parser *p, const char *ptr)
bool upb_decode(const char *buf, size_t size, void *msg, const upb_msglayout *l)
static upb_tabent * mutable_entries(upb_table *t)
const void * closure_type
@ UPB_DESCRIPTOR_TYPE_BOOL
static bool upb_decode_string(const char **ptr, const char *limit, upb_strview *val)
struct google_protobuf_EnumValueDescriptorProto google_protobuf_EnumValueDescriptorProto
bool upb_handlers_setendseq(upb_handlers *h, const upb_fielddef *f, upb_endfield_handlerfunc *func, const upb_handlerattr *attr)
@ UPB_DESCRIPTOR_TYPE_BYTES
UPB_INLINE bool upb_bytessink_start(upb_bytessink s, size_t size_hint, void **subc)
void upb_pbcodecache_free(upb_pbcodecache *c)
static const char prefix[]
UPB_INLINE size_t upb_table_size(const upb_table *t)
static size_t fmt_uint64_as_number(unsigned long long val, char *buf, size_t length)
UPB_INLINE bool upb_sink_startmsg(upb_sink s)
static size_t scalar_str(void *closure, const void *handler_data, const char *str, size_t len, const upb_bufhandle *handle)
const char * upb_strtable_iter_key(const upb_strtable_iter *i)
void upb_handlercache_free(upb_handlercache *cache)
static bool upb_encode_growbuffer(upb_encstate *e, size_t bytes)
static int64_t upb_mktime(const struct tm *tp)
static bool haslazyhandlers(const upb_handlers *h, const upb_fielddef *f)
static bool handle_mapentry(upb_json_parser *p)
static bool mapvalue_endstr(void *closure, const void *handler_data)
uint32_t upb_msgdef_submsgfieldcount(const upb_msgdef *m)
static const void ** returntype(upb_handlers *h, const upb_fielddef *f, upb_handlertype_t type)
static double as_double(uint64_t n)
bool upb_byteshandler_setstartstr(upb_byteshandler *h, upb_startstr_handlerfunc *func, void *d)
static const char * shortdefname(const char *fullname)
struct google_protobuf_FieldDescriptorProto google_protobuf_FieldDescriptorProto
static bool end_number(upb_json_parser *p, const char *ptr)
static void goto_endmsg(upb_pbdecoder *d)
const char * kPbDecoderSubmessageTooLong
static const int json_en_string_machine
void upb_inttable_iter_setdone(upb_inttable_iter *i)
static uint32_t inthash(upb_tabkey key)
@ UPB_WELLKNOWN_INT32VALUE
static void hexdigit(upb_json_parser *p, const char *ptr)
static bool end_null(upb_json_parser *p)
static bool is_wellknown_msg(upb_json_parser *p, upb_wellknowntype_t type)
static void * textprinter_startstr(void *closure, const void *handler_data, size_t size_hint)
static bool in_buf(const char *p, const char *buf, const char *end)
bool upb_unknown_handlerfunc(void *c, const void *hd, const char *buf, size_t n)
static void new_tag(upb_handlers *h, const upb_fielddef *f, upb_wiretype_t wt, upb_handlerattr *attr)
UPB_INLINE upb_strview google_protobuf_EnumValueDescriptorProto_name(const google_protobuf_EnumValueDescriptorProto *msg)
static bool streql_view(upb_strview view, const char *b)
const upb_oneofdef * upb_fielddef_containingoneof(const upb_fielddef *f)
static uint32_t upb_readcase(const char *msg, const upb_msglayout_field *f)
upb_pbdecoder_frame * outer_frame(upb_pbdecoder *d)
bool upb_fielddef_ismap(const upb_fielddef *f)
void upb_msg_oneof_begin(upb_msg_oneof_iter *iter, const upb_msgdef *m)
UPB_INLINE int32_t google_protobuf_FieldDescriptorProto_label(const google_protobuf_FieldDescriptorProto *msg)
void upb_oneof_iter_setdone(upb_oneof_iter *iter)
static const upb_msglayout_field google_protobuf_GeneratedCodeInfo__fields[1]
static bool reserve(upb_pb_encoder *e, size_t bytes)
static void start_wrapper_object(upb_json_parser *p)
#define UPB_DURATION_SECONDS
static size_t fmt_int64_as_number(long long val, char *buf, size_t length)
static bool capture_end(upb_json_parser *p, const char *ptr)
static const int json_start
int upb_msgdef_numoneofs(const upb_msgdef *m)
const google_protobuf_FieldDescriptorProto * unresolved
bool upb_fielddef_lazy(const upb_fielddef *f)
static void upb_msgval_write(void *p, size_t ofs, upb_msgval val, uint8_t size)
static void start_value_object(upb_json_parser *p, int value_type)
static void end_listvalue_object(upb_json_parser *p)
static bool repeated_enum(void *closure, const void *handler_data, int32_t val)
static upb_msgval upb_msgval_fromval(upb_value val)
static upb_array * upb_getorcreatearr(upb_decframe *frame, const upb_msglayout_field *field)
static bool textprinter_putenum(void *closure, const void *handler_data, int32_t val)
const upb_msglayout google_protobuf_DescriptorProto_ReservedRange_msginit
static bool end_membername(upb_json_parser *p)
static bool isfull(upb_table *t)
@ UPB_WIRE_TYPE_END_GROUP
#define UPB_DURATION_MAX_JSON_LEN
static upb_ctype_t upb_fieldtotabtype(upb_fieldtype_t type)
const char * upb_enumdef_fullname(const upb_enumdef *e)
bool upb_strtable_remove3(upb_strtable *t, const char *key, size_t len, upb_value *val, upb_alloc *alloc)
upb_value upb_strtable_iter_value(const upb_strtable_iter *i)
upb_descriptortype_t type_
void upb_status_vseterrf(upb_status *status, const char *fmt, va_list args)
uint32_t hashfunc_t(upb_tabkey key)
static bool textprinter_endsubmsg(void *closure, const void *handler_data)
static bool printer_startdurationmsg(void *closure, const void *handler_data)
GTEST_API_ const char * fmt
void upb_arena_free(upb_arena *a)
#define UPB_JSON_PRINTER_SIZE
upb_map * upb_map_new(upb_fieldtype_t ktype, upb_fieldtype_t vtype, upb_arena *a)
static void count_types_in_file(const google_protobuf_FileDescriptorProto *file_proto, decl_counts *counts)
static upb_array * upb_getarr(upb_decframe *frame, const upb_msglayout_field *field)
bool upb_encode_message(upb_encstate *e, const char *msg, const upb_msglayout *m, size_t *size)
static bool mapvalue_enum(void *closure, const void *handler_data, int32_t val)
@ UPB_WELLKNOWN_UNSPECIFIED
UPB_INLINE void upb_byteshandler_init(upb_byteshandler *handler)
static void multipart_startaccum(upb_json_parser *p)
const struct upb_msglayout *const * submsgs
const char * upb_oneofdef_name(const upb_oneofdef *o)
upb_msgfactory * upb_msgfactory_new(const upb_symtab *symtab)
bool upb_handlers_getattr(const upb_handlers *h, upb_selector_t sel, upb_handlerattr *attr)
const UPB_INLINE google_protobuf_DescriptorProto *const * google_protobuf_DescriptorProto_nested_type(const google_protobuf_DescriptorProto *msg, size_t *len)
void upb_handlerfree(void *d)
static void end_object(upb_json_parser *p)
static bool upb_isalphanum(char c)
const upb_oneofdef * oneofs
const char * kPbDecoderStackOverflow
@ UPB_WELLKNOWN_INT64VALUE
const upb_msgdef * msgdef
static const upb_msglayout_field google_protobuf_EnumDescriptorProto__fields[5]
static const upb_msglayout *const google_protobuf_EnumOptions_submsgs[1]
static UPB_NOINLINE int32_t getbytes_slow(upb_pbdecoder *d, void *buf, size_t bytes)
static bool start_delim(upb_pb_encoder *e)
const upb_msgdef * upb_oneofdef_containingtype(const upb_oneofdef *o)
upb_handlers_callback * callback
UPB_INLINE bool upb_sink_startseq(upb_sink s, upb_selector_t sel, upb_sink *sub)
static UPB_NORETURN void err(tarjan *t)
static void json_parser_reset(upb_json_parser *p)
const char * upb_filedef_name(const upb_filedef *f)
static bool does_string_wrapper_start(upb_json_parser *p)
const upb_handlers * upb_handlers_getsubhandlers(const upb_handlers *h, const upb_fielddef *f)
bool upb_fielddef_checkintfmt(int32_t fmt)
void upb_json_codecache_free(upb_json_codecache *c)
static upb_jsonparser_any_frame * json_parser_any_frame_new(upb_json_parser *p)
int back_labels[MAXLABEL]
static int32_t trygetsel(upb_handlers *h, const upb_fielddef *f, upb_handlertype_t type)
const char * upb_fielddef_name(const upb_fielddef *f)
static const char _json_single_lengths[]
void upb_strtable_iter_setdone(upb_strtable_iter *i)
static const unsigned char _json_eof_actions[]
UPB_INLINE upb_strview google_protobuf_FileDescriptorProto_syntax(const google_protobuf_FileDescriptorProto *msg)
static size_t fmt_uint64_as_string(unsigned long long val, char *buf, size_t length)
static void end_structvalue_object(upb_json_parser *p)
#define UPB_MAX_FIELDNUMBER
@ UPB_WIRE_TYPE_DELIMITED
static size_t fmt_double(double val, char *buf, size_t length)
static bool streql2(const char *a, size_t n, const char *b)
bool upb_handlers_setuint32(upb_handlers *h, const upb_fielddef *f, upb_uint32_handlerfunc *func, const upb_handlerattr *attr)
static bool upb_decode_fixedpacked(upb_array *arr, upb_strview data, int elem_size)
UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_type_name(const google_protobuf_FieldDescriptorProto *msg)
static upb_selector_t getsel_for_handlertype(upb_json_parser *p, upb_handlertype_t type)
static bool upb_encode_array(upb_encstate *e, const char *field_mem, const upb_msglayout *m, const upb_msglayout_field *f)
static UPB_FORCEINLINE int32_t decode_v32(upb_pbdecoder *d, uint32_t *u32)
size_t upb_string_handlerfunc(void *c, const void *hd, const char *buf, size_t n, const upb_bufhandle *handle)
static bool textprinter_putbool(void *closure, const void *handler_data, bool val)
#define UPB_HANDLERATTR_INIT
int32_t upb_fielddef_defaultint32(const upb_fielddef *f)
static bool upb_put_bytes(upb_encstate *e, const void *data, size_t len)
UPB_NOINLINE int32_t upb_pbdecoder_checktag_slow(upb_pbdecoder *d, uint64_t expected)
static bool upb_decode_field(upb_decstate *d, upb_decframe *frame)
void upb_stringsink_init(upb_stringsink *sink)
bool upb_mapiter_isequal(const upb_mapiter *i1, const upb_mapiter *i2)
#define UPB_PB_DECODER_SIZE
UPB_INLINE void upb_status_setoom(upb_status *status)
const UPB_INLINE google_protobuf_FieldDescriptorProto *const * google_protobuf_DescriptorProto_field(const google_protobuf_DescriptorProto *msg, size_t *len)
void upb_cleanup_func(void *ud)
upb_json_codecache * upb_json_codecache_new()
static const int json_en_duration_machine
static const upb_msglayout *const google_protobuf_DescriptorProto_ExtensionRange_submsgs[1]
UPB_INLINE uint32_t upb_zzenc_32(int32_t n)
SETUP_TEARDOWN_TESTCONTEXT typedef uint8_t byte
upb_alloc upb_alloc_global
static void accumulate_clear(upb_json_parser *p)
upb_fieldtype_t upb_map_keytype(const upb_map *map)
static int endfield(upb_textprinter *p)
static size_t bufleft(const upb_pbdecoder *d)
static void * upb_array_reserve(upb_array *arr, size_t elements)
static bool json_parser_any_frame_has_value_before_type_url(upb_jsonparser_any_frame *frame)
static void start_structvalue_object(upb_json_parser *p)
static bool printer_startmsg(void *closure, const void *handler_data)
static void set_bytecode_handlers(mgroup *g)
UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_oneof_index(const google_protobuf_FieldDescriptorProto *msg)
static size_t textprinter_putstr(void *closure, const void *hd, const char *buf, size_t len, const upb_bufhandle *handle)
#define VARINT_CASE(ctype, decode)
static bool resolve_fielddef(const symtab_addctx *ctx, const char *prefix, upb_fielddef *f)
#define TYPE_HANDLERS_MAPKEY(type, fmt_func)
static bool scalar_endstr(void *closure, const void *handler_data)
static const upb_msglayout_field google_protobuf_OneofDescriptorProto__fields[2]
const upb_msgdef * parent
static const upb_msgdef msgs[22]
static const upb_msglayout *const google_protobuf_OneofDescriptorProto_submsgs[1]
bool upb_msg_oneof_done(const upb_msg_oneof_iter *iter)
static void upb_map_tokey(upb_fieldtype_t type, upb_msgval *key, const char **out_key, size_t *out_len)
struct google_protobuf_FieldOptions google_protobuf_FieldOptions
const FieldDescriptor * field
UPB_INLINE upb_strview upb_strview_make(const char *data, size_t size)
upb_decoderet upb_vdecode_max8_branch64(upb_decoderet r)
GLenum GLuint GLenum GLsizei const GLchar * buf
static const short _json_index_offsets[]
bool putf(upb_textprinter *p, const char *fmt,...)
UPB_INLINE bool upb_tabent_isempty(const upb_tabent *e)
static bool upb_put_double(upb_encstate *e, double d)
const SETUP_TEARDOWN_TESTCONTEXT char * key
static void putstring(upb_json_printer *p, const char *buf, unsigned int len)
const UPB_INLINE google_protobuf_FileOptions * google_protobuf_FileDescriptorProto_options(const google_protobuf_FileDescriptorProto *msg)
void upb_textprinter_setsingleline(upb_textprinter *p, bool single_line)
static void assign_msg_wellknowntype(upb_msgdef *m)
static void end_any_member(upb_json_parser *p, const char *ptr)
void upb_pb_encoder_reset(upb_pb_encoder *e)
static const upb_msglayout_field google_protobuf_EnumDescriptorProto_EnumReservedRange__fields[2]
static void start_fieldmask_object(upb_json_parser *p)
static const upb_msglayout *const google_protobuf_MessageOptions_submsgs[1]
static void set_name_table(upb_json_parser *p, upb_jsonparser_frame *frame)
bool upb_handlers_setfloat(upb_handlers *h, const upb_fielddef *f, upb_float_handlerfunc *func, const upb_handlerattr *attr)
static void label(compiler *c, unsigned int label)
const char * before_type_url_end
static uint32_t pcofs(compiler *c)
static const upb_msglayout *const google_protobuf_FileOptions_submsgs[1]
UPB_INLINE google_protobuf_FileDescriptorProto * google_protobuf_FileDescriptorProto_parse(const char *buf, size_t size, upb_arena *arena)
const char * upb_filedef_phpprefix(const upb_filedef *f)
#define TYPE_HANDLERS(type, fmt_func)
#define PRIMITIVE_OP(type, wt, name, convfunc, ctype)
static size_t suspend_save(upb_pbdecoder *d)
static bool does_string_wrapper_end(upb_json_parser *p)
static bool printer_endmsg_noframe(void *closure, const void *handler_data, upb_status *s)
static const upb_msglayout_field google_protobuf_DescriptorProto_ExtensionRange__fields[3]
static const char _json_range_lengths[]
static size_t scalar_bytes(void *closure, const void *handler_data, const char *str, size_t len, const upb_bufhandle *handle)
static void compile_methods(compiler *c)
static upb_jsonparser_frame * start_jsonparser_frame(upb_json_parser *p)
static const upb_msglayout_field google_protobuf_EnumOptions__fields[3]
static size_t upb_msgval_sizeof(upb_fieldtype_t type)
UPB_INLINE bool upb_sink_endstr(upb_sink s, upb_selector_t sel)
static bool encode_bytes(upb_pb_encoder *e, const void *data, size_t len)
@ UPB_DESCRIPTOR_TYPE_UINT32
upb_stringsink stringsink
static uint8_t decoder[96]
static void freecompiler(compiler *c)
static void capture_begin(upb_json_parser *p, const char *ptr)
static void end_frame(upb_json_printer *p)
typedef void(APIENTRY *GLDEBUGPROCARB)(GLenum source
const upb_msglayout google_protobuf_UninterpretedOption_NamePart_msginit
static upb_tabkey strcopy(lookupkey_t k2, upb_alloc *a)
const upb_json_parsermethod const upb_symtab upb_sink bool ignore_json_unknown
size_t upb_pbdecoder_maxnesting(const upb_pbdecoder *d)
UPB_INLINE bool upb_sink_endsubmsg(upb_sink s, upb_selector_t sel)
bool upb_handlers_addcleanup(upb_handlers *h, void *p, upb_handlerfree *func)
bool upb_handlers_setint32(upb_handlers *h, const upb_fielddef *f, upb_int32_handlerfunc *func, const upb_handlerattr *attr)
const upb_symtab * symtab
const struct _upb_tabent * next
static bool upb_put_tag(upb_encstate *e, int field_number, int wire_type)
static const upb_msglayout_field google_protobuf_ServiceDescriptorProto__fields[3]
static void start_text(upb_json_parser *p, const char *ptr)
static bool end_month(upb_json_parser *p, const char *ptr)
UPB_INLINE void * upb_realloc(upb_alloc *alloc, void *ptr, size_t oldsize, size_t size)
static const upb_msglayout *const google_protobuf_FileDescriptorSet_submsgs[1]
UPB_INLINE void upb_sink_reset(upb_sink *s, const upb_handlers *h, void *c)
void upb_oneof_next(upb_oneof_iter *iter)
static bool end_hour(upb_json_parser *p, const char *ptr)
static const upb_msglayout_field google_protobuf_MethodOptions__fields[3]
const upb_fielddef * mapfield
static bool textprinter_endstr(void *closure, const void *handler_data)
upb_fieldtype_t upb_fielddef_type(const upb_fielddef *f)
upb_fielddef * upb_msg_iter_field(const upb_msg_field_iter *iter)
static size_t div_round_up(size_t n, size_t d)
void upb_symtab_free(upb_symtab *s)
@ UPB_DESCRIPTOR_TYPE_MESSAGE
static const upb_msglayout_field google_protobuf_DescriptorProto_ReservedRange__fields[2]
upb_wellknowntype_t upb_msgdef_wellknowntype(const upb_msgdef *m)
bool upb_handlers_setstartsubmsg(upb_handlers *h, const upb_fielddef *f, upb_startfield_handlerfunc *func, const upb_handlerattr *attr)
bool upb_msgdef_lookupname(const upb_msgdef *m, const char *name, size_t len, const upb_fielddef **f, const upb_oneofdef **o)
bool upb_enum_done(upb_enum_iter *iter)
static void * repeated_startstr_fieldmask(void *closure, const void *handler_data, size_t size_hint)
static const upb_tabent * str_tabent(const upb_strtable_iter *i)
static const upb_fielddef fields[107]
static void * startseq(void *closure, const void *handler_data)
bool upb_fielddef_defaultbool(const upb_fielddef *f)
size_t upb_fielddef_getjsonname(const upb_fielddef *f, char *buf, size_t len)
static UPB_FORCEINLINE size_t peekbytes(upb_pbdecoder *d, void *buf, size_t bytes)
static const upb_msglayout_field google_protobuf_MessageOptions__fields[5]
int parser_stack[UPB_JSON_MAX_DEPTH]
static void capture_suspend(upb_json_parser *p, const char **ptr)
UPB_INLINE upb_strview google_protobuf_FieldDescriptorProto_name(const google_protobuf_FieldDescriptorProto *msg)
static void generate_delimfield(compiler *c, const upb_fielddef *f, upb_pbdecodermethod *method)
upb_fielddef * upb_oneof_iter_field(const upb_oneof_iter *iter)
static const upb_msglayout_field google_protobuf_DescriptorProto__fields[10]
UPB_INLINE void * upb_arena_realloc(upb_arena *a, void *ptr, size_t oldsize, size_t size)
upb_decoderet upb_vdecode_max8_branch32(upb_decoderet r)
static compiler * newcompiler(mgroup *group, bool lazy)
bool upb_handlers_setdouble(upb_handlers *h, const upb_fielddef *f, upb_double_handlerfunc *func, const upb_handlerattr *attr)
static bool upb_decode_submsg(upb_decstate *d, upb_decframe *frame, const char *limit, const upb_msglayout_field *field, int group_number)
const upb_symtab * symtab
static void freegroup(mgroup *g)
bool upb_inttable_push2(upb_inttable *t, upb_value val, upb_alloc *a)
static upb_tabval int_arrent(const upb_inttable_iter *i)
void upb_oneof_begin(upb_oneof_iter *iter, const upb_oneofdef *o)
#define UPB_UNREACHABLE()
upb_pbdecoder * upb_pbdecoder_create(upb_arena *a, const upb_pbdecodermethod *m, upb_sink sink, upb_status *status)
static upb_pbdecodermethod * find_submethod(const compiler *c, const upb_pbdecodermethod *method, const upb_fielddef *f)
const char * after_type_url_start
@ UPB_DESCRIPTOR_TYPE_SINT32
bool op_has_longofs(int32_t instruction)
bool upb_mapiter_done(const upb_mapiter *i)
static void json_parser_any_frame_set_after_type_url_start_once(upb_jsonparser_any_frame *frame, const char *ptr)
static void putop(compiler *c, int op,...)
static size_t mapkey_str(void *closure, const void *handler_data, const char *str, size_t len, const upb_bufhandle *handle)
static const char * makefullname(const symtab_addctx *ctx, const char *prefix, upb_strview name)
const upb_filedef ** deps
static void upb_check_alloc(upb_table *t, upb_alloc *a)
static void print_data(upb_json_printer *p, const char *buf, unsigned int len)
@ UPB_WELLKNOWN_FLOATVALUE
static bool printer_startmsg_fieldmask(void *closure, const void *handler_data)
static void decoder_pop(upb_pbdecoder *d)
static void setofs(uint32_t *instruction, int32_t ofs)
const upb_msgdef * upb_fielddef_msgsubdef(const upb_fielddef *f)
#define UPB_DURATION_NANOS
UPB_INLINE upb_alloc * upb_arena_alloc(upb_arena *a)
static void end_subobject(upb_json_parser *p)
void upb_msg_field_iter_setdone(upb_msg_field_iter *iter)
const upb_filedef * upb_symtab_addfile(upb_symtab *s, const google_protobuf_FileDescriptorProto *file_proto, upb_status *status)
void upb_msg_field_next(upb_msg_field_iter *iter)
const upb_msglayout google_protobuf_EnumValueDescriptorProto_msginit
static void * startseq_fieldmask(void *closure, const void *handler_data)
static void json_parser_any_frame_free(upb_jsonparser_any_frame *frame)
static const upb_msglayout_field google_protobuf_FileOptions__fields[19]
static void set_delim_end(upb_pbdecoder *d)
void upb_strtable_uninit2(upb_strtable *t, upb_alloc *a)
static const upb_msglayout *const google_protobuf_SourceCodeInfo_submsgs[1]
const UPB_INLINE google_protobuf_EnumValueDescriptorProto *const * google_protobuf_EnumDescriptorProto_value(const google_protobuf_EnumDescriptorProto *msg, size_t *len)
bool upb_msg_setscalarhandler(upb_handlers *h, const upb_fielddef *f, size_t offset, int32_t hasbit)
UPB_INLINE void upb_bytessink_reset(upb_bytessink *s, const upb_byteshandler *h, void *closure)
static upb_handlers * upb_handlers_new(const upb_msgdef *md, upb_handlercache *cache, upb_arena *arena)
UPB_INLINE bool upb_sink_startsubmsg(upb_sink s, upb_selector_t sel, upb_sink *sub)
upb_byteshandler input_handler_
@ UPB_WELLKNOWN_LISTVALUE
static uint8_t upb_msg_fielddefsize(const upb_fielddef *f)
void upb_inttable_uninit2(upb_inttable *t, upb_alloc *a)
@ UPB_DESCRIPTOR_TYPE_INT32
static uint32_t flt2uint32(float d)
static void * upb_global_allocfunc(upb_alloc *alloc, void *ptr, size_t oldsize, size_t size)
static void start_any_object(upb_json_parser *p, const char *ptr)
static void upb_setoneofcase(upb_decframe *frame, const upb_msglayout_field *field)
int upb_msgdef_numfields(const upb_msgdef *m)
static bool commit(upb_pb_encoder *e)
const upb_msgdef * upb_symtab_lookupmsg(const upb_symtab *s, const char *sym)
uint32_t upb_handlers_selectorbaseoffset(const upb_fielddef *f)
UPB_INLINE uint64_t upb_zzenc_64(int64_t n)
static const upb_msglayout_field google_protobuf_UninterpretedOption__fields[7]
bool upb_inttable_replace(upb_inttable *t, uintptr_t key, upb_value val)
static bool endmsg(void *c, const void *hd, upb_status *status)
upb_json_codecache * parser_codecache
bool upb_fielddef_hassubdef(const upb_fielddef *f)
char msg[UPB_STATUS_MAX_MESSAGE]
#define UPB_TIMESTAMP_SECONDS
bool upb_fielddef_checktype(int32_t type)
void upb_inttable_next(upb_inttable_iter *iter)
UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_name(const google_protobuf_FieldDescriptorProto *msg)
bool upb_inttable_sizedinit(upb_inttable *t, upb_ctype_t ctype, size_t asize, int hsize_lg2, upb_alloc *a)
const upb_msglayout google_protobuf_FileOptions_msginit
void upb_handlers_callback(const void *closure, upb_handlers *h)
zend_class_entry * value_type
static void start_timestamp_zone(upb_json_parser *p, const char *ptr)
strpc * newstrpc(upb_handlers *h, const upb_fielddef *f, bool preserve_fieldnames)
upb_sink upb_textprinter_input(upb_textprinter *p)
static int upb_msg_internalsize(const upb_msglayout *l)
const upb_msglayout google_protobuf_OneofOptions_msginit
uint32_t MurmurHash2(const void *key, size_t len, uint32_t seed)
static uint32_t upb_zzencode_32(int32_t n)
#define UPB_STRING_SELECTOR
int32_t upb_enumdef_default(const upb_enumdef *e)
bool upb_msgdef_isnumberwrapper(const upb_msgdef *m)
const upb_msglayout google_protobuf_UninterpretedOption_msginit
static bool mapkey_endstr(void *closure, const void *handler_data)
static upb_msg_internal_withext * upb_msg_getinternalwithext(upb_msg *msg, const upb_msglayout *l)
const upb_msglayout google_protobuf_ExtensionRangeOptions_msginit
static size_t putstr(void *closure, const void *handler_data, const char *str, size_t len, const upb_bufhandle *handle)
static void print_enum_symbolic_name(upb_json_printer *p, const upb_enumdef *def, int32_t val)
static bool checked_add(size_t a, size_t b, size_t *c)
static const upb_msglayout *const google_protobuf_ServiceDescriptorProto_submsgs[2]
static bool startmsg(void *c, const void *hd)
#define WRAPPER_SETHANDLERS(wrapper, type, putmethod)
static const unsigned char _json_trans_actions[]
const upb_symtab * upb_msgfactory_symtab(const upb_msgfactory *f)
UPB_INLINE size_t upb_bytessink_putbuf(upb_bytessink s, void *subc, const char *buf, size_t size, const upb_bufhandle *handle)
UPB_INLINE upb_strview google_protobuf_EnumDescriptorProto_name(const google_protobuf_EnumDescriptorProto *msg)
bool upb_byteshandler_setstring(upb_byteshandler *h, upb_string_handlerfunc *func, void *d)
const char * upb_enum_iter_name(upb_enum_iter *iter)
bool upb_msg_field_done(const upb_msg_field_iter *iter)
bool upb_inttable_lookupptr(const upb_inttable *t, const void *key, upb_value *v)
static const void * unpack_def(upb_value v, upb_deftype_t type)
static void putpush(compiler *c, const upb_fielddef *f)
void upb_pbcodecache_setallowjit(upb_pbcodecache *c, bool allow)
const upb_msglayout google_protobuf_FileDescriptorProto_msginit
static void * stringsink_start(void *_sink, const void *hd, size_t size_hint)
static bool end_duration_base(upb_json_parser *p, const char *ptr)
const upb_fielddef * upb_msgdef_itof(const upb_msgdef *m, uint32_t i)
#define CHECK_RETURN_TOP(x)
static const upb_tabent * upb_getentry(const upb_table *t, uint32_t hash)
const void * return_closure_type
static bool printer_startmsg_noframe(void *closure, const void *handler_data)
void printer_sethandlers_value(const void *closure, upb_handlers *h)
upb_func * upb_handlers_gethandler(const upb_handlers *h, upb_selector_t s, const void **handler_data)
static const int json_en_main
bool upb_enumdef_ntoi(const upb_enumdef *def, const char *name, size_t len, int32_t *num)
static bool start_fieldmask_path(upb_json_parser *p)
static size_t stringsink_string(void *_sink, const void *hd, const char *ptr, size_t len, const upb_bufhandle *handle)
const upb_json_parsermethod * m
#define T(type, ctype, convert, encode)
static bool parse_number(upb_json_parser *p, bool is_quoted)
static void init_frame(upb_jsonparser_frame *frame)
static bool parse_mapentry_key(upb_json_parser *p)
void upb_strtable_begin(upb_strtable_iter *i, const upb_strtable *t)
static bool end_timestamp_fraction(upb_json_parser *p, const char *ptr)
@ UPB_DESCRIPTOR_TYPE_ENUM
void upb_enum_begin(upb_enum_iter *i, const upb_enumdef *e)
static bool putseconds(void *closure, const void *handler_data, int64_t seconds)
static bool upb_decode_delimitedfield(upb_decstate *d, upb_decframe *frame, const char *field_start, const upb_msglayout_field *field)
static uint64_t get_encoded_tag(const upb_fielddef *f, int wire_type)
static bool endseq_fieldmask(void *closure, const void *handler_data)
static const upb_msglayout_field google_protobuf_EnumValueOptions__fields[2]
static const upb_msglayout *const google_protobuf_MethodOptions_submsgs[1]
static int instruction_len(uint32_t instr)
void * upb_startstr_handlerfunc(void *c, const void *hd, size_t size_hint)
UPB_INLINE upb_strview google_protobuf_DescriptorProto_name(const google_protobuf_DescriptorProto *msg)
static void start_any_member(upb_json_parser *p, const char *ptr)
static void seterr(upb_pbdecoder *d, const char *msg)
#define DEREF(msg, ofs, type)
UPB_INLINE uint32_t upb_inthash(uintptr_t key)
static bool end_hex(upb_json_parser *p)
UPB_INLINE upb_msgval upb_msgval_makestr(const char *data, size_t size)
static bool parser_putbool(upb_json_parser *p, bool val)
bool upb_fielddef_checklabel(int32_t label)
@ UPB_DESCRIPTOR_TYPE_SINT64
static bool start_number(upb_json_parser *p, const char *ptr)
static bool upb_put_varint(upb_encstate *e, uint64_t val)
UPB_INLINE bool upb_inttable_insert(upb_inttable *t, uintptr_t key, upb_value val)
static bool textprinter_startmsg(void *c, const void *hd)
const upb_bufhandle * handle
const void * top_closure_type
void printer_sethandlers_any(const void *closure, upb_handlers *h)
bool upb_map_set(upb_map *map, upb_msgval key, upb_msgval val, upb_msgval *removed)
UPB_INLINE void upb_inttable_compact(upb_inttable *t)
UPB_INLINE bool upb_bytessink_end(upb_bytessink s)
static bool is_number_wrapper_object(upb_json_parser *p)
upb_fieldtype_t upb_map_valuetype(const upb_map *map)
static bool upb_msg_inoneof(const upb_msglayout_field *field)
uint32_t upb_fielddef_number(const upb_fielddef *f)
static size_t align_up_max(size_t size)
static void multipart_end(upb_json_parser *p)
void upb_pbdecodermethodopts_setlazy(upb_pbcodecache *c, bool lazy)
static bool upb_decode_varint32(const char **ptr, const char *limit, uint32_t *val)
static size_t putstr_nokey(void *closure, const void *handler_data, const char *str, size_t len, const upb_bufhandle *handle)
static void putchecktag(compiler *c, const upb_fielddef *f, int wire_type, int dest)
const upb_msglayout google_protobuf_SourceCodeInfo_Location_msginit
static bool upb_put_fixed64(upb_encstate *e, uint64_t val)
const upb_enumdef * enumdef
static bool does_number_wrapper_end(upb_json_parser *p)
static bool does_number_wrapper_start(upb_json_parser *p)
static char * upb_decode_prepareslot(upb_decframe *frame, const upb_msglayout_field *field)
upb_label_t upb_fielddef_label(const upb_fielddef *f)
UPB_INLINE void * upb_gmalloc(size_t size)
const upb_msglayout google_protobuf_DescriptorProto_ExtensionRange_msginit
static str_t * newstr(upb_alloc *alloc, const char *data, size_t len)
static void generate_msgfield(compiler *c, const upb_fielddef *f, upb_pbdecodermethod *method)
static const upb_msglayout *const google_protobuf_ExtensionRangeOptions_submsgs[1]
#define UPB_STRVIEW_ARGS(view)
static void json_parser_any_frame_set_before_type_url_end(upb_jsonparser_any_frame *frame, const char *ptr)
static void start_hex(upb_json_parser *p)
static bool repeated_endstr(void *closure, const void *handler_data)
#define UPB_JSON_PARSER_SIZE
int upb_filedef_enumcount(const upb_filedef *f)
UPB_INLINE void upb_inttable_uninit(upb_inttable *table)
static size_t repeated_str(void *closure, const void *handler_data, const char *str, size_t len, const upb_bufhandle *handle)
static bool upb_put_float(upb_encstate *e, float d)
static UPB_FORCEINLINE int32_t decode_fixed64(upb_pbdecoder *d, uint64_t *u64)
upb_cleanup_func * cleanup
static void end_value_object(upb_json_parser *p)
static uint64_t dbl2uint64(double d)
static bool create_oneofdef(const symtab_addctx *ctx, upb_msgdef *m, const google_protobuf_OneofDescriptorProto *oneof_proto)
bool upb_oneof_done(upb_oneof_iter *iter)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_extendee(const google_protobuf_FieldDescriptorProto *msg)
upb_fieldtype_t upb_array_type(const upb_array *arr)
UPB_INLINE void * upb_grealloc(void *ptr, size_t oldsize, size_t size)
static bool upb_decode_32bit(const char **ptr, const char *limit, uint32_t *val)
static void compile_method(compiler *c, upb_pbdecodermethod *method)
static bool build_filedef(const symtab_addctx *ctx, upb_filedef *file, const google_protobuf_FileDescriptorProto *file_proto)
static size_t upb_encode_varint(uint64_t val, char *buf)
void upb_msg_oneof_iter_setdone(upb_msg_oneof_iter *iter)
struct google_protobuf_FileOptions google_protobuf_FileOptions
const unsigned short int __mon_yday[2][13]
#define SUBH(h, selector)
const upb_fielddef * exts
const upb_handlers * upb_pbdecodermethod_desthandlers(const upb_pbdecodermethod *m)
const char * phpnamespace
bool upb_inttable_lookup(const upb_inttable *t, uintptr_t key, upb_value *v)
upb_sink upb_json_printer_input(upb_json_printer *p)
static upb_value upb_toval(upb_msgval val)
static upb_tabent * emptyent(upb_table *t)
static upb_msgval upb_msgval_read(const void *p, size_t ofs, uint8_t size)
static bool putnanos(void *closure, const void *handler_data, int32_t nanos)
static const upb_msg_internal * upb_msg_getinternal_const(const upb_msg *msg)
static void nullz(upb_status *status)
static const upb_tabent * findentry(const upb_table *t, lookupkey_t key, uint32_t hash, eqlfunc_t *eql)
#define WRAPPER(wellknowntype, name)
upb_jsonparser_frame * limit
static const short _json_key_offsets[]
const char * before_type_url_start
static const upb_msglayout_field google_protobuf_ServiceOptions__fields[2]
#define VOIDPTR_AT(msg, ofs)
static const upb_msglayout_field google_protobuf_SourceCodeInfo_Location__fields[5]
const char * upb_status_errmsg(const upb_status *status)
static bool end_bool(upb_json_parser *p, bool val)
bool upb_pbdecodermethod_isnative(const upb_pbdecodermethod *m)
static bool end_number_nontop(upb_json_parser *p, const char *ptr)
const upb_handlers * dest_handlers_
static const upb_msglayout_field * upb_find_field(const upb_msglayout *l, uint32_t field_number)
const char * upb_msgdef_name(const upb_msgdef *m)
static void start_fieldmask_path_text(upb_json_parser *p, const char *ptr)
static size_t repeated_bytes(void *closure, const void *handler_data, const char *str, size_t len, const upb_bufhandle *handle)
static bool json_parser_any_frame_has_value(upb_jsonparser_any_frame *frame)
static bool upb_symtab_addtotabs(upb_symtab *s, symtab_addctx *ctx, upb_status *status)
static bool end_any_object(upb_json_parser *p, const char *ptr)
bool upb_float_handlerfunc(void *c, const void *hd, float val)
UPB_INLINE char * upb_gstrdup(const char *s)
const upb_symtab * symtab
UPB_INLINE char * upb_tabstr(upb_tabkey key, uint32_t *len)
struct google_protobuf_MessageOptions google_protobuf_MessageOptions
static void set_enum_hd(upb_handlers *h, const upb_fielddef *f, bool preserve_fieldnames, upb_handlerattr *attr)
const upb_filedef * upb_enumdef_file(const upb_enumdef *e)
bool upb_msg_has(const upb_msg *msg, int field_index, const upb_msglayout *l)
static const signed char b64table[]
const uint8_t upb_pb_native_wire_types[]
static size_t next(const upb_table *t, size_t i)
static size_t curbufleft(const upb_pbdecoder *d)
size_t delim_remaining(const upb_pbdecoder *d)
UPB_INLINE void * upb_malloc(upb_alloc *alloc, size_t size)
static const size_t maxalign
static void * scalar_startstr(void *closure, const void *handler_data, size_t size_hint)
static bool end_day(upb_json_parser *p, const char *ptr)
#define UPB_JSON_MAX_DEPTH
const upb_msglayout google_protobuf_DescriptorProto_msginit
upb_pbcodecache * upb_pbcodecache_new(upb_handlercache *dest)
#define UPB_PB_ENCODER_SIZE
GLsizei const GLfloat * value
static const upb_msglayout *const google_protobuf_FieldOptions_submsgs[1]
static bool encode_fixed32(upb_pb_encoder *e, uint32_t val)
#define UPB_STARTSTR_SELECTOR
UPB_INLINE bool google_protobuf_FileOptions_has_php_class_prefix(const google_protobuf_FileOptions *msg)
strpc * newstrpc_str(upb_handlers *h, const char *str)
static void uninit(upb_table *t, upb_alloc *a)
UPB_INLINE bool upb_strtable_lookup(const upb_strtable *t, const char *key, upb_value *v)
@ UPB_WELLKNOWN_FIELDMASK
UPB_INLINE int32_t google_protobuf_EnumValueDescriptorProto_number(const google_protobuf_EnumValueDescriptorProto *msg)
static void * scalar_startstr_nokey(void *closure, const void *handler_data, size_t size_hint)
UPB_INLINE int32_t google_protobuf_FieldDescriptorProto_type(const google_protobuf_FieldDescriptorProto *msg)
const upb_msglayout google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit
bool upb_inttable_insert2(upb_inttable *t, uintptr_t key, upb_value val, upb_alloc *a)
static bool upb_decode_tag(const char **ptr, const char *limit, int *field_number, int *wire_type)
#define UPB_SIZE(size32, size64)
UPB_INLINE upb_strview google_protobuf_FileOptions_php_namespace(const google_protobuf_FileOptions *msg)
static void json_parser_any_frame_set_payload_type(upb_json_parser *p, upb_jsonparser_any_frame *frame, const upb_msgdef *payload_type)
static bool upb_encode_scalarfield(upb_encstate *e, const char *field_mem, const upb_msglayout *m, const upb_msglayout_field *f, bool skip_zero_value)
int32_t upb_pbdecoder_resume(upb_pbdecoder *d, void *p, const char *buf, size_t size, const upb_bufhandle *handle)
static const char _json_trans_targs[]
UPB_INLINE bool upb_inttable_push(upb_inttable *t, upb_value val)
static bool parse_default(const symtab_addctx *ctx, const char *str, size_t len, upb_fielddef *f)
UPB_INLINE bool google_protobuf_FieldOptions_lazy(const google_protobuf_FieldOptions *msg)
static bool end_text(upb_json_parser *p, const char *ptr)
static void * startmap_nokey(void *closure, const void *handler_data)
const char * upb_filedef_phpnamespace(const upb_filedef *f)
const upb_filedef * upb_symtab_lookupfile(const upb_symtab *s, const char *name)
bool upb_strtable_lookup2(const upb_strtable *t, const char *key, size_t len, upb_value *v)
static bool decoder_push(upb_pbdecoder *d, uint64_t end)
@ UPB_DESCRIPTOR_TYPE_GROUP
static const upb_msglayout *const google_protobuf_FileDescriptorProto_submsgs[6]
UPB_INLINE int32_t google_protobuf_FieldDescriptorProto_number(const google_protobuf_FieldDescriptorProto *msg)
static upb_pb_encoder_segment * top(upb_pb_encoder *e)
const upb_json_parsermethod const upb_symtab upb_sink * output
#define UPB_PB_VARINT_MAX_LEN
static void upb_msglayout_free(upb_msglayout *l)
@ UPB_WELLKNOWN_UINT32VALUE
static bool accumulate_append(upb_json_parser *p, const char *buf, size_t len, bool can_alias)
const upb_handlers * upb_handlercache_get(upb_handlercache *c, const upb_msgdef *md)
#define UPB_TIMESTAMP_MAX_JSON_LEN
const UPB_INLINE google_protobuf_EnumDescriptorProto *const * google_protobuf_DescriptorProto_enum_type(const google_protobuf_DescriptorProto *msg, size_t *len)
bool _upb_symtab_loaddefinit(upb_symtab *s, const upb_def_init *init)
static void upb_arena_addblock(upb_arena *a, void *ptr, size_t size, bool owned)
void upb_msg_oneof_next(upb_msg_oneof_iter *iter)
#define UPB_TIMESTAMP_BEFORE_NANO_LEN
bool upb_msg_field_iter_isequal(const upb_msg_field_iter *iter1, const upb_msg_field_iter *iter2)
static bool is_top_level(upb_json_parser *p)
static int64_t upb_zzdecode_64(uint64_t n)
upb_syntax_t upb_msgdef_syntax(const upb_msgdef *m)
const upb_msglayout google_protobuf_EnumOptions_msginit
const upb_enumdef * enumdef
const upb_msgdef * upb_fielddef_containingtype(const upb_fielddef *f)
bool upb_uint32_handlerfunc(void *c, const void *hd, uint32_t val)
upb_mapiter * upb_mapiter_new(const upb_map *t, upb_alloc *a)
UPB_INLINE size_t upb_strtable_count(const upb_strtable *t)
static void * upb_array_add(upb_array *arr, size_t elements)
const upb_pbdecodermethod * upb_pbcodecache_get(upb_pbcodecache *c, const upb_msgdef *md)
static bool scalar_enum(void *closure, const void *handler_data, int32_t val)
const char * upb_msg_getunknown(const upb_msg *msg, size_t *len)
void * upb_pbdecoder_startjit(void *closure, const void *hd, size_t size_hint)
upb_jsonparser_frame stack[UPB_JSON_MAX_DEPTH]
static bool check_stack(upb_json_parser *p)
UPB_INLINE upb_strview google_protobuf_FieldDescriptorProto_type_name(const google_protobuf_FieldDescriptorProto *msg)
const upb_tabent * entries
static const upb_msglayout_field google_protobuf_EnumValueDescriptorProto__fields[3]
const char * upb_msgdef_fullname(const upb_msgdef *m)
bool upb_ok(const upb_status *status)
static bool end_year(upb_json_parser *p, const char *ptr)
static uint32_t * group(tarjan *t, upb_refcounted *r)
@ UPB_DESCRIPTOR_TYPE_SFIXED64
GLboolean GLboolean GLboolean GLboolean a
static UPB_FORCEINLINE void consumebytes(upb_pbdecoder *d, void *buf, size_t bytes)
static size_t upb_msglayout_place(upb_msglayout *l, size_t size)
const upb_msglayout google_protobuf_EnumValueOptions_msginit
static bool end(void *closure, const void *hd)
#define UPB_STARTMSG_SELECTOR
static int32_t skip(upb_pbdecoder *d, size_t bytes)
const void * handler_data
static void check(upb_inttable *t)
static bool resolvename(const upb_strtable *t, const upb_fielddef *f, const char *base, upb_strview sym, upb_deftype_t type, upb_status *status, const void **def)
static void start_day(upb_json_parser *p, const char *ptr)
static bool upb_decode_64bit(const char **ptr, const char *limit, uint64_t *val)
UPB_NOINLINE int32_t upb_pbdecoder_decode_varint_slow(upb_pbdecoder *d, uint64_t *u64)
static float as_float(uint32_t n)
static void advance(upb_pbdecoder *d, size_t len)
const upb_byteshandler * upb_json_parsermethod_inputhandler(const upb_json_parsermethod *m)
size_t run_decoder_vm(upb_pbdecoder *d, const mgroup *group, const upb_bufhandle *handle)
bool upb_startmsg_handlerfunc(void *c, const void *)
uint32_t upb_fielddef_index(const upb_fielddef *f)
static bool create_msgdef(const symtab_addctx *ctx, const char *prefix, const google_protobuf_DescriptorProto *msg_proto)
static void upb_decode_setpresent(upb_decframe *frame, const upb_msglayout_field *field)
static const char kControlCharLimit
void upb_msgfactory_free(upb_msgfactory *f)
bool upb_handlers_setendmsg(upb_handlers *h, upb_endmsg_handlerfunc *func, const upb_handlerattr *attr)
static const upb_msglayout_field google_protobuf_OneofOptions__fields[1]
void upb_inttable_compact2(upb_inttable *t, upb_alloc *a)
UPB_INLINE uint64_t upb_pbdecoder_packdispatch(uint64_t ofs, uint8_t wt1, uint8_t wt2)
bool upb_endmsg_handlerfunc(void *c, const void *, upb_status *status)
static size_t encode_strbuf(void *c, const void *hd, const char *buf, size_t len, const upb_bufhandle *h)
static const upb_msglayout *const google_protobuf_GeneratedCodeInfo_submsgs[1]
const upb_msgdef * upb_filedef_msg(const upb_filedef *f, int i)
UPB_INLINE int32_t google_protobuf_FieldDescriptorProto_oneof_index(const google_protobuf_FieldDescriptorProto *msg)
UPB_INLINE bool google_protobuf_FieldOptions_packed(const google_protobuf_FieldOptions *msg)
static size_t upb_roundup_pow2(size_t bytes)
static uint64_t upb_zzencode_64(int64_t n)
bool upb_inttable_removeptr(upb_inttable *t, const void *key, upb_value *val)
upb_array * upb_array_new(upb_fieldtype_t type, upb_arena *a)
@ UPB_DESCRIPTOR_TYPE_STRING
const upb_msglayout google_protobuf_FieldDescriptorProto_msginit
void * upb_pbdecoder_startbc(void *closure, const void *pc, size_t size_hint)
const upb_msglayout * upb_msgfactory_getlayout(upb_msgfactory *f, const upb_msgdef *m)
static void switchtobuf(upb_pbdecoder *d, const char *buf, const char *end)
static bool does_fieldmask_end(upb_json_parser *p)
char * upb_strdup2(const char *s, size_t len, upb_alloc *a)
static const char * shortname(const char *longname)
static int32_t getofs(uint32_t instruction)
upb_msgval upb_array_get(const upb_array *arr, size_t i)
UPB_INLINE void _upb_value_setval(upb_value *v, uint64_t val, upb_ctype_t ctype)
bool checkstart(upb_handlers *h, const upb_fielddef *f, upb_handlertype_t type, upb_status *status)
static bool start_array(upb_json_parser *p)
bool upb_fielddef_haspresence(const upb_fielddef *f)
@ UPB_DESCRIPTOR_TYPE_DOUBLE
static bool textprinter_endmsg(void *c, const void *hd, upb_status *s)
static bool create_enumdef(const symtab_addctx *ctx, const char *prefix, const google_protobuf_EnumDescriptorProto *enum_proto)
bool upb_handlers_setint64(upb_handlers *h, const upb_fielddef *f, upb_int64_handlerfunc *func, const upb_handlerattr *attr)
int32_t upb_pbdecoder_decode_f64(upb_pbdecoder *d, uint64_t *u64)
#define UPB_STRVIEW_FORMAT
static bool pushtagdelim(upb_pbdecoder *d, uint32_t arg)
int32_t b64lookup(unsigned char ch)
const Descriptor::ReservedRange const EnumValueDescriptor method
UPB_INLINE bool google_protobuf_MessageOptions_map_entry(const google_protobuf_MessageOptions *msg)
GLfloat GLfloat GLfloat GLfloat h
uint32_t upb_fielddef_defaultuint32(const upb_fielddef *f)
static bool upb_skip_unknowngroup(upb_decstate *d, int field_number, const char *limit)
static void * scalar_startstr_onlykey(void *closure, const void *handler_data, size_t size_hint)
static void start_hour(upb_json_parser *p, const char *ptr)
zend_class_entry * descriptor_type
static bool upb_decode_varint(const char **ptr, const char *limit, uint64_t *val)
#define UPB_TIMESTAMP_MAX_NANO_LEN
const char * upb_fielddef_defaultstr(const upb_fielddef *f, size_t *len)
static size_t upb_msg_sizeof(const upb_msglayout *l)
const upb_enumdef * upb_filedef_enum(const upb_filedef *f, int i)
bool upb_handlers_setuint64(upb_handlers *h, const upb_fielddef *f, upb_uint64_handlerfunc *func, const upb_handlerattr *attr)
bool upb_bufsrc_putbuf(const char *buf, size_t len, upb_bytessink sink)
static void onmreg(const void *c, upb_handlers *h)
static bool upb_readhasbit(const char *msg, const upb_msglayout_field *f)
@ UPB_WELLKNOWN_DOUBLEVALUE
static void end_subobject_full(upb_json_parser *p)
const upb_fielddef * upb_msgdef_ntof(const upb_msgdef *m, const char *name, size_t len)
static const int json_en_timestamp_machine
UPB_INLINE upb_strview google_protobuf_FieldDescriptorProto_default_value(const google_protobuf_FieldDescriptorProto *msg)
bool upb_handlers_setstring(upb_handlers *h, const upb_fielddef *f, upb_string_handlerfunc *func, const upb_handlerattr *attr)
UPB_INLINE bool upb_sink_endmsg(upb_sink s, upb_status *status)
static bool endmap(void *closure, const void *handler_data)
const upb_oneofdef * oneof
static bool encode_endgroup(void *c, const void *hd)
bool upb_map_get(const upb_map *map, upb_msgval key, upb_msgval *val)
const upb_strtable * name_table
bool upb_inttable_insertptr2(upb_inttable *t, const void *key, upb_value val, upb_alloc *a)
libaditof
Author(s):
autogenerated on Wed May 21 2025 02:07:00