Merge tag 'refs/tags/sync-piper' into sync-stage

# Conflicts:
#	src/google/protobuf/descriptor.pb.cc
#	src/google/protobuf/duration.pb.cc
#	src/google/protobuf/timestamp.pb.cc
#	src/google/protobuf/type.pb.cc
#	src/google/protobuf/wrappers.pb.cc
This commit is contained in:
Joshua Haberman 2021-09-09 08:23:12 -07:00
commit 018e2e7751
101 changed files with 2942 additions and 2192 deletions

View File

@ -5,6 +5,7 @@ set(libprotobuf_lite_files
${protobuf_source_dir}/src/google/protobuf/extension_set.cc
${protobuf_source_dir}/src/google/protobuf/generated_enum_util.cc
${protobuf_source_dir}/src/google/protobuf/generated_message_table_driven_lite.cc
${protobuf_source_dir}/src/google/protobuf/generated_message_tctable_lite.cc
${protobuf_source_dir}/src/google/protobuf/generated_message_util.cc
${protobuf_source_dir}/src/google/protobuf/implicit_weak_message.cc
${protobuf_source_dir}/src/google/protobuf/inlined_string_field.cc
@ -32,29 +33,54 @@ set(libprotobuf_lite_files
)
set(libprotobuf_lite_includes
${protobuf_source_dir}/src/google/protobuf/any.h
${protobuf_source_dir}/src/google/protobuf/arena.h
${protobuf_source_dir}/src/google/protobuf/arena_impl.h
${protobuf_source_dir}/src/google/protobuf/arenastring.h
${protobuf_source_dir}/src/google/protobuf/extension_set.h
${protobuf_source_dir}/src/google/protobuf/extension_set_inl.h
${protobuf_source_dir}/src/google/protobuf/generated_enum_util.h
${protobuf_source_dir}/src/google/protobuf/generated_message_table_driven.h
${protobuf_source_dir}/src/google/protobuf/generated_message_table_driven_lite.h
${protobuf_source_dir}/src/google/protobuf/generated_message_tctable_decl.h
${protobuf_source_dir}/src/google/protobuf/generated_message_tctable_impl.h
${protobuf_source_dir}/src/google/protobuf/generated_message_tctable_impl.inc
${protobuf_source_dir}/src/google/protobuf/generated_message_util.h
${protobuf_source_dir}/src/google/protobuf/has_bits.h
${protobuf_source_dir}/src/google/protobuf/implicit_weak_message.h
${protobuf_source_dir}/src/google/protobuf/inlined_string_field.h
${protobuf_source_dir}/src/google/protobuf/io/coded_stream.h
${protobuf_source_dir}/src/google/protobuf/io/io_win32.h
${protobuf_source_dir}/src/google/protobuf/io/strtod.h
${protobuf_source_dir}/src/google/protobuf/io/zero_copy_stream.h
${protobuf_source_dir}/src/google/protobuf/io/zero_copy_stream_impl.h
${protobuf_source_dir}/src/google/protobuf/io/zero_copy_stream_impl_lite.h
${protobuf_source_dir}/src/google/protobuf/map.h
${protobuf_source_dir}/src/google/protobuf/map_entry_lite.h
${protobuf_source_dir}/src/google/protobuf/map_field_lite.h
${protobuf_source_dir}/src/google/protobuf/map_type_handler.h
${protobuf_source_dir}/src/google/protobuf/message_lite.h
${protobuf_source_dir}/src/google/protobuf/metadata_lite.h
${protobuf_source_dir}/src/google/protobuf/parse_context.h
${protobuf_source_dir}/src/google/protobuf/port.h
${protobuf_source_dir}/src/google/protobuf/repeated_field.h
${protobuf_source_dir}/src/google/protobuf/stubs/bytestream.h
${protobuf_source_dir}/src/google/protobuf/stubs/callback.h
${protobuf_source_dir}/src/google/protobuf/stubs/casts.h
${protobuf_source_dir}/src/google/protobuf/stubs/common.h
${protobuf_source_dir}/src/google/protobuf/stubs/int128.h
${protobuf_source_dir}/src/google/protobuf/stubs/hash.h
${protobuf_source_dir}/src/google/protobuf/stubs/logging.h
${protobuf_source_dir}/src/google/protobuf/stubs/macros.h
${protobuf_source_dir}/src/google/protobuf/stubs/map_util.h
${protobuf_source_dir}/src/google/protobuf/stubs/mutex.h
${protobuf_source_dir}/src/google/protobuf/stubs/once.h
${protobuf_source_dir}/src/google/protobuf/stubs/platform_macros.h
${protobuf_source_dir}/src/google/protobuf/stubs/port.h
${protobuf_source_dir}/src/google/protobuf/stubs/status.h
${protobuf_source_dir}/src/google/protobuf/stubs/statusor.h
${protobuf_source_dir}/src/google/protobuf/stubs/stl_util.h
${protobuf_source_dir}/src/google/protobuf/stubs/stringpiece.h
${protobuf_source_dir}/src/google/protobuf/stubs/stringprintf.h
${protobuf_source_dir}/src/google/protobuf/stubs/strutil.h
${protobuf_source_dir}/src/google/protobuf/stubs/time.h
${protobuf_source_dir}/src/google/protobuf/stubs/template_util.h
${protobuf_source_dir}/src/google/protobuf/wire_format_lite.h
)

View File

@ -15,11 +15,13 @@ set(libprotobuf_files
${protobuf_source_dir}/src/google/protobuf/generated_message_bases.cc
${protobuf_source_dir}/src/google/protobuf/generated_message_reflection.cc
${protobuf_source_dir}/src/google/protobuf/generated_message_table_driven.cc
${protobuf_source_dir}/src/google/protobuf/generated_message_tctable_full.cc
${protobuf_source_dir}/src/google/protobuf/io/gzip_stream.cc
${protobuf_source_dir}/src/google/protobuf/io/printer.cc
${protobuf_source_dir}/src/google/protobuf/io/tokenizer.cc
${protobuf_source_dir}/src/google/protobuf/map_field.cc
${protobuf_source_dir}/src/google/protobuf/message.cc
${protobuf_source_dir}/src/google/protobuf/reflection_internal.h
${protobuf_source_dir}/src/google/protobuf/reflection_ops.cc
${protobuf_source_dir}/src/google/protobuf/service.cc
${protobuf_source_dir}/src/google/protobuf/source_context.pb.cc
@ -44,7 +46,6 @@ set(libprotobuf_files
${protobuf_source_dir}/src/google/protobuf/util/internal/protostream_objectsource.cc
${protobuf_source_dir}/src/google/protobuf/util/internal/protostream_objectwriter.cc
${protobuf_source_dir}/src/google/protobuf/util/internal/type_info.cc
${protobuf_source_dir}/src/google/protobuf/util/internal/type_info_test_helper.cc
${protobuf_source_dir}/src/google/protobuf/util/internal/utility.cc
${protobuf_source_dir}/src/google/protobuf/util/json_util.cc
${protobuf_source_dir}/src/google/protobuf/util/message_differencer.cc
@ -55,7 +56,6 @@ set(libprotobuf_files
)
set(libprotobuf_includes
${protobuf_source_dir}/src/google/protobuf/any.h
${protobuf_source_dir}/src/google/protobuf/any.pb.h
${protobuf_source_dir}/src/google/protobuf/api.pb.h
${protobuf_source_dir}/src/google/protobuf/compiler/importer.h
@ -68,18 +68,22 @@ set(libprotobuf_includes
${protobuf_source_dir}/src/google/protobuf/empty.pb.h
${protobuf_source_dir}/src/google/protobuf/field_access_listener.h
${protobuf_source_dir}/src/google/protobuf/field_mask.pb.h
${protobuf_source_dir}/src/google/protobuf/generated_enum_reflection.h
${protobuf_source_dir}/src/google/protobuf/generated_message_bases.h
${protobuf_source_dir}/src/google/protobuf/generated_message_reflection.h
${protobuf_source_dir}/src/google/protobuf/io/gzip_stream.h
${protobuf_source_dir}/src/google/protobuf/io/printer.h
${protobuf_source_dir}/src/google/protobuf/io/tokenizer.h
${protobuf_source_dir}/src/google/protobuf/map_entry.h
${protobuf_source_dir}/src/google/protobuf/map_field.h
${protobuf_source_dir}/src/google/protobuf/map_field_inl.h
${protobuf_source_dir}/src/google/protobuf/message.h
${protobuf_source_dir}/src/google/protobuf/metadata.h
${protobuf_source_dir}/src/google/protobuf/reflection.h
${protobuf_source_dir}/src/google/protobuf/reflection_ops.h
${protobuf_source_dir}/src/google/protobuf/service.h
${protobuf_source_dir}/src/google/protobuf/source_context.pb.h
${protobuf_source_dir}/src/google/protobuf/struct.pb.h
${protobuf_source_dir}/src/google/protobuf/stubs/substitute.h
${protobuf_source_dir}/src/google/protobuf/text_format.h
${protobuf_source_dir}/src/google/protobuf/timestamp.pb.h
${protobuf_source_dir}/src/google/protobuf/type.pb.h
@ -87,23 +91,10 @@ set(libprotobuf_includes
${protobuf_source_dir}/src/google/protobuf/util/delimited_message_util.h
${protobuf_source_dir}/src/google/protobuf/util/field_comparator.h
${protobuf_source_dir}/src/google/protobuf/util/field_mask_util.h
${protobuf_source_dir}/src/google/protobuf/util/internal/datapiece.h
${protobuf_source_dir}/src/google/protobuf/util/internal/default_value_objectwriter.h
${protobuf_source_dir}/src/google/protobuf/util/internal/error_listener.h
${protobuf_source_dir}/src/google/protobuf/util/internal/field_mask_utility.h
${protobuf_source_dir}/src/google/protobuf/util/internal/json_escaping.h
${protobuf_source_dir}/src/google/protobuf/util/internal/json_objectwriter.h
${protobuf_source_dir}/src/google/protobuf/util/internal/json_stream_parser.h
${protobuf_source_dir}/src/google/protobuf/util/internal/object_writer.h
${protobuf_source_dir}/src/google/protobuf/util/internal/proto_writer.h
${protobuf_source_dir}/src/google/protobuf/util/internal/protostream_objectsource.h
${protobuf_source_dir}/src/google/protobuf/util/internal/protostream_objectwriter.h
${protobuf_source_dir}/src/google/protobuf/util/internal/type_info.h
${protobuf_source_dir}/src/google/protobuf/util/internal/type_info_test_helper.h
${protobuf_source_dir}/src/google/protobuf/util/internal/utility.h
${protobuf_source_dir}/src/google/protobuf/util/json_util.h
${protobuf_source_dir}/src/google/protobuf/util/message_differencer.h
${protobuf_source_dir}/src/google/protobuf/util/time_util.h
${protobuf_source_dir}/src/google/protobuf/util/type_resolver.h
${protobuf_source_dir}/src/google/protobuf/util/type_resolver_util.h
${protobuf_source_dir}/src/google/protobuf/wire_format.h
${protobuf_source_dir}/src/google/protobuf/wrappers.pb.h

View File

@ -36,6 +36,7 @@ set(libprotoc_files
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_doc_comment.cc
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_enum.cc
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_enum_field.cc
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_enum_field.h
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_enum_field_lite.cc
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_enum_lite.cc
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_extension.cc
@ -64,17 +65,28 @@ set(libprotoc_files
${protobuf_source_dir}/src/google/protobuf/compiler/js/js_generator.cc
${protobuf_source_dir}/src/google/protobuf/compiler/js/well_known_types_embed.cc
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_enum.cc
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_enum.h
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_enum_field.cc
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_enum_field.h
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_extension.cc
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_extension.h
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_field.cc
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_field.h
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_file.cc
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_file.h
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_generator.cc
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_map_field.cc
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_map_field.h
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_message.cc
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_message.h
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_message_field.cc
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_message_field.h
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_nsobject_methods.h
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_oneof.cc
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_oneof.h
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.cc
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.h
${protobuf_source_dir}/src/google/protobuf/compiler/php/php_generator.cc
${protobuf_source_dir}/src/google/protobuf/compiler/plugin.cc
${protobuf_source_dir}/src/google/protobuf/compiler/plugin.pb.cc
@ -82,85 +94,30 @@ set(libprotoc_files
${protobuf_source_dir}/src/google/protobuf/compiler/ruby/ruby_generator.cc
${protobuf_source_dir}/src/google/protobuf/compiler/subprocess.cc
${protobuf_source_dir}/src/google/protobuf/compiler/zip_writer.cc
${protobuf_source_dir}/src/google/protobuf/compiler/zip_writer.h
)
set(libprotoc_headers
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_enum.h
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_enum_field.h
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_extension.h
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_field.h
${protobuf_source_dir}/src/google/protobuf/compiler/code_generator.h
${protobuf_source_dir}/src/google/protobuf/compiler/command_line_interface.h
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_file.h
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_generator.h
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_helpers.h
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_map_field.h
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_message.h
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_message_field.h
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_message_layout_helper.h
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_names.h
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_options.h
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_padding_optimizer.h
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_parse_function_generator.h
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_primitive_field.h
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_service.h
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_string_field.h
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_doc_comment.h
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_enum.h
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_enum_field.h
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_field_base.h
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_helpers.h
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_map_field.h
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_message.h
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_message_field.h
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_generator.h
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_names.h
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_options.h
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_primitive_field.h
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_reflection_class.h
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.h
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.h
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.h
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_source_generator_base.h
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_wrapper_field.h
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_context.h
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_doc_comment.h
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_enum.h
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_enum_field.h
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_enum_field_lite.h
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_enum_lite.h
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_extension.h
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_extension_lite.h
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_field.h
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_file.h
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_generator_factory.h
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_helpers.h
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_map_field.h
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_map_field_lite.h
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message.h
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message_builder.h
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message_builder_lite.h
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message_field.h
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message_field_lite.h
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message_lite.h
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_name_resolver.h
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_options.h
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_primitive_field.h
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_primitive_field_lite.h
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_service.h
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_shared_code_generator.h
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_string_field.h
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_string_field_lite.h
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_enum.h
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_enum_field.h
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_extension.h
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_field.h
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_file.h
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_generator.h
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_kotlin_generator.h
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_names.h
${protobuf_source_dir}/src/google/protobuf/compiler/js/js_generator.h
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_generator.h
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_helpers.h
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_map_field.h
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_message.h
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_message_field.h
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_nsobject_methods.h
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_oneof.h
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.h
${protobuf_source_dir}/src/google/protobuf/compiler/scc.h
${protobuf_source_dir}/src/google/protobuf/compiler/subprocess.h
${protobuf_source_dir}/src/google/protobuf/compiler/zip_writer.h
${protobuf_source_dir}/src/google/protobuf/compiler/php/php_generator.h
${protobuf_source_dir}/src/google/protobuf/compiler/plugin.h
${protobuf_source_dir}/src/google/protobuf/compiler/python/python_generator.h
${protobuf_source_dir}/src/google/protobuf/compiler/ruby/ruby_generator.h
)
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
@ -183,4 +140,3 @@ set_target_properties(libprotoc PROPERTIES
OUTPUT_NAME ${LIB_PREFIX}protoc
DEBUG_POSTFIX "${protobuf_DEBUG_POSTFIX}")
add_library(protobuf::libprotoc ALIAS libprotoc)

View File

@ -111,27 +111,28 @@ foreach(proto_file ${tests_protos})
${protobuf_source_dir}/src/${pb_file})
endforeach(proto_file)
set(common_test_files
${protobuf_source_dir}/src/google/protobuf/arena_test_util.cc
${protobuf_source_dir}/src/google/protobuf/map_test_util.inc
${protobuf_source_dir}/src/google/protobuf/reflection_tester.cc
${protobuf_source_dir}/src/google/protobuf/test_util.cc
${protobuf_source_dir}/src/google/protobuf/test_util.inc
${protobuf_source_dir}/src/google/protobuf/testing/file.cc
${protobuf_source_dir}/src/google/protobuf/testing/googletest.cc
)
set(common_lite_test_files
${protobuf_source_dir}/src/google/protobuf/arena_test_util.cc
${protobuf_source_dir}/src/google/protobuf/map_lite_test_util.cc
${protobuf_source_dir}/src/google/protobuf/test_util_lite.cc
)
set(common_test_files
${common_lite_test_files}
${protobuf_source_dir}/src/google/protobuf/compiler/mock_code_generator.cc
${protobuf_source_dir}/src/google/protobuf/map_test_util.inc
${protobuf_source_dir}/src/google/protobuf/reflection_tester.cc
${protobuf_source_dir}/src/google/protobuf/test_util.cc
${protobuf_source_dir}/src/google/protobuf/testing/file.cc
${protobuf_source_dir}/src/google/protobuf/testing/googletest.cc
)
set(tests_files
${protobuf_source_dir}/src/google/protobuf/any_test.cc
${protobuf_source_dir}/src/google/protobuf/arena_unittest.cc
${protobuf_source_dir}/src/google/protobuf/arenastring_unittest.cc
${protobuf_source_dir}/src/google/protobuf/compiler/annotation_test_util.cc
${protobuf_source_dir}/src/google/protobuf/compiler/annotation_test_util.h
${protobuf_source_dir}/src/google/protobuf/compiler/command_line_interface_unittest.cc
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_move_unittest.cc
@ -144,7 +145,6 @@ set(tests_files
${protobuf_source_dir}/src/google/protobuf/compiler/importer_unittest.cc
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_doc_comment_unittest.cc
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_plugin_unittest.cc
${protobuf_source_dir}/src/google/protobuf/compiler/mock_code_generator.cc
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_helpers_unittest.cc
${protobuf_source_dir}/src/google/protobuf/compiler/parser_unittest.cc
${protobuf_source_dir}/src/google/protobuf/compiler/python/python_plugin_unittest.cc

View File

@ -95,7 +95,7 @@ message ConformanceRequest {
//
// TODO(haberman): if/when we expand the conformance tests to support proto2,
// we will want to include a field that lets the payload/response be a
// protobuf_test_messages.proto2.TestAllTypes message instead.
// protobuf_test_messages.google.protobuf.TestAllTypes message instead.
oneof payload {
bytes protobuf_payload = 1;
string json_payload = 2;
@ -109,7 +109,7 @@ message ConformanceRequest {
// The full name for the test message to use; for the moment, either:
// protobuf_test_messages.proto3.TestAllTypesProto3 or
// protobuf_test_messages.proto2.TestAllTypesProto2.
// protobuf_test_messages.google.protobuf.TestAllTypesProto2.
string message_type = 4;
// Each test is given a specific test category. Some category may need

30
conformance/conformance_nodejs.js Executable file → Normal file
View File

@ -1,3 +1,33 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
// https://developers.google.com/protocol-buffers/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#!/usr/bin/env node
/*

View File

@ -7,7 +7,3 @@ Required.Proto3.TextFormatInput.AnyField.TextFormatOutput
Required.Proto3.TextFormatInput.StringFieldBadUTF8Hex
Required.Proto3.TextFormatInput.StringFieldBadUTF8Octal
Required.Proto3.TextFormatInput.StringLiteralBasicEscapesBytes.ProtobufOutput
Required.Proto3.TextFormatInput.StringLiteralBasicEscapesBytes.TextFormatOutput
Required.Proto3.TextFormatInput.StringLiteralBasicEscapesString.ProtobufOutput
Required.Proto3.TextFormatInput.StringLiteralBasicEscapesString.TextFormatOutput

View File

@ -427,7 +427,7 @@ namespace Conformance {
/// <summary>
/// The full name for the test message to use; for the moment, either:
/// protobuf_test_messages.proto3.TestAllTypesProto3 or
/// protobuf_test_messages.proto2.TestAllTypesProto2.
/// protobuf_test_messages.google.protobuf.TestAllTypesProto2.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]

View File

@ -261,8 +261,8 @@ namespace Google.Protobuf.WellKnownTypes {
/// <summary>
/// `Value` represents a dynamically typed value which can be either
/// null, a number, a string, a boolean, a recursive struct value, or a
/// list of values. A producer of value is expected to set one of that
/// variants, absence of any variant indicates an error.
/// list of values. A producer of value is expected to set one of these
/// variants. Absence of any variant indicates an error.
///
/// The JSON representation for `Value` is JSON value.
/// </summary>

View File

@ -480,7 +480,8 @@ public abstract class ByteString implements Iterable<Byte>, Serializable {
* @param streamToDrain The source stream, which is read completely but not closed.
* @return A new {@code ByteString} which is made up of chunks of various sizes, depending on the
* behavior of the underlying stream.
* @throws IOException IOException is thrown if there is a problem reading the underlying stream.
* @throws IOException if there is a problem reading the underlying stream
* @throws IllegalArgumentException if the stream supplies more than Integer.MAX_VALUE bytes
*/
public static ByteString readFrom(InputStream streamToDrain) throws IOException {
return readFrom(streamToDrain, MIN_READ_FROM_CHUNK_SIZE, MAX_READ_FROM_CHUNK_SIZE);
@ -500,13 +501,23 @@ public abstract class ByteString implements Iterable<Byte>, Serializable {
* @param streamToDrain The source stream, which is read completely but not closed.
* @param chunkSize The size of the chunks in which to read the stream.
* @return A new {@code ByteString} which is made up of chunks of the given size.
* @throws IOException IOException is thrown if there is a problem reading the underlying stream.
* @throws IOException if there is a problem reading the underlying stream
* @throws IllegalArgumentException if the stream supplies more than Integer.MAX_VALUE bytes
*/
public static ByteString readFrom(InputStream streamToDrain, int chunkSize) throws IOException {
return readFrom(streamToDrain, chunkSize, chunkSize);
}
// Helper method that takes the chunk size range as a parameter.
/**
* Helper method that takes the chunk size range as a parameter.
*
* @param streamToDrain the source stream, which is read completely but not closed
* @param minChunkSize the minimum size of the chunks in which to read the stream
* @param maxChunkSize the maximum size of the chunks in which to read the stream
* @return a new {@code ByteString} which is made up of chunks within the given size range
* @throws IOException if there is a problem reading the underlying stream
* @throws IllegalArgumentException if the stream supplies more than Integer.MAX_VALUE bytes
*/
public static ByteString readFrom(InputStream streamToDrain, int minChunkSize, int maxChunkSize)
throws IOException {
Collection<ByteString> results = new ArrayList<ByteString>();
@ -565,6 +576,8 @@ public abstract class ByteString implements Iterable<Byte>, Serializable {
*
* @param other string to concatenate
* @return a new {@code ByteString} instance
* @throws IllegalArgumentException if the combined size of the two byte strings exceeds
* Integer.MAX_VALUE
*/
public final ByteString concat(ByteString other) {
if (Integer.MAX_VALUE - size() < other.size()) {
@ -585,6 +598,8 @@ public abstract class ByteString implements Iterable<Byte>, Serializable {
*
* @param byteStrings strings to be concatenated
* @return new {@code ByteString}
* @throws IllegalArgumentException if the combined size of the byte strings exceeds
* Integer.MAX_VALUE
*/
public static ByteString copyFrom(Iterable<ByteString> byteStrings) {
// Determine the size;

View File

@ -2013,20 +2013,20 @@ public abstract class CodedInputStream {
private ByteBuffer slice(long begin, long end) throws IOException {
int prevPos = buffer.position();
int prevLimit = buffer.limit();
// View ByteBuffer as Buffer to avoid cross-Java version issues.
// See https://issues.apache.org/jira/browse/MRESOLVER-85
Buffer asBuffer = buffer;
try {
// Casts to Buffer here are required for Java 8 compatibility
// no matter what tricorder tells you. see
// https://issues.apache.org/jira/browse/MRESOLVER-85
((Buffer) buffer).position(bufferPos(begin));
((Buffer) buffer).limit(bufferPos(end));
asBuffer.position(bufferPos(begin));
asBuffer.limit(bufferPos(end));
return buffer.slice();
} catch (IllegalArgumentException e) {
InvalidProtocolBufferException ex = InvalidProtocolBufferException.truncatedMessage();
ex.initCause(e);
throw ex;
} finally {
((Buffer) buffer).position(prevPos);
((Buffer) buffer).limit(prevLimit);
asBuffer.position(prevPos);
asBuffer.limit(prevLimit);
}
}
}
@ -3963,18 +3963,18 @@ public abstract class CodedInputStream {
private ByteBuffer slice(int begin, int end) throws IOException {
int prevPos = currentByteBuffer.position();
int prevLimit = currentByteBuffer.limit();
// View ByteBuffer as Buffer to avoid cross-Java version issues.
// See https://issues.apache.org/jira/browse/MRESOLVER-85
Buffer asBuffer = currentByteBuffer;
try {
// casts to Buffer here are required for Java 8 compatibility
// no matter what tricorder tells you. see
// https://issues.apache.org/jira/browse/MRESOLVER-85
((Buffer) currentByteBuffer).position(begin);
((Buffer) currentByteBuffer).limit(end);
asBuffer.position(begin);
asBuffer.limit(end);
return currentByteBuffer.slice();
} catch (IllegalArgumentException e) {
throw InvalidProtocolBufferException.truncatedMessage();
} finally {
((Buffer) currentByteBuffer).position(prevPos);
((Buffer) currentByteBuffer).limit(prevLimit);
asBuffer.position(prevPos);
asBuffer.limit(prevLimit);
}
}
}

View File

@ -693,7 +693,7 @@ public abstract class CodedOutputStream extends ByteOutput {
}
/**
* Compute the number of bytes that would be needed to encode an lazily parsed MessageSet
* Compute the number of bytes that would be needed to encode a lazily parsed MessageSet
* extension field to the stream. For historical reasons, the wire format differs from normal
* fields.
*/

View File

@ -41,14 +41,14 @@ import com.google.protobuf.Internal.DoubleList;
import com.google.protobuf.Internal.FloatList;
import com.google.protobuf.Internal.IntList;
import com.google.protobuf.Internal.LongList;
// In opensource protobuf, we have versioned this GeneratedMessageV3 class to GeneratedMessageV3V3 and
// in the future may have GeneratedMessageV3V4 etc. This allows us to change some aspects of this
// In opensource protobuf, we have versioned this GeneratedMessageV3 class to GeneratedMessageV3 and
// in the future may have GeneratedMessageV4 etc. This allows us to change some aspects of this
// class without breaking binary compatibility with old generated code that still subclasses
// the old GeneratedMessageV3 class. To allow these different GeneratedMessageV3V? classes to
// interoperate (e.g., a GeneratedMessageV3V3 object has a message extension field whose class
// type is GeneratedMessageV3V4), these classes still share a common parent class AbstractMessage
// the old GeneratedMessageV3 class. To allow these different GeneratedMessageV? classes to
// interoperate (e.g., a GeneratedMessageV3 object has a message extension field whose class
// type is GeneratedMessageV4), these classes still share a common parent class AbstractMessage
// and are using the same GeneratedMessage.GeneratedExtension class for extension definitions.
// Since this class becomes GeneratedMessageV3V? in opensource, we have to add an import here
// Since this class becomes GeneratedMessageV? in opensource, we have to add an import here
// to be able to use GeneratedMessage.GeneratedExtension. The GeneratedExtension definition in
// this file is also excluded from opensource to avoid conflict.
import com.google.protobuf.GeneratedMessage.GeneratedExtension;

View File

@ -63,7 +63,7 @@ public final class MapFieldLite<K, V> extends LinkedHashMap<K, V> {
EMPTY_MAP_FIELD.makeImmutable();
}
/** Returns an singleton immutable empty MapFieldLite instance. */
/** Returns a singleton immutable empty MapFieldLite instance. */
@SuppressWarnings({"unchecked", "cast"})
public static <K, V> MapFieldLite<K, V> emptyMapField() {
return (MapFieldLite<K, V>) EMPTY_MAP_FIELD;

View File

@ -73,6 +73,9 @@ public interface MessageLite extends MessageLiteOrBuilder {
/**
* Get the number of bytes required to encode this message. The result is only computed on the
* first call and memoized after that.
*
* If this message requires more than Integer.MAX_VALUE bytes to encode, the return value will
* be smaller than the actual number of bytes required and might be negative.
*/
int getSerializedSize();
@ -85,12 +88,18 @@ public interface MessageLite extends MessageLiteOrBuilder {
/**
* Serializes the message to a {@code ByteString} and returns it. This is just a trivial wrapper
* around {@link #writeTo(CodedOutputStream)}.
*
* If this message requires more than Integer.MAX_VALUE bytes to encode, the behavior is
* unpredictable. It may throw a runtime exception or truncate or slice the data.
*/
ByteString toByteString();
/**
* Serializes the message to a {@code byte} array and returns it. This is just a trivial wrapper
* around {@link #writeTo(CodedOutputStream)}.
*
* If this message requires more than Integer.MAX_VALUE bytes to encode, the behavior is
* unpredictable. It may throw a runtime exception or truncate or slice the data.
*/
byte[] toByteArray();

View File

@ -63,7 +63,7 @@ final class SchemaUtil {
&& GENERATED_MESSAGE_CLASS != null
&& !GENERATED_MESSAGE_CLASS.isAssignableFrom(messageType)) {
throw new IllegalArgumentException(
"Message classes must extend GeneratedMessage or GeneratedMessageLite");
"Message classes must extend GeneratedMessageV3 or GeneratedMessageLite");
}
}

View File

@ -445,9 +445,12 @@ public final class TextFormat {
}
/**
* An adapter class that can take a MapEntry or a MutableMapEntry and returns its key and entry.
* This class is created solely for the purpose of sorting map entries by its key and prevent
* duplicated logic by having a separate comparator for MapEntry and MutableMapEntry.
* An adapter class that can take a {@link MapEntry} and returns its key and entry.
* BEGIN GOOGLE-INTERNAL
* This class is created solely for the purpose of sorting map entries by its
* key and prevent duplicated logic by having a separate comparator for {@link MapEntry} and
* {@link MutableMapEntry}.
* END GOOGLE-INTERNAL
*/
private static class MapEntryAdapter implements Comparable<MapEntryAdapter> {
private Object entry;
@ -2360,6 +2363,9 @@ public final class TextFormat {
case '"':
result[pos++] = '\"';
break;
case '?':
result[pos++] = '?';
break;
case 'x':
// hex escape

View File

@ -184,7 +184,7 @@ public class RepeatedFieldBuilderV3Test {
}
private RepeatedFieldBuilderV3<TestAllTypes, TestAllTypes.Builder, TestAllTypesOrBuilder>
newRepeatedFieldBuilderV3(GeneratedMessage.BuilderParent parent) {
newRepeatedFieldBuilderV3(AbstractMessage.BuilderParent parent) {
return new RepeatedFieldBuilderV3<TestAllTypes, TestAllTypes.Builder, TestAllTypesOrBuilder>(
Collections.<TestAllTypes>emptyList(), false, parent, false);
}

View File

@ -3815,8 +3815,7 @@ public final class TestUtil {
private static ByteString readBytesFromResource(String name) {
try {
return ByteString.copyFrom(
com.google.common.io.ByteStreams.toByteArray(TestUtil.class.getResourceAsStream(name)));
return ByteString.readFrom(TestUtil.class.getResourceAsStream(name));
} catch (IOException e) {
throw new RuntimeException(e);
}

View File

@ -34,6 +34,7 @@ import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth.assertWithMessage;
import static com.google.protobuf.TestUtil.TEST_REQUIRED_INITIALIZED;
import static com.google.protobuf.TestUtil.TEST_REQUIRED_UNINITIALIZED;
import static org.junit.Assert.assertThrows;
import com.google.protobuf.DescriptorProtos.DescriptorProto;
import com.google.protobuf.DescriptorProtos.FieldDescriptorProto;
@ -41,6 +42,7 @@ import com.google.protobuf.DescriptorProtos.FileDescriptorProto;
import com.google.protobuf.Descriptors.Descriptor;
import com.google.protobuf.Descriptors.FieldDescriptor;
import com.google.protobuf.Descriptors.FileDescriptor;
import com.google.protobuf.TextFormat.InvalidEscapeSequenceException;
import com.google.protobuf.TextFormat.Parser.SingularOverwritePolicy;
import com.google.protobuf.testing.proto.TestProto3Optional;
import com.google.protobuf.testing.proto.TestProto3Optional.NestedEnum;
@ -61,6 +63,7 @@ import java.util.Arrays;
import java.util.List;
import java.util.logging.Logger;
import org.junit.Test;
import org.junit.function.ThrowingRunnable;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
@ -596,9 +599,7 @@ public class TextFormatTest {
.setPackage("google.protobuf")
.setSyntax("proto3")
.addMessageType(
DescriptorProto.newBuilder()
.setName("Any")
.addAllField(Arrays.asList(fields)))
DescriptorProto.newBuilder().setName("Any").addAllField(Arrays.asList(fields)))
.build(),
new FileDescriptor[0]);
return fileDescriptor.getMessageTypes().get(0);
@ -874,6 +875,11 @@ public class TextFormatTest {
}
// =================================================================
@Test
public void testEscapeQuestionMark() throws InvalidEscapeSequenceException {
assertThat(TextFormat.unescapeText("?")).isEqualTo("?");
assertThat(TextFormat.unescapeText("\\?")).isEqualTo("?");
}
@Test
public void testEscape() throws Exception {
@ -1231,6 +1237,36 @@ public class TextFormatTest {
assertThat(sb.toString()).isEqualTo(expect);
}
@Test
public void testPrintFieldValueThrows() throws Exception {
assertPrintFieldThrowsClassCastException(5, "repeated_string");
assertPrintFieldThrowsClassCastException(5L, "repeated_string");
assertPrintFieldThrowsClassCastException(ByteString.EMPTY, "repeated_string");
assertPrintFieldThrowsClassCastException(5, "repeated_float");
assertPrintFieldThrowsClassCastException(5D, "repeated_float");
assertPrintFieldThrowsClassCastException("text", "repeated_float");
assertPrintFieldThrowsClassCastException(5, "repeated_double");
assertPrintFieldThrowsClassCastException(5F, "repeated_double");
assertPrintFieldThrowsClassCastException("text", "repeated_double");
assertPrintFieldThrowsClassCastException(123L, "repeated_int32");
assertPrintFieldThrowsClassCastException(123, "repeated_int64");
assertPrintFieldThrowsClassCastException(1, "repeated_bytes");
}
private void assertPrintFieldThrowsClassCastException(final Object value, String fieldName)
throws Exception {
final StringBuilder stringBuilder = new StringBuilder();
final FieldDescriptor fieldDescriptor = TestAllTypes.getDescriptor().findFieldByName(fieldName);
assertThrows(
ClassCastException.class,
new ThrowingRunnable() {
@Override
public void run() throws Throwable {
TextFormat.printer().printFieldValue(fieldDescriptor, value, stringBuilder);
}
});
}
@Test
public void testShortDebugString() {
assertThat(

View File

@ -30,7 +30,7 @@
syntax = "proto3";
package map_lite_test;
package map_test;
option optimize_for = LITE_RUNTIME;
option java_package = "map_lite_test";

View File

@ -128,8 +128,8 @@ typedef GPB_ENUM(GPBValue_Kind_OneOfCase) {
/**
* `Value` represents a dynamically typed value which can be either
* null, a number, a string, a boolean, a recursive struct value, or a
* list of values. A producer of value is expected to set one of that
* variants, absence of any variant indicates an error.
* list of values. A producer of value is expected to set one of these
* variants. Absence of any variant indicates an error.
*
* The JSON representation for `Value` is JSON value.
**/

View File

@ -11,8 +11,8 @@ use Google\Protobuf\Internal\GPBUtil;
/**
* `Value` represents a dynamically typed value which can be either
* null, a number, a string, a boolean, a recursive struct value, or a
* list of values. A producer of value is expected to set one of that
* variants, absence of any variant indicates an error.
* list of values. A producer of value is expected to set one of these
* variants. Absence of any variant indicates an error.
* The JSON representation for `Value` is JSON value.
*
* Generated from protobuf message <code>google.protobuf.Value</code>

View File

@ -36,7 +36,6 @@ __author__ = 'robinson@google.com (Will Robinson)'
import threading
import warnings
import six
from google.protobuf.internal import api_implementation
@ -111,7 +110,7 @@ _Deprecated.count = 100
_internal_create_key = object()
class DescriptorBase(six.with_metaclass(DescriptorMetaclass)):
class DescriptorBase(metaclass=DescriptorMetaclass):
"""Descriptors base class.

View File

@ -207,13 +207,18 @@ class DescriptorPool(object):
Args:
serialized_file_desc_proto (bytes): A bytes string, serialization of the
:class:`FileDescriptorProto` to add.
Returns:
FileDescriptor: Descriptor for the added file.
"""
# pylint: disable=g-import-not-at-top
from google.protobuf import descriptor_pb2
file_desc_proto = descriptor_pb2.FileDescriptorProto.FromString(
serialized_file_desc_proto)
self.Add(file_desc_proto)
file_desc = self._ConvertFileProtoToFileDescriptor(file_desc_proto)
file_desc.serialized_pb = serialized_file_desc_proto
return file_desc
# Add Descriptor to descriptor pool is dreprecated. Please use Add()
# or AddSerializedFile() to add a FileDescriptorProto instead.
@ -808,7 +813,6 @@ class DescriptorPool(object):
self._MakeServiceDescriptor(service_proto, index, scope,
file_proto.package, file_descriptor))
self.Add(file_proto)
self._file_descriptors[file_proto.name] = file_descriptor
# Add extensions to the pool
@ -865,11 +869,17 @@ class DescriptorPool(object):
for index, extension in enumerate(desc_proto.extension)]
oneofs = [
# pylint: disable=g-complex-comprehension
descriptor.OneofDescriptor(desc.name, '.'.join((desc_name, desc.name)),
index, None, [], desc.options,
# pylint: disable=protected-access
create_key=descriptor._internal_create_key)
for index, desc in enumerate(desc_proto.oneof_decl)]
descriptor.OneofDescriptor(
desc.name,
'.'.join((desc_name, desc.name)),
index,
None,
[],
_OptionsOrNone(desc),
# pylint: disable=protected-access
create_key=descriptor._internal_create_key)
for index, desc in enumerate(desc_proto.oneof_decl)
]
extension_ranges = [(r.start, r.end) for r in desc_proto.extension_range]
if extension_ranges:
is_extendable = True
@ -987,6 +997,11 @@ class DescriptorPool(object):
else:
full_name = field_proto.name
if field_proto.json_name:
json_name = field_proto.json_name
else:
json_name = None
return descriptor.FieldDescriptor(
name=field_proto.name,
full_name=full_name,
@ -1003,6 +1018,7 @@ class DescriptorPool(object):
is_extension=is_extension,
extension_scope=None,
options=_OptionsOrNone(field_proto),
json_name=json_name,
file=file_desc,
# pylint: disable=protected-access
create_key=descriptor._internal_create_key)
@ -1107,6 +1123,8 @@ class DescriptorPool(object):
field_desc.default_value = b''
elif field_proto.type == descriptor.FieldDescriptor.TYPE_MESSAGE:
field_desc.default_value = None
elif field_proto.type == descriptor.FieldDescriptor.TYPE_GROUP:
field_desc.default_value = None
else:
# All other types are of the "int" type.
field_desc.default_value = 0

View File

@ -1,30 +0,0 @@
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# https://developers.google.com/protocol-buffers/
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# * Neither the name of Google Inc. nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@ -80,16 +80,8 @@ we repeatedly read a tag, look up the corresponding decoder, and invoke it.
__author__ = 'kenton@google.com (Kenton Varda)'
import math
import struct
import sys
import six
_UCS2_MAXUNICODE = 65535
if six.PY3:
long = int
else:
import re # pylint: disable=g-import-not-at-top
_SURROGATE_PATTERN = re.compile(six.u(r'[\ud800-\udfff]'))
from google.protobuf.internal import containers
from google.protobuf.internal import encoder
@ -97,13 +89,6 @@ from google.protobuf.internal import wire_format
from google.protobuf import message
# This will overflow and thus become IEEE-754 "infinity". We would use
# "float('inf')" but it doesn't work on Windows pre-Python-2.6.
_POS_INF = 1e10000
_NEG_INF = -_POS_INF
_NAN = _POS_INF * 0
# This is not for optimization, but rather to avoid conflicts with local
# variables named "message".
_DecodeError = message.DecodeError
@ -123,7 +108,7 @@ def _VarintDecoder(mask, result_type):
result = 0
shift = 0
while 1:
b = six.indexbytes(buffer, pos)
b = buffer[pos]
result |= ((b & 0x7f) << shift)
pos += 1
if not (b & 0x80):
@ -146,7 +131,7 @@ def _SignedVarintDecoder(bits, result_type):
result = 0
shift = 0
while 1:
b = six.indexbytes(buffer, pos)
b = buffer[pos]
result |= ((b & 0x7f) << shift)
pos += 1
if not (b & 0x80):
@ -159,12 +144,9 @@ def _SignedVarintDecoder(bits, result_type):
raise _DecodeError('Too many bytes when decoding varint.')
return DecodeVarint
# We force 32-bit values to int and 64-bit values to long to make
# alternate implementations where the distinction is more significant
# (e.g. the C++ implementation) simpler.
_DecodeVarint = _VarintDecoder((1 << 64) - 1, long)
_DecodeSignedVarint = _SignedVarintDecoder(64, long)
# All 32-bit and 64-bit values are represented as int.
_DecodeVarint = _VarintDecoder((1 << 64) - 1, int)
_DecodeSignedVarint = _SignedVarintDecoder(64, int)
# Use these versions for values which must be limited to 32 bits.
_DecodeVarint32 = _VarintDecoder((1 << 32) - 1, int)
@ -189,7 +171,7 @@ def ReadTag(buffer, pos):
Tuple[bytes, int] of the tag data and new position.
"""
start = pos
while six.indexbytes(buffer, pos) & 0x80:
while buffer[pos] & 0x80:
pos += 1
pos += 1
@ -333,11 +315,11 @@ def _FloatDecoder():
if (float_bytes[3:4] in b'\x7F\xFF' and float_bytes[2:3] >= b'\x80'):
# If at least one significand bit is set...
if float_bytes[0:3] != b'\x00\x00\x80':
return (_NAN, new_pos)
return (math.nan, new_pos)
# If sign bit is set...
if float_bytes[3:4] == b'\xFF':
return (_NEG_INF, new_pos)
return (_POS_INF, new_pos)
return (-math.inf, new_pos)
return (math.inf, new_pos)
# Note that we expect someone up-stack to catch struct.error and convert
# it to _DecodeError -- this way we don't have to set up exception-
@ -377,7 +359,7 @@ def _DoubleDecoder():
if ((double_bytes[7:8] in b'\x7F\xFF')
and (double_bytes[6:7] >= b'\xF0')
and (double_bytes[0:7] != b'\x00\x00\x00\x00\x00\x00\xF0')):
return (_NAN, new_pos)
return (math.nan, new_pos)
# Note that we expect someone up-stack to catch struct.error and convert
# it to _DecodeError -- this way we don't have to set up exception-
@ -559,31 +541,21 @@ BoolDecoder = _ModifiedDecoder(
def StringDecoder(field_number, is_repeated, is_packed, key, new_default,
is_strict_utf8=False, clear_if_default=False):
clear_if_default=False):
"""Returns a decoder for a string field."""
local_DecodeVarint = _DecodeVarint
local_unicode = six.text_type
def _ConvertToUnicode(memview):
"""Convert byte to unicode."""
byte_str = memview.tobytes()
try:
value = local_unicode(byte_str, 'utf-8')
value = str(byte_str, 'utf-8')
except UnicodeDecodeError as e:
# add more information to the error message and re-raise it.
e.reason = '%s in field: %s' % (e, key.full_name)
raise
if is_strict_utf8 and six.PY2 and sys.maxunicode > _UCS2_MAXUNICODE:
# Only do the check for python2 ucs4 when is_strict_utf8 enabled
if _SURROGATE_PATTERN.search(value):
reason = ('String field %s contains invalid UTF-8 data when parsing'
'a protocol buffer: surrogates not allowed. Use'
'the bytes type if you intend to send raw bytes.') % (
key.full_name)
raise message.DecodeError(reason)
return value
assert not is_packed

View File

@ -1,5 +1,3 @@
#! /usr/bin/env python
#
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# https://developers.google.com/protocol-buffers/
@ -34,10 +32,7 @@
__author__ = 'matthewtoia@google.com (Matt Toia)'
try:
import unittest2 as unittest #PY26
except ImportError:
import unittest
import unittest
import warnings
from google.protobuf import unittest_pb2

22
python/google/protobuf/internal/descriptor_pool_test.py Executable file → Normal file
View File

@ -1,5 +1,3 @@
#! /usr/bin/env python
#
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# https://developers.google.com/protocol-buffers/
@ -36,13 +34,9 @@ __author__ = 'matthewtoia@google.com (Matt Toia)'
import copy
import os
import unittest
import warnings
try:
import unittest2 as unittest #PY26
except ImportError:
import unittest
from google.protobuf import unittest_import_pb2
from google.protobuf import unittest_import_public_pb2
from google.protobuf import unittest_pb2
@ -407,9 +401,19 @@ class DescriptorPoolTestBase(object):
# TODO(jieluo): Fix python and cpp extension diff.
return
self.pool = descriptor_pool.DescriptorPool()
self.pool.AddSerializedFile(self.factory_test1_fd.SerializeToString())
self.pool.AddSerializedFile(self.factory_test2_fd.SerializeToString())
file1 = self.pool.AddSerializedFile(
self.factory_test1_fd.SerializeToString())
file2 = self.pool.AddSerializedFile(
self.factory_test2_fd.SerializeToString())
self.assertEqual(file1.name,
'google/protobuf/internal/factory_test1.proto')
self.assertEqual(file2.name,
'google/protobuf/internal/factory_test2.proto')
self.testFindMessageTypeByName()
file_json = self.pool.AddSerializedFile(
more_messages_pb2.DESCRIPTOR.serialized_pb)
field = file_json.message_types_by_name['class'].fields_by_name['int_field']
self.assertEqual(field.json_name, 'json_int')
def testEnumDefaultValue(self):

21
python/google/protobuf/internal/descriptor_test.py Executable file → Normal file
View File

@ -1,5 +1,3 @@
#! /usr/bin/env python
#
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# https://developers.google.com/protocol-buffers/
@ -34,14 +32,9 @@
__author__ = 'robinson@google.com (Will Robinson)'
import sys
import unittest
import warnings
try:
import unittest2 as unittest #PY26
except ImportError:
import unittest
from google.protobuf import unittest_custom_options_pb2
from google.protobuf import unittest_import_pb2
from google.protobuf import unittest_pb2
@ -582,10 +575,7 @@ class GeneratedDescriptorTest(unittest.TestCase):
self.assertEqual(mapping, mapping)
self.assertGreater(len(mapping), 0) # Sized
self.assertEqual(len(mapping), len(excepted_dict)) # Iterable
if sys.version_info >= (3,):
key, item = next(iter(mapping.items()))
else:
key, item = mapping.items()[0]
key, item = next(iter(mapping.items()))
self.assertIn(key, mapping) # Container
self.assertEqual(mapping.get(key), item)
with self.assertRaises(TypeError):
@ -598,13 +588,6 @@ class GeneratedDescriptorTest(unittest.TestCase):
# keys(), iterkeys() &co
item = (next(iter(mapping.keys())), next(iter(mapping.values())))
self.assertEqual(item, next(iter(mapping.items())))
if sys.version_info < (3,):
def CheckItems(seq, iterator):
self.assertEqual(next(iterator), seq[0])
self.assertEqual(list(iterator), seq[1:])
CheckItems(mapping.keys(), mapping.iterkeys())
CheckItems(mapping.values(), mapping.itervalues())
CheckItems(mapping.items(), mapping.iteritems())
excepted_dict[key] = 'change value'
self.assertNotEqual(mapping, excepted_dict)
del excepted_dict[key]

View File

@ -68,8 +68,6 @@ __author__ = 'kenton@google.com (Kenton Varda)'
import struct
import six
from google.protobuf.internal import wire_format
@ -372,7 +370,8 @@ def MapSizer(field_descriptor, is_message_map):
def _VarintEncoder():
"""Return an encoder for a basic varint value (does not include tag)."""
local_int2byte = six.int2byte
local_int2byte = struct.Struct('>B').pack
def EncodeVarint(write, value, unused_deterministic=None):
bits = value & 0x7f
value >>= 7
@ -389,7 +388,8 @@ def _SignedVarintEncoder():
"""Return an encoder for a basic signed varint value (does not include
tag)."""
local_int2byte = six.int2byte
local_int2byte = struct.Struct('>B').pack
def EncodeSignedVarint(write, value, unused_deterministic=None):
if value < 0:
value += (1 << 64)
@ -420,8 +420,7 @@ def _VarintBytes(value):
def TagBytes(field_number, wire_type):
"""Encode the given tag and return the bytes. Only called at startup."""
return six.binary_type(
_VarintBytes(wire_format.PackTag(field_number, wire_type)))
return bytes(_VarintBytes(wire_format.PackTag(field_number, wire_type)))
# --------------------------------------------------------------------
# As with sizers (see above), we have a number of common encoder

View File

@ -37,8 +37,6 @@ on proto classes. For usage, see:
__author__ = 'rabsatt@google.com (Kevin Rabsatt)'
import six
class EnumTypeWrapper(object):
"""A utility for finding the names of enum values."""
@ -57,7 +55,7 @@ class EnumTypeWrapper(object):
except KeyError:
pass # fall out to break exception chaining
if not isinstance(number, six.integer_types):
if not isinstance(number, int):
raise TypeError(
'Enum value for {} must be an int, but got {} {!r}.'.format(
self._enum_type.name, type(number), number))

2
python/google/protobuf/internal/generator_test.py Executable file → Normal file
View File

@ -1,5 +1,3 @@
#! /usr/bin/env python
#
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# https://developers.google.com/protocol-buffers/

17
python/google/protobuf/internal/json_format_test.py Executable file → Normal file
View File

@ -1,5 +1,3 @@
#! /usr/bin/env python
#
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# https://developers.google.com/protocol-buffers/
@ -37,12 +35,8 @@ __author__ = 'jieluo@google.com (Jie Luo)'
import json
import math
import struct
import sys
try:
import unittest2 as unittest #PY26
except ImportError:
import unittest
import unittest
from google.protobuf import any_pb2
from google.protobuf import duration_pb2
@ -296,11 +290,8 @@ class JsonFormatTest(JsonFormatBase):
def testJsonEscapeString(self):
message = json_format_proto3_pb2.TestMessage()
if sys.version_info[0] < 3:
message.string_value = '&\n<\"\r>\b\t\f\\\001/\xe2\x80\xa8\xe2\x80\xa9'
else:
message.string_value = '&\n<\"\r>\b\t\f\\\001/'
message.string_value += (b'\xe2\x80\xa8\xe2\x80\xa9').decode('utf-8')
message.string_value = '&\n<\"\r>\b\t\f\\\001/'
message.string_value += (b'\xe2\x80\xa8\xe2\x80\xa9').decode('utf-8')
self.assertEqual(
json_format.MessageToJson(message),
'{\n "stringValue": '
@ -1039,8 +1030,6 @@ class JsonFormatTest(JsonFormatBase):
json_format.ParseError,
'Failed to parse boolMap field: Expected "true" or "false", not null.',
json_format.Parse, text, message)
if sys.version_info < (2, 7):
return
text = r'{"stringMap": {"a": 3, "\u0061": 2}}'
self.assertRaisesRegexp(
json_format.ParseError,

2
python/google/protobuf/internal/keywords_test.py Executable file → Normal file
View File

@ -1,5 +1,3 @@
#! /usr/bin/env python
#
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# https://developers.google.com/protocol-buffers/

View File

@ -1,5 +1,3 @@
#! /usr/bin/env python
#
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# https://developers.google.com/protocol-buffers/
@ -34,10 +32,7 @@
__author__ = 'matthewtoia@google.com (Matt Toia)'
try:
import unittest2 as unittest #PY26
except ImportError:
import unittest
import unittest
from google.protobuf import descriptor_pb2
from google.protobuf.internal import api_implementation

265
python/google/protobuf/internal/message_test.py Executable file → Normal file
View File

@ -1,6 +1,4 @@
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# https://developers.google.com/protocol-buffers/
@ -44,31 +42,17 @@ abstract interface.
__author__ = 'gps@google.com (Gregory P. Smith)'
import collections
import copy
import math
import operator
import pickle
import pydoc
import six
import sys
import unittest
import warnings
try:
# Since python 3
import collections.abc as collections_abc
except ImportError:
# Won't work after python 3.8
import collections as collections_abc
try:
import unittest2 as unittest # PY26
except ImportError:
import unittest
try:
cmp # Python 2
except NameError:
cmp = lambda x, y: (x > y) - (x < y) # Python 3
cmp = lambda x, y: (x > y) - (x < y)
from google.protobuf import map_proto2_unittest_pb2
from google.protobuf import map_unittest_pb2
@ -89,22 +73,6 @@ from google.protobuf import message
from google.protobuf.internal import _parameterized
UCS2_MAXUNICODE = 65535
if six.PY3:
long = int
# Python pre-2.6 does not have isinf() or isnan() functions, so we have
# to provide our own.
def isnan(val):
# NaN is never equal to itself.
return val != val
def isinf(val):
# Infinity times zero equals NaN.
return not isnan(val) and isnan(val * 0)
def IsPosInf(val):
return isinf(val) and (val > 0)
def IsNegInf(val):
return isinf(val) and (val < 0)
warnings.simplefilter('error', DeprecationWarning)
@ -243,10 +211,10 @@ class MessageTest(unittest.TestCase):
golden_message = message_module.TestAllTypes()
golden_message.ParseFromString(golden_data)
self.assertTrue(IsPosInf(golden_message.optional_float))
self.assertTrue(IsPosInf(golden_message.optional_double))
self.assertTrue(IsPosInf(golden_message.repeated_float[0]))
self.assertTrue(IsPosInf(golden_message.repeated_double[0]))
self.assertEqual(golden_message.optional_float, math.inf)
self.assertEqual(golden_message.optional_double, math.inf)
self.assertEqual(golden_message.repeated_float[0], math.inf)
self.assertEqual(golden_message.repeated_double[0], math.inf)
self.assertEqual(golden_data, golden_message.SerializeToString())
def testNegativeInfinity(self, message_module):
@ -263,10 +231,10 @@ class MessageTest(unittest.TestCase):
golden_message = message_module.TestAllTypes()
golden_message.ParseFromString(golden_data)
self.assertTrue(IsNegInf(golden_message.optional_float))
self.assertTrue(IsNegInf(golden_message.optional_double))
self.assertTrue(IsNegInf(golden_message.repeated_float[0]))
self.assertTrue(IsNegInf(golden_message.repeated_double[0]))
self.assertEqual(golden_message.optional_float, -math.inf)
self.assertEqual(golden_message.optional_double, -math.inf)
self.assertEqual(golden_message.repeated_float[0], -math.inf)
self.assertEqual(golden_message.repeated_double[0], -math.inf)
self.assertEqual(golden_data, golden_message.SerializeToString())
def testNotANumber(self, message_module):
@ -276,10 +244,10 @@ class MessageTest(unittest.TestCase):
b'\xD1\x02\x00\x00\x00\x00\x00\x00\xF8\x7F')
golden_message = message_module.TestAllTypes()
golden_message.ParseFromString(golden_data)
self.assertTrue(isnan(golden_message.optional_float))
self.assertTrue(isnan(golden_message.optional_double))
self.assertTrue(isnan(golden_message.repeated_float[0]))
self.assertTrue(isnan(golden_message.repeated_double[0]))
self.assertTrue(math.isnan(golden_message.optional_float))
self.assertTrue(math.isnan(golden_message.optional_double))
self.assertTrue(math.isnan(golden_message.repeated_float[0]))
self.assertTrue(math.isnan(golden_message.repeated_double[0]))
# The protocol buffer may serialize to any one of multiple different
# representations of a NaN. Rather than verify a specific representation,
@ -288,18 +256,18 @@ class MessageTest(unittest.TestCase):
serialized = golden_message.SerializeToString()
message = message_module.TestAllTypes()
message.ParseFromString(serialized)
self.assertTrue(isnan(message.optional_float))
self.assertTrue(isnan(message.optional_double))
self.assertTrue(isnan(message.repeated_float[0]))
self.assertTrue(isnan(message.repeated_double[0]))
self.assertTrue(math.isnan(message.optional_float))
self.assertTrue(math.isnan(message.optional_double))
self.assertTrue(math.isnan(message.repeated_float[0]))
self.assertTrue(math.isnan(message.repeated_double[0]))
def testPositiveInfinityPacked(self, message_module):
golden_data = (b'\xA2\x06\x04\x00\x00\x80\x7F'
b'\xAA\x06\x08\x00\x00\x00\x00\x00\x00\xF0\x7F')
golden_message = message_module.TestPackedTypes()
golden_message.ParseFromString(golden_data)
self.assertTrue(IsPosInf(golden_message.packed_float[0]))
self.assertTrue(IsPosInf(golden_message.packed_double[0]))
self.assertEqual(golden_message.packed_float[0], math.inf)
self.assertEqual(golden_message.packed_double[0], math.inf)
self.assertEqual(golden_data, golden_message.SerializeToString())
def testNegativeInfinityPacked(self, message_module):
@ -307,8 +275,8 @@ class MessageTest(unittest.TestCase):
b'\xAA\x06\x08\x00\x00\x00\x00\x00\x00\xF0\xFF')
golden_message = message_module.TestPackedTypes()
golden_message.ParseFromString(golden_data)
self.assertTrue(IsNegInf(golden_message.packed_float[0]))
self.assertTrue(IsNegInf(golden_message.packed_double[0]))
self.assertEqual(golden_message.packed_float[0], -math.inf)
self.assertEqual(golden_message.packed_double[0], -math.inf)
self.assertEqual(golden_data, golden_message.SerializeToString())
def testNotANumberPacked(self, message_module):
@ -316,14 +284,14 @@ class MessageTest(unittest.TestCase):
b'\xAA\x06\x08\x00\x00\x00\x00\x00\x00\xF8\x7F')
golden_message = message_module.TestPackedTypes()
golden_message.ParseFromString(golden_data)
self.assertTrue(isnan(golden_message.packed_float[0]))
self.assertTrue(isnan(golden_message.packed_double[0]))
self.assertTrue(math.isnan(golden_message.packed_float[0]))
self.assertTrue(math.isnan(golden_message.packed_double[0]))
serialized = golden_message.SerializeToString()
message = message_module.TestPackedTypes()
message.ParseFromString(serialized)
self.assertTrue(isnan(message.packed_float[0]))
self.assertTrue(isnan(message.packed_double[0]))
self.assertTrue(math.isnan(message.packed_float[0]))
self.assertTrue(math.isnan(message.packed_double[0]))
def testExtremeFloatValues(self, message_module):
message = message_module.TestAllTypes()
@ -451,10 +419,7 @@ class MessageTest(unittest.TestCase):
def testHighPrecisionDoublePrinting(self, message_module):
msg = message_module.TestAllTypes()
msg.optional_double = 0.12345678912345678
if sys.version_info >= (3,):
self.assertEqual(str(msg), 'optional_double: 0.12345678912345678\n')
else:
self.assertEqual(str(msg), 'optional_double: 0.123456789123\n')
self.assertEqual(str(msg), 'optional_double: 0.12345678912345678\n')
def testUnknownFieldPrinting(self, message_module):
populated = message_module.TestAllTypes()
@ -694,7 +659,6 @@ class MessageTest(unittest.TestCase):
message = message_module.TestAllTypes()
get_bb = operator.attrgetter('bb')
cmp_bb = lambda a, b: cmp(a.bb, b.bb)
message.repeated_nested_message.add().bb = 1
message.repeated_nested_message.add().bb = 3
message.repeated_nested_message.add().bb = 2
@ -707,13 +671,6 @@ class MessageTest(unittest.TestCase):
message.repeated_nested_message.sort(key=get_bb, reverse=True)
self.assertEqual([k.bb for k in message.repeated_nested_message],
[6, 5, 4, 3, 2, 1])
if sys.version_info >= (3,): return # No cmp sorting in PY3.
message.repeated_nested_message.sort(sort_function=cmp_bb)
self.assertEqual([k.bb for k in message.repeated_nested_message],
[1, 2, 3, 4, 5, 6])
message.repeated_nested_message.sort(cmp=cmp_bb, reverse=True)
self.assertEqual([k.bb for k in message.repeated_nested_message],
[6, 5, 4, 3, 2, 1])
def testRepeatedScalarFieldSortArguments(self, message_module):
"""Check sorting a scalar field using list.sort() arguments."""
@ -726,12 +683,6 @@ class MessageTest(unittest.TestCase):
self.assertEqual(list(message.repeated_int32), [-1, -2, -3])
message.repeated_int32.sort(key=abs, reverse=True)
self.assertEqual(list(message.repeated_int32), [-3, -2, -1])
if sys.version_info < (3,): # No cmp sorting in PY3.
abs_cmp = lambda a, b: cmp(abs(a), abs(b))
message.repeated_int32.sort(sort_function=abs_cmp)
self.assertEqual(list(message.repeated_int32), [-1, -2, -3])
message.repeated_int32.sort(cmp=abs_cmp, reverse=True)
self.assertEqual(list(message.repeated_int32), [-3, -2, -1])
message.repeated_string.append('aaa')
message.repeated_string.append('bb')
@ -740,12 +691,6 @@ class MessageTest(unittest.TestCase):
self.assertEqual(list(message.repeated_string), ['c', 'bb', 'aaa'])
message.repeated_string.sort(key=len, reverse=True)
self.assertEqual(list(message.repeated_string), ['aaa', 'bb', 'c'])
if sys.version_info < (3,): # No cmp sorting in PY3.
len_cmp = lambda a, b: cmp(len(a), len(b))
message.repeated_string.sort(sort_function=len_cmp)
self.assertEqual(list(message.repeated_string), ['c', 'bb', 'aaa'])
message.repeated_string.sort(cmp=len_cmp, reverse=True)
self.assertEqual(list(message.repeated_string), ['aaa', 'bb', 'c'])
def testRepeatedFieldsComparable(self, message_module):
m1 = message_module.TestAllTypes()
@ -763,30 +708,11 @@ class MessageTest(unittest.TestCase):
m2.repeated_nested_message.add().bb = 2
m2.repeated_nested_message.add().bb = 3
if sys.version_info >= (3,): return # No cmp() in PY3.
# These comparisons should not raise errors.
_ = m1 < m2
_ = m1.repeated_nested_message < m2.repeated_nested_message
# Make sure cmp always works. If it wasn't defined, these would be
# id() comparisons and would all fail.
self.assertEqual(cmp(m1, m2), 0)
self.assertEqual(cmp(m1.repeated_int32, m2.repeated_int32), 0)
self.assertEqual(cmp(m1.repeated_int32, [0, 1, 2]), 0)
self.assertEqual(cmp(m1.repeated_nested_message,
m2.repeated_nested_message), 0)
with self.assertRaises(TypeError):
# Can't compare repeated composite containers to lists.
cmp(m1.repeated_nested_message, m2.repeated_nested_message[:])
# TODO(anuraag): Implement extensiondict comparison in C++ and then add test
def testRepeatedFieldsAreSequences(self, message_module):
m = message_module.TestAllTypes()
self.assertIsInstance(m.repeated_int32, collections_abc.MutableSequence)
self.assertIsInstance(m.repeated_int32, collections.abc.MutableSequence)
self.assertIsInstance(m.repeated_nested_message,
collections_abc.MutableSequence)
collections.abc.MutableSequence)
def testRepeatedFieldsNotHashable(self, message_module):
m = message_module.TestAllTypes()
@ -860,8 +786,8 @@ class MessageTest(unittest.TestCase):
# that a sub-sliced memoryview is not being used.
self.assertIsInstance(m1.optional_bytes, bytes)
self.assertIsInstance(m1.repeated_bytes[0], bytes)
self.assertIsInstance(m1.optional_string, six.text_type)
self.assertIsInstance(m1.repeated_string[0], six.text_type)
self.assertIsInstance(m1.optional_string, str)
self.assertIsInstance(m1.repeated_string[0], str)
def testMergeFromEmpty(self, message_module):
m1 = message_module.TestAllTypes()
@ -1049,10 +975,10 @@ class MessageTest(unittest.TestCase):
in the value being converted to a Unicode string."""
m = message_module.TestAllTypes()
m.optional_string = str('')
self.assertIsInstance(m.optional_string, six.text_type)
self.assertIsInstance(m.optional_string, str)
def testLongValuedSlice(self, message_module):
"""It should be possible to use long-valued indices in slices.
"""It should be possible to use int-valued indices in slices.
This didn't used to work in the v2 C++ implementation.
"""
@ -1060,12 +986,12 @@ class MessageTest(unittest.TestCase):
# Repeated scalar
m.repeated_int32.append(1)
sl = m.repeated_int32[long(0):long(len(m.repeated_int32))]
sl = m.repeated_int32[int(0):int(len(m.repeated_int32))]
self.assertEqual(len(m.repeated_int32), len(sl))
# Repeated composite
m.repeated_nested_message.add().bb = 3
sl = m.repeated_nested_message[long(0):long(len(m.repeated_nested_message))]
sl = m.repeated_nested_message[int(0):int(len(m.repeated_nested_message))]
self.assertEqual(len(m.repeated_nested_message), len(sl))
def testExtendShouldNotSwallowExceptions(self, message_module):
@ -1794,7 +1720,7 @@ class Proto3Test(unittest.TestCase):
self.assertTrue(111 in msg.map_int32_bytes)
self.assertTrue(888 in msg.map_int32_enum)
self.assertIsInstance(msg.map_string_string['abc'], six.text_type)
self.assertIsInstance(msg.map_string_string['abc'], str)
# Accessing an unset key still throws TypeError if the type of the key
# is incorrect.
@ -1909,8 +1835,8 @@ class Proto3Test(unittest.TestCase):
self.assertEqual(key, unicode_obj)
self.assertEqual(value, unicode_obj)
self.assertIsInstance(key, six.text_type)
self.assertIsInstance(value, six.text_type)
self.assertIsInstance(key, str)
self.assertIsInstance(value, str)
def testMessageMap(self):
msg = map_unittest_pb2.TestMap()
@ -2110,7 +2036,7 @@ class Proto3Test(unittest.TestCase):
with self.assertRaisesRegexp(
TypeError,
r'Parameter to MergeFrom\(\) must be instance of same class: expected '
r'.*TestMap got int\.'):
r'.+TestMap got int\.'):
msg.MergeFrom(1)
def testCopyFromBadType(self):
@ -2118,15 +2044,15 @@ class Proto3Test(unittest.TestCase):
with self.assertRaisesRegexp(
TypeError,
r'Parameter to [A-Za-z]*From\(\) must be instance of same class: '
r'expected .*TestMap got int\.'):
r'expected .+TestMap got int\.'):
msg.CopyFrom(1)
def testIntegerMapWithLongs(self):
msg = map_unittest_pb2.TestMap()
msg.map_int32_int32[long(-123)] = long(-456)
msg.map_int64_int64[long(-2**33)] = long(-2**34)
msg.map_uint32_uint32[long(123)] = long(456)
msg.map_uint64_uint64[long(2**33)] = long(2**34)
msg.map_int32_int32[int(-123)] = int(-456)
msg.map_int64_int64[int(-2**33)] = int(-2**34)
msg.map_uint32_uint32[int(123)] = int(456)
msg.map_uint64_uint64[int(2**33)] = int(2**34)
serialized = msg.SerializeToString()
msg2 = map_unittest_pb2.TestMap()
@ -2238,54 +2164,6 @@ class Proto3Test(unittest.TestCase):
matching_dict = {2: 4, 3: 6, 4: 8}
self.assertMapIterEquals(msg.map_int32_int32.items(), matching_dict)
def testPython2Map(self):
if sys.version_info < (3,):
msg = map_unittest_pb2.TestMap()
msg.map_int32_int32[2] = 4
msg.map_int32_int32[3] = 6
msg.map_int32_int32[4] = 8
msg.map_int32_int32[5] = 10
map_int32 = msg.map_int32_int32
self.assertEqual(4, len(map_int32))
msg2 = map_unittest_pb2.TestMap()
msg2.ParseFromString(msg.SerializeToString())
def CheckItems(seq, iterator):
self.assertEqual(next(iterator), seq[0])
self.assertEqual(list(iterator), seq[1:])
CheckItems(map_int32.items(), map_int32.iteritems())
CheckItems(map_int32.keys(), map_int32.iterkeys())
CheckItems(map_int32.values(), map_int32.itervalues())
self.assertEqual(6, map_int32.get(3))
self.assertEqual(None, map_int32.get(999))
self.assertEqual(6, map_int32.pop(3))
self.assertEqual(0, map_int32.pop(3))
self.assertEqual(3, len(map_int32))
key, value = map_int32.popitem()
self.assertEqual(2 * key, value)
self.assertEqual(2, len(map_int32))
map_int32.clear()
self.assertEqual(0, len(map_int32))
with self.assertRaises(KeyError):
map_int32.popitem()
self.assertEqual(0, map_int32.setdefault(2))
self.assertEqual(1, len(map_int32))
map_int32.update(msg2.map_int32_int32)
self.assertEqual(4, len(map_int32))
with self.assertRaises(TypeError):
map_int32.update(msg2.map_int32_int32,
msg2.map_int32_int32)
with self.assertRaises(TypeError):
map_int32.update(0)
with self.assertRaises(TypeError):
map_int32.update(value=12)
def testMapItems(self):
# Map items used to have strange behaviors when use c extension. Because
# [] may reorder the map and invalidate any exsting iterators.
@ -2457,11 +2335,12 @@ class Proto3Test(unittest.TestCase):
def testMapsAreMapping(self):
msg = map_unittest_pb2.TestMap()
self.assertIsInstance(msg.map_int32_int32, collections_abc.Mapping)
self.assertIsInstance(msg.map_int32_int32, collections_abc.MutableMapping)
self.assertIsInstance(msg.map_int32_foreign_message, collections_abc.Mapping)
self.assertIsInstance(msg.map_int32_int32, collections.abc.Mapping)
self.assertIsInstance(msg.map_int32_int32, collections.abc.MutableMapping)
self.assertIsInstance(msg.map_int32_foreign_message,
collections_abc.MutableMapping)
collections.abc.Mapping)
self.assertIsInstance(msg.map_int32_foreign_message,
collections.abc.MutableMapping)
def testMapsCompare(self):
msg = map_unittest_pb2.TestMap()
@ -2501,19 +2380,7 @@ class Proto3Test(unittest.TestCase):
optional_string=u'\ud001')
self.assertEqual(msg.optional_string, u'\ud001')
@unittest.skipIf(six.PY2, 'Surrogates are acceptable in python2')
def testSurrogatesInPython3(self):
# Surrogates like U+D83D is an invalid unicode character, it is
# supported by Python2 only because in some builds, unicode strings
# use 2-bytes code units. Since Python 3.3, we don't have this problem.
#
# Surrogates are utf16 code units, in a unicode string they are invalid
# characters even when they appear in pairs like u'\ud801\udc01'. Protobuf
# Python3 reject such cases at setters and parsers. Python2 accpect it
# to keep same features with the language itself. 'Unpaired pairs'
# like u'\ud801' are rejected at parsers when strict utf8 check is enabled
# in proto3 to keep same behavior with c extension.
# Surrogates are rejected at setters in Python3.
with self.assertRaises(ValueError):
unittest_proto3_arena_pb2.TestAllTypes(
@ -2528,33 +2395,6 @@ class Proto3Test(unittest.TestCase):
unittest_proto3_arena_pb2.TestAllTypes(
optional_string=u'\ud801\ud801')
@unittest.skipIf(six.PY3 or sys.maxunicode == UCS2_MAXUNICODE,
'Surrogates are rejected at setters in Python3')
def testSurrogatesInPython2(self):
# Test optional_string=u'\ud801\udc01'.
# surrogate pair is acceptable in python2.
msg = unittest_proto3_arena_pb2.TestAllTypes(
optional_string=u'\ud801\udc01')
# TODO(jieluo): Change pure python to have same behavior with c extension.
# Some build in python2 consider u'\ud801\udc01' and u'\U00010401' are
# equal, some are not equal.
if api_implementation.Type() == 'python':
self.assertEqual(msg.optional_string, u'\ud801\udc01')
else:
self.assertEqual(msg.optional_string, u'\U00010401')
serialized = msg.SerializeToString()
msg2 = unittest_proto3_arena_pb2.TestAllTypes()
msg2.MergeFromString(serialized)
self.assertEqual(msg2.optional_string, u'\U00010401')
# Python2 does not reject surrogates at setters.
msg = unittest_proto3_arena_pb2.TestAllTypes(
optional_string=b'\xed\xa0\x81')
unittest_proto3_arena_pb2.TestAllTypes(
optional_string=u'\ud801')
unittest_proto3_arena_pb2.TestAllTypes(
optional_string=u'\ud801\ud801')
@testing_refleaks.TestCase
class ValidTypeNamesTest(unittest.TestCase):
@ -2636,9 +2476,8 @@ class PackedFieldTest(unittest.TestCase):
self.assertEqual(golden_data, message.SerializeToString())
@unittest.skipIf(api_implementation.Type() != 'cpp' or
sys.version_info < (2, 7),
'explicit tests of the C++ implementation for PY27 and above')
@unittest.skipIf(api_implementation.Type() != 'cpp',
'explicit tests of the C++ implementation')
@testing_refleaks.TestCase
class OversizeProtosTest(unittest.TestCase):

View File

@ -40,44 +40,44 @@ package google.protobuf.internal;
// canonicalization of serialized output, which should always be in tag order.
// We also mix in some extensions for extra fun.
message OutOfOrderFields {
optional sint32 optional_sint32 = 5;
optional sint32 optional_sint32 = 5;
extensions 4 to 4;
optional uint32 optional_uint32 = 3;
optional uint32 optional_uint32 = 3;
extensions 2 to 2;
optional int32 optional_int32 = 1;
};
optional int32 optional_int32 = 1;
}
extend OutOfOrderFields {
optional uint64 optional_uint64 = 4;
optional int64 optional_int64 = 2;
optional uint64 optional_uint64 = 4;
optional int64 optional_int64 = 2;
}
enum is { // top level enum keyword
enum is { // top level enum keyword
default = 0;
else = 1; // top level enum value keyword
else = 1; // top level enum value keyword
}
message class { // message keyword
optional int32 int_field = 1;
optional int32 if = 2; // field keyword
optional is as = 3; // enum field keyword
message class { // message keyword
optional int32 int_field = 1 [json_name = "json_int"];
optional int32 if = 2; // field keyword
optional is as = 3; // enum field keyword
optional is enum_field = 4;
enum for { // nested enum keyword
default = 0;
True = 1; // nested enum value keyword
True = 1; // nested enum value keyword
}
optional for nested_enum_field = 5;
message try {
optional int32 field = 1;
extensions 999 to 9999;
}
optional try nested_message = 6;
optional try
nested_message = 6;
extensions 999 to 9999;
}
extend class {
optional int32 continue = 1001; // top level extension keyword
optional int32 continue = 1001; // top level extension keyword
}
extend class.try {
@ -86,7 +86,7 @@ extend class.try {
message ExtendClass {
extend class {
optional int32 return = 1002; // nested extension keyword
optional int32 return = 1002; // nested extension keyword
}
}

2
python/google/protobuf/internal/proto_builder_test.py Executable file → Normal file
View File

@ -1,5 +1,3 @@
#! /usr/bin/env python
#
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# https://developers.google.com/protocol-buffers/

View File

@ -55,9 +55,6 @@ import struct
import sys
import weakref
import six
from six.moves import range
# We use "as" to avoid name collisions with variables.
from google.protobuf.internal import api_implementation
from google.protobuf.internal import containers
@ -284,13 +281,6 @@ def _IsMessageMapField(field):
return value_type.cpp_type == _FieldDescriptor.CPPTYPE_MESSAGE
def _IsStrictUtf8Check(field):
if field.containing_type.syntax != 'proto3':
return False
enforce_utf8 = True
return enforce_utf8
def _AttachFieldHelpers(cls, field_descriptor):
is_repeated = (field_descriptor.label == _FieldDescriptor.LABEL_REPEATED)
is_packable = (is_repeated and
@ -348,11 +338,10 @@ def _AttachFieldHelpers(cls, field_descriptor):
field_descriptor, _GetInitializeDefaultForMap(field_descriptor),
is_message_map)
elif decode_type == _FieldDescriptor.TYPE_STRING:
is_strict_utf8_check = _IsStrictUtf8Check(field_descriptor)
field_decoder = decoder.StringDecoder(
field_descriptor.number, is_repeated, is_packed,
field_descriptor, field_descriptor._default_constructor,
is_strict_utf8_check, clear_if_default)
clear_if_default)
elif field_descriptor.cpp_type == _FieldDescriptor.CPPTYPE_MESSAGE:
field_decoder = type_checkers.TYPE_TO_DECODER[decode_type](
field_descriptor.number, is_repeated, is_packed,
@ -485,7 +474,7 @@ def _ReraiseTypeErrorWithFieldName(message_name, field_name):
exc = TypeError('%s for field %s.%s' % (str(exc), message_name, field_name))
# re-raise possibly-amended exception with original traceback:
six.reraise(type(exc), exc, sys.exc_info()[2])
raise exc.with_traceback(sys.exc_info()[2])
def _AddInitMethod(message_descriptor, cls):
@ -498,7 +487,7 @@ def _AddInitMethod(message_descriptor, cls):
enum_type with the same name. If the value is not a string, it's
returned as-is. (No conversion or bounds-checking is done.)
"""
if isinstance(value, six.string_types):
if isinstance(value, str):
try:
return enum_type.values_by_name[value].number
except KeyError:
@ -1305,6 +1294,14 @@ def _AddIsInitializedMethod(message_descriptor, cls):
cls.FindInitializationErrors = FindInitializationErrors
def _FullyQualifiedClassName(klass):
module = klass.__module__
name = getattr(klass, '__qualname__', klass.__name__)
if module in (None, 'builtins', '__builtin__'):
return name
return module + '.' + name
def _AddMergeFromMethod(cls):
LABEL_REPEATED = _FieldDescriptor.LABEL_REPEATED
CPPTYPE_MESSAGE = _FieldDescriptor.CPPTYPE_MESSAGE
@ -1313,7 +1310,8 @@ def _AddMergeFromMethod(cls):
if not isinstance(msg, cls):
raise TypeError(
'Parameter to MergeFrom() must be instance of same class: '
'expected %s got %s.' % (cls.__name__, msg.__class__.__name__))
'expected %s got %s.' % (_FullyQualifiedClassName(cls),
_FullyQualifiedClassName(msg.__class__)))
assert msg is not self
self._Modified()

37
python/google/protobuf/internal/reflection_test.py Executable file → Normal file
View File

@ -1,6 +1,4 @@
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# https://developers.google.com/protocol-buffers/
@ -38,14 +36,9 @@ pure-Python protocol compiler.
import copy
import gc
import operator
import six
import struct
import warnings
try:
import unittest2 as unittest #PY26
except ImportError:
import unittest
import unittest
from google.protobuf import unittest_import_pb2
from google.protobuf import unittest_mset_pb2
@ -67,10 +60,6 @@ from google.protobuf.internal import decoder
from google.protobuf.internal import _parameterized
if six.PY3:
long = int # pylint: disable=redefined-builtin,invalid-name
warnings.simplefilter('error', DeprecationWarning)
@ -411,7 +400,7 @@ class ReflectionTest(unittest.TestCase):
TestGetAndDeserialize('optional_int32', 1, int)
TestGetAndDeserialize('optional_int32', 1 << 30, int)
TestGetAndDeserialize('optional_uint32', 1 << 30, int)
integer_64 = long
integer_64 = int
if struct.calcsize('L') == 4:
# Python only has signed ints, so 32-bit python can't fit an uint32
# in an int.
@ -852,14 +841,14 @@ class ReflectionTest(unittest.TestCase):
setattr, proto, 'optional_bytes', u'unicode object')
# Check that the default value is of python's 'unicode' type.
self.assertEqual(type(proto.optional_string), six.text_type)
self.assertEqual(type(proto.optional_string), str)
proto.optional_string = six.text_type('Testing')
proto.optional_string = str('Testing')
self.assertEqual(proto.optional_string, str('Testing'))
# Assign a value of type 'str' which can be encoded in UTF-8.
proto.optional_string = str('Testing')
self.assertEqual(proto.optional_string, six.text_type('Testing'))
self.assertEqual(proto.optional_string, str('Testing'))
# Try to assign a 'bytes' object which contains non-UTF-8.
self.assertRaises(ValueError,
@ -874,8 +863,7 @@ class ReflectionTest(unittest.TestCase):
def testBytesInTextFormat(self, message_module):
proto = message_module.TestAllTypes(optional_bytes=b'\x00\x7f\x80\xff')
self.assertEqual(u'optional_bytes: "\\000\\177\\200\\377"\n',
six.text_type(proto))
self.assertEqual(u'optional_bytes: "\\000\\177\\200\\377"\n', str(proto))
def testEmptyNestedMessage(self, message_module):
proto = message_module.TestAllTypes()
@ -1508,7 +1496,9 @@ class Proto2ReflectionTest(unittest.TestCase):
options=descriptor_pb2.MessageOptions(),
# pylint: disable=protected-access
create_key=descriptor._internal_create_key)
class MyProtoClass(six.with_metaclass(reflection.GeneratedProtocolMessageType, message.Message)):
class MyProtoClass(
message.Message, metaclass=reflection.GeneratedProtocolMessageType):
DESCRIPTOR = mydescriptor
myproto_instance = MyProtoClass()
self.assertEqual(0, myproto_instance.foo_field)
@ -1556,8 +1546,8 @@ class Proto2ReflectionTest(unittest.TestCase):
self.assertTrue('price' in desc.fields_by_name)
self.assertTrue('owners' in desc.fields_by_name)
class CarMessage(six.with_metaclass(reflection.GeneratedProtocolMessageType,
message.Message)):
class CarMessage(
message.Message, metaclass=reflection.GeneratedProtocolMessageType):
DESCRIPTOR = desc
prius = CarMessage()
@ -2094,7 +2084,7 @@ class Proto2ReflectionTest(unittest.TestCase):
bytes_read = message2.MergeFromString(raw.item[0].message)
self.assertEqual(len(raw.item[0].message), bytes_read)
self.assertEqual(type(message2.str), six.text_type)
self.assertEqual(type(message2.str), str)
self.assertEqual(message2.str, test_utf8)
# The pure Python API throws an exception on MergeFromString(),
@ -3340,7 +3330,8 @@ class ClassAPITest(unittest.TestCase):
msg_descriptor = descriptor.MakeDescriptor(
file_descriptor.message_type[0])
class MessageClass(six.with_metaclass(reflection.GeneratedProtocolMessageType, message.Message)):
class MessageClass(
message.Message, metaclass=reflection.GeneratedProtocolMessageType):
DESCRIPTOR = msg_descriptor
msg = MessageClass()
msg_str = (

View File

@ -1,5 +1,3 @@
#! /usr/bin/env python
#
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# https://developers.google.com/protocol-buffers/
@ -35,10 +33,7 @@
__author__ = 'petar@google.com (Petar Petrov)'
try:
import unittest2 as unittest #PY26
except ImportError:
import unittest
import unittest
from google.protobuf import unittest_pb2
from google.protobuf import service_reflection

View File

@ -1,5 +1,3 @@
#! /usr/bin/env python
#
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# https://developers.google.com/protocol-buffers/
@ -32,10 +30,7 @@
"""Tests for google.protobuf.symbol_database."""
try:
import unittest2 as unittest #PY26
except ImportError:
import unittest
import unittest
from google.protobuf import unittest_pb2
from google.protobuf import descriptor

View File

@ -38,18 +38,10 @@ If sys.gettotalrefcount() is not available (because Python was built without
the Py_DEBUG option), then this module is a no-op and tests will run normally.
"""
import copyreg
import gc
import sys
try:
import copy_reg as copyreg #PY26
except ImportError:
import copyreg
try:
import unittest2 as unittest #PY26
except ImportError:
import unittest
import unittest
class LocalTestResult(unittest.TestResult):

7
python/google/protobuf/internal/text_encoding_test.py Executable file → Normal file
View File

@ -1,5 +1,3 @@
#! /usr/bin/env python
#
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# https://developers.google.com/protocol-buffers/
@ -32,10 +30,7 @@
"""Tests for google.protobuf.text_encoding."""
try:
import unittest2 as unittest #PY26
except ImportError:
import unittest
import unittest
from google.protobuf import text_encoding

239
python/google/protobuf/internal/text_format_test.py Executable file → Normal file
View File

@ -1,6 +1,4 @@
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# https://developers.google.com/protocol-buffers/
@ -39,13 +37,7 @@ import re
import string
import textwrap
import six
# pylint: disable=g-import-not-at-top
try:
import unittest2 as unittest # PY26
except ImportError:
import unittest
import unittest
from google.protobuf import any_pb2
from google.protobuf import any_test_pb2
@ -207,14 +199,10 @@ class TextFormatMessageToStringTests(TextFormatBase):
'repeated_double: 1.23456789\n'
'repeated_double: 1.234567898\n'
'repeated_double: 1.2345678987\n'
'repeated_double: 1.23456789876\n' +
('repeated_double: 1.23456789876\n'
'repeated_double: 1.23456789877\n'
'repeated_double: 1.23456789877\n'
if six.PY2 else
'repeated_double: 1.234567898765\n'
'repeated_double: 1.2345678987654\n'
'repeated_double: 1.23456789876543\n') +
'repeated_double: 1.23456789876\n'
'repeated_double: 1.234567898765\n'
'repeated_double: 1.2345678987654\n'
'repeated_double: 1.23456789876543\n'
'repeated_double: 1.2e+100\n'
'repeated_double: 1.23e+100\n'
'repeated_double: 1.234e+100\n'
@ -225,18 +213,14 @@ class TextFormatMessageToStringTests(TextFormatBase):
'repeated_double: 1.23456789e+100\n'
'repeated_double: 1.234567898e+100\n'
'repeated_double: 1.2345678987e+100\n'
'repeated_double: 1.23456789876e+100\n' +
('repeated_double: 1.23456789877e+100\n'
'repeated_double: 1.23456789877e+100\n'
'repeated_double: 1.23456789877e+100\n'
if six.PY2 else
'repeated_double: 1.234567898765e+100\n'
'repeated_double: 1.2345678987654e+100\n'
'repeated_double: 1.23456789876543e+100\n'))
'repeated_double: 1.23456789876e+100\n'
'repeated_double: 1.234567898765e+100\n'
'repeated_double: 1.2345678987654e+100\n'
'repeated_double: 1.23456789876543e+100\n')
def testPrintExoticUnicodeSubclass(self, message_module):
class UnicodeSub(six.text_type):
class UnicodeSub(str):
pass
message = message_module.TestAllTypes()
@ -364,7 +348,7 @@ class TextFormatMessageToStringTests(TextFormatBase):
message.repeated_string.append(u'\u00fc\t\ua71f')
text = text_format.MessageToString(message, as_utf8=True)
golden_unicode = u'repeated_string: "\u00fc\\t\ua71f"\n'
golden_text = golden_unicode if six.PY3 else golden_unicode.encode('utf-8')
golden_text = golden_unicode
# MessageToString always returns a native str.
self.CompareToGoldenText(text, golden_text)
parsed_message = message_module.TestAllTypes()
@ -777,16 +761,18 @@ class TextFormatParserTests(TextFormatBase):
def testParseSingleWord(self, message_module):
message = message_module.TestAllTypes()
text = 'foo'
six.assertRaisesRegex(self, text_format.ParseError, (
r'1:1 : Message type "\w+.TestAllTypes" has no field named '
r'"foo".'), text_format.Parse, text, message)
self.assertRaisesRegex(
text_format.ParseError,
(r'1:1 : Message type "\w+.TestAllTypes" has no field named '
r'"foo".'), text_format.Parse, text, message)
def testParseUnknownField(self, message_module):
message = message_module.TestAllTypes()
text = 'unknown_field: 8\n'
six.assertRaisesRegex(self, text_format.ParseError, (
r'1:1 : Message type "\w+.TestAllTypes" has no field named '
r'"unknown_field".'), text_format.Parse, text, message)
self.assertRaisesRegex(
text_format.ParseError,
(r'1:1 : Message type "\w+.TestAllTypes" has no field named '
r'"unknown_field".'), text_format.Parse, text, message)
text = ('optional_int32: 123\n'
'unknown_field: 8\n'
'optional_nested_message { bb: 45 }')
@ -797,19 +783,19 @@ class TextFormatParserTests(TextFormatBase):
def testParseBadEnumValue(self, message_module):
message = message_module.TestAllTypes()
text = 'optional_nested_enum: BARR'
six.assertRaisesRegex(self, text_format.ParseError,
(r'1:23 : \'optional_nested_enum: BARR\': '
r'Enum type "\w+.TestAllTypes.NestedEnum" '
r'has no value named BARR.'), text_format.Parse,
text, message)
self.assertRaisesRegex(text_format.ParseError,
(r'1:23 : \'optional_nested_enum: BARR\': '
r'Enum type "\w+.TestAllTypes.NestedEnum" '
r'has no value named BARR.'), text_format.Parse,
text, message)
def testParseBadIntValue(self, message_module):
message = message_module.TestAllTypes()
text = 'optional_int32: bork'
six.assertRaisesRegex(self, text_format.ParseError,
('1:17 : \'optional_int32: bork\': '
'Couldn\'t parse integer: bork'),
text_format.Parse, text, message)
self.assertRaisesRegex(text_format.ParseError,
('1:17 : \'optional_int32: bork\': '
'Couldn\'t parse integer: bork'), text_format.Parse,
text, message)
def testParseStringFieldUnescape(self, message_module):
message = message_module.TestAllTypes()
@ -842,8 +828,8 @@ class TextFormatParserTests(TextFormatBase):
def testParseMultipleOneof(self, message_module):
m_string = '\n'.join(['oneof_uint32: 11', 'oneof_string: "foo"'])
m2 = message_module.TestAllTypes()
with six.assertRaisesRegex(self, text_format.ParseError,
' is specified along with field '):
with self.assertRaisesRegex(text_format.ParseError,
' is specified along with field '):
text_format.Parse(m_string, m2)
# This example contains non-ASCII codepoint unicode data as literals
@ -922,27 +908,28 @@ class TextFormatParserTests(TextFormatBase):
message = message_module.TestAllTypes()
text = ('optional_nested_message { bb: 1 } '
'optional_nested_message { bb: 2 }')
six.assertRaisesRegex(self, text_format.ParseError, (
r'1:59 : Message type "\w+.TestAllTypes" '
r'should not have multiple "optional_nested_message" fields.'),
text_format.Parse, text,
message)
self.assertRaisesRegex(
text_format.ParseError,
(r'1:59 : Message type "\w+.TestAllTypes" '
r'should not have multiple "optional_nested_message" fields.'),
text_format.Parse, text, message)
def testParseDuplicateScalars(self, message_module):
message = message_module.TestAllTypes()
text = ('optional_int32: 42 ' 'optional_int32: 67')
six.assertRaisesRegex(self, text_format.ParseError, (
r'1:36 : Message type "\w+.TestAllTypes" should not '
r'have multiple "optional_int32" fields.'), text_format.Parse, text,
message)
self.assertRaisesRegex(
text_format.ParseError,
(r'1:36 : Message type "\w+.TestAllTypes" should not '
r'have multiple "optional_int32" fields.'), text_format.Parse, text,
message)
def testParseExistingScalarInMessage(self, message_module):
message = message_module.TestAllTypes(optional_int32=42)
text = 'optional_int32: 67'
six.assertRaisesRegex(self, text_format.ParseError,
(r'Message type "\w+.TestAllTypes" should not '
r'have multiple "optional_int32" fields.'),
text_format.Parse, text, message)
self.assertRaisesRegex(text_format.ParseError,
(r'Message type "\w+.TestAllTypes" should not '
r'have multiple "optional_int32" fields.'),
text_format.Parse, text, message)
@_parameterized.parameters(unittest_pb2, unittest_proto3_arena_pb2)
@ -1398,14 +1385,14 @@ class Proto2Tests(TextFormatBase):
# Can't parse field number without set allow_field_number=True.
message = unittest_pb2.TestAllTypes()
text = '34:1\n'
six.assertRaisesRegex(self, text_format.ParseError, (
r'1:1 : Message type "\w+.TestAllTypes" has no field named '
r'"34".'), text_format.Parse, text, message)
self.assertRaisesRegex(
text_format.ParseError,
(r'1:1 : Message type "\w+.TestAllTypes" has no field named '
r'"34".'), text_format.Parse, text, message)
# Can't parse if field number is not found.
text = '1234:1\n'
six.assertRaisesRegex(
self,
self.assertRaisesRegex(
text_format.ParseError,
(r'1:1 : Message type "\w+.TestAllTypes" has no field named '
r'"1234".'),
@ -1492,13 +1479,13 @@ class Proto2Tests(TextFormatBase):
' i:\n' # Missing value.
' }\n'
'}\n')
six.assertRaisesRegex(self,
text_format.ParseError,
'Invalid field value: }',
text_format.Parse,
malformed,
message,
allow_unknown_extension=True)
self.assertRaisesRegex(
text_format.ParseError,
'Invalid field value: }',
text_format.Parse,
malformed,
message,
allow_unknown_extension=True)
message = unittest_mset_pb2.TestMessageSetContainer()
malformed = ('message_set {\n'
@ -1506,13 +1493,13 @@ class Proto2Tests(TextFormatBase):
' str: "malformed string\n' # Missing closing quote.
' }\n'
'}\n')
six.assertRaisesRegex(self,
text_format.ParseError,
'Invalid field value: "',
text_format.Parse,
malformed,
message,
allow_unknown_extension=True)
self.assertRaisesRegex(
text_format.ParseError,
'Invalid field value: "',
text_format.Parse,
malformed,
message,
allow_unknown_extension=True)
message = unittest_mset_pb2.TestMessageSetContainer()
malformed = ('message_set {\n'
@ -1520,13 +1507,13 @@ class Proto2Tests(TextFormatBase):
' str: "malformed\n multiline\n string\n'
' }\n'
'}\n')
six.assertRaisesRegex(self,
text_format.ParseError,
'Invalid field value: "',
text_format.Parse,
malformed,
message,
allow_unknown_extension=True)
self.assertRaisesRegex(
text_format.ParseError,
'Invalid field value: "',
text_format.Parse,
malformed,
message,
allow_unknown_extension=True)
message = unittest_mset_pb2.TestMessageSetContainer()
malformed = ('message_set {\n'
@ -1534,28 +1521,28 @@ class Proto2Tests(TextFormatBase):
' i: -5\n'
' \n' # Missing '>' here.
'}\n')
six.assertRaisesRegex(self,
text_format.ParseError,
'5:1 : \'}\': Expected ">".',
text_format.Parse,
malformed,
message,
allow_unknown_extension=True)
self.assertRaisesRegex(
text_format.ParseError,
'5:1 : \'}\': Expected ">".',
text_format.Parse,
malformed,
message,
allow_unknown_extension=True)
# Don't allow unknown fields with allow_unknown_extension=True.
message = unittest_mset_pb2.TestMessageSetContainer()
malformed = ('message_set {\n'
' unknown_field: true\n'
'}\n')
six.assertRaisesRegex(self,
text_format.ParseError,
('2:3 : Message type '
'"proto2_wireformat_unittest.TestMessageSet" has no'
' field named "unknown_field".'),
text_format.Parse,
malformed,
message,
allow_unknown_extension=True)
self.assertRaisesRegex(
text_format.ParseError,
('2:3 : Message type '
'"proto2_wireformat_unittest.TestMessageSet" has no'
' field named "unknown_field".'),
text_format.Parse,
malformed,
message,
allow_unknown_extension=True)
# Parse known extension correctly.
message = unittest_mset_pb2.TestMessageSetContainer()
@ -1585,22 +1572,24 @@ class Proto2Tests(TextFormatBase):
def testParseBadExtension(self):
message = unittest_pb2.TestAllExtensions()
text = '[unknown_extension]: 8\n'
six.assertRaisesRegex(self, text_format.ParseError,
'1:2 : Extension "unknown_extension" not registered.',
text_format.Parse, text, message)
self.assertRaisesRegex(
text_format.ParseError,
'1:2 : Extension "unknown_extension" not registered.',
text_format.Parse, text, message)
message = unittest_pb2.TestAllTypes()
six.assertRaisesRegex(self, text_format.ParseError, (
'1:2 : Message type "protobuf_unittest.TestAllTypes" does not have '
'extensions.'), text_format.Parse, text, message)
self.assertRaisesRegex(
text_format.ParseError,
('1:2 : Message type "protobuf_unittest.TestAllTypes" does not have '
'extensions.'), text_format.Parse, text, message)
def testParseNumericUnknownEnum(self):
message = unittest_pb2.TestAllTypes()
text = 'optional_nested_enum: 100'
six.assertRaisesRegex(self, text_format.ParseError,
(r'1:23 : \'optional_nested_enum: 100\': '
r'Enum type "\w+.TestAllTypes.NestedEnum" '
r'has no value with number 100.'), text_format.Parse,
text, message)
self.assertRaisesRegex(text_format.ParseError,
(r'1:23 : \'optional_nested_enum: 100\': '
r'Enum type "\w+.TestAllTypes.NestedEnum" '
r'has no value with number 100.'),
text_format.Parse, text, message)
def testMergeDuplicateExtensionScalars(self):
message = unittest_pb2.TestAllExtensions()
@ -1614,30 +1603,32 @@ class Proto2Tests(TextFormatBase):
message = unittest_pb2.TestAllExtensions()
text = ('[protobuf_unittest.optional_int32_extension]: 42 '
'[protobuf_unittest.optional_int32_extension]: 67')
six.assertRaisesRegex(self, text_format.ParseError, (
'1:96 : Message type "protobuf_unittest.TestAllExtensions" '
'should not have multiple '
'"protobuf_unittest.optional_int32_extension" extensions.'),
text_format.Parse, text, message)
self.assertRaisesRegex(
text_format.ParseError,
('1:96 : Message type "protobuf_unittest.TestAllExtensions" '
'should not have multiple '
'"protobuf_unittest.optional_int32_extension" extensions.'),
text_format.Parse, text, message)
def testParseDuplicateExtensionMessages(self):
message = unittest_pb2.TestAllExtensions()
text = ('[protobuf_unittest.optional_nested_message_extension]: {} '
'[protobuf_unittest.optional_nested_message_extension]: {}')
six.assertRaisesRegex(self, text_format.ParseError, (
'1:114 : Message type "protobuf_unittest.TestAllExtensions" '
'should not have multiple '
'"protobuf_unittest.optional_nested_message_extension" extensions.'),
text_format.Parse, text, message)
self.assertRaisesRegex(
text_format.ParseError,
('1:114 : Message type "protobuf_unittest.TestAllExtensions" '
'should not have multiple '
'"protobuf_unittest.optional_nested_message_extension" extensions.'),
text_format.Parse, text, message)
def testParseGroupNotClosed(self):
message = unittest_pb2.TestAllTypes()
text = 'RepeatedGroup: <'
six.assertRaisesRegex(self, text_format.ParseError, '1:16 : Expected ">".',
text_format.Parse, text, message)
self.assertRaisesRegex(text_format.ParseError, '1:16 : Expected ">".',
text_format.Parse, text, message)
text = 'RepeatedGroup: {'
six.assertRaisesRegex(self, text_format.ParseError, '1:16 : Expected "}".',
text_format.Parse, text, message)
self.assertRaisesRegex(text_format.ParseError, '1:16 : Expected "}".',
text_format.Parse, text, message)
def testParseEmptyGroup(self):
message = unittest_pb2.TestAllTypes()

View File

@ -45,16 +45,8 @@ TYPE_TO_DESERIALIZE_METHOD: A dictionary with field types and deserialization
__author__ = 'robinson@google.com (Will Robinson)'
try:
import ctypes
except Exception: # pylint: disable=broad-except
ctypes = None
import struct
import ctypes
import numbers
import six
if six.PY3:
long = int
from google.protobuf.internal import api_implementation
from google.protobuf.internal import decoder
@ -66,10 +58,7 @@ _FieldDescriptor = descriptor.FieldDescriptor
def TruncateToFourByteFloat(original):
if ctypes:
return ctypes.c_float(original).value
else:
return struct.unpack('<f', struct.pack('<f', original))[0]
return ctypes.c_float(original).value
def ToShortestFloat(original):
@ -162,14 +151,13 @@ class IntValueChecker(object):
def CheckValue(self, proposed_value):
if not isinstance(proposed_value, numbers.Integral):
message = ('%.1024r has type %s, but expected one of: %s' %
(proposed_value, type(proposed_value), six.integer_types))
(proposed_value, type(proposed_value), (int,)))
raise TypeError(message)
if not self._MIN <= int(proposed_value) <= self._MAX:
raise ValueError('Value out of range: %d' % proposed_value)
# We force 32-bit values to int and 64-bit values to long to make
# alternate implementations where the distinction is more significant
# (e.g. the C++ implementation) simpler.
proposed_value = self._TYPE(proposed_value)
# We force all values to int to make alternate implementations where the
# distinction is more significant (e.g. the C++ implementation) simpler.
proposed_value = int(proposed_value)
return proposed_value
def DefaultValue(self):
@ -186,7 +174,7 @@ class EnumValueChecker(object):
def CheckValue(self, proposed_value):
if not isinstance(proposed_value, numbers.Integral):
message = ('%.1024r has type %s, but expected one of: %s' %
(proposed_value, type(proposed_value), six.integer_types))
(proposed_value, type(proposed_value), (int,)))
raise TypeError(message)
if int(proposed_value) not in self._enum_type.values_by_number:
raise ValueError('Unknown enum value: %d' % proposed_value)
@ -204,9 +192,9 @@ class UnicodeValueChecker(object):
"""
def CheckValue(self, proposed_value):
if not isinstance(proposed_value, (bytes, six.text_type)):
if not isinstance(proposed_value, (bytes, str)):
message = ('%.1024r has type %s, but expected one of: %s' %
(proposed_value, type(proposed_value), (bytes, six.text_type)))
(proposed_value, type(proposed_value), (bytes, str)))
raise TypeError(message)
# If the value is of type 'bytes' make sure that it is valid UTF-8 data.
@ -237,25 +225,21 @@ class Int32ValueChecker(IntValueChecker):
# efficient.
_MIN = -2147483648
_MAX = 2147483647
_TYPE = int
class Uint32ValueChecker(IntValueChecker):
_MIN = 0
_MAX = (1 << 32) - 1
_TYPE = int
class Int64ValueChecker(IntValueChecker):
_MIN = -(1 << 63)
_MAX = (1 << 63) - 1
_TYPE = long
class Uint64ValueChecker(IntValueChecker):
_MIN = 0
_MAX = (1 << 64) - 1
_TYPE = long
# The max 4 bytes float is about 3.4028234663852886e+38

8
python/google/protobuf/internal/unknown_fields_test.py Executable file → Normal file
View File

@ -1,6 +1,4 @@
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# https://developers.google.com/protocol-buffers/
@ -35,11 +33,9 @@
__author__ = 'bohdank@google.com (Bohdan Koval)'
try:
import unittest2 as unittest #PY26
except ImportError:
import unittest
import sys
import unittest
from google.protobuf import map_unittest_pb2
from google.protobuf import unittest_mset_pb2
from google.protobuf import unittest_pb2

View File

@ -1,5 +1,3 @@
#! /usr/bin/env python
#
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# https://developers.google.com/protocol-buffers/
@ -34,19 +32,9 @@
__author__ = 'jieluo@google.com (Jie Luo)'
import collections.abc as collections_abc
import datetime
try:
# Since python 3
import collections.abc as collections_abc
except ImportError:
# Won't work after python 3.8
import collections as collections_abc
try:
import unittest2 as unittest #PY26
except ImportError:
import unittest
import unittest
from google.protobuf import any_pb2
from google.protobuf import duration_pb2

7
python/google/protobuf/internal/wire_format_test.py Executable file → Normal file
View File

@ -1,5 +1,3 @@
#! /usr/bin/env python
#
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# https://developers.google.com/protocol-buffers/
@ -34,10 +32,7 @@
__author__ = 'robinson@google.com (Will Robinson)'
try:
import unittest2 as unittest #PY26
except ImportError:
import unittest
import unittest
from google.protobuf import message
from google.protobuf.internal import wire_format

View File

@ -42,24 +42,15 @@ Simple usage example:
__author__ = 'jieluo@google.com (Jie Luo)'
# pylint: disable=g-statement-before-imports,g-import-not-at-top
try:
from collections import OrderedDict
except ImportError:
from ordereddict import OrderedDict # PY26
# pylint: enable=g-statement-before-imports,g-import-not-at-top
import base64
from collections import OrderedDict
import json
import math
from operator import methodcaller
import re
import sys
import six
from google.protobuf.internal import type_checkers
from google.protobuf import descriptor
from google.protobuf import symbol_database
@ -78,9 +69,8 @@ _INFINITY = 'Infinity'
_NEG_INFINITY = '-Infinity'
_NAN = 'NaN'
_UNPAIRED_SURROGATE_PATTERN = re.compile(six.u(
r'[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]'
))
_UNPAIRED_SURROGATE_PATTERN = re.compile(
u'[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]')
_VALID_EXTENSION_NAME = re.compile(r'\[[a-zA-Z0-9\._]*\]$')
@ -426,7 +416,8 @@ def Parse(text, message, ignore_unknown_fields=False, descriptor_pool=None):
Raises::
ParseError: On JSON parsing problems.
"""
if not isinstance(text, six.text_type): text = text.decode('utf-8')
if not isinstance(text, str):
text = text.decode('utf-8')
try:
js = json.loads(text, object_pairs_hook=_DuplicateChecker)
except ValueError as e:
@ -455,7 +446,7 @@ def ParseDict(js_dict,
return message
_INT_OR_FLOAT = six.integer_types + (float,)
_INT_OR_FLOAT = (int, float)
class _Parser(object):
@ -646,7 +637,7 @@ class _Parser(object):
message.null_value = 0
elif isinstance(value, bool):
message.bool_value = value
elif isinstance(value, six.string_types):
elif isinstance(value, str):
message.string_value = value
elif isinstance(value, _INT_OR_FLOAT):
message.number_value = value
@ -729,7 +720,7 @@ def _ConvertScalarFieldValue(value, field, require_str=False):
return _ConvertBool(value, require_str)
elif field.cpp_type == descriptor.FieldDescriptor.CPPTYPE_STRING:
if field.type == descriptor.FieldDescriptor.TYPE_BYTES:
if isinstance(value, six.text_type):
if isinstance(value, str):
encoded = value.encode('utf-8')
else:
encoded = value
@ -776,7 +767,7 @@ def _ConvertInteger(value):
if isinstance(value, float) and not value.is_integer():
raise ParseError('Couldn\'t parse integer: {0}.'.format(value))
if isinstance(value, six.text_type) and value.find(' ') != -1:
if isinstance(value, str) and value.find(' ') != -1:
raise ParseError('Couldn\'t parse integer: "{0}".'.format(value))
if isinstance(value, bool):

View File

@ -98,8 +98,6 @@ class MessageFactory(object):
A class describing the passed in descriptor.
"""
descriptor_name = descriptor.name
if str is bytes: # PY2
descriptor_name = descriptor.name.encode('ascii', 'ignore')
result_class = _GENERATED_PROTOCOL_MESSAGE_TYPE(
descriptor_name,
(message.Message,),

View File

@ -30,10 +30,7 @@
"""Dynamic Protobuf class creator."""
try:
from collections import OrderedDict
except ImportError:
from ordereddict import OrderedDict #PY26
from collections import OrderedDict
import hashlib
import os

View File

@ -31,8 +31,6 @@
"""Encoding related utilities."""
import re
import six
_cescape_chr_to_symbol_map = {}
_cescape_chr_to_symbol_map[9] = r'\t' # optional escape
_cescape_chr_to_symbol_map[10] = r'\n' # optional escape
@ -72,14 +70,11 @@ def CEscape(text, as_utf8):
# escapes whereas our C++ unescaping function allows hex escapes to be any
# length. So, "\0011".encode('string_escape') ends up being "\\x011", which
# will be decoded in C++ as a single-character string with char code 0x11.
if six.PY3:
text_is_unicode = isinstance(text, str)
if as_utf8 and text_is_unicode:
# We're already unicode, no processing beyond control char escapes.
return text.translate(_cescape_chr_to_symbol_map)
ord_ = ord if text_is_unicode else lambda x: x # bytes iterate as ints.
else:
ord_ = ord # PY2
text_is_unicode = isinstance(text, str)
if as_utf8 and text_is_unicode:
# We're already unicode, no processing beyond control char escapes.
return text.translate(_cescape_chr_to_symbol_map)
ord_ = ord if text_is_unicode else lambda x: x # bytes iterate as ints.
if as_utf8:
return ''.join(_cescape_unicode_to_str[ord_(c)] for c in text)
return ''.join(_cescape_byte_to_str[ord_(c)] for c in text)
@ -109,9 +104,7 @@ def CUnescape(text):
# allow single-digit hex escapes (like '\xf').
result = _CUNESCAPE_HEX.sub(ReplaceHex, text)
if six.PY2:
return result.decode('string_escape')
return (result.encode('utf-8') # PY3: Make it bytes to allow decode.
return (result.encode('utf-8') # Make it bytes to allow decode.
.decode('unicode_escape')
# Make it bytes again to return the proper type.
.encode('raw_unicode_escape'))

View File

@ -48,16 +48,12 @@ import encodings.unicode_escape # pylint: disable=unused-import
import io
import math
import re
import six
from google.protobuf.internal import decoder
from google.protobuf.internal import type_checkers
from google.protobuf import descriptor
from google.protobuf import text_encoding
if six.PY3:
long = int # pylint: disable=redefined-builtin,invalid-name
# pylint: disable=g-import-not-at-top
__all__ = ['MessageToString', 'Parse', 'PrintMessage', 'PrintField',
'PrintFieldValue', 'Merge', 'MessageToBytes']
@ -102,15 +98,9 @@ class ParseError(Error):
class TextWriter(object):
def __init__(self, as_utf8):
if six.PY2:
self._writer = io.BytesIO()
else:
self._writer = io.StringIO()
self._writer = io.StringIO()
def write(self, val):
if six.PY2:
if isinstance(val, six.text_type):
val = val.encode('utf-8')
return self._writer.write(val)
def close(self):
@ -562,7 +552,7 @@ class _Printer(object):
# Note: this is called only when value has at least one element.
self._PrintFieldName(field)
self.out.write(' [')
for i in six.moves.range(len(value) - 1):
for i in range(len(value) - 1):
self.PrintFieldValue(field, value[i])
self.out.write(', ')
self.PrintFieldValue(field, value[-1])
@ -608,7 +598,7 @@ class _Printer(object):
out.write(str(value))
elif field.cpp_type == descriptor.FieldDescriptor.CPPTYPE_STRING:
out.write('\"')
if isinstance(value, six.text_type) and (six.PY2 or not self.as_utf8):
if isinstance(value, str) and not self.as_utf8:
out_value = value.encode('utf-8')
else:
out_value = value
@ -839,12 +829,9 @@ class _Parser(object):
ParseError: On text parsing problems.
"""
# Tokenize expects native str lines.
if six.PY2:
str_lines = (line if isinstance(line, str) else line.encode('utf-8')
for line in lines)
else:
str_lines = (line if isinstance(line, str) else line.decode('utf-8')
for line in lines)
str_lines = (
line if isinstance(line, str) else line.decode('utf-8')
for line in lines)
tokenizer = Tokenizer(str_lines)
while not tokenizer.AtEnd():
self._MergeField(tokenizer, message)
@ -1395,17 +1382,14 @@ class Tokenizer(object):
def TryConsumeInteger(self):
try:
# Note: is_long only affects value type, not whether an error is raised.
self.ConsumeInteger()
return True
except ParseError:
return False
def ConsumeInteger(self, is_long=False):
def ConsumeInteger(self):
"""Consumes an integer number.
Args:
is_long: True if the value should be returned as a long integer.
Returns:
The integer parsed.
@ -1413,7 +1397,7 @@ class Tokenizer(object):
ParseError: If an integer couldn't be consumed.
"""
try:
result = _ParseAbstractInteger(self.token, is_long=is_long)
result = _ParseAbstractInteger(self.token)
except ValueError as e:
raise self.ParseError(str(e))
self.NextToken()
@ -1476,7 +1460,7 @@ class Tokenizer(object):
"""
the_bytes = self.ConsumeByteString()
try:
return six.text_type(the_bytes, 'utf-8')
return str(the_bytes, 'utf-8')
except UnicodeDecodeError as e:
raise self._StringParseError(e)
@ -1650,14 +1634,6 @@ def _ConsumeUint64(tokenizer):
return _ConsumeInteger(tokenizer, is_signed=False, is_long=True)
def _TryConsumeInteger(tokenizer, is_signed=False, is_long=False):
try:
_ConsumeInteger(tokenizer, is_signed=is_signed, is_long=is_long)
return True
except ParseError:
return False
def _ConsumeInteger(tokenizer, is_signed=False, is_long=False):
"""Consumes an integer number from tokenizer.
@ -1695,7 +1671,7 @@ def ParseInteger(text, is_signed=False, is_long=False):
ValueError: Thrown Iff the text is not a valid integer.
"""
# Do the actual parsing. Exception handling is propagated to caller.
result = _ParseAbstractInteger(text, is_long=is_long)
result = _ParseAbstractInteger(text)
# Check if the integer is sane. Exceptions handled by callers.
checker = _INTEGER_CHECKERS[2 * int(is_long) + int(is_signed)]
@ -1703,12 +1679,11 @@ def ParseInteger(text, is_signed=False, is_long=False):
return result
def _ParseAbstractInteger(text, is_long=False):
def _ParseAbstractInteger(text):
"""Parses an integer without checking size/signedness.
Args:
text: The text to parse.
is_long: True if the value should be returned as a long integer.
Returns:
The integer value.
@ -1724,13 +1699,7 @@ def _ParseAbstractInteger(text, is_long=False):
# we always use the '0o' prefix for multi-digit numbers starting with 0.
text = c_octal_match.group(1) + '0o' + c_octal_match.group(2)
try:
# We force 32-bit values to int and 64-bit values to long to make
# alternate implementations where the distinction is more significant
# (e.g. the C++ implementation) simpler.
if is_long:
return long(text, 0)
else:
return int(text, 0)
return int(text, 0)
except ValueError:
raise ValueError('Couldn\'t parse integer: %s' % orig_text)

View File

@ -73,15 +73,19 @@ nobase_include_HEADERS = \
google/protobuf/arenastring.h \
google/protobuf/compiler/code_generator.h \
google/protobuf/compiler/command_line_interface.h \
google/protobuf/compiler/cpp/cpp_file.h \
google/protobuf/compiler/cpp/cpp_generator.h \
google/protobuf/compiler/cpp/cpp_helpers.h \
google/protobuf/compiler/cpp/cpp_names.h \
google/protobuf/compiler/csharp/csharp_doc_comment.h \
google/protobuf/compiler/csharp/csharp_generator.h \
google/protobuf/compiler/csharp/csharp_names.h \
google/protobuf/compiler/csharp/csharp_options.h \
google/protobuf/compiler/importer.h \
google/protobuf/compiler/java/java_generator.h \
google/protobuf/compiler/java/java_kotlin_generator.h \
google/protobuf/compiler/java/java_names.h \
google/protobuf/compiler/js/js_generator.h \
google/protobuf/compiler/js/well_known_types_embed.h \
google/protobuf/compiler/objectivec/objectivec_generator.h \
google/protobuf/compiler/objectivec/objectivec_helpers.h \
google/protobuf/compiler/parser.h \
@ -105,6 +109,7 @@ nobase_include_HEADERS = \
google/protobuf/generated_message_bases.h \
google/protobuf/generated_message_reflection.h \
google/protobuf/generated_message_table_driven.h \
google/protobuf/generated_message_table_driven_lite.h \
google/protobuf/generated_message_tctable_decl.h \
google/protobuf/generated_message_tctable_impl.h \
google/protobuf/generated_message_tctable_impl.inc \
@ -133,15 +138,14 @@ nobase_include_HEADERS = \
google/protobuf/metadata.h \
google/protobuf/metadata_lite.h \
google/protobuf/parse_context.h \
google/protobuf/port.h \
google/protobuf/port_def.inc \
google/protobuf/port_undef.inc \
google/protobuf/port.h \
google/protobuf/reflection.h \
google/protobuf/reflection_ops.h \
google/protobuf/repeated_field.h \
google/protobuf/service.h \
google/protobuf/source_context.pb.h \
google/protobuf/string_member_robber.h \
google/protobuf/struct.pb.h \
google/protobuf/stubs/bytestream.h \
google/protobuf/stubs/callback.h \
@ -191,7 +195,7 @@ libprotobuf_lite_la_SOURCES = \
google/protobuf/extension_set.cc \
google/protobuf/generated_enum_util.cc \
google/protobuf/generated_message_table_driven_lite.cc \
google/protobuf/generated_message_table_driven_lite.h \
google/protobuf/generated_message_tctable_lite.cc \
google/protobuf/generated_message_util.cc \
google/protobuf/implicit_weak_message.cc \
google/protobuf/inlined_string_field.cc \
@ -205,21 +209,17 @@ libprotobuf_lite_la_SOURCES = \
google/protobuf/message_lite.cc \
google/protobuf/parse_context.cc \
google/protobuf/repeated_field.cc \
google/protobuf/string_member_robber.h \
google/protobuf/stubs/bytestream.cc \
google/protobuf/stubs/bytestream.h \
google/protobuf/stubs/common.cc \
google/protobuf/stubs/hash.h \
google/protobuf/stubs/int128.cc \
google/protobuf/stubs/int128.h \
google/protobuf/stubs/map_util.h \
google/protobuf/stubs/mathutil.h \
google/protobuf/stubs/status_macros.h \
google/protobuf/stubs/status.cc \
google/protobuf/stubs/status.h \
google/protobuf/stubs/status_macros.h \
google/protobuf/stubs/statusor.cc \
google/protobuf/stubs/statusor.h \
google/protobuf/stubs/stringpiece.cc \
google/protobuf/stubs/stringpiece.h \
google/protobuf/stubs/stringprintf.cc \
google/protobuf/stubs/stringprintf.h \
google/protobuf/stubs/structurally_valid.cc \
@ -252,7 +252,7 @@ libprotobuf_la_SOURCES = \
google/protobuf/generated_message_bases.cc \
google/protobuf/generated_message_reflection.cc \
google/protobuf/generated_message_table_driven.cc \
google/protobuf/generated_message_table_driven_lite.h \
google/protobuf/generated_message_tctable_full.cc \
google/protobuf/io/gzip_stream.cc \
google/protobuf/io/printer.cc \
google/protobuf/io/tokenizer.cc \
@ -303,7 +303,6 @@ libprotobuf_la_SOURCES = \
google/protobuf/util/internal/structured_objectwriter.h \
google/protobuf/util/internal/type_info.cc \
google/protobuf/util/internal/type_info.h \
google/protobuf/util/internal/type_info_test_helper.cc \
google/protobuf/util/internal/type_info_test_helper.h \
google/protobuf/util/internal/utility.cc \
google/protobuf/util/internal/utility.h \
@ -334,10 +333,8 @@ libprotoc_la_SOURCES = \
google/protobuf/compiler/cpp/cpp_field.cc \
google/protobuf/compiler/cpp/cpp_field.h \
google/protobuf/compiler/cpp/cpp_file.cc \
google/protobuf/compiler/cpp/cpp_file.h \
google/protobuf/compiler/cpp/cpp_generator.cc \
google/protobuf/compiler/cpp/cpp_helpers.cc \
google/protobuf/compiler/cpp/cpp_helpers.h \
google/protobuf/compiler/cpp/cpp_map_field.cc \
google/protobuf/compiler/cpp/cpp_map_field.h \
google/protobuf/compiler/cpp/cpp_message.cc \
@ -345,7 +342,6 @@ libprotoc_la_SOURCES = \
google/protobuf/compiler/cpp/cpp_message_field.cc \
google/protobuf/compiler/cpp/cpp_message_field.h \
google/protobuf/compiler/cpp/cpp_message_layout_helper.h \
google/protobuf/compiler/cpp/cpp_names.h \
google/protobuf/compiler/cpp/cpp_options.h \
google/protobuf/compiler/cpp/cpp_padding_optimizer.cc \
google/protobuf/compiler/cpp/cpp_padding_optimizer.h \
@ -358,7 +354,6 @@ libprotoc_la_SOURCES = \
google/protobuf/compiler/cpp/cpp_string_field.cc \
google/protobuf/compiler/cpp/cpp_string_field.h \
google/protobuf/compiler/csharp/csharp_doc_comment.cc \
google/protobuf/compiler/csharp/csharp_doc_comment.h \
google/protobuf/compiler/csharp/csharp_enum.cc \
google/protobuf/compiler/csharp/csharp_enum.h \
google/protobuf/compiler/csharp/csharp_enum_field.cc \
@ -374,11 +369,10 @@ libprotoc_la_SOURCES = \
google/protobuf/compiler/csharp/csharp_message.h \
google/protobuf/compiler/csharp/csharp_message_field.cc \
google/protobuf/compiler/csharp/csharp_message_field.h \
google/protobuf/compiler/csharp/csharp_options.h \
google/protobuf/compiler/csharp/csharp_primitive_field.cc \
google/protobuf/compiler/csharp/csharp_primitive_field.h \
google/protobuf/compiler/csharp/csharp_reflection_class.cc \
google/protobuf/compiler/csharp/csharp_reflection_class.h \
google/protobuf/compiler/csharp/csharp_reflection_class.cc \
google/protobuf/compiler/csharp/csharp_reflection_class.h \
google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc \
google/protobuf/compiler/csharp/csharp_repeated_enum_field.h \
google/protobuf/compiler/csharp/csharp_repeated_message_field.cc \
@ -448,6 +442,7 @@ libprotoc_la_SOURCES = \
google/protobuf/compiler/java/java_string_field_lite.h \
google/protobuf/compiler/js/js_generator.cc \
google/protobuf/compiler/js/well_known_types_embed.cc \
google/protobuf/compiler/js/well_known_types_embed.h \
google/protobuf/compiler/objectivec/objectivec_enum.cc \
google/protobuf/compiler/objectivec/objectivec_enum.h \
google/protobuf/compiler/objectivec/objectivec_enum_field.cc \
@ -460,7 +455,6 @@ libprotoc_la_SOURCES = \
google/protobuf/compiler/objectivec/objectivec_file.h \
google/protobuf/compiler/objectivec/objectivec_generator.cc \
google/protobuf/compiler/objectivec/objectivec_helpers.cc \
google/protobuf/compiler/objectivec/objectivec_helpers.h \
google/protobuf/compiler/objectivec/objectivec_map_field.cc \
google/protobuf/compiler/objectivec/objectivec_map_field.h \
google/protobuf/compiler/objectivec/objectivec_message.cc \
@ -542,18 +536,18 @@ protoc_inputs = \
EXTRA_DIST = \
$(protoc_inputs) \
solaris/libstdc++.la \
README.md \
google/protobuf/compiler/package_info.h \
google/protobuf/compiler/ruby/ruby_generated_code.proto \
google/protobuf/compiler/ruby/ruby_generated_code_pb.rb \
google/protobuf/compiler/ruby/ruby_generated_code_proto2.proto \
google/protobuf/compiler/ruby/ruby_generated_code_proto2_pb.rb \
google/protobuf/compiler/ruby/ruby_generated_pkg_explicit.proto \
google/protobuf/compiler/ruby/ruby_generated_code_proto2.proto \
google/protobuf/compiler/ruby/ruby_generated_code_proto2_pb.rb \
google/protobuf/compiler/ruby/ruby_generated_pkg_explicit.proto \
google/protobuf/compiler/ruby/ruby_generated_pkg_explicit_legacy.proto \
google/protobuf/compiler/ruby/ruby_generated_pkg_explicit_legacy_pb.rb \
google/protobuf/compiler/ruby/ruby_generated_pkg_explicit_pb.rb \
google/protobuf/compiler/ruby/ruby_generated_pkg_implicit.proto \
google/protobuf/compiler/ruby/ruby_generated_pkg_implicit_pb.rb \
google/protobuf/compiler/ruby/ruby_generated_pkg_explicit_pb.rb \
google/protobuf/compiler/ruby/ruby_generated_pkg_implicit.proto \
google/protobuf/compiler/ruby/ruby_generated_pkg_implicit_pb.rb \
google/protobuf/compiler/zip_output_unittest.sh \
google/protobuf/io/gzip_stream.h \
google/protobuf/io/gzip_stream_unittest.sh \
@ -569,16 +563,16 @@ EXTRA_DIST = \
google/protobuf/testdata/golden_packed_fields_message \
google/protobuf/testdata/map_test_data.txt \
google/protobuf/testdata/text_format_unittest_data.txt \
google/protobuf/testdata/text_format_unittest_data_oneof_implemented.txt \
google/protobuf/testdata/text_format_unittest_data_pointy.txt \
google/protobuf/testdata/text_format_unittest_data_pointy_oneof.txt \
google/protobuf/testdata/text_format_unittest_extensions_data.txt \
google/protobuf/testdata/text_format_unittest_extensions_data_pointy.txt \
google/protobuf/testdata/text_format_unittest_data_oneof_implemented.txt \
google/protobuf/testdata/text_format_unittest_data_pointy.txt \
google/protobuf/testdata/text_format_unittest_data_pointy_oneof.txt \
google/protobuf/testdata/text_format_unittest_extensions_data.txt \
google/protobuf/testdata/text_format_unittest_extensions_data_pointy.txt \
google/protobuf/util/package_info.h \
libprotobuf-lite.map \
libprotobuf.map \
libprotoc.map \
README.md
solaris/libstdc++.la
protoc_lite_outputs = \
google/protobuf/map_lite_unittest.pb.cc \
@ -703,11 +697,9 @@ endif
$(protoc_outputs): unittest_proto_middleman
COMMON_TEST_SOURCES = \
google/protobuf/arena_test_util.cc \
google/protobuf/arena_test_util.h \
$(COMMON_LITE_TEST_SOURCES) \
google/protobuf/compiler/cpp/cpp_unittest.h \
google/protobuf/map_test_util.h \
google/protobuf/map_test_util.inc \
google/protobuf/map_test_util_impl.h \
google/protobuf/reflection_tester.cc \
google/protobuf/reflection_tester.h \
google/protobuf/test_util.cc \
@ -737,6 +729,7 @@ protobuf_test_CPPFLAGS = -I$(GOOGLETEST_SRC_DIR)/include \
# See configure.ac for more info.
protobuf_test_CXXFLAGS = $(NO_OPT_CXXFLAGS)
protobuf_test_SOURCES = \
$(COMMON_TEST_SOURCES) \
google/protobuf/any_test.cc \
google/protobuf/arena_unittest.cc \
google/protobuf/arenastring_unittest.cc \
@ -747,7 +740,6 @@ protobuf_test_SOURCES = \
google/protobuf/compiler/cpp/cpp_move_unittest.cc \
google/protobuf/compiler/cpp/cpp_plugin_unittest.cc \
google/protobuf/compiler/cpp/cpp_unittest.cc \
google/protobuf/compiler/cpp/cpp_unittest.h \
google/protobuf/compiler/cpp/cpp_unittest.inc \
google/protobuf/compiler/cpp/metadata_test.cc \
google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc \
@ -815,8 +807,7 @@ protobuf_test_SOURCES = \
google/protobuf/util/type_resolver_util_test.cc \
google/protobuf/well_known_types_unittest.cc \
google/protobuf/wire_format_unittest.cc \
google/protobuf/wire_format_unittest.inc \
$(COMMON_TEST_SOURCES)
google/protobuf/wire_format_unittest.inc
nodist_protobuf_test_SOURCES = $(protoc_outputs)
$(am_protobuf_test_OBJECTS): unittest_proto_middleman
@ -842,6 +833,7 @@ COMMON_LITE_TEST_SOURCES = \
google/protobuf/arena_test_util.h \
google/protobuf/map_lite_test_util.cc \
google/protobuf/map_lite_test_util.h \
google/protobuf/map_test_util_impl.h \
google/protobuf/test_util_lite.cc \
google/protobuf/test_util_lite.h

View File

@ -36,7 +36,7 @@ static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_google_2fprotobuf_2
static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_google_2fprotobuf_2fany_2eproto = nullptr;
static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_google_2fprotobuf_2fany_2eproto = nullptr;
const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_google_2fprotobuf_2fany_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
const uint32_t TableStruct_google_2fprotobuf_2fany_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
~0u, // no _has_bits_
PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Any, _internal_metadata_),
~0u, // no _extensions_
@ -112,11 +112,17 @@ Any::Any(const Any& from)
_any_metadata_(&type_url_, &value_) {
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
type_url_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
type_url_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (!from._internal_type_url().empty()) {
type_url_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_type_url(),
GetArenaForAllocation());
}
value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (!from._internal_value().empty()) {
value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_value(),
GetArenaForAllocation());
@ -126,7 +132,13 @@ Any::Any(const Any& from)
inline void Any::SharedCtor() {
type_url_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
type_url_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
}
Any::~Any() {
@ -154,7 +166,7 @@ void Any::SetCachedSize(int size) const {
void Any::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.Any)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@ -166,12 +178,12 @@ void Any::Clear() {
const char* Any::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
::PROTOBUF_NAMESPACE_ID::uint32 tag;
uint32_t tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
switch (tag >> 3) {
// string type_url = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
auto str = _internal_mutable_type_url();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Any.type_url"));
@ -181,7 +193,7 @@ const char* Any::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::intern
continue;
// bytes value = 2;
case 2:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) {
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) {
auto str = _internal_mutable_value();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
CHK_(ptr);
@ -211,10 +223,10 @@ failure:
#undef CHK_
}
::PROTOBUF_NAMESPACE_ID::uint8* Any::_InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
uint8_t* Any::_InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Any)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
// string type_url = 1;
@ -245,7 +257,7 @@ size_t Any::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:google.protobuf.Any)
size_t total_size = 0;
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@ -282,7 +294,7 @@ void Any::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
void Any::MergeFrom(const Any& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Any)
GOOGLE_DCHECK_NE(&from, this);
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
if (!from._internal_type_url().empty()) {

View File

@ -50,7 +50,7 @@ struct PROTOBUF_EXPORT TableStruct_google_2fprotobuf_2fany_2eproto {
PROTOBUF_SECTION_VARIABLE(protodesc_cold);
static const ::PROTOBUF_NAMESPACE_ID::internal::FieldMetadata field_metadata[];
static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[];
static const ::PROTOBUF_NAMESPACE_ID::uint32 offsets[];
static const uint32_t offsets[];
};
PROTOBUF_EXPORT extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fprotobuf_2fany_2eproto;
PROTOBUF_NAMESPACE_OPEN
@ -191,8 +191,8 @@ class PROTOBUF_EXPORT Any final :
size_t ByteSizeLong() const final;
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
uint8_t* _InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
@ -320,6 +320,11 @@ inline void Any::set_allocated_type_url(std::string* type_url) {
}
type_url_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), type_url,
GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (type_url_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
type_url_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Any.type_url)
}
@ -366,6 +371,11 @@ inline void Any::set_allocated_value(std::string* value) {
}
value_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value,
GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (value_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Any.value)
}

View File

@ -73,7 +73,7 @@ static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_google_2fprotobuf_2
static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_google_2fprotobuf_2fapi_2eproto = nullptr;
static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_google_2fprotobuf_2fapi_2eproto = nullptr;
const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_google_2fprotobuf_2fapi_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
const uint32_t TableStruct_google_2fprotobuf_2fapi_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
~0u, // no _has_bits_
PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Api, _internal_metadata_),
~0u, // no _extensions_
@ -200,11 +200,17 @@ Api::Api(const Api& from)
mixins_(from.mixins_) {
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (!from._internal_name().empty()) {
name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(),
GetArenaForAllocation());
}
version_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
version_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (!from._internal_version().empty()) {
version_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_version(),
GetArenaForAllocation());
@ -220,7 +226,13 @@ Api::Api(const Api& from)
inline void Api::SharedCtor() {
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
version_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
version_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(
reinterpret_cast<char*>(&source_context_) - reinterpret_cast<char*>(this)),
0, static_cast<size_t>(reinterpret_cast<char*>(&syntax_) -
@ -253,7 +265,7 @@ void Api::SetCachedSize(int size) const {
void Api::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.Api)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@ -273,12 +285,12 @@ void Api::Clear() {
const char* Api::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
::PROTOBUF_NAMESPACE_ID::uint32 tag;
uint32_t tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
switch (tag >> 3) {
// string name = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
auto str = _internal_mutable_name();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Api.name"));
@ -288,7 +300,7 @@ const char* Api::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::intern
continue;
// repeated .google.protobuf.Method methods = 2;
case 2:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) {
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) {
ptr -= 1;
do {
ptr += 1;
@ -301,7 +313,7 @@ const char* Api::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::intern
continue;
// repeated .google.protobuf.Option options = 3;
case 3:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) {
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 26)) {
ptr -= 1;
do {
ptr += 1;
@ -314,7 +326,7 @@ const char* Api::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::intern
continue;
// string version = 4;
case 4:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 34)) {
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 34)) {
auto str = _internal_mutable_version();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Api.version"));
@ -324,7 +336,7 @@ const char* Api::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::intern
continue;
// .google.protobuf.SourceContext source_context = 5;
case 5:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 42)) {
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 42)) {
ptr = ctx->ParseMessage(_internal_mutable_source_context(), ptr);
CHK_(ptr);
} else
@ -332,7 +344,7 @@ const char* Api::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::intern
continue;
// repeated .google.protobuf.Mixin mixins = 6;
case 6:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 50)) {
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 50)) {
ptr -= 1;
do {
ptr += 1;
@ -345,8 +357,8 @@ const char* Api::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::intern
continue;
// .google.protobuf.Syntax syntax = 7;
case 7:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 56)) {
::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 56)) {
uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
CHK_(ptr);
_internal_set_syntax(static_cast<::PROTOBUF_NAMESPACE_ID::Syntax>(val));
} else
@ -375,10 +387,10 @@ failure:
#undef CHK_
}
::PROTOBUF_NAMESPACE_ID::uint8* Api::_InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
uint8_t* Api::_InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Api)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
// string name = 1;
@ -452,7 +464,7 @@ size_t Api::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:google.protobuf.Api)
size_t total_size = 0;
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@ -523,7 +535,7 @@ void Api::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
void Api::MergeFrom(const Api& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Api)
GOOGLE_DCHECK_NE(&from, this);
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
methods_.MergeFrom(from.methods_);
@ -611,16 +623,25 @@ Method::Method(const Method& from)
options_(from.options_) {
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (!from._internal_name().empty()) {
name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(),
GetArenaForAllocation());
}
request_type_url_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
request_type_url_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (!from._internal_request_type_url().empty()) {
request_type_url_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_request_type_url(),
GetArenaForAllocation());
}
response_type_url_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
response_type_url_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (!from._internal_response_type_url().empty()) {
response_type_url_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_response_type_url(),
GetArenaForAllocation());
@ -633,8 +654,17 @@ Method::Method(const Method& from)
inline void Method::SharedCtor() {
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
request_type_url_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
request_type_url_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
response_type_url_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
response_type_url_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(
reinterpret_cast<char*>(&request_streaming_) - reinterpret_cast<char*>(this)),
0, static_cast<size_t>(reinterpret_cast<char*>(&syntax_) -
@ -667,7 +697,7 @@ void Method::SetCachedSize(int size) const {
void Method::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.Method)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@ -684,12 +714,12 @@ void Method::Clear() {
const char* Method::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
::PROTOBUF_NAMESPACE_ID::uint32 tag;
uint32_t tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
switch (tag >> 3) {
// string name = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
auto str = _internal_mutable_name();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Method.name"));
@ -699,7 +729,7 @@ const char* Method::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::int
continue;
// string request_type_url = 2;
case 2:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) {
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) {
auto str = _internal_mutable_request_type_url();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Method.request_type_url"));
@ -709,7 +739,7 @@ const char* Method::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::int
continue;
// bool request_streaming = 3;
case 3:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 24)) {
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 24)) {
request_streaming_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
CHK_(ptr);
} else
@ -717,7 +747,7 @@ const char* Method::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::int
continue;
// string response_type_url = 4;
case 4:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 34)) {
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 34)) {
auto str = _internal_mutable_response_type_url();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Method.response_type_url"));
@ -727,7 +757,7 @@ const char* Method::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::int
continue;
// bool response_streaming = 5;
case 5:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 40)) {
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 40)) {
response_streaming_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
CHK_(ptr);
} else
@ -735,7 +765,7 @@ const char* Method::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::int
continue;
// repeated .google.protobuf.Option options = 6;
case 6:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 50)) {
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 50)) {
ptr -= 1;
do {
ptr += 1;
@ -748,8 +778,8 @@ const char* Method::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::int
continue;
// .google.protobuf.Syntax syntax = 7;
case 7:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 56)) {
::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 56)) {
uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
CHK_(ptr);
_internal_set_syntax(static_cast<::PROTOBUF_NAMESPACE_ID::Syntax>(val));
} else
@ -778,10 +808,10 @@ failure:
#undef CHK_
}
::PROTOBUF_NAMESPACE_ID::uint8* Method::_InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
uint8_t* Method::_InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Method)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
// string name = 1;
@ -853,7 +883,7 @@ size_t Method::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:google.protobuf.Method)
size_t total_size = 0;
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@ -920,7 +950,7 @@ void Method::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
void Method::MergeFrom(const Method& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Method)
GOOGLE_DCHECK_NE(&from, this);
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
options_.MergeFrom(from.options_);
@ -1010,11 +1040,17 @@ Mixin::Mixin(const Mixin& from)
: ::PROTOBUF_NAMESPACE_ID::Message() {
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (!from._internal_name().empty()) {
name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(),
GetArenaForAllocation());
}
root_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
root_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (!from._internal_root().empty()) {
root_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_root(),
GetArenaForAllocation());
@ -1024,7 +1060,13 @@ Mixin::Mixin(const Mixin& from)
inline void Mixin::SharedCtor() {
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
root_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
root_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
}
Mixin::~Mixin() {
@ -1052,7 +1094,7 @@ void Mixin::SetCachedSize(int size) const {
void Mixin::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.Mixin)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@ -1064,12 +1106,12 @@ void Mixin::Clear() {
const char* Mixin::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
::PROTOBUF_NAMESPACE_ID::uint32 tag;
uint32_t tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
switch (tag >> 3) {
// string name = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
auto str = _internal_mutable_name();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Mixin.name"));
@ -1079,7 +1121,7 @@ const char* Mixin::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inte
continue;
// string root = 2;
case 2:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) {
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) {
auto str = _internal_mutable_root();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Mixin.root"));
@ -1110,10 +1152,10 @@ failure:
#undef CHK_
}
::PROTOBUF_NAMESPACE_ID::uint8* Mixin::_InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
uint8_t* Mixin::_InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Mixin)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
// string name = 1;
@ -1148,7 +1190,7 @@ size_t Mixin::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:google.protobuf.Mixin)
size_t total_size = 0;
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@ -1185,7 +1227,7 @@ void Mixin::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
void Mixin::MergeFrom(const Mixin& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Mixin)
GOOGLE_DCHECK_NE(&from, this);
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
if (!from._internal_name().empty()) {

View File

@ -52,7 +52,7 @@ struct PROTOBUF_EXPORT TableStruct_google_2fprotobuf_2fapi_2eproto {
PROTOBUF_SECTION_VARIABLE(protodesc_cold);
static const ::PROTOBUF_NAMESPACE_ID::internal::FieldMetadata field_metadata[];
static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[];
static const ::PROTOBUF_NAMESPACE_ID::uint32 offsets[];
static const uint32_t offsets[];
};
PROTOBUF_EXPORT extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fprotobuf_2fapi_2eproto;
PROTOBUF_NAMESPACE_OPEN
@ -168,8 +168,8 @@ class PROTOBUF_EXPORT Api final :
size_t ByteSizeLong() const final;
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
uint8_t* _InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
@ -428,8 +428,8 @@ class PROTOBUF_EXPORT Method final :
size_t ByteSizeLong() const final;
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
uint8_t* _InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
@ -666,8 +666,8 @@ class PROTOBUF_EXPORT Mixin final :
size_t ByteSizeLong() const final;
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
uint8_t* _InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
@ -794,6 +794,11 @@ inline void Api::set_allocated_name(std::string* name) {
}
name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name,
GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Api.name)
}
@ -917,6 +922,11 @@ inline void Api::set_allocated_version(std::string* version) {
}
version_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), version,
GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (version_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
version_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Api.version)
}
@ -1113,6 +1123,11 @@ inline void Method::set_allocated_name(std::string* name) {
}
name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name,
GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Method.name)
}
@ -1159,6 +1174,11 @@ inline void Method::set_allocated_request_type_url(std::string* request_type_url
}
request_type_url_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), request_type_url,
GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (request_type_url_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
request_type_url_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Method.request_type_url)
}
@ -1225,6 +1245,11 @@ inline void Method::set_allocated_response_type_url(std::string* response_type_u
}
response_type_url_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), response_type_url,
GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (response_type_url_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
response_type_url_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Method.response_type_url)
}
@ -1352,6 +1377,11 @@ inline void Mixin::set_allocated_name(std::string* name) {
}
name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name,
GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Mixin.name)
}
@ -1398,6 +1428,11 @@ inline void Mixin::set_allocated_root(std::string* root) {
}
root_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), root,
GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (root_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
root_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Mixin.root)
}

View File

@ -414,6 +414,16 @@ class PROTOBUF_EXPORT PROTOBUF_ALIGNAS(8) Arena final {
p, std::is_convertible<T*, MessageLite*>());
}
// Creates message-owned arena.
static Arena* CreateMessageOwnedArena() {
return new Arena(internal::MessageOwned{});
}
// Checks whether the given arena is message-owned.
static bool IsMessageOwnedArena(Arena* arena) {
return arena->IsMessageOwned();
}
private:
static Arena* GetArenaForAllocationInternal(
const T* p, std::true_type /*is_derived_from<MessageLite>*/) {
@ -521,6 +531,14 @@ class PROTOBUF_EXPORT PROTOBUF_ALIGNAS(8) Arena final {
template <typename T>
struct has_get_arena : InternalHelper<T>::has_get_arena {};
// Constructor solely used by message-owned arena.
inline Arena(internal::MessageOwned) : impl_(internal::MessageOwned{}) {}
// Checks whether this arena is message-owned.
PROTOBUF_ALWAYS_INLINE bool IsMessageOwned() const {
return impl_.IsMessageOwned();
}
template <typename T, typename... Args>
PROTOBUF_NDEBUG_INLINE static T* CreateMessageInternal(Arena* arena,
Args&&... args) {

View File

@ -255,6 +255,13 @@ class PROTOBUF_EXPORT SerialArena {
static constexpr size_t kCleanupSize = AlignUpTo8(sizeof(CleanupNode));
};
// Tag type used to invoke the constructor of message-owned arena.
// Only message-owned arenas use this constructor for creation.
// Such constructors are internal implementation details of the library.
struct MessageOwned {
explicit MessageOwned() = default;
};
// This class provides the core Arena memory allocation library. Different
// implementations only need to implement the public interface below.
// Arena is not a template type as that would only be useful if all protos
@ -265,6 +272,11 @@ class PROTOBUF_EXPORT ThreadSafeArena {
public:
ThreadSafeArena() { Init(false); }
// Constructor solely used by message-owned arena.
ThreadSafeArena(internal::MessageOwned) : alloc_policy_(kMessageOwnedArena) {
Init(false);
}
ThreadSafeArena(char* mem, size_t size) { InitializeFrom(mem, size); }
explicit ThreadSafeArena(void* mem, size_t size,
@ -320,6 +332,11 @@ class PROTOBUF_EXPORT ThreadSafeArena {
// Add object pointer and cleanup function pointer to the list.
void AddCleanup(void* elem, void (*cleanup)(void*));
// Checks whether this arena is message-owned.
PROTOBUF_ALWAYS_INLINE bool IsMessageOwned() const {
return alloc_policy_ & kMessageOwnedArena;
}
private:
// Unique for each arena. Changes on Reset().
uint64_t tag_and_id_;
@ -328,7 +345,11 @@ class PROTOBUF_EXPORT ThreadSafeArena {
intptr_t alloc_policy_ = 0; // Tagged pointer to AllocPolicy.
// The LSB of alloc_policy_ indicates if the user owns the initial block.
enum { kUserOwnedInitialBlock = 1 };
// The second LSB of alloc_policy_ indicates if the arena is message-owned.
enum {
kUserOwnedInitialBlock = 1,
kMessageOwnedArena = 2,
};
// Pointer to a linked list of SerialArena.
std::atomic<SerialArena*> threads_;

View File

@ -759,6 +759,7 @@ TEST(ArenaTest, AddAllocatedWithReflection) {
}
TEST(ArenaTest, RepeatedPtrFieldAddClearedTest) {
#ifndef PROTOBUF_FUTURE_BREAKING_CHANGES
{
RepeatedPtrField<TestAllTypes> repeated_field;
EXPECT_TRUE(repeated_field.empty());
@ -769,6 +770,7 @@ TEST(ArenaTest, RepeatedPtrFieldAddClearedTest) {
EXPECT_TRUE(repeated_field.empty());
EXPECT_EQ(0, repeated_field.size());
}
#endif // !PROTOBUF_FUTURE_BREAKING_CHANGES
{
RepeatedPtrField<TestAllTypes> repeated_field;
EXPECT_TRUE(repeated_field.empty());

View File

@ -78,7 +78,7 @@ bool RunProtoCompiler(const std::string& filename,
bool DecodeMetadata(const std::string& path, GeneratedCodeInfo* info);
// Finds all of the Annotations for a given source file and path.
// See Location.path in http://google3/net/proto2/proto/descriptor.proto for
// See Location.path in https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/descriptor.proto for
// explanation of what path vector is.
void FindAnnotationsOnPath(
const GeneratedCodeInfo& info, const std::string& source_file,
@ -88,7 +88,7 @@ void FindAnnotationsOnPath(
// Finds the Annotation for a given source file and path (or returns null if it
// couldn't). If there are several annotations for given path, returns the first
// one. See Location.path in
// http://google3/net/proto2/proto/descriptor.proto for explanation of what path
// https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/descriptor.proto for explanation of what path
// vector is.
const GeneratedCodeInfo::Annotation* FindAnnotationOnPath(
const GeneratedCodeInfo& info, const std::string& source_file,

View File

@ -44,18 +44,6 @@ namespace protobuf {
namespace compiler {
namespace cpp {
namespace {
// Returns the fully-qualified class name of the message that this field
// extends. This function is used in the Google-internal code to handle some
// legacy cases.
std::string ExtendeeClassName(const FieldDescriptor* descriptor) {
const Descriptor* extendee = descriptor->containing_type();
return ClassName(extendee, true);
}
} // anonymous namespace
ExtensionGenerator::ExtensionGenerator(const FieldDescriptor* descriptor,
const Options& options,
MessageSCCAnalyzer* scc_analyzer)
@ -88,7 +76,8 @@ ExtensionGenerator::ExtensionGenerator(const FieldDescriptor* descriptor,
break;
}
SetCommonVars(options, &variables_);
variables_["extendee"] = ExtendeeClassName(descriptor_);
variables_["extendee"] =
QualifiedClassName(descriptor_->containing_type(), options_);
variables_["type_traits"] = type_traits_;
std::string name = descriptor_->name();
variables_["name"] = ResolveKeyword(name);

View File

@ -1178,7 +1178,8 @@ void FileGenerator::GenerateLibraryIncludes(io::Printer* printer) {
IncludeFile("net/proto2/io/public/coded_stream.h", printer);
IncludeFile("net/proto2/public/arena.h", printer);
IncludeFile("net/proto2/public/arenastring.h", printer);
if (options_.force_inline_string || options_.profile_driven_inline_string) {
if ((options_.force_inline_string || options_.profile_driven_inline_string) &&
!options_.opensource_runtime) {
IncludeFile("net/proto2/public/inlined_string_field.h", printer);
}
if (HasSimpleBaseClasses(file_, options_)) {

View File

@ -58,6 +58,7 @@
#include <google/protobuf/stubs/substitute.h>
#include <google/protobuf/stubs/hash.h>
// Must be last.
#include <google/protobuf/port_def.inc>
namespace google {
@ -170,11 +171,7 @@ static std::unordered_set<std::string>* MakeKeywordsMap() {
static std::unordered_set<std::string>& kKeywords = *MakeKeywordsMap();
std::string IntTypeName(const Options& options, const std::string& type) {
if (options.opensource_runtime) {
return "::PROTOBUF_NAMESPACE_ID::" + type;
} else {
return "::" + type;
}
return type + "_t";
}
void SetIntVar(const Options& options, const std::string& type,
@ -456,6 +453,19 @@ std::string FieldName(const FieldDescriptor* field) {
return result;
}
std::string OneofCaseConstantName(const FieldDescriptor* field) {
GOOGLE_DCHECK(field->containing_oneof());
std::string field_name = UnderscoresToCamelCase(field->name(), true);
return "k" + field_name;
}
std::string QualifiedOneofCaseConstantName(const FieldDescriptor* field) {
GOOGLE_DCHECK(field->containing_oneof());
const std::string qualification =
QualifiedClassName(field->containing_type());
return StrCat(qualification, "::", OneofCaseConstantName(field));
}
std::string EnumValueName(const EnumValueDescriptor* enum_value) {
std::string result = enum_value->name();
if (kKeywords.count(result) > 0) {
@ -522,13 +532,13 @@ std::string StripProto(const std::string& filename) {
const char* PrimitiveTypeName(FieldDescriptor::CppType type) {
switch (type) {
case FieldDescriptor::CPPTYPE_INT32:
return "::google::protobuf::int32";
return "int32_t";
case FieldDescriptor::CPPTYPE_INT64:
return "::google::protobuf::int64";
return "int64_t";
case FieldDescriptor::CPPTYPE_UINT32:
return "::google::protobuf::uint32";
return "uint32_t";
case FieldDescriptor::CPPTYPE_UINT64:
return "::google::protobuf::uint64";
return "uint64_t";
case FieldDescriptor::CPPTYPE_DOUBLE:
return "double";
case FieldDescriptor::CPPTYPE_FLOAT:

View File

@ -1437,7 +1437,8 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* printer) {
if (EnableMessageOwnedArena(descriptor_)) {
format(
"inline $classname$() : $classname$("
"new ::$proto_ns$::Arena(), true) {}\n");
"::$proto_ns$::Arena::InternalHelper<$classname$>::\n"
" CreateMessageOwnedArena(), true) {}\n");
} else {
format("inline $classname$() : $classname$(nullptr) {}\n");
}
@ -1530,10 +1531,8 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* printer) {
format("enum $1$Case {\n", UnderscoresToCamelCase(oneof->name(), true));
format.Indent();
for (auto field : FieldRange(oneof)) {
std::string oneof_enum_case_field_name =
UnderscoresToCamelCase(field->name(), true);
format("k$1$ = $2$,\n", oneof_enum_case_field_name, // 1
field->number()); // 2
format("$1$ = $2$,\n", OneofCaseConstantName(field), // 1
field->number()); // 2
}
format("$1$_NOT_SET = 0,\n", ToUpper(oneof->name()));
format.Outdent();

View File

@ -73,6 +73,12 @@ std::string QualifiedExtensionName(const FieldDescriptor* d);
// anyway, so normally this just returns field->name().
std::string FieldName(const FieldDescriptor* field);
// Requires that this field is in a oneof. Returns the (unqualified) case
// constant for this field.
std::string OneofCaseConstantName(const FieldDescriptor* field);
// Returns the quafilied case constant for this field.
std::string QualifiedOneofCaseConstantName(const FieldDescriptor* field);
// Get the (unqualified) name that should be used for this enum value in C++
// code.
std::string EnumValueName(const EnumValueDescriptor* enum_value);

View File

@ -292,6 +292,14 @@ void StringFieldGenerator::GenerateInlineAccessorDefinitions(
format(
" return $name$_.ReleaseNonDefault($init_value$, "
"GetArenaForAllocation());\n");
if (descriptor_->default_value_string().empty()) {
format(
"#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING\n"
" if ($name$_.IsDefault($init_value$)) {\n"
" $name$_.Set($init_value$, \"\", GetArenaForAllocation());\n"
" }\n"
"#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING\n");
}
} else {
format(
" return $name$_.Release(nullptr, GetArenaForAllocation(), "
@ -314,6 +322,14 @@ void StringFieldGenerator::GenerateInlineAccessorDefinitions(
format(
" $name$_.SetAllocated($init_value$, $name$,\n"
" GetArenaForAllocation());\n");
if (descriptor_->default_value_string().empty()) {
format(
"#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING\n"
" if ($name$_.IsDefault($init_value$)) {\n"
" $name$_.Set($init_value$, \"\", GetArenaForAllocation());\n"
" }\n"
"#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING\n");
}
} else {
// Currently, string fields with default value can't be inlined.
format(
@ -422,6 +438,13 @@ void StringFieldGenerator::GenerateConstructorCode(io::Printer* printer) const {
}
GOOGLE_DCHECK(!inlined_);
format("$name$_.UnsafeSetDefault($init_value$);\n");
if (IsString(descriptor_, options_) &&
descriptor_->default_value_string().empty()) {
format(
"#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING\n"
" $name$_.Set($init_value$, \"\", GetArenaForAllocation());\n"
"#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING\n");
}
}
void StringFieldGenerator::GenerateCopyConstructorCode(

View File

@ -36,6 +36,7 @@
#include <vector>
#include <google/protobuf/descriptor.pb.h>
#include <google/protobuf/io/printer.h>
#include <google/protobuf/stubs/strutil.h>
@ -186,6 +187,21 @@ void WriteFieldDocComment(io::Printer* printer, const FieldDescriptor* field) {
printer->Print(" */\n");
}
void WriteDeprecatedJavadoc(io::Printer* printer, const FieldDescriptor* field,
const FieldAccessorType type) {
if (!field->options().deprecated()) {
return;
}
// Lite codegen does not annotate set & clear methods with @Deprecated.
if (field->file()->options().optimize_for() == FileOptions::LITE_RUNTIME &&
(type == SETTER || type == CLEARER)) {
return;
}
printer->Print(" * @deprecated\n");
}
void WriteFieldAccessorDocComment(io::Printer* printer,
const FieldDescriptor* field,
const FieldAccessorType type,
@ -194,6 +210,7 @@ void WriteFieldAccessorDocComment(io::Printer* printer,
WriteDocCommentBody(printer, field);
printer->Print(" * <code>$def$</code>\n", "def",
EscapeJavadoc(FirstLineOf(field->DebugString())));
WriteDeprecatedJavadoc(printer, field, type);
switch (type) {
case HAZZER:
printer->Print(" * @return Whether the $name$ field is set.\n", "name",
@ -252,6 +269,7 @@ void WriteFieldEnumValueAccessorDocComment(io::Printer* printer,
WriteDocCommentBody(printer, field);
printer->Print(" * <code>$def$</code>\n", "def",
EscapeJavadoc(FirstLineOf(field->DebugString())));
WriteDeprecatedJavadoc(printer, field, type);
switch (type) {
case HAZZER:
// Should never happen
@ -321,6 +339,7 @@ void WriteFieldStringBytesAccessorDocComment(io::Printer* printer,
WriteDocCommentBody(printer, field);
printer->Print(" * <code>$def$</code>\n", "def",
EscapeJavadoc(FirstLineOf(field->DebugString())));
WriteDeprecatedJavadoc(printer, field, type);
switch (type) {
case HAZZER:
// Should never happen

View File

@ -83,7 +83,7 @@ static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_google_2fprotobuf_2
static const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* file_level_enum_descriptors_google_2fprotobuf_2fcompiler_2fplugin_2eproto[1];
static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_google_2fprotobuf_2fcompiler_2fplugin_2eproto = nullptr;
const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_google_2fprotobuf_2fcompiler_2fplugin_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
const uint32_t TableStruct_google_2fprotobuf_2fcompiler_2fplugin_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::compiler::Version, _has_bits_),
PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::compiler::Version, _internal_metadata_),
~0u, // no _extensions_
@ -248,6 +248,9 @@ Version::Version(const Version& from)
_has_bits_(from._has_bits_) {
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
suffix_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
suffix_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_suffix()) {
suffix_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_suffix(),
GetArenaForAllocation());
@ -260,6 +263,9 @@ Version::Version(const Version& from)
inline void Version::SharedCtor() {
suffix_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
suffix_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(
reinterpret_cast<char*>(&major_) - reinterpret_cast<char*>(this)),
0, static_cast<size_t>(reinterpret_cast<char*>(&patch_) -
@ -290,7 +296,7 @@ void Version::SetCachedSize(int size) const {
void Version::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.compiler.Version)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@ -311,12 +317,12 @@ const char* Version::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::in
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
_Internal::HasBits has_bits{};
while (!ctx->Done(&ptr)) {
::PROTOBUF_NAMESPACE_ID::uint32 tag;
uint32_t tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
switch (tag >> 3) {
// optional int32 major = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) {
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) {
_Internal::set_has_major(&has_bits);
major_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
CHK_(ptr);
@ -325,7 +331,7 @@ const char* Version::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::in
continue;
// optional int32 minor = 2;
case 2:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) {
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 16)) {
_Internal::set_has_minor(&has_bits);
minor_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
CHK_(ptr);
@ -334,7 +340,7 @@ const char* Version::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::in
continue;
// optional int32 patch = 3;
case 3:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 24)) {
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 24)) {
_Internal::set_has_patch(&has_bits);
patch_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
CHK_(ptr);
@ -343,7 +349,7 @@ const char* Version::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::in
continue;
// optional string suffix = 4;
case 4:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 34)) {
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 34)) {
auto str = _internal_mutable_suffix();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
#ifndef NDEBUG
@ -377,10 +383,10 @@ failure:
#undef CHK_
}
::PROTOBUF_NAMESPACE_ID::uint8* Version::_InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
uint8_t* Version::_InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.compiler.Version)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = _has_bits_[0];
@ -424,7 +430,7 @@ size_t Version::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:google.protobuf.compiler.Version)
size_t total_size = 0;
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@ -472,7 +478,7 @@ void Version::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
void Version::MergeFrom(const Version& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.compiler.Version)
GOOGLE_DCHECK_NE(&from, this);
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = from._has_bits_[0];
@ -569,6 +575,9 @@ CodeGeneratorRequest::CodeGeneratorRequest(const CodeGeneratorRequest& from)
proto_file_(from.proto_file_) {
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
parameter_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
parameter_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_parameter()) {
parameter_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_parameter(),
GetArenaForAllocation());
@ -583,6 +592,9 @@ CodeGeneratorRequest::CodeGeneratorRequest(const CodeGeneratorRequest& from)
inline void CodeGeneratorRequest::SharedCtor() {
parameter_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
parameter_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
compiler_version_ = nullptr;
}
@ -611,7 +623,7 @@ void CodeGeneratorRequest::SetCachedSize(int size) const {
void CodeGeneratorRequest::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.compiler.CodeGeneratorRequest)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@ -635,12 +647,12 @@ const char* CodeGeneratorRequest::_InternalParse(const char* ptr, ::PROTOBUF_NAM
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
_Internal::HasBits has_bits{};
while (!ctx->Done(&ptr)) {
::PROTOBUF_NAMESPACE_ID::uint32 tag;
uint32_t tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
switch (tag >> 3) {
// repeated string file_to_generate = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
ptr -= 1;
do {
ptr += 1;
@ -657,7 +669,7 @@ const char* CodeGeneratorRequest::_InternalParse(const char* ptr, ::PROTOBUF_NAM
continue;
// optional string parameter = 2;
case 2:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) {
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) {
auto str = _internal_mutable_parameter();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
#ifndef NDEBUG
@ -669,7 +681,7 @@ const char* CodeGeneratorRequest::_InternalParse(const char* ptr, ::PROTOBUF_NAM
continue;
// optional .google.protobuf.compiler.Version compiler_version = 3;
case 3:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) {
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 26)) {
ptr = ctx->ParseMessage(_internal_mutable_compiler_version(), ptr);
CHK_(ptr);
} else
@ -677,7 +689,7 @@ const char* CodeGeneratorRequest::_InternalParse(const char* ptr, ::PROTOBUF_NAM
continue;
// repeated .google.protobuf.FileDescriptorProto proto_file = 15;
case 15:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 122)) {
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 122)) {
ptr -= 1;
do {
ptr += 1;
@ -712,10 +724,10 @@ failure:
#undef CHK_
}
::PROTOBUF_NAMESPACE_ID::uint8* CodeGeneratorRequest::_InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
uint8_t* CodeGeneratorRequest::_InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.compiler.CodeGeneratorRequest)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
// repeated string file_to_generate = 1;
@ -767,7 +779,7 @@ size_t CodeGeneratorRequest::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:google.protobuf.compiler.CodeGeneratorRequest)
size_t total_size = 0;
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@ -822,7 +834,7 @@ void CodeGeneratorRequest::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
void CodeGeneratorRequest::MergeFrom(const CodeGeneratorRequest& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.compiler.CodeGeneratorRequest)
GOOGLE_DCHECK_NE(&from, this);
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
file_to_generate_.MergeFrom(from.file_to_generate_);
@ -915,16 +927,25 @@ CodeGeneratorResponse_File::CodeGeneratorResponse_File(const CodeGeneratorRespon
_has_bits_(from._has_bits_) {
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_name()) {
name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(),
GetArenaForAllocation());
}
insertion_point_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
insertion_point_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_insertion_point()) {
insertion_point_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_insertion_point(),
GetArenaForAllocation());
}
content_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
content_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_content()) {
content_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_content(),
GetArenaForAllocation());
@ -939,8 +960,17 @@ CodeGeneratorResponse_File::CodeGeneratorResponse_File(const CodeGeneratorRespon
inline void CodeGeneratorResponse_File::SharedCtor() {
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
insertion_point_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
insertion_point_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
content_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
content_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
generated_code_info_ = nullptr;
}
@ -971,7 +1001,7 @@ void CodeGeneratorResponse_File::SetCachedSize(int size) const {
void CodeGeneratorResponse_File::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.compiler.CodeGeneratorResponse.File)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@ -999,12 +1029,12 @@ const char* CodeGeneratorResponse_File::_InternalParse(const char* ptr, ::PROTOB
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
_Internal::HasBits has_bits{};
while (!ctx->Done(&ptr)) {
::PROTOBUF_NAMESPACE_ID::uint32 tag;
uint32_t tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
switch (tag >> 3) {
// optional string name = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
auto str = _internal_mutable_name();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
#ifndef NDEBUG
@ -1016,7 +1046,7 @@ const char* CodeGeneratorResponse_File::_InternalParse(const char* ptr, ::PROTOB
continue;
// optional string insertion_point = 2;
case 2:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) {
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) {
auto str = _internal_mutable_insertion_point();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
#ifndef NDEBUG
@ -1028,7 +1058,7 @@ const char* CodeGeneratorResponse_File::_InternalParse(const char* ptr, ::PROTOB
continue;
// optional string content = 15;
case 15:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 122)) {
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 122)) {
auto str = _internal_mutable_content();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
#ifndef NDEBUG
@ -1040,7 +1070,7 @@ const char* CodeGeneratorResponse_File::_InternalParse(const char* ptr, ::PROTOB
continue;
// optional .google.protobuf.GeneratedCodeInfo generated_code_info = 16;
case 16:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 130)) {
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 130)) {
ptr = ctx->ParseMessage(_internal_mutable_generated_code_info(), ptr);
CHK_(ptr);
} else
@ -1070,10 +1100,10 @@ failure:
#undef CHK_
}
::PROTOBUF_NAMESPACE_ID::uint8* CodeGeneratorResponse_File::_InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
uint8_t* CodeGeneratorResponse_File::_InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.compiler.CodeGeneratorResponse.File)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = _has_bits_[0];
@ -1127,7 +1157,7 @@ size_t CodeGeneratorResponse_File::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:google.protobuf.compiler.CodeGeneratorResponse.File)
size_t total_size = 0;
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@ -1181,7 +1211,7 @@ void CodeGeneratorResponse_File::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
void CodeGeneratorResponse_File::MergeFrom(const CodeGeneratorResponse_File& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.compiler.CodeGeneratorResponse.File)
GOOGLE_DCHECK_NE(&from, this);
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = from._has_bits_[0];
@ -1272,6 +1302,9 @@ CodeGeneratorResponse::CodeGeneratorResponse(const CodeGeneratorResponse& from)
file_(from.file_) {
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
error_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
error_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_error()) {
error_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_error(),
GetArenaForAllocation());
@ -1282,6 +1315,9 @@ CodeGeneratorResponse::CodeGeneratorResponse(const CodeGeneratorResponse& from)
inline void CodeGeneratorResponse::SharedCtor() {
error_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
error_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
supported_features_ = uint64_t{0u};
}
@ -1309,7 +1345,7 @@ void CodeGeneratorResponse::SetCachedSize(int size) const {
void CodeGeneratorResponse::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.compiler.CodeGeneratorResponse)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@ -1327,12 +1363,12 @@ const char* CodeGeneratorResponse::_InternalParse(const char* ptr, ::PROTOBUF_NA
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
_Internal::HasBits has_bits{};
while (!ctx->Done(&ptr)) {
::PROTOBUF_NAMESPACE_ID::uint32 tag;
uint32_t tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
switch (tag >> 3) {
// optional string error = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
auto str = _internal_mutable_error();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
#ifndef NDEBUG
@ -1344,7 +1380,7 @@ const char* CodeGeneratorResponse::_InternalParse(const char* ptr, ::PROTOBUF_NA
continue;
// optional uint64 supported_features = 2;
case 2:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) {
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 16)) {
_Internal::set_has_supported_features(&has_bits);
supported_features_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
CHK_(ptr);
@ -1353,7 +1389,7 @@ const char* CodeGeneratorResponse::_InternalParse(const char* ptr, ::PROTOBUF_NA
continue;
// repeated .google.protobuf.compiler.CodeGeneratorResponse.File file = 15;
case 15:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 122)) {
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 122)) {
ptr -= 1;
do {
ptr += 1;
@ -1388,10 +1424,10 @@ failure:
#undef CHK_
}
::PROTOBUF_NAMESPACE_ID::uint8* CodeGeneratorResponse::_InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
uint8_t* CodeGeneratorResponse::_InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.compiler.CodeGeneratorResponse)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = _has_bits_[0];
@ -1431,7 +1467,7 @@ size_t CodeGeneratorResponse::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:google.protobuf.compiler.CodeGeneratorResponse)
size_t total_size = 0;
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@ -1476,7 +1512,7 @@ void CodeGeneratorResponse::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
void CodeGeneratorResponse::MergeFrom(const CodeGeneratorResponse& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.compiler.CodeGeneratorResponse)
GOOGLE_DCHECK_NE(&from, this);
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
file_.MergeFrom(from.file_);

View File

@ -58,7 +58,7 @@ struct PROTOC_EXPORT TableStruct_google_2fprotobuf_2fcompiler_2fplugin_2eproto {
PROTOBUF_SECTION_VARIABLE(protodesc_cold);
static const ::PROTOBUF_NAMESPACE_ID::internal::FieldMetadata field_metadata[];
static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[];
static const ::PROTOBUF_NAMESPACE_ID::uint32 offsets[];
static const uint32_t offsets[];
};
PROTOC_EXPORT extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto;
PROTOBUF_NAMESPACE_OPEN
@ -211,8 +211,8 @@ class PROTOC_EXPORT Version final :
size_t ByteSizeLong() const final;
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
uint8_t* _InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
@ -271,11 +271,11 @@ class PROTOC_EXPORT Version final :
bool _internal_has_major() const;
public:
void clear_major();
::PROTOBUF_NAMESPACE_ID::int32 major() const;
void set_major(::PROTOBUF_NAMESPACE_ID::int32 value);
int32_t major() const;
void set_major(int32_t value);
private:
::PROTOBUF_NAMESPACE_ID::int32 _internal_major() const;
void _internal_set_major(::PROTOBUF_NAMESPACE_ID::int32 value);
int32_t _internal_major() const;
void _internal_set_major(int32_t value);
public:
// optional int32 minor = 2;
@ -284,11 +284,11 @@ class PROTOC_EXPORT Version final :
bool _internal_has_minor() const;
public:
void clear_minor();
::PROTOBUF_NAMESPACE_ID::int32 minor() const;
void set_minor(::PROTOBUF_NAMESPACE_ID::int32 value);
int32_t minor() const;
void set_minor(int32_t value);
private:
::PROTOBUF_NAMESPACE_ID::int32 _internal_minor() const;
void _internal_set_minor(::PROTOBUF_NAMESPACE_ID::int32 value);
int32_t _internal_minor() const;
void _internal_set_minor(int32_t value);
public:
// optional int32 patch = 3;
@ -297,11 +297,11 @@ class PROTOC_EXPORT Version final :
bool _internal_has_patch() const;
public:
void clear_patch();
::PROTOBUF_NAMESPACE_ID::int32 patch() const;
void set_patch(::PROTOBUF_NAMESPACE_ID::int32 value);
int32_t patch() const;
void set_patch(int32_t value);
private:
::PROTOBUF_NAMESPACE_ID::int32 _internal_patch() const;
void _internal_set_patch(::PROTOBUF_NAMESPACE_ID::int32 value);
int32_t _internal_patch() const;
void _internal_set_patch(int32_t value);
public:
// @@protoc_insertion_point(class_scope:google.protobuf.compiler.Version)
@ -314,9 +314,9 @@ class PROTOC_EXPORT Version final :
::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_;
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr suffix_;
::PROTOBUF_NAMESPACE_ID::int32 major_;
::PROTOBUF_NAMESPACE_ID::int32 minor_;
::PROTOBUF_NAMESPACE_ID::int32 patch_;
int32_t major_;
int32_t minor_;
int32_t patch_;
friend struct ::TableStruct_google_2fprotobuf_2fcompiler_2fplugin_2eproto;
};
// -------------------------------------------------------------------
@ -421,8 +421,8 @@ class PROTOC_EXPORT CodeGeneratorRequest final :
size_t ByteSizeLong() const final;
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
uint8_t* _InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
@ -652,8 +652,8 @@ class PROTOC_EXPORT CodeGeneratorResponse_File final :
size_t ByteSizeLong() const final;
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
uint8_t* _InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
@ -877,8 +877,8 @@ class PROTOC_EXPORT CodeGeneratorResponse final :
size_t ByteSizeLong() const final;
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
uint8_t* _InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
@ -986,11 +986,11 @@ class PROTOC_EXPORT CodeGeneratorResponse final :
bool _internal_has_supported_features() const;
public:
void clear_supported_features();
::PROTOBUF_NAMESPACE_ID::uint64 supported_features() const;
void set_supported_features(::PROTOBUF_NAMESPACE_ID::uint64 value);
uint64_t supported_features() const;
void set_supported_features(uint64_t value);
private:
::PROTOBUF_NAMESPACE_ID::uint64 _internal_supported_features() const;
void _internal_set_supported_features(::PROTOBUF_NAMESPACE_ID::uint64 value);
uint64_t _internal_supported_features() const;
void _internal_set_supported_features(uint64_t value);
public:
// @@protoc_insertion_point(class_scope:google.protobuf.compiler.CodeGeneratorResponse)
@ -1004,7 +1004,7 @@ class PROTOC_EXPORT CodeGeneratorResponse final :
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File > file_;
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr error_;
::PROTOBUF_NAMESPACE_ID::uint64 supported_features_;
uint64_t supported_features_;
friend struct ::TableStruct_google_2fprotobuf_2fcompiler_2fplugin_2eproto;
};
// ===================================================================
@ -1030,18 +1030,18 @@ inline void Version::clear_major() {
major_ = 0;
_has_bits_[0] &= ~0x00000002u;
}
inline ::PROTOBUF_NAMESPACE_ID::int32 Version::_internal_major() const {
inline int32_t Version::_internal_major() const {
return major_;
}
inline ::PROTOBUF_NAMESPACE_ID::int32 Version::major() const {
inline int32_t Version::major() const {
// @@protoc_insertion_point(field_get:google.protobuf.compiler.Version.major)
return _internal_major();
}
inline void Version::_internal_set_major(::PROTOBUF_NAMESPACE_ID::int32 value) {
inline void Version::_internal_set_major(int32_t value) {
_has_bits_[0] |= 0x00000002u;
major_ = value;
}
inline void Version::set_major(::PROTOBUF_NAMESPACE_ID::int32 value) {
inline void Version::set_major(int32_t value) {
_internal_set_major(value);
// @@protoc_insertion_point(field_set:google.protobuf.compiler.Version.major)
}
@ -1058,18 +1058,18 @@ inline void Version::clear_minor() {
minor_ = 0;
_has_bits_[0] &= ~0x00000004u;
}
inline ::PROTOBUF_NAMESPACE_ID::int32 Version::_internal_minor() const {
inline int32_t Version::_internal_minor() const {
return minor_;
}
inline ::PROTOBUF_NAMESPACE_ID::int32 Version::minor() const {
inline int32_t Version::minor() const {
// @@protoc_insertion_point(field_get:google.protobuf.compiler.Version.minor)
return _internal_minor();
}
inline void Version::_internal_set_minor(::PROTOBUF_NAMESPACE_ID::int32 value) {
inline void Version::_internal_set_minor(int32_t value) {
_has_bits_[0] |= 0x00000004u;
minor_ = value;
}
inline void Version::set_minor(::PROTOBUF_NAMESPACE_ID::int32 value) {
inline void Version::set_minor(int32_t value) {
_internal_set_minor(value);
// @@protoc_insertion_point(field_set:google.protobuf.compiler.Version.minor)
}
@ -1086,18 +1086,18 @@ inline void Version::clear_patch() {
patch_ = 0;
_has_bits_[0] &= ~0x00000008u;
}
inline ::PROTOBUF_NAMESPACE_ID::int32 Version::_internal_patch() const {
inline int32_t Version::_internal_patch() const {
return patch_;
}
inline ::PROTOBUF_NAMESPACE_ID::int32 Version::patch() const {
inline int32_t Version::patch() const {
// @@protoc_insertion_point(field_get:google.protobuf.compiler.Version.patch)
return _internal_patch();
}
inline void Version::_internal_set_patch(::PROTOBUF_NAMESPACE_ID::int32 value) {
inline void Version::_internal_set_patch(int32_t value) {
_has_bits_[0] |= 0x00000008u;
patch_ = value;
}
inline void Version::set_patch(::PROTOBUF_NAMESPACE_ID::int32 value) {
inline void Version::set_patch(int32_t value) {
_internal_set_patch(value);
// @@protoc_insertion_point(field_set:google.protobuf.compiler.Version.patch)
}
@ -1148,6 +1148,11 @@ inline std::string* Version::release_suffix() {
}
_has_bits_[0] &= ~0x00000001u;
return suffix_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (suffix_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
suffix_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
}
inline void Version::set_allocated_suffix(std::string* suffix) {
if (suffix != nullptr) {
@ -1157,6 +1162,11 @@ inline void Version::set_allocated_suffix(std::string* suffix) {
}
suffix_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), suffix,
GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (suffix_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
suffix_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.compiler.Version.suffix)
}
@ -1285,6 +1295,11 @@ inline std::string* CodeGeneratorRequest::release_parameter() {
}
_has_bits_[0] &= ~0x00000001u;
return parameter_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (parameter_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
parameter_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
}
inline void CodeGeneratorRequest::set_allocated_parameter(std::string* parameter) {
if (parameter != nullptr) {
@ -1294,6 +1309,11 @@ inline void CodeGeneratorRequest::set_allocated_parameter(std::string* parameter
}
parameter_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), parameter,
GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (parameter_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
parameter_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.compiler.CodeGeneratorRequest.parameter)
}
@ -1474,6 +1494,11 @@ inline std::string* CodeGeneratorResponse_File::release_name() {
}
_has_bits_[0] &= ~0x00000001u;
return name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
}
inline void CodeGeneratorResponse_File::set_allocated_name(std::string* name) {
if (name != nullptr) {
@ -1483,6 +1508,11 @@ inline void CodeGeneratorResponse_File::set_allocated_name(std::string* name) {
}
name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name,
GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.compiler.CodeGeneratorResponse.File.name)
}
@ -1532,6 +1562,11 @@ inline std::string* CodeGeneratorResponse_File::release_insertion_point() {
}
_has_bits_[0] &= ~0x00000002u;
return insertion_point_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (insertion_point_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
insertion_point_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
}
inline void CodeGeneratorResponse_File::set_allocated_insertion_point(std::string* insertion_point) {
if (insertion_point != nullptr) {
@ -1541,6 +1576,11 @@ inline void CodeGeneratorResponse_File::set_allocated_insertion_point(std::strin
}
insertion_point_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), insertion_point,
GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (insertion_point_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
insertion_point_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point)
}
@ -1590,6 +1630,11 @@ inline std::string* CodeGeneratorResponse_File::release_content() {
}
_has_bits_[0] &= ~0x00000004u;
return content_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (content_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
content_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
}
inline void CodeGeneratorResponse_File::set_allocated_content(std::string* content) {
if (content != nullptr) {
@ -1599,6 +1644,11 @@ inline void CodeGeneratorResponse_File::set_allocated_content(std::string* conte
}
content_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), content,
GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (content_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
content_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.compiler.CodeGeneratorResponse.File.content)
}
@ -1740,6 +1790,11 @@ inline std::string* CodeGeneratorResponse::release_error() {
}
_has_bits_[0] &= ~0x00000001u;
return error_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (error_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
error_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
}
inline void CodeGeneratorResponse::set_allocated_error(std::string* error) {
if (error != nullptr) {
@ -1749,6 +1804,11 @@ inline void CodeGeneratorResponse::set_allocated_error(std::string* error) {
}
error_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), error,
GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (error_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
error_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.compiler.CodeGeneratorResponse.error)
}
@ -1764,18 +1824,18 @@ inline void CodeGeneratorResponse::clear_supported_features() {
supported_features_ = uint64_t{0u};
_has_bits_[0] &= ~0x00000002u;
}
inline ::PROTOBUF_NAMESPACE_ID::uint64 CodeGeneratorResponse::_internal_supported_features() const {
inline uint64_t CodeGeneratorResponse::_internal_supported_features() const {
return supported_features_;
}
inline ::PROTOBUF_NAMESPACE_ID::uint64 CodeGeneratorResponse::supported_features() const {
inline uint64_t CodeGeneratorResponse::supported_features() const {
// @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorResponse.supported_features)
return _internal_supported_features();
}
inline void CodeGeneratorResponse::_internal_set_supported_features(::PROTOBUF_NAMESPACE_ID::uint64 value) {
inline void CodeGeneratorResponse::_internal_set_supported_features(uint64_t value) {
_has_bits_[0] |= 0x00000002u;
supported_features_ = value;
}
inline void CodeGeneratorResponse::set_supported_features(::PROTOBUF_NAMESPACE_ID::uint64 value) {
inline void CodeGeneratorResponse::set_supported_features(uint64_t value) {
_internal_set_supported_features(value);
// @@protoc_insertion_point(field_set:google.protobuf.compiler.CodeGeneratorResponse.supported_features)
}

View File

@ -180,6 +180,8 @@ void PrintTopBoilerplate(io::Printer* printer, const FileDescriptor* file,
}
printer->Print(
"from google.protobuf import descriptor as _descriptor\n"
"from google.protobuf import descriptor_pool as "
"_descriptor_pool\n"
"from google.protobuf import message as _message\n"
"from google.protobuf import reflection as _reflection\n"
"from google.protobuf import symbol_database as "
@ -350,12 +352,32 @@ bool Generator::Generate(const FileDescriptor* file,
PrintTopLevelEnums();
PrintTopLevelExtensions();
if (pure_python_workable_) {
PrintAllNestedEnumsInFile();
PrintMessageDescriptors();
FixForeignFieldsInDescriptors();
if (GeneratingDescriptorProto()) {
printer_->Print("if _descriptor._USE_C_DESCRIPTORS == False:\n");
printer_->Indent();
// Create enums before message descriptors
PrintAllNestedEnumsInFile(StripPrintDescriptor::kCreate);
PrintMessageDescriptors(StripPrintDescriptor::kCreate);
FixForeignFieldsInDescriptors();
printer_->Outdent();
printer_->Print("else:\n");
printer_->Indent();
}
// Find the message descriptors first and then use the message
// descriptor to find enums.
PrintMessageDescriptors(StripPrintDescriptor::kFind);
PrintAllNestedEnumsInFile(StripPrintDescriptor::kFind);
if (GeneratingDescriptorProto()) {
printer_->Outdent();
}
}
PrintMessages();
if (pure_python_workable_) {
PrintServiceDescriptors();
printer.Print("if _descriptor._USE_C_DESCRIPTORS == False:\n");
printer_->Indent();
// We have to fix up the extensions after the message classes themselves,
// since they need to call static RegisterExtension() methods on these
// classes.
@ -366,7 +388,11 @@ bool Generator::Generate(const FileDescriptor* file,
// custom options that may be unknown when we define the descriptors.
// This does not apply to services because they are not used by extensions.
FixAllDescriptorOptions();
PrintServiceDescriptors();
// Set serialized_start and serialized_end.
SetSerializedPbInterval();
printer_->Outdent();
}
if (HasGenericServices(file)) {
PrintServices();
@ -428,46 +454,65 @@ void Generator::PrintFileDescriptor() const {
m["package"] = file_->package();
m["syntax"] = StringifySyntax(file_->syntax());
m["options"] = OptionsValue(file_->options().SerializeAsString());
const char file_descriptor_template[] =
"$descriptor_name$ = _descriptor.FileDescriptor(\n"
" name='$name$',\n"
" package='$package$',\n"
" syntax='$syntax$',\n"
" serialized_options=$options$,\n"
" create_key=_descriptor._internal_create_key,\n";
printer_->Print(m, file_descriptor_template);
printer_->Indent();
if (pure_python_workable_) {
printer_->Print("serialized_pb=b'$value$'\n", "value",
strings::CHexEscape(file_descriptor_serialized_));
if (file_->dependency_count() != 0) {
printer_->Print(",\ndependencies=[");
for (int i = 0; i < file_->dependency_count(); ++i) {
std::string module_alias = ModuleAlias(file_->dependency(i)->name());
printer_->Print("$module_alias$.DESCRIPTOR,", "module_alias",
module_alias);
m["serialized_descriptor"] = strings::CHexEscape(file_descriptor_serialized_);
if (GeneratingDescriptorProto()) {
printer_->Print("if _descriptor._USE_C_DESCRIPTORS == False:\n");
printer_->Indent();
// Pure python's AddSerializedFile() depend on the generated
// descriptor_pb2.py thus we can not use AddSerializedFile() when
// generated descriptor.proto for pure python.
const char file_descriptor_template[] =
"$descriptor_name$ = _descriptor.FileDescriptor(\n"
" name='$name$',\n"
" package='$package$',\n"
" syntax='$syntax$',\n"
" serialized_options=$options$,\n"
" create_key=_descriptor._internal_create_key,\n";
printer_->Print(m, file_descriptor_template);
printer_->Indent();
if (pure_python_workable_) {
printer_->Print("serialized_pb=b'$value$'\n", "value",
strings::CHexEscape(file_descriptor_serialized_));
if (file_->dependency_count() != 0) {
printer_->Print(",\ndependencies=[");
for (int i = 0; i < file_->dependency_count(); ++i) {
std::string module_alias = ModuleAlias(file_->dependency(i)->name());
printer_->Print("$module_alias$.DESCRIPTOR,", "module_alias",
module_alias);
}
printer_->Print("]");
}
printer_->Print("]");
}
if (file_->public_dependency_count() > 0) {
printer_->Print(",\npublic_dependencies=[");
for (int i = 0; i < file_->public_dependency_count(); ++i) {
std::string module_alias =
ModuleAlias(file_->public_dependency(i)->name());
printer_->Print("$module_alias$.DESCRIPTOR,", "module_alias",
module_alias);
if (file_->public_dependency_count() > 0) {
printer_->Print(",\npublic_dependencies=[");
for (int i = 0; i < file_->public_dependency_count(); ++i) {
std::string module_alias =
ModuleAlias(file_->public_dependency(i)->name());
printer_->Print("$module_alias$.DESCRIPTOR,", "module_alias",
module_alias);
}
printer_->Print("]");
}
printer_->Print("]");
} else {
printer_->Print("serialized_pb=''\n");
}
} else {
printer_->Print("serialized_pb=''\n");
// TODO(falk): Also print options and fix the message_type, enum_type,
// service and extension later in the generation.
printer_->Outdent();
printer_->Print(")\n");
printer_->Outdent();
printer_->Print("else:\n");
printer_->Indent();
}
printer_->Print(m,
"$descriptor_name$ = "
"_descriptor_pool.Default().AddSerializedFile(b'$serialized_"
"descriptor$')\n");
if (GeneratingDescriptorProto()) {
printer_->Outdent();
}
// TODO(falk): Also print options and fix the message_type, enum_type,
// service and extension later in the generation.
printer_->Outdent();
printer_->Print(")\n");
printer_->Print("\n");
}
@ -477,7 +522,7 @@ void Generator::PrintTopLevelEnums() const {
std::vector<std::pair<std::string, int> > top_level_enum_values;
for (int i = 0; i < file_->enum_type_count(); ++i) {
const EnumDescriptor& enum_descriptor = *file_->enum_type(i);
PrintEnum(enum_descriptor);
PrintFindEnum(enum_descriptor);
printer_->Print(
"$name$ = "
"enum_type_wrapper.EnumTypeWrapper($descriptor_name$)",
@ -501,16 +546,17 @@ void Generator::PrintTopLevelEnums() const {
}
// Prints all enums contained in all message types in |file|.
void Generator::PrintAllNestedEnumsInFile() const {
void Generator::PrintAllNestedEnumsInFile(
StripPrintDescriptor print_mode) const {
for (int i = 0; i < file_->message_type_count(); ++i) {
PrintNestedEnums(*file_->message_type(i));
PrintNestedEnums(*file_->message_type(i), print_mode);
}
}
// Prints a Python statement assigning the appropriate module-level
// enum name to a Python EnumDescriptor object equivalent to
// enum_descriptor.
void Generator::PrintEnum(const EnumDescriptor& enum_descriptor) const {
void Generator::PrintCreateEnum(const EnumDescriptor& enum_descriptor) const {
std::map<std::string, std::string> m;
std::string module_level_descriptor_name =
ModuleLevelDescriptorName(enum_descriptor);
@ -545,7 +591,6 @@ void Generator::PrintEnum(const EnumDescriptor& enum_descriptor) const {
printer_->Print("serialized_options=$options_value$,\n", "options_value",
OptionsValue(options_string));
EnumDescriptorProto edp;
PrintSerializedPbInterval(enum_descriptor, edp);
printer_->Outdent();
printer_->Print(")\n");
if (pure_python_workable_) {
@ -555,20 +600,41 @@ void Generator::PrintEnum(const EnumDescriptor& enum_descriptor) const {
printer_->Print("\n");
}
void Generator::PrintFindEnum(const EnumDescriptor& enum_descriptor) const {
std::map<std::string, std::string> m;
m["descriptor_name"] = ModuleLevelDescriptorName(enum_descriptor);
m["name"] = enum_descriptor.name();
m["file"] = kDescriptorKey;
if (enum_descriptor.containing_type()) {
m["containing_type"] =
ModuleLevelDescriptorName(*enum_descriptor.containing_type());
printer_->Print(m,
"$descriptor_name$ = "
"$containing_type$.enum_types_by_name['$name$']\n");
} else {
printer_->Print(
m, "$descriptor_name$ = $file$.enum_types_by_name['$name$']\n");
}
}
// Recursively prints enums in nested types within descriptor, then
// prints enums contained at the top level in descriptor.
void Generator::PrintNestedEnums(const Descriptor& descriptor) const {
void Generator::PrintNestedEnums(const Descriptor& descriptor,
StripPrintDescriptor print_mode) const {
for (int i = 0; i < descriptor.nested_type_count(); ++i) {
PrintNestedEnums(*descriptor.nested_type(i));
PrintNestedEnums(*descriptor.nested_type(i), print_mode);
}
for (int i = 0; i < descriptor.enum_type_count(); ++i) {
PrintEnum(*descriptor.enum_type(i));
if (print_mode == StripPrintDescriptor::kCreate) {
PrintCreateEnum(*descriptor.enum_type(i));
} else {
PrintFindEnum(*descriptor.enum_type(i));
}
}
}
void Generator::PrintTopLevelExtensions() const {
const bool is_extension = true;
for (int i = 0; i < file_->extension_count(); ++i) {
const FieldDescriptor& extension_field = *file_->extension(i);
std::string constant_name = extension_field.name() + "_FIELD_NUMBER";
@ -576,27 +642,32 @@ void Generator::PrintTopLevelExtensions() const {
printer_->Print("$constant_name$ = $number$\n", "constant_name",
constant_name, "number",
StrCat(extension_field.number()));
printer_->Print("$name$ = ", "name",
ResolveKeyword(extension_field.name()));
PrintFieldDescriptor(extension_field, is_extension);
printer_->Print("\n");
printer_->Print(
"$resolved_name$ = "
"$file$.extensions_by_name['$name$']\n",
"resolved_name", ResolveKeyword(extension_field.name()), "file",
kDescriptorKey, "name", extension_field.name());
}
printer_->Print("\n");
}
// Prints Python equivalents of all Descriptors in |file|.
void Generator::PrintMessageDescriptors() const {
for (int i = 0; i < file_->message_type_count(); ++i) {
PrintDescriptor(*file_->message_type(i));
printer_->Print("\n");
void Generator::PrintMessageDescriptors(StripPrintDescriptor print_mode) const {
if (print_mode == StripPrintDescriptor::kCreate) {
for (int i = 0; i < file_->message_type_count(); ++i) {
PrintCreateDescriptor(*file_->message_type(i));
printer_->Print("\n");
}
} else {
for (int i = 0; i < file_->message_type_count(); ++i) {
PrintFindDescriptor(*file_->message_type(i));
}
}
}
void Generator::PrintServiceDescriptors() const {
for (int i = 0; i < file_->service_count(); ++i) {
PrintServiceDescriptor(*file_->service(i));
AddServiceToFileDescriptor(*file_->service(i));
printer_->Print("\n");
}
}
@ -610,65 +681,11 @@ void Generator::PrintServices() const {
void Generator::PrintServiceDescriptor(
const ServiceDescriptor& descriptor) const {
printer_->Print("\n");
std::string service_name = ModuleLevelServiceDescriptorName(descriptor);
std::string options_string;
descriptor.options().SerializeToString(&options_string);
printer_->Print("$service_name$ = _descriptor.ServiceDescriptor(\n",
"service_name", service_name);
printer_->Indent();
std::map<std::string, std::string> m;
m["service_name"] = ModuleLevelServiceDescriptorName(descriptor);
m["name"] = descriptor.name();
m["full_name"] = descriptor.full_name();
m["file"] = kDescriptorKey;
m["index"] = StrCat(descriptor.index());
m["options_value"] = OptionsValue(options_string);
const char required_function_arguments[] =
"name='$name$',\n"
"full_name='$full_name$',\n"
"file=$file$,\n"
"index=$index$,\n"
"serialized_options=$options_value$,\n"
"create_key=_descriptor._internal_create_key,\n";
printer_->Print(m, required_function_arguments);
ServiceDescriptorProto sdp;
PrintSerializedPbInterval(descriptor, sdp);
printer_->Print("methods=[\n");
for (int i = 0; i < descriptor.method_count(); ++i) {
const MethodDescriptor* method = descriptor.method(i);
method->options().SerializeToString(&options_string);
m.clear();
m["name"] = method->name();
m["full_name"] = method->full_name();
m["index"] = StrCat(method->index());
m["serialized_options"] = CEscape(options_string);
m["input_type"] = ModuleLevelDescriptorName(*(method->input_type()));
m["output_type"] = ModuleLevelDescriptorName(*(method->output_type()));
m["options_value"] = OptionsValue(options_string);
printer_->Print("_descriptor.MethodDescriptor(\n");
printer_->Indent();
printer_->Print(m,
"name='$name$',\n"
"full_name='$full_name$',\n"
"index=$index$,\n"
"containing_service=None,\n"
"input_type=$input_type$,\n"
"output_type=$output_type$,\n"
"serialized_options=$options_value$,\n"
"create_key=_descriptor._internal_create_key,\n");
printer_->Outdent();
printer_->Print("),\n");
}
printer_->Outdent();
printer_->Print("])\n");
printer_->Print("_sym_db.RegisterServiceDescriptor($name$)\n", "name",
service_name);
printer_->Print("\n");
printer_->Print(m, "$service_name$ = $file$.services_by_name['$name$']\n");
}
void Generator::PrintDescriptorKeyAndModuleName(
@ -713,18 +730,20 @@ void Generator::PrintServiceStub(const ServiceDescriptor& descriptor) const {
// to a Python Descriptor object for message_descriptor.
//
// Mutually recursive with PrintNestedDescriptors().
void Generator::PrintDescriptor(const Descriptor& message_descriptor) const {
PrintNestedDescriptors(message_descriptor);
void Generator::PrintCreateDescriptor(
const Descriptor& message_descriptor) const {
std::map<std::string, std::string> m;
m["name"] = message_descriptor.name();
m["full_name"] = message_descriptor.full_name();
m["file"] = kDescriptorKey;
PrintNestedDescriptors(message_descriptor, StripPrintDescriptor::kCreate);
printer_->Print("\n");
printer_->Print("$descriptor_name$ = _descriptor.Descriptor(\n",
"descriptor_name",
ModuleLevelDescriptorName(message_descriptor));
printer_->Indent();
std::map<std::string, std::string> m;
m["name"] = message_descriptor.name();
m["full_name"] = message_descriptor.full_name();
m["file"] = kDescriptorKey;
const char required_function_arguments[] =
"name='$name$',\n"
"full_name='$full_name$',\n"
@ -800,22 +819,46 @@ void Generator::PrintDescriptor(const Descriptor& message_descriptor) const {
}
printer_->Outdent();
printer_->Print("],\n");
// Serialization of proto
DescriptorProto edp;
PrintSerializedPbInterval(message_descriptor, edp);
printer_->Outdent();
printer_->Print(")\n");
}
void Generator::PrintFindDescriptor(
const Descriptor& message_descriptor) const {
std::map<std::string, std::string> m;
m["descriptor_name"] = ModuleLevelDescriptorName(message_descriptor);
m["name"] = message_descriptor.name();
if (message_descriptor.containing_type()) {
m["containing_type"] =
ModuleLevelDescriptorName(*message_descriptor.containing_type());
printer_->Print(m,
"$descriptor_name$ = "
"$containing_type$.nested_types_by_name['$name$']\n");
} else {
m["file"] = kDescriptorKey;
printer_->Print(
m, "$descriptor_name$ = $file$.message_types_by_name['$name$']\n");
}
PrintNestedDescriptors(message_descriptor, StripPrintDescriptor::kFind);
}
// Prints Python Descriptor objects for all nested types contained in
// message_descriptor.
//
// Mutually recursive with PrintDescriptor().
void Generator::PrintNestedDescriptors(
const Descriptor& containing_descriptor) const {
for (int i = 0; i < containing_descriptor.nested_type_count(); ++i) {
PrintDescriptor(*containing_descriptor.nested_type(i));
void Generator::PrintNestedDescriptors(const Descriptor& containing_descriptor,
StripPrintDescriptor print_mode) const {
if (print_mode == StripPrintDescriptor::kCreate) {
for (int i = 0; i < containing_descriptor.nested_type_count(); ++i) {
PrintCreateDescriptor(*containing_descriptor.nested_type(i));
}
} else {
for (int i = 0; i < containing_descriptor.nested_type_count(); ++i) {
PrintFindDescriptor(*containing_descriptor.nested_type(i));
}
}
}
@ -1098,10 +1141,6 @@ void Generator::FixForeignFieldsInExtensions() const {
void Generator::FixForeignFieldsInExtension(
const FieldDescriptor& extension_field) const {
GOOGLE_CHECK(extension_field.is_extension());
// extension_scope() will be NULL for top-level extensions, which is
// exactly what FixForeignFieldsInField() wants.
FixForeignFieldsInField(extension_field.extension_scope(), extension_field,
"extensions_by_name");
std::map<std::string, std::string> m;
// Confusingly, for FieldDescriptors that happen to be extensions,
@ -1300,7 +1339,8 @@ std::string Generator::ModuleLevelServiceDescriptorName(
//
template <typename DescriptorT, typename DescriptorProtoT>
void Generator::PrintSerializedPbInterval(const DescriptorT& descriptor,
DescriptorProtoT& proto) const {
DescriptorProtoT& proto,
const std::string& name) const {
descriptor.CopyTo(&proto);
std::string sp;
proto.SerializeToString(&sp);
@ -1308,9 +1348,9 @@ void Generator::PrintSerializedPbInterval(const DescriptorT& descriptor,
GOOGLE_CHECK_GE(offset, 0);
printer_->Print(
"serialized_start=$serialized_start$,\n"
"serialized_end=$serialized_end$,\n",
"serialized_start", StrCat(offset), "serialized_end",
"$name$._serialized_start=$serialized_start$\n"
"$name$._serialized_end=$serialized_end$\n",
"name", name, "serialized_start", StrCat(offset), "serialized_end",
StrCat(offset + sp.size()));
}
@ -1320,16 +1360,62 @@ void PrintDescriptorOptionsFixingCode(const std::string& descriptor,
io::Printer* printer) {
// Reset the _options to None thus DescriptorBase.GetOptions() can
// parse _options again after extensions are registered.
printer->Print("$descriptor$._options = None\n", "descriptor", descriptor);
printer->Print(
"$descriptor$._options = None\n"
"$descriptor$._serialized_options = $serialized_value$\n",
"descriptor", descriptor, "serialized_value", options);
}
} // namespace
void Generator::SetSerializedPbInterval() const {
// Top level enums.
for (int i = 0; i < file_->enum_type_count(); ++i) {
EnumDescriptorProto proto;
const EnumDescriptor& descriptor = *file_->enum_type(i);
PrintSerializedPbInterval(descriptor, proto,
ModuleLevelDescriptorName(descriptor));
}
// Messages.
for (int i = 0; i < file_->message_type_count(); ++i) {
SetMessagePbInterval(*file_->message_type(i));
}
// Services.
for (int i = 0; i < file_->service_count(); ++i) {
ServiceDescriptorProto proto;
const ServiceDescriptor& service = *file_->service(i);
PrintSerializedPbInterval(service, proto,
ModuleLevelServiceDescriptorName(service));
}
}
void Generator::SetMessagePbInterval(const Descriptor& descriptor) const {
DescriptorProto message_proto;
PrintSerializedPbInterval(descriptor, message_proto,
ModuleLevelDescriptorName(descriptor));
// Nested messages.
for (int i = 0; i < descriptor.nested_type_count(); ++i) {
SetMessagePbInterval(*descriptor.nested_type(i));
}
for (int i = 0; i < descriptor.enum_type_count(); ++i) {
EnumDescriptorProto proto;
const EnumDescriptor& enum_des = *descriptor.enum_type(i);
PrintSerializedPbInterval(enum_des, proto,
ModuleLevelDescriptorName(enum_des));
}
}
// Prints expressions that set the options field of all descriptors.
void Generator::FixAllDescriptorOptions() const {
// Prints an expression that sets the file descriptor's options.
std::string file_options = OptionsValue(file_->options().SerializeAsString());
if (file_options != "None") {
PrintDescriptorOptionsFixingCode(kDescriptorKey, file_options, printer_);
} else {
printer_->Print("DESCRIPTOR._options = None\n");
}
// Prints expressions that set the options for all top level enums.
for (int i = 0; i < file_->enum_type_count(); ++i) {
@ -1346,6 +1432,10 @@ void Generator::FixAllDescriptorOptions() const {
for (int i = 0; i < file_->message_type_count(); ++i) {
FixOptionsForMessage(*file_->message_type(i));
}
for (int i = 0; i < file_->service_count(); ++i) {
FixOptionsForService(*file_->service(i));
}
}
void Generator::FixOptionsForOneof(const OneofDescriptor& oneof) const {
@ -1380,6 +1470,31 @@ void Generator::FixOptionsForEnum(const EnumDescriptor& enum_descriptor) const {
}
}
// Prints expressions that set the options for an service descriptor and its
// value descriptors.
void Generator::FixOptionsForService(
const ServiceDescriptor& service_descriptor) const {
std::string descriptor_name =
ModuleLevelServiceDescriptorName(service_descriptor);
std::string service_options =
OptionsValue(service_descriptor.options().SerializeAsString());
if (service_options != "None") {
PrintDescriptorOptionsFixingCode(descriptor_name, service_options,
printer_);
}
for (int i = 0; i < service_descriptor.method_count(); ++i) {
const MethodDescriptor* method = service_descriptor.method(i);
std::string method_options =
OptionsValue(method->options().SerializeAsString());
if (method_options != "None") {
std::string method_name =
descriptor_name + ".methods_by_name['" + method->name() + "']";
PrintDescriptorOptionsFixingCode(method_name, method_options, printer_);
}
}
}
// Prints expressions that set the options for field descriptors (including
// extensions).
void Generator::FixOptionsForField(const FieldDescriptor& field) const {

View File

@ -59,6 +59,8 @@ class Printer;
namespace compiler {
namespace python {
enum class StripPrintDescriptor { kCreate, kFind };
// CodeGenerator implementation for generated Python protocol buffer classes.
// If you create your own protocol compiler binary and you want it to support
// Python output, you can do so by registering an instance of this
@ -79,9 +81,11 @@ class PROTOC_EXPORT Generator : public CodeGenerator {
void PrintImports() const;
void PrintFileDescriptor() const;
void PrintTopLevelEnums() const;
void PrintAllNestedEnumsInFile() const;
void PrintNestedEnums(const Descriptor& descriptor) const;
void PrintEnum(const EnumDescriptor& enum_descriptor) const;
void PrintAllNestedEnumsInFile(StripPrintDescriptor print_mode) const;
void PrintNestedEnums(const Descriptor& descriptor,
StripPrintDescriptor print_mode) const;
void PrintCreateEnum(const EnumDescriptor& enum_descriptor) const;
void PrintFindEnum(const EnumDescriptor& enum_descriptor) const;
void PrintTopLevelExtensions() const;
@ -93,9 +97,11 @@ class PROTOC_EXPORT Generator : public CodeGenerator {
const FieldDescriptor* (Descriptor::*GetterFn)(int)const) const;
void PrintFieldsInDescriptor(const Descriptor& message_descriptor) const;
void PrintExtensionsInDescriptor(const Descriptor& message_descriptor) const;
void PrintMessageDescriptors() const;
void PrintDescriptor(const Descriptor& message_descriptor) const;
void PrintNestedDescriptors(const Descriptor& containing_descriptor) const;
void PrintMessageDescriptors(StripPrintDescriptor print_mode) const;
void PrintCreateDescriptor(const Descriptor& message_descriptor) const;
void PrintFindDescriptor(const Descriptor& message_descriptor) const;
void PrintNestedDescriptors(const Descriptor& containing_descriptor,
StripPrintDescriptor print_mode) const;
void PrintMessages() const;
void PrintMessage(const Descriptor& message_descriptor,
@ -150,14 +156,19 @@ class PROTOC_EXPORT Generator : public CodeGenerator {
template <typename DescriptorT, typename DescriptorProtoT>
void PrintSerializedPbInterval(const DescriptorT& descriptor,
DescriptorProtoT& proto) const;
DescriptorProtoT& proto,
const std::string& name) const;
void FixAllDescriptorOptions() const;
void FixOptionsForField(const FieldDescriptor& field) const;
void FixOptionsForOneof(const OneofDescriptor& oneof) const;
void FixOptionsForEnum(const EnumDescriptor& descriptor) const;
void FixOptionsForService(const ServiceDescriptor& descriptor) const;
void FixOptionsForMessage(const Descriptor& descriptor) const;
void SetSerializedPbInterval() const;
void SetMessagePbInterval(const Descriptor& descriptor) const;
void CopyPublicDependenciesAliases(const std::string& copy_from,
const FileDescriptor* file) const;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -35,7 +35,7 @@ static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_google_2fprotobuf_2
static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_google_2fprotobuf_2fduration_2eproto = nullptr;
static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_google_2fprotobuf_2fduration_2eproto = nullptr;
const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_google_2fprotobuf_2fduration_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
const uint32_t TableStruct_google_2fprotobuf_2fduration_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
~0u, // no _has_bits_
PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Duration, _internal_metadata_),
~0u, // no _extensions_
@ -130,7 +130,7 @@ void Duration::SetCachedSize(int size) const {
void Duration::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.Duration)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@ -143,12 +143,12 @@ void Duration::Clear() {
const char* Duration::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
::PROTOBUF_NAMESPACE_ID::uint32 tag;
uint32_t tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
switch (tag >> 3) {
// int64 seconds = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) {
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) {
seconds_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
CHK_(ptr);
} else
@ -156,7 +156,7 @@ const char* Duration::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::i
continue;
// int32 nanos = 2;
case 2:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) {
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 16)) {
nanos_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
CHK_(ptr);
} else
@ -185,10 +185,10 @@ failure:
#undef CHK_
}
::PROTOBUF_NAMESPACE_ID::uint8* Duration::_InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
uint8_t* Duration::_InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Duration)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
// int64 seconds = 1;
@ -215,7 +215,7 @@ size_t Duration::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:google.protobuf.Duration)
size_t total_size = 0;
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@ -248,7 +248,7 @@ void Duration::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
void Duration::MergeFrom(const Duration& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Duration)
GOOGLE_DCHECK_NE(&from, this);
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
if (from._internal_seconds() != 0) {

View File

@ -50,7 +50,7 @@ struct PROTOBUF_EXPORT TableStruct_google_2fprotobuf_2fduration_2eproto {
PROTOBUF_SECTION_VARIABLE(protodesc_cold);
static const ::PROTOBUF_NAMESPACE_ID::internal::FieldMetadata field_metadata[];
static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[];
static const ::PROTOBUF_NAMESPACE_ID::uint32 offsets[];
static const uint32_t offsets[];
};
PROTOBUF_EXPORT extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fprotobuf_2fduration_2eproto;
PROTOBUF_NAMESPACE_OPEN
@ -158,8 +158,8 @@ class PROTOBUF_EXPORT Duration final :
size_t ByteSizeLong() const final;
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
uint8_t* _InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
@ -194,20 +194,20 @@ class PROTOBUF_EXPORT Duration final :
};
// int64 seconds = 1;
void clear_seconds();
::PROTOBUF_NAMESPACE_ID::int64 seconds() const;
void set_seconds(::PROTOBUF_NAMESPACE_ID::int64 value);
int64_t seconds() const;
void set_seconds(int64_t value);
private:
::PROTOBUF_NAMESPACE_ID::int64 _internal_seconds() const;
void _internal_set_seconds(::PROTOBUF_NAMESPACE_ID::int64 value);
int64_t _internal_seconds() const;
void _internal_set_seconds(int64_t value);
public:
// int32 nanos = 2;
void clear_nanos();
::PROTOBUF_NAMESPACE_ID::int32 nanos() const;
void set_nanos(::PROTOBUF_NAMESPACE_ID::int32 value);
int32_t nanos() const;
void set_nanos(int32_t value);
private:
::PROTOBUF_NAMESPACE_ID::int32 _internal_nanos() const;
void _internal_set_nanos(::PROTOBUF_NAMESPACE_ID::int32 value);
int32_t _internal_nanos() const;
void _internal_set_nanos(int32_t value);
public:
// @@protoc_insertion_point(class_scope:google.protobuf.Duration)
@ -217,8 +217,8 @@ class PROTOBUF_EXPORT Duration final :
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
typedef void InternalArenaConstructable_;
typedef void DestructorSkippable_;
::PROTOBUF_NAMESPACE_ID::int64 seconds_;
::PROTOBUF_NAMESPACE_ID::int32 nanos_;
int64_t seconds_;
int32_t nanos_;
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
friend struct ::TableStruct_google_2fprotobuf_2fduration_2eproto;
};
@ -237,18 +237,18 @@ class PROTOBUF_EXPORT Duration final :
inline void Duration::clear_seconds() {
seconds_ = int64_t{0};
}
inline ::PROTOBUF_NAMESPACE_ID::int64 Duration::_internal_seconds() const {
inline int64_t Duration::_internal_seconds() const {
return seconds_;
}
inline ::PROTOBUF_NAMESPACE_ID::int64 Duration::seconds() const {
inline int64_t Duration::seconds() const {
// @@protoc_insertion_point(field_get:google.protobuf.Duration.seconds)
return _internal_seconds();
}
inline void Duration::_internal_set_seconds(::PROTOBUF_NAMESPACE_ID::int64 value) {
inline void Duration::_internal_set_seconds(int64_t value) {
seconds_ = value;
}
inline void Duration::set_seconds(::PROTOBUF_NAMESPACE_ID::int64 value) {
inline void Duration::set_seconds(int64_t value) {
_internal_set_seconds(value);
// @@protoc_insertion_point(field_set:google.protobuf.Duration.seconds)
}
@ -257,18 +257,18 @@ inline void Duration::set_seconds(::PROTOBUF_NAMESPACE_ID::int64 value) {
inline void Duration::clear_nanos() {
nanos_ = 0;
}
inline ::PROTOBUF_NAMESPACE_ID::int32 Duration::_internal_nanos() const {
inline int32_t Duration::_internal_nanos() const {
return nanos_;
}
inline ::PROTOBUF_NAMESPACE_ID::int32 Duration::nanos() const {
inline int32_t Duration::nanos() const {
// @@protoc_insertion_point(field_get:google.protobuf.Duration.nanos)
return _internal_nanos();
}
inline void Duration::_internal_set_nanos(::PROTOBUF_NAMESPACE_ID::int32 value) {
inline void Duration::_internal_set_nanos(int32_t value) {
nanos_ = value;
}
inline void Duration::set_nanos(::PROTOBUF_NAMESPACE_ID::int32 value) {
inline void Duration::set_nanos(int32_t value) {
_internal_set_nanos(value);
// @@protoc_insertion_point(field_set:google.protobuf.Duration.nanos)
}

View File

@ -33,7 +33,7 @@ static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_google_2fprotobuf_2
static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_google_2fprotobuf_2fempty_2eproto = nullptr;
static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_google_2fprotobuf_2fempty_2eproto = nullptr;
const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_google_2fprotobuf_2fempty_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
const uint32_t TableStruct_google_2fprotobuf_2fempty_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
~0u, // no _has_bits_
PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Empty, _internal_metadata_),
~0u, // no _extensions_

View File

@ -51,7 +51,7 @@ struct PROTOBUF_EXPORT TableStruct_google_2fprotobuf_2fempty_2eproto {
PROTOBUF_SECTION_VARIABLE(protodesc_cold);
static const ::PROTOBUF_NAMESPACE_ID::internal::FieldMetadata field_metadata[];
static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[];
static const ::PROTOBUF_NAMESPACE_ID::uint32 offsets[];
static const uint32_t offsets[];
};
PROTOBUF_EXPORT extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fprotobuf_2fempty_2eproto;
PROTOBUF_NAMESPACE_OPEN

View File

@ -101,22 +101,22 @@ typedef bool EnumValidityFuncWithArg(const void* arg, int number);
// Information about a registered extension.
struct ExtensionInfo {
inline ExtensionInfo() {}
inline ExtensionInfo(const MessageLite* extendee, int param_number,
FieldType type_param, bool isrepeated, bool ispacked)
constexpr ExtensionInfo() : enum_validity_check() {}
constexpr ExtensionInfo(const MessageLite* extendee, int param_number,
FieldType type_param, bool isrepeated, bool ispacked)
: message(extendee),
number(param_number),
type(type_param),
is_repeated(isrepeated),
is_packed(ispacked),
descriptor(nullptr) {}
enum_validity_check() {}
const MessageLite* message;
int number;
const MessageLite* message = nullptr;
int number = 0;
FieldType type;
bool is_repeated;
bool is_packed;
FieldType type = 0;
bool is_repeated = false;
bool is_packed = false;
struct EnumValidityCheck {
EnumValidityFuncWithArg* func;
@ -135,7 +135,7 @@ struct ExtensionInfo {
// The descriptor for this extension, if one exists and is known. May be
// nullptr. Must not be nullptr if the descriptor for the extension does not
// live in the same pool as the descriptor for the containing type.
const FieldDescriptor* descriptor;
const FieldDescriptor* descriptor = nullptr;
};
// Abstract interface for an object which looks up extension definitions. Used

View File

@ -34,7 +34,7 @@ static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_google_2fprotobuf_2
static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_google_2fprotobuf_2ffield_5fmask_2eproto = nullptr;
static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_google_2fprotobuf_2ffield_5fmask_2eproto = nullptr;
const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_google_2fprotobuf_2ffield_5fmask_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
const uint32_t TableStruct_google_2fprotobuf_2ffield_5fmask_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
~0u, // no _has_bits_
PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FieldMask, _internal_metadata_),
~0u, // no _extensions_
@ -123,7 +123,7 @@ void FieldMask::SetCachedSize(int size) const {
void FieldMask::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.FieldMask)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@ -134,12 +134,12 @@ void FieldMask::Clear() {
const char* FieldMask::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
::PROTOBUF_NAMESPACE_ID::uint32 tag;
uint32_t tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
switch (tag >> 3) {
// repeated string paths = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
ptr -= 1;
do {
ptr += 1;
@ -175,10 +175,10 @@ failure:
#undef CHK_
}
::PROTOBUF_NAMESPACE_ID::uint8* FieldMask::_InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
uint8_t* FieldMask::_InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.FieldMask)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
// repeated string paths = 1;
@ -203,7 +203,7 @@ size_t FieldMask::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:google.protobuf.FieldMask)
size_t total_size = 0;
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@ -234,7 +234,7 @@ void FieldMask::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
void FieldMask::MergeFrom(const FieldMask& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.FieldMask)
GOOGLE_DCHECK_NE(&from, this);
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
paths_.MergeFrom(from.paths_);

View File

@ -50,7 +50,7 @@ struct PROTOBUF_EXPORT TableStruct_google_2fprotobuf_2ffield_5fmask_2eproto {
PROTOBUF_SECTION_VARIABLE(protodesc_cold);
static const ::PROTOBUF_NAMESPACE_ID::internal::FieldMetadata field_metadata[];
static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[];
static const ::PROTOBUF_NAMESPACE_ID::uint32 offsets[];
static const uint32_t offsets[];
};
PROTOBUF_EXPORT extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fprotobuf_2ffield_5fmask_2eproto;
PROTOBUF_NAMESPACE_OPEN
@ -158,8 +158,8 @@ class PROTOBUF_EXPORT FieldMask final :
size_t ByteSizeLong() const final;
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
uint8_t* _InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
int GetCachedSize() const final { return _cached_size_.Get(); }
private:

View File

@ -468,6 +468,12 @@
#error PROTOBUF_FORCE_COPY_IN_MOVE was previously defined
#endif
// Force copy the default string to a string field so that non-optimized builds
// have harder-to-rely-on address stability.
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
#error PROTOBUF_FORCE_COPY_DEFAULT_STRING was previously defined
#endif
#ifdef PROTOBUF_FALLTHROUGH_INTENDED
#error PROTOBUF_FALLTHROUGH_INTENDED was previously defined
#endif

View File

@ -67,6 +67,7 @@
#undef PROTOBUF_FORCE_COPY_IN_RELEASE
#undef PROTOBUF_FORCE_COPY_IN_SWAP
#undef PROTOBUF_FORCE_COPY_IN_MOVE
#undef PROTOBUF_FORCE_COPY_DEFAULT_STRING
#undef PROTOBUF_NAMESPACE_OPEN
#undef PROTOBUF_NAMESPACE_CLOSE
#undef PROTOBUF_UNUSED

View File

@ -1140,6 +1140,7 @@ class RepeatedPtrField final : private internal::RepeatedPtrFieldBase {
// Get the number of cleared objects that are currently being kept
// around for reuse.
int ClearedCount() const;
#ifndef PROTOBUF_FUTURE_BREAKING_CHANGES
// Add an element to the pool of cleared objects, passing ownership to
// the RepeatedPtrField. The element must be cleared prior to calling
// this method.
@ -1155,6 +1156,7 @@ class RepeatedPtrField final : private internal::RepeatedPtrFieldBase {
// This method cannot be called when the repeated field is on an arena; doing
// so will trigger a GOOGLE_DCHECK-failure.
PROTOBUF_MUST_USE_RESULT Element* ReleaseCleared();
#endif // !PROTOBUF_FUTURE_BREAKING_CHANGES
// Removes the element referenced by position.
//
@ -2480,6 +2482,7 @@ inline int RepeatedPtrField<Element>::ClearedCount() const {
return RepeatedPtrFieldBase::ClearedCount();
}
#ifndef PROTOBUF_FUTURE_BREAKING_CHANGES
template <typename Element>
inline void RepeatedPtrField<Element>::AddCleared(Element* value) {
return RepeatedPtrFieldBase::AddCleared<TypeHandler>(value);
@ -2489,6 +2492,7 @@ template <typename Element>
inline Element* RepeatedPtrField<Element>::ReleaseCleared() {
return RepeatedPtrFieldBase::ReleaseCleared<TypeHandler>();
}
#endif // !PROTOBUF_FUTURE_BREAKING_CHANGES
template <typename Element>
inline void RepeatedPtrField<Element>::Reserve(int new_size) {

View File

@ -1140,6 +1140,7 @@ TEST(RepeatedPtrField, ClearedElements) {
field.Clear();
EXPECT_EQ(field.ClearedCount(), 2);
#ifndef PROTOBUF_FUTURE_BREAKING_CHANGES
EXPECT_EQ(field.ReleaseCleared(), original); // Take ownership again.
EXPECT_EQ(field.ClearedCount(), 1);
EXPECT_NE(field.Add(), original);
@ -1151,6 +1152,7 @@ TEST(RepeatedPtrField, ClearedElements) {
EXPECT_EQ(field.ClearedCount(), 1);
EXPECT_EQ(field.Add(), original);
EXPECT_EQ(field.ClearedCount(), 0);
#endif // !PROTOBUF_FUTURE_BREAKING_CHANGES
}
// Test all code paths in AddAllocated().

View File

@ -34,7 +34,7 @@ static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_google_2fprotobuf_2
static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_google_2fprotobuf_2fsource_5fcontext_2eproto = nullptr;
static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_google_2fprotobuf_2fsource_5fcontext_2eproto = nullptr;
const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_google_2fprotobuf_2fsource_5fcontext_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
const uint32_t TableStruct_google_2fprotobuf_2fsource_5fcontext_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
~0u, // no _has_bits_
PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::SourceContext, _internal_metadata_),
~0u, // no _extensions_
@ -93,6 +93,9 @@ SourceContext::SourceContext(const SourceContext& from)
: ::PROTOBUF_NAMESPACE_ID::Message() {
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
file_name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
file_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (!from._internal_file_name().empty()) {
file_name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_file_name(),
GetArenaForAllocation());
@ -102,6 +105,9 @@ SourceContext::SourceContext(const SourceContext& from)
inline void SourceContext::SharedCtor() {
file_name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
file_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
}
SourceContext::~SourceContext() {
@ -128,7 +134,7 @@ void SourceContext::SetCachedSize(int size) const {
void SourceContext::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.SourceContext)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@ -139,12 +145,12 @@ void SourceContext::Clear() {
const char* SourceContext::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
::PROTOBUF_NAMESPACE_ID::uint32 tag;
uint32_t tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
switch (tag >> 3) {
// string file_name = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
auto str = _internal_mutable_file_name();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.SourceContext.file_name"));
@ -175,10 +181,10 @@ failure:
#undef CHK_
}
::PROTOBUF_NAMESPACE_ID::uint8* SourceContext::_InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
uint8_t* SourceContext::_InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.SourceContext)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
// string file_name = 1;
@ -203,7 +209,7 @@ size_t SourceContext::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:google.protobuf.SourceContext)
size_t total_size = 0;
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@ -233,7 +239,7 @@ void SourceContext::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
void SourceContext::MergeFrom(const SourceContext& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.SourceContext)
GOOGLE_DCHECK_NE(&from, this);
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
if (!from._internal_file_name().empty()) {

View File

@ -50,7 +50,7 @@ struct PROTOBUF_EXPORT TableStruct_google_2fprotobuf_2fsource_5fcontext_2eproto
PROTOBUF_SECTION_VARIABLE(protodesc_cold);
static const ::PROTOBUF_NAMESPACE_ID::internal::FieldMetadata field_metadata[];
static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[];
static const ::PROTOBUF_NAMESPACE_ID::uint32 offsets[];
static const uint32_t offsets[];
};
PROTOBUF_EXPORT extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fprotobuf_2fsource_5fcontext_2eproto;
PROTOBUF_NAMESPACE_OPEN
@ -158,8 +158,8 @@ class PROTOBUF_EXPORT SourceContext final :
size_t ByteSizeLong() const final;
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
uint8_t* _InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
@ -270,6 +270,11 @@ inline void SourceContext::set_allocated_file_name(std::string* file_name) {
}
file_name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), file_name,
GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (file_name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
file_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.SourceContext.file_name)
}

View File

@ -69,7 +69,7 @@ static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_google_2fprotobuf_2
static const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* file_level_enum_descriptors_google_2fprotobuf_2fstruct_2eproto[1];
static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_google_2fprotobuf_2fstruct_2eproto = nullptr;
const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_google_2fprotobuf_2fstruct_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
const uint32_t TableStruct_google_2fprotobuf_2fstruct_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Struct_FieldsEntry_DoNotUse, _has_bits_),
PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Struct_FieldsEntry_DoNotUse, _internal_metadata_),
~0u, // no _extensions_
@ -235,7 +235,7 @@ void Struct::SetCachedSize(int size) const {
void Struct::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.Struct)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@ -246,12 +246,12 @@ void Struct::Clear() {
const char* Struct::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
::PROTOBUF_NAMESPACE_ID::uint32 tag;
uint32_t tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
switch (tag >> 3) {
// map<string, .google.protobuf.Value> fields = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
ptr -= 1;
do {
ptr += 1;
@ -285,10 +285,10 @@ failure:
#undef CHK_
}
::PROTOBUF_NAMESPACE_ID::uint8* Struct::_InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
uint8_t* Struct::_InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Struct)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
// map<string, .google.protobuf.Value> fields = 1;
@ -345,7 +345,7 @@ size_t Struct::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:google.protobuf.Struct)
size_t total_size = 0;
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@ -377,7 +377,7 @@ void Struct::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
void Struct::MergeFrom(const Struct& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Struct)
GOOGLE_DCHECK_NE(&from, this);
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
fields_.MergeFrom(from.fields_);
@ -567,7 +567,7 @@ void Value::clear_kind() {
void Value::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.Value)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@ -578,13 +578,13 @@ void Value::Clear() {
const char* Value::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
::PROTOBUF_NAMESPACE_ID::uint32 tag;
uint32_t tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
switch (tag >> 3) {
// .google.protobuf.NullValue null_value = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) {
::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) {
uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
CHK_(ptr);
_internal_set_null_value(static_cast<::PROTOBUF_NAMESPACE_ID::NullValue>(val));
} else
@ -592,7 +592,7 @@ const char* Value::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inte
continue;
// double number_value = 2;
case 2:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 17)) {
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 17)) {
_internal_set_number_value(::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<double>(ptr));
ptr += sizeof(double);
} else
@ -600,7 +600,7 @@ const char* Value::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inte
continue;
// string string_value = 3;
case 3:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) {
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 26)) {
auto str = _internal_mutable_string_value();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Value.string_value"));
@ -610,7 +610,7 @@ const char* Value::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inte
continue;
// bool bool_value = 4;
case 4:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 32)) {
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 32)) {
_internal_set_bool_value(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr));
CHK_(ptr);
} else
@ -618,7 +618,7 @@ const char* Value::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inte
continue;
// .google.protobuf.Struct struct_value = 5;
case 5:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 42)) {
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 42)) {
ptr = ctx->ParseMessage(_internal_mutable_struct_value(), ptr);
CHK_(ptr);
} else
@ -626,7 +626,7 @@ const char* Value::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inte
continue;
// .google.protobuf.ListValue list_value = 6;
case 6:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 50)) {
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 50)) {
ptr = ctx->ParseMessage(_internal_mutable_list_value(), ptr);
CHK_(ptr);
} else
@ -655,10 +655,10 @@ failure:
#undef CHK_
}
::PROTOBUF_NAMESPACE_ID::uint8* Value::_InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
uint8_t* Value::_InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Value)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
// .google.protobuf.NullValue null_value = 1;
@ -718,7 +718,7 @@ size_t Value::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:google.protobuf.Value)
size_t total_size = 0;
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@ -783,7 +783,7 @@ void Value::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
void Value::MergeFrom(const Value& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Value)
GOOGLE_DCHECK_NE(&from, this);
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
switch (from.kind_case()) {
@ -891,7 +891,7 @@ void ListValue::SetCachedSize(int size) const {
void ListValue::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.ListValue)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@ -902,12 +902,12 @@ void ListValue::Clear() {
const char* ListValue::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
::PROTOBUF_NAMESPACE_ID::uint32 tag;
uint32_t tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
switch (tag >> 3) {
// repeated .google.protobuf.Value values = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
ptr -= 1;
do {
ptr += 1;
@ -941,10 +941,10 @@ failure:
#undef CHK_
}
::PROTOBUF_NAMESPACE_ID::uint8* ListValue::_InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
uint8_t* ListValue::_InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.ListValue)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
// repeated .google.protobuf.Value values = 1;
@ -967,7 +967,7 @@ size_t ListValue::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:google.protobuf.ListValue)
size_t total_size = 0;
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@ -997,7 +997,7 @@ void ListValue::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
void ListValue::MergeFrom(const ListValue& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.ListValue)
GOOGLE_DCHECK_NE(&from, this);
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
values_.MergeFrom(from.values_);

View File

@ -54,7 +54,7 @@ struct PROTOBUF_EXPORT TableStruct_google_2fprotobuf_2fstruct_2eproto {
PROTOBUF_SECTION_VARIABLE(protodesc_cold);
static const ::PROTOBUF_NAMESPACE_ID::internal::FieldMetadata field_metadata[];
static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[];
static const ::PROTOBUF_NAMESPACE_ID::uint32 offsets[];
static const uint32_t offsets[];
};
PROTOBUF_EXPORT extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fprotobuf_2fstruct_2eproto;
PROTOBUF_NAMESPACE_OPEN
@ -81,8 +81,8 @@ PROTOBUF_NAMESPACE_OPEN
enum NullValue : int {
NULL_VALUE = 0,
NullValue_INT_MIN_SENTINEL_DO_NOT_USE_ = std::numeric_limits<::PROTOBUF_NAMESPACE_ID::int32>::min(),
NullValue_INT_MAX_SENTINEL_DO_NOT_USE_ = std::numeric_limits<::PROTOBUF_NAMESPACE_ID::int32>::max()
NullValue_INT_MIN_SENTINEL_DO_NOT_USE_ = std::numeric_limits<int32_t>::min(),
NullValue_INT_MAX_SENTINEL_DO_NOT_USE_ = std::numeric_limits<int32_t>::max()
};
PROTOBUF_EXPORT bool NullValue_IsValid(int value);
constexpr NullValue NullValue_MIN = NULL_VALUE;
@ -223,8 +223,8 @@ class PROTOBUF_EXPORT Struct final :
size_t ByteSizeLong() const final;
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
uint8_t* _InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
@ -394,8 +394,8 @@ class PROTOBUF_EXPORT Value final :
size_t ByteSizeLong() const final;
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
uint8_t* _InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
@ -554,7 +554,7 @@ class PROTOBUF_EXPORT Value final :
::PROTOBUF_NAMESPACE_ID::ListValue* list_value_;
} kind_;
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
::PROTOBUF_NAMESPACE_ID::uint32 _oneof_case_[1];
uint32_t _oneof_case_[1];
friend struct ::TableStruct_google_2fprotobuf_2fstruct_2eproto;
};
@ -653,8 +653,8 @@ class PROTOBUF_EXPORT ListValue final :
size_t ByteSizeLong() const final;
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
uint8_t* _InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
int GetCachedSize() const final { return _cached_size_.Get(); }
private:

View File

@ -55,8 +55,8 @@ message Struct {
// `Value` represents a dynamically typed value which can be either
// null, a number, a string, a boolean, a recursive struct value, or a
// list of values. A producer of value is expected to set one of that
// variants, absence of any variant indicates an error.
// list of values. A producer of value is expected to set one of these
// variants. Absence of any variant indicates an error.
//
// The JSON representation for `Value` is JSON value.
message Value {

View File

@ -35,7 +35,7 @@ static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_google_2fprotobuf_2
static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_google_2fprotobuf_2ftimestamp_2eproto = nullptr;
static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_google_2fprotobuf_2ftimestamp_2eproto = nullptr;
const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_google_2fprotobuf_2ftimestamp_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
const uint32_t TableStruct_google_2fprotobuf_2ftimestamp_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
~0u, // no _has_bits_
PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Timestamp, _internal_metadata_),
~0u, // no _extensions_
@ -130,7 +130,7 @@ void Timestamp::SetCachedSize(int size) const {
void Timestamp::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.Timestamp)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@ -143,12 +143,12 @@ void Timestamp::Clear() {
const char* Timestamp::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
::PROTOBUF_NAMESPACE_ID::uint32 tag;
uint32_t tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
switch (tag >> 3) {
// int64 seconds = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) {
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) {
seconds_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
CHK_(ptr);
} else
@ -156,7 +156,7 @@ const char* Timestamp::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::
continue;
// int32 nanos = 2;
case 2:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) {
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 16)) {
nanos_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
CHK_(ptr);
} else
@ -185,10 +185,10 @@ failure:
#undef CHK_
}
::PROTOBUF_NAMESPACE_ID::uint8* Timestamp::_InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
uint8_t* Timestamp::_InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Timestamp)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
// int64 seconds = 1;
@ -215,7 +215,7 @@ size_t Timestamp::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:google.protobuf.Timestamp)
size_t total_size = 0;
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@ -248,7 +248,7 @@ void Timestamp::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
void Timestamp::MergeFrom(const Timestamp& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Timestamp)
GOOGLE_DCHECK_NE(&from, this);
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
if (from._internal_seconds() != 0) {

View File

@ -50,7 +50,7 @@ struct PROTOBUF_EXPORT TableStruct_google_2fprotobuf_2ftimestamp_2eproto {
PROTOBUF_SECTION_VARIABLE(protodesc_cold);
static const ::PROTOBUF_NAMESPACE_ID::internal::FieldMetadata field_metadata[];
static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[];
static const ::PROTOBUF_NAMESPACE_ID::uint32 offsets[];
static const uint32_t offsets[];
};
PROTOBUF_EXPORT extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fprotobuf_2ftimestamp_2eproto;
PROTOBUF_NAMESPACE_OPEN
@ -158,8 +158,8 @@ class PROTOBUF_EXPORT Timestamp final :
size_t ByteSizeLong() const final;
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
uint8_t* _InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
@ -194,20 +194,20 @@ class PROTOBUF_EXPORT Timestamp final :
};
// int64 seconds = 1;
void clear_seconds();
::PROTOBUF_NAMESPACE_ID::int64 seconds() const;
void set_seconds(::PROTOBUF_NAMESPACE_ID::int64 value);
int64_t seconds() const;
void set_seconds(int64_t value);
private:
::PROTOBUF_NAMESPACE_ID::int64 _internal_seconds() const;
void _internal_set_seconds(::PROTOBUF_NAMESPACE_ID::int64 value);
int64_t _internal_seconds() const;
void _internal_set_seconds(int64_t value);
public:
// int32 nanos = 2;
void clear_nanos();
::PROTOBUF_NAMESPACE_ID::int32 nanos() const;
void set_nanos(::PROTOBUF_NAMESPACE_ID::int32 value);
int32_t nanos() const;
void set_nanos(int32_t value);
private:
::PROTOBUF_NAMESPACE_ID::int32 _internal_nanos() const;
void _internal_set_nanos(::PROTOBUF_NAMESPACE_ID::int32 value);
int32_t _internal_nanos() const;
void _internal_set_nanos(int32_t value);
public:
// @@protoc_insertion_point(class_scope:google.protobuf.Timestamp)
@ -217,8 +217,8 @@ class PROTOBUF_EXPORT Timestamp final :
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
typedef void InternalArenaConstructable_;
typedef void DestructorSkippable_;
::PROTOBUF_NAMESPACE_ID::int64 seconds_;
::PROTOBUF_NAMESPACE_ID::int32 nanos_;
int64_t seconds_;
int32_t nanos_;
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
friend struct ::TableStruct_google_2fprotobuf_2ftimestamp_2eproto;
};
@ -237,18 +237,18 @@ class PROTOBUF_EXPORT Timestamp final :
inline void Timestamp::clear_seconds() {
seconds_ = int64_t{0};
}
inline ::PROTOBUF_NAMESPACE_ID::int64 Timestamp::_internal_seconds() const {
inline int64_t Timestamp::_internal_seconds() const {
return seconds_;
}
inline ::PROTOBUF_NAMESPACE_ID::int64 Timestamp::seconds() const {
inline int64_t Timestamp::seconds() const {
// @@protoc_insertion_point(field_get:google.protobuf.Timestamp.seconds)
return _internal_seconds();
}
inline void Timestamp::_internal_set_seconds(::PROTOBUF_NAMESPACE_ID::int64 value) {
inline void Timestamp::_internal_set_seconds(int64_t value) {
seconds_ = value;
}
inline void Timestamp::set_seconds(::PROTOBUF_NAMESPACE_ID::int64 value) {
inline void Timestamp::set_seconds(int64_t value) {
_internal_set_seconds(value);
// @@protoc_insertion_point(field_set:google.protobuf.Timestamp.seconds)
}
@ -257,18 +257,18 @@ inline void Timestamp::set_seconds(::PROTOBUF_NAMESPACE_ID::int64 value) {
inline void Timestamp::clear_nanos() {
nanos_ = 0;
}
inline ::PROTOBUF_NAMESPACE_ID::int32 Timestamp::_internal_nanos() const {
inline int32_t Timestamp::_internal_nanos() const {
return nanos_;
}
inline ::PROTOBUF_NAMESPACE_ID::int32 Timestamp::nanos() const {
inline int32_t Timestamp::nanos() const {
// @@protoc_insertion_point(field_get:google.protobuf.Timestamp.nanos)
return _internal_nanos();
}
inline void Timestamp::_internal_set_nanos(::PROTOBUF_NAMESPACE_ID::int32 value) {
inline void Timestamp::_internal_set_nanos(int32_t value) {
nanos_ = value;
}
inline void Timestamp::set_nanos(::PROTOBUF_NAMESPACE_ID::int32 value) {
inline void Timestamp::set_nanos(int32_t value) {
_internal_set_nanos(value);
// @@protoc_insertion_point(field_set:google.protobuf.Timestamp.nanos)
}

View File

@ -107,7 +107,7 @@ static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_google_2fprotobuf_2
static const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* file_level_enum_descriptors_google_2fprotobuf_2ftype_2eproto[3];
static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_google_2fprotobuf_2ftype_2eproto = nullptr;
const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_google_2fprotobuf_2ftype_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
const uint32_t TableStruct_google_2fprotobuf_2ftype_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
~0u, // no _has_bits_
PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Type, _internal_metadata_),
~0u, // no _extensions_
@ -372,6 +372,9 @@ Type::Type(const Type& from)
options_(from.options_) {
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (!from._internal_name().empty()) {
name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(),
GetArenaForAllocation());
@ -387,6 +390,9 @@ Type::Type(const Type& from)
inline void Type::SharedCtor() {
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(
reinterpret_cast<char*>(&source_context_) - reinterpret_cast<char*>(this)),
0, static_cast<size_t>(reinterpret_cast<char*>(&syntax_) -
@ -418,7 +424,7 @@ void Type::SetCachedSize(int size) const {
void Type::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.Type)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@ -437,12 +443,12 @@ void Type::Clear() {
const char* Type::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
::PROTOBUF_NAMESPACE_ID::uint32 tag;
uint32_t tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
switch (tag >> 3) {
// string name = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
auto str = _internal_mutable_name();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Type.name"));
@ -452,7 +458,7 @@ const char* Type::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inter
continue;
// repeated .google.protobuf.Field fields = 2;
case 2:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) {
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) {
ptr -= 1;
do {
ptr += 1;
@ -465,7 +471,7 @@ const char* Type::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inter
continue;
// repeated string oneofs = 3;
case 3:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) {
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 26)) {
ptr -= 1;
do {
ptr += 1;
@ -480,7 +486,7 @@ const char* Type::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inter
continue;
// repeated .google.protobuf.Option options = 4;
case 4:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 34)) {
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 34)) {
ptr -= 1;
do {
ptr += 1;
@ -493,7 +499,7 @@ const char* Type::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inter
continue;
// .google.protobuf.SourceContext source_context = 5;
case 5:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 42)) {
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 42)) {
ptr = ctx->ParseMessage(_internal_mutable_source_context(), ptr);
CHK_(ptr);
} else
@ -501,8 +507,8 @@ const char* Type::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inter
continue;
// .google.protobuf.Syntax syntax = 6;
case 6:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 48)) {
::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 48)) {
uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
CHK_(ptr);
_internal_set_syntax(static_cast<::PROTOBUF_NAMESPACE_ID::Syntax>(val));
} else
@ -531,10 +537,10 @@ failure:
#undef CHK_
}
::PROTOBUF_NAMESPACE_ID::uint8* Type::_InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
uint8_t* Type::_InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Type)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
// string name = 1;
@ -600,7 +606,7 @@ size_t Type::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:google.protobuf.Type)
size_t total_size = 0;
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@ -665,7 +671,7 @@ void Type::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
void Type::MergeFrom(const Type& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Type)
GOOGLE_DCHECK_NE(&from, this);
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
fields_.MergeFrom(from.fields_);
@ -742,21 +748,33 @@ Field::Field(const Field& from)
options_(from.options_) {
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (!from._internal_name().empty()) {
name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(),
GetArenaForAllocation());
}
type_url_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
type_url_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (!from._internal_type_url().empty()) {
type_url_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_type_url(),
GetArenaForAllocation());
}
json_name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
json_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (!from._internal_json_name().empty()) {
json_name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_json_name(),
GetArenaForAllocation());
}
default_value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
default_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (!from._internal_default_value().empty()) {
default_value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_default_value(),
GetArenaForAllocation());
@ -769,9 +787,21 @@ Field::Field(const Field& from)
inline void Field::SharedCtor() {
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
type_url_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
type_url_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
json_name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
json_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
default_value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
default_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(
reinterpret_cast<char*>(&kind_) - reinterpret_cast<char*>(this)),
0, static_cast<size_t>(reinterpret_cast<char*>(&packed_) -
@ -805,7 +835,7 @@ void Field::SetCachedSize(int size) const {
void Field::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.Field)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@ -823,13 +853,13 @@ void Field::Clear() {
const char* Field::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
::PROTOBUF_NAMESPACE_ID::uint32 tag;
uint32_t tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
switch (tag >> 3) {
// .google.protobuf.Field.Kind kind = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) {
::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) {
uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
CHK_(ptr);
_internal_set_kind(static_cast<::PROTOBUF_NAMESPACE_ID::Field_Kind>(val));
} else
@ -837,8 +867,8 @@ const char* Field::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inte
continue;
// .google.protobuf.Field.Cardinality cardinality = 2;
case 2:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) {
::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 16)) {
uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
CHK_(ptr);
_internal_set_cardinality(static_cast<::PROTOBUF_NAMESPACE_ID::Field_Cardinality>(val));
} else
@ -846,7 +876,7 @@ const char* Field::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inte
continue;
// int32 number = 3;
case 3:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 24)) {
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 24)) {
number_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
CHK_(ptr);
} else
@ -854,7 +884,7 @@ const char* Field::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inte
continue;
// string name = 4;
case 4:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 34)) {
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 34)) {
auto str = _internal_mutable_name();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Field.name"));
@ -864,7 +894,7 @@ const char* Field::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inte
continue;
// string type_url = 6;
case 6:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 50)) {
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 50)) {
auto str = _internal_mutable_type_url();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Field.type_url"));
@ -874,7 +904,7 @@ const char* Field::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inte
continue;
// int32 oneof_index = 7;
case 7:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 56)) {
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 56)) {
oneof_index_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
CHK_(ptr);
} else
@ -882,7 +912,7 @@ const char* Field::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inte
continue;
// bool packed = 8;
case 8:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 64)) {
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 64)) {
packed_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
CHK_(ptr);
} else
@ -890,7 +920,7 @@ const char* Field::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inte
continue;
// repeated .google.protobuf.Option options = 9;
case 9:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 74)) {
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 74)) {
ptr -= 1;
do {
ptr += 1;
@ -903,7 +933,7 @@ const char* Field::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inte
continue;
// string json_name = 10;
case 10:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 82)) {
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 82)) {
auto str = _internal_mutable_json_name();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Field.json_name"));
@ -913,7 +943,7 @@ const char* Field::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inte
continue;
// string default_value = 11;
case 11:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 90)) {
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 90)) {
auto str = _internal_mutable_default_value();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Field.default_value"));
@ -944,10 +974,10 @@ failure:
#undef CHK_
}
::PROTOBUF_NAMESPACE_ID::uint8* Field::_InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
uint8_t* Field::_InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Field)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
// .google.protobuf.Field.Kind kind = 1;
@ -1042,7 +1072,7 @@ size_t Field::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:google.protobuf.Field)
size_t total_size = 0;
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@ -1127,7 +1157,7 @@ void Field::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
void Field::MergeFrom(const Field& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Field)
GOOGLE_DCHECK_NE(&from, this);
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
options_.MergeFrom(from.options_);
@ -1246,6 +1276,9 @@ Enum::Enum(const Enum& from)
options_(from.options_) {
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (!from._internal_name().empty()) {
name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(),
GetArenaForAllocation());
@ -1261,6 +1294,9 @@ Enum::Enum(const Enum& from)
inline void Enum::SharedCtor() {
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(
reinterpret_cast<char*>(&source_context_) - reinterpret_cast<char*>(this)),
0, static_cast<size_t>(reinterpret_cast<char*>(&syntax_) -
@ -1292,7 +1328,7 @@ void Enum::SetCachedSize(int size) const {
void Enum::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.Enum)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@ -1310,12 +1346,12 @@ void Enum::Clear() {
const char* Enum::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
::PROTOBUF_NAMESPACE_ID::uint32 tag;
uint32_t tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
switch (tag >> 3) {
// string name = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
auto str = _internal_mutable_name();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Enum.name"));
@ -1325,7 +1361,7 @@ const char* Enum::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inter
continue;
// repeated .google.protobuf.EnumValue enumvalue = 2;
case 2:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) {
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) {
ptr -= 1;
do {
ptr += 1;
@ -1338,7 +1374,7 @@ const char* Enum::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inter
continue;
// repeated .google.protobuf.Option options = 3;
case 3:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) {
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 26)) {
ptr -= 1;
do {
ptr += 1;
@ -1351,7 +1387,7 @@ const char* Enum::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inter
continue;
// .google.protobuf.SourceContext source_context = 4;
case 4:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 34)) {
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 34)) {
ptr = ctx->ParseMessage(_internal_mutable_source_context(), ptr);
CHK_(ptr);
} else
@ -1359,8 +1395,8 @@ const char* Enum::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inter
continue;
// .google.protobuf.Syntax syntax = 5;
case 5:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 40)) {
::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 40)) {
uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
CHK_(ptr);
_internal_set_syntax(static_cast<::PROTOBUF_NAMESPACE_ID::Syntax>(val));
} else
@ -1389,10 +1425,10 @@ failure:
#undef CHK_
}
::PROTOBUF_NAMESPACE_ID::uint8* Enum::_InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
uint8_t* Enum::_InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Enum)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
// string name = 1;
@ -1448,7 +1484,7 @@ size_t Enum::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:google.protobuf.Enum)
size_t total_size = 0;
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@ -1505,7 +1541,7 @@ void Enum::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
void Enum::MergeFrom(const Enum& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Enum)
GOOGLE_DCHECK_NE(&from, this);
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
enumvalue_.MergeFrom(from.enumvalue_);
@ -1580,6 +1616,9 @@ EnumValue::EnumValue(const EnumValue& from)
options_(from.options_) {
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (!from._internal_name().empty()) {
name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(),
GetArenaForAllocation());
@ -1590,6 +1629,9 @@ EnumValue::EnumValue(const EnumValue& from)
inline void EnumValue::SharedCtor() {
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
number_ = 0;
}
@ -1617,7 +1659,7 @@ void EnumValue::SetCachedSize(int size) const {
void EnumValue::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.EnumValue)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@ -1630,12 +1672,12 @@ void EnumValue::Clear() {
const char* EnumValue::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
::PROTOBUF_NAMESPACE_ID::uint32 tag;
uint32_t tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
switch (tag >> 3) {
// string name = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
auto str = _internal_mutable_name();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.EnumValue.name"));
@ -1645,7 +1687,7 @@ const char* EnumValue::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::
continue;
// int32 number = 2;
case 2:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) {
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 16)) {
number_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
CHK_(ptr);
} else
@ -1653,7 +1695,7 @@ const char* EnumValue::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::
continue;
// repeated .google.protobuf.Option options = 3;
case 3:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) {
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 26)) {
ptr -= 1;
do {
ptr += 1;
@ -1687,10 +1729,10 @@ failure:
#undef CHK_
}
::PROTOBUF_NAMESPACE_ID::uint8* EnumValue::_InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
uint8_t* EnumValue::_InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.EnumValue)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
// string name = 1;
@ -1729,7 +1771,7 @@ size_t EnumValue::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:google.protobuf.EnumValue)
size_t total_size = 0;
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@ -1771,7 +1813,7 @@ void EnumValue::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
void EnumValue::MergeFrom(const EnumValue& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.EnumValue)
GOOGLE_DCHECK_NE(&from, this);
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
options_.MergeFrom(from.options_);
@ -1845,6 +1887,9 @@ Option::Option(const Option& from)
: ::PROTOBUF_NAMESPACE_ID::Message() {
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (!from._internal_name().empty()) {
name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(),
GetArenaForAllocation());
@ -1859,6 +1904,9 @@ Option::Option(const Option& from)
inline void Option::SharedCtor() {
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
value_ = nullptr;
}
@ -1887,7 +1935,7 @@ void Option::SetCachedSize(int size) const {
void Option::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.Option)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@ -1902,12 +1950,12 @@ void Option::Clear() {
const char* Option::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
::PROTOBUF_NAMESPACE_ID::uint32 tag;
uint32_t tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
switch (tag >> 3) {
// string name = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
auto str = _internal_mutable_name();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Option.name"));
@ -1917,7 +1965,7 @@ const char* Option::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::int
continue;
// .google.protobuf.Any value = 2;
case 2:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) {
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) {
ptr = ctx->ParseMessage(_internal_mutable_value(), ptr);
CHK_(ptr);
} else
@ -1946,10 +1994,10 @@ failure:
#undef CHK_
}
::PROTOBUF_NAMESPACE_ID::uint8* Option::_InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
uint8_t* Option::_InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Option)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
// string name = 1;
@ -1982,7 +2030,7 @@ size_t Option::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:google.protobuf.Option)
size_t total_size = 0;
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@ -2019,7 +2067,7 @@ void Option::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
void Option::MergeFrom(const Option& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Option)
GOOGLE_DCHECK_NE(&from, this);
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
if (!from._internal_name().empty()) {

View File

@ -53,7 +53,7 @@ struct PROTOBUF_EXPORT TableStruct_google_2fprotobuf_2ftype_2eproto {
PROTOBUF_SECTION_VARIABLE(protodesc_cold);
static const ::PROTOBUF_NAMESPACE_ID::internal::FieldMetadata field_metadata[];
static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[];
static const ::PROTOBUF_NAMESPACE_ID::uint32 offsets[];
static const uint32_t offsets[];
};
PROTOBUF_EXPORT extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fprotobuf_2ftype_2eproto;
PROTOBUF_NAMESPACE_OPEN
@ -102,8 +102,8 @@ enum Field_Kind : int {
Field_Kind_TYPE_SFIXED64 = 16,
Field_Kind_TYPE_SINT32 = 17,
Field_Kind_TYPE_SINT64 = 18,
Field_Kind_Field_Kind_INT_MIN_SENTINEL_DO_NOT_USE_ = std::numeric_limits<::PROTOBUF_NAMESPACE_ID::int32>::min(),
Field_Kind_Field_Kind_INT_MAX_SENTINEL_DO_NOT_USE_ = std::numeric_limits<::PROTOBUF_NAMESPACE_ID::int32>::max()
Field_Kind_Field_Kind_INT_MIN_SENTINEL_DO_NOT_USE_ = std::numeric_limits<int32_t>::min(),
Field_Kind_Field_Kind_INT_MAX_SENTINEL_DO_NOT_USE_ = std::numeric_limits<int32_t>::max()
};
PROTOBUF_EXPORT bool Field_Kind_IsValid(int value);
constexpr Field_Kind Field_Kind_Kind_MIN = Field_Kind_TYPE_UNKNOWN;
@ -129,8 +129,8 @@ enum Field_Cardinality : int {
Field_Cardinality_CARDINALITY_OPTIONAL = 1,
Field_Cardinality_CARDINALITY_REQUIRED = 2,
Field_Cardinality_CARDINALITY_REPEATED = 3,
Field_Cardinality_Field_Cardinality_INT_MIN_SENTINEL_DO_NOT_USE_ = std::numeric_limits<::PROTOBUF_NAMESPACE_ID::int32>::min(),
Field_Cardinality_Field_Cardinality_INT_MAX_SENTINEL_DO_NOT_USE_ = std::numeric_limits<::PROTOBUF_NAMESPACE_ID::int32>::max()
Field_Cardinality_Field_Cardinality_INT_MIN_SENTINEL_DO_NOT_USE_ = std::numeric_limits<int32_t>::min(),
Field_Cardinality_Field_Cardinality_INT_MAX_SENTINEL_DO_NOT_USE_ = std::numeric_limits<int32_t>::max()
};
PROTOBUF_EXPORT bool Field_Cardinality_IsValid(int value);
constexpr Field_Cardinality Field_Cardinality_Cardinality_MIN = Field_Cardinality_CARDINALITY_UNKNOWN;
@ -154,8 +154,8 @@ inline bool Field_Cardinality_Parse(
enum Syntax : int {
SYNTAX_PROTO2 = 0,
SYNTAX_PROTO3 = 1,
Syntax_INT_MIN_SENTINEL_DO_NOT_USE_ = std::numeric_limits<::PROTOBUF_NAMESPACE_ID::int32>::min(),
Syntax_INT_MAX_SENTINEL_DO_NOT_USE_ = std::numeric_limits<::PROTOBUF_NAMESPACE_ID::int32>::max()
Syntax_INT_MIN_SENTINEL_DO_NOT_USE_ = std::numeric_limits<int32_t>::min(),
Syntax_INT_MAX_SENTINEL_DO_NOT_USE_ = std::numeric_limits<int32_t>::max()
};
PROTOBUF_EXPORT bool Syntax_IsValid(int value);
constexpr Syntax Syntax_MIN = SYNTAX_PROTO2;
@ -271,8 +271,8 @@ class PROTOBUF_EXPORT Type final :
size_t ByteSizeLong() const final;
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
uint8_t* _InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
@ -521,8 +521,8 @@ class PROTOBUF_EXPORT Field final :
size_t ByteSizeLong() const final;
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
uint8_t* _InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
@ -755,20 +755,20 @@ class PROTOBUF_EXPORT Field final :
// int32 number = 3;
void clear_number();
::PROTOBUF_NAMESPACE_ID::int32 number() const;
void set_number(::PROTOBUF_NAMESPACE_ID::int32 value);
int32_t number() const;
void set_number(int32_t value);
private:
::PROTOBUF_NAMESPACE_ID::int32 _internal_number() const;
void _internal_set_number(::PROTOBUF_NAMESPACE_ID::int32 value);
int32_t _internal_number() const;
void _internal_set_number(int32_t value);
public:
// int32 oneof_index = 7;
void clear_oneof_index();
::PROTOBUF_NAMESPACE_ID::int32 oneof_index() const;
void set_oneof_index(::PROTOBUF_NAMESPACE_ID::int32 value);
int32_t oneof_index() const;
void set_oneof_index(int32_t value);
private:
::PROTOBUF_NAMESPACE_ID::int32 _internal_oneof_index() const;
void _internal_set_oneof_index(::PROTOBUF_NAMESPACE_ID::int32 value);
int32_t _internal_oneof_index() const;
void _internal_set_oneof_index(int32_t value);
public:
// bool packed = 8;
@ -794,8 +794,8 @@ class PROTOBUF_EXPORT Field final :
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr default_value_;
int kind_;
int cardinality_;
::PROTOBUF_NAMESPACE_ID::int32 number_;
::PROTOBUF_NAMESPACE_ID::int32 oneof_index_;
int32_t number_;
int32_t oneof_index_;
bool packed_;
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
friend struct ::TableStruct_google_2fprotobuf_2ftype_2eproto;
@ -895,8 +895,8 @@ class PROTOBUF_EXPORT Enum final :
size_t ByteSizeLong() const final;
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
uint8_t* _InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
@ -1119,8 +1119,8 @@ class PROTOBUF_EXPORT EnumValue final :
size_t ByteSizeLong() const final;
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
uint8_t* _InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
@ -1188,11 +1188,11 @@ class PROTOBUF_EXPORT EnumValue final :
// int32 number = 2;
void clear_number();
::PROTOBUF_NAMESPACE_ID::int32 number() const;
void set_number(::PROTOBUF_NAMESPACE_ID::int32 value);
int32_t number() const;
void set_number(int32_t value);
private:
::PROTOBUF_NAMESPACE_ID::int32 _internal_number() const;
void _internal_set_number(::PROTOBUF_NAMESPACE_ID::int32 value);
int32_t _internal_number() const;
void _internal_set_number(int32_t value);
public:
// @@protoc_insertion_point(class_scope:google.protobuf.EnumValue)
@ -1204,7 +1204,7 @@ class PROTOBUF_EXPORT EnumValue final :
typedef void DestructorSkippable_;
::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Option > options_;
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr name_;
::PROTOBUF_NAMESPACE_ID::int32 number_;
int32_t number_;
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
friend struct ::TableStruct_google_2fprotobuf_2ftype_2eproto;
};
@ -1303,8 +1303,8 @@ class PROTOBUF_EXPORT Option final :
size_t ByteSizeLong() const final;
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
uint8_t* _InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
@ -1435,6 +1435,11 @@ inline void Type::set_allocated_name(std::string* name) {
}
name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name,
GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Type.name)
}
@ -1747,18 +1752,18 @@ inline void Field::set_cardinality(::PROTOBUF_NAMESPACE_ID::Field_Cardinality va
inline void Field::clear_number() {
number_ = 0;
}
inline ::PROTOBUF_NAMESPACE_ID::int32 Field::_internal_number() const {
inline int32_t Field::_internal_number() const {
return number_;
}
inline ::PROTOBUF_NAMESPACE_ID::int32 Field::number() const {
inline int32_t Field::number() const {
// @@protoc_insertion_point(field_get:google.protobuf.Field.number)
return _internal_number();
}
inline void Field::_internal_set_number(::PROTOBUF_NAMESPACE_ID::int32 value) {
inline void Field::_internal_set_number(int32_t value) {
number_ = value;
}
inline void Field::set_number(::PROTOBUF_NAMESPACE_ID::int32 value) {
inline void Field::set_number(int32_t value) {
_internal_set_number(value);
// @@protoc_insertion_point(field_set:google.protobuf.Field.number)
}
@ -1806,6 +1811,11 @@ inline void Field::set_allocated_name(std::string* name) {
}
name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name,
GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Field.name)
}
@ -1852,6 +1862,11 @@ inline void Field::set_allocated_type_url(std::string* type_url) {
}
type_url_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), type_url,
GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (type_url_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
type_url_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Field.type_url)
}
@ -1859,18 +1874,18 @@ inline void Field::set_allocated_type_url(std::string* type_url) {
inline void Field::clear_oneof_index() {
oneof_index_ = 0;
}
inline ::PROTOBUF_NAMESPACE_ID::int32 Field::_internal_oneof_index() const {
inline int32_t Field::_internal_oneof_index() const {
return oneof_index_;
}
inline ::PROTOBUF_NAMESPACE_ID::int32 Field::oneof_index() const {
inline int32_t Field::oneof_index() const {
// @@protoc_insertion_point(field_get:google.protobuf.Field.oneof_index)
return _internal_oneof_index();
}
inline void Field::_internal_set_oneof_index(::PROTOBUF_NAMESPACE_ID::int32 value) {
inline void Field::_internal_set_oneof_index(int32_t value) {
oneof_index_ = value;
}
inline void Field::set_oneof_index(::PROTOBUF_NAMESPACE_ID::int32 value) {
inline void Field::set_oneof_index(int32_t value) {
_internal_set_oneof_index(value);
// @@protoc_insertion_point(field_set:google.protobuf.Field.oneof_index)
}
@ -1978,6 +1993,11 @@ inline void Field::set_allocated_json_name(std::string* json_name) {
}
json_name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), json_name,
GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (json_name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
json_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Field.json_name)
}
@ -2024,6 +2044,11 @@ inline void Field::set_allocated_default_value(std::string* default_value) {
}
default_value_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), default_value,
GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (default_value_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
default_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Field.default_value)
}
@ -2074,6 +2099,11 @@ inline void Enum::set_allocated_name(std::string* name) {
}
name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name,
GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Enum.name)
}
@ -2310,6 +2340,11 @@ inline void EnumValue::set_allocated_name(std::string* name) {
}
name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name,
GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.EnumValue.name)
}
@ -2317,18 +2352,18 @@ inline void EnumValue::set_allocated_name(std::string* name) {
inline void EnumValue::clear_number() {
number_ = 0;
}
inline ::PROTOBUF_NAMESPACE_ID::int32 EnumValue::_internal_number() const {
inline int32_t EnumValue::_internal_number() const {
return number_;
}
inline ::PROTOBUF_NAMESPACE_ID::int32 EnumValue::number() const {
inline int32_t EnumValue::number() const {
// @@protoc_insertion_point(field_get:google.protobuf.EnumValue.number)
return _internal_number();
}
inline void EnumValue::_internal_set_number(::PROTOBUF_NAMESPACE_ID::int32 value) {
inline void EnumValue::_internal_set_number(int32_t value) {
number_ = value;
}
inline void EnumValue::set_number(::PROTOBUF_NAMESPACE_ID::int32 value) {
inline void EnumValue::set_number(int32_t value) {
_internal_set_number(value);
// @@protoc_insertion_point(field_set:google.protobuf.EnumValue.number)
}
@ -2420,6 +2455,11 @@ inline void Option::set_allocated_name(std::string* name) {
}
name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name,
GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Option.name)
}

View File

@ -245,7 +245,7 @@ class PROTOBUF_EXPORT FieldMaskUtil::TrimOptions {
// When trimming message fields, the default behavior is to trim required
// fields of the present message if they are not specified in the field mask.
// If you instead want to keep required fields of the present message even
// they are not specified in the field mask, set this flag to true.
// when they are not specified in the field mask, set this flag to true.
void set_keep_required_fields(bool value) { keep_required_fields_ = value; }
bool keep_required_fields() const { return keep_required_fields_; }

View File

@ -130,7 +130,7 @@ static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_google_2fprotobuf_2
static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_google_2fprotobuf_2fwrappers_2eproto = nullptr;
static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_google_2fprotobuf_2fwrappers_2eproto = nullptr;
const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_google_2fprotobuf_2fwrappers_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
const uint32_t TableStruct_google_2fprotobuf_2fwrappers_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
~0u, // no _has_bits_
PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::DoubleValue, _internal_metadata_),
~0u, // no _extensions_
@ -297,7 +297,7 @@ void DoubleValue::SetCachedSize(int size) const {
void DoubleValue::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.DoubleValue)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@ -308,12 +308,12 @@ void DoubleValue::Clear() {
const char* DoubleValue::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
::PROTOBUF_NAMESPACE_ID::uint32 tag;
uint32_t tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
switch (tag >> 3) {
// double value = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 9)) {
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 9)) {
value_ = ::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<double>(ptr);
ptr += sizeof(double);
} else
@ -342,10 +342,10 @@ failure:
#undef CHK_
}
::PROTOBUF_NAMESPACE_ID::uint8* DoubleValue::_InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
uint8_t* DoubleValue::_InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.DoubleValue)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
// double value = 1;
@ -366,7 +366,7 @@ size_t DoubleValue::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:google.protobuf.DoubleValue)
size_t total_size = 0;
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@ -394,7 +394,7 @@ void DoubleValue::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
void DoubleValue::MergeFrom(const DoubleValue& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.DoubleValue)
GOOGLE_DCHECK_NE(&from, this);
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
if (!(from._internal_value() <= 0 && from._internal_value() >= 0)) {
@ -475,7 +475,7 @@ void FloatValue::SetCachedSize(int size) const {
void FloatValue::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.FloatValue)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@ -486,12 +486,12 @@ void FloatValue::Clear() {
const char* FloatValue::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
::PROTOBUF_NAMESPACE_ID::uint32 tag;
uint32_t tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
switch (tag >> 3) {
// float value = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 13)) {
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 13)) {
value_ = ::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<float>(ptr);
ptr += sizeof(float);
} else
@ -520,10 +520,10 @@ failure:
#undef CHK_
}
::PROTOBUF_NAMESPACE_ID::uint8* FloatValue::_InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
uint8_t* FloatValue::_InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.FloatValue)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
// float value = 1;
@ -544,7 +544,7 @@ size_t FloatValue::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:google.protobuf.FloatValue)
size_t total_size = 0;
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@ -572,7 +572,7 @@ void FloatValue::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
void FloatValue::MergeFrom(const FloatValue& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.FloatValue)
GOOGLE_DCHECK_NE(&from, this);
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
if (!(from._internal_value() <= 0 && from._internal_value() >= 0)) {
@ -653,7 +653,7 @@ void Int64Value::SetCachedSize(int size) const {
void Int64Value::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.Int64Value)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@ -664,12 +664,12 @@ void Int64Value::Clear() {
const char* Int64Value::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
::PROTOBUF_NAMESPACE_ID::uint32 tag;
uint32_t tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
switch (tag >> 3) {
// int64 value = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) {
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) {
value_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
CHK_(ptr);
} else
@ -698,10 +698,10 @@ failure:
#undef CHK_
}
::PROTOBUF_NAMESPACE_ID::uint8* Int64Value::_InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
uint8_t* Int64Value::_InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Int64Value)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
// int64 value = 1;
@ -722,7 +722,7 @@ size_t Int64Value::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:google.protobuf.Int64Value)
size_t total_size = 0;
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@ -750,7 +750,7 @@ void Int64Value::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
void Int64Value::MergeFrom(const Int64Value& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Int64Value)
GOOGLE_DCHECK_NE(&from, this);
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
if (from._internal_value() != 0) {
@ -831,7 +831,7 @@ void UInt64Value::SetCachedSize(int size) const {
void UInt64Value::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.UInt64Value)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@ -842,12 +842,12 @@ void UInt64Value::Clear() {
const char* UInt64Value::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
::PROTOBUF_NAMESPACE_ID::uint32 tag;
uint32_t tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
switch (tag >> 3) {
// uint64 value = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) {
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) {
value_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
CHK_(ptr);
} else
@ -876,10 +876,10 @@ failure:
#undef CHK_
}
::PROTOBUF_NAMESPACE_ID::uint8* UInt64Value::_InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
uint8_t* UInt64Value::_InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.UInt64Value)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
// uint64 value = 1;
@ -900,7 +900,7 @@ size_t UInt64Value::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:google.protobuf.UInt64Value)
size_t total_size = 0;
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@ -928,7 +928,7 @@ void UInt64Value::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
void UInt64Value::MergeFrom(const UInt64Value& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.UInt64Value)
GOOGLE_DCHECK_NE(&from, this);
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
if (from._internal_value() != 0) {
@ -1009,7 +1009,7 @@ void Int32Value::SetCachedSize(int size) const {
void Int32Value::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.Int32Value)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@ -1020,12 +1020,12 @@ void Int32Value::Clear() {
const char* Int32Value::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
::PROTOBUF_NAMESPACE_ID::uint32 tag;
uint32_t tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
switch (tag >> 3) {
// int32 value = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) {
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) {
value_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
CHK_(ptr);
} else
@ -1054,10 +1054,10 @@ failure:
#undef CHK_
}
::PROTOBUF_NAMESPACE_ID::uint8* Int32Value::_InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
uint8_t* Int32Value::_InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Int32Value)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
// int32 value = 1;
@ -1078,7 +1078,7 @@ size_t Int32Value::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:google.protobuf.Int32Value)
size_t total_size = 0;
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@ -1106,7 +1106,7 @@ void Int32Value::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
void Int32Value::MergeFrom(const Int32Value& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Int32Value)
GOOGLE_DCHECK_NE(&from, this);
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
if (from._internal_value() != 0) {
@ -1187,7 +1187,7 @@ void UInt32Value::SetCachedSize(int size) const {
void UInt32Value::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.UInt32Value)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@ -1198,12 +1198,12 @@ void UInt32Value::Clear() {
const char* UInt32Value::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
::PROTOBUF_NAMESPACE_ID::uint32 tag;
uint32_t tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
switch (tag >> 3) {
// uint32 value = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) {
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) {
value_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
CHK_(ptr);
} else
@ -1232,10 +1232,10 @@ failure:
#undef CHK_
}
::PROTOBUF_NAMESPACE_ID::uint8* UInt32Value::_InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
uint8_t* UInt32Value::_InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.UInt32Value)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
// uint32 value = 1;
@ -1256,7 +1256,7 @@ size_t UInt32Value::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:google.protobuf.UInt32Value)
size_t total_size = 0;
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@ -1284,7 +1284,7 @@ void UInt32Value::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
void UInt32Value::MergeFrom(const UInt32Value& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.UInt32Value)
GOOGLE_DCHECK_NE(&from, this);
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
if (from._internal_value() != 0) {
@ -1365,7 +1365,7 @@ void BoolValue::SetCachedSize(int size) const {
void BoolValue::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.BoolValue)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@ -1376,12 +1376,12 @@ void BoolValue::Clear() {
const char* BoolValue::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
::PROTOBUF_NAMESPACE_ID::uint32 tag;
uint32_t tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
switch (tag >> 3) {
// bool value = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) {
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) {
value_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
CHK_(ptr);
} else
@ -1410,10 +1410,10 @@ failure:
#undef CHK_
}
::PROTOBUF_NAMESPACE_ID::uint8* BoolValue::_InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
uint8_t* BoolValue::_InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.BoolValue)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
// bool value = 1;
@ -1434,7 +1434,7 @@ size_t BoolValue::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:google.protobuf.BoolValue)
size_t total_size = 0;
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@ -1462,7 +1462,7 @@ void BoolValue::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
void BoolValue::MergeFrom(const BoolValue& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.BoolValue)
GOOGLE_DCHECK_NE(&from, this);
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
if (from._internal_value() != 0) {
@ -1513,6 +1513,9 @@ StringValue::StringValue(const StringValue& from)
: ::PROTOBUF_NAMESPACE_ID::Message() {
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (!from._internal_value().empty()) {
value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_value(),
GetArenaForAllocation());
@ -1522,6 +1525,9 @@ StringValue::StringValue(const StringValue& from)
inline void StringValue::SharedCtor() {
value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
}
StringValue::~StringValue() {
@ -1548,7 +1554,7 @@ void StringValue::SetCachedSize(int size) const {
void StringValue::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.StringValue)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@ -1559,12 +1565,12 @@ void StringValue::Clear() {
const char* StringValue::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
::PROTOBUF_NAMESPACE_ID::uint32 tag;
uint32_t tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
switch (tag >> 3) {
// string value = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
auto str = _internal_mutable_value();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.StringValue.value"));
@ -1595,10 +1601,10 @@ failure:
#undef CHK_
}
::PROTOBUF_NAMESPACE_ID::uint8* StringValue::_InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
uint8_t* StringValue::_InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.StringValue)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
// string value = 1;
@ -1623,7 +1629,7 @@ size_t StringValue::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:google.protobuf.StringValue)
size_t total_size = 0;
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@ -1653,7 +1659,7 @@ void StringValue::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
void StringValue::MergeFrom(const StringValue& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.StringValue)
GOOGLE_DCHECK_NE(&from, this);
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
if (!from._internal_value().empty()) {
@ -1710,6 +1716,9 @@ BytesValue::BytesValue(const BytesValue& from)
: ::PROTOBUF_NAMESPACE_ID::Message() {
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (!from._internal_value().empty()) {
value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_value(),
GetArenaForAllocation());
@ -1719,6 +1728,9 @@ BytesValue::BytesValue(const BytesValue& from)
inline void BytesValue::SharedCtor() {
value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
}
BytesValue::~BytesValue() {
@ -1745,7 +1757,7 @@ void BytesValue::SetCachedSize(int size) const {
void BytesValue::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.BytesValue)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@ -1756,12 +1768,12 @@ void BytesValue::Clear() {
const char* BytesValue::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
::PROTOBUF_NAMESPACE_ID::uint32 tag;
uint32_t tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
switch (tag >> 3) {
// bytes value = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
auto str = _internal_mutable_value();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
CHK_(ptr);
@ -1791,10 +1803,10 @@ failure:
#undef CHK_
}
::PROTOBUF_NAMESPACE_ID::uint8* BytesValue::_InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
uint8_t* BytesValue::_InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:google.protobuf.BytesValue)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
// bytes value = 1;
@ -1815,7 +1827,7 @@ size_t BytesValue::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:google.protobuf.BytesValue)
size_t total_size = 0;
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
@ -1845,7 +1857,7 @@ void BytesValue::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
void BytesValue::MergeFrom(const BytesValue& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.BytesValue)
GOOGLE_DCHECK_NE(&from, this);
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
if (!from._internal_value().empty()) {

Some files were not shown because too many files have changed in this diff Show More