|
|
|
@ -376,18 +376,6 @@ static char* upb_Decoder_EncodeVarint32(uint32_t val, char* ptr) { |
|
|
|
|
return ptr; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void _upb_Decoder_AddUnknownVarints(upb_Decoder* d, upb_Message* msg, |
|
|
|
|
uint32_t val1, uint32_t val2) { |
|
|
|
|
char buf[20]; |
|
|
|
|
char* end = buf; |
|
|
|
|
end = upb_Decoder_EncodeVarint32(val1, end); |
|
|
|
|
end = upb_Decoder_EncodeVarint32(val2, end); |
|
|
|
|
|
|
|
|
|
if (!UPB_PRIVATE(_upb_Message_AddUnknown)(msg, buf, end - buf, &d->arena)) { |
|
|
|
|
_upb_Decoder_ErrorJmp(d, kUpb_DecodeStatus_OutOfMemory); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
UPB_FORCEINLINE |
|
|
|
|
bool _upb_Decoder_CheckEnum(upb_Decoder* d, const char* ptr, upb_Message* msg, |
|
|
|
|
const upb_MiniTableEnum* e, |
|
|
|
@ -404,7 +392,15 @@ bool _upb_Decoder_CheckEnum(upb_Decoder* d, const char* ptr, upb_Message* msg, |
|
|
|
|
upb_Message* unknown_msg = |
|
|
|
|
field->UPB_PRIVATE(mode) & kUpb_LabelFlags_IsExtension ? d->unknown_msg |
|
|
|
|
: msg; |
|
|
|
|
_upb_Decoder_AddUnknownVarints(d, unknown_msg, tag, v); |
|
|
|
|
char buf[20]; |
|
|
|
|
char* end = buf; |
|
|
|
|
end = upb_Decoder_EncodeVarint32(tag, end); |
|
|
|
|
end = upb_Decoder_EncodeVarint32(v, end); |
|
|
|
|
|
|
|
|
|
if (!UPB_PRIVATE(_upb_Message_AddUnknown)(unknown_msg, buf, end - buf, |
|
|
|
|
&d->arena)) { |
|
|
|
|
_upb_Decoder_ErrorJmp(d, kUpb_DecodeStatus_OutOfMemory); |
|
|
|
|
} |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -675,8 +671,16 @@ static const char* _upb_Decoder_DecodeToMap( |
|
|
|
|
if (status != kUpb_EncodeStatus_Ok) { |
|
|
|
|
_upb_Decoder_ErrorJmp(d, kUpb_DecodeStatus_OutOfMemory); |
|
|
|
|
} |
|
|
|
|
_upb_Decoder_AddUnknownVarints(d, msg, tag, size); |
|
|
|
|
if (!UPB_PRIVATE(_upb_Message_AddUnknown)(msg, buf, size, &d->arena)) { |
|
|
|
|
char delim_buf[20]; |
|
|
|
|
char* delim_end = delim_buf; |
|
|
|
|
delim_end = upb_Decoder_EncodeVarint32(tag, delim_end); |
|
|
|
|
delim_end = upb_Decoder_EncodeVarint32(size, delim_end); |
|
|
|
|
upb_StringView unknown[] = { |
|
|
|
|
{delim_buf, delim_end - delim_buf}, |
|
|
|
|
{buf, size}, |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
if (!UPB_PRIVATE(_upb_Message_AddUnknownV)(msg, &d->arena, unknown, 2)) { |
|
|
|
|
_upb_Decoder_ErrorJmp(d, kUpb_DecodeStatus_OutOfMemory); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
@ -846,12 +850,12 @@ static void upb_Decoder_AddUnknownMessageSetItem(upb_Decoder* d, |
|
|
|
|
|
|
|
|
|
ptr = upb_Decoder_EncodeVarint32(kEndItemTag, ptr); |
|
|
|
|
char* end = ptr; |
|
|
|
|
|
|
|
|
|
if (!UPB_PRIVATE(_upb_Message_AddUnknown)(msg, buf, split - buf, &d->arena) || |
|
|
|
|
!UPB_PRIVATE(_upb_Message_AddUnknown)(msg, message_data, message_size, |
|
|
|
|
&d->arena) || |
|
|
|
|
!UPB_PRIVATE(_upb_Message_AddUnknown)(msg, split, end - split, |
|
|
|
|
&d->arena)) { |
|
|
|
|
upb_StringView unknown[] = { |
|
|
|
|
{buf, split - buf}, |
|
|
|
|
{message_data, message_size}, |
|
|
|
|
{split, end - split}, |
|
|
|
|
}; |
|
|
|
|
if (!UPB_PRIVATE(_upb_Message_AddUnknownV)(msg, &d->arena, unknown, 3)) { |
|
|
|
|
_upb_Decoder_ErrorJmp(d, kUpb_DecodeStatus_OutOfMemory); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|