Classes | Macros | Functions | Variables
decode.c File Reference
#include "upb/decode.h"
#include <setjmp.h>
#include <string.h>
#include "upb/decode_internal.h"
#include "upb/upb.h"
#include "upb/upb_internal.h"
#include "upb/port_def.inc"
Include dependency graph for decode.c:

Go to the source code of this file.

Classes

struct  decode_vret
 
union  wireval
 

Macros

#define OP_BYTES   5
 
#define OP_ENUM   1
 
#define OP_FIXPCK_LG2(n)   (n + 5) /* n in [2, 3] => op in [7, 8] */
 
#define OP_MSGSET_ITEM   -2
 
#define OP_MSGSET_TYPEID   -3
 
#define OP_PACKED_ENUM   13
 
#define OP_SCALAR_LG2(n)   (n) /* n in [0, 2, 3] => op in [0, 2, 3] */
 
#define OP_STRING   4
 
#define OP_SUBMSG   6
 
#define OP_UNKNOWN   -1 /* Unknown field. */
 
#define OP_VARPCK_LG2(n)   (n + 9) /* n in [0, 2, 3] => op in [9, 11, 12] */
 
#define TYPE_COUNT   20
 
#define TYPE_MSGSET_ITEM   19
 
#define TYPE_MSGSET_TYPE_ID   20
 

Functions

static UPB_FORCEINLINE bool decode_checkenum (upb_Decoder *d, const char *ptr, upb_Message *msg, const upb_MiniTable_Enum *e, const upb_MiniTable_Field *field, wireval *val)
 
static UPB_NOINLINE bool decode_checkenum_slow (upb_Decoder *d, const char *ptr, upb_Message *msg, const upb_MiniTable_Enum *e, const upb_MiniTable_Field *field, uint32_t v)
 
const UPB_NOINLINE char * decode_checkrequired (upb_Decoder *d, const char *ptr, const upb_Message *msg, const upb_MiniTable *l)
 
static const UPB_NOINLINE char * decode_enum_packed (upb_Decoder *d, const char *ptr, upb_Message *msg, upb_Array *arr, const upb_MiniTable_Sub *subs, const upb_MiniTable_Field *field, wireval *val)
 
static const UPB_NOINLINE char * decode_enum_toarray (upb_Decoder *d, const char *ptr, upb_Message *msg, upb_Array *arr, const upb_MiniTable_Sub *subs, const upb_MiniTable_Field *field, wireval *val)
 
static UPB_NORETURN void * decode_err (upb_Decoder *d, upb_DecodeStatus status)
 
static const upb_MiniTable_Fielddecode_findfield (upb_Decoder *d, const upb_MiniTable *l, uint32_t field_number, int *last_field_index)
 
static const UPB_FORCEINLINE char * decode_fixed_packed (upb_Decoder *d, const char *ptr, upb_Array *arr, wireval *val, const upb_MiniTable_Field *field, int lg2)
 
static const UPB_FORCEINLINE char * decode_group (upb_Decoder *d, const char *ptr, upb_Message *submsg, const upb_MiniTable *subl, uint32_t number)
 
const UPB_NOINLINE char * decode_isdonefallback (upb_Decoder *d, const char *ptr, int overrun)
 
static const UPB_FORCEINLINE char * decode_known (upb_Decoder *d, const char *ptr, upb_Message *msg, const upb_MiniTable *layout, const upb_MiniTable_Field *field, int op, wireval *val)
 
static UPB_NOINLINE decode_vret decode_longvarint64 (const char *ptr, uint64_t val)
 
static const char * decode_msg (upb_Decoder *d, const char *ptr, upb_Message *msg, const upb_MiniTable *layout)
 
static const char * decode_msgset (upb_Decoder *d, const char *ptr, upb_Message *msg, const upb_MiniTable *layout)
 
static void decode_munge (int type, wireval *val)
 
static void decode_munge_int32 (wireval *val)
 
static upb_Messagedecode_newsubmsg (upb_Decoder *d, const upb_MiniTable_Sub *subs, const upb_MiniTable_Field *field)
 
static const char * decode_readstr (upb_Decoder *d, const char *ptr, int size, upb_StringView *str)
 
static bool decode_reserve (upb_Decoder *d, upb_Array *arr, size_t elem)
 
static const char * decode_reverse_skip_varint (const char *ptr, uint32_t val)
 
