|
|
|
@ -13715,6 +13715,40 @@ bool _upb_FieldDef_ValidateUtf8(const upb_FieldDef* f) { |
|
|
|
|
UPB_DESC(FeatureSet_VERIFY); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
bool _upb_FieldDef_IsGroupLike(const upb_FieldDef* f) { |
|
|
|
|
// Groups are always tag-delimited.
|
|
|
|
|
if (UPB_DESC(FeatureSet_message_encoding)(upb_FieldDef_ResolvedFeatures(f)) != |
|
|
|
|
UPB_DESC(FeatureSet_DELIMITED)) { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const upb_MessageDef* msg = upb_FieldDef_MessageSubDef(f); |
|
|
|
|
|
|
|
|
|
// Group fields always are always the lowercase type name.
|
|
|
|
|
const char* mname = upb_MessageDef_Name(msg); |
|
|
|
|
const char* fname = upb_FieldDef_Name(f); |
|
|
|
|
size_t name_size = strlen(fname); |
|
|
|
|
if (name_size != strlen(mname)) return false; |
|
|
|
|
for (size_t i = 0; i < name_size; ++i) { |
|
|
|
|
if ((mname[i] | 0x20) != fname[i]) { |
|
|
|
|
// Case-insensitive ascii comparison.
|
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (upb_MessageDef_File(msg) != upb_FieldDef_File(f)) { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Group messages are always defined in the same scope as the field. File
|
|
|
|
|
// level extensions will compare NULL == NULL here, which is why the file
|
|
|
|
|
// comparison above is necessary to ensure both come from the same file.
|
|
|
|
|
return upb_FieldDef_IsExtension(f) ? upb_FieldDef_ExtensionScope(f) == |
|
|
|
|
upb_MessageDef_ContainingType(msg) |
|
|
|
|
: upb_FieldDef_ContainingType(f) == |
|
|
|
|
upb_MessageDef_ContainingType(msg); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
uint64_t _upb_FieldDef_Modifiers(const upb_FieldDef* f) { |
|
|
|
|
uint64_t out = upb_FieldDef_IsPacked(f) ? kUpb_FieldModifier_IsPacked : 0; |
|
|
|
|
|
|
|
|
|