Fixed a bug in set_flags order in the compiler.

pull/13171/head
Joshua Haberman 16 years ago
parent 85f6cecb80
commit a952e42e99
  1. 1269
      descriptor/descriptor.c
  2. 6
      src/upb_context.c
  3. 14
      tools/upbc.c

File diff suppressed because it is too large Load Diff

@ -195,14 +195,12 @@ static bool insert_message(struct upb_strtable *t,
upb_strtable_insert(t, &e.e);
/* Add nested messages and enums. */
//if(d->set_flags.has.nested_type) (re-enable when protoc sets)
if(d->nested_type)
if(d->set_flags.has.nested_type)
for(unsigned int i = 0; i < d->nested_type->len; i++)
if(!insert_message(t, d->nested_type->elements[i], &fqname, sort))
return false;
//if(d->set_flags.has.enum_type)
if(d->enum_type)
if(d->set_flags.has.enum_type)
for(unsigned int i = 0; i < d->enum_type->len; i++)
if(!insert_enum(t, d->enum_type->elements[i], &fqname))
return false;

@ -467,10 +467,16 @@ static void write_message_c(void *data, struct upb_msg *m,
struct upb_msg *m = e->field->ref.msg;
void *msgdata = val.msg;
/* Print set flags. */
fputs(" {.set_flags = {.bytes = {", stream);
for(unsigned int j = 0; j < m->set_flags_bytes; j++) {
fprintf(stream, "0x%02hhx", *(uint8_t*)(val.msg + j));
if(j < m->set_flags_bytes - 1) fputs(", ", stream);
fputs(" {.set_flags = {.has = {\n", stream);
for(unsigned int j = 0; j < m->num_fields; j++) {
struct upb_msg_field *f = &m->fields[j];
google_protobuf_FieldDescriptorProto *fd = m->field_descriptors[j];
fprintf(stream, " ." UPB_STRFMT " = ", UPB_STRARG(*fd->name));
if(upb_msg_isset(msgdata, f))
fprintf(stream, "true");
else
fprintf(stream, "false");
fputs(",\n", stream);
}
fputs(" }},\n", stream);
/* Print msg data. */

Loading…
Cancel
Save