diff --git a/tests/conformance_upb.c b/tests/conformance_upb.c index 9f83e807e4..1671409f61 100644 --- a/tests/conformance_upb.c +++ b/tests/conformance_upb.c @@ -81,7 +81,7 @@ void DoTest( char *serialized = protobuf_test_messages_proto3_TestAllTypes_serialize( test_message, env, &serialized_len); if (!serialized) { - fprintf(stderr, "conformance_upb: Error serialiing."); + fprintf(stderr, "conformance_upb: Error serializing."); exit(1); } conformance_ConformanceResponse_set_protobuf_payload( diff --git a/tools/make_c_api.lua b/tools/make_c_api.lua index aaf5d1ead4..c13f37c413 100644 --- a/tools/make_c_api.lua +++ b/tools/make_c_api.lua @@ -30,11 +30,6 @@ function strip_proto(filename) return string.gsub(filename, '%.proto$','') end ---[[ - [upb.TYPE_ENUM] = 5, - [upb.TYPE_MESSAGE] = 8, ---]] - local function join(...) return table.concat({...}, ".") end @@ -138,6 +133,12 @@ local function field_layout_rank(field) -- 5. string fields -- 6. submessage fields -- 7. repeated fields + -- + -- This has the following nice properties: + -- + -- 1. padding alignment is (nearly) minimized. + -- 2. fields that might have defaults (1-5) are segregated + -- from fields that are always zero-initialized (6-7). local rank if field:containing_oneof() then rank = 4 diff --git a/tools/upbc.lua b/tools/upbc.lua index bf9a68d36a..bfd93f86ab 100644 --- a/tools/upbc.lua +++ b/tools/upbc.lua @@ -18,6 +18,10 @@ for _, argument in ipairs(arg) do if argument == "--generate-upbdefs" then generate_upbdefs = true else + if src then + print("upbc can only handle one input file at a time.") + return 1 + end src = argument end end diff --git a/upb/msg.c b/upb/msg.c index 34525b78e8..f1070d72fe 100644 --- a/upb/msg.c +++ b/upb/msg.c @@ -340,8 +340,8 @@ static upb_msglayout *upb_msglayout_new(const upb_msgdef *m) { } /* Size of the entire structure should be a multiple of its greatest - * alignment. */ - l->data.size = align_up(l->data.size, 8 /* TODO: track for real? */); + * alignment. TODO: track overall alignment for real? */ + l->data.size = align_up(l->data.size, 8); if (upb_msglayout_initdefault(l, m)) { return l; diff --git a/upb/msg.h b/upb/msg.h index ee1e2fbd10..7026a50edb 100644 --- a/upb/msg.h +++ b/upb/msg.h @@ -408,7 +408,7 @@ typedef struct upb_msglayout_msginit_v1 { const upb_msglayout_oneofinit_v1 *oneofs; void *default_msg; /* Must be aligned to sizeof(void*). Doesn't include internal members like - * unknown * fields, extension dict, pointer to msglayout, etc. */ + * unknown fields, extension dict, pointer to msglayout, etc. */ uint32_t size; uint16_t field_count; uint16_t oneof_count;