diff --git a/upb/base/descriptor_constants.h b/upb/base/descriptor_constants.h index c60c8b3f50..8cb1c95096 100644 --- a/upb/base/descriptor_constants.h +++ b/upb/base/descriptor_constants.h @@ -40,7 +40,7 @@ typedef enum { kUpb_CType_Float = 2, kUpb_CType_Int32 = 3, kUpb_CType_UInt32 = 4, - kUpb_CType_Enum = 5, // Enum values are int32. + kUpb_CType_Enum = 5, // Enum values are int32. TODO(b/279178239): rename kUpb_CType_Message = 6, kUpb_CType_Double = 7, kUpb_CType_Int64 = 8, diff --git a/upb/message/accessors.h b/upb/message/accessors.h index 0432d9e08e..c23c477f5d 100644 --- a/upb/message/accessors.h +++ b/upb/message/accessors.h @@ -108,7 +108,8 @@ UPB_API_INLINE int32_t upb_Message_GetInt32(const upb_Message* msg, UPB_API_INLINE bool upb_Message_SetInt32(upb_Message* msg, const upb_MiniTableField* field, int32_t value, upb_Arena* a) { - UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Int32); + UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Int32 || + upb_MiniTableField_CType(field) == kUpb_CType_Enum); UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte); UPB_ASSUME(!upb_IsRepeatedOrMap(field)); return _upb_Message_SetField(msg, field, &value, a); @@ -134,7 +135,7 @@ UPB_API_INLINE bool upb_Message_SetUInt32(upb_Message* msg, return _upb_Message_SetField(msg, field, &value, a); } -UPB_API_INLINE void upb_Message_SetEnumProto2( +UPB_API_INLINE void upb_Message_SetClosedEnum( upb_Message* msg, const upb_MiniTable* msg_mini_table, const upb_MiniTableField* field, int32_t value) { UPB_ASSERT(upb_MiniTableField_IsClosedEnum(field));