Go to the documentation of this file.
53 #if !((defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \
54 (defined(__cplusplus) && __cplusplus >= 201103L) || \
55 (defined(_MSC_VER) && _MSC_VER >= 1900))
56 #error upb requires C99 or C++11 or MSVC >= 2015.
62 #if UINTPTR_MAX == 0xffffffff
63 #define UPB_SIZE(size32, size64) size32
65 #define UPB_SIZE(size32, size64) size64
71 #define UPB_PTR_AT(msg, ofs, type) ((type*)((char*)(msg) + (ofs)))
73 #define UPB_READ_ONEOF(msg, fieldtype, offset, case_offset, case_val, default) \
74 *UPB_PTR_AT(msg, case_offset, int) == case_val \
75 ? *UPB_PTR_AT(msg, offset, fieldtype) \
78 #define UPB_WRITE_ONEOF(msg, fieldtype, offset, value, case_offset, case_val) \
79 *UPB_PTR_AT(msg, case_offset, int) = case_val; \
80 *UPB_PTR_AT(msg, offset, fieldtype) = value;
82 #define UPB_MAPTYPE_STRING 0
86 #define UPB_INLINE inline
87 #elif defined (__GNUC__) || defined(__clang__)
88 #define UPB_INLINE static __inline__
90 #define UPB_INLINE static
93 #define UPB_ALIGN_UP(size, align) (((size) + (align) - 1) / (align) * (align))
94 #define UPB_ALIGN_DOWN(size, align) ((size) / (align) * (align))
95 #define UPB_ALIGN_MALLOC(size) UPB_ALIGN_UP(size, 16)
96 #define UPB_ALIGN_OF(type) offsetof (struct { char c; type member; }, member)
99 #if defined (__GNUC__) || defined(__clang__)
100 #define UPB_LIKELY(x) __builtin_expect((x),1)
101 #define UPB_UNLIKELY(x) __builtin_expect((x),0)
103 #define UPB_LIKELY(x) (x)
104 #define UPB_UNLIKELY(x) (x)
109 #define UPB_FORCEINLINE __inline__ __attribute__((always_inline))
110 #define UPB_NOINLINE __attribute__((noinline))
111 #define UPB_NORETURN __attribute__((__noreturn__))
112 #define UPB_PRINTF(str, first_vararg) __attribute__((format (printf, str, first_vararg)))
113 #elif defined(_MSC_VER)
115 #define UPB_FORCEINLINE
116 #define UPB_NORETURN __declspec(noreturn)
117 #define UPB_PRINTF(str, first_vararg)
119 #define UPB_FORCEINLINE
122 #define UPB_PRINTF(str, first_vararg)
125 #define UPB_MAX(x, y) ((x) > (y) ? (x) : (y))
126 #define UPB_MIN(x, y) ((x) < (y) ? (x) : (y))
128 #define UPB_UNUSED(var) (void)var
134 #define UPB_ASSUME(expr) if (!(expr)) __builtin_unreachable()
135 #elif defined _MSC_VER
136 #define UPB_ASSUME(expr) if (!(expr)) __assume(0)
138 #define UPB_ASSUME(expr) do {} while (false && (expr))
141 #define UPB_ASSUME(expr) assert(expr)
147 #define UPB_ASSERT(expr) do {} while (false && (expr))
149 #define UPB_ASSERT(expr) assert(expr)
152 #if defined(__GNUC__) || defined(__clang__)
153 #define UPB_UNREACHABLE() do { assert(0); __builtin_unreachable(); } while(0)
155 #define UPB_UNREACHABLE() do { assert(0); } while(0)
160 #define UPB_SETJMP(buf) _setjmp(buf)
161 #define UPB_LONGJMP(buf, val) _longjmp(buf, val)
163 #define UPB_SETJMP(buf) setjmp(buf)
164 #define UPB_LONGJMP(buf, val) longjmp(buf, val)
168 #define UPB_PTRADD(ptr, ofs) ((ofs) ? (ptr) + (ofs) : (ptr))
172 #ifdef __has_attribute
173 #define UPB_HAS_ATTRIBUTE(x) __has_attribute(x)
175 #define UPB_HAS_ATTRIBUTE(x) 0
178 #if UPB_HAS_ATTRIBUTE(musttail)
179 #define UPB_MUSTTAIL __attribute__((musttail))
184 #undef UPB_HAS_ATTRIBUTE
200 #if (defined(__x86_64__) || defined(__aarch64__)) && defined(__GNUC__)
201 #define UPB_FASTTABLE_SUPPORTED 1
203 #define UPB_FASTTABLE_SUPPORTED 0
209 #if defined(UPB_ENABLE_FASTTABLE)
210 #if !UPB_FASTTABLE_SUPPORTED
211 #error fasttable is x86-64/ARM64 only and requires GCC or Clang.
213 #define UPB_FASTTABLE 1
217 #elif defined(UPB_TRY_ENABLE_FASTTABLE)
218 #define UPB_FASTTABLE UPB_FASTTABLE_SUPPORTED
220 #define UPB_FASTTABLE 0
225 #if !UPB_FASTTABLE && defined(UPB_TRY_ENABLE_FASTTABLE)
226 #define UPB_FASTTABLE_INIT(...)
228 #define UPB_FASTTABLE_INIT(...) __VA_ARGS__
231 #undef UPB_FASTTABLE_SUPPORTED
235 #if defined(__SANITIZE_ADDRESS__)
245 #define UPB_POISON_MEMORY_REGION(addr, size) \
246 __asan_poison_memory_region((addr), (size))
247 #define UPB_UNPOISON_MEMORY_REGION(addr, size) \
248 __asan_unpoison_memory_region((addr), (size))
251 #define UPB_POISON_MEMORY_REGION(addr, size) \
252 ((void)(addr), (void)(size))
253 #define UPB_UNPOISON_MEMORY_REGION(addr, size) \
254 ((void)(addr), (void)(size))
320 #define OP_SCALAR_LG2(n) (n)
325 #define OP_FIXPCK_LG2(n) (n + 5)
326 #define OP_VARPCK_LG2(n) (n + 9)
407 #pragma clang diagnostic push
408 #pragma clang diagnostic ignored "-Wunknown-warning-option"
409 #pragma clang diagnostic ignored "-Wsuggest-attribute"
418 #pragma clang diagnostic pop
422 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
423 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
424 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
425 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
426 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
427 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
428 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
429 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
430 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
431 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
432 4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0,
457 for (
i = 1;
i < 10;
i++) {
459 val += (
byte - 1) << (
i * 7);
460 if (!(
byte & 0x80)) {
528 int *last_field_index) {
531 if (
l == NULL)
return &none;
533 size_t idx = ((size_t)field_number) - 1;
534 if (idx < l->dense_below) {
539 int last = *last_field_index;
540 for (
idx = last;
idx <
l->field_count;
idx++) {
541 if (
l->fields[
idx].number == field_number) {
547 if (
l->fields[
idx].number == field_number) {
556 *last_field_index =
idx;
557 return &
l->fields[
idx];
684 int mask = (1 << lg2) - 1;
686 if ((val->
size & mask) != 0) {
700 int scale = 1 << lg2;
743 memset(&ent, 0,
sizeof(ent));
764 if (
field->presence > 0) {
766 }
else if (
field->presence < 0) {
772 *oneof_case =
field->number;
816 if (
layout &&
layout->table_mask != (
unsigned char)-1) {
829 int last_field_index = 0;
835 const char *field_start =
ptr;
841 field_number =
tag >> 3;
867 int ndx =
field->descriptortype;
885 d->end_group = field_number;
913 d->unknown = field_start;
914 d->unknown_msg =
msg;
916 d->unknown_msg = NULL;
917 field_start =
d->unknown;
958 }
else if (
size <= 16) {
972 state.unknown_msg = NULL;
977 state.arena.cleanup_metadata =
arena->cleanup_metadata;
988 arena->cleanup_metadata =
state.arena.cleanup_metadata;
1008 #define UPB_PB_VARINT_MAX_LEN 10
1016 if (val)
byte |= 0x80U;
1048 size_t old_size = e->limit - e->buf;
1059 e->ptr = new_buf +
new_size - (e->limit - e->ptr);
1070 if ((
size_t)(e->ptr - e->buf) <
bytes) {
1080 if (
len == 0)
return;
1109 if (val < 128 && e->
ptr != e->buf) {
1138 size_t bytes = arr->
len * elem_size;
1158 bool skip_zero_value) {
1159 const char *field_mem = _field_mem;
1162 #define CASE(ctype, type, wtype, encodeval) \
1164 ctype val = *(ctype *)field_mem; \
1165 if (skip_zero_value && val == 0) { \
1168 encode_##type(e, encodeval); \
1169 wire_type = wtype; \
1173 switch (
f->descriptortype) {
1201 if (skip_zero_value && view.
size == 0) {
1211 void *submsg = *(
void **)field_mem;
1213 if (submsg == NULL) {
1225 void *submsg = *(
void **)field_mem;
1227 if (submsg == NULL) {
1249 size_t pre_len = e->limit - e->ptr;
1251 if (arr == NULL || arr->
len == 0) {
1255 #define VARINT_CASE(ctype, encode) \
1257 const ctype *start = _upb_array_constptr(arr); \
1258 const ctype *ptr = start + arr->len; \
1259 uint32_t tag = packed ? 0 : (f->number << 3) | UPB_WIRE_TYPE_VARINT; \
1262 encode_varint(e, encode); \
1263 if (tag) encode_varint(e, tag); \
1264 } while (ptr != start); \
1268 #define TAG(wire_type) (packed ? 0 : (f->number << 3 | wire_type))
1270 switch (
f->descriptortype) {
1355 size_t pre_len = e->limit - e->ptr;
1359 size = (e->limit - e->ptr) - pre_len;
1370 if (
map == NULL)
return;
1398 bool skip_empty =
false;
1399 if (
f->presence == 0) {
1402 }
else if (
f->presence > 0) {
1414 size_t pre_len = e->limit - e->ptr;
1419 size_t unknown_size;
1444 *
size = (e->limit - e->ptr) - pre_len;
1466 *
size = e.limit - e.ptr;
1503 if (!
in->internal) {
1507 if (!
internal)
return false;
1508 internal->size =
size;
1510 internal->ext_begin =
size;
1511 in->internal =
internal;
1512 }
else if (
in->internal->ext_begin -
in->internal->unknown_end < need) {
1515 size_t ext_bytes =
in->internal->size -
in->internal->ext_begin;
1516 size_t new_ext_begin =
new_size - ext_bytes;
1519 if (!
internal)
return false;
1522 char *
ptr = (
char*)
internal;
1523 memmove(
ptr + new_ext_begin,
ptr +
internal->ext_begin, ext_bytes);
1525 internal->ext_begin = new_ext_begin;
1527 in->internal =
internal;
1529 UPB_ASSERT(
in->internal->ext_begin -
in->internal->unknown_end >= need);
1538 in->internal->unknown_end +=
len;
1553 return (
char*)(
in->internal + 1);
1580 for (
size_t i = 0;
i <
n;
i++) {
1606 int elem_size_lg2 = arr->
data & 7;
1607 size_t old_bytes = arr->
size << elem_size_lg2;
1614 new_bytes =
new_size << elem_size_lg2;
1631 if (!arr)
return NULL;
1647 if (!arr)
return false;
1649 size_t elems = arr->
len;
1670 map->key_size = key_size;
1671 map->val_size = value_size;
1677 void *b_key,
size_t size) {
1719 size_t common_size =
UPB_MIN(
a.size,
b.size);
1720 int cmp = memcmp(
a.data,
b.data, common_size);
1722 return a.size -
b.size;
1728 sorted->
start = s->size;
1730 sorted->
end = sorted->
start + map_size;
1733 if (sorted->
end > s->cap) {
1735 s->entries = realloc(s->entries, s->cap *
sizeof(*s->entries));
1736 if (!s->entries)
return false;
1739 s->size = sorted->
end;
1745 for (; src <
end; src++) {
1755 int (*compar)(
const void *,
const void *);
1787 qsort(&s->entries[sorted->
start], map_size,
sizeof(*s->entries), compar);
1798 #define EXTREG_KEY_SIZE (sizeof(upb_msglayout*) + sizeof(uint32_t))
1802 memcpy(
buf +
sizeof(
l), &fieldnum,
sizeof(fieldnum));
1807 if (!
r)
return NULL;
1817 for (; e <
end; e++) {
1820 upb_value_constptr(e),
r->arena)) {
1842 return upb_value_getconstptr(
v);
1860 #define UPB_MAXARRSIZE 16
1863 #define ARRAY_SIZE(x) \
1864 ((sizeof(x)/sizeof(0[x])) / ((size_t)(!(sizeof(x) % sizeof(0[x])))))
1884 while (
v >>= 1)
ret++;
1938 return t->entries + (
hash & t->mask);
1947 return t->count == t->max_count;
1954 t->size_lg2 = size_lg2;
1960 if (!t->entries)
return false;
1971 for (e = e + 1; e <
end; e++) {
1989 if (t->size_lg2 == 0)
return NULL;
1993 if (eql(e->key,
key))
return e;
1994 if ((e = e->next) == NULL)
return NULL;
2037 if (chain == mainpos_e) {
2041 mainpos_e->
next = new_e;
2047 *new_e = *mainpos_e;
2048 while (chain->
next != mainpos_e) {
2052 chain->
next = new_e;
2057 our_e->
key = tabkey;
2066 if (eql(chain->
key,
key)) {
2070 if (removed) *removed = chain->
key;
2090 if (removed) *removed =
rm->key;
2122 if (
str == NULL)
return 0;
2143 #if defined(_MSC_VER) && defined(_M_X64)
2150 #ifdef __SIZEOF_INT128__
2155 #elif defined(_MSC_VER) && defined(_M_X64)
2156 return _umul128(v0, v1, out_high);
2166 low += (mid1 << 32) + (mid2 << 32);
2168 high += (mid1 >> 32) + (mid2 >> 32);
2190 uint64_t duplicated_state = current_state;
2204 current_state = (cs0 ^ cs1);
2208 duplicated_state = (ds0 ^ ds1);
2214 current_state = current_state ^ duplicated_state;
2223 current_state =
WyhashMix(
a ^ salt[1],
b ^ current_state);
2239 }
else if (
len > 3) {
2244 }
else if (
len > 0) {
2260 0x243F6A8885A308D3
ULL, 0x13198A2E03707344
ULL, 0xA4093822299F31D0
ULL,
2261 0x082EFA98EC4E6C89
ULL, 0x452821E638D01377
ULL,
2277 return len ==
k2.str.len && (
len == 0 || memcmp(
str,
k2.str.str,
len) == 0);
2282 size_t need_entries = (expected_size + 1) * 1204 / 1024;
2283 UPB_ASSERT(need_entries >= expected_size * 0.85);
2285 return init(&t->t, size_lg2,
a);
2298 if (!
init(&new_table.
t, size_lg2,
a))
2325 if (tabkey == 0)
return false;
2353 i->index =
next(&
i->t->t,
i->index);
2357 if (!
i->t)
return true;
2385 return i1->t ==
i2->t &&
i1->index ==
i2->index;
2397 return k1 ==
k2.num;
2405 if (key < t->array_size) {
2410 return e ? &e->val : NULL;
2420 return t->t.count + t->array_count;
2425 #if defined(UPB_DEBUG_TABLE) && !defined(NDEBUG)
2443 if (!
init(&t->t, hsize_lg2,
a))
return false;
2446 t->array_size =
UPB_MAX(1, asize);
2448 array_bytes = t->array_size *
sizeof(
upb_value);
2468 if (key < t->array_size) {
2478 if (!
init(&new_table, t->t.size_lg2 + 1,
a)) {
2504 if (!table_v)
return false;
2511 if (!table_v)
return false;
2518 if (key < t->array_size) {
2561 for (size_lg2 =
ARRAY_SIZE(counts) - 1; size_lg2 > 0; size_lg2--) {
2562 if (counts[size_lg2] == 0) {
2565 }
else if (arr_count >= (1 << size_lg2) *
MIN_DENSITY) {
2569 arr_count -= counts[size_lg2];
2576 size_t arr_size =
max[size_lg2] + 1;
2578 size_t hash_size = hash_count ? (hash_count /
MAX_LOAD) + 1 : 0;
2579 int hashsize_lg2 =
log2ceil(hash_size);
2597 return &
i->t->t.entries[
i->index];
2602 return i->t->array[
i->index];
2608 i->array_part =
true;
2614 if (
iter->array_part) {
2615 while (++
iter->index < t->array_size) {
2620 iter->array_part =
false;
2628 if (!
i->t)
return true;
2629 if (
i->array_part) {
2630 return i->index >=
i->t->array_size ||
2652 i->array_part =
false;
2659 return i1->t ==
i2->t &&
i1->index ==
i2->index &&
2660 i1->array_part ==
i2->array_part;
2731 return (
uint32_t *)(cleanup_metadata & ~0x1);
2735 return cleanup_metadata & 0x1;
2739 bool has_initial_block) {
2766 while (
a->parent !=
a) {
2768 a->parent =
next->parent;
2781 block->cleanups = 0;
2783 a->last_size =
block->size;
2799 if (!
block)
return false;
2823 n = first_block_overhead + 256;
2836 a->freelist_tail = NULL;
2879 if (
block->cleanups > 0) {
2923 if (r1 == r2)
return true;
2970 #define UPB_PARSE_PARAMS \
2971 upb_decstate *d, const char *ptr, upb_msg *msg, intptr_t table, \
2972 uint64_t hasbits, uint64_t data
2974 #define UPB_PARSE_ARGS d, ptr, msg, table, hasbits, data
2976 #define RETURN_GENERIC(m) \
2980 return fastdecode_generic(d, ptr, msg, table, hasbits, 0);
2997 UPB_MUSTTAIL return fastdecode_tagdispatch(UPB_PARSE_ARGS);
3003 int overrun =
ptr -
d->end;
3010 UPB_MUSTTAIL return fastdecode_isdonefallback(UPB_PARSE_ARGS);
3016 UPB_MUSTTAIL return fastdecode_tagdispatch(UPB_PARSE_ARGS);
3020 static bool fastdecode_checktag(
uint16_t data,
int tagbytes) {
3021 if (tagbytes == 1) {
3022 return (
data & 0xff) == 0;
3029 static const char *fastdecode_longsize(
const char *
ptr,
int *
size) {
3033 for (
i = 0;
i < 3;
i++) {
3036 *
size += (
byte - 1) << (7 + 7 *
i);
3044 *
size += (
byte - 1) << 28;
3049 static bool fastdecode_boundscheck(
const char *
ptr,
size_t len,
3054 return res < uptr || res > uend;
3058 static bool fastdecode_boundscheck2(
const char *
ptr,
size_t len,
3068 return res < uptr || res > uend;
3076 fastdecode_delimfunc *
func,
void *
ctx) {
3079 if (fastdecode_boundscheck2(
ptr,
len,
d->limit_ptr)) {
3091 if (
ptr -
d->end + (
int)
len >
d->limit) {
3101 const char *saved_limit_ptr =
d->limit_ptr;
3102 int saved_limit =
d->limit;
3104 d->limit =
d->limit_ptr -
d->end;
3107 d->limit_ptr = saved_limit_ptr;
3108 d->limit = saved_limit;
3129 fastdecode_next
next;
3131 } fastdecode_nextret;
3135 fastdecode_arr *farr,
int valbytes) {
3138 size_t old_bytes =
old_size * valbytes;
3140 size_t new_bytes =
new_size * valbytes;
3143 uint8_t elem_size_lg2 = __builtin_ctz(valbytes);
3147 farr->end = (
void*)(new_ptr + (
new_size * valbytes));
3154 if (tagbytes == 1) {
3162 static void fastdecode_commitarr(
void *
dst, fastdecode_arr *farr,
3169 static fastdecode_nextret fastdecode_nextrepeated(
upb_decstate *
d,
void *
dst,
3171 fastdecode_arr *farr,
3174 fastdecode_nextret
ret;
3175 dst = (
char *)
dst + valbytes;
3179 if (fastdecode_tagmatch(
ret.tag,
data, tagbytes)) {
3180 ret.next = FD_NEXT_SAMEFIELD;
3182 fastdecode_commitarr(
dst, farr, valbytes);
3183 ret.next = FD_NEXT_OTHERFIELD;
3186 fastdecode_commitarr(
dst, farr, valbytes);
3187 ret.next = FD_NEXT_ATLIMIT;
3196 size_t ofs =
data >> 48;
3197 return (
char *)
msg + ofs;
3203 fastdecode_arr *farr,
int valbytes,
3209 *hasbits |= 1ull << hasbit_index;
3210 return fastdecode_fieldmem(
msg, *
data);
3216 *oneof_case = field_number;
3217 return fastdecode_fieldmem(
msg, *
data);
3221 uint8_t elem_size_lg2 = __builtin_ctz(valbytes);
3233 farr->end =
begin + (farr->arr->size * valbytes);
3235 return begin + (farr->arr->len * valbytes);
3243 static bool fastdecode_flippacked(
uint64_t *
data,
int tagbytes) {
3244 *
data ^= (0x2 ^ 0x0);
3245 return fastdecode_checktag(*
data, tagbytes);
3248 #define FASTDECODE_CHECKPACKED(tagbytes, card, func) \
3249 if (UPB_UNLIKELY(!fastdecode_checktag(data, tagbytes))) { \
3250 if (card == CARD_r && fastdecode_flippacked(&data, tagbytes)) { \
3251 UPB_MUSTTAIL return func(UPB_PARSE_ARGS); \
3253 RETURN_GENERIC("packed check tag mismatch\n"); \
3259 static uint64_t fastdecode_munge(
uint64_t val,
int valbytes,
bool zigzag) {
3260 if (valbytes == 1) {
3262 }
else if (zigzag) {
3263 if (valbytes == 4) {
3266 }
else if (valbytes == 8) {
3267 return (val >> 1) ^ -(
int64_t)(val & 1);
3275 static const char *fastdecode_varint64(
const char *
ptr,
uint64_t *val) {
3280 for (
i = 0;
i < 8;
i++) {
3283 *val += (
byte - 1) << (7 + 7 *
i);
3291 *val += (
byte - 1) << 63;
3298 #define FASTDECODE_UNPACKEDVARINT(d, ptr, msg, table, hasbits, data, tagbytes, \
3299 valbytes, card, zigzag, packed) \
3302 fastdecode_arr farr; \
3304 FASTDECODE_CHECKPACKED(tagbytes, card, packed); \
3306 dst = fastdecode_getfield(d, ptr, msg, &data, &hasbits, &farr, valbytes, \
3308 if (card == CARD_r) { \
3309 if (UPB_UNLIKELY(!dst)) { \
3310 RETURN_GENERIC("need array resize\n"); \
3315 if (card == CARD_r) { \
3316 dst = fastdecode_resizearr(d, dst, &farr, valbytes); \
3320 ptr = fastdecode_varint64(ptr, &val); \
3322 return fastdecode_err(d); \
3323 val = fastdecode_munge(val, valbytes, zigzag); \
3324 memcpy(dst, &val, valbytes); \
3326 if (card == CARD_r) { \
3327 fastdecode_nextret ret = fastdecode_nextrepeated( \
3328 d, dst, &ptr, &farr, data, tagbytes, valbytes); \
3329 switch (ret.next) { \
3330 case FD_NEXT_SAMEFIELD: \
3333 case FD_NEXT_OTHERFIELD: \
3335 UPB_MUSTTAIL return fastdecode_tagdispatch(UPB_PARSE_ARGS); \
3336 case FD_NEXT_ATLIMIT: \
3341 UPB_MUSTTAIL return fastdecode_dispatch(UPB_PARSE_ARGS);
3347 fastdecode_arr farr;
3348 } fastdecode_varintdata;
3351 static const char *fastdecode_topackedvarint(
upb_decstate *
d,
const char *
ptr,
3353 fastdecode_varintdata *
data =
ctx;
3359 ptr = fastdecode_varint64(
ptr, &val);
3360 if (
ptr == NULL)
return NULL;
3361 val = fastdecode_munge(val,
data->valbytes,
data->zigzag);
3366 fastdecode_commitarr(
dst, &
data->farr,
data->valbytes);
3370 #define FASTDECODE_PACKEDVARINT(d, ptr, msg, table, hasbits, data, tagbytes, \
3371 valbytes, zigzag, unpacked) \
3372 fastdecode_varintdata ctx = {valbytes, zigzag}; \
3374 FASTDECODE_CHECKPACKED(tagbytes, CARD_r, unpacked); \
3376 ctx.dst = fastdecode_getfield(d, ptr, msg, &data, &hasbits, &ctx.farr, \
3377 valbytes, CARD_r); \
3378 if (UPB_UNLIKELY(!ctx.dst)) { \
3379 RETURN_GENERIC("need array resize\n"); \
3383 ptr = fastdecode_delimited(d, ptr, &fastdecode_topackedvarint, &ctx); \
3385 if (UPB_UNLIKELY(ptr == NULL)) { \
3386 return fastdecode_err(d); \
3389 UPB_MUSTTAIL return fastdecode_dispatch(d, ptr, msg, table, hasbits, 0);
3391 #define FASTDECODE_VARINT(d, ptr, msg, table, hasbits, data, tagbytes, \
3392 valbytes, card, zigzag, unpacked, packed) \
3393 if (card == CARD_p) { \
3394 FASTDECODE_PACKEDVARINT(d, ptr, msg, table, hasbits, data, tagbytes, \
3395 valbytes, zigzag, unpacked); \
3397 FASTDECODE_UNPACKEDVARINT(d, ptr, msg, table, hasbits, data, tagbytes, \
3398 valbytes, card, zigzag, packed); \
3408 #define F(card, type, valbytes, tagbytes) \
3410 const char *upb_p##card##type##valbytes##_##tagbytes##bt(UPB_PARSE_PARAMS) { \
3411 FASTDECODE_VARINT(d, ptr, msg, table, hasbits, data, tagbytes, valbytes, \
3412 CARD_##card, type##_ZZ, \
3413 upb_pr##type##valbytes##_##tagbytes##bt, \
3414 upb_pp##type##valbytes##_##tagbytes##bt); \
3417 #define TYPES(card, tagbytes) \
3418 F(card, b, 1, tagbytes) \
3419 F(card, v, 4, tagbytes) \
3420 F(card, v, 8, tagbytes) \
3421 F(card, z, 4, tagbytes) \
3422 F(card, z, 8, tagbytes)
3424 #define TAGBYTES(card) \
3442 #undef FASTDECODE_UNPACKEDVARINT
3443 #undef FASTDECODE_PACKEDVARINT
3444 #undef FASTDECODE_VARINT
3449 #define FASTDECODE_UNPACKEDFIXED(d, ptr, msg, table, hasbits, data, tagbytes, \
3450 valbytes, card, packed) \
3452 fastdecode_arr farr; \
3454 FASTDECODE_CHECKPACKED(tagbytes, card, packed) \
3456 dst = fastdecode_getfield(d, ptr, msg, &data, &hasbits, &farr, valbytes, \
3458 if (card == CARD_r) { \
3459 if (UPB_UNLIKELY(!dst)) { \
3460 RETURN_GENERIC("couldn't allocate array in arena\n"); \
3465 if (card == CARD_r) { \
3466 dst = fastdecode_resizearr(d, dst, &farr, valbytes); \
3470 memcpy(dst, ptr, valbytes); \
3473 if (card == CARD_r) { \
3474 fastdecode_nextret ret = fastdecode_nextrepeated( \
3475 d, dst, &ptr, &farr, data, tagbytes, valbytes); \
3476 switch (ret.next) { \
3477 case FD_NEXT_SAMEFIELD: \
3480 case FD_NEXT_OTHERFIELD: \
3482 UPB_MUSTTAIL return fastdecode_tagdispatch(UPB_PARSE_ARGS); \
3483 case FD_NEXT_ATLIMIT: \
3488 UPB_MUSTTAIL return fastdecode_dispatch(UPB_PARSE_ARGS);
3490 #define FASTDECODE_PACKEDFIXED(d, ptr, msg, table, hasbits, data, tagbytes, \
3491 valbytes, unpacked) \
3492 FASTDECODE_CHECKPACKED(tagbytes, CARD_r, unpacked) \
3495 int size = (uint8_t)ptr[0]; \
3497 if (size & 0x80) { \
3498 ptr = fastdecode_longsize(ptr, &size); \
3501 if (UPB_UNLIKELY(fastdecode_boundscheck(ptr, size, d->limit_ptr) || \
3502 (size % valbytes) != 0)) { \
3503 return fastdecode_err(d); \
3506 upb_array **arr_p = fastdecode_fieldmem(msg, data); \
3507 upb_array *arr = *arr_p; \
3508 uint8_t elem_size_lg2 = __builtin_ctz(valbytes); \
3509 int elems = size / valbytes; \
3511 if (UPB_LIKELY(!arr)) { \
3512 *arr_p = arr = _upb_array_new(&d->arena, elems, elem_size_lg2); \
3514 return fastdecode_err(d); \
3517 _upb_array_resize(arr, elems, &d->arena); \
3520 char *dst = _upb_array_ptr(arr); \
3521 memcpy(dst, ptr, size); \
3525 UPB_MUSTTAIL return fastdecode_dispatch(UPB_PARSE_ARGS);
3527 #define FASTDECODE_FIXED(d, ptr, msg, table, hasbits, data, tagbytes, \
3528 valbytes, card, unpacked, packed) \
3529 if (card == CARD_p) { \
3530 FASTDECODE_PACKEDFIXED(d, ptr, msg, table, hasbits, data, tagbytes, \
3531 valbytes, unpacked); \
3533 FASTDECODE_UNPACKEDFIXED(d, ptr, msg, table, hasbits, data, tagbytes, \
3534 valbytes, card, packed); \
3540 #define F(card, valbytes, tagbytes) \
3542 const char *upb_p##card##f##valbytes##_##tagbytes##bt(UPB_PARSE_PARAMS) { \
3543 FASTDECODE_FIXED(d, ptr, msg, table, hasbits, data, tagbytes, valbytes, \
3544 CARD_##card, upb_ppf##valbytes##_##tagbytes##bt, \
3545 upb_prf##valbytes##_##tagbytes##bt); \
3548 #define TYPES(card, tagbytes) \
3549 F(card, 4, tagbytes) \
3550 F(card, 8, tagbytes)
3552 #define TAGBYTES(card) \
3564 #undef FASTDECODE_UNPACKEDFIXED
3565 #undef FASTDECODE_PACKEDFIXED
3569 typedef const char *fastdecode_copystr_func(
struct upb_decstate *
d,
3582 UPB_MUSTTAIL return fastdecode_dispatch(UPB_PARSE_ARGS);
3585 #define FASTDECODE_LONGSTRING(d, ptr, msg, table, hasbits, dst, validate_utf8) \
3586 int size = (uint8_t)ptr[0]; \
3588 if (size & 0x80) { \
3589 ptr = fastdecode_longsize(ptr, &size); \
3592 if (UPB_UNLIKELY(fastdecode_boundscheck(ptr, size, d->limit_ptr))) { \
3594 return fastdecode_err(d); \
3601 char *data = upb_arena_malloc(&d->arena, size); \
3603 return fastdecode_err(d); \
3605 memcpy(data, ptr, size); \
3611 if (validate_utf8) { \
3612 data = (uint64_t)dst; \
3613 UPB_MUSTTAIL return fastdecode_verifyutf8(UPB_PARSE_ARGS); \
3615 UPB_MUSTTAIL return fastdecode_dispatch(UPB_PARSE_ARGS); \
3619 static const char *fastdecode_longstring_utf8(
struct upb_decstate *
d,
3628 static const char *fastdecode_longstring_noutf8(
struct upb_decstate *
d,
3640 d->arena.head.ptr +=
copy;
3647 #define FASTDECODE_COPYSTRING(d, ptr, msg, table, hasbits, data, tagbytes, \
3648 card, validate_utf8) \
3650 fastdecode_arr farr; \
3653 size_t common_has; \
3656 UPB_ASSERT(!d->alias); \
3657 UPB_ASSERT(fastdecode_checktag(data, tagbytes)); \
3659 dst = fastdecode_getfield(d, ptr, msg, &data, &hasbits, &farr, \
3660 sizeof(upb_strview), card); \
3663 if (card == CARD_r) { \
3664 dst = fastdecode_resizearr(d, dst, &farr, sizeof(upb_strview)); \
3667 size = (uint8_t)ptr[tagbytes]; \
3668 ptr += tagbytes + 1; \
3671 buf = d->arena.head.ptr; \
3672 arena_has = _upb_arenahas(&d->arena); \
3673 common_has = UPB_MIN(arena_has, (d->end - ptr) + 16); \
3675 if (UPB_LIKELY(size <= 15 - tagbytes)) { \
3676 if (arena_has < 16) \
3678 d->arena.head.ptr += 16; \
3679 memcpy(buf, ptr - tagbytes - 1, 16); \
3680 dst->data = buf + tagbytes + 1; \
3681 } else if (UPB_LIKELY(size <= 32)) { \
3682 if (UPB_UNLIKELY(common_has < 32)) \
3684 fastdecode_docopy(d, ptr, size, 32, buf, dst); \
3685 } else if (UPB_LIKELY(size <= 64)) { \
3686 if (UPB_UNLIKELY(common_has < 64)) \
3688 fastdecode_docopy(d, ptr, size, 64, buf, dst); \
3689 } else if (UPB_LIKELY(size < 128)) { \
3690 if (UPB_UNLIKELY(common_has < 128)) \
3692 fastdecode_docopy(d, ptr, size, 128, buf, dst); \
3699 if (card == CARD_r) { \
3700 if (validate_utf8 && !decode_verifyutf8_inl(dst->data, dst->size)) { \
3701 return fastdecode_err(d); \
3703 fastdecode_nextret ret = fastdecode_nextrepeated( \
3704 d, dst, &ptr, &farr, data, tagbytes, sizeof(upb_strview)); \
3705 switch (ret.next) { \
3706 case FD_NEXT_SAMEFIELD: \
3709 case FD_NEXT_OTHERFIELD: \
3711 UPB_MUSTTAIL return fastdecode_tagdispatch(UPB_PARSE_ARGS); \
3712 case FD_NEXT_ATLIMIT: \
3717 if (card != CARD_r && validate_utf8) { \
3718 data = (uint64_t)dst; \
3719 UPB_MUSTTAIL return fastdecode_verifyutf8(UPB_PARSE_ARGS); \
3722 UPB_MUSTTAIL return fastdecode_dispatch(UPB_PARSE_ARGS); \
3726 if (validate_utf8) { \
3727 UPB_MUSTTAIL return fastdecode_longstring_utf8(d, ptr, msg, table, \
3728 hasbits, (uint64_t)dst); \
3730 UPB_MUSTTAIL return fastdecode_longstring_noutf8(d, ptr, msg, table, \
3731 hasbits, (uint64_t)dst); \
3734 #define FASTDECODE_STRING(d, ptr, msg, table, hasbits, data, tagbytes, card, \
3735 copyfunc, validate_utf8) \
3737 fastdecode_arr farr; \
3740 if (UPB_UNLIKELY(!fastdecode_checktag(data, tagbytes))) { \
3741 RETURN_GENERIC("string field tag mismatch\n"); \
3744 if (UPB_UNLIKELY(!d->alias)) { \
3745 UPB_MUSTTAIL return copyfunc(UPB_PARSE_ARGS); \
3748 dst = fastdecode_getfield(d, ptr, msg, &data, &hasbits, &farr, \
3749 sizeof(upb_strview), card); \
3752 if (card == CARD_r) { \
3753 dst = fastdecode_resizearr(d, dst, &farr, sizeof(upb_strview)); \
3756 size = (int8_t)ptr[tagbytes]; \
3757 ptr += tagbytes + 1; \
3761 if (UPB_UNLIKELY(fastdecode_boundscheck(ptr, size, d->end))) { \
3763 if (validate_utf8) { \
3764 return fastdecode_longstring_utf8(d, ptr, msg, table, hasbits, \
3767 return fastdecode_longstring_noutf8(d, ptr, msg, table, hasbits, \
3774 if (card == CARD_r) { \
3775 if (validate_utf8 && !decode_verifyutf8_inl(dst->data, dst->size)) { \
3776 return fastdecode_err(d); \
3778 fastdecode_nextret ret = fastdecode_nextrepeated( \
3779 d, dst, &ptr, &farr, data, tagbytes, sizeof(upb_strview)); \
3780 switch (ret.next) { \
3781 case FD_NEXT_SAMEFIELD: \
3783 if (UPB_UNLIKELY(!d->alias)) { \
3787 fastdecode_commitarr(dst, &farr, sizeof(upb_strview)); \
3789 UPB_MUSTTAIL return fastdecode_tagdispatch(UPB_PARSE_ARGS); \
3792 case FD_NEXT_OTHERFIELD: \
3794 UPB_MUSTTAIL return fastdecode_tagdispatch(UPB_PARSE_ARGS); \
3795 case FD_NEXT_ATLIMIT: \
3800 if (card != CARD_r && validate_utf8) { \
3801 data = (uint64_t)dst; \
3802 UPB_MUSTTAIL return fastdecode_verifyutf8(UPB_PARSE_ARGS); \
3805 UPB_MUSTTAIL return fastdecode_dispatch(UPB_PARSE_ARGS);
3810 #define s_VALIDATE true
3811 #define b_VALIDATE false
3813 #define F(card, tagbytes, type) \
3815 const char *upb_c##card##type##_##tagbytes##bt(UPB_PARSE_PARAMS) { \
3816 FASTDECODE_COPYSTRING(d, ptr, msg, table, hasbits, data, tagbytes, \
3817 CARD_##card, type##_VALIDATE); \
3819 const char *upb_p##card##type##_##tagbytes##bt(UPB_PARSE_PARAMS) { \
3820 FASTDECODE_STRING(d, ptr, msg, table, hasbits, data, tagbytes, \
3821 CARD_##card, upb_c##card##type##_##tagbytes##bt, \
3825 #define UTF8(card, tagbytes) \
3826 F(card, tagbytes, s) \
3827 F(card, tagbytes, b)
3829 #define TAGBYTES(card) \
3841 #undef FASTDECODE_LONGSTRING
3842 #undef FASTDECODE_COPYSTRING
3843 #undef FASTDECODE_STRING
3849 int msg_ceil_bytes) {
3855 msg_data =
d->arena.head.ptr;
3856 d->arena.head.ptr +=
size;
3858 memset(msg_data, 0, msg_ceil_bytes);
3870 } fastdecode_submsgdata;
3875 fastdecode_submsgdata *submsg =
ctx;
3876 ptr = fastdecode_dispatch(
d,
ptr, submsg->msg, submsg->table, 0, 0);
3881 #define FASTDECODE_SUBMSG(d, ptr, msg, table, hasbits, data, tagbytes, \
3882 msg_ceil_bytes, card) \
3884 if (UPB_UNLIKELY(!fastdecode_checktag(data, tagbytes))) { \
3885 RETURN_GENERIC("submessage field tag mismatch\n"); \
3888 if (--d->depth == 0) return fastdecode_err(d); \
3891 uint32_t submsg_idx = (data >> 16) & 0xff; \
3892 const upb_msglayout *tablep = decode_totablep(table); \
3893 const upb_msglayout *subtablep = tablep->submsgs[submsg_idx]; \
3894 fastdecode_submsgdata submsg = {decode_totable(subtablep)}; \
3895 fastdecode_arr farr; \
3897 if (subtablep->table_mask == (uint8_t)-1) { \
3898 RETURN_GENERIC("submessage doesn't have fast tables."); \
3901 dst = fastdecode_getfield(d, ptr, msg, &data, &hasbits, &farr, \
3902 sizeof(upb_msg *), card); \
3904 if (card == CARD_s) { \
3905 *(uint32_t *)msg |= hasbits; \
3910 if (card == CARD_r) { \
3911 dst = fastdecode_resizearr(d, dst, &farr, sizeof(upb_msg *)); \
3914 submsg.msg = *dst; \
3916 if (card == CARD_r || UPB_LIKELY(!submsg.msg)) { \
3917 *dst = submsg.msg = decode_newmsg_ceil(d, subtablep, msg_ceil_bytes); \
3921 ptr = fastdecode_delimited(d, ptr, fastdecode_tosubmsg, &submsg); \
3923 if (UPB_UNLIKELY(ptr == NULL || d->end_group != DECODE_NOGROUP)) { \
3924 return fastdecode_err(d); \
3927 if (card == CARD_r) { \
3928 fastdecode_nextret ret = fastdecode_nextrepeated( \
3929 d, dst, &ptr, &farr, data, tagbytes, sizeof(upb_msg *)); \
3930 switch (ret.next) { \
3931 case FD_NEXT_SAMEFIELD: \
3934 case FD_NEXT_OTHERFIELD: \
3937 UPB_MUSTTAIL return fastdecode_tagdispatch(UPB_PARSE_ARGS); \
3938 case FD_NEXT_ATLIMIT: \
3945 UPB_MUSTTAIL return fastdecode_dispatch(UPB_PARSE_ARGS);
3947 #define F(card, tagbytes, size_ceil, ceil_arg) \
3948 const char *upb_p##card##m_##tagbytes##bt_max##size_ceil##b( \
3949 UPB_PARSE_PARAMS) { \
3950 FASTDECODE_SUBMSG(d, ptr, msg, table, hasbits, data, tagbytes, ceil_arg, \
3954 #define SIZES(card, tagbytes) \
3955 F(card, tagbytes, 64, 64) \
3956 F(card, tagbytes, 128, 128) \
3957 F(card, tagbytes, 192, 192) \
3958 F(card, tagbytes, 256, 256) \
3959 F(card, tagbytes, max, -1)
3961 #define TAGBYTES(card) \
3972 #undef FASTDECODE_SUBMSG
4028 UPB_SIZE(64, 128), 12,
false, 12, 255,
4057 UPB_SIZE(48, 96), 10,
false, 10, 255,
4073 UPB_SIZE(16, 24), 3,
false, 3, 255,
4084 UPB_SIZE(16, 16), 2,
false, 2, 255,
4122 UPB_SIZE(72, 112), 11,
false, 10, 255,
4137 UPB_SIZE(16, 32), 2,
false, 2, 255,
4157 UPB_SIZE(32, 64), 5,
false, 5, 255,
4168 UPB_SIZE(16, 16), 2,
false, 2, 255,
4184 UPB_SIZE(24, 32), 3,
false, 3, 255,
4201 UPB_SIZE(24, 48), 3,
false, 3, 255,
4220 UPB_SIZE(32, 64), 6,
false, 6, 255,
4254 UPB_SIZE(104, 192), 21,
false, 1, 255,
4272 UPB_SIZE(16, 16), 5,
false, 3, 255,
4292 UPB_SIZE(24, 24), 7,
false, 3, 255,
4368 UPB_SIZE(16, 24), 3,
false, 0, 255,
4388 UPB_SIZE(64, 96), 7,
false, 0, 255,
4399 UPB_SIZE(16, 32), 2,
false, 2, 255,
4427 UPB_SIZE(32, 64), 5,
false, 4, 255,
4454 UPB_SIZE(24, 48), 4,
false, 4, 255,
4586 return (
num & 3) ==
type ? (
const void*)(
num & ~3) : NULL;
4591 return upb_value_constptr((
const void*)
num);
4596 return c >= low &&
c <= high;
4610 if (fullname == NULL) {
4612 }
else if ((
p = strrchr(fullname,
'.')) == NULL) {
4648 if (!strcmp(
name,
"google.protobuf.Any")) {
4650 }
else if (!strcmp(
name,
"google.protobuf.FieldMask")) {
4652 }
else if (!strcmp(
name,
"google.protobuf.Duration")) {
4654 }
else if (!strcmp(
name,
"google.protobuf.Timestamp")) {
4656 }
else if (!strcmp(
name,
"google.protobuf.DoubleValue")) {
4658 }
else if (!strcmp(
name,
"google.protobuf.FloatValue")) {
4660 }
else if (!strcmp(
name,
"google.protobuf.Int64Value")) {
4662 }
else if (!strcmp(
name,
"google.protobuf.UInt64Value")) {
4664 }
else if (!strcmp(
name,
"google.protobuf.Int32Value")) {
4666 }
else if (!strcmp(
name,
"google.protobuf.UInt32Value")) {
4668 }
else if (!strcmp(
name,
"google.protobuf.BoolValue")) {
4670 }
else if (!strcmp(
name,
"google.protobuf.StringValue")) {
4672 }
else if (!strcmp(
name,
"google.protobuf.BytesValue")) {
4674 }
else if (!strcmp(
name,
"google.protobuf.Value")) {
4676 }
else if (!strcmp(
name,
"google.protobuf.ListValue")) {
4678 }
else if (!strcmp(
name,
"google.protobuf.Struct")) {
4689 return e->full_name;
4702 return e->defaultval;
4723 if (
num) *
num = upb_value_getint32(
v);
4744 return f->full_name;
4799 return f->is_extension_;
4815 return f->json_name;
4841 ret.str_val.data =
str->str;
4842 ret.str_val.size =
str->len;
4844 ret.str_val.size = 0;
4859 return f->defaultval.sint;
4864 return (
int32_t)
f->defaultval.sint;
4869 return f->defaultval.uint;
4879 return f->defaultval.boolean;
4884 return f->defaultval.flt;
4889 return f->defaultval.dbl;
4915 return &
f->msgdef->layout->fields[
f->layout_index];
4951 return x >= low &&
x <= high;
4965 return m->full_name;
4977 return m->file->syntax;
5022 const char *
name,
size_t len) {
5037 return m->field_count;
5041 return m->oneof_count;
5045 return m->real_oneof_count;
5049 return m->field_count;
5053 return m->oneof_count;
5057 return m->real_oneof_count;
5066 return &
m->fields[
i];
5071 return &
m->oneofs[
i];
5075 return m->map_entry;
5079 return m->well_known_type;
5162 return o->field_count;
5167 return o->fields[
i];
5171 return o->field_count;
5175 return o -
o->parent->oneofs;
5179 return o->synthetic;
5186 upb_value_getptr(val) : NULL;
5226 return f->phpprefix;
5230 return f->phpnamespace;
5238 return f->msg_count;
5242 return f->dep_count;
5246 return f->enum_count;
5250 return i < 0 || i >=
f->dep_count ? NULL :
f->deps[
i];
5254 return i < 0 || i >=
f->msg_count ? NULL : &
f->msgs[
i];
5258 return i < 0 || i >=
f->enum_count ? NULL : &
f->enums[
i];
5278 s->bytes_loaded = 0;
5318 upb_value_getconstptr(
v) : NULL;
5332 #define CHK_OOM(x) if (!(x)) { symtab_oomerr(ctx); }
5369 for (
i = 0;
i <
len;
i++) {
5372 if (
start || !full) {
5373 symtab_errf(
ctx,
"invalid name: unexpected '.' (%.*s)", (
int)
len,
str);
5380 "invalid name: path components must start with a letter (%.*s)",
5386 symtab_errf(
ctx,
"invalid name: non-alphanumeric character (%.*s)",
5392 symtab_errf(
ctx,
"invalid name: empty part (%.*s)", (
int)
len,
str);
5397 return (
n +
d - 1) /
d;
5414 return sizeof(
void*);
5426 return sizeof(ent.
k);
5428 return sizeof(
void*);
5446 return f1->number -
f2->number;
5453 int dense_below = 0;
5454 for (
i = 0;
i <
n;
i++) {
5457 f->layout_index =
i;
5460 dense_below =
i + 1;
5463 l->dense_below = dense_below;
5498 size_t submsg_count = 0;
5505 for (
size_t i = 0;
i < field_count;
i++) {
5516 l->submsgs = submsgs;
5522 l->fasttable[0].field_data = 0;
5539 fields[1].submsg_index = 0;
5572 field->submsg_index = submsg_count++;
5579 field->presence = ++hasbit;
5581 field->presence = 0;
5610 size_t case_size =
sizeof(
uint32_t);
5611 size_t field_size = 0;
5652 return n == strlen(
b) && memcmp(
a,
b,
n) == 0;
5677 int synthetic_count = 0;
5680 for (
i = 0;
i <
m->oneof_count;
i++) {
5683 if (
o->synthetic &&
o->field_count != 1) {
5684 symtab_errf(
ctx,
"Synthetic oneofs must have one field, not %d: %s",
5690 }
else if (synthetic_count != 0) {
5691 symtab_errf(
ctx,
"Synthetic oneofs must be after all other oneofs: %s",
5699 for (
i = 0;
i <
m->field_count;
i++) {
5703 o->fields[
o->field_count++] =
f;
5707 m->real_oneof_count =
m->oneof_count - synthetic_count;
5711 size_t src,
dst = 0;
5712 bool ucase_next =
false;
5714 #define WRITE(byte) \
5716 if (dst < len) buf[dst - 1] = byte; \
5717 else if (dst == len) buf[dst - 1] = '\0'
5728 for (src = 0;
name[src]; src++) {
5729 if (
name[src] ==
'_') {
5757 symtab_errf(
ctx,
"duplicate symbol '%s'",
name);
5770 if(sym.
size == 0)
goto notfound;
5771 if(sym.
data[0] ==
'.') {
5781 symtab_errf(
ctx,
"type mismatch when resolving field %s, name %s",
5782 f->full_name, sym.
data);
5809 o->synthetic =
false;
5821 if (!
ret)
return NULL;
5843 symtab_errf(
ctx,
"Default too long: %.*s", (
int)
len,
str);
5855 long val = strtol(
str, &
end, 0);
5859 f->defaultval.sint = val;
5868 f->defaultval.sint = val;
5872 long long val = strtoll(
str, &
end, 0);
5876 f->defaultval.sint = val;
5880 unsigned long val = strtoul(
str, &
end, 0);
5884 f->defaultval.uint = val;
5888 unsigned long long val = strtoull(
str, &
end, 0);
5892 f->defaultval.uint = val;
5896 double val = strtod(
str, &
end);
5897 if (errno == ERANGE || *
end) {
5900 f->defaultval.dbl = val;
5904 float val = strtof(
str, &
end);
5905 if (errno == ERANGE || *
end) {
5908 f->defaultval.flt = val;
5913 f->defaultval.boolean =
false;
5915 f->defaultval.boolean =
true;
5929 symtab_errf(
ctx,
"Message should not have a default (%s)",
5936 symtab_errf(
ctx,
"Invalid default '%.*s' for field %s", (
int)
len,
str,
5945 f->defaultval.sint = 0;
5949 f->defaultval.uint = 0;
5953 f->defaultval.dbl = 0;
5960 f->defaultval.boolean =
false;
5973 const char *full_name;
5974 const char *json_name;
5997 symtab_errf(
ctx,
"invalid field number (%u)", field_number);
6006 f->index_ =
m->field_count++;
6008 f->is_extension_ =
false;
6011 symtab_errf(
ctx,
"duplicate field name (%s)",
shortname);
6015 symtab_errf(
ctx,
"duplicate json_name (%s)", json_name);
6019 symtab_errf(
ctx,
"duplicate field number (%u)", field_number);
6024 v = upb_value_constptr(
f);
6025 json_size = strlen(json_name);
6031 if (strcmp(
shortname, json_name) != 0) {
6037 int count =
m->layout->field_count;
6042 f->layout_index =
i;
6052 f->is_extension_ =
true;
6056 f->full_name = full_name;
6057 f->json_name = json_name;
6058 f->file =
ctx->file;
6061 f->number_ = field_number;
6063 f->proto3_optional_ =
6069 f->sub.unresolved = field_proto;
6072 symtab_errf(
ctx,
"proto3 fields cannot be required (%s)",
f->full_name);
6082 symtab_errf(
ctx,
"fields in oneof must have OPTIONAL label (%s)",
6087 symtab_errf(
ctx,
"oneof_index provided for extension field (%s)",
6091 if (oneof_index >=
m->oneof_count) {
6092 symtab_errf(
ctx,
"oneof_index out of range (%s)",
f->full_name);
6099 if (
f->proto3_optional_) {
6107 if (
f->proto3_optional_) {
6108 symtab_errf(
ctx,
"field with proto3_optional was not in a oneof (%s)",
6150 e->file =
ctx->file;
6154 symtab_errf(
ctx,
"enums must contain at least one value (%s)",
6158 for (
i = 0;
i <
n;
i++) {
6166 symtab_errf(
ctx,
"for proto3, the first enum value must be zero (%s)",
6171 symtab_errf(
ctx,
"duplicate enum label '%s'", name2);
6194 size_t i, n_oneof, n_field,
n;
6210 m->file =
ctx->file;
6211 m->map_entry =
false;
6220 m->layout = *
ctx->layouts;
6230 for (
i = 0;
i < n_oneof;
i++) {
6236 for (
i = 0;
i < n_field;
i++) {
6247 for (
i = 0;
i <
n;
i++) {
6252 for (
i = 0;
i <
n;
i++) {
6265 for (
i = 0;
i <
n;
i++) {
6270 file->enum_count +=
n;
6273 file->ext_count +=
n;
6283 for (
i = 0;
i <
n;
i++) {
6288 file->enum_count +=
n;
6291 file->ext_count +=
n;
6299 if (
f->is_extension_) {
6301 symtab_errf(
ctx,
"extension for field '%s' had no extendee",
6311 symtab_errf(
ctx,
"field '%s' is missing type name",
f->full_name);
6329 symtab_errf(
ctx,
"proto3 fields cannot have explicit defaults (%s)",
6334 symtab_errf(
ctx,
"message fields cannot have explicit defaults (%s)",
6357 file->msg_count = 0;
6358 file->enum_count = 0;
6359 file->ext_count = 0;
6366 file->msg_count = 0;
6367 file->enum_count = 0;
6368 file->ext_count = 0;
6371 symtab_errf(
ctx,
"File has no name");
6376 file->phpprefix = NULL;
6377 file->phpnamespace = NULL;
6381 google_protobuf_FileDescriptorProto_package(file_proto);
6385 file->package = NULL;
6406 if (file_options_proto) {
6422 for (
i = 0;
i <
n;
i++) {
6426 dep_name.
size, &
v)) {
6429 "', but it has not been loaded",
6432 file->deps[
i] = upb_value_getconstptr(
v);
6437 for (
i = 0;
i <
n;
i++) {
6443 for (
i = 0;
i <
n;
i++) {
6450 for (
i = 0;
i <
n;
i++) {
6455 for (
i = 0;
i < (size_t)
file->ext_count;
i++) {
6459 for (
i = 0;
i < (size_t)
file->msg_count;
i++) {
6462 for (j = 0; j <
m->field_count; j++) {
6467 if (!
ctx->layouts) {
6468 for (
i = 0;
i < (size_t)
file->msg_count;
i++) {
6477 for (
i = 0;
i <
file->msg_count;
i++) {
6478 const char *
name =
file->msgs[
i].full_name;
6481 for (
i = 0;
i <
file->enum_count;
i++) {
6482 const char *
name =
file->enums[
i].full_name;
6485 for (
i = 0;
i <
file->ext_count;
i++) {
6486 const char *
name =
file->exts[
i].full_name;
6565 s->bytes_loaded +=
init->descriptor.size;
6570 "Failed to parse compiled-in descriptor for file '%s'. This should "
6582 fprintf(
stderr,
"Error loading compiled-in descriptor: %s\n",
6589 return s->bytes_loaded;
6604 static unsigned char sizes[] = {
6666 return field->presence < 0;
6681 }
else if (
field->presence > 0) {
6723 if (
a && (!
ret.msg || wrong_oneof)) {
6740 }
else if (
field->presence > 0) {
6753 if (
field->presence > 0) {
6764 if (
field->presence > 0) {
6768 if (*oneof_case !=
field->number)
return;
6797 test.str_val.data = NULL;
6800 if (memcmp(&
test, &zero,
sizeof(
test)) == 0)
continue;
6825 if (--
depth == 0)
return false;
6831 if (!subm)
continue;
6838 if (!val_m)
continue;
6849 for (
i = 0;
i <
n;
i++) {
6882 int lg2 = arr->
data & 7;
6890 int lg2 = arr->
data & 7;
6973 #include <inttypes.h>
6991 const char *line_begin;
7007 return str.size == strlen(lit) && memcmp(
str.data, lit,
str.size) == 0;
7013 "google.protobuf.NullValue") == 0;
7025 (
int)(
d->ptr -
d->line_begin),
msg);
7033 (
int)(
d->ptr -
d->line_begin));
7041 while (
d->ptr !=
d->end) {
7045 d->line_begin =
d->ptr;
7060 if (
d->ptr ==
d->end || *
d->ptr !=
ch)
return false;
7066 size_t avail =
d->end -
d->ptr;
7067 size_t len = strlen(lit);
7068 if (avail <
len || memcmp(
d->ptr, lit,
len) != 0) {
7137 if (--
d->depth < 0) {
7144 bool is_first =
d->is_first;
7145 d->is_first =
false;
7147 if (*
d->ptr == end_ch)
return false;
7187 const char *
start =
d->ptr;
7189 while (
d->ptr <
d->end) {
7190 if (*
d->ptr <
'0' || *
d->ptr >
'9') {
7206 const char *
start =
d->ptr;
7211 if (*
d->ptr ==
'-')
d->ptr++;
7221 if (
d->ptr ==
d->end)
goto parse;
7225 if (
d->ptr ==
d->end)
goto parse;
7227 if (*
d->ptr ==
'e' || *
d->ptr ==
'E') {
7229 if (
d->ptr ==
d->end) {
7232 if (*
d->ptr ==
'+' || *
d->ptr ==
'-') {
7245 assert(
end ==
d->ptr);
7256 if (val > DBL_MAX || val < -DBL_MAX) {
7267 switch (*
d->ptr++) {
7293 if (
d->end -
d->ptr < 4) {
7298 while (
d->ptr <
end) {
7299 char ch = *
d->ptr++;
7300 if (
ch >=
'0' &&
ch <=
'9') {
7302 }
else if (
ch >=
'a' &&
ch <=
'f') {
7304 }
else if (
ch >=
'A' &&
ch <=
'F') {
7309 cp = (cp << 4) |
ch;
7318 if (cp >= 0xd800 && cp <= 0xdbff) {
7324 if (low < 0xdc00 || low > 0xdfff) {
7327 cp = (high & 0x3ff) << 10;
7328 cp |= (low & 0x3ff);
7330 }
else if (cp >= 0xdc00 && cp <= 0xdfff) {
7338 }
else if (cp <= 0x07FF) {
7339 out[0] = ((cp >> 6) & 0x1F) | 0xC0;
7340 out[1] = ((cp >> 0) & 0x3F) | 0x80;
7342 }
else if (cp <= 0xFFFF) {
7343 out[0] = ((cp >> 12) & 0x0F) | 0xE0;
7344 out[1] = ((cp >> 6) & 0x3F) | 0x80;
7345 out[2] = ((cp >> 0) & 0x3F) | 0x80;
7347 }
else if (cp < 0x10FFFF) {
7348 out[0] = ((cp >> 18) & 0x07) | 0xF0;
7349 out[1] = ((cp >> 12) & 0x3f) | 0x80;
7350 out[2] = ((cp >> 6) & 0x3f) | 0x80;
7351 out[3] = ((cp >> 0) & 0x3f) | 0x80;
7359 size_t oldsize = *buf_end - *
buf;
7373 char *buf_end = NULL;
7377 if (*
d->ptr++ !=
'"') {
7381 while (
d->ptr <
d->end) {
7382 char ch = *
d->ptr++;
7384 if (
end == buf_end) {
7397 if (
d->ptr ==
d->end)
goto eof;
7398 if (*
d->ptr ==
'u') {
7400 if (buf_end -
end < 4) {
7410 if ((
unsigned char)*
d->ptr < 0x20) {
7462 const signed char table[256] = {
7463 -1, -1, -1, -1, -1, -1, -1,
7464 -1, -1, -1, -1, -1, -1, -1,
7465 -1, -1, -1, -1, -1, -1, -1,
7466 -1, -1, -1, -1, -1, -1, -1,
7467 -1, -1, -1, -1, -1, -1, -1,
7468 -1, -1, -1, -1, -1, -1, -1,
7469 -1, 62 , -1, 62 , -1, 63 , 52 ,
7470 53 , 54 , 55 , 56 , 57 , 58 , 59 ,
7471 60 , 61 , -1, -1, -1, -1, -1,
7472 -1, -1, 0 , 1 , 2 , 3 , 4 ,
7473 5 , 6 , 07 , 8 , 9 , 10 , 11 ,
7474 12 , 13 , 14 , 15 , 16 , 17 , 18 ,
7475 19 , 20 , 21 , 22 , 23 , 24 , 25 ,
7476 -1, -1, -1, -1, 63 , -1, 26 ,
7477 27 , 28 , 29 , 30 , 31 , 32 , 33 ,
7478 34 , 35 , 36 , 37 , 38 , 39 , 40 ,
7479 41 , 42 , 43 , 44 , 45 , 46 , 47 ,
7480 48 , 49 , 50 , 51 , -1, -1, -1,
7481 -1, -1, -1, -1, -1, -1, -1,
7482 -1, -1, -1, -1, -1, -1, -1,
7483 -1, -1, -1, -1, -1, -1, -1,
7484 -1, -1, -1, -1, -1, -1, -1,
7485 -1, -1, -1, -1, -1, -1, -1,
7486 -1, -1, -1, -1, -1, -1, -1,
7487 -1, -1, -1, -1, -1, -1, -1,
7488 -1, -1, -1, -1, -1, -1, -1,
7489 -1, -1, -1, -1, -1, -1, -1,
7490 -1, -1, -1, -1, -1, -1, -1,
7491 -1, -1, -1, -1, -1, -1, -1,
7492 -1, -1, -1, -1, -1, -1, -1,
7493 -1, -1, -1, -1, -1, -1, -1,
7494 -1, -1, -1, -1, -1, -1, -1,
7495 -1, -1, -1, -1, -1, -1, -1,
7496 -1, -1, -1, -1, -1, -1, -1,
7497 -1, -1, -1, -1, -1, -1, -1,
7498 -1, -1, -1, -1, -1, -1, -1,
7521 out[1] = (val >> 8) & 0xff;
7536 char *
out = (
char*)
str.data;
7537 const char *
ptr =
str.data;
7539 const char *end4 =
ptr + (
str.size & -4);
7541 for (;
ptr < end4;
ptr += 4,
out += 3) {
7550 if (
ptr[2] ==
'=') {
7560 out[1] = (val >> 8) & 0xff;
7561 out[2] = val & 0xff;
7581 unsigned ch = *
ptr -
'0';
7582 if (
ch >= 10)
break;
7610 *val = neg ? -u64 : u64;
7618 jsondec_err(
d,
"Non-number characters in quoted integer");
7627 jsondec_err(
d,
"Non-number characters in quoted integer");
7641 if (dbl > 9223372036854774784.0 || dbl < -9223372036854775808.0) {
7646 jsondec_errf(
d,
"JSON number was not integral (%f != %" PRId64
")", dbl,
7677 if (dbl > 18446744073709549568.0 || dbl < 0) {
7682 jsondec_errf(
d,
"JSON number was not integral (%f != %" PRIu64
")", dbl,
7891 preserved =
d->debug_field;
7907 d->debug_field = preserved;
7946 const char *
after) {
7948 const char *
p = *
ptr;
7949 const char *
end =
p + digits;
7950 size_t after_len =
after ? strlen(
after) : 0;
7955 (after_len && memcmp(
end,
after, after_len) != 0)) {
7967 const char *
p = *
ptr;
7969 if (
p !=
end && *
p ==
'.') {
7971 int digits = (
int)(nano_end -
p - 1);
7972 int exp_lg10 = 9 - digits;
7976 while (exp_lg10--) nanos *= 10;
7990 const uint32_t adjust = carry ? 12 : 0;
7991 const uint32_t y_adj =
y + year_base - carry;
7992 const uint32_t month_days = ((m_adj + adjust) * 62719 + 769) / 2048;
7993 const uint32_t leap_days = y_adj / 4 - y_adj / 100 + y_adj / 400;
7994 return y_adj * 365 + leap_days + month_days + (
d - 1) - 2472632;
8005 const char *
ptr =
str.data;
8008 if (
str.size < 20)
goto malformed;
8030 if (
ptr ==
end)
goto malformed;
8037 if ((
end -
ptr) != 5)
goto malformed;
8040 ofs_min = ((ofs_hour * 60) + ofs_min) * 60;
8041 seconds.int64_val += (neg ? ofs_min : -ofs_min);
8044 if (
ptr !=
end)
goto malformed;
8051 if (
seconds.int64_val < -62135596800) {
8067 const char *
ptr =
str.data;
8100 value.msg_val = value_msg;
8119 value.msg_val = value_msg;
8191 ret.size += (*
ptr >=
'A' && *
ptr <=
'Z');
8201 if (
ch >=
'A' &&
ch <=
'Z') {
8204 }
else if (
ch ==
'_') {
8219 const char *
ptr =
str.data;
8224 const char *elem_end = memchr(
ptr,
',',
end -
ptr);
8247 jsondec_err(
d,
"Key for well-known type must be 'value'");
8269 jsondec_err(
d,
"Type url must have at least one '/' and non-empty host");
8288 const char *pre_type_data = NULL;
8289 const char *pre_type_end = NULL;
8296 const char *
start =
d->ptr;
8301 if (pre_type_data) {
8302 pre_type_end =
start;
8303 while (*pre_type_end !=
',') pre_type_end--;
8306 if (!pre_type_data) pre_type_data =
start;
8312 jsondec_err(
d,
"Any object didn't contain a '@type' field");
8317 if (pre_type_data) {
8318 size_t len = pre_type_end - pre_type_data + 1;
8320 const char *saved_ptr =
d->ptr;
8321 const char *saved_end =
d->end;
8395 if (
size == 0)
return true;
8400 d.any_pool = any_pool;
8405 d.line_begin =
d.ptr;
8406 d.debug_field = NULL;
8419 #include <inttypes.h>
8471 size_t have = e->end - e->ptr;
8480 e->overflow += (
len - have);
8491 size_t have = e->end - e->ptr;
8502 e->overflow += (
n - have);
8509 if (nanos == 0)
return;
8510 if (nanos < 0 || nanos >= 1000000000) {
8511 jsonenc_err(e,
"error formatting timestamp as JSON: invalid nanos");
8514 while (nanos % 1000 == 0) {
8528 int L,
N,
I, J, K, hour,
min, sec;
8532 "error formatting timestamp as JSON: minimum acceptable value "
8533 "is 0001-01-01T00:00:00Z");
8534 }
else if (
seconds > 253402300799) {
8536 "error formatting timestamp as JSON: maximum acceptable value "
8537 "is 9999-12-31T23:59:59Z");
8546 L =
L - (146097 *
N + 3) / 4;
8547 I = 4000 * (
L + 1) / 1461001;
8548 L =
L - 1461 *
I / 4 + 31;
8550 K =
L - 2447 * J / 80;
8553 I = 100 * (
N - 49) +
I +
L;
8571 (
seconds < 0) != (nanos < 0)) {
8602 static const char base64[] =
8603 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
8604 const unsigned char *
ptr = (
unsigned char*)
str.data;
8611 buf[0] = base64[
ptr[0] >> 2];
8612 buf[1] = base64[((
ptr[0] & 0x3) << 4) | (
ptr[1] >> 4)];
8613 buf[2] = base64[((
ptr[1] & 0xf) << 2) | (
ptr[2] >> 6)];
8614 buf[3] = base64[
ptr[2] & 0x3f];
8621 buf[0] = base64[
ptr[0] >> 2];
8622 buf[1] = base64[((
ptr[0] & 0x3) << 4) | (
ptr[1] >> 4)];
8623 buf[2] = base64[(
ptr[1] & 0xf) << 2];
8628 buf[0] = base64[
ptr[0] >> 2];
8629 buf[1] = base64[((
ptr[0] & 0x3) << 4)];
8640 const char *
ptr =
str.data;
8687 if (val == INFINITY) {
8689 }
else if (val == -INFINITY) {
8691 }
else if (val != val) {
8702 for (
char *
end = e->ptr;
p <
end;
p++) {
8703 if (*
p ==
',') *
p =
'.';
8722 jsonenc_err(e,
"Tried to encode Any, but no symtab was provided");
8725 if (
type_url.size == 0)
goto badurl;
8795 if (
ch >=
'A' &&
ch <=
'Z') {
8796 jsonenc_err(e,
"Field mask element may not have upper-case letter.");
8797 }
else if (
ch ==
'_') {
8798 if (
ptr ==
end - 1 || *(
ptr + 1) <
'a' || *(
ptr + 1) >
'z') {
8799 jsonenc_err(e,
"Underscore must be followed by a lowercase letter.");
8820 for (
i = 0;
i <
n;
i++) {
9084 for (
i = 0;
i <
n;
i++) {
9106 size_t ret = e->ptr - e->buf + e->overflow;
9109 if (e->ptr == e->end) e->ptr--;
9126 e.ext_pool = ext_pool;
9130 if (setjmp(e.err))
return -1;
9142 #undef UPB_READ_ONEOF
9143 #undef UPB_WRITE_ONEOF
9144 #undef UPB_MAPTYPE_STRING
9147 #undef UPB_ALIGN_DOWN
9148 #undef UPB_ALIGN_MALLOC
9152 #undef UPB_FORCEINLINE
9161 #undef UPB_UNREACHABLE
9166 #undef UPB_FASTTABLE_SUPPORTED
9167 #undef UPB_FASTTABLE
9168 #undef UPB_FASTTABLE_INIT
9169 #undef UPB_POISON_MEMORY_REGION
9170 #undef UPB_UNPOISON_MEMORY_REGION
static const char * decode_readstr(upb_decstate *d, const char *ptr, int size, upb_strview *str)
static void jsonenc_wrapper(jsonenc *e, const upb_msg *msg, const upb_msgdef *m)
static const char * decode_tomsg(upb_decstate *d, const char *ptr, upb_msg *msg, upb_msglayout const *const *submsgs, const upb_msglayout_field *field, wireval *val, int op)
void upb_inttable_iter_setdone(upb_inttable_iter *i)
static void jsondec_skipws(jsondec *d)
static bool jsondec_streql(upb_strview str, const char *lit)
static const upb_msglayout_field google_protobuf_EnumValueOptions__fields[2]
union upb_map_entry::@434 k
static int jsondec_tsdigits(jsondec *d, const char **ptr, size_t digits, const char *after)
std::chrono::duration< std::int_fast64_t > seconds
static const upb_msglayout * layouts[27]
UPB_INLINE int32_t google_protobuf_FieldDescriptorProto_oneof_index(const google_protobuf_FieldDescriptorProto *msg)
static bool decode_reserve(upb_decstate *d, upb_array *arr, size_t elem)
bool upb_decode(const char *buf, size_t size, void *msg, const upb_msglayout *l, upb_arena *arena)
static void encode_scalarfield(upb_encstate *e, const char *msg, const upb_msglayout *m, const upb_msglayout_field *f)
static bool realloc_internal(upb_msg *msg, size_t need, upb_arena *arena)
UPB_INLINE int _upb_lg2ceilsize(int x)
static _upb_DefPool_Init * deps[4]
int upb_msgdef_numoneofs(const upb_msgdef *m)
static bool upb_arena_allocblock(upb_arena *a, size_t size)
const upb_msglayout google_protobuf_FieldOptions_msginit
static const upb_msglayout_field google_protobuf_FileDescriptorSet__fields[1]
size_t _upb_symtab_bytesloaded(const upb_symtab *s)
UPB_INLINE void * upb_arena_malloc(upb_arena *a, size_t size)
static void decode_verifyutf8(upb_decstate *d, const char *buf, int len)
uint32_t field_rank(const upb_fielddef *f)
bool upb_fielddef_isstring(const upb_fielddef *f)
static void encode_bytes(upb_encstate *e, const void *data, size_t len)
static void jsonenc_map(jsonenc *e, const upb_map *map, const upb_fielddef *f)
static upb_strview jsondec_mask(jsondec *d, const char *buf, const char *end)
static const upb_msglayout *const google_protobuf_MethodOptions_submsgs[1]
int __cdecl vsnprintf(char *buffer, size_t count, const char *format, va_list argptr)
static const double MIN_DENSITY
UPB_INLINE void _upb_clearhas_field(const upb_msg *msg, const upb_msglayout_field *f)
static void check_ident(symtab_addctx *ctx, upb_strview name, bool full)
const upb_msglayout_field * _upb_extreg_get(const upb_extreg *r, const upb_msglayout *l, uint32_t num)
UPB_INLINE bool google_protobuf_FieldDescriptorProto_proto3_optional(const google_protobuf_FieldDescriptorProto *msg)
static UPB_FORCEINLINE void encode_varint(upb_encstate *e, uint64_t val)
static const upb_msgdef * jsonenc_getanymsg(jsonenc *e, upb_strview type_url)
void upb_status_seterrf(upb_status *status, const char *fmt,...)
static uint32_t jsondec_codepoint(jsondec *d)
const upb_msglayout google_protobuf_FileDescriptorSet_msginit
static void jsondec_wellknownvalue(jsondec *d, upb_msg *msg, const upb_msgdef *m)
const upb_msglayout_field * upb_fielddef_layout(const upb_fielddef *f)
UPB_INLINE int _upb_lg2ceil(int x)
static void encode_tag(upb_encstate *e, uint32_t field_number, uint8_t wire_type)
int upb_msgdef_oneofcount(const upb_msgdef *m)
UPB_INLINE upb_StringView const * google_protobuf_FileDescriptorProto_dependency(const google_protobuf_FileDescriptorProto *msg, size_t *len)
const UPB_INLINE google_protobuf_FieldOptions * google_protobuf_FieldDescriptorProto_options(const google_protobuf_FieldDescriptorProto *msg)
const upb_msgdef * upb_symtab_lookupmsg2(const upb_symtab *s, const char *sym, size_t len)
const upb_msglayout_field * fields
int upb_msgdef_realoneofcount(const upb_msgdef *m)
static upb_arena * jsonenc_arena(jsonenc *e)
const upb_fielddef * upb_oneofdef_ntof(const upb_oneofdef *o, const char *name, size_t length)
static const char * shortdefname(const char *fullname)
const upb_msglayout google_protobuf_FieldDescriptorProto_msginit
static void jsondec_arrstart(jsondec *d)
static size_t upb_roundup_pow2(size_t bytes)
static const char * makefullname(symtab_addctx *ctx, const char *prefix, upb_strview name)
bool upb_strtable_init(upb_strtable *t, size_t expected_size, upb_arena *a)
upb_label_t upb_fielddef_label(const upb_fielddef *f)
@ UPB_WELLKNOWN_STRINGVALUE
@ UPB_WELLKNOWN_DOUBLEVALUE
const upb_array * array_val
bool upb_mapiter_next(const upb_map *map, size_t *iter)
UPB_INLINE uintptr_t _upb_array_tagptr(void *ptr, int elem_size_lg2)
return memset(p, 0, total)
const upb_symtab * upb_filedef_symtab(const upb_filedef *f)
#define UPB_SIZE(size32, size64)
void upb_msg_field_next(upb_msg_field_iter *iter)
const upb_msgdef * upb_symtab_lookupmsg(const upb_symtab *s, const char *sym)
static void encode_scalar(upb_encstate *e, const void *_field_mem, const upb_msglayout *m, const upb_msglayout_field *f, bool skip_zero_value)
const grpc_generator::File * file
static UPB_NORETURN void jsonenc_errf(jsonenc *e, const char *fmt,...)
const upb_filedef * upb_symtab_addfile(upb_symtab *s, const google_protobuf_FileDescriptorProto *file_proto, upb_status *status)
static void upb_arena_addblock(upb_arena *a, upb_arena *root, void *ptr, size_t size)
@ UPB_DESCRIPTOR_TYPE_STRING
static const upb_msglayout *const google_protobuf_EnumDescriptorProto_submsgs[3]
UPB_INLINE bool google_protobuf_FieldOptions_lazy(const google_protobuf_FieldOptions *msg)
void upb_cleanup_func(void *ud)
const upb_fielddef * exts
upb_wellknowntype_t well_known_type
const upb_msgdef * msgdef
UPB_INLINE bool upb_tabent_isempty(const upb_tabent *e)
static bool is_pow2(uint64_t v)
static void encode_double(upb_encstate *e, double d)
int upb_msgdef_numfields(const upb_msgdef *m)
static const upb_msgdef * jsondec_typeurl(jsondec *d, upb_msg *msg, const upb_msgdef *m)
int upb_msgdef_numrealoneofs(const upb_msgdef *m)
static const upb_msglayout_field google_protobuf_ExtensionRangeOptions__fields[1]
static uint32_t encode_zz32(int32_t n)
static uint64_t WyhashMix(uint64_t v0, uint64_t v1)
const char * upb_filedef_name(const upb_filedef *f)
const char * upb_fielddef_defaultstr(const upb_fielddef *f, size_t *len)
static void jsondec_parselit(jsondec *d, const char *lit)
static const char * decode_msg(upb_decstate *d, const char *ptr, upb_msg *msg, const upb_msglayout *layout)
static const size_t memblock_reserve
UPB_INLINE uint64_t _upb_be_swap64(uint64_t val)
UPB_INLINE void decode_poplimit(upb_decstate *d, const char *ptr, int saved_delta)
struct google_protobuf_EnumValueDescriptorProto google_protobuf_EnumValueDescriptorProto
union upb_map_entry::@435 v
static bool jsondec_seqnext(jsondec *d, char end_ch)
static int64_t jsondec_unixtime(int y, int m, int d, int h, int min, int s)
const char * upb_filedef_phpprefix(const upb_filedef *f)
int upb_oneofdef_numfields(const upb_oneofdef *o)
static const upb_msglayout_field google_protobuf_FieldOptions__fields[7]
UPB_INLINE upb_StringView google_protobuf_FieldDescriptorProto_default_value(const google_protobuf_FieldDescriptorProto *msg)
static void insert(upb_table *t, lookupkey_t key, upb_tabkey tabkey, upb_value val, uint32_t hash, hashfunc_t *hashfunc, eqlfunc_t *eql)
const char * upb_status_errmsg(const upb_status *status)
static void jsonenc_printf(jsonenc *e, const char *fmt,...)
static void jsondec_anyfield(jsondec *d, upb_msg *msg, const upb_msgdef *m)
static int copy(grpc_slice_buffer *input, grpc_slice_buffer *output)
const upb_fielddef * upb_msgdef_itof(const upb_msgdef *m, uint32_t i)
const upb_fielddef ** fields
UPB_INLINE void * _upb_map_next(const upb_map *map, size_t *iter)
static char * jsondec_partialbase64(jsondec *d, const char *ptr, const char *end, char *out)
static const uint8_t seed[20]
UPB_INLINE upb_alloc * upb_arena_alloc(upb_arena *a)
static bool streql_view(upb_strview view, const char *b)
static const upb_msglayout *const google_protobuf_ServiceOptions_submsgs[1]
#define UPB_ALIGN_DOWN(size, align)
@ UPB_WIRE_TYPE_END_GROUP
const UPB_INLINE google_protobuf_EnumValueDescriptorProto *const * google_protobuf_EnumDescriptorProto_value(const google_protobuf_EnumDescriptorProto *msg, size_t *len)
const upb_filedef * upb_symtab_lookupfile(const upb_symtab *s, const char *name)
UPB_INLINE void _upb_sethas_field(const upb_msg *msg, const upb_msglayout_field *f)
@ UPB_WELLKNOWN_UNSPECIFIED
const upb_msglayout google_protobuf_FileOptions_msginit
bool upb_fielddef_ismap(const upb_fielddef *f)
upb_msgval upb_msg_get(const upb_msg *msg, const upb_fielddef *f)
static void jsonenc_bytes(jsonenc *e, upb_strview str)
@ UPB_DESCRIPTOR_TYPE_FIXED32
const upb_msglayout google_protobuf_UninterpretedOption_NamePart_msginit
struct _upb_tabent upb_tabent
mem_block * freelist_tail
UPB_INLINE upb_StringView google_protobuf_DescriptorProto_name(const google_protobuf_DescriptorProto *msg)
static const upb_msglayout_field google_protobuf_FieldDescriptorProto__fields[11]
const upb_msglayout google_protobuf_DescriptorProto_msginit
static size_t div_round_up(size_t n, size_t d)
const upb_oneofdef * upb_msgdef_ntoo(const upb_msgdef *m, const char *name, size_t len)
UPB_INLINE upb_StringView google_protobuf_FileOptions_php_namespace(const google_protobuf_FileOptions *msg)
@ UPB_DESCRIPTOR_TYPE_SFIXED64
static upb_msgval jsondec_strfield(jsondec *d, const upb_fielddef *f)
const UPB_INLINE google_protobuf_FileOptions * google_protobuf_FileDescriptorProto_options(const google_protobuf_FileDescriptorProto *msg)
const upb_filedef * upb_msgdef_file(const upb_msgdef *m)
static char * makejsonname(symtab_addctx *ctx, const char *name)
static const unsigned fixed64_ok
#define UPB_PRINTF(str, first_vararg)
static lookupkey_t intkey(uintptr_t key)
static void create_fielddef(symtab_addctx *ctx, const char *prefix, upb_msgdef *m, const google_protobuf_FieldDescriptorProto *field_proto)
UPB_INLINE bool _upb_map_get(const upb_map *map, const void *key, size_t key_size, void *val, size_t val_size)
const uint64_t kWyhashSalt[5]
static void decode_munge(int type, wireval *val)
static void extreg_key(char *buf, const upb_msglayout *l, uint32_t fieldnum)
static upb_strview jsondec_string(jsondec *d)
#define UPB_LONGJMP(buf, val)
static struct test_ctx ctx
upb_arena * upb_arena_init(void *mem, size_t n, upb_alloc *alloc)
UPB_INLINE char * upb_tabstr(upb_tabkey key, uint32_t *len)
static upb_msgval jsondec_bool(jsondec *d, const upb_fielddef *f)
const upb_msglayout google_protobuf_ServiceOptions_msginit
const char * upb_fielddef_fullname(const upb_fielddef *f)
bool upb_strtable_remove(upb_strtable *t, const char *key, size_t len, upb_value *val)
@ UPB_DESCRIPTOR_TYPE_GROUP
static void jsondec_wsch(jsondec *d, char ch)
static const upb_msglayout_field google_protobuf_EnumOptions__fields[3]
UPB_INLINE int32_t google_protobuf_FieldDescriptorProto_number(const google_protobuf_FieldDescriptorProto *msg)
void upb_msg_field_begin(upb_msg_field_iter *iter, const upb_msgdef *m)
@ UPB_DESCRIPTOR_TYPE_BYTES
UPB_INLINE uintptr_t _upb_tag_arrptr(void *ptr, int elem_size_lg2)
union upb_fielddef::@207 sub
bool upb_fielddef_packed(const upb_fielddef *f)
upb_value upb_inttable_iter_value(const upb_inttable_iter *i)
UPB_INLINE intptr_t decode_totable(const upb_msglayout *tablep)
static int _upb_mapsorter_cmpu32(const void *_a, const void *_b)
bool upb_msg_has(const upb_msg *msg, const upb_fielddef *f)
static const uint8_t desctype_to_elem_size_lg2[]
static void * upb_arena_doalloc(upb_alloc *alloc, void *ptr, size_t oldsize, size_t size)
static const upb_tabent * findentry(const upb_table *t, lookupkey_t key, uint32_t hash, eqlfunc_t *eql)
static int _upb_mapsorter_cmpstr(const void *_a, const void *_b)
static int64_t jsondec_strtoint64(jsondec *d, upb_strview str)
static void parse_default(symtab_addctx *ctx, const char *str, size_t len, upb_fielddef *f)
const UPB_INLINE upb_msglayout * decode_totablep(intptr_t table)
const upb_enumdef * upb_symtab_lookupenum(const upb_symtab *s, const char *sym)
static bool upb_cleanup_has_initial_block(uintptr_t cleanup_metadata)
int cmp_fields(const void *p1, const void *p2)
UPB_INLINE upb_StringView google_protobuf_FieldDescriptorProto_extendee(const google_protobuf_FieldDescriptorProto *msg)
const UPB_INLINE google_protobuf_OneofDescriptorProto *const * google_protobuf_DescriptorProto_oneof_decl(const google_protobuf_DescriptorProto *msg, size_t *len)
bool _upb_msg_discardunknown(upb_msg *msg, const upb_msgdef *m, int depth)
static char * strviewdup(symtab_addctx *ctx, upb_strview view)
static UPB_NORETURN void decode_err(upb_decstate *d)
static void encode_fixed32(upb_encstate *e, uint32_t val)
static const upb_msglayout_field google_protobuf_UninterpretedOption_NamePart__fields[2]
static void encode_fixed64(upb_encstate *e, uint64_t val)
struct google_protobuf_OneofDescriptorProto google_protobuf_OneofDescriptorProto
int upb_symtab_filecount(const upb_symtab *s)
const upb_filedef * upb_symtab_lookupfile2(const upb_symtab *s, const char *name, size_t len)
UPB_INLINE upb_StringView google_protobuf_EnumValueDescriptorProto_name(const google_protobuf_EnumValueDescriptorProto *msg)
bool upb_fielddef_issubmsg(const upb_fielddef *f)
UPB_INLINE uint32_t _upb_getoneofcase_field(const upb_msg *msg, const upb_msglayout_field *f)
const char * upb_fielddef_jsonname(const upb_fielddef *f)
upb_alloc upb_alloc_global
bool upb_fielddef_checkintfmt(int32_t fmt)
uintptr_t cleanup_metadata
static const upb_msglayout_field google_protobuf_DescriptorProto__fields[10]
const upb_fielddef * upb_oneofdef_itof(const upb_oneofdef *o, uint32_t num)
uint32_t upb_fielddef_number(const upb_fielddef *f)
const upb_msglayout google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit
static void jsondec_null(jsondec *d)
static const upb_msglayout_field google_protobuf_MethodOptions__fields[3]
static bool decode_top(struct upb_decstate *d, const char *buf, void *msg, const upb_msglayout *l)
const uint8_t upb_utf8_offsets[]
struct google_protobuf_FieldDescriptorProto google_protobuf_FieldDescriptorProto
upb_msg_ext * _upb_msg_getorcreateext(upb_msg *msg, const upb_msglayout_ext *e, upb_arena *arena)
static void _upb_mapsorter_getkeys(const void *_a, const void *_b, void *a_key, void *b_key, size_t size)
static const upb_msglayout_field google_protobuf_OneofOptions__fields[1]
grpc_core::ScopedArenaPtr arena
upb_msgval upb_mapiter_key(const upb_map *map, size_t iter)
bool _upb_decode(const char *buf, size_t size, void *msg, const upb_msglayout *l, const upb_extreg *extreg, int options, upb_arena *arena)
static const upb_msglayout *const google_protobuf_OneofOptions_submsgs[1]
const upb_fielddef * upb_oneofdef_field(const upb_oneofdef *o, int i)
static const UPB_FORCEINLINE char * decode_togroup(upb_decstate *d, const char *ptr, upb_msg *submsg, upb_msglayout const *const *submsgs, const upb_msglayout_field *field)
static void jsondec_objend(jsondec *d)
@ UPB_WELLKNOWN_UINT32VALUE
static void fill_fieldlayout(upb_msglayout_field *field, const upb_fielddef *f)
@ UPB_WELLKNOWN_UINT64VALUE
static bool streql(upb_tabkey k1, lookupkey_t k2)
bool upb_inttable_insert(upb_inttable *t, uintptr_t key, upb_value val, upb_arena *a)
upb_msg * _upb_msg_new(const upb_msglayout *l, upb_arena *a)
static void encode_mapentry(upb_encstate *e, uint32_t number, const upb_msglayout *layout, const upb_map_entry *ent)
const upb_msglayout google_protobuf_SourceCodeInfo_Location_msginit
static int field_number_cmp(const void *p1, const void *p2)
upb_fielddef * upb_msg_iter_field(const upb_msg_field_iter *iter)
static const UPB_FORCEINLINE char * decode_tag(upb_decstate *d, const char *ptr, uint32_t *val)
UPB_INLINE bool upb_strtable_lookup(const upb_strtable *t, const char *key, upb_value *v)
const upb_msg_ext * _upb_msg_getext(const upb_msg *msg, const upb_msglayout_ext *e)
#define UPB_ALIGN_OF(type)
@ UPB_WIRE_TYPE_DELIMITED
UPB_INLINE upb_StringView google_protobuf_EnumDescriptorProto_name(const google_protobuf_EnumDescriptorProto *msg)
for(map_begin_internal(intern, &it);!map_done(&it);map_next(&it))
void upb_strtable_begin(upb_strtable_iter *i, const upb_strtable *t)
static uint32_t upb_msglayout_place(upb_msglayout *l, size_t size)
static void * upb_global_allocfunc(upb_alloc *alloc, void *ptr, size_t oldsize, size_t size)
const upb_fielddef * upb_msgdef_field(const upb_msgdef *m, int i)
UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_extendee(const google_protobuf_FieldDescriptorProto *msg)
uint32_t upb_fielddef_defaultuint32(const upb_fielddef *f)
bool upb_array_append(upb_array *arr, upb_msgval val, upb_arena *arena)
static upb_msgval jsondec_msg(jsondec *d, const upb_fielddef *f)
static upb_msgval jsondec_value(jsondec *d, const upb_fielddef *f)
const upb_msglayout google_protobuf_MessageOptions_msginit
const upb_msglayout google_protobuf_EnumValueDescriptorProto_msginit
const upb_oneofdef * upb_msg_iter_oneof(const upb_msg_oneof_iter *iter)
static void encode_fixedarray(upb_encstate *e, const upb_array *arr, size_t elem_size, uint32_t tag)
static upb_tabent * findentry_mutable(upb_table *t, lookupkey_t key, uint32_t hash, eqlfunc_t *eql)
UPB_INLINE void * _upb_array_ptr(upb_array *arr)
@ UPB_JSONDEC_IGNOREUNKNOWN
UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_oneof_index(const google_protobuf_FieldDescriptorProto *msg)
int32_t upb_fielddef_defaultint32(const upb_fielddef *f)
const upb_msglayout google_protobuf_UninterpretedOption_msginit
memcpy(mem, inblock.get(), min(CONTAINING_RECORD(inblock.get(), MEMBLOCK, data) ->size, size))
static int jsondec_peek(jsondec *d)
static const void * symtab_resolve(symtab_addctx *ctx, const upb_fielddef *f, const char *base, upb_strview sym, upb_deftype_t type)
uint32_t upb_oneofdef_index(const upb_oneofdef *o)
static const upb_msg_internal * upb_msg_getinternal_const(const upb_msg *msg)
bool upb_msg_discardunknown(upb_msg *msg, const upb_msgdef *m, int maxdepth)
static const UPB_FORCEINLINE char * decode_varint64(upb_decstate *d, const char *ptr, uint64_t *val)
#define UPB_ALIGN_UP(size, align)
static const upb_msglayout_field google_protobuf_OneofDescriptorProto__fields[2]
const upb_enumdef * upb_fielddef_enumsubdef(const upb_fielddef *f)
static const char * jsondec_buftoint64(jsondec *d, const char *ptr, const char *end, int64_t *val)
size_t upb_json_encode(const upb_msg *msg, const upb_msgdef *m, const upb_symtab *ext_pool, int options, char *buf, size_t size, upb_status *status)
@ UPB_DESCRIPTOR_TYPE_MESSAGE
static const char _upb_fieldtype_to_sizelg2[12]
const char * upb_fielddef_name(const upb_fielddef *f)
static size_t upb_msgval_sizeof(upb_fieldtype_t type)
bool upb_strtable_resize(upb_strtable *t, size_t size_lg2, upb_arena *a)
static void jsonenc_putstr(jsonenc *e, const char *str)
static bool jsondec_isvalue(const upb_fielddef *f)
bool upb_msgdef_isnumberwrapper(const upb_msgdef *m)
UPB_INLINE bool _upb_map_set(upb_map *map, const void *key, size_t key_size, void *val, size_t val_size, upb_arena *a)
constexpr absl::remove_reference_t< T > && move(T &&t) noexcept
int32_t upb_enumdef_default(const upb_enumdef *e)
UPB_INLINE bool google_protobuf_FileOptions_has_php_namespace(const google_protobuf_FileOptions *msg)
static bool jsondec_tryskipdigits(jsondec *d)
bool upb_mapiter_done(const upb_map *map, size_t iter)
static void jsondec_field(jsondec *d, upb_msg *msg, const upb_msgdef *m)
static size_t upb_msg_sizeof(const upb_msglayout *l)
UPB_INLINE void * upb_realloc(upb_alloc *alloc, void *ptr, size_t oldsize, size_t size)
uint64_t Wyhash(const void *data, size_t len, uint64_t seed, const uint64_t salt[])
static const upb_msglayout *const google_protobuf_EnumValueDescriptorProto_submsgs[1]
void upb_map_clear(upb_map *map)
static void jsondec_map(jsondec *d, upb_msg *msg, const upb_fielddef *f)
bool upb_inttable_done(const upb_inttable_iter *i)
static const upb_msglayout *const google_protobuf_UninterpretedOption_submsgs[1]
static uint32_t * upb_cleanup_pointer(uintptr_t cleanup_metadata)
size_t upb_map_size(const upb_map *map)
static UPB_NORETURN void encode_err(upb_encstate *e)
static void * tag(intptr_t t)
UPB_INLINE int32_t google_protobuf_FieldDescriptorProto_label(const google_protobuf_FieldDescriptorProto *msg)
static void jsonenc_value(jsonenc *e, const upb_msg *msg, const upb_msgdef *m)
RefCountedPtr< grpc_tls_certificate_provider > root
struct google_protobuf_FieldOptions google_protobuf_FieldOptions
static const size_t overhead
const upb_msglayout google_protobuf_EnumDescriptorProto_msginit
const char * upb_enumdef_fullname(const upb_enumdef *e)
static uint32_t upb_inthash(uintptr_t key)
const upb_msglayout google_protobuf_OneofOptions_msginit
static void jsonenc_putsep(jsonenc *e, const char *str, bool *first)
const upb_msglayout google_protobuf_EnumValueOptions_msginit
@ UPB_WELLKNOWN_FLOATVALUE
const char * upb_msgdef_name(const upb_msgdef *m)
static unsigned int jsondec_base64_tablelookup(const char ch)
const char * upb_filedef_phpnamespace(const upb_filedef *f)
UPB_INLINE upb_StringView google_protobuf_FileDescriptorProto_syntax(const google_protobuf_FileDescriptorProto *msg)
static const upb_msglayout *const google_protobuf_FileOptions_submsgs[1]
UPB_INLINE bool decode_verifyutf8_inl(const char *buf, int len)
UPB_INLINE bool google_protobuf_FileDescriptorProto_has_name(const google_protobuf_FileDescriptorProto *msg)
size_t upb_inttable_count(const upb_inttable *t)
static upb_tabkey strcopy(lookupkey_t k2, upb_arena *a)
upb_map * _upb_map_new(upb_arena *a, size_t key_size, size_t value_size)
#define UPB_PTR_AT(msg, ofs, type)
const upb_msglayout google_protobuf_FileDescriptorProto_msginit
int upb_filedef_enumcount(const upb_filedef *f)
int upb_oneofdef_fieldcount(const upb_oneofdef *o)
static void jsonenc_stringbody(jsonenc *e, upb_strview str)
const UPB_INLINE google_protobuf_FieldDescriptorProto *const * google_protobuf_FileDescriptorProto_extension(const google_protobuf_FileDescriptorProto *msg, size_t *len)
@ UPB_DESCRIPTOR_TYPE_SINT32
@ UPB_WELLKNOWN_TIMESTAMP
static bool upb_arrhas(upb_tabval key)
union upb_fielddef::@206 defaultval
static const upb_msglayout *const google_protobuf_OneofDescriptorProto_submsgs[1]
uint32_t upb_fielddef_index(const upb_fielddef *f)
static void jsondec_wrapper(jsondec *d, upb_msg *msg, const upb_msgdef *m)
UPB_INLINE void _upb_map_fromvalue(upb_value val, void *out, size_t size)
void upb_status_clear(upb_status *status)
UPB_INLINE upb_StringView google_protobuf_OneofDescriptorProto_name(const google_protobuf_OneofDescriptorProto *msg)
const upb_oneofdef * upb_fielddef_containingoneof(const upb_fielddef *f)
static const upb_msglayout_field google_protobuf_DescriptorProto_ReservedRange__fields[2]
static uint32_t inthash(upb_tabkey key)
const char * upb_oneofdef_name(const upb_oneofdef *o)
static void jsondec_wellknown(jsondec *d, upb_msg *msg, const upb_msgdef *m)
bool upb_inttable_lookup(const upb_inttable *t, uintptr_t key, upb_value *v)
UPB_INLINE void _upb_map_clear(upb_map *map)
bool upb_json_decode(const char *buf, size_t size, upb_msg *msg, const upb_msgdef *m, const upb_symtab *any_pool, int options, upb_arena *arena, upb_status *status)
char * upb_strdup2(const char *s, size_t len, upb_arena *a)
unsigned __int64 uint64_t
static UPB_FORCEINLINE bool decode_tryfastdispatch(upb_decstate *d, const char **ptr, upb_msg *msg, const upb_msglayout *layout)
UPB_INLINE size_t _upb_map_size(const upb_map *map)
#define CASE(ctype, type, wtype, encodeval)
const char * upb_enumdef_name(const upb_enumdef *e)
const google_protobuf_FieldDescriptorProto * unresolved
int def(FILE *source, FILE *dest, int level)
bool upb_fielddef_checklabel(int32_t label)
@ UPB_DESCRIPTOR_TYPE_UINT32
bool upb_fielddef_isextension(const upb_fielddef *f)
static const upb_msglayout_field google_protobuf_SourceCodeInfo__fields[1]
const UPB_INLINE google_protobuf_FieldDescriptorProto *const * google_protobuf_DescriptorProto_extension(const google_protobuf_DescriptorProto *msg, size_t *len)
const char * upb_filedef_package(const upb_filedef *f)
static UPB_NORETURN void jsonenc_err(jsonenc *e, const char *msg)
upb_descriptortype_t type_
static const int8_t delim_ops[37]
static const upb_msglayout_field google_protobuf_FileOptions__fields[21]
upb_syntax_t upb_msgdef_syntax(const upb_msgdef *m)
static void jsonenc_timestamp(jsonenc *e, const upb_msg *msg, const upb_msgdef *m)
static void jsondec_arrend(jsondec *d)
struct google_protobuf_EnumDescriptorProto google_protobuf_EnumDescriptorProto
UPB_INLINE upb_msg * _upb_msg_new_inl(const upb_msglayout *l, upb_arena *a)
@ UPB_DESCRIPTOR_TYPE_FIXED64
void upb_enum_next(upb_enum_iter *iter)
upb_extreg * upb_extreg_new(upb_arena *arena)
static void jsondec_timestamp(jsondec *d, upb_msg *msg, const upb_msgdef *m)
UPB_INLINE upb_arena * upb_arena_new(void)
const struct upb_msglayout *const * submsgs
UPB_INLINE upb_StringView google_protobuf_FileOptions_php_class_prefix(const google_protobuf_FileOptions *msg)
static void jsondec_tomsg(jsondec *d, upb_msg *msg, const upb_msgdef *m)
const upb_fielddef * fields
struct upb_arena upb_arena
static upb_arena * arena_findroot(upb_arena *a)
UPB_INLINE uint32_t fastdecode_loadtag(const char *ptr)
static const upb_msglayout *const google_protobuf_DescriptorProto_ExtensionRange_submsgs[1]
static size_t jsondec_base64(jsondec *d, upb_strview str)
@ UPB_DESCRIPTOR_TYPE_FLOAT
bool upb_fielddef_isseq(const upb_fielddef *f)
static const upb_msglayout_field google_protobuf_FileDescriptorProto__fields[12]
static void jsonenc_fieldmask(jsonenc *e, const upb_msg *msg, const upb_msgdef *m)
static uint64_t upb_umul128(uint64_t v0, uint64_t v1, uint64_t *out_high)
bool _upb_extreg_add(upb_extreg *r, const upb_msglayout_ext *e, size_t count)
void * _upb_array_resize_fallback(upb_array **arr_ptr, size_t size, int elem_size_lg2, upb_arena *arena)
static const char *const mon[12]
@ UPB_DESCRIPTOR_TYPE_SINT64
UPB_INLINE void upb_gfree(void *ptr)
float upb_fielddef_defaultfloat(const upb_fielddef *f)
static void remove_filedef(upb_symtab *s, upb_filedef *file)
static const upb_msglayout_field google_protobuf_GeneratedCodeInfo__fields[1]
static const char * decode_toarray(upb_decstate *d, const char *ptr, upb_msg *msg, upb_msglayout const *const *submsgs, const upb_msglayout_field *field, wireval *val, int op)
UPB_INLINE bool google_protobuf_FileDescriptorProto_has_package(const google_protobuf_FileDescriptorProto *msg)
static const upb_msglayout_field google_protobuf_UninterpretedOption__fields[7]
#define UPB_STRVIEW_FORMAT
void upb_status_seterrmsg(upb_status *status, const char *msg)
static bool jsondec_objnext(jsondec *d)
static const void * unpack_def(upb_value v, upb_deftype_t type)
#define UPB_STRVIEW_ARGS(view)
UPB_INLINE upb_fieldmode _upb_getmode(const upb_msglayout_field *field)
static bool inteql(upb_tabkey k1, lookupkey_t k2)
static void create_msgdef(symtab_addctx *ctx, const char *prefix, const google_protobuf_DescriptorProto *msg_proto)
#define UPB_PB_VARINT_MAX_LEN
const upb_fielddef * upb_msgdef_ntof(const upb_msgdef *m, const char *name, size_t len)
const UPB_NOINLINE char * decode_isdonefallback(upb_decstate *d, const char *ptr, int overrun)
static void jsondec_array(jsondec *d, upb_msg *msg, const upb_fielddef *f)
static const upb_filedef * _upb_symtab_addfile(upb_symtab *s, const google_protobuf_FileDescriptorProto *file_proto, const upb_msglayout **layouts, upb_status *status)
bool upb_oneofdef_issynthetic(const upb_oneofdef *o)
static void jsondec_object(jsondec *d, upb_msg *msg, const upb_msgdef *m)
upb_map * upb_map_new(upb_arena *a, upb_fieldtype_t key_type, upb_fieldtype_t value_type)
_W64 unsigned int uintptr_t
void upb_strtable_clear(upb_strtable *t)
UPB_INLINE size_t _upb_arenahas(upb_arena *a)
static void jsonenc_scalar(jsonenc *e, upb_msgval val, const upb_fielddef *f)
static const uint8_t desctype_to_mapsize[]
static UPB_NOINLINE decode_vret decode_longvarint64(const char *ptr, uint64_t val)
UPB_INLINE void * upb_malloc(upb_alloc *alloc, size_t size)
bool upb_msg_oneof_done(const upb_msg_oneof_iter *iter)
UPB_INLINE upb_StringView google_protobuf_FieldDescriptorProto_type_name(const google_protobuf_FieldDescriptorProto *msg)
const upb_msglayout * layout
bool upb_inttable_replace(upb_inttable *t, uintptr_t key, upb_value val)
UPB_INLINE bool _upb_sortedmap_next(_upb_mapsorter *s, const upb_map *map, _upb_sortedmap *sorted, upb_map_entry *ent)
bool upb_msgdef_lookupname(const upb_msgdef *m, const char *name, size_t len, const upb_fielddef **f, const upb_oneofdef **o)
const UPB_INLINE google_protobuf_MessageOptions * google_protobuf_DescriptorProto_options(const google_protobuf_DescriptorProto *msg)
void upb_inttable_next(upb_inttable_iter *iter)
UPB_INLINE bool google_protobuf_FileDescriptorProto_has_syntax(const google_protobuf_FileDescriptorProto *msg)
@ UPB_DESCRIPTOR_TYPE_UINT64
static str_t * newstr(symtab_addctx *ctx, const char *data, size_t len)
UPB_INLINE void _upb_mapsorter_popmap(_upb_mapsorter *s, _upb_sortedmap *sorted)
const upb_msgdef * parent
void qsort(void *a, size_t n, size_t es, int(*cmp)(const void *, const void *))
UPB_INLINE bool _upb_array_resize(upb_array *arr, size_t size, upb_arena *arena)
UPB_INLINE bool google_protobuf_FieldOptions_has_packed(const google_protobuf_FieldOptions *msg)
static bool jsondec_tryparsech(jsondec *d, char ch)
#define UPB_PTRADD(ptr, ofs)
static upb_tabval int_arrent(const upb_inttable_iter *i)
static UPB_NORETURN void jsondec_err(jsondec *d, const char *msg)
static const upb_msglayout_field google_protobuf_DescriptorProto_ExtensionRange__fields[3]
UPB_INLINE bool google_protobuf_FileOptions_has_php_class_prefix(const google_protobuf_FileOptions *msg)
UPB_INLINE bool _upb_hasbit_field(const upb_msg *msg, const upb_msglayout_field *f)
UPB_INLINE void _upb_mapsorter_destroy(_upb_mapsorter *s)
static UPB_NOINLINE size_t encode_varint64(uint64_t val, char *buf)
const UPB_INLINE google_protobuf_EnumDescriptorProto *const * google_protobuf_FileDescriptorProto_enum_type(const google_protobuf_FileDescriptorProto *msg, size_t *len)
size_t getjsonname(const char *name, char *buf, size_t len)
static void assign_msg_wellknowntype(upb_msgdef *m)
@ UPB_WELLKNOWN_INT32VALUE
static upb_value pack_def(const void *ptr, upb_deftype_t type)
IntAfterTypedTestSuiteP after
bool upb_strtable_lookup2(const upb_strtable *t, const char *key, size_t len, upb_value *v)
bool upb_msgdef_mapentry(const upb_msgdef *m)
size_t upb_array_size(const upb_array *arr)
static void jsondec_entrysep(jsondec *d)
static void jsonenc_struct(jsonenc *e, const upb_msg *msg, const upb_msgdef *m)
const upb_fielddef * upb_msg_whichoneof(const upb_msg *msg, const upb_oneofdef *o)
bool upb_msg_oneof_iter_isequal(const upb_msg_oneof_iter *iter1, const upb_msg_oneof_iter *iter2)
#define UPB_TABVALUE_EMPTY_INIT
static void count_types_in_msg(const google_protobuf_DescriptorProto *msg_proto, upb_filedef *file)
static bool between(int32_t x, int32_t low, int32_t high)
static void upb_status_setoom(upb_status *status)
const char * upb_msgdef_fullname(const upb_msgdef *m)
static void jsonenc_msgfield(jsonenc *e, const upb_msg *msg, const upb_msgdef *m)
const upb_msglayout google_protobuf_ServiceDescriptorProto_msginit
bool upb_inttable_init(upb_inttable *t, upb_arena *a)
UPB_INLINE upb_StringView google_protobuf_FieldDescriptorProto_json_name(const google_protobuf_FieldDescriptorProto *msg)
bool upb_msg_next(const upb_msg *msg, const upb_msgdef *m, const upb_symtab *ext_pool, const upb_fielddef **out_f, upb_msgval *out_val, size_t *iter)
static int _upb_mapsorter_cmpi32(const void *_a, const void *_b)
@ UPB_DESCRIPTOR_TYPE_DOUBLE
bool upb_fielddef_defaultbool(const upb_fielddef *f)
static upb_msgval _upb_msg_getraw(const upb_msg *msg, const upb_fielddef *f)
upb_arena * arena_initslow(void *mem, size_t n, upb_alloc *alloc)
static const upb_msglayout_field google_protobuf_EnumDescriptorProto__fields[5]
void upb_oneof_next(upb_oneof_iter *iter)
@ UPB_WELLKNOWN_FIELDMASK
UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_json_name(const google_protobuf_FieldDescriptorProto *msg)
static upb_msgval jsondec_int(jsondec *d, const upb_fielddef *f)
bool upb_msg_field_done(const upb_msg_field_iter *iter)
static void count_types_in_file(const google_protobuf_FileDescriptorProto *file_proto, upb_filedef *file)
static size_t get_field_size(const upb_msglayout_field *f)
upb_wellknowntype_t upb_msgdef_wellknowntype(const upb_msgdef *m)
static bool streql2(const char *a, size_t n, const char *b)
@ UPB_WELLKNOWN_BYTESVALUE
static const upb_msglayout *const google_protobuf_ServiceDescriptorProto_submsgs[2]
bool upb_oneof_done(upb_oneof_iter *iter)
static upb_msg_internal * upb_msg_getinternal(upb_msg *msg)
const char * upb_msg_getunknown(const upb_msg *msg, size_t *len)
const upb_msglayout google_protobuf_DescriptorProto_ExtensionRange_msginit
const struct _upb_tabent * next
static bool init(upb_table *t, uint8_t size_lg2, upb_arena *a)
#define UPB_UNREACHABLE()
#define VARINT_CASE(ctype, encode)
static void encode_float(upb_encstate *e, float d)
static upb_tabval * mutable_array(upb_inttable *t)
static const unsigned fixed32_ok
bool upb_map_set(upb_map *map, upb_msgval key, upb_msgval val, upb_arena *arena)
bool upb_map_get(const upb_map *map, upb_msgval key, upb_msgval *val)
const char * upb_enumdef_iton(const upb_enumdef *def, int32_t num)
static void jsondec_skipval(jsondec *d)
void * symtab_alloc(symtab_addctx *ctx, size_t bytes)
UPB_INLINE void upb_free(upb_alloc *alloc, void *ptr)
static const char * shortname(const char *longname)
static const upb_msglayout_field google_protobuf_SourceCodeInfo_Location__fields[5]
void upb_msg_field_iter_setdone(upb_msg_field_iter *iter)
static void create_enumdef(symtab_addctx *ctx, const char *prefix, const google_protobuf_EnumDescriptorProto *enum_proto)
bool upb_msg_field_iter_isequal(const upb_msg_field_iter *iter1, const upb_msg_field_iter *iter2)
upb_msg * upb_msg_new(const upb_msgdef *m, upb_arena *a)
const UPB_INLINE google_protobuf_EnumDescriptorProto *const * google_protobuf_DescriptorProto_enum_type(const google_protobuf_DescriptorProto *msg, size_t *len)
GTEST_API_ const char * fmt
UPB_INLINE uint32_t _upb_be_swap32(uint32_t val)
static void build_filedef(symtab_addctx *ctx, upb_filedef *file, const google_protobuf_FileDescriptorProto *file_proto)
const UPB_INLINE char * decode_isdonefallback_inl(upb_decstate *d, const char *ptr, int overrun)
UPB_INLINE bool _upb_map_delete(upb_map *map, const void *key, size_t key_size)
const upb_msglayout google_protobuf_MethodOptions_msginit
const upb_enumdef * upb_filedef_enum(const upb_filedef *f, int i)
static void jsondec_fieldmask(jsondec *d, upb_msg *msg, const upb_msgdef *m)
void upb_msg_oneof_iter_setdone(upb_msg_oneof_iter *iter)
bool upb_strtable_insert(upb_strtable *t, const char *k, size_t len, upb_value v, upb_arena *a)
const upb_msglayout google_protobuf_SourceCodeInfo_msginit
const upb_filedef * upb_fielddef_file(const upb_fielddef *f)
const upb_msglayout google_protobuf_ExtensionRangeOptions_msginit
UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_type_name(const google_protobuf_FieldDescriptorProto *msg)
int upb_filedef_msgcount(const upb_filedef *f)
static uint64_t encode_zz64(int64_t n)
@ UPB_DESCRIPTOR_TYPE_SFIXED32
bool upb_map_delete(upb_map *map, upb_msgval key)
bool upb_arena_addcleanup(upb_arena *a, void *ud, upb_cleanup_func *func)
const char * fastdecode_generic(struct upb_decstate *d, const char *ptr, upb_msg *msg, intptr_t table, uint64_t hasbits, uint64_t data)
const FieldDescriptor * field
const upb_msglayout google_protobuf_DescriptorProto_ReservedRange_msginit
UPB_INLINE void * upb_gmalloc(size_t size)
static void check(upb_inttable *t)
static void jsonenc_listvalue(jsonenc *e, const upb_msg *msg, const upb_msgdef *m)
#define UPB_UNPOISON_MEMORY_REGION(addr, size)
const upb_oneofdef * oneofs
static void __asan_unpoison_memory_region(const void *addr, size_t size)
bool upb_fielddef_checktype(int32_t type)
static void jsonenc_nanos(jsonenc *e, int32_t nanos)
static const char * decode_tomap(upb_decstate *d, const char *ptr, upb_msg *msg, upb_msglayout const *const *submsgs, const upb_msglayout_field *field, wireval *val)
void upb_arena_free(upb_arena *a)
static const upb_msglayout_field google_protobuf_EnumValueDescriptorProto__fields[3]
const upb_DefPool * symtab
@ UPB_DESCRIPTOR_TYPE_ENUM
const UPB_INLINE google_protobuf_DescriptorProto *const * google_protobuf_FileDescriptorProto_message_type(const google_protobuf_FileDescriptorProto *msg, size_t *len)
static void create_oneofdef(symtab_addctx *ctx, upb_msgdef *m, const google_protobuf_OneofDescriptorProto *oneof_proto)
const upb_msg_ext * _upb_msg_getexts(const upb_msg *msg, size_t *count)
static size_t jsonenc_nullz(jsonenc *e, size_t size)
#define UPB_STATUS_MAX_MESSAGE
static uint32_t table_hash(const char *p, size_t n)
static void jsonenc_fieldpath(jsonenc *e, upb_strview path)
UPB_INLINE bool google_protobuf_FieldOptions_packed(const google_protobuf_FieldOptions *msg)
bool upb_enum_done(upb_enum_iter *iter)
UPB_INLINE void _upb_mapsorter_init(_upb_mapsorter *s)
void upb_strtable_iter_setdone(upb_strtable_iter *i)
static const upb_msglayout *const google_protobuf_EnumValueOptions_submsgs[1]
#define UPB_POISON_MEMORY_REGION(addr, size)
const upb_oneofdef * upb_msgdef_oneof(const upb_msgdef *m, int i)
bool upb_inttable_sizedinit(upb_inttable *t, size_t asize, int hsize_lg2, upb_arena *a)
static void assign_layout_indices(const upb_msgdef *m, upb_msglayout *l, upb_msglayout_field *fields)
UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_name(const google_protobuf_FieldDescriptorProto *msg)
const upb_msgdef * upb_oneofdef_containingtype(const upb_oneofdef *o)
static void nullz(upb_status *status)
UPB_NORETURN static UPB_NOINLINE void symtab_oomerr(symtab_addctx *ctx)
const upb_msglayout google_protobuf_OneofDescriptorProto_msginit
const upb_msglayout google_protobuf_EnumOptions_msginit
void upb_inttable_compact(upb_inttable *t, upb_arena *a)
void upb_status_vappenderrf(upb_status *status, const char *fmt, va_list args)
static bool lookup(const upb_table *t, lookupkey_t key, upb_value *v, uint32_t hash, eqlfunc_t *eql)
UPB_INLINE void _upb_value_setval(upb_value *v, uint64_t val, upb_ctype_t ctype)
bool _upb_array_realloc(upb_array *arr, size_t min_size, upb_arena *arena)
static upb_tabval * inttable_val(upb_inttable *t, uintptr_t key)
bool upb_strtable_done(const upb_strtable_iter *i)
const upb_msglayout google_protobuf_MethodDescriptorProto_msginit
void upb_inttable_begin(upb_inttable_iter *i, const upb_inttable *t)
static bool in_oneof(const upb_msglayout_field *field)
static const upb_msglayout *const google_protobuf_ExtensionRangeOptions_submsgs[1]
const UPB_INLINE google_protobuf_FieldDescriptorProto *const * google_protobuf_DescriptorProto_field(const google_protobuf_DescriptorProto *msg, size_t *len)
static void encode_array(upb_encstate *e, const upb_msg *msg, const upb_msglayout *m, const upb_msglayout_field *f)
static const int8_t varint_ops[19]
static const upb_tabent * str_tabent(const upb_strtable_iter *i)
static double jsondec_number(jsondec *d)
static uint8_t upb_msg_fielddefsize(const upb_fielddef *f)
@ UPB_JSONENC_EMITDEFAULTS
upb_msgval upb_array_get(const upb_array *arr, size_t i)
static const upb_tabent * int_tabent(const upb_inttable_iter *i)
bool _upb_mapsorter_pushmap(_upb_mapsorter *s, upb_descriptortype_t key_type, const upb_map *map, _upb_sortedmap *sorted)
UniquePtr< SSL_SESSION > ret
int upb_enumdef_numvals(const upb_enumdef *e)
void upb_msg_oneof_begin(upb_msg_oneof_iter *iter, const upb_msgdef *m)
UPB_INLINE upb_StringView google_protobuf_FieldDescriptorProto_name(const google_protobuf_FieldDescriptorProto *msg)
static const upb_msglayout_field google_protobuf_MethodDescriptorProto__fields[6]
static const upb_msglayout *const google_protobuf_FieldDescriptorProto_submsgs[1]
static const upb_msglayout *const google_protobuf_MethodDescriptorProto_submsgs[1]
bool upb_ok(const upb_status *status)
bool _upb_symtab_loaddefinit(upb_symtab *s, const upb_def_init *init)
@ UPB_DEFTYPE_FIELD_JSONNAME
bool upb_enumdef_ntoi(const upb_enumdef *def, const char *name, size_t len, int32_t *num)
static void jsondec_struct(jsondec *d, upb_msg *msg, const upb_msgdef *m)
const upb_msglayout google_protobuf_GeneratedCodeInfo_msginit
static void encode_message(upb_encstate *e, const upb_msg *msg, const upb_msglayout *m, size_t *size)
static UPB_NORETURN void jsondec_errf(jsondec *d, const char *fmt,...)
static upb_msgval jsondec_uint(jsondec *d, const upb_fielddef *f)
UPB_INLINE int32_t google_protobuf_EnumValueDescriptorProto_number(const google_protobuf_EnumValueDescriptorProto *msg)
UPB_INLINE upb_StringView google_protobuf_FileDescriptorProto_name(const google_protobuf_FileDescriptorProto *msg)
static const upb_msglayout *const google_protobuf_EnumOptions_submsgs[1]
bool _upb_msg_addunknown(upb_msg *msg, const char *data, size_t len, upb_arena *arena)
int upb_filedef_depcount(const upb_filedef *f)
const upb_fielddef * upb_msgdef_lookupjsonname(const upb_msgdef *m, const char *name, size_t len)
static const upb_msglayout *const google_protobuf_FieldOptions_submsgs[1]
static void jsonenc_putbytes(jsonenc *e, const void *data, size_t len)
const upb_msgdef * upb_fielddef_containingtype(const upb_fielddef *f)
bool upb_inttable_iter_isequal(const upb_inttable_iter *i1, const upb_inttable_iter *i2)
static int _upb_mapsorter_cmpi64(const void *_a, const void *_b)
std::array< int64_t, Size > values
@ UPB_DESCRIPTOR_TYPE_INT64
bool upb_inttable_remove(upb_inttable *t, uintptr_t key, upb_value *val)
static char jsondec_escape(jsondec *d)
static const char prefix[]
UPB_INLINE upb_strview upb_tabstrview(upb_tabkey key)
static lookupkey_t strkey2(const char *str, size_t len)
void upb_enum_begin(upb_enum_iter *i, const upb_enumdef *e)
#define UPB_MAPENTRY_VALUE
@ UPB_DESCRIPTOR_TYPE_BOOL
static void jsondec_false(jsondec *d)
#define UPB_MAPTYPE_STRING
#define UPB_MAX_FIELDNUMBER
upb_msgval upb_mapiter_value(const upb_map *map, size_t iter)
static void parse(const char *s)
uintptr_t upb_inttable_iter_key(const upb_inttable_iter *i)
static upb_tabent * emptyent(upb_table *t, upb_tabent *e)
static void jsonenc_enum(int32_t val, const upb_fielddef *f, jsonenc *e)
UPB_INLINE bool decode_isdone(upb_decstate *d, const char **ptr)
static void set_default_default(symtab_addctx *ctx, upb_fielddef *f)
static const upb_msglayout_field google_protobuf_EnumDescriptorProto_EnumReservedRange__fields[2]
static void jsondec_resize(jsondec *d, char **buf, char **end, char **buf_end)
const upb_oneofdef * upb_fielddef_realcontainingoneof(const upb_fielddef *f)
static uint32_t strhash(upb_tabkey key)
void upb_msg_clearfield(upb_msg *msg, const upb_fielddef *f)
ABSL_MUST_USE_RESULT bool ok() const
void * _upb_arena_slowmalloc(upb_arena *a, size_t size)
bool upb_fielddef_lazy(const upb_fielddef *f)
static void make_layout(symtab_addctx *ctx, const upb_msgdef *m)
upb_strview upb_strtable_iter_key(const upb_strtable_iter *i)
const upb_enumdef * enumdef
bool upb_fielddef_isprimitive(const upb_fielddef *f)
UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_options(const google_protobuf_FieldDescriptorProto *msg)
static const upb_msglayout *const google_protobuf_MessageOptions_submsgs[1]
static void encode_map(upb_encstate *e, const upb_msg *msg, const upb_msglayout *m, const upb_msglayout_field *f)
const UPB_INLINE void * _upb_array_constptr(const upb_array *arr)
static bool jsondec_arrnext(jsondec *d)
static const upb_msglayout *const google_protobuf_FileDescriptorSet_submsgs[1]
static const UPB_FORCEINLINE char * decode_tosubmsg(upb_decstate *d, const char *ptr, upb_msg *submsg, upb_msglayout const *const *submsgs, const upb_msglayout_field *field, int size)
const upb_msgdef * upb_filedef_msg(const upb_filedef *f, int i)
static bool upb_isbetween(char c, char low, char high)
void upb_status_vseterrf(upb_status *status, const char *fmt, va_list args)
static const upb_msglayout_field google_protobuf_ServiceDescriptorProto__fields[3]
UPB_INLINE bool google_protobuf_MessageOptions_map_entry(const google_protobuf_MessageOptions *msg)
upb_cleanup_func * cleanup
static const upb_msglayout *const google_protobuf_GeneratedCodeInfo_submsgs[1]
static upb_array * getorcreate_array(upb_array **arr_ptr, int elem_size_lg2, upb_arena *arena)
const upb_filedef * upb_enumdef_file(const upb_enumdef *e)
static int _upb_mapsorter_cmpbool(const void *_a, const void *_b)
static const upb_msglayout *const google_protobuf_FileDescriptorProto_submsgs[6]
const upb_filedef ** deps
static upb_value _upb_value_val(uint64_t val)
bool upb_fielddef_hassubdef(const upb_fielddef *f)
bool upb_fielddef_haspresence(const upb_fielddef *f)
static void jsondec_listvalue(jsondec *d, upb_msg *msg, const upb_msgdef *m)
uint32_t hashfunc_t(upb_tabkey key)
static void jsondec_true(jsondec *d)
char * upb_encode_ex(const void *msg, const upb_msglayout *l, int options, upb_arena *arena, size_t *size)
const char * phpnamespace
const upb_msglayout * upb_msgdef_layout(const upb_msgdef *m)
upb_array * upb_array_new(upb_arena *a, upb_fieldtype_t type)
void upb_msg_set(upb_msg *msg, const upb_fielddef *f, upb_msgval val, upb_arena *a)
@ UPB_WELLKNOWN_BOOLVALUE
static uint32_t UnalignedLoad32(const void *p)
const upb_msgdef * upb_fielddef_msgsubdef(const upb_fielddef *f)
upb_msgval upb_fielddef_default(const upb_fielddef *f)
static void jsondec_duration(jsondec *d, upb_msg *msg, const upb_msgdef *m)
void upb_msg_oneof_next(upb_msg_oneof_iter *iter)
static const upb_msglayout_field google_protobuf_GeneratedCodeInfo_Annotation__fields[4]
UPB_INLINE int32_t google_protobuf_FieldDescriptorProto_type(const google_protobuf_FieldDescriptorProto *msg)
UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_default_value(const google_protobuf_FieldDescriptorProto *msg)
static int _upb_mapsorter_cmpu64(const void *_a, const void *_b)
static void jsondec_any(jsondec *d, upb_msg *msg, const upb_msgdef *m)
int jsondec_epochdays(int y, int m, int d)
static const upb_msglayout_field google_protobuf_ServiceOptions__fields[2]
static void jsonenc_msgfields(jsonenc *e, const upb_msg *msg, const upb_msgdef *m, bool first)
bool upb_fielddef_checkdescriptortype(int32_t type)
static uintptr_t upb_cleanup_metadata(uint32_t *cleanup, bool has_initial_block)
static bool rm(upb_table *t, lookupkey_t key, upb_value *val, upb_tabkey *removed, uint32_t hash, eqlfunc_t *eql)
static const upb_msglayout *const google_protobuf_SourceCodeInfo_submsgs[1]
@ UPB_WIRE_TYPE_START_GROUP
static void jsonenc_msg(jsonenc *e, const upb_msg *msg, const upb_msgdef *m)
static const upb_tabent * upb_getentry(const upb_table *t, uint32_t hash)
const char * fastdecode_err(upb_decstate *d)
static bool jsondec_isnullvalue(const upb_fielddef *f)
int64_t upb_fielddef_defaultint64(const upb_fielddef *f)
UPB_INLINE bool _upb_repeated_or_map(const upb_msglayout_field *field)
void upb_msg_clear(upb_msg *msg, const upb_msgdef *m)
const upb_enumdef * enums
static void jsonenc_double(jsonenc *e, const char *fmt, double val)
static UPB_NOINLINE void encode_growbuffer(upb_encstate *e, size_t bytes)
UPB_INLINE int decode_pushlimit(upb_decstate *d, const char *ptr, int size)
@ UPB_DESCRIPTOR_TYPE_INT32
void upb_oneof_begin(upb_oneof_iter *iter, const upb_oneofdef *o)
static const UPB_FORCEINLINE char * decode_group(upb_decstate *d, const char *ptr, upb_msg *submsg, const upb_msglayout *subl, uint32_t number)
static void jsonenc_array(jsonenc *e, const upb_array *arr, const upb_fielddef *f)
struct google_protobuf_DescriptorProto google_protobuf_DescriptorProto
UPB_INLINE bool _upb_isle(void)
static upb_msgval jsondec_double(jsondec *d, const upb_fielddef *f)
int32_t upb_enum_iter_number(upb_enum_iter *iter)
const UPB_INLINE google_protobuf_DescriptorProto *const * google_protobuf_DescriptorProto_nested_type(const google_protobuf_DescriptorProto *msg, size_t *len)
upb_mutmsgval upb_msg_mutable(upb_msg *msg, const upb_fielddef *f, upb_arena *a)
upb_arena * _upb_symtab_arena(const upb_symtab *s)
static void resolve_fielddef(symtab_addctx *ctx, const char *prefix, upb_fielddef *f)
const upb_filedef * upb_filedef_dep(const upb_filedef *f, int i)
static void chkdefaulttype(const upb_fielddef *f, int ctype)
const char * upb_enum_iter_name(upb_enum_iter *iter)
static UPB_NOINLINE void encode_longvarint(upb_encstate *e, uint64_t val)
static const double MAX_LOAD
char * upb_encode(const void *msg, const upb_msglayout *m, upb_arena *arena, size_t *size)
void upb_oneof_iter_setdone(upb_oneof_iter *iter)
static bool isfull(upb_table *t)
UPB_INLINE void _upb_map_fromkey(upb_strview key, void *out, size_t size)
static void __asan_poison_memory_region(const void *addr, size_t size)
@ UPB_WELLKNOWN_INT64VALUE
static void jsonenc_mapkey(jsonenc *e, upb_msgval val, const upb_fielddef *f)
bool upb_msgdef_iswrapper(const upb_msgdef *m)
bool eqlfunc_t(upb_tabkey k1, lookupkey_t k2)
UPB_INLINE google_protobuf_FileDescriptorProto * google_protobuf_FileDescriptorProto_parse_ex(const char *buf, size_t size, const upb_ExtensionRegistry *extreg, int options, upb_Arena *arena)
static void jsondec_objstart(jsondec *d)
@ UPB_ENCODE_DETERMINISTIC
static const upb_msglayout *const google_protobuf_DescriptorProto_submsgs[7]
upb_descriptortype_t upb_fielddef_descriptortype(const upb_fielddef *f)
struct google_protobuf_FileDescriptorProto google_protobuf_FileDescriptorProto
static const upb_tabval * inttable_val_const(const upb_inttable *t, uintptr_t key)
static void jsondec_skipdigits(jsondec *d)
bool upb_array_resize(upb_array *arr, size_t size, upb_arena *arena)
upb_fielddef * upb_oneof_iter_field(const upb_oneof_iter *iter)
uint64_t upb_fielddef_defaultuint64(const upb_fielddef *f)
static void jsonenc_duration(jsonenc *e, const upb_msg *msg, const upb_msgdef *m)
static uint64_t jsondec_strtouint64(jsondec *d, upb_strview str)
upb_value upb_strtable_iter_value(const upb_strtable_iter *i)
UPB_INLINE upb_array * _upb_array_new(upb_arena *a, size_t init_size, int elem_size_lg2)
static int jsondec_nanos(jsondec *d, const char **ptr, const char *end)
void upb_array_set(upb_array *arr, size_t i, upb_msgval val)
struct google_protobuf_FileOptions google_protobuf_FileOptions
static void jsonenc_any(jsonenc *e, const upb_msg *msg, const upb_msgdef *m)
void _upb_msg_discardunknown_shallow(upb_msg *msg)
static size_t jsondec_unicode(jsondec *d, char *out)
static size_t next(const upb_table *t, size_t i)
struct google_protobuf_MessageOptions google_protobuf_MessageOptions
static const upb_msglayout_field google_protobuf_MessageOptions__fields[5]
static bool upb_isalphanum(char c)
static void symtab_add(symtab_addctx *ctx, const char *name, upb_value v)
upb_fieldtype_t upb_fielddef_type(const upb_fielddef *f)
static void jsonenc_fieldval(jsonenc *e, const upb_fielddef *f, upb_msgval val, bool *first)
static void jsonenc_string(jsonenc *e, upb_strview str)
static int log2ceil(uint64_t v)
UPB_INLINE size_t upb_table_size(const upb_table *t)
if(p->owned &&p->wrapped !=NULL)
UPB_INLINE uint32_t * _upb_oneofcase_field(upb_msg *msg, const upb_msglayout_field *f)
std::allocator< int > alloc
static char _upb_fieldtype_to_mapsize[12]
const upb_msglayout google_protobuf_GeneratedCodeInfo_Annotation_msginit
UPB_INLINE size_t upb_strtable_count(const upb_strtable *t)
static const char * jsondec_buftouint64(jsondec *d, const char *ptr, const char *end, uint64_t *val)
bool upb_strtable_iter_isequal(const upb_strtable_iter *i1, const upb_strtable_iter *i2)
static void finalize_oneofs(symtab_addctx *ctx, upb_msgdef *m)
static int jsondec_rawpeek(jsondec *d)
static const upb_msglayout_field * upb_find_field(const upb_msglayout *l, uint32_t field_number, int *last_field_index)
void _upb_msg_clear(upb_msg *msg, const upb_msglayout *l)
double upb_fielddef_defaultdouble(const upb_fielddef *f)
static uint64_t UnalignedLoad64(const void *p)
@ UPB_WELLKNOWN_LISTVALUE
static struct rpc_state state
static void arena_dofree(upb_arena *a)
static UPB_FORCEINLINE void encode_reserve(upb_encstate *e, size_t bytes)
struct upb_arena * parent
upb_symtab * upb_symtab_new(void)
static upb_tabent * getentry_mutable(upb_table *t, uint32_t hash)
bool upb_arena_fuse(upb_arena *a1, upb_arena *a2)
static bool upb_isletter(char c)
struct cleanup_ent cleanup_ent
void upb_symtab_free(upb_symtab *s)
static void jsondec_push(jsondec *d)
int upb_msgdef_fieldcount(const upb_msgdef *m)
static size_t begin(const upb_table *t)
UPB_INLINE void * upb_arena_realloc(upb_arena *a, void *ptr, size_t oldsize, size_t size)
bool _upb_array_append_fallback(upb_array **arr_ptr, const void *value, int elem_size_lg2, upb_arena *arena)
const upb_symtab * symtab
upb_syntax_t upb_filedef_syntax(const upb_filedef *f)
static upb_msg * decode_newsubmsg(upb_decstate *d, upb_msglayout const *const *submsgs, const upb_msglayout_field *field)
void upb_strtable_next(upb_strtable_iter *i)
const upb_oneofdef * oneof
static upb_msgval jsondec_enum(jsondec *d, const upb_fielddef *f)
grpc
Author(s):
autogenerated on Thu Mar 13 2025 03:01:13