diff --git a/cmake/google/protobuf/descriptor.upb.c b/cmake/google/protobuf/descriptor.upb.c index ef4f876a65..21dbcaddbe 100644 --- a/cmake/google/protobuf/descriptor.upb.c +++ b/cmake/google/protobuf/descriptor.upb.c @@ -184,7 +184,7 @@ static const upb_MiniTable_Field google_protobuf_EnumDescriptorProto__fields[5] const upb_MiniTable google_protobuf_EnumDescriptorProto_msginit = { &google_protobuf_EnumDescriptorProto_submsgs[0], &google_protobuf_EnumDescriptorProto__fields[0], - UPB_SIZE(32, 64), 5, upb_ExtMode_NonExtendable, 5, 255, 0, + UPB_SIZE(32, 56), 5, upb_ExtMode_NonExtendable, 5, 255, 0, }; static const upb_MiniTable_Field google_protobuf_EnumDescriptorProto_EnumReservedRange__fields[2] = { @@ -228,7 +228,7 @@ static const upb_MiniTable_Field google_protobuf_ServiceDescriptorProto__fields[ const upb_MiniTable google_protobuf_ServiceDescriptorProto_msginit = { &google_protobuf_ServiceDescriptorProto_submsgs[0], &google_protobuf_ServiceDescriptorProto__fields[0], - UPB_SIZE(24, 48), 3, upb_ExtMode_NonExtendable, 3, 255, 0, + UPB_SIZE(24, 40), 3, upb_ExtMode_NonExtendable, 3, 255, 0, }; static const upb_MiniTable_Sub google_protobuf_MethodDescriptorProto_submsgs[1] = { @@ -420,7 +420,7 @@ static const upb_MiniTable_Field google_protobuf_UninterpretedOption__fields[7] const upb_MiniTable google_protobuf_UninterpretedOption_msginit = { &google_protobuf_UninterpretedOption_submsgs[0], &google_protobuf_UninterpretedOption__fields[0], - UPB_SIZE(64, 96), 7, upb_ExtMode_NonExtendable, 0, 255, 0, + UPB_SIZE(64, 88), 7, upb_ExtMode_NonExtendable, 0, 255, 0, }; static const upb_MiniTable_Field google_protobuf_UninterpretedOption_NamePart__fields[2] = { @@ -431,7 +431,7 @@ static const upb_MiniTable_Field google_protobuf_UninterpretedOption_NamePart__f const upb_MiniTable google_protobuf_UninterpretedOption_NamePart_msginit = { NULL, &google_protobuf_UninterpretedOption_NamePart__fields[0], - UPB_SIZE(16, 32), 2, upb_ExtMode_NonExtendable, 2, 255, 2, + UPB_SIZE(16, 24), 2, upb_ExtMode_NonExtendable, 2, 255, 2, }; static const upb_MiniTable_Sub google_protobuf_SourceCodeInfo_submsgs[1] = { @@ -486,7 +486,7 @@ static const upb_MiniTable_Field google_protobuf_GeneratedCodeInfo_Annotation__f const upb_MiniTable google_protobuf_GeneratedCodeInfo_Annotation_msginit = { NULL, &google_protobuf_GeneratedCodeInfo_Annotation__fields[0], - UPB_SIZE(24, 48), 4, upb_ExtMode_NonExtendable, 4, 255, 0, + UPB_SIZE(24, 40), 4, upb_ExtMode_NonExtendable, 4, 255, 0, }; static const upb_MiniTable *messages_layout[27] = { diff --git a/upb/upb.h b/upb/upb.h index 45000ffdaf..5c500fe5f5 100644 --- a/upb/upb.h +++ b/upb/upb.h @@ -227,7 +227,7 @@ UPB_INLINE void* upb_Arena_Realloc(upb_Arena* a, void* ptr, size_t oldsize, size_t size) { _upb_ArenaHead* h = (_upb_ArenaHead*)a; char* ch_ptr = (char*)ptr; - oldsize = UPB_ALIGN_MALLOC(size); + oldsize = UPB_ALIGN_MALLOC(oldsize); size = UPB_ALIGN_MALLOC(size); if (ch_ptr + oldsize == h->ptr) { if ((size_t)(h->end - ch_ptr) >= size) { diff --git a/upbc/protoc-gen-upb.cc b/upbc/protoc-gen-upb.cc index 62ce9a7850..b701640110 100644 --- a/upbc/protoc-gen-upb.cc +++ b/upbc/protoc-gen-upb.cc @@ -1431,11 +1431,11 @@ void WriteMessage(const protobuf::Descriptor* message, const FileLayout& layout, FieldNumberOrder(message); assert(field_number_order.size() == mt_32->field_count); assert(field_number_order.size() == mt_64->field_count); - if (!field_number_order.empty()) { + if (mt_64->field_count > 0) { std::string fields_array_name = msg_name + "__fields"; fields_array_ref = "&" + fields_array_name + "[0]"; output("static const upb_MiniTable_Field $0[$1] = {\n", fields_array_name, - field_number_order.size()); + mt_64->field_count()); for (int i = 0; i < static_cast(field_number_order.size()); i++) { auto field = field_number_order[i]; int sublayout_index = 0;