|
|
|
@ -7619,19 +7619,23 @@ static upb_DecodeStatus upb_Decoder_Decode(upb_Decoder* const decoder, |
|
|
|
|
return decoder->status; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
uint16_t upb_DecodeOptions_GetEffectiveMaxDepth(uint32_t options) { |
|
|
|
|
uint16_t max_depth = upb_DecodeOptions_GetMaxDepth(options); |
|
|
|
|
return max_depth ? max_depth : kUpb_WireFormat_DefaultDepthLimit; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
upb_DecodeStatus upb_Decode(const char* buf, size_t size, upb_Message* msg, |
|
|
|
|
const upb_MiniTable* mt, |
|
|
|
|
const upb_ExtensionRegistry* extreg, int options, |
|
|
|
|
upb_Arena* arena) { |
|
|
|
|
UPB_ASSERT(!upb_Message_IsFrozen(msg)); |
|
|
|
|
upb_Decoder decoder; |
|
|
|
|
unsigned depth = (unsigned)options >> 16; |
|
|
|
|
|
|
|
|
|
upb_EpsCopyInputStream_Init(&decoder.input, &buf, size, |
|
|
|
|
options & kUpb_DecodeOption_AliasString); |
|
|
|
|
|
|
|
|
|
decoder.extreg = extreg; |
|
|
|
|
decoder.depth = depth ? depth : kUpb_WireFormat_DefaultDepthLimit; |
|
|
|
|
decoder.depth = upb_DecodeOptions_GetEffectiveMaxDepth(options); |
|
|
|
|
decoder.end_group = DECODE_NOGROUP; |
|
|
|
|
decoder.options = (uint16_t)options; |
|
|
|
|
decoder.missing_required = false; |
|
|
|
@ -8341,19 +8345,23 @@ static upb_EncodeStatus upb_Encoder_Encode(upb_encstate* const encoder, |
|
|
|
|
return encoder->status; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
uint16_t upb_EncodeOptions_GetEffectiveMaxDepth(uint32_t options) { |
|
|
|
|
uint16_t max_depth = upb_EncodeOptions_GetMaxDepth(options); |
|
|
|
|
return max_depth ? max_depth : kUpb_WireFormat_DefaultDepthLimit; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static upb_EncodeStatus _upb_Encode(const upb_Message* msg, |
|
|
|
|
const upb_MiniTable* l, int options, |
|
|
|
|
upb_Arena* arena, char** buf, size_t* size, |
|
|
|
|
bool prepend_len) { |
|
|
|
|
upb_encstate e; |
|
|
|
|
unsigned depth = (unsigned)options >> 16; |
|
|
|
|
|
|
|
|
|
e.status = kUpb_EncodeStatus_Ok; |
|
|
|
|
e.arena = arena; |
|
|
|
|
e.buf = NULL; |
|
|
|
|
e.limit = NULL; |
|
|
|
|
e.ptr = NULL; |
|
|
|
|
e.depth = depth ? depth : kUpb_WireFormat_DefaultDepthLimit; |
|
|
|
|
e.depth = upb_EncodeOptions_GetEffectiveMaxDepth(options); |
|
|
|
|
e.options = options; |
|
|
|
|
_upb_mapsorter_init(&e.sorter); |
|
|
|
|
|
|
|
|
|