Auto-generate files after cl/572041162

pull/14308/head
Protobuf Team Bot 1 year ago
parent 41af1d53a2
commit 2b7a816256
  1. 43
      php/ext/google/protobuf/php-upb.c
  2. 1
      php/ext/google/protobuf/php-upb.h
  3. 43
      ruby/ext/google/protobuf_c/ruby-upb.c
  4. 1
      ruby/ext/google/protobuf_c/ruby-upb.h

@ -10749,6 +10749,9 @@ struct upb_MessageDef {
upb_inttable itof;
upb_strtable ntof;
// Looking up fields by json name.
upb_strtable jtof;
/* All nested defs.
* MEM: We could save some space here by putting nested defs in a contiguous
* region and calculating counts from offsets or vice-versa. */
@ -10774,9 +10777,6 @@ struct upb_MessageDef {
bool in_message_set;
bool is_sorted;
upb_WellKnown well_known_type;
#if UINTPTR_MAX == 0xffffffff
uint32_t padding; // Increase size to a multiple of 8.
#endif
};
static void assign_msg_wellknowntype(upb_MessageDef* m) {
@ -10919,16 +10919,16 @@ bool upb_MessageDef_FindByNameWithSize(const upb_MessageDef* m,
const upb_FieldDef* upb_MessageDef_FindByJsonNameWithSize(
const upb_MessageDef* m, const char* name, size_t size) {
upb_value val;
const upb_FieldDef* f;
if (upb_strtable_lookup2(&m->jtof, name, size, &val)) {
return upb_value_getconstptr(val);
}
if (!upb_strtable_lookup2(&m->ntof, name, size, &val)) {
return NULL;
}
f = _upb_DefType_Unpack(val, UPB_DEFTYPE_FIELD);
if (!f) f = _upb_DefType_Unpack(val, UPB_DEFTYPE_FIELD_JSONNAME);
return f;
return _upb_DefType_Unpack(val, UPB_DEFTYPE_FIELD);
}
int upb_MessageDef_ExtensionRangeCount(const upb_MessageDef* m) {
@ -11108,17 +11108,25 @@ void _upb_MessageDef_InsertField(upb_DefBuilder* ctx, upb_MessageDef* m,
_upb_MessageDef_Insert(m, shortname, shortnamelen, field_v, ctx->arena);
if (!ok) _upb_DefBuilder_OomErr(ctx);
if (strcmp(shortname, json_name) != 0) {
if (upb_strtable_lookup(&m->ntof, json_name, &v)) {
_upb_DefBuilder_Errf(ctx, "duplicate json_name (%s)", json_name);
}
// TODO: Once editions is supported this should turn into a
// check on LEGACY_BEST_EFFORT
if (strcmp(shortname, json_name) != 0 &&
upb_FileDef_Syntax(m->file) == kUpb_Syntax_Proto3 &&
upb_strtable_lookup(&m->ntof, json_name, &v)) {
_upb_DefBuilder_Errf(
ctx, "duplicate json_name for (%s) with original field name (%s)",
shortname, json_name);
}
const size_t json_size = strlen(json_name);
const upb_value json_v = _upb_DefType_Pack(f, UPB_DEFTYPE_FIELD_JSONNAME);
ok = _upb_MessageDef_Insert(m, json_name, json_size, json_v, ctx->arena);
if (!ok) _upb_DefBuilder_OomErr(ctx);
if (upb_strtable_lookup(&m->jtof, json_name, &v)) {
_upb_DefBuilder_Errf(ctx, "duplicate json_name (%s)", json_name);
}
const size_t json_size = strlen(json_name);
ok = upb_strtable_insert(&m->jtof, json_name, json_size,
upb_value_constptr(f), ctx->arena);
if (!ok) _upb_DefBuilder_OomErr(ctx);
if (upb_inttable_lookup(&m->itof, field_number, NULL)) {
_upb_DefBuilder_Errf(ctx, "duplicate field number (%u)", field_number);
}
@ -11371,6 +11379,9 @@ static void create_msgdef(upb_DefBuilder* ctx, const char* prefix,
ok = upb_strtable_init(&m->ntof, n_oneof + n_field, ctx->arena);
if (!ok) _upb_DefBuilder_OomErr(ctx);
ok = upb_strtable_init(&m->jtof, n_field, ctx->arena);
if (!ok) _upb_DefBuilder_OomErr(ctx);
UPB_DEF_SET_OPTIONS(m->opts, DescriptorProto, MessageOptions, msg_proto);
m->oneof_count = n_oneof;

@ -10115,7 +10115,6 @@ typedef enum {
// Only inside message table.
UPB_DEFTYPE_FIELD = 0,
UPB_DEFTYPE_ONEOF = 1,
UPB_DEFTYPE_FIELD_JSONNAME = 2,
} upb_deftype_t;
#ifdef __cplusplus

@ -10263,6 +10263,9 @@ struct upb_MessageDef {
upb_inttable itof;
upb_strtable ntof;
// Looking up fields by json name.
upb_strtable jtof;
/* All nested defs.
* MEM: We could save some space here by putting nested defs in a contiguous
* region and calculating counts from offsets or vice-versa. */
@ -10288,9 +10291,6 @@ struct upb_MessageDef {
bool in_message_set;
bool is_sorted;
upb_WellKnown well_known_type;
#if UINTPTR_MAX == 0xffffffff
uint32_t padding; // Increase size to a multiple of 8.
#endif
};
static void assign_msg_wellknowntype(upb_MessageDef* m) {
@ -10433,16 +10433,16 @@ bool upb_MessageDef_FindByNameWithSize(const upb_MessageDef* m,
const upb_FieldDef* upb_MessageDef_FindByJsonNameWithSize(
const upb_MessageDef* m, const char* name, size_t size) {
upb_value val;
const upb_FieldDef* f;
if (upb_strtable_lookup2(&m->jtof, name, size, &val)) {
return upb_value_getconstptr(val);
}
if (!upb_strtable_lookup2(&m->ntof, name, size, &val)) {
return NULL;
}
f = _upb_DefType_Unpack(val, UPB_DEFTYPE_FIELD);
if (!f) f = _upb_DefType_Unpack(val, UPB_DEFTYPE_FIELD_JSONNAME);
return f;
return _upb_DefType_Unpack(val, UPB_DEFTYPE_FIELD);
}
int upb_MessageDef_ExtensionRangeCount(const upb_MessageDef* m) {
@ -10622,17 +10622,25 @@ void _upb_MessageDef_InsertField(upb_DefBuilder* ctx, upb_MessageDef* m,
_upb_MessageDef_Insert(m, shortname, shortnamelen, field_v, ctx->arena);
if (!ok) _upb_DefBuilder_OomErr(ctx);
if (strcmp(shortname, json_name) != 0) {
if (upb_strtable_lookup(&m->ntof, json_name, &v)) {
_upb_DefBuilder_Errf(ctx, "duplicate json_name (%s)", json_name);
}
// TODO: Once editions is supported this should turn into a
// check on LEGACY_BEST_EFFORT
if (strcmp(shortname, json_name) != 0 &&
upb_FileDef_Syntax(m->file) == kUpb_Syntax_Proto3 &&
upb_strtable_lookup(&m->ntof, json_name, &v)) {
_upb_DefBuilder_Errf(
ctx, "duplicate json_name for (%s) with original field name (%s)",
shortname, json_name);
}
const size_t json_size = strlen(json_name);
const upb_value json_v = _upb_DefType_Pack(f, UPB_DEFTYPE_FIELD_JSONNAME);
ok = _upb_MessageDef_Insert(m, json_name, json_size, json_v, ctx->arena);
if (!ok) _upb_DefBuilder_OomErr(ctx);
if (upb_strtable_lookup(&m->jtof, json_name, &v)) {
_upb_DefBuilder_Errf(ctx, "duplicate json_name (%s)", json_name);
}
const size_t json_size = strlen(json_name);
ok = upb_strtable_insert(&m->jtof, json_name, json_size,
upb_value_constptr(f), ctx->arena);
if (!ok) _upb_DefBuilder_OomErr(ctx);
if (upb_inttable_lookup(&m->itof, field_number, NULL)) {
_upb_DefBuilder_Errf(ctx, "duplicate field number (%u)", field_number);
}
@ -10885,6 +10893,9 @@ static void create_msgdef(upb_DefBuilder* ctx, const char* prefix,
ok = upb_strtable_init(&m->ntof, n_oneof + n_field, ctx->arena);
if (!ok) _upb_DefBuilder_OomErr(ctx);
ok = upb_strtable_init(&m->jtof, n_field, ctx->arena);
if (!ok) _upb_DefBuilder_OomErr(ctx);
UPB_DEF_SET_OPTIONS(m->opts, DescriptorProto, MessageOptions, msg_proto);
m->oneof_count = n_oneof;

@ -10619,7 +10619,6 @@ typedef enum {
// Only inside message table.
UPB_DEFTYPE_FIELD = 0,
UPB_DEFTYPE_ONEOF = 1,
UPB_DEFTYPE_FIELD_JSONNAME = 2,
} upb_deftype_t;
#ifdef __cplusplus

Loading…
Cancel
Save