static const UPB_FORCEINLINE char * decode_tag (upb_Decoder *d, const char *ptr, uint32_t *val)
 
static const char * decode_toarray (upb_Decoder *d, const char *ptr, upb_Message *msg, const upb_MiniTable_Sub *subs, const upb_MiniTable_Field *field, wireval *val, int op)
 
static const UPB_FORCEINLINE char * decode_togroup (upb_Decoder *d, const char *ptr, upb_Message *submsg, const upb_MiniTable_Sub *subs, const upb_MiniTable_Field *field)
 
static const char * decode_tomap (upb_Decoder *d, const char *ptr, upb_Message *msg, const upb_MiniTable_Sub *subs, const upb_MiniTable_Field *field, wireval *val)
 
static const char * decode_tomsg (upb_Decoder *d, const char *ptr, upb_Message *msg, const upb_MiniTable_Sub *subs, const upb_MiniTable_Field *field, wireval *val, int op)
 
static upb_DecodeStatus decode_top (struct upb_Decoder *d, const char *buf, void *msg, const upb_MiniTable *l)
 
static const UPB_FORCEINLINE char * decode_tosubmsg (upb_Decoder *d, const char *ptr, upb_Message *submsg, const upb_MiniTable_Sub *subs, const upb_MiniTable_Field *field, int size)
 
static const UPB_FORCEINLINE char * decode_tosubmsg2 (upb_Decoder *d, const char *ptr, upb_Message *submsg, const upb_MiniTable *subl, int size)
 
static UPB_FORCEINLINE bool decode_tryfastdispatch (upb_Decoder *d, const char **ptr, upb_Message *msg, const upb_MiniTable *layout)
 
static const char * decode_unknown (upb_Decoder *d, const char *ptr, upb_Message *msg, int field_number, int wire_type, wireval val)
 
static const UPB_FORCEINLINE char * decode_varint64 (upb_Decoder *d, const char *ptr, uint64_t *val)
 
static const UPB_FORCEINLINE char * decode_varint_packed (upb_Decoder *d, const char *ptr, upb_Array *arr, wireval *val, const upb_MiniTable_Field *field, int lg2)
 
static void decode_verifyutf8 (upb_Decoder *d, const char *buf, int len)
 
static const UPB_FORCEINLINE char * decode_wireval (upb_Decoder *d, const char *ptr, const upb_MiniTable_Field *field, int wire_type, wireval *val, int *op)
 
static char * encode_varint32 (uint32_t val, char *ptr)
 
const char * fastdecode_err (upb_Decoder *d, int status)
 
const char * fastdecode_generic (struct upb_Decoder *d, const char *ptr, upb_Message *msg, intptr_t table, uint64_t hasbits, uint64_t data)
 
upb_DecodeStatus upb_Decode (const char *buf, size_t size, void *msg, const upb_MiniTable *l, const upb_ExtensionRegistry *extreg, int options, upb_Arena *arena)
 
static void upb_Decode_AddUnknownVarints (upb_Decoder *d, upb_Message *msg, uint32_t val1, uint32_t val2)
 

Variables

static const int8_t delim_ops []
 
static const uint8_t desctype_to_elem_size_lg2 []
 
static const uint8_t desctype_to_mapsize []
 
static const unsigned FIXED32_OK_MASK
 
static const unsigned FIXED64_OK_MASK
 
static const int8_t varint_ops []
 

Macro Definition Documentation

◆ OP_BYTES

#define OP_BYTES   5

Definition at line 106 of file decode.c.

◆ OP_ENUM

#define OP_ENUM   1

Definition at line 104 of file decode.c.

◆ OP_FIXPCK_LG2

#define OP_FIXPCK_LG2 (   n)    (n + 5) /* n in [2, 3] => op in [7, 8] */

Definition at line 109 of file decode.c.

◆ OP_MSGSET_ITEM

#define OP_MSGSET_ITEM   -2

Definition at line 101 of file decode.c.

◆ OP_MSGSET_TYPEID

#define OP_MSGSET_TYPEID   -3

Definition at line 102 of file decode.c.

◆ OP_PACKED_ENUM

#define OP_PACKED_ENUM   13

Definition at line 111 of file decode.c.

◆ OP_SCALAR_LG2

#define OP_SCALAR_LG2 (   n)    (n) /* n in [0, 2, 3] => op in [0, 2, 3] */

