summaryrefslogtreecommitdiff
path: root/tools/upbc.c
diff options
context:
space:
mode:
authorJoshua Haberman <joshua@reverberate.org>2009-08-01 18:34:24 -0700
committerJoshua Haberman <joshua@reverberate.org>2009-08-01 18:34:24 -0700
commita952e42e996fcab8f13e48d0078c0e95a4d507d9 (patch)
tree853539b0fed3691a98bb4f96320dafb06d5a2941 /tools/upbc.c
parent85f6cecb80b48d13dd6c0886c07d38eda0a8f1dd (diff)
Fixed a bug in set_flags order in the compiler.
Diffstat (limited to 'tools/upbc.c')
-rw-r--r--tools/upbc.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/tools/upbc.c b/tools/upbc.c
index 3234a34..8eec85c 100644
--- a/tools/upbc.c
+++ b/tools/upbc.c
@@ -467,12 +467,18 @@ 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);
+ fputs(" }},\n", stream);
/* Print msg data. */
for(unsigned int j = 0; j < m->num_fields; j++) {
struct upb_msg_field *f = &m->fields[j];
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback