diff options
author | Joshua Haberman <jhaberman@gmail.com> | 2011-07-31 15:39:19 -0700 |
---|---|---|
committer | Joshua Haberman <jhaberman@gmail.com> | 2011-07-31 15:39:19 -0700 |
commit | 57abebaaf902436f8de8e50f7054c25b391067ac (patch) | |
tree | 4792a2d03a3e8e8b891845ad1000f95fe3df19bb /upb | |
parent | 56984e8db8e1c43687535cc77fb6ce43df0b3d1f (diff) |
Fixed "make descriptorgen".
Diffstat (limited to 'upb')
-rw-r--r-- | upb/def.c | 5 | ||||
-rw-r--r-- | upb/def.h | 1 | ||||
-rw-r--r-- | upb/descriptor_const.h | 60 | ||||
-rw-r--r-- | upb/pb/glue.c | 2 | ||||
-rw-r--r-- | upb/upb.h | 4 |
5 files changed, 36 insertions, 36 deletions
@@ -172,8 +172,9 @@ upb_enumdef *upb_enumdef_dup(upb_enumdef *e) { bool upb_enumdef_addval(upb_enumdef *e, char *name, int32_t num) { if (upb_enumdef_iton(e, num) || upb_enumdef_ntoi(e, name, NULL)) return false; + upb_iton_ent ent = {0, strdup(name)}; upb_strtable_insert(&e->ntoi, name, &num); - upb_inttable_insert(&e->iton, num, strdup(name)); + upb_inttable_insert(&e->iton, num, &ent); return true; } @@ -715,11 +716,11 @@ bool upb_symtab_add(upb_symtab *s, upb_def **defs, int n, upb_status *status) { case UPB_TYPE(SINT64): upb_value_setint64(&f->defaultval, 0); break; case UPB_TYPE(INT32): case UPB_TYPE(SINT32): - case UPB_TYPE(ENUM): case UPB_TYPE(SFIXED32): upb_value_setint32(&f->defaultval, 0); break; case UPB_TYPE(UINT32): case UPB_TYPE(FIXED32): upb_value_setuint32(&f->defaultval, 0); break; case UPB_TYPE(BOOL): upb_value_setbool(&f->defaultval, false); break; + case UPB_TYPE(ENUM): // Will be resolved by upb_resolve(). case UPB_TYPE(STRING): case UPB_TYPE(BYTES): case UPB_TYPE(GROUP): @@ -276,7 +276,6 @@ typedef struct _upb_enumdef { } upb_enumdef; typedef struct { - upb_strtable_entry e; uint32_t value; } upb_ntoi_ent; diff --git a/upb/descriptor_const.h b/upb/descriptor_const.h index 228c95a..20058e4 100644 --- a/upb/descriptor_const.h +++ b/upb/descriptor_const.h @@ -1,7 +1,7 @@ /* This file was generated by upbc (the upb compiler). Do not edit. */ -#ifndef SRC_DESCRIPTOR_CONST_C -#define SRC_DESCRIPTOR_CONST_C +#ifndef UPB_DESCRIPTOR_CONST_H +#define UPB_DESCRIPTOR_CONST_H #ifdef __cplusplus extern "C" { @@ -10,42 +10,42 @@ extern "C" { /* Enums. */ typedef enum google_protobuf_FieldOptions_CType { - GOOGLE_PROTOBUF_FIELDOPTIONS_STRING = 0, - GOOGLE_PROTOBUF_FIELDOPTIONS_STRING_PIECE = 2, - GOOGLE_PROTOBUF_FIELDOPTIONS_CORD = 1 + GOOGLE_PROTOBUF_FIELDOPTIONS_CTYPE_STRING = 0, + GOOGLE_PROTOBUF_FIELDOPTIONS_CTYPE_CORD = 1, + GOOGLE_PROTOBUF_FIELDOPTIONS_CTYPE_STRING_PIECE = 2 } google_protobuf_FieldOptions_CType; typedef enum google_protobuf_FieldDescriptorProto_Type { - GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_TYPE_DOUBLE = 1, - GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_TYPE_FLOAT = 2, - GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_TYPE_INT64 = 3, - GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_TYPE_UINT64 = 4, - GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_TYPE_INT32 = 5, - GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_TYPE_FIXED64 = 6, - GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_TYPE_FIXED32 = 7, - GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_TYPE_BOOL = 8, - GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_TYPE_STRING = 9, - GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_TYPE_GROUP = 10, - GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_TYPE_MESSAGE = 11, - GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_TYPE_BYTES = 12, - GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_TYPE_UINT32 = 13, - GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_TYPE_ENUM = 14, - GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_TYPE_SFIXED32 = 15, - GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_TYPE_SFIXED64 = 16, - GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_TYPE_SINT32 = 17, - GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_TYPE_SINT64 = 18 + GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_TYPE_TYPE_DOUBLE = 1, + GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_TYPE_TYPE_FLOAT = 2, + GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_TYPE_TYPE_INT64 = 3, + GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_TYPE_TYPE_UINT64 = 4, + GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_TYPE_TYPE_INT32 = 5, + GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_TYPE_TYPE_FIXED64 = 6, + GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_TYPE_TYPE_FIXED32 = 7, + GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_TYPE_TYPE_BOOL = 8, + GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_TYPE_TYPE_STRING = 9, + GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_TYPE_TYPE_GROUP = 10, + GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_TYPE_TYPE_MESSAGE = 11, + GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_TYPE_TYPE_BYTES = 12, + GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_TYPE_TYPE_UINT32 = 13, + GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_TYPE_TYPE_ENUM = 14, + GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_TYPE_TYPE_SFIXED32 = 15, + GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_TYPE_TYPE_SFIXED64 = 16, + GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_TYPE_TYPE_SINT32 = 17, + GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_TYPE_TYPE_SINT64 = 18 } google_protobuf_FieldDescriptorProto_Type; typedef enum google_protobuf_FieldDescriptorProto_Label { - GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_LABEL_OPTIONAL = 1, - GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_LABEL_REQUIRED = 2, - GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_LABEL_REPEATED = 3 + GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_LABEL_LABEL_OPTIONAL = 1, + GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_LABEL_LABEL_REQUIRED = 2, + GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_LABEL_LABEL_REPEATED = 3 } google_protobuf_FieldDescriptorProto_Label; typedef enum google_protobuf_FileOptions_OptimizeMode { - GOOGLE_PROTOBUF_FILEOPTIONS_SPEED = 1, - GOOGLE_PROTOBUF_FILEOPTIONS_CODE_SIZE = 2, - GOOGLE_PROTOBUF_FILEOPTIONS_LITE_RUNTIME = 3 + GOOGLE_PROTOBUF_FILEOPTIONS_OPTIMIZEMODE_SPEED = 1, + GOOGLE_PROTOBUF_FILEOPTIONS_OPTIMIZEMODE_CODE_SIZE = 2, + GOOGLE_PROTOBUF_FILEOPTIONS_OPTIMIZEMODE_LITE_RUNTIME = 3 } google_protobuf_FileOptions_OptimizeMode; /* Constants for field names and numbers. */ @@ -346,4 +346,4 @@ typedef enum google_protobuf_FileOptions_OptimizeMode { } /* extern "C" */ #endif -#endif /* SRC_DESCRIPTOR_CONST_C */ +#endif /* UPB_DESCRIPTOR_CONST_H */ diff --git a/upb/pb/glue.c b/upb/pb/glue.c index d4d04bc..dfd9e88 100644 --- a/upb/pb/glue.c +++ b/upb/pb/glue.c @@ -77,7 +77,7 @@ void upb_read_descriptor(upb_symtab *symtab, const char *str, size_t len, for(int i = 0; i < n; i++) { upb_def *def = defs[i]; upb_msgdef *md = upb_dyncast_msgdef(def); - if (!md) return; + if (!md) continue; // For field in msgdef: upb_msg_iter i; for(i = upb_msg_begin(md); !upb_msg_done(i); i = upb_msg_next(md, i)) { @@ -106,8 +106,8 @@ enum upb_wire_type { typedef uint8_t upb_fieldtype_t; // For referencing the type constants tersely. -#define UPB_TYPE(type) GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_TYPE_ ## type -#define UPB_LABEL(type) GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_LABEL_ ## type +#define UPB_TYPE(type) GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_TYPE_TYPE_ ## type +#define UPB_LABEL(type) GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_LABEL_LABEL_ ## type // Info for a given field type. typedef struct { |