Definition at line 103 of file decode.c.

◆ OP_STRING

#define OP_STRING   4

Definition at line 105 of file decode.c.

◆ OP_SUBMSG

#define OP_SUBMSG   6

Definition at line 107 of file decode.c.

◆ OP_UNKNOWN

#define OP_UNKNOWN   -1 /* Unknown field. */

Definition at line 100 of file decode.c.

◆ OP_VARPCK_LG2

#define OP_VARPCK_LG2 (   n)    (n + 9) /* n in [0, 2, 3] => op in [9, 11, 12] */

Definition at line 110 of file decode.c.

◆ TYPE_COUNT

#define TYPE_COUNT   20

Definition at line 97 of file decode.c.

◆ TYPE_MSGSET_ITEM

#define TYPE_MSGSET_ITEM   19

Definition at line 95 of file decode.c.

◆ TYPE_MSGSET_TYPE_ID

#define TYPE_MSGSET_TYPE_ID   20

Definition at line 96 of file decode.c.

Function Documentation

◆ decode_checkenum()

static UPB_FORCEINLINE bool decode_checkenum ( upb_Decoder d,
const char *  ptr,
upb_Message msg,
const upb_MiniTable_Enum e,
const upb_MiniTable_Field field,
wireval val 
)
static

Definition at line 420 of file decode.c.

◆ decode_checkenum_slow()

static UPB_NOINLINE bool decode_checkenum_slow ( upb_Decoder d,
const char *  ptr,
upb_Message msg,
const upb_MiniTable_Enum e,
const upb_MiniTable_Field field,
uint32_t  v 
)
static

Definition at line 401 of file decode.c.

◆ decode_checkrequired()

const UPB_NOINLINE char* decode_checkrequired ( upb_Decoder d,
const char *  ptr,
const upb_Message msg,
const upb_MiniTable l 
)

Definition at line 715 of file decode.c.

◆ decode_enum_packed()

static const UPB_NOINLINE char* decode_enum_packed ( upb_Decoder d,
const char *  ptr,
upb_Message msg,
upb_Array arr,
const upb_MiniTable_Sub subs,
const upb_MiniTable_Field field,
wireval val 
)
static

Definition at line 511 of file decode.c.

◆ decode_enum_toarray()

static const UPB_NOINLINE char* decode_enum_toarray ( upb_Decoder d,
const char *  ptr,
upb_Message msg,
upb_Array arr,
const upb_MiniTable_Sub subs,
const upb_MiniTable_Field field,
wireval val 
)
static

Definition at line 431 of file decode.c.

◆ decode_err()

static UPB_NORETURN void* decode_err ( upb_Decoder d,
upb_DecodeStatus  status 
)
static

Definition at line 192 of file decode.c.

◆ decode_findfield()

static const upb_MiniTable_Field* decode_findfield ( upb_Decoder d,
const upb_MiniTable l,
uint32_t  field_number,
int last_field_index 
)
static

Definition at line 767 of file decode.c.

◆ decode_fixed_packed()

static const UPB_FORCEINLINE char* decode_fixed_packed ( upb_Decoder d,
const char *  ptr,
upb_Array arr,
wireval val,
const upb_MiniTable_Field field,
int  lg2 
)
static

Definition at line 445 of file decode.c.

◆ decode_group()

static const UPB_FORCEINLINE char* decode_group ( upb_Decoder d,
const char *  ptr,
upb_Message submsg,
const upb_MiniTable subl,
uint32_t  number 
)
static

Definition at line 355 of file decode.c.

◆ decode_isdonefallback()

const UPB_NOINLINE char* decode_isdonefallback ( upb_Decoder d,
const char *  ptr,
int  overrun 
)

Definition at line 307 of file decode.c.

◆ decode_known()

static const UPB_FORCEINLINE char* decode_known ( upb_Decoder d,
const char *  ptr,
upb_Message msg,
const upb_MiniTable layout,
const upb_MiniTable_Field field,
int  op,
wireval val 
)
static

Definition at line 897 of file decode.c.

◆ decode_longvarint64()

static UPB_NOINLINE decode_vret decode_longvarint64 ( const char *  ptr,
uint64_t  val 
)
static

Definition at line 221 of file decode.c.

◆ decode_msg()

static const UPB_NOINLINE char * decode_msg ( upb_Decoder d,
const char *  ptr,
upb_Message msg,
const upb_MiniTable layout 
)
static

