@ -415,7 +415,10 @@ void _upb_MessageDef_InsertField(upb_DefBuilder* ctx, upb_MessageDef* m,
_upb_MessageDef_Insert ( m , shortname , shortnamelen , field_v , ctx - > arena ) ;
_upb_MessageDef_Insert ( m , shortname , shortnamelen , field_v , ctx - > arena ) ;
if ( ! ok ) _upb_DefBuilder_OomErr ( ctx ) ;
if ( ! ok ) _upb_DefBuilder_OomErr ( ctx ) ;
if ( strcmp ( shortname , json_name ) ! = 0 & &
bool skip_json_conflicts =
UPB_DESC ( MessageOptions_deprecated_legacy_json_field_conflicts ) (
upb_MessageDef_Options ( m ) ) ;
if ( ! skip_json_conflicts & & strcmp ( shortname , json_name ) ! = 0 & &
UPB_DESC ( FeatureSet_json_format ) ( m - > resolved_features ) = =
UPB_DESC ( FeatureSet_json_format ) ( m - > resolved_features ) = =
UPB_DESC ( FeatureSet_ALLOW ) & &
UPB_DESC ( FeatureSet_ALLOW ) & &
upb_strtable_lookup ( & m - > ntof , json_name , & v ) ) {
upb_strtable_lookup ( & m - > ntof , json_name , & v ) ) {
@ -425,14 +428,16 @@ void _upb_MessageDef_InsertField(upb_DefBuilder* ctx, upb_MessageDef* m,
}
}
if ( upb_strtable_lookup ( & m - > jtof , json_name , & v ) ) {
if ( upb_strtable_lookup ( & m - > jtof , json_name , & v ) ) {
_upb_DefBuilder_Errf ( ctx , " duplicate json_name (%s) " , json_name ) ;
if ( ! skip_json_conflicts ) {
_upb_DefBuilder_Errf ( ctx , " duplicate json_name (%s) " , json_name ) ;
}
} else {
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 ) ;
}
}
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 ) ) {
if ( upb_inttable_lookup ( & m - > itof , field_number , NULL ) ) {
_upb_DefBuilder_Errf ( ctx , " duplicate field number (%u) " , field_number ) ;
_upb_DefBuilder_Errf ( ctx , " duplicate field number (%u) " , field_number ) ;
}
}