From 9349b703a33c76b0d50a15c6d372e8948e045749 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Tue, 15 Jan 2019 13:35:39 -0800 Subject: Fixed a few bugs surfaced by Ruby. --- upb/def.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'upb') diff --git a/upb/def.c b/upb/def.c index ae2306f..aedd88d 100644 --- a/upb/def.c +++ b/upb/def.c @@ -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); -- cgit v1.2.3