Go to the documentation of this file.
39 #include "upb/port_def.inc"
41 #define UPB_PB_VARINT_MAX_LEN 10
49 if (val)
byte |= 0x80U;
94 e->ptr = new_buf +
new_size - (e->limit - e->ptr);
105 if ((
size_t)(e->ptr - e->buf) <
bytes) {
115 if (
len == 0)
return;
144 if (val < 128 && e->
ptr != e->buf) {
173 size_t bytes = arr->
len * elem_size;
179 if (elem_size == 4) {
207 const char* field_mem = _field_mem;
210 #define CASE(ctype, type, wtype, encodeval) \
212 ctype val = *(ctype*)field_mem; \
213 encode_##type(e, encodeval); \
218 switch (
f->descriptortype) {
253 void* submsg = *(
void**)field_mem;
255 if (submsg == NULL) {
267 void* submsg = *(
void**)field_mem;
269 if (submsg == NULL) {
292 size_t pre_len = e->limit - e->ptr;
294 if (arr == NULL || arr->
len == 0) {
298 #define VARINT_CASE(ctype, encode) \
300 const ctype* start = _upb_array_constptr(arr); \
301 const ctype* ptr = start + arr->len; \
302 uint32_t tag = packed ? 0 : (f->number << 3) | kUpb_WireType_Varint; \
305 encode_varint(e, encode); \
306 if (tag) encode_varint(e, tag); \
307 } while (ptr != start); \
311 #define TAG(wire_type) (packed ? 0 : (f->number << 3 | wire_type))
313 switch (
f->descriptortype) {
398 size_t pre_len = e->limit - e->ptr;
402 size = (e->limit - e->ptr) - pre_len;
414 if (
map == NULL)
return;
442 if (
f->presence == 0) {
451 #if UINTPTR_MAX == 0xffffffff
459 #if UINTPTR_MAX != 0xffffffff
469 return str->size != 0;
474 }
else if (
f->presence > 0) {
521 size_t pre_len = e->limit - e->ptr;
559 if (
m->field_count) {
570 *
size = (e->limit - e->ptr) - pre_len;
592 *
size = e.limit - e.ptr;
UPB_INLINE uint64_t upb_MiniTable_requiredmask(const upb_MiniTable *l)
@ kUpb_WireType_Delimited
@ kUpb_FieldType_SFixed64
static void encode_field(upb_encstate *e, const upb_Message *msg, const upb_MiniTable_Sub *subs, const upb_MiniTable_Field *field)
bool upb_strtable_done(const upb_strtable_iter *i)
static UPB_NOINLINE void encode_longvarint(upb_encstate *e, uint64_t val)
static void encode_map(upb_encstate *e, const upb_Message *msg, const upb_MiniTable_Sub *subs, const upb_MiniTable_Field *f)
static void encode_fixedarray(upb_encstate *e, const upb_Array *arr, size_t elem_size, uint32_t tag)
@ kUpb_Encode_Deterministic
@ kUpb_Encode_CheckRequired
@ kUpb_Encode_SkipUnknown
static bool encode_shouldencode(upb_encstate *e, const upb_Message *msg, const upb_MiniTable_Sub *subs, const upb_MiniTable_Field *f)
@ kUpb_LabelFlags_IsPacked
static void encode_mapentry(upb_encstate *e, uint32_t number, const upb_MiniTable *layout, const upb_MapEntry *ent)
static void encode_fixed64(upb_encstate *e, uint64_t val)
const char * upb_Message_GetUnknown(const upb_Message *msg, size_t *len)
#define UPB_UNREACHABLE()
@ kUpb_FieldType_SFixed32
static UPB_NOINLINE void encode_growbuffer(upb_encstate *e, size_t bytes)
static void encode_array(upb_encstate *e, const upb_Message *msg, const upb_MiniTable_Sub *subs, const upb_MiniTable_Field *f)
static uint32_t encode_zz32(int32_t n)
bool _upb_mapsorter_pushmap(_upb_mapsorter *s, upb_descriptortype_t key_type, const upb_map *map, _upb_sortedmap *sorted)
#define UPB_PTR_AT(msg, ofs, type)
UPB_INLINE uint32_t _upb_getoneofcase_field(const upb_msg *msg, const upb_msglayout_field *f)
const char * upb_strtable_iter_key(const upb_strtable_iter *i)
grpc_core::ScopedArenaPtr arena
union upb_MapEntry::@708 k
@ kUpb_ExtMode_NonExtendable
memcpy(mem, inblock.get(), min(CONTAINING_RECORD(inblock.get(), MEMBLOCK, data) ->size, size))
const upb_Message_Extension * _upb_Message_Getexts(const upb_Message *msg, size_t *count)
void upb_strtable_begin(upb_strtable_iter *i, const upb_strtable *t)
static UPB_NOINLINE size_t encode_varint64(uint64_t val, char *buf)
UPB_INLINE void * upb_realloc(upb_alloc *alloc, void *ptr, size_t oldsize, size_t size)
static void * tag(intptr_t t)
static UPB_FORCEINLINE void encode_varint(upb_encstate *e, uint64_t val)
UPB_INLINE void _upb_map_fromvalue(upb_value val, void *out, size_t size)
unsigned __int64 uint64_t
union upb_MapEntry::@709 v
UPB_INLINE upb_FieldMode upb_FieldMode_Get(const upb_MiniTable_Field *field)
static void encode_float(upb_encstate *e, float d)
static void encode_msgset_item(upb_encstate *e, const upb_Message_Extension *ext)
static void encode_scalar(upb_encstate *e, const void *_field_mem, const upb_MiniTable_Sub *subs, const upb_MiniTable_Field *f)
void upb_strtable_next(upb_strtable_iter *i)
UPB_INLINE uint64_t _upb_BigEndian_Swap64(uint64_t val)
UPB_INLINE bool _upb_IsLittleEndian(void)
UPB_INLINE bool _upb_sortedmap_next(_upb_mapsorter *s, const upb_map *map, _upb_sortedmap *sorted, upb_map_entry *ent)
UPB_INLINE void _upb_mapsorter_popmap(_upb_mapsorter *s, _upb_sortedmap *sorted)
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 void encode_tag(upb_encstate *e, uint32_t field_number, uint8_t wire_type)
UPB_INLINE upb_alloc * upb_Arena_Alloc(upb_Arena *a)
static uint64_t encode_zz64(int64_t n)
char * upb_Encode(const void *msg, const upb_MiniTable *l, int options, upb_Arena *arena, size_t *size)
const FieldDescriptor * field
UPB_INLINE void _upb_mapsorter_init(_upb_mapsorter *s)
#define CASE(ctype, type, wtype, encodeval)
static void encode_bytes(upb_encstate *e, const void *data, size_t len)
UniquePtr< SSL_SESSION > ret
static void encode_message(upb_encstate *e, const upb_Message *msg, const upb_MiniTable *m, size_t *size)
@ kUpb_ExtMode_IsMessageSet
#define VARINT_CASE(ctype, encode)
static void encode_fixed32(upb_encstate *e, uint32_t val)
static UPB_NORETURN void encode_err(upb_encstate *e)
upb_value upb_strtable_iter_value(const upb_strtable_iter *i)
#define UPB_PB_VARINT_MAX_LEN
UPB_INLINE uint32_t _upb_BigEndian_Swap32(uint32_t val)
const UPB_INLINE void * _upb_array_constptr(const upb_array *arr)
static void encode_double(upb_encstate *e, double d)
static UPB_FORCEINLINE void encode_reserve(upb_encstate *e, size_t bytes)
@ kUpb_FieldRep_StringView
UPB_INLINE void _upb_map_fromkey(upb_strview key, void *out, size_t size)
std::allocator< int > alloc
static size_t upb_roundup_pow2(size_t bytes)
#define UPB_LONGJMP(buf, val)
@ kUpb_WireType_StartGroup
grpc
Author(s):
autogenerated on Thu Mar 13 2025 02:59:15