Definition at line 988 of file decode.c.

◆ decode_msgset()

static const char* decode_msgset ( upb_Decoder d,
const char *  ptr,
upb_Message msg,
const upb_MiniTable layout 
)
static

Definition at line 746 of file decode.c.

◆ decode_munge()

static void decode_munge ( int  type,
wireval val 
)
static

Definition at line 276 of file decode.c.

◆ decode_munge_int32()

static void decode_munge_int32 ( wireval val)
static

Definition at line 269 of file decode.c.

◆ decode_newsubmsg()

static upb_Message* decode_newsubmsg ( upb_Decoder d,
const upb_MiniTable_Sub subs,
const upb_MiniTable_Field field 
)
static

Definition at line 299 of file decode.c.

◆ decode_readstr()

static const char* decode_readstr ( upb_Decoder d,
const char *  ptr,
int  size,
upb_StringView str 
)
static

Definition at line 317 of file decode.c.

◆ decode_reserve()

static bool decode_reserve ( upb_Decoder d,
upb_Array arr,
size_t  elem 
)
static

Definition at line 207 of file decode.c.

◆ decode_reverse_skip_varint()

static const char* decode_reverse_skip_varint ( const char *  ptr,
uint32_t  val 
)
static

Definition at line 926 of file decode.c.

◆ decode_tag()

static const UPB_FORCEINLINE char* decode_tag ( upb_Decoder d,
const char *  ptr,
uint32_t val 
)
static

Definition at line 253 of file decode.c.

◆ decode_toarray()

static const char* decode_toarray ( upb_Decoder d,
const char *  ptr,
upb_Message msg,
const upb_MiniTable_Sub subs,
const upb_MiniTable_Field field,
wireval val,
int  op 
)
static

Definition at line 537 of file decode.c.

◆ decode_togroup()

static const UPB_FORCEINLINE char* decode_togroup ( upb_Decoder d,
const char *  ptr,
upb_Message submsg,
const upb_MiniTable_Sub subs,
const upb_MiniTable_Field field 
)
static

Definition at line 370 of file decode.c.

◆ decode_tomap()

static const char* decode_tomap ( upb_Decoder d,
const char *  ptr,
upb_Message msg,
const upb_MiniTable_Sub subs,
const upb_MiniTable_Field field,
wireval val 
)
static

Definition at line 603 of file decode.c.

◆ decode_tomsg()

static const char* decode_tomsg ( upb_Decoder d,
const char *  ptr,
upb_Message msg,
const upb_MiniTable_Sub subs,
const upb_MiniTable_Field field,
wireval val,
int  op 
)
static

Definition at line 651 of file decode.c.

◆ decode_top()

static upb_DecodeStatus decode_top ( struct upb_Decoder d,
const char *  buf,
void *  msg,
const upb_MiniTable l 
)
static

Definition at line 1066 of file decode.c.

◆ decode_tosubmsg()

static const UPB_FORCEINLINE char* decode_tosubmsg ( upb_Decoder d,
const char *  ptr,
upb_Message submsg,
const upb_MiniTable_Sub subs,
const upb_MiniTable_Field field,
int  size 
)
static

Definition at line 346 of file decode.c.

◆ decode_tosubmsg2()

static const UPB_FORCEINLINE char* decode_tosubmsg2 ( upb_Decoder d,
const char *  ptr,
upb_Message submsg,
const upb_MiniTable subl,
int  size 
)
static

Definition at line 332 of file decode.c.

◆ decode_tryfastdispatch()

static UPB_FORCEINLINE bool decode_tryfastdispatch ( upb_Decoder d,
const char **  ptr,
upb_Message msg,
const upb_MiniTable layout 
)
static

Definition at line 732 of file decode.c.

◆ decode_unknown()

static const char* decode_unknown ( upb_Decoder d,
const char *  ptr,
upb_Message msg,
int  field_number,
int  wire_type,
wireval  val 
)
static

Definition at line 936 of file decode.c.

◆ decode_varint64()

static const UPB_FORCEINLINE char* decode_varint64 ( upb_Decoder d,
const char *  ptr,
uint64_t val 
)
static

Definition at line 238 of file decode.c.

◆ decode_varint_packed()

