MSET -> MSGSET

pull/13171/head
Joshua Haberman 4 years ago
parent 853c4e4181
commit 8c916941b0
  1. 12
      upb/decode.c
  2. 2
      upb/def.c
  3. 6
      upb/encode.c
  4. 14
      upb/msg_internal.h
  5. 2
      upbc/protoc-gen-upb.cc

@ -592,7 +592,7 @@ static const char *decode_msgset(upb_decstate *d, const char *ptr, upb_msg *msg,
.fields = NULL,
.size = 0,
.field_count = 0,
.ext = _UPB_MSGEXT_MSET_ITEM,
.ext = _UPB_MSGEXT_MSGSET_ITEM,
.dense_below = 0,
.table_mask = -1};
return decode_group(d, ptr, msg, &item_layout, 1);
@ -636,20 +636,20 @@ static const upb_msglayout_field *decode_findfield(upb_decstate *d,
if (ext) return &ext->field;
break;
}
case _UPB_MSGEXT_MSET:
if (field_number == _UPB_MSET_ITEM) {
case _UPB_MSGEXT_MSGSET:
if (field_number == _UPB_MSGSET_ITEM) {
static upb_msglayout_field item = {0, 0, 0, 0, TYPE_MSGSET_ITEM, 0};
return &item;
}
break;
case _UPB_MSGEXT_MSET_ITEM:
case _UPB_MSGEXT_MSGSET_ITEM:
switch (field_number) {
case _UPB_MSET_TYPEID: {
case _UPB_MSGSET_TYPEID: {
static upb_msglayout_field type_id = {
0, 0, 0, 0, TYPE_MSGSET_TYPE_ID, 0};
return &type_id;
}
case _UPB_MSET_MESSAGE:
case _UPB_MSGSET_MESSAGE:
if (l->fields) {
// We saw type_id previously and succeeded in looking up msg.
return l->fields;

@ -1228,7 +1228,7 @@ static void make_layout(symtab_addctx *ctx, const upb_msgdef *m) {
if (upb_msgdef_extrangecount(m) > 0) {
if (m->is_message_set) {
l->ext = _UPB_MSGEXT_MSET;
l->ext = _UPB_MSGEXT_MSGSET;
} else {
l->ext = _UPB_MSGEXT_EXTENDABLE;
}

@ -483,7 +483,7 @@ static void encode_field(upb_encstate *e, const upb_msg *msg,
* required string message = 3;
* }
* } */
static void encode_mset_item(upb_encstate *e, const upb_msg_ext *ext) {
static void encode_msgset_item(upb_encstate *e, const upb_msg_ext *ext) {
size_t size;
encode_tag(e, 1, UPB_WIRE_TYPE_END_GROUP);
encode_message(e, ext->data.ptr, ext->ext->sub.submsg, &size);
@ -516,8 +516,8 @@ static void encode_message(upb_encstate *e, const upb_msg *msg,
const upb_msg_ext *end = ext + ext_count;
if (ext_count) {
for (; ext != end; ext++) {
if (UPB_UNLIKELY(m->ext == _UPB_MSGEXT_MSET)) {
encode_mset_item(e, ext);
if (UPB_UNLIKELY(m->ext == _UPB_MSGEXT_MSGSET)) {
encode_msgset_item(e, ext);
} else {
encode_field(e, &ext->data, &ext->ext->sub, &ext->ext->field);
}

@ -136,10 +136,10 @@ typedef union {
} upb_msglayout_sub;
typedef enum {
_UPB_MSGEXT_NONE = 0, // Non-extendable message.
_UPB_MSGEXT_EXTENDABLE = 1, // Normal extendable message.
_UPB_MSGEXT_MSET = 2, // MessageSet message.
_UPB_MSGEXT_MSET_ITEM = 3, // MessageSet item (temporary only, see decode.c)
_UPB_MSGEXT_NONE = 0, // Non-extendable message.
_UPB_MSGEXT_EXTENDABLE = 1, // Normal extendable message.
_UPB_MSGEXT_MSGSET = 2, // MessageSet message.
_UPB_MSGEXT_MSGSET_ITEM = 3, // MessageSet item (temporary only, see decode.c)
} upb_msgext_mode;
/* MessageSet wire format is:
@ -151,9 +151,9 @@ typedef enum {
* }
*/
typedef enum {
_UPB_MSET_ITEM = 1,
_UPB_MSET_TYPEID = 2,
_UPB_MSET_MESSAGE = 3,
_UPB_MSGSET_ITEM = 1,
_UPB_MSGSET_TYPEID = 2,
_UPB_MSGSET_MESSAGE = 3,
} upb_msgext_fieldnum;
struct upb_msglayout {

@ -1107,7 +1107,7 @@ void WriteMessage(const protobuf::Descriptor* message, Output& output,
if (message->extension_range_count()) {
if (message->options().message_set_wire_format()) {
msgext = "_UPB_MSGEXT_MSET";
msgext = "_UPB_MSGEXT_MSGSET";
} else {
msgext = "_UPB_MSGEXT_EXTENDABLE";
}

Loading…
Cancel
Save