diff options
author | pg <pg@yandex-team.com> | 2023-02-06 20:48:31 +0300 |
---|---|---|
committer | pg <pg@yandex-team.com> | 2023-02-06 20:48:31 +0300 |
commit | 6cabb77676668397e5ac0afacc8c68b54c41c86b (patch) | |
tree | 8fa149d5288f046e8ecb7944fa299c69f17f86fe /contrib/libs/protoc/src/google/protobuf/compiler/java | |
parent | 717dbc4b00249886f789109e9af0432ece4d9586 (diff) | |
download | ydb-6cabb77676668397e5ac0afacc8c68b54c41c86b.tar.gz |
less shim
К сожалению, люди успели наплодить переменных и методов c именами i64(), ui64(), поэтому для генеренного кода проще всего оказалось завести несколько type alias arc_ui64 -> ui64, и так далее.
Diffstat (limited to 'contrib/libs/protoc/src/google/protobuf/compiler/java')
9 files changed, 15 insertions, 15 deletions
diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_enum_field.cc b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_enum_field.cc index 9c32e1821b..a037f6289c 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_enum_field.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_enum_field.cc @@ -70,7 +70,7 @@ void SetEnumVariables(const FieldDescriptor* descriptor, int messageBitIndex, (*variables)["default_number"] = StrCat(descriptor->default_value_enum()->number()); (*variables)["tag"] = StrCat( - static_cast<i32>(internal::WireFormat::MakeTag(descriptor))); + static_cast<arc_i32>(internal::WireFormat::MakeTag(descriptor))); (*variables)["tag_size"] = StrCat( internal::WireFormat::TagSize(descriptor->number(), GetType(descriptor))); // TODO(birdo): Add @deprecated javadoc when generating javadoc is supported diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_enum_field_lite.cc b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_enum_field_lite.cc index 73ef7ddfa4..300da77b9c 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_enum_field_lite.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_enum_field_lite.cc @@ -77,7 +77,7 @@ void SetEnumVariables(const FieldDescriptor* descriptor, int messageBitIndex, (*variables)["default_number"] = StrCat(descriptor->default_value_enum()->number()); (*variables)["tag"] = StrCat( - static_cast<i32>(internal::WireFormat::MakeTag(descriptor))); + static_cast<arc_i32>(internal::WireFormat::MakeTag(descriptor))); (*variables)["tag_size"] = StrCat( internal::WireFormat::TagSize(descriptor->number(), GetType(descriptor))); // TODO(birdo): Add @deprecated javadoc when generating javadoc is supported diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_helpers.cc b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_helpers.cc index 161565a62d..4c613af8ea 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_helpers.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_helpers.cc @@ -576,11 +576,11 @@ TProtoStringType DefaultValue(const FieldDescriptor* field, bool immutable, return StrCat(field->default_value_int32()); case FieldDescriptor::CPPTYPE_UINT32: // Need to print as a signed int since Java has no unsigned. - return StrCat(static_cast<i32>(field->default_value_uint32())); + return StrCat(static_cast<arc_i32>(field->default_value_uint32())); case FieldDescriptor::CPPTYPE_INT64: return StrCat(field->default_value_int64()) + "L"; case FieldDescriptor::CPPTYPE_UINT64: - return StrCat(static_cast<i64>(field->default_value_uint64())) + + return StrCat(static_cast<arc_i64>(field->default_value_uint64())) + "L"; case FieldDescriptor::CPPTYPE_DOUBLE: { double value = field->default_value_double(); @@ -972,7 +972,7 @@ bool HasRepeatedFields(const Descriptor* descriptor) { // // Note that we only use code points in [0x0000, 0xD7FF] and [0xE000, 0xFFFF]. // There will be no surrogate pairs in the encoded character sequence. -void WriteUInt32ToUtf16CharSequence(ui32 number, +void WriteUInt32ToUtf16CharSequence(arc_ui32 number, std::vector<uint16_t>* output) { // For values in [0x0000, 0xD7FF], only use one char to encode it. if (number < 0xD800) { diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_helpers.h b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_helpers.h index 487b43f13e..dd80e23d3f 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_helpers.h +++ b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_helpers.h @@ -426,12 +426,12 @@ inline TProtoStringType GeneratedCodeVersionSuffix() { return "V3"; } -void WriteUInt32ToUtf16CharSequence(ui32 number, +void WriteUInt32ToUtf16CharSequence(arc_ui32 number, std::vector<uint16_t>* output); inline void WriteIntToUtf16CharSequence(int value, std::vector<uint16_t>* output) { - WriteUInt32ToUtf16CharSequence(static_cast<ui32>(value), output); + WriteUInt32ToUtf16CharSequence(static_cast<arc_ui32>(value), output); } // Escape a UTF-16 character so it can be embedded in a Java string literal. diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_message.cc b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_message.cc index b245106ab7..83c5fb5dd6 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_message.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_message.cc @@ -1222,11 +1222,11 @@ void ImmutableMessageGenerator::GenerateParsingConstructor( for (int i = 0; i < descriptor_->field_count(); i++) { const FieldDescriptor* field = sorted_fields[i]; - ui32 tag = WireFormatLite::MakeTag( + arc_ui32 tag = WireFormatLite::MakeTag( field->number(), WireFormat::WireTypeForFieldType(field->type())); printer->Print("case $tag$: {\n", "tag", - StrCat(static_cast<i32>(tag))); + StrCat(static_cast<arc_i32>(tag))); printer->Indent(); field_generators_.get(field).GenerateParsingCode(printer); @@ -1239,10 +1239,10 @@ void ImmutableMessageGenerator::GenerateParsingConstructor( if (field->is_packable()) { // To make packed = true wire compatible, we generate parsing code from a // packed version of this field regardless of field->options().packed(). - ui32 packed_tag = WireFormatLite::MakeTag( + arc_ui32 packed_tag = WireFormatLite::MakeTag( field->number(), WireFormatLite::WIRETYPE_LENGTH_DELIMITED); printer->Print("case $tag$: {\n", "tag", - StrCat(static_cast<i32>(packed_tag))); + StrCat(static_cast<arc_i32>(packed_tag))); printer->Indent(); field_generators_.get(field).GenerateParsingCodeFromPacked(printer); diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_primitive_field.cc b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_primitive_field.cc index a90dc71d0a..51e91affd8 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_primitive_field.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_primitive_field.cc @@ -114,7 +114,7 @@ void SetPrimitiveVariables(const FieldDescriptor* descriptor, (*variables)["capitalized_type"] = GetCapitalizedType(descriptor, /* immutable = */ true); (*variables)["tag"] = - StrCat(static_cast<i32>(WireFormat::MakeTag(descriptor))); + StrCat(static_cast<arc_i32>(WireFormat::MakeTag(descriptor))); (*variables)["tag_size"] = StrCat( WireFormat::TagSize(descriptor->number(), GetType(descriptor))); if (IsReferenceType(GetJavaType(descriptor))) { diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_primitive_field_lite.cc b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_primitive_field_lite.cc index 16ad9881c9..24fef33624 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_primitive_field_lite.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_primitive_field_lite.cc @@ -80,7 +80,7 @@ void SetPrimitiveVariables(const FieldDescriptor* descriptor, (*variables)["capitalized_type"] = GetCapitalizedType(descriptor, /* immutable = */ true); (*variables)["tag"] = - StrCat(static_cast<i32>(WireFormat::MakeTag(descriptor))); + StrCat(static_cast<arc_i32>(WireFormat::MakeTag(descriptor))); (*variables)["tag_size"] = StrCat( WireFormat::TagSize(descriptor->number(), GetType(descriptor))); (*variables)["required"] = descriptor->is_required() ? "true" : "false"; diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_string_field.cc b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_string_field.cc index 6b4b058eba..2d0eb752a8 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_string_field.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_string_field.cc @@ -73,7 +73,7 @@ void SetPrimitiveVariables(const FieldDescriptor* descriptor, "= " + ImmutableDefaultValue(descriptor, name_resolver); (*variables)["capitalized_type"] = "String"; (*variables)["tag"] = - StrCat(static_cast<i32>(WireFormat::MakeTag(descriptor))); + StrCat(static_cast<arc_i32>(WireFormat::MakeTag(descriptor))); (*variables)["tag_size"] = StrCat( WireFormat::TagSize(descriptor->number(), GetType(descriptor))); (*variables)["null_check"] = diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_string_field_lite.cc b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_string_field_lite.cc index b448ae8930..42198cc266 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_string_field_lite.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_string_field_lite.cc @@ -74,7 +74,7 @@ void SetPrimitiveVariables(const FieldDescriptor* descriptor, "= " + ImmutableDefaultValue(descriptor, name_resolver); (*variables)["capitalized_type"] = "java.lang.String"; (*variables)["tag"] = - StrCat(static_cast<i32>(WireFormat::MakeTag(descriptor))); + StrCat(static_cast<arc_i32>(WireFormat::MakeTag(descriptor))); (*variables)["tag_size"] = StrCat( WireFormat::TagSize(descriptor->number(), GetType(descriptor))); // We use `x.getClass()` as a null check because it generates less bytecode |