diff options
author | Joshua Haberman <jhaberman@gmail.com> | 2019-01-15 13:35:39 -0800 |
---|---|---|
committer | Joshua Haberman <jhaberman@gmail.com> | 2019-01-15 13:35:39 -0800 |
commit | 9349b703a33c76b0d50a15c6d372e8948e045749 (patch) | |
tree | 88b91e7aa7f1dd545d4ed45f2fd7569b6006b131 /upb/def.c | |
parent | f30c7f4acbe0457aa41597f034765d94eb39e739 (diff) |
Fixed a few bugs surfaced by Ruby.
Diffstat (limited to 'upb/def.c')
-rw-r--r-- | upb/def.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -552,7 +552,7 @@ uint32_t upb_fielddef_defaultuint32(const upb_fielddef *f) { bool upb_fielddef_defaultbool(const upb_fielddef *f) { chkdefaulttype(f, UPB_TYPE_BOOL); - return f->defaultval.uint; + return f->defaultval.boolean; } float upb_fielddef_defaultfloat(const upb_fielddef *f) { @@ -1094,7 +1094,7 @@ static bool parse_default(const symtab_addctx *ctx, const char *str, size_t len, /* XXX: Need to write our own strtof, since it's not available in c89. */ float val = strtod(str, &end); CHK(errno != ERANGE && !*end); - f->defaultval.dbl = val; + f->defaultval.flt = val; break; } case UPB_TYPE_BOOL: { @@ -1305,7 +1305,7 @@ static bool create_enumdef( int32_t num = google_protobuf_EnumValueDescriptorProto_number(value); upb_value v = upb_value_int32(num); - if (n == 0 && e->file->syntax == UPB_SYNTAX_PROTO3 && num != 0) { + if (i == 0 && e->file->syntax == UPB_SYNTAX_PROTO3 && num != 0) { upb_status_seterrf(ctx->status, "for proto3, the first enum value must be zero (%s)", e->full_name); |