static const UPB_FORCEINLINE char* decode_varint_packed ( upb_Decoder d,
const char *  ptr,
upb_Array arr,
wireval val,
const upb_MiniTable_Field field,
int  lg2 
)
static

Definition at line 488 of file decode.c.

◆ decode_verifyutf8()

static void decode_verifyutf8 ( upb_Decoder d,
const char *  buf,
int  len 
)
static

Definition at line 202 of file decode.c.

◆ decode_wireval()

static const UPB_FORCEINLINE char* decode_wireval ( upb_Decoder d,
const char *  ptr,
const upb_MiniTable_Field field,
int  wire_type,
wireval val,
int op 
)
static

Definition at line 843 of file decode.c.

◆ encode_varint32()

static char* encode_varint32 ( uint32_t  val,
char *  ptr 
)
static

Definition at line 378 of file decode.c.

◆ fastdecode_err()

const char* fastdecode_err ( upb_Decoder d,
int  status 
)

Definition at line 197 of file decode.c.

◆ fastdecode_generic()

const char* fastdecode_generic ( struct upb_Decoder d,
const char *  ptr,
upb_Message msg,
intptr_t  table,
uint64_t  hasbits,
uint64_t  data 
)

Definition at line 1058 of file decode.c.

◆ upb_Decode()

upb_DecodeStatus upb_Decode ( const char *  buf,
size_t  size,
void *  msg,
const upb_MiniTable l,
const upb_ExtensionRegistry extreg,
int  options,
upb_Arena arena 
)

Definition at line 1076 of file decode.c.

◆ upb_Decode_AddUnknownVarints()

static void upb_Decode_AddUnknownVarints ( upb_Decoder d,
upb_Message msg,
uint32_t  val1,
uint32_t  val2 
)
static

Definition at line 388 of file decode.c.

Variable Documentation

◆ delim_ops

const int8_t delim_ops[]
static

Definition at line 137 of file decode.c.

◆ desctype_to_elem_size_lg2

const uint8_t desctype_to_elem_size_lg2[]
static
Initial value:
= {
-1,
3,
2,
3,
3,
2,
3,
2,
0,
UPB_SIZE(3, 4),
UPB_SIZE(2, 3),
UPB_SIZE(2, 3),
UPB_SIZE(3, 4),
2,
2,
2,
3,
2,
3,
}

Definition at line 41 of file decode.c.

◆ desctype_to_mapsize

const uint8_t desctype_to_mapsize[]
static
Initial value:
= {
-1,
8,
4,
8,
8,
4,
8,
4,
1,
sizeof(void*),
sizeof(void*),
4,
4,
4,
8,
4,
8,
}

Definition at line 64 of file decode.c.

◆ FIXED32_OK_MASK

const unsigned FIXED32_OK_MASK
static
Initial value:

Definition at line 86 of file decode.c.

◆ FIXED64_OK_MASK

const unsigned FIXED64_OK_MASK
static
Initial value:

Definition at line 90 of file decode.c.

◆ varint_ops

const int8_t varint_ops[]
static
kUpb_FieldType_SFixed64
@ kUpb_FieldType_SFixed64
Definition: upb/upb/upb.h:324
OP_MSGSET_TYPEID
#define OP_MSGSET_TYPEID
Definition: decode.c:102
OP_ENUM
#define OP_ENUM
Definition: decode.c:104
kUpb_FieldType_SFixed32
@ kUpb_FieldType_SFixed32
Definition: upb/upb/upb.h:323
kUpb_FieldType_Double
@ kUpb_FieldType_Double
Definition: upb/upb/upb.h:309
kUpb_FieldType_Float
@ kUpb_FieldType_Float
Definition: upb/upb/upb.h:310
OP_UNKNOWN
#define OP_UNKNOWN
Definition: decode.c:100
UPB_SIZE
#define UPB_SIZE(size32, size64)
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.c:32
kUpb_FieldType_Fixed32
@ kUpb_FieldType_Fixed32
Definition: upb/upb/upb.h:315
kUpb_FieldType_Fixed64
@ kUpb_FieldType_Fixed64
Definition: upb/upb/upb.h:314
UPB_MAPTYPE_STRING
#define UPB_MAPTYPE_STRING
Definition: php-upb.c:82
OP_SCALAR_LG2
#define OP_SCALAR_LG2(n)
Definition: decode.c:103


grpc
Author(s):
autogenerated on Fri May 16 2025 03:01:09