Sync from Piper @acozzette/proto_github_202203101748

PROTOBUF_SYNC_PIPER
pull/9652/head
Adam Cozzette 3 years ago
parent b0f9799a7c
commit b20209f321
  1. 45
      CHANGES.txt
  2. 5
      Makefile.am
  3. 2
      Protobuf-C++.podspec
  4. 2
      Protobuf.podspec
  5. 341
      cmake/CMakeLists.txt
  6. 56
      cmake/conformance.cmake
  7. 2
      cmake/examples.cmake
  8. 256
      cmake/extract_includes.bat.in
  9. 26
      cmake/install.cmake
  10. 180
      cmake/libprotobuf-lite.cmake
  11. 210
      cmake/libprotobuf.cmake
  12. 252
      cmake/libprotoc.cmake
  13. 2
      cmake/protoc.cmake
  14. 210
      cmake/tests.cmake
  15. 2
      configure.ac
  16. 2
      csharp/Google.Protobuf.Tools.nuspec
  17. 19
      csharp/src/Google.Protobuf.Test/CodedInputStreamTest.cs
  18. 4
      csharp/src/Google.Protobuf/Google.Protobuf.csproj
  19. 2
      csharp/src/Google.Protobuf/WireFormat.cs
  20. 2
      docs/third_party.md
  21. 19
      editors/protobuf-mode.el
  22. 6
      java/README.md
  23. 2
      java/bom/pom.xml
  24. 2
      java/core/pom.xml
  25. 54
      java/core/src/main/java/com/google/protobuf/CodedOutputStream.java
  26. 2
      java/core/src/test/java/com/google/protobuf/LazyStringEndToEndTest.java
  27. 4
      java/core/src/test/java/com/google/protobuf/MessageTest.java
  28. 3
      java/core/src/test/java/com/google/protobuf/ServiceTest.java
  29. 1
      java/core/src/test/java/com/google/protobuf/TestBadIdentifiers.java
  30. 2
      java/kotlin-lite/pom.xml
  31. 2
      java/kotlin/pom.xml
  32. 21
      java/lite.md
  33. 2
      java/lite/pom.xml
  34. 2
      java/pom.xml
  35. 1
      java/util/BUILD
  36. 2
      java/util/pom.xml
  37. 2
      js/package.json
  38. 5
      objectivec/GPBApi.pbobjc.h
  39. 2
      objectivec/GPBApi.pbobjc.m
  40. 4
      objectivec/GPBType.pbobjc.h
  41. 2
      objectivec/GPBType.pbobjc.m
  42. 17
      objectivec/README.md
  43. 8
      php/ext/google/protobuf/arena.c
  44. 6
      php/ext/google/protobuf/arena.h
  45. 86
      php/ext/google/protobuf/array.c
  46. 20
      php/ext/google/protobuf/array.h
  47. 2
      php/ext/google/protobuf/config.m4
  48. 141
      php/ext/google/protobuf/convert.c
  49. 16
      php/ext/google/protobuf/convert.h
  50. 243
      php/ext/google/protobuf/def.c
  51. 28
      php/ext/google/protobuf/def.h
  52. 114
      php/ext/google/protobuf/map.c
  53. 20
      php/ext/google/protobuf/map.h
  54. 383
      php/ext/google/protobuf/message.c
  55. 14
      php/ext/google/protobuf/message.h
  56. 25
      php/ext/google/protobuf/names.c
  57. 2
      php/ext/google/protobuf/names.h
  58. 32
      php/ext/google/protobuf/package.xml
  59. 8308
      php/ext/google/protobuf/php-upb.c
  60. 4179
      php/ext/google/protobuf/php-upb.h
  61. 41
      php/ext/google/protobuf/protobuf.c
  62. 28
      php/ext/google/protobuf/protobuf.h
  63. 9
      php/ext/google/protobuf/tests/unnecessary_zval.phpt
  64. 653
      php/ext/google/protobuf/wkt.inc
  65. 10
      php/tests/EncodeDecodeTest.php
  66. 14
      php/tests/compile_extension.sh
  67. 2
      protobuf_version.bzl
  68. 2
      protoc-artifacts/pom.xml
  69. 2
      python/google/protobuf/__init__.py
  70. 5
      python/google/protobuf/descriptor.py
  71. 7
      python/google/protobuf/internal/api_implementation.py
  72. 7
      python/google/protobuf/internal/message_test.py
  73. 10
      python/google/protobuf/internal/text_format_test.py
  74. 7
      python/google/protobuf/pyext/cpp_message.py
  75. 25
      python/google/protobuf/text_format.py
  76. 2
      python/setup.py
  77. 4
      ruby/Rakefile
  78. 1
      ruby/ext/google/protobuf_c/defs.c
  79. 2
      ruby/ext/google/protobuf_c/extconf.rb
  80. 6
      ruby/ext/google/protobuf_c/message.c
  81. 13
      ruby/ext/google/protobuf_c/protobuf.c
  82. 2
      ruby/google-protobuf.gemspec
  83. 4
      ruby/pom.xml
  84. 10
      ruby/src/main/java/com/google/protobuf/jruby/RubyMessage.java
  85. 8
      ruby/tests/basic.rb
  86. 3
      ruby/tests/common_tests.rb
  87. 1
      ruby/tests/gc_test.rb
  88. 2
      src/Makefile.am
  89. 4
      src/google/protobuf/any.h
  90. 87
      src/google/protobuf/any.pb.cc
  91. 69
      src/google/protobuf/any.pb.h
  92. 438
      src/google/protobuf/api.pb.cc
  93. 291
      src/google/protobuf/api.pb.h
  94. 4
      src/google/protobuf/arenaz_sampler.cc
  95. 16
      src/google/protobuf/compiler/command_line_interface.cc
  96. 56
      src/google/protobuf/compiler/cpp/cpp_enum_field.cc
  97. 13
      src/google/protobuf/compiler/cpp/cpp_enum_field.h
  98. 2
      src/google/protobuf/compiler/cpp/cpp_extension.cc
  99. 19
      src/google/protobuf/compiler/cpp/cpp_field.cc
  100. 30
      src/google/protobuf/compiler/cpp/cpp_field.h
  101. Some files were not shown because too many files have changed in this diff Show More

@ -1,6 +1,11 @@
Unreleased Changes (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)
2022-03-04 version 3.20.0 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)
Ruby
* Dropped Ruby 2.3 and 2.4 support for CI and releases. (#9311)
* Message.decode/encode: Add max_recursion_depth option (#9218)
* Rename max_recursion_depth to recursion_limit (#9486)
* Fix conversion of singleton classes in Ruby (#9342)
* Suppress warning for intentional circular require (#9556)
* JSON will now output shorter strings for double and float fields when possible
without losing precision.
* Encoding and decoding of binary format will now work properly on big-endian
@ -10,6 +15,8 @@ Unreleased Changes (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)
putting such values in unknown fields.
Java
* Revert "Standardize on Array copyOf" (#9400)
* Resolve more java field accessor name conflicts (#8198)
* Don't support map fields in DynamicMessage.Builder.{getFieldBuilder,getRepeatedFieldBuilder}
* Fix parseFrom to only throw InvalidProtocolBufferException
* InvalidProtocolBufferException now allows arbitrary wrapped Exception types.
@ -17,30 +24,33 @@ Unreleased Changes (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)
* Flush CodedOutputStream also flushes underlying OutputStream
* When oneof case is the same and the field type is Message, merge the
subfield. (previously it was replaced.)’
* add @CheckReturnValue to some protobuf types
* Add @CheckReturnValue to some protobuf types
* Report original exceptions when parsing JSON
* Add more info to @deprecated javadoc for set/get/has methods
* Fix initialization bug in doc comment line numbers
* Fix comments for message set wire format.
Kotlin
* Add test scope to kotlin-test for protobuf-kotlin-lite (#9518)
* Add orNull extensions for optional message fields.
* Add orNull extensions to all proto3 message fields.
Python
* Dropped support for Python < 3.7 (#9480)
* Protoc is now able to generate python stubs (.pyi) with --pyi_out
* Pin multibuild scripts to get manylinux1 wheels back (#9216)
* Fix type annotations of some Duration and Timestamp methods.
* Repeated field containers are now generic in field types and could be used
in type annotations.
* Protobuf python generated codes are simplified. Descriptors and message
classes' definitions are now dynamic created in internal/builder.py.
Insertion Points for messages classes are discarded.
* protoc is now able to generate python stub (.pyi) by --gen_pyi
* has_presence is added for FieldDescriptor in python
* Loosen indexing type requirements to allow valid __index__() implementations
rather than only PyLongObjects.
* Fix the deepcopy bug caused by not copying message_listener.
* Added python JSON parse recursion limit (default 100)
* path info is added for python JSON parse errors
* Path info is added for python JSON parse errors
* Pure python repeated scalar fields will not able to pickle. Convert to list
first.
* Timestamp.ToDatetime() now accepts an optional tzinfo parameter. If
@ -51,6 +61,7 @@ Unreleased Changes (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)
* Add "ensure_ascii" parameter to json_format.MessageToJson. This allows smaller
JSON serializations with UTF-8 or other non-ASCII encodings.
* Added experimental support for directly assigning numpy scalars and array.
* Improve the calculation of public_dependencies in DescriptorPool.
Compiler
* Migrate IsDefault(const std::string*) and UnsafeSetDefault(const std::string*)
@ -81,18 +92,38 @@ Unreleased Changes (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)
* Implement on demand register ArenaDtor for InlinedStringField
C++
* manually *struct Cord fields to work better with arenas.
* manually destruct map fields.
* Enable testing via CTest (#8737)
* Add option to use external GTest in CMake (#8736)
* CMake: Set correct sonames for libprotobuf-lite.so and libprotoc.so (#8635) (#9529)
* Add cmake option `protobuf_INSTALL` to not install files (#7123)
* CMake: Allow custom plugin options e.g. to generate mocks (#9105)
* CMake: Use linker version scripts (#9545)
* Manually *struct Cord fields to work better with arenas.
* Manually destruct map fields.
* Generate narrower code
* Fix https://github.com/protocolbuffers/protobuf/issues/9378 by removing
shadowed _cached_size_ field
* Remove GetPointer() and explicit nullptr defaults.
* add proto_h flag for speeding up large builds
* Add proto_h flag for speeding up large builds
* Add missing overload for reference wrapped fields.
* Add MergedDescriptorDatabase::FindAllFileNames()
* RepeatedField now defines an iterator type instead of using a pointer.
* Remove obsolete macros GOOGLE_PROTOBUF_HAS_ONEOF and GOOGLE_PROTOBUF_HAS_ARENAS.
PHP
* Fix: add missing reserved classnames (#9458)
* PHP 8.1 compatibility (#9370)
C#
* Fix trim warnings (#9182)
* Fixes NullReferenceException when accessing FieldDescriptor.IsPacked (#9430)
* Add ToProto() method to all descriptor classes (#9426)
* Add an option to preserve proto names in JsonFormatter (#6307)
Objective-C
* Add prefix_to_proto_package_mappings_path option. (#9498)
* Rename `proto_package_to_prefix_mappings_path` to `package_to_prefix_mappings_path`. (#9552)
* Add a generation option to control use of forward declarations in headers. (#9568)
2022-01-28 version 3.19.4 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)

@ -840,6 +840,7 @@ php_EXTRA_DIST= \
php/ext/google/protobuf/protobuf.c \
php/ext/google/protobuf/protobuf.h \
php/ext/google/protobuf/wkt.inc \
php/ext/google/protobuf/tests/unnecessary_zval.phpt \
php/generate_descriptor_protos.sh \
php/generate_test_protos.sh \
php/release.sh \
@ -1037,7 +1038,10 @@ python_EXTRA_DIST= \
python/google/protobuf/internal/factory_test2.proto \
python/google/protobuf/internal/file_options_test.proto \
python/google/protobuf/internal/generator_test.py \
python/google/protobuf/internal/import_test.py \
python/google/protobuf/internal/import_test_package/__init__.py \
python/google/protobuf/internal/import_test_package/import_public.proto \
python/google/protobuf/internal/import_test_package/import_public_nested.proto \
python/google/protobuf/internal/import_test_package/inner.proto \
python/google/protobuf/internal/import_test_package/outer.proto \
python/google/protobuf/internal/json_format_test.py \
@ -1393,6 +1397,7 @@ EXTRA_DIST = $(@DIST_LANG@_EXTRA_DIST) \
update_file_lists.sh \
BUILD \
WORKSPACE \
CMakeLists.txt \
cmake/CMakeLists.txt \
cmake/README.md \
cmake/conformance.cmake \

@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'Protobuf-C++'
s.version = '3.19.4'
s.version = '3.20.0-rc1'
s.summary = 'Protocol Buffers v3 runtime library for C++.'
s.homepage = 'https://github.com/google/protobuf'
s.license = 'BSD-3-Clause'

@ -5,7 +5,7 @@
# dependent projects use the :git notation to refer to the library.
Pod::Spec.new do |s|
s.name = 'Protobuf'
s.version = '3.19.4'
s.version = '3.20.0-rc1'
s.summary = 'Protocol Buffers v.3 runtime library for Objective-C.'
s.homepage = 'https://github.com/protocolbuffers/protobuf'
s.license = 'BSD-3-Clause'

@ -1,342 +1,9 @@
# Minimum CMake required
cmake_minimum_required(VERSION 3.10)
cmake_minimum_required(VERSION 3.5)
if(protobuf_VERBOSE)
message(STATUS "Protocol Buffers Configuring...")
endif()
message(WARNING "Calling of cmake with source directory set to \"cmake\" subdirectory of Protocol Buffers project is deprecated. Top-level directory of Protocol Buffers project should be used instead.")
# CMake policies
cmake_policy(SET CMP0022 NEW)
# On MacOS use @rpath/ for target's install name prefix path
if (POLICY CMP0042)
cmake_policy(SET CMP0042 NEW)
endif ()
# Clear VERSION variables when no VERSION is given to project()
if(POLICY CMP0048)
cmake_policy(SET CMP0048 NEW)
endif()
# MSVC runtime library flags are selected by an abstraction.
if(POLICY CMP0091)
cmake_policy(SET CMP0091 NEW)
endif()
# Project
project(protobuf C CXX)
# Add c++11 flags
if (CYGWIN)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")
else()
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
endif()
# The Intel compiler isn't able to deal with noinline member functions of
# template classes defined in headers. As such it spams the output with
# warning #2196: routine is both "inline" and "noinline"
# This silences that warning.
if (CMAKE_CXX_COMPILER_ID MATCHES Intel)
string(APPEND CMAKE_CXX_FLAGS " -diag-disable=2196")
endif()
# Options
option(protobuf_INSTALL "Install protobuf binaries and files" ON)
if(WITH_PROTOC)
set(protobuf_PROTOC_EXE ${WITH_PROTOC} CACHE FILEPATH "Protocol Buffer Compiler executable" FORCE)
endif()
option(protobuf_BUILD_TESTS "Build tests" ON)
option(protobuf_BUILD_CONFORMANCE "Build conformance tests" OFF)
option(protobuf_BUILD_EXAMPLES "Build examples" OFF)
option(protobuf_BUILD_PROTOC_BINARIES "Build libprotoc and protoc compiler" ON)
option(protobuf_BUILD_LIBPROTOC "Build libprotoc" OFF)
option(protobuf_DISABLE_RTTI "Remove runtime type information in the binaries" OFF)
if (BUILD_SHARED_LIBS)
set(protobuf_BUILD_SHARED_LIBS_DEFAULT ON)
else (BUILD_SHARED_LIBS)
set(protobuf_BUILD_SHARED_LIBS_DEFAULT OFF)
endif (BUILD_SHARED_LIBS)
option(protobuf_BUILD_SHARED_LIBS "Build Shared Libraries" ${protobuf_BUILD_SHARED_LIBS_DEFAULT})
include(CMakeDependentOption)
cmake_dependent_option(protobuf_MSVC_STATIC_RUNTIME "Link static runtime libraries" ON
"NOT protobuf_BUILD_SHARED_LIBS" OFF)
set(protobuf_WITH_ZLIB_DEFAULT ON)
option(protobuf_WITH_ZLIB "Build with zlib support" ${protobuf_WITH_ZLIB_DEFAULT})
set(protobuf_DEBUG_POSTFIX "d"
CACHE STRING "Default debug postfix")
mark_as_advanced(protobuf_DEBUG_POSTFIX)
# User options
include(protobuf-options.cmake)
# Overrides for option dependencies
if (protobuf_BUILD_PROTOC_BINARIES OR protobuf_BUILD_TESTS)
set(protobuf_BUILD_LIBPROTOC ON)
endif ()
# Path to main configure script
set(protobuf_CONFIGURE_SCRIPT "../configure.ac")
# Parse configure script
set(protobuf_AC_INIT_REGEX
"^AC_INIT\\(\\[([^]]+)\\],\\[([^]]+)\\],\\[([^]]+)\\],\\[([^]]+)\\]\\)$")
file(STRINGS "${protobuf_CONFIGURE_SCRIPT}" protobuf_AC_INIT_LINE
LIMIT_COUNT 1 REGEX "^AC_INIT")
# Description
string(REGEX REPLACE "${protobuf_AC_INIT_REGEX}" "\\1"
protobuf_DESCRIPTION "${protobuf_AC_INIT_LINE}")
# Version
string(REGEX REPLACE "${protobuf_AC_INIT_REGEX}" "\\2"
protobuf_VERSION_STRING "${protobuf_AC_INIT_LINE}")
# Contact
string(REGEX REPLACE "${protobuf_AC_INIT_REGEX}" "\\3"
protobuf_CONTACT "${protobuf_AC_INIT_LINE}")
# Parse version tweaks
set(protobuf_VERSION_REGEX "^([0-9]+)\\.([0-9]+)\\.([0-9]+)([-]rc[-]|\\.)?([0-9]*)$")
string(REGEX REPLACE "${protobuf_VERSION_REGEX}" "\\1"
protobuf_VERSION_MAJOR "${protobuf_VERSION_STRING}")
string(REGEX REPLACE "${protobuf_VERSION_REGEX}" "\\2"
protobuf_VERSION_MINOR "${protobuf_VERSION_STRING}")
string(REGEX REPLACE "${protobuf_VERSION_REGEX}" "\\3"
protobuf_VERSION_PATCH "${protobuf_VERSION_STRING}")
string(REGEX REPLACE "${protobuf_VERSION_REGEX}" "\\5"
protobuf_VERSION_PRERELEASE "${protobuf_VERSION_STRING}")
message(STATUS "${protobuf_VERSION_PRERELEASE}")
# Package version
set(protobuf_VERSION
"${protobuf_VERSION_MAJOR}.${protobuf_VERSION_MINOR}.${protobuf_VERSION_PATCH}")
if(protobuf_VERSION_PRERELEASE)
set(protobuf_VERSION "${protobuf_VERSION}.${protobuf_VERSION_PRERELEASE}")
else()
set(protobuf_VERSION "${protobuf_VERSION}.0")
endif()
message(STATUS "${protobuf_VERSION}")
if(protobuf_VERBOSE)
message(STATUS "Configuration script parsing status [")
message(STATUS " Description : ${protobuf_DESCRIPTION}")
message(STATUS " Version : ${protobuf_VERSION} (${protobuf_VERSION_STRING})")
message(STATUS " Contact : ${protobuf_CONTACT}")
message(STATUS "]")
endif()
add_definitions(-DGOOGLE_PROTOBUF_CMAKE_BUILD)
if (protobuf_DISABLE_RTTI)
add_definitions(-DGOOGLE_PROTOBUF_NO_RTTI=1)
endif()
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/cmaketest.map
"{
global:
main;
local:
*;
};")
# CheckLinkerFlag module available in CMake >=3.18.
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.18)
include(CheckLinkerFlag)
check_linker_flag(CXX -Wl,--version-script=${CMAKE_CURRENT_BINARY_DIR}/cmaketest.map protobuf_HAVE_LD_VERSION_SCRIPT)
else()
include(CheckCXXSourceCompiles)
set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} -Wl,--version-script=${CMAKE_CURRENT_BINARY_DIR}/cmaketest.map)
check_cxx_source_compiles("
int main() {
return 0;
}
" protobuf_HAVE_LD_VERSION_SCRIPT)
set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
endif()
file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/cmaketest.map)
find_package(Threads REQUIRED)
set(_protobuf_FIND_ZLIB)
if (protobuf_WITH_ZLIB)
find_package(ZLIB)
if (ZLIB_FOUND)
set(HAVE_ZLIB 1)
# FindZLIB module define ZLIB_INCLUDE_DIRS variable
# Set ZLIB_INCLUDE_DIRECTORIES for compatible
set(ZLIB_INCLUDE_DIRECTORIES ${ZLIB_INCLUDE_DIRECTORIES} ${ZLIB_INCLUDE_DIRS})
# Using imported target if exists
if (TARGET ZLIB::ZLIB)
set(ZLIB_LIBRARIES ZLIB::ZLIB)
set(_protobuf_FIND_ZLIB "if(NOT ZLIB_FOUND)\n find_package(ZLIB)\nendif()")
endif (TARGET ZLIB::ZLIB)
else (ZLIB_FOUND)
set(HAVE_ZLIB 0)
# Explicitly set these to empty (override NOT_FOUND) so cmake doesn't
# complain when we use them later.
set(ZLIB_INCLUDE_DIRECTORIES)
set(ZLIB_LIBRARIES)
endif (ZLIB_FOUND)
endif (protobuf_WITH_ZLIB)
if (HAVE_ZLIB)
add_definitions(-DHAVE_ZLIB)
endif (HAVE_ZLIB)
# We need to link with libatomic on systems that do not have builtin atomics, or
# don't have builtin support for 8 byte atomics
set(protobuf_LINK_LIBATOMIC false)
if (NOT MSVC)
include(CheckCXXSourceCompiles)
set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} -std=c++11)
check_cxx_source_compiles("
#include <atomic>
int main() {
return std::atomic<int64_t>{};
}
" protobuf_HAVE_BUILTIN_ATOMICS)
if (NOT protobuf_HAVE_BUILTIN_ATOMICS)
set(protobuf_LINK_LIBATOMIC true)
endif (NOT protobuf_HAVE_BUILTIN_ATOMICS)
set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
endif (NOT MSVC)
if (protobuf_BUILD_SHARED_LIBS)
set(protobuf_SHARED_OR_STATIC "SHARED")
else (protobuf_BUILD_SHARED_LIBS)
set(protobuf_SHARED_OR_STATIC "STATIC")
# The CMAKE_<LANG>_FLAGS(_<BUILD_TYPE>)? is meant to be user controlled.
# Prior to CMake 3.15, the MSVC runtime library was pushed into the same flags
# making programmatic control difficult. Prefer the functionality in newer
# CMake versions when available.
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.15)
if (protobuf_MSVC_STATIC_RUNTIME)
set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreaded$<$<CONFIG:Debug>:Debug>)
else()
set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreaded$<$<CONFIG:Debug>:Debug>DLL)
endif()
else()
# In case we are building static libraries, link also the runtime library statically
# so that MSVCR*.DLL is not required at runtime.
# https://msdn.microsoft.com/en-us/library/2kzt1wy3.aspx
# This is achieved by replacing msvc option /MD with /MT and /MDd with /MTd
# http://www.cmake.org/Wiki/CMake_FAQ#How_can_I_build_my_MSVC_application_with_a_static_runtime.3F
if (MSVC AND protobuf_MSVC_STATIC_RUNTIME)
foreach(flag_var
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
if(${flag_var} MATCHES "/MD")
string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
endif(${flag_var} MATCHES "/MD")
endforeach(flag_var)
endif (MSVC AND protobuf_MSVC_STATIC_RUNTIME)
endif()
endif (protobuf_BUILD_SHARED_LIBS)
if (MSVC)
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
# Build with multiple processes
add_definitions(/MP)
endif()
# Set source file and execution character sets to UTF-8
add_definitions(/utf-8)
# MSVC warning suppressions
add_definitions(
/wd4065 # switch statement contains 'default' but no 'case' labels
/wd4244 # 'conversion' conversion from 'type1' to 'type2', possible loss of data
/wd4251 # 'identifier' : class 'type' needs to have dll-interface to be used by clients of class 'type2'
/wd4267 # 'var' : conversion from 'size_t' to 'type', possible loss of data
/wd4305 # 'identifier' : truncation from 'type1' to 'type2'
/wd4307 # 'operator' : integral constant overflow
/wd4309 # 'conversion' : truncation of constant value
/wd4334 # 'operator' : result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?)
/wd4355 # 'this' : used in base member initializer list
/wd4506 # no definition for inline function 'function'
/wd4800 # 'type' : forcing value to bool 'true' or 'false' (performance warning)
/wd4996 # The compiler encountered a deprecated declaration.
)
# Allow big object
add_definitions(/bigobj)
string(REPLACE "/" "\\" PROTOBUF_SOURCE_WIN32_PATH ${protobuf_SOURCE_DIR})
string(REPLACE "/" "\\" PROTOBUF_BINARY_WIN32_PATH ${protobuf_BINARY_DIR})
string(REPLACE "." "," protobuf_RC_FILEVERSION "${protobuf_VERSION}")
configure_file(extract_includes.bat.in extract_includes.bat)
# Suppress linker warnings about files with no symbols defined.
set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} /ignore:4221")
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
# Configure Resource Compiler
enable_language(RC)
# use English language (0x409) in resource compiler
set(rc_flags "/l0x409")
# fix rc.exe invocations because of usage of add_definitions()
set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> ${rc_flags} <DEFINES> /fo<OBJECT> <SOURCE>")
endif()
configure_file(version.rc.in ${CMAKE_CURRENT_BINARY_DIR}/version.rc @ONLY)
endif (MSVC)
get_filename_component(protobuf_source_dir ${protobuf_SOURCE_DIR} PATH)
include_directories(
${ZLIB_INCLUDE_DIRECTORIES}
${protobuf_BINARY_DIR}
${protobuf_source_dir}/src)
if (MSVC)
# Add the "lib" prefix for generated .lib outputs.
set(LIB_PREFIX lib)
else (MSVC)
# When building with "make", "lib" prefix will be added automatically by
# the build tool.
set(LIB_PREFIX)
endif (MSVC)
if (protobuf_UNICODE)
add_definitions(-DUNICODE -D_UNICODE)
endif (protobuf_UNICODE)
include(libprotobuf-lite.cmake)
include(libprotobuf.cmake)
if (protobuf_BUILD_LIBPROTOC)
include(libprotoc.cmake)
endif (protobuf_BUILD_LIBPROTOC)
if (protobuf_BUILD_PROTOC_BINARIES)
include(protoc.cmake)
if (NOT DEFINED protobuf_PROTOC_EXE)
set(protobuf_PROTOC_EXE protoc)
endif (NOT DEFINED protobuf_PROTOC_EXE)
endif (protobuf_BUILD_PROTOC_BINARIES)
# Ensure we have a protoc executable if we need one
if (protobuf_BUILD_TESTS OR protobuf_BUILD_CONFORMANCE OR protobuf_BUILD_EXAMPLES)
if (NOT DEFINED protobuf_PROTOC_EXE)
find_program(protobuf_PROTOC_EXE protoc)
if (NOT protobuf_PROTOC_EXE)
message(FATAL "Build requires 'protoc' but binary not found and not building protoc.")
endif ()
endif ()
if(protobuf_VERBOSE)
message(STATUS "Using protoc : ${protobuf_PROTOC_EXE}")
endif(protobuf_VERBOSE)
endif ()
if (protobuf_BUILD_TESTS)
enable_testing()
include(tests.cmake)
endif (protobuf_BUILD_TESTS)
if (protobuf_BUILD_CONFORMANCE)
include(conformance.cmake)
endif (protobuf_BUILD_CONFORMANCE)
if (protobuf_INSTALL)
include(install.cmake)
endif (protobuf_INSTALL)
if (protobuf_BUILD_EXAMPLES)
include(examples.cmake)
endif (protobuf_BUILD_EXAMPLES)
set(protobuf_DEPRECATED_CMAKE_SUBDIRECTORY_USAGE TRUE)
if(protobuf_VERBOSE)
message(STATUS "Protocol Buffers Configuring done")
endif(protobuf_VERBOSE)
include(../CMakeLists.txt)

@ -1,49 +1,49 @@
add_custom_command(
OUTPUT ${protobuf_source_dir}/conformance/conformance.pb.cc
DEPENDS ${protobuf_PROTOC_EXE} ${protobuf_source_dir}/conformance/conformance.proto
COMMAND ${protobuf_PROTOC_EXE} ${protobuf_source_dir}/conformance/conformance.proto
--proto_path=${protobuf_source_dir}/conformance
--cpp_out=${protobuf_source_dir}/conformance
OUTPUT ${protobuf_SOURCE_DIR}/conformance/conformance.pb.cc
DEPENDS ${protobuf_PROTOC_EXE} ${protobuf_SOURCE_DIR}/conformance/conformance.proto
COMMAND ${protobuf_PROTOC_EXE} ${protobuf_SOURCE_DIR}/conformance/conformance.proto
--proto_path=${protobuf_SOURCE_DIR}/conformance
--cpp_out=${protobuf_SOURCE_DIR}/conformance
)
add_custom_command(
OUTPUT ${protobuf_source_dir}/src/google/protobuf/test_messages_proto3.pb.cc
${protobuf_source_dir}/src/google/protobuf/test_messages_proto2.pb.cc
DEPENDS ${protobuf_PROTOC_EXE} ${protobuf_source_dir}/src/google/protobuf/test_messages_proto3.proto
${protobuf_PROTOC_EXE} ${protobuf_source_dir}/src/google/protobuf/test_messages_proto2.proto
COMMAND ${protobuf_PROTOC_EXE} ${protobuf_source_dir}/src/google/protobuf/test_messages_proto3.proto
${protobuf_source_dir}/src/google/protobuf/test_messages_proto2.proto
--proto_path=${protobuf_source_dir}/src
--cpp_out=${protobuf_source_dir}/src
OUTPUT ${protobuf_SOURCE_DIR}/src/google/protobuf/test_messages_proto3.pb.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/test_messages_proto2.pb.cc
DEPENDS ${protobuf_PROTOC_EXE} ${protobuf_SOURCE_DIR}/src/google/protobuf/test_messages_proto3.proto
${protobuf_PROTOC_EXE} ${protobuf_SOURCE_DIR}/src/google/protobuf/test_messages_proto2.proto
COMMAND ${protobuf_PROTOC_EXE} ${protobuf_SOURCE_DIR}/src/google/protobuf/test_messages_proto3.proto
${protobuf_SOURCE_DIR}/src/google/protobuf/test_messages_proto2.proto
--proto_path=${protobuf_SOURCE_DIR}/src
--cpp_out=${protobuf_SOURCE_DIR}/src
)
add_executable(conformance_test_runner
${protobuf_source_dir}/conformance/binary_json_conformance_suite.cc
${protobuf_source_dir}/conformance/binary_json_conformance_suite.h
${protobuf_source_dir}/conformance/conformance.pb.cc
${protobuf_source_dir}/conformance/conformance_test.cc
${protobuf_source_dir}/conformance/conformance_test_runner.cc
${protobuf_source_dir}/conformance/third_party/jsoncpp/json.h
${protobuf_source_dir}/conformance/third_party/jsoncpp/jsoncpp.cpp
${protobuf_source_dir}/src/google/protobuf/test_messages_proto2.pb.cc
${protobuf_source_dir}/src/google/protobuf/test_messages_proto3.pb.cc
${protobuf_SOURCE_DIR}/conformance/binary_json_conformance_suite.cc
${protobuf_SOURCE_DIR}/conformance/binary_json_conformance_suite.h
${protobuf_SOURCE_DIR}/conformance/conformance.pb.cc
${protobuf_SOURCE_DIR}/conformance/conformance_test.cc
${protobuf_SOURCE_DIR}/conformance/conformance_test_runner.cc
${protobuf_SOURCE_DIR}/conformance/third_party/jsoncpp/json.h
${protobuf_SOURCE_DIR}/conformance/third_party/jsoncpp/jsoncpp.cpp
${protobuf_SOURCE_DIR}/src/google/protobuf/test_messages_proto2.pb.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/test_messages_proto3.pb.cc
)
add_executable(conformance_cpp
${protobuf_source_dir}/conformance/conformance.pb.cc
${protobuf_source_dir}/conformance/conformance_cpp.cc
${protobuf_source_dir}/src/google/protobuf/test_messages_proto2.pb.cc
${protobuf_source_dir}/src/google/protobuf/test_messages_proto3.pb.cc
${protobuf_SOURCE_DIR}/conformance/conformance.pb.cc
${protobuf_SOURCE_DIR}/conformance/conformance_cpp.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/test_messages_proto2.pb.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/test_messages_proto3.pb.cc
)
target_include_directories(
conformance_test_runner
PUBLIC ${protobuf_source_dir}/conformance)
PUBLIC ${protobuf_SOURCE_DIR}/conformance)
target_include_directories(
conformance_cpp
PUBLIC ${protobuf_source_dir}/conformance)
PUBLIC ${protobuf_SOURCE_DIR}/conformance)
target_link_libraries(conformance_test_runner libprotobuf)
target_link_libraries(conformance_cpp libprotobuf)

@ -2,7 +2,7 @@ if(protobuf_VERBOSE)
message(STATUS "Protocol Buffers Examples Configuring...")
endif()
get_filename_component(examples_dir "../examples" ABSOLUTE)
get_filename_component(examples_dir "${protobuf_SOURCE_DIR}/examples" ABSOLUTE)
if(protobuf_VERBOSE)
message(STATUS "Protocol Buffers Examples Configuring done")

@ -13,131 +13,131 @@ mkdir include\google\protobuf\compiler\ruby
mkdir include\google\protobuf\io
mkdir include\google\protobuf\stubs
mkdir include\google\protobuf\util
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\any.h" include\google\protobuf\any.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\any.pb.h" include\google\protobuf\any.pb.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\api.pb.h" include\google\protobuf\api.pb.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\arena.h" include\google\protobuf\arena.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\arena_impl.h" include\google\protobuf\arena_impl.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\arenastring.h" include\google\protobuf\arenastring.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\arenaz_sampler.h" include\google\protobuf\arenaz_sampler.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\code_generator.h" include\google\protobuf\compiler\code_generator.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\command_line_interface.h" include\google\protobuf\compiler\command_line_interface.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\cpp\cpp_file.h" include\google\protobuf\compiler\cpp\cpp_file.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\cpp\cpp_generator.h" include\google\protobuf\compiler\cpp\cpp_generator.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\cpp\cpp_helpers.h" include\google\protobuf\compiler\cpp\cpp_helpers.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\cpp\cpp_names.h" include\google\protobuf\compiler\cpp\cpp_names.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\csharp\csharp_doc_comment.h" include\google\protobuf\compiler\csharp\csharp_doc_comment.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\csharp\csharp_generator.h" include\google\protobuf\compiler\csharp\csharp_generator.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\csharp\csharp_names.h" include\google\protobuf\compiler\csharp\csharp_names.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\csharp\csharp_options.h" include\google\protobuf\compiler\csharp\csharp_options.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\importer.h" include\google\protobuf\compiler\importer.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\java\java_generator.h" include\google\protobuf\compiler\java\java_generator.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\java\java_kotlin_generator.h" include\google\protobuf\compiler\java\java_kotlin_generator.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\java\java_names.h" include\google\protobuf\compiler\java\java_names.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\js\js_generator.h" include\google\protobuf\compiler\js\js_generator.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\objectivec\objectivec_generator.h" include\google\protobuf\compiler\objectivec\objectivec_generator.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\objectivec\objectivec_helpers.h" include\google\protobuf\compiler\objectivec\objectivec_helpers.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\parser.h" include\google\protobuf\compiler\parser.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\php\php_generator.h" include\google\protobuf\compiler\php\php_generator.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\plugin.h" include\google\protobuf\compiler\plugin.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\plugin.pb.h" include\google\protobuf\compiler\plugin.pb.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\python\python_generator.h" include\google\protobuf\compiler\python\python_generator.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\python\python_pyi_generator.h" include\google\protobuf\compiler\python\python_pyi_generator.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\python\python_helpers.h" include\google\protobuf\compiler\python\python_helpers.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\ruby\ruby_generator.h" include\google\protobuf\compiler\ruby\ruby_generator.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\descriptor.h" include\google\protobuf\descriptor.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\descriptor.pb.h" include\google\protobuf\descriptor.pb.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\descriptor_database.h" include\google\protobuf\descriptor_database.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\duration.pb.h" include\google\protobuf\duration.pb.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\dynamic_message.h" include\google\protobuf\dynamic_message.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\empty.pb.h" include\google\protobuf\empty.pb.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\explicitly_constructed.h" include\google\protobuf\explicitly_constructed.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\extension_set.h" include\google\protobuf\extension_set.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\extension_set_inl.h" include\google\protobuf\extension_set_inl.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\field_access_listener.h" include\google\protobuf\field_access_listener.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\field_mask.pb.h" include\google\protobuf\field_mask.pb.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_enum_reflection.h" include\google\protobuf\generated_enum_reflection.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_enum_util.h" include\google\protobuf\generated_enum_util.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_message_bases.h" include\google\protobuf\generated_message_bases.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_message_reflection.h" include\google\protobuf\generated_message_reflection.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_message_tctable_decl.h" include\google\protobuf\generated_message_tctable_decl.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_message_tctable_impl.h" include\google\protobuf\generated_message_tctable_impl.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_message_util.h" include\google\protobuf\generated_message_util.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\has_bits.h" include\google\protobuf\has_bits.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\implicit_weak_message.h" include\google\protobuf\implicit_weak_message.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\inlined_string_field.h" include\google\protobuf\inlined_string_field.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\io\coded_stream.h" include\google\protobuf\io\coded_stream.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\io\gzip_stream.h" include\google\protobuf\io\gzip_stream.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\io\io_win32.h" include\google\protobuf\io\io_win32.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\io\printer.h" include\google\protobuf\io\printer.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\io\strtod.h" include\google\protobuf\io\strtod.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\io\tokenizer.h" include\google\protobuf\io\tokenizer.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\io\zero_copy_stream.h" include\google\protobuf\io\zero_copy_stream.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\io\zero_copy_stream_impl.h" include\google\protobuf\io\zero_copy_stream_impl.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\io\zero_copy_stream_impl_lite.h" include\google\protobuf\io\zero_copy_stream_impl_lite.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\map.h" include\google\protobuf\map.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\map_entry.h" include\google\protobuf\map_entry.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\map_entry_lite.h" include\google\protobuf\map_entry_lite.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\map_field.h" include\google\protobuf\map_field.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\map_field_inl.h" include\google\protobuf\map_field_inl.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\map_field_lite.h" include\google\protobuf\map_field_lite.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\map_type_handler.h" include\google\protobuf\map_type_handler.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\message.h" include\google\protobuf\message.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\message_lite.h" include\google\protobuf\message_lite.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\metadata.h" include\google\protobuf\metadata.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\metadata_lite.h" include\google\protobuf\metadata_lite.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\parse_context.h" include\google\protobuf\parse_context.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\port.h" include\google\protobuf\port.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\port_def.inc" include\google\protobuf\port_def.inc
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\port_undef.inc" include\google\protobuf\port_undef.inc
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\reflection.h" include\google\protobuf\reflection.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\reflection_ops.h" include\google\protobuf\reflection_ops.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\repeated_field.h" include\google\protobuf\repeated_field.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\repeated_ptr_field.h" include\google\protobuf\repeated_ptr_field.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\service.h" include\google\protobuf\service.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\source_context.pb.h" include\google\protobuf\source_context.pb.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\struct.pb.h" include\google\protobuf\struct.pb.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\bytestream.h" include\google\protobuf\stubs\bytestream.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\callback.h" include\google\protobuf\stubs\callback.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\casts.h" include\google\protobuf\stubs\casts.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\common.h" include\google\protobuf\stubs\common.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\hash.h" include\google\protobuf\stubs\hash.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\logging.h" include\google\protobuf\stubs\logging.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\macros.h" include\google\protobuf\stubs\macros.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\map_util.h" include\google\protobuf\stubs\map_util.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\mutex.h" include\google\protobuf\stubs\mutex.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\once.h" include\google\protobuf\stubs\once.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\platform_macros.h" include\google\protobuf\stubs\platform_macros.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\port.h" include\google\protobuf\stubs\port.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\status.h" include\google\protobuf\stubs\status.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\stl_util.h" include\google\protobuf\stubs\stl_util.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\stringpiece.h" include\google\protobuf\stubs\stringpiece.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\strutil.h" include\google\protobuf\stubs\strutil.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\template_util.h" include\google\protobuf\stubs\template_util.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\text_format.h" include\google\protobuf\text_format.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\timestamp.pb.h" include\google\protobuf\timestamp.pb.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\type.pb.h" include\google\protobuf\type.pb.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\unknown_field_set.h" include\google\protobuf\unknown_field_set.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\util\delimited_message_util.h" include\google\protobuf\util\delimited_message_util.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\util\field_comparator.h" include\google\protobuf\util\field_comparator.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\util\field_mask_util.h" include\google\protobuf\util\field_mask_util.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\util\json_util.h" include\google\protobuf\util\json_util.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\util\message_differencer.h" include\google\protobuf\util\message_differencer.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\util\time_util.h" include\google\protobuf\util\time_util.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\util\type_resolver.h" include\google\protobuf\util\type_resolver.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\util\type_resolver_util.h" include\google\protobuf\util\type_resolver_util.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\wire_format.h" include\google\protobuf\wire_format.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\wire_format_lite.h" include\google\protobuf\wire_format_lite.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\wrappers.pb.h" include\google\protobuf\wrappers.pb.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\any.proto" include\google\protobuf\any.proto
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\api.proto" include\google\protobuf\api.proto
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\plugin.proto" include\google\protobuf\compiler\plugin.proto
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\descriptor.proto" include\google\protobuf\descriptor.proto
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\duration.proto" include\google\protobuf\duration.proto
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\empty.proto" include\google\protobuf\empty.proto
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\field_mask.proto" include\google\protobuf\field_mask.proto
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\source_context.proto" include\google\protobuf\source_context.proto
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\struct.proto" include\google\protobuf\struct.proto
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\timestamp.proto" include\google\protobuf\timestamp.proto
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\type.proto" include\google\protobuf\type.proto
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\wrappers.proto" include\google\protobuf\wrappers.proto
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\any.h" include\google\protobuf\any.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\any.pb.h" include\google\protobuf\any.pb.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\api.pb.h" include\google\protobuf\api.pb.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\arena.h" include\google\protobuf\arena.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\arena_impl.h" include\google\protobuf\arena_impl.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\arenastring.h" include\google\protobuf\arenastring.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\arenaz_sampler.h" include\google\protobuf\arenaz_sampler.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\compiler\code_generator.h" include\google\protobuf\compiler\code_generator.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\compiler\command_line_interface.h" include\google\protobuf\compiler\command_line_interface.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\compiler\cpp\cpp_file.h" include\google\protobuf\compiler\cpp\cpp_file.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\compiler\cpp\cpp_generator.h" include\google\protobuf\compiler\cpp\cpp_generator.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\compiler\cpp\cpp_helpers.h" include\google\protobuf\compiler\cpp\cpp_helpers.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\compiler\cpp\cpp_names.h" include\google\protobuf\compiler\cpp\cpp_names.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\compiler\csharp\csharp_doc_comment.h" include\google\protobuf\compiler\csharp\csharp_doc_comment.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\compiler\csharp\csharp_generator.h" include\google\protobuf\compiler\csharp\csharp_generator.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\compiler\csharp\csharp_names.h" include\google\protobuf\compiler\csharp\csharp_names.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\compiler\csharp\csharp_options.h" include\google\protobuf\compiler\csharp\csharp_options.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\compiler\importer.h" include\google\protobuf\compiler\importer.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\compiler\java\java_generator.h" include\google\protobuf\compiler\java\java_generator.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\compiler\java\java_kotlin_generator.h" include\google\protobuf\compiler\java\java_kotlin_generator.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\compiler\java\java_names.h" include\google\protobuf\compiler\java\java_names.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\compiler\js\js_generator.h" include\google\protobuf\compiler\js\js_generator.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\compiler\objectivec\objectivec_generator.h" include\google\protobuf\compiler\objectivec\objectivec_generator.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\compiler\objectivec\objectivec_helpers.h" include\google\protobuf\compiler\objectivec\objectivec_helpers.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\compiler\parser.h" include\google\protobuf\compiler\parser.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\compiler\php\php_generator.h" include\google\protobuf\compiler\php\php_generator.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\compiler\plugin.h" include\google\protobuf\compiler\plugin.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\compiler\plugin.pb.h" include\google\protobuf\compiler\plugin.pb.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\compiler\python\python_generator.h" include\google\protobuf\compiler\python\python_generator.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\compiler\python\python_pyi_generator.h" include\google\protobuf\compiler\python\python_pyi_generator.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\compiler\python\python_helpers.h" include\google\protobuf\compiler\python\python_helpers.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\compiler\ruby\ruby_generator.h" include\google\protobuf\compiler\ruby\ruby_generator.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\descriptor.h" include\google\protobuf\descriptor.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\descriptor.pb.h" include\google\protobuf\descriptor.pb.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\descriptor_database.h" include\google\protobuf\descriptor_database.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\duration.pb.h" include\google\protobuf\duration.pb.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\dynamic_message.h" include\google\protobuf\dynamic_message.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\empty.pb.h" include\google\protobuf\empty.pb.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\explicitly_constructed.h" include\google\protobuf\explicitly_constructed.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\extension_set.h" include\google\protobuf\extension_set.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\extension_set_inl.h" include\google\protobuf\extension_set_inl.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\field_access_listener.h" include\google\protobuf\field_access_listener.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\field_mask.pb.h" include\google\protobuf\field_mask.pb.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\generated_enum_reflection.h" include\google\protobuf\generated_enum_reflection.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\generated_enum_util.h" include\google\protobuf\generated_enum_util.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\generated_message_bases.h" include\google\protobuf\generated_message_bases.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\generated_message_reflection.h" include\google\protobuf\generated_message_reflection.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\generated_message_tctable_decl.h" include\google\protobuf\generated_message_tctable_decl.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\generated_message_tctable_impl.h" include\google\protobuf\generated_message_tctable_impl.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\generated_message_util.h" include\google\protobuf\generated_message_util.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\has_bits.h" include\google\protobuf\has_bits.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\implicit_weak_message.h" include\google\protobuf\implicit_weak_message.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\inlined_string_field.h" include\google\protobuf\inlined_string_field.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\io\coded_stream.h" include\google\protobuf\io\coded_stream.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\io\gzip_stream.h" include\google\protobuf\io\gzip_stream.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\io\io_win32.h" include\google\protobuf\io\io_win32.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\io\printer.h" include\google\protobuf\io\printer.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\io\strtod.h" include\google\protobuf\io\strtod.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\io\tokenizer.h" include\google\protobuf\io\tokenizer.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\io\zero_copy_stream.h" include\google\protobuf\io\zero_copy_stream.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\io\zero_copy_stream_impl.h" include\google\protobuf\io\zero_copy_stream_impl.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\io\zero_copy_stream_impl_lite.h" include\google\protobuf\io\zero_copy_stream_impl_lite.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\map.h" include\google\protobuf\map.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\map_entry.h" include\google\protobuf\map_entry.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\map_entry_lite.h" include\google\protobuf\map_entry_lite.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\map_field.h" include\google\protobuf\map_field.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\map_field_inl.h" include\google\protobuf\map_field_inl.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\map_field_lite.h" include\google\protobuf\map_field_lite.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\map_type_handler.h" include\google\protobuf\map_type_handler.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\message.h" include\google\protobuf\message.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\message_lite.h" include\google\protobuf\message_lite.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\metadata.h" include\google\protobuf\metadata.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\metadata_lite.h" include\google\protobuf\metadata_lite.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\parse_context.h" include\google\protobuf\parse_context.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\port.h" include\google\protobuf\port.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\port_def.inc" include\google\protobuf\port_def.inc
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\port_undef.inc" include\google\protobuf\port_undef.inc
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\reflection.h" include\google\protobuf\reflection.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\reflection_ops.h" include\google\protobuf\reflection_ops.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\repeated_field.h" include\google\protobuf\repeated_field.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\repeated_ptr_field.h" include\google\protobuf\repeated_ptr_field.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\service.h" include\google\protobuf\service.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\source_context.pb.h" include\google\protobuf\source_context.pb.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\struct.pb.h" include\google\protobuf\struct.pb.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\stubs\bytestream.h" include\google\protobuf\stubs\bytestream.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\stubs\callback.h" include\google\protobuf\stubs\callback.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\stubs\casts.h" include\google\protobuf\stubs\casts.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\stubs\common.h" include\google\protobuf\stubs\common.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\stubs\hash.h" include\google\protobuf\stubs\hash.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\stubs\logging.h" include\google\protobuf\stubs\logging.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\stubs\macros.h" include\google\protobuf\stubs\macros.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\stubs\map_util.h" include\google\protobuf\stubs\map_util.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\stubs\mutex.h" include\google\protobuf\stubs\mutex.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\stubs\once.h" include\google\protobuf\stubs\once.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\stubs\platform_macros.h" include\google\protobuf\stubs\platform_macros.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\stubs\port.h" include\google\protobuf\stubs\port.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\stubs\status.h" include\google\protobuf\stubs\status.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\stubs\stl_util.h" include\google\protobuf\stubs\stl_util.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\stubs\stringpiece.h" include\google\protobuf\stubs\stringpiece.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\stubs\strutil.h" include\google\protobuf\stubs\strutil.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\stubs\template_util.h" include\google\protobuf\stubs\template_util.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\text_format.h" include\google\protobuf\text_format.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\timestamp.pb.h" include\google\protobuf\timestamp.pb.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\type.pb.h" include\google\protobuf\type.pb.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\unknown_field_set.h" include\google\protobuf\unknown_field_set.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\util\delimited_message_util.h" include\google\protobuf\util\delimited_message_util.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\util\field_comparator.h" include\google\protobuf\util\field_comparator.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\util\field_mask_util.h" include\google\protobuf\util\field_mask_util.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\util\json_util.h" include\google\protobuf\util\json_util.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\util\message_differencer.h" include\google\protobuf\util\message_differencer.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\util\time_util.h" include\google\protobuf\util\time_util.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\util\type_resolver.h" include\google\protobuf\util\type_resolver.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\util\type_resolver_util.h" include\google\protobuf\util\type_resolver_util.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\wire_format.h" include\google\protobuf\wire_format.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\wire_format_lite.h" include\google\protobuf\wire_format_lite.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\wrappers.pb.h" include\google\protobuf\wrappers.pb.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\any.proto" include\google\protobuf\any.proto
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\api.proto" include\google\protobuf\api.proto
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\compiler\plugin.proto" include\google\protobuf\compiler\plugin.proto
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\descriptor.proto" include\google\protobuf\descriptor.proto
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\duration.proto" include\google\protobuf\duration.proto
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\empty.proto" include\google\protobuf\empty.proto
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\field_mask.proto" include\google\protobuf\field_mask.proto
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\source_context.proto" include\google\protobuf\source_context.proto
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\struct.proto" include\google\protobuf\struct.proto
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\timestamp.proto" include\google\protobuf\timestamp.proto
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\type.proto" include\google\protobuf\type.proto
copy "${PROTOBUF_SOURCE_WIN32_PATH}\src\google\protobuf\wrappers.proto" include\google\protobuf\wrappers.proto

@ -1,8 +1,8 @@
include(GNUInstallDirs)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/protobuf.pc.cmake
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/protobuf.pc.cmake
${CMAKE_CURRENT_BINARY_DIR}/protobuf.pc @ONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/protobuf-lite.pc.cmake
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/protobuf-lite.pc.cmake
${CMAKE_CURRENT_BINARY_DIR}/protobuf-lite.pc @ONLY)
set(_protobuf_libraries libprotobuf-lite libprotobuf)
@ -13,7 +13,7 @@ endif (protobuf_BUILD_LIBPROTOC)
foreach(_library ${_protobuf_libraries})
set_property(TARGET ${_library}
PROPERTY INTERFACE_INCLUDE_DIRECTORIES
$<BUILD_INTERFACE:${protobuf_source_dir}/src>
$<BUILD_INTERFACE:${protobuf_SOURCE_DIR}/src>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
if (UNIX AND NOT APPLE)
set_property(TARGET ${_library}
@ -43,13 +43,13 @@ endif (protobuf_BUILD_PROTOC_BINARIES)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/protobuf.pc ${CMAKE_CURRENT_BINARY_DIR}/protobuf-lite.pc DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
file(STRINGS extract_includes.bat.in _extract_strings
file(STRINGS ${protobuf_SOURCE_DIR}/cmake/extract_includes.bat.in _extract_strings
REGEX "^copy")
foreach(_extract_string ${_extract_strings})
string(REGEX REPLACE "^.* .+ include\\\\(.+)$" "\\1"
_header ${_extract_string})
string(REPLACE "\\" "/" _header ${_header})
get_filename_component(_extract_from "${protobuf_SOURCE_DIR}/../src/${_header}" ABSOLUTE)
get_filename_component(_extract_from "${protobuf_SOURCE_DIR}/src/${_header}" ABSOLUTE)
get_filename_component(_extract_name ${_header} NAME)
get_filename_component(_extract_to "${CMAKE_INSTALL_INCLUDEDIR}/${_header}" PATH)
if(EXISTS "${_extract_from}")
@ -84,9 +84,9 @@ function(_protobuf_auto_list FILE_NAME VARIABLE)
endfunction()
# Install well-known type proto files
_protobuf_auto_list("../src/Makefile.am" nobase_dist_proto_DATA)
_protobuf_auto_list("${protobuf_SOURCE_DIR}/src/Makefile.am" nobase_dist_proto_DATA)
foreach(_file ${nobase_dist_proto_DATA})
get_filename_component(_file_from "../src/${_file}" ABSOLUTE)
get_filename_component(_file_from "${protobuf_SOURCE_DIR}/src/${_file}" ABSOLUTE)
get_filename_component(_file_name ${_file} NAME)
get_filename_component(_file_path ${_file} PATH)
if(EXISTS "${_file_from}")
@ -96,7 +96,7 @@ foreach(_file ${nobase_dist_proto_DATA})
RENAME "${_file_name}")
else()
message(AUTHOR_WARNING "The file \"${_file_from}\" is listed in "
"\"${protobuf_SOURCE_DIR}/../src/Makefile.am\" as nobase_dist_proto_DATA "
"\"${protobuf_SOURCE_DIR}/src/Makefile.am\" as nobase_dist_proto_DATA "
"but there not exists. The file will not be installed.")
endif()
endforeach()
@ -114,13 +114,13 @@ endif()
mark_as_advanced(CMAKE_INSTALL_CMAKEDIR)
mark_as_advanced(CMAKE_INSTALL_EXAMPLEDIR)
configure_file(protobuf-config.cmake.in
configure_file(${protobuf_SOURCE_DIR}/cmake/protobuf-config.cmake.in
${CMAKE_INSTALL_CMAKEDIR}/protobuf-config.cmake @ONLY)
configure_file(protobuf-config-version.cmake.in
configure_file(${protobuf_SOURCE_DIR}/cmake/protobuf-config-version.cmake.in
${CMAKE_INSTALL_CMAKEDIR}/protobuf-config-version.cmake @ONLY)
configure_file(protobuf-module.cmake.in
configure_file(${protobuf_SOURCE_DIR}/cmake/protobuf-module.cmake.in
${CMAKE_INSTALL_CMAKEDIR}/protobuf-module.cmake @ONLY)
configure_file(protobuf-options.cmake
configure_file(${protobuf_SOURCE_DIR}/cmake/protobuf-options.cmake
${CMAKE_INSTALL_CMAKEDIR}/protobuf-options.cmake @ONLY)
# Allows the build directory to be used as a find directory.
@ -150,7 +150,7 @@ install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_INSTALL_CMAKEDIR}/
option(protobuf_INSTALL_EXAMPLES "Install the examples folder" OFF)
if(protobuf_INSTALL_EXAMPLES)
install(DIRECTORY ../examples/
install(DIRECTORY examples/
DESTINATION "${CMAKE_INSTALL_EXAMPLEDIR}"
COMPONENT protobuf-examples)
endif()

@ -1,88 +1,88 @@
set(libprotobuf_lite_files
${protobuf_source_dir}/src/google/protobuf/any_lite.cc
${protobuf_source_dir}/src/google/protobuf/arena.cc
${protobuf_source_dir}/src/google/protobuf/arenastring.cc
${protobuf_source_dir}/src/google/protobuf/arenaz_sampler.cc
${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_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
${protobuf_source_dir}/src/google/protobuf/io/coded_stream.cc
${protobuf_source_dir}/src/google/protobuf/io/io_win32.cc
${protobuf_source_dir}/src/google/protobuf/io/strtod.cc
${protobuf_source_dir}/src/google/protobuf/io/zero_copy_stream.cc
${protobuf_source_dir}/src/google/protobuf/io/zero_copy_stream_impl.cc
${protobuf_source_dir}/src/google/protobuf/io/zero_copy_stream_impl_lite.cc
${protobuf_source_dir}/src/google/protobuf/map.cc
${protobuf_source_dir}/src/google/protobuf/message_lite.cc
${protobuf_source_dir}/src/google/protobuf/parse_context.cc
${protobuf_source_dir}/src/google/protobuf/repeated_field.cc
${protobuf_source_dir}/src/google/protobuf/repeated_ptr_field.cc
${protobuf_source_dir}/src/google/protobuf/stubs/bytestream.cc
${protobuf_source_dir}/src/google/protobuf/stubs/common.cc
${protobuf_source_dir}/src/google/protobuf/stubs/int128.cc
${protobuf_source_dir}/src/google/protobuf/stubs/status.cc
${protobuf_source_dir}/src/google/protobuf/stubs/statusor.cc
${protobuf_source_dir}/src/google/protobuf/stubs/stringpiece.cc
${protobuf_source_dir}/src/google/protobuf/stubs/stringprintf.cc
${protobuf_source_dir}/src/google/protobuf/stubs/structurally_valid.cc
${protobuf_source_dir}/src/google/protobuf/stubs/strutil.cc
${protobuf_source_dir}/src/google/protobuf/stubs/time.cc
${protobuf_source_dir}/src/google/protobuf/wire_format_lite.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/any_lite.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/arena.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/arenastring.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/arenaz_sampler.cc
${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_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
${protobuf_SOURCE_DIR}/src/google/protobuf/io/coded_stream.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/io/io_win32.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/io/strtod.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/io/zero_copy_stream.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/io/zero_copy_stream_impl.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/io/zero_copy_stream_impl_lite.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/map.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/message_lite.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/parse_context.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/repeated_field.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/repeated_ptr_field.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/bytestream.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/common.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/int128.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/status.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/statusor.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/stringpiece.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/stringprintf.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/structurally_valid.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/strutil.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/time.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/wire_format_lite.cc
)
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/arenaz_sampler.h
${protobuf_source_dir}/src/google/protobuf/explicitly_constructed.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_tctable_decl.h
${protobuf_source_dir}/src/google/protobuf/generated_message_tctable_impl.h
${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/repeated_ptr_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/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/stl_util.h
${protobuf_source_dir}/src/google/protobuf/stubs/stringpiece.h
${protobuf_source_dir}/src/google/protobuf/stubs/strutil.h
${protobuf_source_dir}/src/google/protobuf/stubs/template_util.h
${protobuf_source_dir}/src/google/protobuf/wire_format_lite.h
${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/arenaz_sampler.h
${protobuf_SOURCE_DIR}/src/google/protobuf/explicitly_constructed.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_tctable_decl.h
${protobuf_SOURCE_DIR}/src/google/protobuf/generated_message_tctable_impl.h
${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/repeated_ptr_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/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/stl_util.h
${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/stringpiece.h
${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/strutil.h
${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/template_util.h
${protobuf_SOURCE_DIR}/src/google/protobuf/wire_format_lite.h
)
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
@ -94,18 +94,22 @@ endif()
add_library(libprotobuf-lite ${protobuf_SHARED_OR_STATIC}
${libprotobuf_lite_files} ${libprotobuf_lite_includes} ${libprotobuf_lite_rc_files})
if(protobuf_HAVE_LD_VERSION_SCRIPT)
target_link_options(libprotobuf-lite PRIVATE -Wl,--version-script=${protobuf_source_dir}/src/libprotobuf-lite.map)
if(${CMAKE_VERSION} VERSION_GREATER 3.13 OR ${CMAKE_VERSION} VERSION_EQUAL 3.13)
target_link_options(libprotobuf-lite PRIVATE -Wl,--version-script=${protobuf_SOURCE_DIR}/src/libprotobuf-lite.map)
elseif(protobuf_BUILD_SHARED_LIBS)
target_link_libraries(libprotobuf-lite PRIVATE -Wl,--version-script=${protobuf_SOURCE_DIR}/src/libprotobuf-lite.map)
endif()
set_target_properties(libprotobuf-lite PROPERTIES
LINK_DEPENDS ${protobuf_source_dir}/src/libprotobuf-lite.map)
LINK_DEPENDS ${protobuf_SOURCE_DIR}/src/libprotobuf-lite.map)
endif()
target_link_libraries(libprotobuf-lite ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(libprotobuf-lite PRIVATE ${CMAKE_THREAD_LIBS_INIT})
if(protobuf_LINK_LIBATOMIC)
target_link_libraries(libprotobuf-lite atomic)
target_link_libraries(libprotobuf-lite PRIVATE atomic)
endif()
if(${CMAKE_SYSTEM_NAME} STREQUAL "Android")
target_link_libraries(libprotobuf-lite log)
target_link_libraries(libprotobuf-lite PRIVATE log)
endif()
target_include_directories(libprotobuf-lite PUBLIC ${protobuf_source_dir}/src)
target_include_directories(libprotobuf-lite PUBLIC ${protobuf_SOURCE_DIR}/src)
if(protobuf_BUILD_SHARED_LIBS)
target_compile_definitions(libprotobuf-lite
PUBLIC PROTOBUF_USE_DLLS
@ -113,7 +117,7 @@ if(protobuf_BUILD_SHARED_LIBS)
endif()
set_target_properties(libprotobuf-lite PROPERTIES
VERSION ${protobuf_VERSION}
SOVERSION 30
SOVERSION 31
OUTPUT_NAME ${LIB_PREFIX}protobuf-lite
DEBUG_POSTFIX "${protobuf_DEBUG_POSTFIX}")
add_library(protobuf::libprotobuf-lite ALIAS libprotobuf-lite)

@ -1,102 +1,102 @@
set(libprotobuf_files
${protobuf_source_dir}/src/google/protobuf/any.cc
${protobuf_source_dir}/src/google/protobuf/any.pb.cc
${protobuf_source_dir}/src/google/protobuf/api.pb.cc
${protobuf_source_dir}/src/google/protobuf/compiler/importer.cc
${protobuf_source_dir}/src/google/protobuf/compiler/parser.cc
${protobuf_source_dir}/src/google/protobuf/descriptor.cc
${protobuf_source_dir}/src/google/protobuf/descriptor.pb.cc
${protobuf_source_dir}/src/google/protobuf/descriptor_database.cc
${protobuf_source_dir}/src/google/protobuf/duration.pb.cc
${protobuf_source_dir}/src/google/protobuf/dynamic_message.cc
${protobuf_source_dir}/src/google/protobuf/empty.pb.cc
${protobuf_source_dir}/src/google/protobuf/extension_set_heavy.cc
${protobuf_source_dir}/src/google/protobuf/field_mask.pb.cc
${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_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
${protobuf_source_dir}/src/google/protobuf/struct.pb.cc
${protobuf_source_dir}/src/google/protobuf/stubs/substitute.cc
${protobuf_source_dir}/src/google/protobuf/text_format.cc
${protobuf_source_dir}/src/google/protobuf/timestamp.pb.cc
${protobuf_source_dir}/src/google/protobuf/type.pb.cc
${protobuf_source_dir}/src/google/protobuf/unknown_field_set.cc
${protobuf_source_dir}/src/google/protobuf/util/delimited_message_util.cc
${protobuf_source_dir}/src/google/protobuf/util/field_comparator.cc
${protobuf_source_dir}/src/google/protobuf/util/field_mask_util.cc
${protobuf_source_dir}/src/google/protobuf/util/internal/datapiece.cc
${protobuf_source_dir}/src/google/protobuf/util/internal/default_value_objectwriter.cc
${protobuf_source_dir}/src/google/protobuf/util/internal/error_listener.cc
${protobuf_source_dir}/src/google/protobuf/util/internal/field_mask_utility.cc
${protobuf_source_dir}/src/google/protobuf/util/internal/json_escaping.cc
${protobuf_source_dir}/src/google/protobuf/util/internal/json_objectwriter.cc
${protobuf_source_dir}/src/google/protobuf/util/internal/json_stream_parser.cc
${protobuf_source_dir}/src/google/protobuf/util/internal/object_writer.cc
${protobuf_source_dir}/src/google/protobuf/util/internal/proto_writer.cc
${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/utility.cc
${protobuf_source_dir}/src/google/protobuf/util/json_util.cc
${protobuf_source_dir}/src/google/protobuf/util/message_differencer.cc
${protobuf_source_dir}/src/google/protobuf/util/time_util.cc
${protobuf_source_dir}/src/google/protobuf/util/type_resolver_util.cc
${protobuf_source_dir}/src/google/protobuf/wire_format.cc
${protobuf_source_dir}/src/google/protobuf/wrappers.pb.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/any.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/any.pb.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/api.pb.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/importer.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/parser.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/descriptor.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/descriptor.pb.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/descriptor_database.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/duration.pb.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/dynamic_message.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/empty.pb.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/extension_set_heavy.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/field_mask.pb.cc
${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_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
${protobuf_SOURCE_DIR}/src/google/protobuf/struct.pb.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/substitute.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/text_format.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/timestamp.pb.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/type.pb.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/unknown_field_set.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/util/delimited_message_util.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/util/field_comparator.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/util/field_mask_util.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/datapiece.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/default_value_objectwriter.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/error_listener.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/field_mask_utility.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/json_escaping.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/json_objectwriter.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/json_stream_parser.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/object_writer.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/proto_writer.cc
${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/utility.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/util/json_util.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/util/message_differencer.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/util/time_util.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/util/type_resolver_util.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/wire_format.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/wrappers.pb.cc
)
set(libprotobuf_includes
${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
${protobuf_source_dir}/src/google/protobuf/compiler/parser.h
${protobuf_source_dir}/src/google/protobuf/descriptor.h
${protobuf_source_dir}/src/google/protobuf/descriptor.pb.h
${protobuf_source_dir}/src/google/protobuf/descriptor_database.h
${protobuf_source_dir}/src/google/protobuf/duration.pb.h
${protobuf_source_dir}/src/google/protobuf/dynamic_message.h
${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/text_format.h
${protobuf_source_dir}/src/google/protobuf/timestamp.pb.h
${protobuf_source_dir}/src/google/protobuf/type.pb.h
${protobuf_source_dir}/src/google/protobuf/unknown_field_set.h
${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/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
${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
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/parser.h
${protobuf_SOURCE_DIR}/src/google/protobuf/descriptor.h
${protobuf_SOURCE_DIR}/src/google/protobuf/descriptor.pb.h
${protobuf_SOURCE_DIR}/src/google/protobuf/descriptor_database.h
${protobuf_SOURCE_DIR}/src/google/protobuf/duration.pb.h
${protobuf_SOURCE_DIR}/src/google/protobuf/dynamic_message.h
${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/text_format.h
${protobuf_SOURCE_DIR}/src/google/protobuf/timestamp.pb.h
${protobuf_SOURCE_DIR}/src/google/protobuf/type.pb.h
${protobuf_SOURCE_DIR}/src/google/protobuf/unknown_field_set.h
${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/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
)
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
@ -108,21 +108,25 @@ endif()
add_library(libprotobuf ${protobuf_SHARED_OR_STATIC}
${libprotobuf_lite_files} ${libprotobuf_files} ${libprotobuf_includes} ${libprotobuf_rc_files})
if(protobuf_HAVE_LD_VERSION_SCRIPT)
target_link_options(libprotobuf PRIVATE -Wl,--version-script=${protobuf_source_dir}/src/libprotobuf.map)
if(${CMAKE_VERSION} VERSION_GREATER 3.13 OR ${CMAKE_VERSION} VERSION_EQUAL 3.13)
target_link_options(libprotobuf PRIVATE -Wl,--version-script=${protobuf_SOURCE_DIR}/src/libprotobuf.map)
elseif(protobuf_BUILD_SHARED_LIBS)
target_link_libraries(libprotobuf PRIVATE -Wl,--version-script=${protobuf_SOURCE_DIR}/src/libprotobuf.map)
endif()
set_target_properties(libprotobuf PROPERTIES
LINK_DEPENDS ${protobuf_source_dir}/src/libprotobuf.map)
LINK_DEPENDS ${protobuf_SOURCE_DIR}/src/libprotobuf.map)
endif()
target_link_libraries(libprotobuf ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(libprotobuf PRIVATE ${CMAKE_THREAD_LIBS_INIT})
if(protobuf_WITH_ZLIB)
target_link_libraries(libprotobuf ${ZLIB_LIBRARIES})
target_link_libraries(libprotobuf PRIVATE ${ZLIB_LIBRARIES})
endif()
if(protobuf_LINK_LIBATOMIC)
target_link_libraries(libprotobuf atomic)
target_link_libraries(libprotobuf PRIVATE atomic)
endif()
if(${CMAKE_SYSTEM_NAME} STREQUAL "Android")
target_link_libraries(libprotobuf log)
target_link_libraries(libprotobuf PRIVATE log)
endif()
target_include_directories(libprotobuf PUBLIC ${protobuf_source_dir}/src)
target_include_directories(libprotobuf PUBLIC ${protobuf_SOURCE_DIR}/src)
if(protobuf_BUILD_SHARED_LIBS)
target_compile_definitions(libprotobuf
PUBLIC PROTOBUF_USE_DLLS
@ -130,7 +134,7 @@ if(protobuf_BUILD_SHARED_LIBS)
endif()
set_target_properties(libprotobuf PROPERTIES
VERSION ${protobuf_VERSION}
SOVERSION 30
SOVERSION 31
OUTPUT_NAME ${LIB_PREFIX}protobuf
DEBUG_POSTFIX "${protobuf_DEBUG_POSTFIX}")
add_library(protobuf::libprotobuf ALIAS libprotobuf)

@ -1,126 +1,126 @@
set(libprotoc_files
${protobuf_source_dir}/src/google/protobuf/compiler/code_generator.cc
${protobuf_source_dir}/src/google/protobuf/compiler/command_line_interface.cc
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_enum.cc
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_enum_field.cc
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_extension.cc
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_field.cc
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_file.cc
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_generator.cc
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_helpers.cc
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_map_field.cc
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_message.cc
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_message_field.cc
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_padding_optimizer.cc
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_parse_function_generator.cc
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_service.cc
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_string_field.cc
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_doc_comment.cc
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_enum.cc
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_enum_field.cc
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_field_base.cc
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_generator.cc
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_helpers.cc
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_map_field.cc
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_message.cc
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_message_field.cc
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_primitive_field.cc
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_reflection_class.cc
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.cc
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_source_generator_base.cc
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_wrapper_field.cc
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_context.cc
${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
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_extension_lite.cc
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_field.cc
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_file.cc
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_generator.cc
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_generator_factory.cc
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_helpers.cc
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_kotlin_generator.cc
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_map_field.cc
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_map_field_lite.cc
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message.cc
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message_builder.cc
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message_builder_lite.cc
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message_field.cc
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message_field_lite.cc
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message_lite.cc
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_name_resolver.cc
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_primitive_field.cc
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_primitive_field_lite.cc
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_service.cc
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_shared_code_generator.cc
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_string_field.cc
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_string_field_lite.cc
${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
${protobuf_source_dir}/src/google/protobuf/compiler/python/python_generator.cc
${protobuf_source_dir}/src/google/protobuf/compiler/python/python_helpers.cc
${protobuf_source_dir}/src/google/protobuf/compiler/python/python_pyi_generator.cc
${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
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/code_generator.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/command_line_interface.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/cpp_enum.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/cpp_enum_field.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/cpp_extension.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/cpp_field.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/cpp_file.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/cpp_generator.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/cpp_helpers.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/cpp_map_field.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/cpp_message.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/cpp_message_field.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/cpp_padding_optimizer.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/cpp_parse_function_generator.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/cpp_service.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/cpp_string_field.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/csharp/csharp_doc_comment.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/csharp/csharp_enum.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/csharp/csharp_enum_field.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/csharp/csharp_field_base.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/csharp/csharp_generator.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/csharp/csharp_helpers.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/csharp/csharp_map_field.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/csharp/csharp_message.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/csharp/csharp_message_field.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/csharp/csharp_primitive_field.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/csharp/csharp_reflection_class.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/csharp/csharp_source_generator_base.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/csharp/csharp_wrapper_field.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/java_context.cc
${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
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/java_extension_lite.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/java_field.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/java_file.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/java_generator.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/java_generator_factory.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/java_helpers.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/java_kotlin_generator.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/java_map_field.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/java_map_field_lite.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/java_message.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/java_message_builder.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/java_message_builder_lite.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/java_message_field.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/java_message_field_lite.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/java_message_lite.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/java_name_resolver.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/java_primitive_field.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/java_primitive_field_lite.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/java_service.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/java_shared_code_generator.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/java_string_field.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/java_string_field_lite.cc
${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
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/python/python_generator.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/python/python_helpers.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/python/python_pyi_generator.cc
${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/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_names.h
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_doc_comment.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/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/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/python/python_pyi_generator.h
${protobuf_source_dir}/src/google/protobuf/compiler/ruby/ruby_generator.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_names.h
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/csharp/csharp_doc_comment.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/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/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/python/python_pyi_generator.h
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/ruby/ruby_generator.h
)
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
@ -132,12 +132,16 @@ endif()
add_library(libprotoc ${protobuf_SHARED_OR_STATIC}
${libprotoc_files} ${libprotoc_headers} ${libprotoc_rc_files})
if(protobuf_HAVE_LD_VERSION_SCRIPT)
target_link_options(libprotoc PRIVATE -Wl,--version-script=${protobuf_source_dir}/src/libprotoc.map)
if(${CMAKE_VERSION} VERSION_GREATER 3.13 OR ${CMAKE_VERSION} VERSION_EQUAL 3.13)
target_link_options(libprotoc PRIVATE -Wl,--version-script=${protobuf_SOURCE_DIR}/src/libprotoc.map)
elseif(protobuf_BUILD_SHARED_LIBS)
target_link_libraries(libprotoc PRIVATE -Wl,--version-script=${protobuf_SOURCE_DIR}/src/libprotoc.map)
endif()
set_target_properties(libprotoc PROPERTIES
LINK_DEPENDS ${protobuf_source_dir}/src/libprotoc.map)
LINK_DEPENDS ${protobuf_SOURCE_DIR}/src/libprotoc.map)
endif()
target_link_libraries(libprotoc libprotobuf)
if(MSVC AND protobuf_BUILD_SHARED_LIBS)
target_link_libraries(libprotoc PRIVATE libprotobuf)
if(protobuf_BUILD_SHARED_LIBS)
target_compile_definitions(libprotoc
PUBLIC PROTOBUF_USE_DLLS
PRIVATE LIBPROTOC_EXPORTS)
@ -145,7 +149,7 @@ endif()
set_target_properties(libprotoc PROPERTIES
COMPILE_DEFINITIONS LIBPROTOC_EXPORTS
VERSION ${protobuf_VERSION}
SOVERSION 30
SOVERSION 31
OUTPUT_NAME ${LIB_PREFIX}protoc
DEBUG_POSTFIX "${protobuf_DEBUG_POSTFIX}")
add_library(protobuf::libprotoc ALIAS libprotoc)

@ -1,5 +1,5 @@
set(protoc_files
${protobuf_source_dir}/src/google/protobuf/compiler/main.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/main.cc
)
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")

@ -7,7 +7,7 @@ mark_as_advanced(protobuf_ABSOLUTE_TEST_PLUGIN_PATH)
if (protobuf_USE_EXTERNAL_GTEST)
find_package(GTest REQUIRED)
else()
if (NOT EXISTS "${PROJECT_SOURCE_DIR}/../third_party/googletest/CMakeLists.txt")
if (NOT EXISTS "${protobuf_SOURCE_DIR}/third_party/googletest/CMakeLists.txt")
message(FATAL_ERROR
"Cannot find third_party/googletest directory that's needed to "
"build tests. If you use git, make sure you have cloned submodules:\n"
@ -16,8 +16,8 @@ else()
" cmake -Dprotobuf_BUILD_TESTS=OFF\n")
endif()
set(googlemock_source_dir "${protobuf_source_dir}/third_party/googletest/googlemock")
set(googletest_source_dir "${protobuf_source_dir}/third_party/googletest/googletest")
set(googlemock_source_dir "${protobuf_SOURCE_DIR}/third_party/googletest/googlemock")
set(googletest_source_dir "${protobuf_SOURCE_DIR}/third_party/googletest/googletest")
include_directories(
${googlemock_source_dir}
${googletest_source_dir}
@ -95,11 +95,11 @@ macro(compile_proto_file filename)
get_filename_component(dirname ${filename} PATH)
get_filename_component(basename ${filename} NAME_WE)
add_custom_command(
OUTPUT ${protobuf_source_dir}/src/${dirname}/${basename}.pb.cc
DEPENDS ${protobuf_PROTOC_EXE} ${protobuf_source_dir}/src/${dirname}/${basename}.proto
COMMAND ${protobuf_PROTOC_EXE} ${protobuf_source_dir}/src/${dirname}/${basename}.proto
--proto_path=${protobuf_source_dir}/src
--cpp_out=${protobuf_source_dir}/src
OUTPUT ${protobuf_SOURCE_DIR}/src/${dirname}/${basename}.pb.cc
DEPENDS ${protobuf_PROTOC_EXE} ${protobuf_SOURCE_DIR}/src/${dirname}/${basename}.proto
COMMAND ${protobuf_PROTOC_EXE} ${protobuf_SOURCE_DIR}/src/${dirname}/${basename}.proto
--proto_path=${protobuf_SOURCE_DIR}/src
--cpp_out=${protobuf_SOURCE_DIR}/src
--experimental_allow_proto3_optional
)
endmacro(compile_proto_file)
@ -109,7 +109,7 @@ foreach(proto_file ${lite_test_protos})
compile_proto_file(${proto_file})
string(REPLACE .proto .pb.cc pb_file ${proto_file})
set(lite_test_proto_files ${lite_test_proto_files}
${protobuf_source_dir}/src/${pb_file})
${protobuf_SOURCE_DIR}/src/${pb_file})
endforeach(proto_file)
set(tests_proto_files)
@ -117,104 +117,104 @@ foreach(proto_file ${tests_protos})
compile_proto_file(${proto_file})
string(REPLACE .proto .pb.cc pb_file ${proto_file})
set(tests_proto_files ${tests_proto_files}
${protobuf_source_dir}/src/${pb_file})
${protobuf_SOURCE_DIR}/src/${pb_file})
endforeach(proto_file)
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
${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
${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/arenaz_sampler_test.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
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_plugin_unittest.cc
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_unittest.cc
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_unittest.inc
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/metadata_test.cc
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_generator_unittest.cc
${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/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
${protobuf_source_dir}/src/google/protobuf/compiler/ruby/ruby_generator_unittest.cc
${protobuf_source_dir}/src/google/protobuf/descriptor_database_unittest.cc
${protobuf_source_dir}/src/google/protobuf/descriptor_unittest.cc
${protobuf_source_dir}/src/google/protobuf/drop_unknown_fields_test.cc
${protobuf_source_dir}/src/google/protobuf/dynamic_message_unittest.cc
${protobuf_source_dir}/src/google/protobuf/extension_set_unittest.cc
${protobuf_source_dir}/src/google/protobuf/generated_message_reflection_unittest.cc
${protobuf_source_dir}/src/google/protobuf/generated_message_tctable_lite_test.cc
${protobuf_source_dir}/src/google/protobuf/inlined_string_field_unittest.cc
${protobuf_source_dir}/src/google/protobuf/io/coded_stream_unittest.cc
${protobuf_source_dir}/src/google/protobuf/io/io_win32_unittest.cc
${protobuf_source_dir}/src/google/protobuf/io/printer_unittest.cc
${protobuf_source_dir}/src/google/protobuf/io/tokenizer_unittest.cc
${protobuf_source_dir}/src/google/protobuf/io/zero_copy_stream_unittest.cc
${protobuf_source_dir}/src/google/protobuf/map_field_test.cc
${protobuf_source_dir}/src/google/protobuf/map_test.cc
${protobuf_source_dir}/src/google/protobuf/map_test.inc
${protobuf_source_dir}/src/google/protobuf/message_unittest.cc
${protobuf_source_dir}/src/google/protobuf/message_unittest.inc
${protobuf_source_dir}/src/google/protobuf/no_field_presence_test.cc
${protobuf_source_dir}/src/google/protobuf/preserve_unknown_enum_test.cc
${protobuf_source_dir}/src/google/protobuf/proto3_arena_lite_unittest.cc
${protobuf_source_dir}/src/google/protobuf/proto3_arena_unittest.cc
${protobuf_source_dir}/src/google/protobuf/proto3_lite_unittest.cc
${protobuf_source_dir}/src/google/protobuf/proto3_lite_unittest.inc
${protobuf_source_dir}/src/google/protobuf/reflection_ops_unittest.cc
${protobuf_source_dir}/src/google/protobuf/repeated_field_reflection_unittest.cc
${protobuf_source_dir}/src/google/protobuf/repeated_field_unittest.cc
${protobuf_source_dir}/src/google/protobuf/stubs/bytestream_unittest.cc
${protobuf_source_dir}/src/google/protobuf/stubs/common_unittest.cc
${protobuf_source_dir}/src/google/protobuf/stubs/int128_unittest.cc
${protobuf_source_dir}/src/google/protobuf/stubs/status_test.cc
${protobuf_source_dir}/src/google/protobuf/stubs/statusor_test.cc
${protobuf_source_dir}/src/google/protobuf/stubs/stringpiece_unittest.cc
${protobuf_source_dir}/src/google/protobuf/stubs/stringprintf_unittest.cc
${protobuf_source_dir}/src/google/protobuf/stubs/structurally_valid_unittest.cc
${protobuf_source_dir}/src/google/protobuf/stubs/strutil_unittest.cc
${protobuf_source_dir}/src/google/protobuf/stubs/template_util_unittest.cc
${protobuf_source_dir}/src/google/protobuf/stubs/time_test.cc
${protobuf_source_dir}/src/google/protobuf/text_format_unittest.cc
${protobuf_source_dir}/src/google/protobuf/unknown_field_set_unittest.cc
${protobuf_source_dir}/src/google/protobuf/util/delimited_message_util_test.cc
${protobuf_source_dir}/src/google/protobuf/util/field_comparator_test.cc
${protobuf_source_dir}/src/google/protobuf/util/field_mask_util_test.cc
${protobuf_source_dir}/src/google/protobuf/util/internal/default_value_objectwriter_test.cc
${protobuf_source_dir}/src/google/protobuf/util/internal/json_objectwriter_test.cc
${protobuf_source_dir}/src/google/protobuf/util/internal/json_stream_parser_test.cc
${protobuf_source_dir}/src/google/protobuf/util/internal/protostream_objectsource_test.cc
${protobuf_source_dir}/src/google/protobuf/util/internal/protostream_objectwriter_test.cc
${protobuf_source_dir}/src/google/protobuf/util/internal/type_info_test_helper.cc
${protobuf_source_dir}/src/google/protobuf/util/json_util_test.cc
${protobuf_source_dir}/src/google/protobuf/util/message_differencer_unittest.cc
${protobuf_source_dir}/src/google/protobuf/util/time_util_test.cc
${protobuf_source_dir}/src/google/protobuf/util/type_resolver_util_test.cc
${protobuf_source_dir}/src/google/protobuf/well_known_types_unittest.cc
${protobuf_source_dir}/src/google/protobuf/wire_format_unittest.cc
${protobuf_source_dir}/src/google/protobuf/wire_format_unittest.inc
${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/arenaz_sampler_test.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
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/cpp_plugin_unittest.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/cpp_unittest.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/cpp_unittest.inc
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/metadata_test.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/csharp/csharp_generator_unittest.cc
${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/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
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/ruby/ruby_generator_unittest.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/descriptor_database_unittest.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/descriptor_unittest.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/drop_unknown_fields_test.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/dynamic_message_unittest.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/extension_set_unittest.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/generated_message_reflection_unittest.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/generated_message_tctable_lite_test.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/inlined_string_field_unittest.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/io/coded_stream_unittest.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/io/io_win32_unittest.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/io/printer_unittest.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/io/tokenizer_unittest.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/io/zero_copy_stream_unittest.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/map_field_test.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/map_test.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/map_test.inc
${protobuf_SOURCE_DIR}/src/google/protobuf/message_unittest.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/message_unittest.inc
${protobuf_SOURCE_DIR}/src/google/protobuf/no_field_presence_test.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/preserve_unknown_enum_test.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/proto3_arena_lite_unittest.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/proto3_arena_unittest.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/proto3_lite_unittest.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/proto3_lite_unittest.inc
${protobuf_SOURCE_DIR}/src/google/protobuf/reflection_ops_unittest.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/repeated_field_reflection_unittest.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/repeated_field_unittest.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/bytestream_unittest.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/common_unittest.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/int128_unittest.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/status_test.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/statusor_test.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/stringpiece_unittest.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/stringprintf_unittest.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/structurally_valid_unittest.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/strutil_unittest.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/template_util_unittest.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/time_test.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/text_format_unittest.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/unknown_field_set_unittest.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/util/delimited_message_util_test.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/util/field_comparator_test.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/util/field_mask_util_test.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/default_value_objectwriter_test.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/json_objectwriter_test.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/json_stream_parser_test.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/protostream_objectsource_test.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/protostream_objectwriter_test.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/type_info_test_helper.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/util/json_util_test.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/util/message_differencer_unittest.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/util/time_util_test.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/util/type_resolver_util_test.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/well_known_types_unittest.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/wire_format_unittest.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/wire_format_unittest.inc
)
if(protobuf_ABSOLUTE_TEST_PLUGIN_PATH)
@ -241,23 +241,23 @@ endif()
target_link_libraries(tests libprotoc libprotobuf GTest::gmock_main)
set(test_plugin_files
${protobuf_source_dir}/src/google/protobuf/compiler/mock_code_generator.cc
${protobuf_source_dir}/src/google/protobuf/compiler/test_plugin.cc
${protobuf_source_dir}/src/google/protobuf/testing/file.cc
${protobuf_source_dir}/src/google/protobuf/testing/file.h
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/mock_code_generator.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/test_plugin.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/testing/file.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/testing/file.h
)
add_executable(test_plugin ${test_plugin_files})
target_link_libraries(test_plugin libprotoc libprotobuf GTest::gmock)
set(lite_test_files
${protobuf_source_dir}/src/google/protobuf/lite_unittest.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/lite_unittest.cc
)
add_executable(lite-test ${lite_test_files} ${common_lite_test_files} ${lite_test_proto_files})
target_link_libraries(lite-test libprotobuf-lite GTest::gmock_main)
set(lite_arena_test_files
${protobuf_source_dir}/src/google/protobuf/lite_arena_unittest.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/lite_arena_unittest.cc
)
add_executable(lite-arena-test ${lite_arena_test_files} ${common_lite_test_files} ${lite_test_proto_files})
target_link_libraries(lite-arena-test libprotobuf-lite GTest::gmock_main)
@ -265,8 +265,8 @@ target_link_libraries(lite-arena-test libprotobuf-lite GTest::gmock_main)
add_custom_target(check
COMMAND tests
DEPENDS tests test_plugin
WORKING_DIRECTORY ${protobuf_source_dir})
WORKING_DIRECTORY ${protobuf_SOURCE_DIR})
add_test(NAME check
COMMAND tests
WORKING_DIRECTORY "${protobuf_source_dir}")
WORKING_DIRECTORY "${protobuf_SOURCE_DIR}")

@ -17,7 +17,7 @@ AC_PREREQ(2.59)
# In the SVN trunk, the version should always be the next anticipated release
# version with the "-pre" suffix. (We used to use "-SNAPSHOT" but this pushed
# the size of one file name in the dist tarfile over the 99-char limit.)
AC_INIT([Protocol Buffers],[3.19.4],[protobuf@googlegroups.com],[protobuf])
AC_INIT([Protocol Buffers],[3.20.0-rc-1],[protobuf@googlegroups.com],[protobuf])
AM_MAINTAINER_MODE([enable])

@ -5,7 +5,7 @@
<title>Google Protocol Buffers tools</title>
<summary>Tools for Protocol Buffers - Google's data interchange format.</summary>
<description>See project site for more info.</description>
<version>3.19.4</version>
<version>3.20.0-rc1</version>
<authors>Google Inc.</authors>
<owners>protobuf-packages</owners>
<licenseUrl>https://github.com/protocolbuffers/protobuf/blob/master/LICENSE</licenseUrl>

@ -716,6 +716,25 @@ namespace Google.Protobuf
}
}
[Test]
public void MaximumFieldNumber()
{
MemoryStream ms = new MemoryStream();
CodedOutputStream output = new CodedOutputStream(ms);
int fieldNumber = 0x1FFFFFFF;
uint tag = WireFormat.MakeTag(fieldNumber, WireFormat.WireType.LengthDelimited);
output.WriteRawVarint32(tag);
output.WriteString("field 1");
output.Flush();
ms.Position = 0;
CodedInputStream input = new CodedInputStream(ms);
Assert.AreEqual(tag, input.ReadTag());
Assert.AreEqual(fieldNumber, WireFormat.GetTagFieldNumber(tag));
}
[Test]
public void Tag0Throws()
{

@ -1,10 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Description>C# runtime library for Protocol Buffers - Google's data interchange format.</Description>
<Copyright>Copyright 2015, Google Inc.</Copyright>
<AssemblyTitle>Google Protocol Buffers</AssemblyTitle>
<VersionPrefix>3.19.4</VersionPrefix>
<VersionPrefix>3.20.0-rc1</VersionPrefix>
<!-- C# 7.2 is required for Span/BufferWriter/ReadOnlySequence -->
<LangVersion>7.2</LangVersion>
<Authors>Google Inc.</Authors>

@ -90,7 +90,7 @@ namespace Google.Protobuf
/// </summary>
public static int GetTagFieldNumber(uint tag)
{
return (int) tag >> TagTypeBits;
return (int) (tag >> TagTypeBits);
}
/// <summary>

@ -180,7 +180,7 @@ There are miscellaneous other things you may find useful as a Protocol Buffers d
* [Protobuf for nginx module](https://github.com/dbcode/protobuf-nginx/)
* [RSpec matchers and Cucumber step defs for testing Protocol Buffers](https://github.com/connamara/protobuf_spec)
* [Sbt plugin for Protocol Buffers](https://github.com/Atry/sbt-cppp)
* [Gradle Protobuf Plugin](https://github.com/aantono/gradle-plugin-protobuf)
* [Protobuf Plugin for Gradle](https://github.com/google/protobuf-gradle-plugin)
* [Multi-platform executable JAR and Java API for protoc](https://github.com/os72/protoc-jar)
* [Python scripts to convert between Protocol Buffers and JSON](https://github.com/NextTuesday/py-pb-converters)
* [Visual Studio Language Service support for Protocol Buffers](http://visualstudiogallery.msdn.microsoft.com/4bc0f38c-b058-4e05-ae38-155e053c19c5)

@ -193,7 +193,7 @@
;;;###autoload (add-to-list 'auto-mode-alist '("\\.proto\\'" . protobuf-mode))
;;;###autoload
(define-derived-mode protobuf-mode prog-mode "Protobuf"
(define-derived-mode protobuf-mode prog-mode "Protocol-Buffers"
"Major mode for editing Protocol Buffers description language.
The hook `c-mode-common-hook' is run with no argument at mode
@ -201,26 +201,17 @@ initialization, then `protobuf-mode-hook'.
Key bindings:
\\{protobuf-mode-map}"
(interactive)
(kill-all-local-variables)
(set-syntax-table protobuf-mode-syntax-table)
(setq major-mode 'protobuf-mode
mode-name "Protocol-Buffers"
local-abbrev-table protobuf-mode-abbrev-table
abbrev-mode t)
(use-local-map protobuf-mode-map)
:after-hook (c-update-modeline)
(setq abbrev-mode t)
(c-initialize-cc-mode t)
(if (fboundp 'c-make-emacs-variables-local)
(c-make-emacs-variables-local))
(c-init-language-vars protobuf-mode)
(c-common-init 'protobuf-mode)
(easy-menu-add protobuf-menu)
(c-run-mode-hooks 'c-mode-common-hook 'protobuf-mode-hook)
(c-update-modeline)
(setq imenu-generic-expression
'(("Message" "^[[:space:]]*message[[:space:]]+\\([[:alnum:]]+\\)" 1)
("Enum" "^[[:space:]]*enum[[:space:]]+\\([[:alnum:]]+\\)" 1)
("Service" "^[[:space:]]*service[[:space:]]+\\([[:alnum:]]+\\)" 1))))
("Service" "^[[:space:]]*service[[:space:]]+\\([[:alnum:]]+\\)" 1)))
(c-run-mode-hooks 'c-mode-common-hook))
(provide 'protobuf-mode)

@ -23,7 +23,7 @@ If you are using Maven, use the following:
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>3.19.4</version>
<version>3.20.0-rc-1</version>
</dependency>
```
@ -37,7 +37,7 @@ protobuf-java-util package:
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java-util</artifactId>
<version>3.19.4</version>
<version>3.20.0-rc-1</version>
</dependency>
```
@ -45,7 +45,7 @@ protobuf-java-util package:
If you are using Gradle, add the following to your `build.gradle` file's dependencies:
```
implementation 'com.google.protobuf:protobuf-java:3.19.4'
implementation 'com.google.protobuf:protobuf-java:3.20.0-rc-1'
```
Again, be sure to check that the version number matches (or is newer than) the version number of protoc that you are using.

@ -4,7 +4,7 @@
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-bom</artifactId>
<version>3.19.4</version>
<version>3.20.0-rc-1</version>
<packaging>pom</packaging>
<name>Protocol Buffers [BOM]</name>

@ -4,7 +4,7 @@
<parent>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-parent</artifactId>
<version>3.19.4</version>
<version>3.20.0-rc-1</version>
</parent>
<artifactId>protobuf-java</artifactId>

@ -996,8 +996,6 @@ public abstract class CodedOutputStream extends ByteOutput {
writeLazy(bytes, 0, bytes.length);
} catch (IndexOutOfBoundsException e) {
throw new OutOfSpaceException(e);
} catch (OutOfSpaceException e) {
throw e;
}
}
@ -1345,49 +1343,19 @@ public abstract class CodedOutputStream extends ByteOutput {
@Override
public final void writeUInt32NoTag(int value) throws IOException {
if (HAS_UNSAFE_ARRAY_OPERATIONS
&& !Android.isOnAndroidDevice()
&& spaceLeft() >= MAX_VARINT32_SIZE) {
if ((value & ~0x7F) == 0) {
UnsafeUtil.putByte(buffer, position++, (byte) value);
return;
}
UnsafeUtil.putByte(buffer, position++, (byte) (value | 0x80));
value >>>= 7;
if ((value & ~0x7F) == 0) {
UnsafeUtil.putByte(buffer, position++, (byte) value);
return;
}
UnsafeUtil.putByte(buffer, position++, (byte) (value | 0x80));
value >>>= 7;
if ((value & ~0x7F) == 0) {
UnsafeUtil.putByte(buffer, position++, (byte) value);
return;
}
UnsafeUtil.putByte(buffer, position++, (byte) (value | 0x80));
value >>>= 7;
if ((value & ~0x7F) == 0) {
UnsafeUtil.putByte(buffer, position++, (byte) value);
return;
}
UnsafeUtil.putByte(buffer, position++, (byte) (value | 0x80));
value >>>= 7;
UnsafeUtil.putByte(buffer, position++, (byte) value);
} else {
try {
while (true) {
if ((value & ~0x7F) == 0) {
buffer[position++] = (byte) value;
return;
} else {
buffer[position++] = (byte) ((value & 0x7F) | 0x80);
value >>>= 7;
}
try {
while (true) {
if ((value & ~0x7F) == 0) {
buffer[position++] = (byte) value;
return;
} else {
buffer[position++] = (byte) ((value & 0x7F) | 0x80);
value >>>= 7;
}
} catch (IndexOutOfBoundsException e) {
throw new OutOfSpaceException(
String.format("Pos: %d, limit: %d, len: %d", position, limit, 1), e);
}
} catch (IndexOutOfBoundsException e) {
throw new OutOfSpaceException(
String.format("Pos: %d, limit: %d, len: %d", position, limit, 1), e);
}
}

@ -76,7 +76,7 @@ public class LazyStringEndToEndTest {
ByteString bytes = tV2.toByteString();
assertThat(bytes).isEqualTo(TEST_ALL_TYPES_SERIALIZED_WITH_ILLEGAL_UTF8);
tV2.getOptionalString();
String unused = tV2.getOptionalString();
bytes = tV2.toByteString();
assertThat(bytes).isEqualTo(TEST_ALL_TYPES_SERIALIZED_WITH_ILLEGAL_UTF8);
}

@ -337,7 +337,7 @@ public class MessageTest {
/** Test reading unset repeated message from DynamicMessage. */
@Test
public void testDynamicRepeatedMessageNull() throws Exception {
TestRequired.getDescriptor();
Descriptors.Descriptor unused = TestRequired.getDescriptor();
DynamicMessage result =
DynamicMessage.newBuilder(TestAllTypes.getDescriptor())
.mergeFrom(DynamicMessage.newBuilder(MERGE_SOURCE).build())
@ -365,7 +365,7 @@ public class MessageTest {
.addRepeatedForeignMessage(ForeignMessage.getDefaultInstance())
.addRepeatedForeignMessage(ForeignMessage.getDefaultInstance())
.build();
TestRequired.getDescriptor();
Descriptors.Descriptor unused = TestRequired.getDescriptor();
DynamicMessage result =
DynamicMessage.newBuilder(TestAllTypes.getDescriptor())
.mergeFrom(DynamicMessage.newBuilder(repeatedNested).build())

@ -251,7 +251,4 @@ public class ServiceTest {
assertThat(file.getServices().get(0).getMethods()).hasSize(1);
assertThat(file.getServices().get(0).getMethods().get(0).getName()).isEqualTo("Foo");
}
// =================================================================
}

@ -49,6 +49,7 @@ public class TestBadIdentifiers extends TestCase {
TestBadIdentifiersProto.Override.getDefaultInstance();
}
@SuppressWarnings("IgnoredPureGetter") // TODO(b/221602772): Fix this
public void testGetDescriptor() {
TestBadIdentifiersProto.getDescriptor();
TestBadIdentifiersProto.Descriptor.getDefaultInstance().getDescriptor();

@ -4,7 +4,7 @@
<parent>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-parent</artifactId>
<version>3.19.4</version>
<version>3.20.0-rc-1</version>
</parent>
<artifactId>protobuf-kotlin-lite</artifactId>

@ -4,7 +4,7 @@
<parent>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-parent</artifactId>
<version>3.19.4</version>
<version>3.20.0-rc-1</version>
</parent>
<artifactId>protobuf-kotlin</artifactId>

@ -4,33 +4,32 @@ Copyright 2008 Google Inc.
https://developers.google.com/protocol-buffers/
## Use Protobuf Java Lite Runtime
## Use the Protobuf Java Lite Runtime
Protobuf Java Lite runtime is separated from the main Java runtime because
it's designed/implemented with different constraints. In particular, Java
Lite runtime has a much smaller code size which makes it more suitable to
be used on Android.
The Protobuf Java Lite runtime is separated from the main Java runtime because
it's designed and implemented with different constraints. In particular, the Java
Lite runtime is much smaller which makes it more suitable to be used on Android.
Note that in order to achieve maximum performance and code size, we will
In order to achieve maximum performance and code size, we do
NOT guarantee API/ABI stability for Java Lite. If this is not acceptable
for your use-case, please use the full Java runtime instead. Note that
for your use-case, use the full Java runtime instead. Note that
the latest version of Java Lite is not compatible with the 3.0.0 version.
You can generate Java Lite code for your .proto files:
$ protoc --java_out=lite:${OUTPUT_DIR} path/to/your/proto/file
Note that "optimize_for = LITE_RUNTIME" option in proto file is deprecated
and will not have any effect any more.
The "optimize_for = LITE_RUNTIME" option in the .proto file no longer has any
effect on Java code.
Include the generated Java files in your project and add a dependency on the
protobuf Java runtime. If you are using Maven, use the following:
protobuf Java Lite runtime. If you are using Maven, include the following:
```xml
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-javalite</artifactId>
<version>3.19.4</version>
<version>3.20.0-rc-1</version>
</dependency>
```

@ -4,7 +4,7 @@
<parent>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-parent</artifactId>
<version>3.19.4</version>
<version>3.20.0-rc-1</version>
</parent>
<artifactId>protobuf-javalite</artifactId>

@ -4,7 +4,7 @@
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-parent</artifactId>
<version>3.19.4</version>
<version>3.20.0-rc-1</version>
<packaging>pom</packaging>
<name>Protocol Buffers [Parent]</name>

@ -68,6 +68,7 @@ junit_tests(
":util",
"//java/core",
"//java/core:generic_test_protos_java_proto",
"@maven//:com_google_code_gson_gson",
"@maven//:com_google_guava_guava",
"@maven//:com_google_truth_truth",
"@maven//:junit_junit",

@ -4,7 +4,7 @@
<parent>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-parent</artifactId>
<version>3.19.4</version>
<version>3.20.0-rc-1</version>
</parent>
<artifactId>protobuf-java-util</artifactId>

@ -1,6 +1,6 @@
{
"name": "google-protobuf",
"version": "3.19.4",
"version": "3.20.0-rc.1",
"description": "Protocol Buffers for JavaScript",
"main": "google-protobuf.js",
"files": [

@ -4,6 +4,8 @@
#import "GPBDescriptor.h"
#import "GPBMessage.h"
#import "GPBRootObject.h"
#import "GPBSourceContext.pbobjc.h"
#import "GPBType.pbobjc.h"
#if GOOGLE_PROTOBUF_OBJC_VERSION < 30004
#error This file was generated by a newer version of protoc which is incompatible with your Protocol Buffer library sources.
@ -21,9 +23,6 @@ CF_EXTERN_C_BEGIN
@class GPBMethod;
@class GPBMixin;
@class GPBOption;
@class GPBSourceContext;
GPB_ENUM_FWD_DECLARE(GPBSyntax);
NS_ASSUME_NONNULL_BEGIN

@ -3,8 +3,6 @@
#import "GPBProtocolBuffers_RuntimeSupport.h"
#import "GPBApi.pbobjc.h"
#import "GPBSourceContext.pbobjc.h"
#import "GPBType.pbobjc.h"
// @@protoc_insertion_point(imports)

@ -4,6 +4,8 @@
#import "GPBDescriptor.h"
#import "GPBMessage.h"
#import "GPBRootObject.h"
#import "GPBAny.pbobjc.h"
#import "GPBSourceContext.pbobjc.h"
#if GOOGLE_PROTOBUF_OBJC_VERSION < 30004
#error This file was generated by a newer version of protoc which is incompatible with your Protocol Buffer library sources.
@ -19,11 +21,9 @@
CF_EXTERN_C_BEGIN
@class GPBAny;
@class GPBEnumValue;
@class GPBField;
@class GPBOption;
@class GPBSourceContext;
NS_ASSUME_NONNULL_BEGIN

@ -3,8 +3,6 @@
#import "GPBProtocolBuffers_RuntimeSupport.h"
#import "GPBType.pbobjc.h"
#import "GPBAny.pbobjc.h"
#import "GPBSourceContext.pbobjc.h"
#import <stdatomic.h>

@ -182,7 +182,7 @@ supported keys are:
having to add the runtime directory to the header search path since the
generate `#import` will be more complete.
* `package_to_prefix_mappings_path`: The `value` used for this key is a
* `package_to_prefix_mappings_path`: The `value` used for this key is a
path to a file containing a list of proto packages and prefixes.
The generator will use this to locate which ObjC class prefix to use when
generating sources _unless_ the `objc_class_prefix` file option is set.
@ -218,6 +218,21 @@ supported keys are:
helps prepare folks before they end up using a lot of protos and getting a
lot of collisions.
* `headers_use_forward_declarations`: The `value` for this can be `yes` or
`no`, and indicates if the generated headers use forward declarations for
Message and Enum types from other .proto files or if the files should be
imported into the generated header instead.
By using forward declarations, less code is likely to recompile when the
files do change, but Swift generally doesn't like forward declarations and
will fail to include properties when the concrete definition of the type is
known at import time. If your proto usages span modules, this can be a
problem.
`headers_use_forward_declarations` currently defaults to `yes` (existing
behavior), but in a future release, that default may change to provide
better Swift support by default.
Contributing
------------

@ -38,7 +38,7 @@
typedef struct Arena {
zend_object std;
upb_arena* arena;
upb_Arena* arena;
} Arena;
zend_class_entry *Arena_class_entry;
@ -50,14 +50,14 @@ static zend_object* Arena_Create(zend_class_entry *class_type) {
Arena *intern = emalloc(sizeof(Arena));
zend_object_std_init(&intern->std, class_type);
intern->std.handlers = &Arena_object_handlers;
intern->arena = upb_arena_new();
intern->arena = upb_Arena_New();
// Skip object_properties_init(), we don't allow derived classes.
return &intern->std;
}
static void Arena_Free(zend_object* obj) {
Arena* intern = (Arena*)obj;
upb_arena_free(intern->arena);
upb_Arena_Free(intern->arena);
zend_object_std_dtor(&intern->std);
}
@ -67,7 +67,7 @@ void Arena_Init(zval* val) {
ZVAL_OBJ(val, Arena_Create(Arena_class_entry));
}
upb_arena *Arena_Get(zval *val) {
upb_Arena *Arena_Get(zval *val) {
Arena *a = (Arena*)Z_OBJ_P(val);
return a->arena;
}

@ -38,10 +38,10 @@
// Registers the PHP Arena class.
void Arena_ModuleInit();
// Creates and returns a new arena object that wraps a new upb_arena*.
// Creates and returns a new arena object that wraps a new upb_Arena*.
void Arena_Init(zval *val);
// Gets the underlying upb_arena from this arena object.
upb_arena *Arena_Get(zval *arena);
// Gets the underlying upb_Arena from this arena object.
upb_Arena *Arena_Get(zval *arena);
#endif // PHP_PROTOBUF_ARENA_H_

@ -54,7 +54,7 @@ static void RepeatedFieldIter_make(zval *val, zval *repeated_field);
typedef struct {
zend_object std;
zval arena;
upb_array *array;
upb_Array *array;
TypeInfo type;
} RepeatedField;
@ -120,14 +120,14 @@ static int RepeatedField_compare_objects(zval *rf1, zval *rf2) {
*/
static zend_object *RepeatedField_clone_obj(PROTO_VAL *object) {
RepeatedField* intern = PROTO_VAL_P(object);
upb_arena *arena = Arena_Get(&intern->arena);
upb_array *clone = upb_array_new(arena, intern->type.type);
size_t n = upb_array_size(intern->array);
upb_Arena *arena = Arena_Get(&intern->arena);
upb_Array *clone = upb_Array_New(arena, intern->type.type);
size_t n = upb_Array_Size(intern->array);
size_t i;
for (i = 0; i < n; i++) {
upb_msgval msgval = upb_array_get(intern->array, i);
upb_array_append(clone, msgval, arena);
upb_MessageValue msgval = upb_Array_Get(intern->array, i);
upb_Array_Append(clone, msgval, arena);
}
zval ret;
@ -149,7 +149,7 @@ static zval *RepeatedField_GetPropertyPtrPtr(PROTO_VAL *object,
// These are documented in the header file.
void RepeatedField_GetPhpWrapper(zval *val, upb_array *arr, TypeInfo type,
void RepeatedField_GetPhpWrapper(zval *val, upb_Array *arr, TypeInfo type,
zval *arena) {
if (!arr) {
ZVAL_NULL(val);
@ -169,15 +169,15 @@ void RepeatedField_GetPhpWrapper(zval *val, upb_array *arr, TypeInfo type,
}
}
upb_array *RepeatedField_GetUpbArray(zval *val, TypeInfo type,
upb_arena *arena) {
upb_Array *RepeatedField_GetUpbArray(zval *val, TypeInfo type,
upb_Arena *arena) {
if (Z_ISREF_P(val)) {
ZVAL_DEREF(val);
}
if (Z_TYPE_P(val) == IS_ARRAY) {
// Auto-construct, eg. [1, 2, 3] -> upb_array([1, 2, 3]).
upb_array *arr = upb_array_new(arena, type.type);
// Auto-construct, eg. [1, 2, 3] -> upb_Array([1, 2, 3]).
upb_Array *arr = upb_Array_New(arena, type.type);
HashTable *table = HASH_OF(val);
HashPosition pos;
@ -185,7 +185,7 @@ upb_array *RepeatedField_GetUpbArray(zval *val, TypeInfo type,
while (true) {
zval *zv = zend_hash_get_current_data_ex(table, &pos);
upb_msgval val;
upb_MessageValue val;
if (!zv) return arr;
@ -193,12 +193,12 @@ upb_array *RepeatedField_GetUpbArray(zval *val, TypeInfo type,
return NULL;
}
upb_array_append(arr, val, arena);
upb_Array_Append(arr, val, arena);
zend_hash_move_forward_ex(table, &pos);
}
} else if (Z_TYPE_P(val) == IS_OBJECT &&
Z_OBJCE_P(val) == RepeatedField_class_entry) {
// Unwrap existing RepeatedField object to get the upb_array* inside.
// Unwrap existing RepeatedField object to get the upb_Array* inside.
RepeatedField *intern = (RepeatedField*)Z_OBJ_P(val);
if (!TypeInfo_Eq(intern->type, type)) {
@ -206,7 +206,7 @@ upb_array *RepeatedField_GetUpbArray(zval *val, TypeInfo type,
"Wrong type for this repeated field.");
}
upb_arena_fuse(arena, Arena_Get(&intern->arena));
upb_Arena_Fuse(arena, Arena_Get(&intern->arena));
return intern->array;
} else {
php_error_docref(NULL, E_USER_ERROR, "Must be a repeated field");
@ -214,19 +214,19 @@ upb_array *RepeatedField_GetUpbArray(zval *val, TypeInfo type,
}
}
bool ArrayEq(const upb_array *a1, const upb_array *a2, TypeInfo type) {
bool ArrayEq(const upb_Array *a1, const upb_Array *a2, TypeInfo type) {
size_t i;
size_t n;
if ((a1 == NULL) != (a2 == NULL)) return false;
if (a1 == NULL) return true;
n = upb_array_size(a1);
if (n != upb_array_size(a2)) return false;
n = upb_Array_Size(a1);
if (n != upb_Array_Size(a2)) return false;
for (i = 0; i < n; i++) {
upb_msgval val1 = upb_array_get(a1, i);
upb_msgval val2 = upb_array_get(a2, i);
upb_MessageValue val1 = upb_Array_Get(a1, i);
upb_MessageValue val2 = upb_Array_Get(a2, i);
if (!ValueEq(val1, val2, type)) return false;
}
@ -245,7 +245,7 @@ bool ArrayEq(const upb_array *a1, const upb_array *a2, TypeInfo type) {
*/
PHP_METHOD(RepeatedField, __construct) {
RepeatedField *intern = (RepeatedField*)Z_OBJ_P(getThis());
upb_arena *arena = Arena_Get(&intern->arena);
upb_Arena *arena = Arena_Get(&intern->arena);
zend_long type;
zend_class_entry* klass = NULL;
@ -256,13 +256,13 @@ PHP_METHOD(RepeatedField, __construct) {
intern->type.type = pbphp_dtype_to_type(type);
intern->type.desc = Descriptor_GetFromClassEntry(klass);
if (intern->type.type == UPB_TYPE_MESSAGE && klass == NULL) {
if (intern->type.type == kUpb_CType_Message && klass == NULL) {
php_error_docref(NULL, E_USER_ERROR,
"Message/enum type must have concrete class.");
return;
}
intern->array = upb_array_new(arena, intern->type.type);
intern->array = upb_Array_New(arena, intern->type.type);
ObjCache_Add(intern->array, &intern->std);
}
@ -274,16 +274,16 @@ PHP_METHOD(RepeatedField, __construct) {
*/
PHP_METHOD(RepeatedField, append) {
RepeatedField *intern = (RepeatedField*)Z_OBJ_P(getThis());
upb_arena *arena = Arena_Get(&intern->arena);
upb_Arena *arena = Arena_Get(&intern->arena);
zval *php_val;
upb_msgval msgval;
upb_MessageValue msgval;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &php_val) != SUCCESS ||
!Convert_PhpToUpb(php_val, &msgval, intern->type, arena)) {
return;
}
upb_array_append(intern->array, msgval, arena);
upb_Array_Append(intern->array, msgval, arena);
}
/**
@ -305,7 +305,7 @@ PHP_METHOD(RepeatedField, offsetExists) {
return;
}
RETURN_BOOL(index >= 0 && index < upb_array_size(intern->array));
RETURN_BOOL(index >= 0 && index < upb_Array_Size(intern->array));
}
/**
@ -323,19 +323,19 @@ PHP_METHOD(RepeatedField, offsetExists) {
PHP_METHOD(RepeatedField, offsetGet) {
RepeatedField *intern = (RepeatedField*)Z_OBJ_P(getThis());
zend_long index;
upb_msgval msgval;
upb_MessageValue msgval;
zval ret;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &index) == FAILURE) {
return;
}
if (index < 0 || index >= upb_array_size(intern->array)) {
if (index < 0 || index >= upb_Array_Size(intern->array)) {
zend_error(E_USER_ERROR, "Element at %ld doesn't exist.\n", index);
return;
}
msgval = upb_array_get(intern->array, index);
msgval = upb_Array_Get(intern->array, index);
Convert_UpbToPhp(msgval, &ret, intern->type, &intern->arena);
RETURN_COPY_VALUE(&ret);
}
@ -356,11 +356,11 @@ PHP_METHOD(RepeatedField, offsetGet) {
*/
PHP_METHOD(RepeatedField, offsetSet) {
RepeatedField *intern = (RepeatedField*)Z_OBJ_P(getThis());
upb_arena *arena = Arena_Get(&intern->arena);
size_t size = upb_array_size(intern->array);
upb_Arena *arena = Arena_Get(&intern->arena);
size_t size = upb_Array_Size(intern->array);
zval *offset, *val;
int64_t index;
upb_msgval msgval;
upb_MessageValue msgval;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "zz", &offset, &val) != SUCCESS) {
return;
@ -379,9 +379,9 @@ PHP_METHOD(RepeatedField, offsetSet) {
if (index > size) {
zend_error(E_USER_ERROR, "Element at index %ld doesn't exist.\n", index);
} else if (index == size) {
upb_array_append(intern->array, msgval, Arena_Get(&intern->arena));
upb_Array_Append(intern->array, msgval, Arena_Get(&intern->arena));
} else {
upb_array_set(intern->array, index, msgval);
upb_Array_Set(intern->array, index, msgval);
}
}
@ -399,7 +399,7 @@ PHP_METHOD(RepeatedField, offsetSet) {
PHP_METHOD(RepeatedField, offsetUnset) {
RepeatedField *intern = (RepeatedField*)Z_OBJ_P(getThis());
zend_long index;
zend_long size = upb_array_size(intern->array);
zend_long size = upb_Array_Size(intern->array);
// Only the element at the end of the array can be removed.
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &index) != SUCCESS) {
@ -412,7 +412,7 @@ PHP_METHOD(RepeatedField, offsetUnset) {
return;
}
upb_array_resize(intern->array, size - 1, Arena_Get(&intern->arena));
upb_Array_Resize(intern->array, size - 1, Arena_Get(&intern->arena));
}
/**
@ -432,7 +432,7 @@ PHP_METHOD(RepeatedField, count) {
return;
}
RETURN_LONG(upb_array_size(intern->array));
RETURN_LONG(upb_Array_Size(intern->array));
}
/**
@ -581,16 +581,16 @@ PHP_METHOD(RepeatedFieldIter, rewind) {
PHP_METHOD(RepeatedFieldIter, current) {
RepeatedFieldIter *intern = (RepeatedFieldIter*)Z_OBJ_P(getThis());
RepeatedField *field = (RepeatedField*)Z_OBJ_P(&intern->repeated_field);
upb_array *array = field->array;
upb_Array *array = field->array;
zend_long index = intern->position;
upb_msgval msgval;
upb_MessageValue msgval;
zval ret;
if (index < 0 || index >= upb_array_size(array)) {
if (index < 0 || index >= upb_Array_Size(array)) {
zend_error(E_USER_ERROR, "Element at %ld doesn't exist.\n", index);
}
msgval = upb_array_get(array, index);
msgval = upb_Array_Get(array, index);
Convert_UpbToPhp(msgval, &ret, field->type, &field->arena);
RETURN_COPY_VALUE(&ret);
@ -624,7 +624,7 @@ PHP_METHOD(RepeatedFieldIter, next) {
PHP_METHOD(RepeatedFieldIter, valid) {
RepeatedFieldIter *intern = (RepeatedFieldIter*)Z_OBJ_P(getThis());
RepeatedField *field = (RepeatedField*)Z_OBJ_P(&intern->repeated_field);
RETURN_BOOL(intern->position < upb_array_size(field->array));
RETURN_BOOL(intern->position < upb_Array_Size(field->array));
}
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_current, 0, 0, IS_MIXED, 0)

@ -39,29 +39,29 @@
// Registers PHP classes for RepeatedField.
void Array_ModuleInit();
// Gets a upb_array* for the PHP object |val|:
// Gets a upb_Array* for the PHP object |val|:
// * If |val| is a RepeatedField object, we first check its type and verify
// that that the elements have the correct type for |type|. If so, we return
// the wrapped upb_array*. We also make sure that this array's arena is fused
// to |arena|, so the returned upb_array is guaranteed to live as long as
// the wrapped upb_Array*. We also make sure that this array's arena is fused
// to |arena|, so the returned upb_Array is guaranteed to live as long as
// |arena|.
// * If |val| is a PHP Array, we attempt to create a new upb_array using
// * If |val| is a PHP Array, we attempt to create a new upb_Array using
// |arena| and add all of the PHP elements to it.
//
// If an error occurs, we raise a PHP error and return NULL.
upb_array *RepeatedField_GetUpbArray(zval *val, TypeInfo type,
upb_arena *arena);
upb_Array *RepeatedField_GetUpbArray(zval *val, TypeInfo type,
upb_Arena *arena);
// Creates a PHP RepeatedField object for the given upb_array* and |type| and
// Creates a PHP RepeatedField object for the given upb_Array* and |type| and
// returns it in |val|. The PHP object will keep a reference to this |arena| to
// ensure the underlying array data stays alive.
//
// If |arr| is NULL, this will return a PHP null object.
void RepeatedField_GetPhpWrapper(zval *val, upb_array *arr, TypeInfo type,
void RepeatedField_GetPhpWrapper(zval *val, upb_Array *arr, TypeInfo type,
zval *arena);
// Returns true if the given arrays are equal. Both arrays must be of this
// |type| and, if the type is |UPB_TYPE_MESSAGE|, must have the same |m|.
bool ArrayEq(const upb_array *a1, const upb_array *a2, TypeInfo type);
// |type| and, if the type is |kUpb_CType_Message|, must have the same |m|.
bool ArrayEq(const upb_Array *a1, const upb_Array *a2, TypeInfo type);
#endif // PHP_PROTOBUF_ARRAY_H_

@ -4,7 +4,7 @@ if test "$PHP_PROTOBUF" != "no"; then
PHP_NEW_EXTENSION(
protobuf,
arena.c array.c convert.c def.c map.c message.c names.c php-upb.c protobuf.c,
arena.c array.c convert.c def.c map.c message.c names.c php-upb.c protobuf.c third_party/utf8_range/naive.c third_party/utf8_range/range2-neon.c third_party/utf8_range/range2-sse.c,
$ext_shared, , -std=gnu99)
fi

@ -153,30 +153,30 @@ static zend_function_entry util_methods[] = {
// Conversion functions used from C
// -----------------------------------------------------------------------------
upb_fieldtype_t pbphp_dtype_to_type(upb_descriptortype_t type) {
upb_CType pbphp_dtype_to_type(upb_FieldType type) {
switch (type) {
#define CASE(descriptor_type, type) \
case UPB_DESCRIPTOR_TYPE_##descriptor_type: \
return UPB_TYPE_##type;
CASE(FLOAT, FLOAT);
CASE(DOUBLE, DOUBLE);
CASE(BOOL, BOOL);
CASE(STRING, STRING);
CASE(BYTES, BYTES);
CASE(MESSAGE, MESSAGE);
CASE(GROUP, MESSAGE);
CASE(ENUM, ENUM);
CASE(INT32, INT32);
CASE(INT64, INT64);
CASE(UINT32, UINT32);
CASE(UINT64, UINT64);
CASE(SINT32, INT32);
CASE(SINT64, INT64);
CASE(FIXED32, UINT32);
CASE(FIXED64, UINT64);
CASE(SFIXED32, INT32);
CASE(SFIXED64, INT64);
case kUpb_FieldType_##descriptor_type: \
return kUpb_CType_##type;
CASE(Float, Float);
CASE(Double, Double);
CASE(Bool, Bool);
CASE(String, String);
CASE(Bytes, Bytes);
CASE(Message, Message);
CASE(Group, Message);
CASE(Enum, Enum);
CASE(Int32, Int32);
CASE(Int64, Int64);
CASE(UInt32, Int32);
CASE(UInt64, UInt64);
CASE(SInt32, Int32);
CASE(SInt64, Int64);
CASE(Fixed32, UInt32);
CASE(Fixed64, UInt64);
CASE(SFixed32, Int32);
CASE(SFixed64, Int64);
#undef CASE
@ -353,8 +353,8 @@ static bool to_string(zval* from) {
}
}
bool Convert_PhpToUpb(zval *php_val, upb_msgval *upb_val, TypeInfo type,
upb_arena *arena) {
bool Convert_PhpToUpb(zval *php_val, upb_MessageValue *upb_val, TypeInfo type,
upb_Arena *arena) {
int64_t i64;
if (Z_ISREF_P(php_val)) {
@ -362,37 +362,37 @@ bool Convert_PhpToUpb(zval *php_val, upb_msgval *upb_val, TypeInfo type,
}
switch (type.type) {
case UPB_TYPE_INT64:
case kUpb_CType_Int64:
return Convert_PhpToInt64(php_val, &upb_val->int64_val);
case UPB_TYPE_INT32:
case UPB_TYPE_ENUM:
case kUpb_CType_Int32:
case kUpb_CType_Enum:
if (!Convert_PhpToInt64(php_val, &i64)) {
return false;
}
upb_val->int32_val = i64;
return true;
case UPB_TYPE_UINT64:
case kUpb_CType_UInt64:
if (!Convert_PhpToInt64(php_val, &i64)) {
return false;
}
upb_val->uint64_val = i64;
return true;
case UPB_TYPE_UINT32:
case kUpb_CType_UInt32:
if (!Convert_PhpToInt64(php_val, &i64)) {
return false;
}
upb_val->uint32_val = i64;
return true;
case UPB_TYPE_DOUBLE:
case kUpb_CType_Double:
return to_double(php_val, &upb_val->double_val);
case UPB_TYPE_FLOAT:
case kUpb_CType_Float:
if (!to_double(php_val, &upb_val->double_val)) return false;
upb_val->float_val = upb_val->double_val;
return true;
case UPB_TYPE_BOOL:
case kUpb_CType_Bool:
return to_bool(php_val, &upb_val->bool_val);
case UPB_TYPE_STRING:
case UPB_TYPE_BYTES: {
case kUpb_CType_String:
case kUpb_CType_Bytes: {
char *ptr;
size_t size;
@ -401,30 +401,30 @@ bool Convert_PhpToUpb(zval *php_val, upb_msgval *upb_val, TypeInfo type,
size = Z_STRLEN_P(php_val);
// If arena is NULL we reference the input zval.
// The resulting upb_strview will only be value while the zval is alive.
// The resulting upb_StringView will only be value while the zval is alive.
if (arena) {
ptr = upb_arena_malloc(arena, size);
ptr = upb_Arena_Malloc(arena, size);
memcpy(ptr, Z_STRVAL_P(php_val), size);
} else {
ptr = Z_STRVAL_P(php_val);
}
upb_val->str_val = upb_strview_make(ptr, size);
upb_val->str_val = upb_StringView_FromDataAndSize(ptr, size);
return true;
}
case UPB_TYPE_MESSAGE:
case kUpb_CType_Message:
PBPHP_ASSERT(type.desc);
return Message_GetUpbMessage(php_val, type.desc, arena,
(upb_msg **)&upb_val->msg_val);
(upb_Message **)&upb_val->msg_val);
}
return false;
}
void Convert_UpbToPhp(upb_msgval upb_val, zval *php_val, TypeInfo type,
void Convert_UpbToPhp(upb_MessageValue upb_val, zval *php_val, TypeInfo type,
zval *arena) {
switch (type.type) {
case UPB_TYPE_INT64:
case kUpb_CType_Int64:
#if SIZEOF_ZEND_LONG == 8
ZVAL_LONG(php_val, upb_val.int64_val);
#else
@ -435,7 +435,7 @@ void Convert_UpbToPhp(upb_msgval upb_val, zval *php_val, TypeInfo type,
}
#endif
break;
case UPB_TYPE_UINT64:
case kUpb_CType_UInt64:
#if SIZEOF_ZEND_LONG == 8
ZVAL_LONG(php_val, upb_val.uint64_val);
#else
@ -446,51 +446,70 @@ void Convert_UpbToPhp(upb_msgval upb_val, zval *php_val, TypeInfo type,
}
#endif
break;
case UPB_TYPE_INT32:
case UPB_TYPE_ENUM:
case kUpb_CType_Int32:
case kUpb_CType_Enum:
ZVAL_LONG(php_val, upb_val.int32_val);
break;
case UPB_TYPE_UINT32: {
case kUpb_CType_UInt32: {
// Sign-extend for consistency between 32/64-bit builds.
zend_long val = (int32_t)upb_val.uint32_val;
ZVAL_LONG(php_val, val);
break;
}
case UPB_TYPE_DOUBLE:
case kUpb_CType_Double:
ZVAL_DOUBLE(php_val, upb_val.double_val);
break;
case UPB_TYPE_FLOAT:
case kUpb_CType_Float:
ZVAL_DOUBLE(php_val, upb_val.float_val);
break;
case UPB_TYPE_BOOL:
case kUpb_CType_Bool:
ZVAL_BOOL(php_val, upb_val.bool_val);
break;
case UPB_TYPE_STRING:
case UPB_TYPE_BYTES: {
upb_strview str = upb_val.str_val;
case kUpb_CType_String:
case kUpb_CType_Bytes: {
upb_StringView str = upb_val.str_val;
ZVAL_NEW_STR(php_val, zend_string_init(str.data, str.size, 0));
break;
}
case UPB_TYPE_MESSAGE:
case kUpb_CType_Message:
PBPHP_ASSERT(type.desc);
Message_GetPhpWrapper(php_val, type.desc, (upb_msg *)upb_val.msg_val,
Message_GetPhpWrapper(php_val, type.desc, (upb_Message *)upb_val.msg_val,
arena);
break;
}
}
bool Convert_PhpToUpbAutoWrap(zval *val, upb_msgval *upb_val, TypeInfo type,
upb_arena *arena) {
const upb_msgdef *subm = type.desc ? type.desc->msgdef : NULL;
if (subm && upb_msgdef_iswrapper(subm) && Z_TYPE_P(val) != IS_OBJECT) {
// Check if the field is a well known wrapper type
static bool IsWrapper(const upb_MessageDef* m) {
if (!m) return false;
switch (upb_MessageDef_WellKnownType(m)) {
case kUpb_WellKnown_DoubleValue:
case kUpb_WellKnown_FloatValue:
case kUpb_WellKnown_Int64Value:
case kUpb_WellKnown_UInt64Value:
case kUpb_WellKnown_Int32Value:
case kUpb_WellKnown_UInt32Value:
case kUpb_WellKnown_StringValue:
case kUpb_WellKnown_BytesValue:
case kUpb_WellKnown_BoolValue:
return true;
default:
return false;
}
}
bool Convert_PhpToUpbAutoWrap(zval *val, upb_MessageValue *upb_val, TypeInfo type,
upb_Arena *arena) {
const upb_MessageDef *subm = type.desc ? type.desc->msgdef : NULL;
if (subm && IsWrapper(subm) && Z_TYPE_P(val) != IS_OBJECT) {
// Assigning a scalar to a wrapper-typed value. We will automatically wrap
// the value, so the user doesn't need to create a FooWrapper(['value': X])
// message manually.
upb_msg *wrapper = upb_msg_new(subm, arena);
const upb_fielddef *val_f = upb_msgdef_itof(subm, 1);
upb_msgval msgval;
upb_Message *wrapper = upb_Message_New(subm, arena);
const upb_FieldDef *val_f = upb_MessageDef_FindFieldByNumber(subm, 1);
upb_MessageValue msgval;
if (!Convert_PhpToUpb(val, &msgval, TypeInfo_Get(val_f), arena)) return false;
upb_msg_set(wrapper, val_f, msgval, arena);
upb_Message_Set(wrapper, val_f, msgval, arena);
upb_val->msg_val = wrapper;
return true;
} else {

@ -36,18 +36,18 @@
#include "php-upb.h"
#include "def.h"
upb_fieldtype_t pbphp_dtype_to_type(upb_descriptortype_t type);
upb_CType pbphp_dtype_to_type(upb_FieldType type);
// Converts |php_val| to an int64_t. Returns false if the value cannot be
// converted.
bool Convert_PhpToInt64(const zval *php_val, int64_t *i64);
// Converts |php_val| to a upb_msgval according to |type|. If type is
// UPB_TYPE_MESSAGE, then |desc| must be the Descriptor for this message type.
// Converts |php_val| to a upb_MessageValue according to |type|. If type is
// kUpb_CType_Message, then |desc| must be the Descriptor for this message type.
// If type is string, message, or bytes, then |arena| will be used to copy
// string data or fuse this arena to the given message's arena.
bool Convert_PhpToUpb(zval *php_val, upb_msgval *upb_val, TypeInfo type,
upb_arena *arena);
bool Convert_PhpToUpb(zval *php_val, upb_MessageValue *upb_val, TypeInfo type,
upb_Arena *arena);
// Similar to Convert_PhpToUpb, but supports automatically wrapping the wrapper
// types if a primitive is specified:
@ -56,15 +56,15 @@ bool Convert_PhpToUpb(zval *php_val, upb_msgval *upb_val, TypeInfo type,
//
// We currently allow this implicit conversion in initializers, but not for
// assignment.
bool Convert_PhpToUpbAutoWrap(zval *val, upb_msgval *upb_val, TypeInfo type,
upb_arena *arena);
bool Convert_PhpToUpbAutoWrap(zval *val, upb_MessageValue *upb_val, TypeInfo type,
upb_Arena *arena);
// Converts |upb_val| to a PHP zval according to |type|. This may involve
// creating a PHP wrapper object. Any newly created wrapper object
// will reference |arena|.
//
// The caller owns a reference to the returned value.
void Convert_UpbToPhp(upb_msgval upb_val, zval *php_val, TypeInfo type,
void Convert_UpbToPhp(upb_MessageValue upb_val, zval *php_val, TypeInfo type,
zval *arena);
// Registers the GPBUtil class.

@ -39,13 +39,13 @@
#include "php-upb.h"
#include "protobuf.h"
static void CheckUpbStatus(const upb_status* status, const char* msg) {
if (!upb_ok(status)) {
zend_error(E_ERROR, "%s: %s\n", msg, upb_status_errmsg(status));
static void CheckUpbStatus(const upb_Status* status, const char* msg) {
if (!upb_Status_IsOk(status)) {
zend_error(E_ERROR, "%s: %s\n", msg, upb_Status_ErrorMessage(status));
}
}
static void FieldDescriptor_FromFieldDef(zval *val, const upb_fielddef *f);
static void FieldDescriptor_FromFieldDef(zval *val, const upb_FieldDef *f);
// We use this for objects that should not be created directly from PHP.
static zend_object *CreateHandler_ReturnNull(zend_class_entry *class_type) {
@ -117,7 +117,7 @@ static zend_function_entry EnumValueDescriptor_methods[] = {
typedef struct {
zend_object std;
const upb_enumdef *enumdef;
const upb_EnumDef *enumdef;
void *cache_key;
} EnumDescriptor;
@ -141,7 +141,7 @@ static void EnumDescriptor_FromClassEntry(zval *val, zend_class_entry *ce) {
}
if (!ObjCache_Get(key, val)) {
const upb_enumdef *e = NameMap_GetEnum(ce);
const upb_EnumDef *e = NameMap_GetEnum(ce);
if (!e) {
ZVAL_NULL(val);
return;
@ -157,12 +157,12 @@ static void EnumDescriptor_FromClassEntry(zval *val, zend_class_entry *ce) {
}
// Caller owns a ref on the returned zval.
static void EnumDescriptor_FromEnumDef(zval *val, const upb_enumdef *m) {
static void EnumDescriptor_FromEnumDef(zval *val, const upb_EnumDef *m) {
if (!m) {
ZVAL_NULL(val);
} else {
char *classname =
GetPhpClassname(upb_enumdef_file(m), upb_enumdef_fullname(m));
GetPhpClassname(upb_EnumDef_File(m), upb_EnumDef_FullName(m));
zend_string *str = zend_string_init(classname, strlen(classname), 0);
zend_class_entry *ce = zend_lookup_class(str); // May autoload the class.
@ -193,20 +193,14 @@ PHP_METHOD(EnumDescriptor, getValue) {
return;
}
int field_num = upb_enumdef_numvals(intern->enumdef);
if (index < 0 || index >= field_num) {
if (index < 0 || index >= upb_EnumDef_ValueCount(intern->enumdef)) {
zend_error(E_USER_ERROR, "Cannot get element at %ld.\n", index);
return;
}
upb_enum_iter iter;
int i;
for(upb_enum_begin(&iter, intern->enumdef), i = 0;
!upb_enum_done(&iter) && i < index;
upb_enum_next(&iter), i++);
EnumValueDescriptor_Make(&ret, upb_enum_iter_name(&iter),
upb_enum_iter_number(&iter));
const upb_EnumValueDef* ev = upb_EnumDef_Value(intern->enumdef, index);
EnumValueDescriptor_Make(&ret, upb_EnumValueDef_Name(ev),
upb_EnumValueDef_Number(ev));
RETURN_COPY_VALUE(&ret);
}
@ -217,7 +211,7 @@ PHP_METHOD(EnumDescriptor, getValue) {
*/
PHP_METHOD(EnumDescriptor, getValueCount) {
EnumDescriptor *intern = (EnumDescriptor*)Z_OBJ_P(getThis());
RETURN_LONG(upb_enumdef_numvals(intern->enumdef));
RETURN_LONG(upb_EnumDef_ValueCount(intern->enumdef));
}
/*
@ -244,7 +238,7 @@ static zend_function_entry EnumDescriptor_methods[] = {
typedef struct {
zend_object std;
const upb_oneofdef *oneofdef;
const upb_OneofDef *oneofdef;
} OneofDescriptor;
zend_class_entry *OneofDescriptor_class_entry;
@ -255,7 +249,7 @@ static void OneofDescriptor_destructor(zend_object* obj) {
ObjCache_Delete(intern->oneofdef);
}
static void OneofDescriptor_FromOneofDef(zval *val, const upb_oneofdef *o) {
static void OneofDescriptor_FromOneofDef(zval *val, const upb_OneofDef *o) {
if (o == NULL) {
ZVAL_NULL(val);
return;
@ -278,7 +272,7 @@ static void OneofDescriptor_FromOneofDef(zval *val, const upb_oneofdef *o) {
*/
PHP_METHOD(OneofDescriptor, getName) {
OneofDescriptor *intern = (OneofDescriptor*)Z_OBJ_P(getThis());
RETURN_STRING(upb_oneofdef_name(intern->oneofdef));
RETURN_STRING(upb_OneofDef_Name(intern->oneofdef));
}
/*
@ -297,19 +291,12 @@ PHP_METHOD(OneofDescriptor, getField) {
return;
}
int field_num = upb_oneofdef_numfields(intern->oneofdef);
if (index < 0 || index >= field_num) {
if (index < 0 || index >= upb_OneofDef_FieldCount(intern->oneofdef)) {
zend_error(E_USER_ERROR, "Cannot get element at %ld.\n", index);
return;
}
upb_oneof_iter iter;
int i;
for(upb_oneof_begin(&iter, intern->oneofdef), i = 0;
!upb_oneof_done(&iter) && i < index;
upb_oneof_next(&iter), i++);
const upb_fielddef *field = upb_oneof_iter_field(&iter);
const upb_FieldDef* field = upb_OneofDef_Field(intern->oneofdef, index);
FieldDescriptor_FromFieldDef(&ret, field);
RETURN_COPY_VALUE(&ret);
}
@ -321,7 +308,7 @@ PHP_METHOD(OneofDescriptor, getField) {
*/
PHP_METHOD(OneofDescriptor, getFieldCount) {
OneofDescriptor *intern = (OneofDescriptor*)Z_OBJ_P(getThis());
RETURN_LONG(upb_oneofdef_numfields(intern->oneofdef));
RETURN_LONG(upb_OneofDef_FieldCount(intern->oneofdef));
}
static zend_function_entry OneofDescriptor_methods[] = {
@ -337,7 +324,7 @@ static zend_function_entry OneofDescriptor_methods[] = {
typedef struct {
zend_object std;
const upb_fielddef *fielddef;
const upb_FieldDef *fielddef;
} FieldDescriptor;
zend_class_entry *FieldDescriptor_class_entry;
@ -349,7 +336,7 @@ static void FieldDescriptor_destructor(zend_object* obj) {
}
// Caller owns a ref on the returned zval.
static void FieldDescriptor_FromFieldDef(zval *val, const upb_fielddef *f) {
static void FieldDescriptor_FromFieldDef(zval *val, const upb_FieldDef *f) {
if (f == NULL) {
ZVAL_NULL(val);
return;
@ -365,30 +352,30 @@ static void FieldDescriptor_FromFieldDef(zval *val, const upb_fielddef *f) {
}
}
upb_fieldtype_t to_fieldtype(upb_descriptortype_t type) {
upb_CType to_fieldtype(upb_FieldType type) {
switch (type) {
#define CASE(descriptor_type, type) \
case UPB_DESCRIPTOR_TYPE_##descriptor_type: \
return UPB_TYPE_##type;
CASE(FLOAT, FLOAT);
CASE(DOUBLE, DOUBLE);
CASE(BOOL, BOOL);
CASE(STRING, STRING);
CASE(BYTES, BYTES);
CASE(MESSAGE, MESSAGE);
CASE(GROUP, MESSAGE);
CASE(ENUM, ENUM);
CASE(INT32, INT32);
CASE(INT64, INT64);
CASE(UINT32, UINT32);
CASE(UINT64, UINT64);
CASE(SINT32, INT32);
CASE(SINT64, INT64);
CASE(FIXED32, UINT32);
CASE(FIXED64, UINT64);
CASE(SFIXED32, INT32);
CASE(SFIXED64, INT64);
case kUpb_FieldType_##descriptor_type: \
return kUpb_CType_##type;
CASE(Float, Float);
CASE(Double, Double);
CASE(Bool, Bool);
CASE(String, String);
CASE(Bytes, Bytes);
CASE(Message, Message);
CASE(Group, Message);
CASE(Enum, Enum);
CASE(Int32, Int32);
CASE(Int64, Int64);
CASE(UInt32, UInt32);
CASE(UInt64, UInt64);
CASE(SInt32, Int32);
CASE(SInt64, Int64);
CASE(Fixed32, UInt32);
CASE(Fixed64, UInt64);
CASE(SFixed32, Int32);
CASE(SFixed64, Int64);
#undef CONVERT
@ -405,7 +392,7 @@ upb_fieldtype_t to_fieldtype(upb_descriptortype_t type) {
*/
PHP_METHOD(FieldDescriptor, getName) {
FieldDescriptor *intern = (FieldDescriptor*)Z_OBJ_P(getThis());
RETURN_STRING(upb_fielddef_name(intern->fielddef));
RETURN_STRING(upb_FieldDef_Name(intern->fielddef));
}
/*
@ -415,7 +402,7 @@ PHP_METHOD(FieldDescriptor, getName) {
*/
PHP_METHOD(FieldDescriptor, getNumber) {
FieldDescriptor *intern = (FieldDescriptor*)Z_OBJ_P(getThis());
RETURN_LONG(upb_fielddef_number(intern->fielddef));
RETURN_LONG(upb_FieldDef_Number(intern->fielddef));
}
/*
@ -425,7 +412,7 @@ PHP_METHOD(FieldDescriptor, getNumber) {
*/
PHP_METHOD(FieldDescriptor, getLabel) {
FieldDescriptor *intern = (FieldDescriptor*)Z_OBJ_P(getThis());
RETURN_LONG(upb_fielddef_label(intern->fielddef));
RETURN_LONG(upb_FieldDef_Label(intern->fielddef));
}
/*
@ -435,7 +422,7 @@ PHP_METHOD(FieldDescriptor, getLabel) {
*/
PHP_METHOD(FieldDescriptor, getType) {
FieldDescriptor *intern = (FieldDescriptor*)Z_OBJ_P(getThis());
RETURN_LONG(upb_fielddef_descriptortype(intern->fielddef));
RETURN_LONG(upb_FieldDef_Type(intern->fielddef));
}
/*
@ -445,7 +432,7 @@ PHP_METHOD(FieldDescriptor, getType) {
*/
PHP_METHOD(FieldDescriptor, isMap) {
FieldDescriptor *intern = (FieldDescriptor*)Z_OBJ_P(getThis());
RETURN_BOOL(upb_fielddef_ismap(intern->fielddef));
RETURN_BOOL(upb_FieldDef_IsMap(intern->fielddef));
}
/*
@ -455,13 +442,13 @@ PHP_METHOD(FieldDescriptor, isMap) {
*/
PHP_METHOD(FieldDescriptor, getEnumType) {
FieldDescriptor *intern = (FieldDescriptor*)Z_OBJ_P(getThis());
const upb_enumdef *e = upb_fielddef_enumsubdef(intern->fielddef);
const upb_EnumDef *e = upb_FieldDef_EnumSubDef(intern->fielddef);
zval ret;
if (!e) {
zend_throw_exception_ex(NULL, 0,
"Cannot get enum type for non-enum field '%s'",
upb_fielddef_name(intern->fielddef));
upb_FieldDef_Name(intern->fielddef));
return;
}
@ -481,7 +468,7 @@ PHP_METHOD(FieldDescriptor, getMessageType) {
if (!desc) {
zend_throw_exception_ex(
NULL, 0, "Cannot get message type for non-message field '%s'",
upb_fielddef_name(intern->fielddef));
upb_FieldDef_Name(intern->fielddef));
return;
}
@ -511,9 +498,9 @@ static void Descriptor_destructor(zend_object* obj) {
// collected before the end of the request.
}
static zend_class_entry *Descriptor_GetGeneratedClass(const upb_msgdef *m) {
static zend_class_entry *Descriptor_GetGeneratedClass(const upb_MessageDef *m) {
char *classname =
GetPhpClassname(upb_msgdef_file(m), upb_msgdef_fullname(m));
GetPhpClassname(upb_MessageDef_File(m), upb_MessageDef_FullName(m));
zend_string *str = zend_string_init(classname, strlen(classname), 0);
zend_class_entry *ce = zend_lookup_class(str); // May autoload the class.
@ -527,7 +514,7 @@ static zend_class_entry *Descriptor_GetGeneratedClass(const upb_msgdef *m) {
return ce;
}
void Descriptor_FromMessageDef(zval *val, const upb_msgdef *m) {
void Descriptor_FromMessageDef(zval *val, const upb_MessageDef *m) {
if (m == NULL) {
ZVAL_NULL(val);
return;
@ -535,7 +522,7 @@ void Descriptor_FromMessageDef(zval *val, const upb_msgdef *m) {
if (!ObjCache_Get(m, val)) {
zend_class_entry *ce = NULL;
if (!upb_msgdef_mapentry(m)) { // Map entries don't have a class.
if (!upb_MessageDef_IsMapEntry(m)) { // Map entries don't have a class.
ce = Descriptor_GetGeneratedClass(m);
if (!ce) {
ZVAL_NULL(val);
@ -581,14 +568,14 @@ Descriptor* Descriptor_GetFromClassEntry(zend_class_entry *ce) {
return Descriptor_GetFromZval(&desc);
}
Descriptor* Descriptor_GetFromMessageDef(const upb_msgdef *m) {
Descriptor* Descriptor_GetFromMessageDef(const upb_MessageDef *m) {
zval desc;
Descriptor_FromMessageDef(&desc, m);
return Descriptor_GetFromZval(&desc);
}
Descriptor* Descriptor_GetFromFieldDef(const upb_fielddef *f) {
return Descriptor_GetFromMessageDef(upb_fielddef_msgsubdef(f));
Descriptor* Descriptor_GetFromFieldDef(const upb_FieldDef *f) {
return Descriptor_GetFromMessageDef(upb_FieldDef_MessageSubDef(f));
}
/*
@ -609,7 +596,7 @@ PHP_METHOD(Descriptor, getPublicDescriptor) {
*/
PHP_METHOD(Descriptor, getFullName) {
Descriptor *intern = (Descriptor*)Z_OBJ_P(getThis());
RETURN_STRING(upb_msgdef_fullname(intern->msgdef));
RETURN_STRING(upb_MessageDef_FullName(intern->msgdef));
}
/*
@ -620,7 +607,7 @@ PHP_METHOD(Descriptor, getFullName) {
*/
PHP_METHOD(Descriptor, getField) {
Descriptor *intern = (Descriptor*)Z_OBJ_P(getThis());
int count = upb_msgdef_numfields(intern->msgdef);
int count = upb_MessageDef_FieldCount(intern->msgdef);
zval ret;
zend_long index;
@ -634,7 +621,7 @@ PHP_METHOD(Descriptor, getField) {
return;
}
FieldDescriptor_FromFieldDef(&ret, upb_msgdef_field(intern->msgdef, index));
FieldDescriptor_FromFieldDef(&ret, upb_MessageDef_Field(intern->msgdef, index));
RETURN_COPY_VALUE(&ret);
}
@ -645,7 +632,7 @@ PHP_METHOD(Descriptor, getField) {
*/
PHP_METHOD(Descriptor, getFieldCount) {
Descriptor *intern = (Descriptor*)Z_OBJ_P(getThis());
RETURN_LONG(upb_msgdef_numfields(intern->msgdef));
RETURN_LONG(upb_MessageDef_FieldCount(intern->msgdef));
}
/*
@ -664,20 +651,12 @@ PHP_METHOD(Descriptor, getOneofDecl) {
return;
}
int field_num = upb_msgdef_numoneofs(intern->msgdef);
if (index < 0 || index >= field_num) {
if (index < 0 || index >= upb_MessageDef_OneofCount(intern->msgdef)) {
zend_error(E_USER_ERROR, "Cannot get element at %ld.\n", index);
return;
}
upb_msg_oneof_iter iter;
int i;
for(upb_msg_oneof_begin(&iter, intern->msgdef), i = 0;
!upb_msg_oneof_done(&iter) && i < index;
upb_msg_oneof_next(&iter), i++);
const upb_oneofdef *oneof = upb_msg_iter_oneof(&iter);
OneofDescriptor_FromOneofDef(&ret, oneof);
OneofDescriptor_FromOneofDef(&ret, upb_MessageDef_Oneof(intern->msgdef, index));
RETURN_COPY_VALUE(&ret);
}
@ -688,7 +667,7 @@ PHP_METHOD(Descriptor, getOneofDecl) {
*/
PHP_METHOD(Descriptor, getOneofDeclCount) {
Descriptor *intern = (Descriptor*)Z_OBJ_P(getThis());
RETURN_LONG(upb_msgdef_numoneofs(intern->msgdef));
RETURN_LONG(upb_MessageDef_OneofCount(intern->msgdef));
}
/*
@ -720,7 +699,7 @@ static zend_function_entry Descriptor_methods[] = {
typedef struct DescriptorPool {
zend_object std;
upb_symtab *symtab;
upb_DefPool *symtab;
} DescriptorPool;
zend_class_entry *DescriptorPool_class_entry;
@ -743,7 +722,7 @@ static void DescriptorPool_destructor(zend_object* obj) {
zend_object_std_dtor(&intern->std);
}
void DescriptorPool_CreateWithSymbolTable(zval *zv, upb_symtab *symtab) {
void DescriptorPool_CreateWithSymbolTable(zval *zv, upb_DefPool *symtab) {
DescriptorPool *intern = emalloc(sizeof(DescriptorPool));
zend_object_std_init(&intern->std, DescriptorPool_class_entry);
intern->std.handlers = &DescriptorPool_object_handlers;
@ -752,21 +731,17 @@ void DescriptorPool_CreateWithSymbolTable(zval *zv, upb_symtab *symtab) {
ZVAL_OBJ(zv, &intern->std);
}
upb_symtab *DescriptorPool_GetSymbolTable() {
DescriptorPool *intern = GetPool(get_generated_pool());
return intern->symtab;
upb_DefPool *DescriptorPool_GetSymbolTable() {
return get_global_symtab();
}
/*
* DescriptorPool::getGeneratedPool()
*
* Returns the generated DescriptorPool.
*/
PHP_METHOD(DescriptorPool, getGeneratedPool) {
zval ret;
ZVAL_COPY(&ret, get_generated_pool());
RETURN_COPY_VALUE(&ret);
DescriptorPool_CreateWithSymbolTable(return_value, get_global_symtab());
}
/*
@ -836,7 +811,7 @@ PHP_METHOD(DescriptorPool, getDescriptorByProtoName) {
DescriptorPool *intern = GetPool(getThis());
char *protoname = NULL;
zend_long protoname_len;
const upb_msgdef *m;
const upb_MessageDef *m;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &protoname, &protoname_len) ==
FAILURE) {
@ -845,7 +820,7 @@ PHP_METHOD(DescriptorPool, getDescriptorByProtoName) {
if (*protoname == '.') protoname++;
m = upb_symtab_lookupmsg(intern->symtab, protoname);
m = upb_DefPool_FindMessageByName(intern->symtab, protoname);
if (m) {
RETURN_OBJ_COPY(&Descriptor_GetFromMessageDef(m)->std);
@ -860,13 +835,13 @@ PHP_METHOD(DescriptorPool, getDescriptorByProtoName) {
* Returns true if this FileDescriptorProto depends on descriptor.proto.
*/
bool depends_on_descriptor(const google_protobuf_FileDescriptorProto* file) {
const upb_strview *deps;
upb_strview name = upb_strview_makez("google/protobuf/descriptor.proto");
const upb_StringView *deps;
upb_StringView name = upb_StringView_FromString("google/protobuf/descriptor.proto");
size_t i, n;
deps = google_protobuf_FileDescriptorProto_dependency(file, &n);
for (i = 0; i < n; i++) {
if (upb_strview_eql(deps[i], name)) {
if (upb_StringView_IsEqual(deps[i], name)) {
return true;
}
}
@ -874,37 +849,48 @@ bool depends_on_descriptor(const google_protobuf_FileDescriptorProto* file) {
return false;
}
static void add_message_name_mappings(const upb_MessageDef *message) {
NameMap_AddMessage(message);
int msg_n = upb_MessageDef_NestedMessageCount(message);
for (int i = 0; i < msg_n; i++) {
add_message_name_mappings(upb_MessageDef_NestedMessage(message, i));
}
int enum_n = upb_MessageDef_NestedEnumCount(message);
for (int i = 0; i < enum_n; i++) {
NameMap_AddEnum(upb_MessageDef_NestedEnum(message, i));
}
}
/*
* add_name_mappings()
*
* Adds the messages and enums in this file to the NameMap.
*/
static void add_name_mappings(const upb_filedef *file) {
size_t i;
for (i = 0; i < upb_filedef_msgcount(file); i++) {
NameMap_AddMessage(upb_filedef_msg(file, i));
static void add_name_mappings(const upb_FileDef *file) {
for (int i = 0; i < upb_FileDef_TopLevelMessageCount(file); i++) {
add_message_name_mappings(upb_FileDef_TopLevelMessage(file, i));
}
for (i = 0; i < upb_filedef_enumcount(file); i++) {
NameMap_AddEnum(upb_filedef_enum(file, i));
for (int i = 0; i < upb_FileDef_TopLevelEnumCount(file); i++) {
NameMap_AddEnum(upb_FileDef_TopLevelEnum(file, i));
}
}
static void add_descriptor(DescriptorPool *pool,
static void add_descriptor(upb_DefPool *symtab,
const google_protobuf_FileDescriptorProto *file) {
upb_strview name = google_protobuf_FileDescriptorProto_name(file);
upb_status status;
const upb_filedef *file_def;
upb_status_clear(&status);
upb_StringView name = google_protobuf_FileDescriptorProto_name(file);
upb_Status status;
const upb_FileDef *file_def;
upb_Status_Clear(&status);
if (upb_symtab_lookupfile2(pool->symtab, name.data, name.size)) {
if (upb_DefPool_FindFileByNameWithSize(symtab, name.data, name.size)) {
// Already added.
// TODO(teboring): Re-enable this warning when aggregate metadata is
// deprecated.
// zend_error(E_USER_WARNING,
// "proto descriptor was previously loaded (included in multiple "
// "metadata bundles?): " UPB_STRVIEW_FORMAT,
// UPB_STRVIEW_ARGS(name));
// "metadata bundles?): " UPB_STRINGVIEW_FORMAT,
// UPB_STRINGVIEW_ARGS(name));
return;
}
@ -912,10 +898,10 @@ static void add_descriptor(DescriptorPool *pool,
// doesn't add it as a dependency even if the proto file actually does
// depend on it.
if (depends_on_descriptor(file)) {
google_protobuf_FileDescriptorProto_getmsgdef(pool->symtab);
google_protobuf_FileDescriptorProto_getmsgdef(symtab);
}
file_def = upb_symtab_addfile(pool->symtab, file, &status);
file_def = upb_DefPool_AddFile(symtab, file, &status);
CheckUpbStatus(&status, "Unable to load descriptor");
add_name_mappings(file_def);
}
@ -925,8 +911,8 @@ static void add_descriptor(DescriptorPool *pool,
*
* Adds the given descriptor data to this DescriptorPool.
*/
static void add_descriptor_set(DescriptorPool *pool, const char *data,
int data_len, upb_arena *arena) {
static void add_descriptor_set(upb_DefPool *symtab, const char *data,
int data_len, upb_Arena *arena) {
size_t i, n;
google_protobuf_FileDescriptorSet *set;
const google_protobuf_FileDescriptorProto* const* files;
@ -942,18 +928,17 @@ static void add_descriptor_set(DescriptorPool *pool, const char *data,
for (i = 0; i < n; i++) {
const google_protobuf_FileDescriptorProto* file = files[i];
add_descriptor(pool, file);
add_descriptor(symtab, file);
}
}
bool DescriptorPool_HasFile(const char *filename) {
DescriptorPool *intern = GetPool(get_generated_pool());
return upb_symtab_lookupfile(intern->symtab, filename) != NULL;
return upb_DefPool_FindFileByName(get_global_symtab(), filename) != NULL;
}
void DescriptorPool_AddDescriptor(const char *filename, const char *data,
int size) {
upb_arena *arena = upb_arena_new();
upb_Arena *arena = upb_Arena_New();
const google_protobuf_FileDescriptorProto *file =
google_protobuf_FileDescriptorProto_parse(data, size, arena);
@ -962,8 +947,8 @@ void DescriptorPool_AddDescriptor(const char *filename, const char *data,
return;
}
add_descriptor(GetPool(get_generated_pool()), file);
upb_arena_free(arena);
add_descriptor(get_global_symtab(), file);
upb_Arena_Free(arena);
}
/*
@ -976,16 +961,16 @@ PHP_METHOD(DescriptorPool, internalAddGeneratedFile) {
char *data = NULL;
zend_long data_len;
zend_bool use_nested_submsg = false;
upb_arena *arena;
upb_Arena *arena;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|b", &data, &data_len,
&use_nested_submsg) != SUCCESS) {
return;
}
arena = upb_arena_new();
add_descriptor_set(intern, data, data_len, arena);
upb_arena_free(arena);
arena = upb_Arena_New();
add_descriptor_set(intern->symtab, data, data_len, arena);
upb_Arena_Free(arena);
}
ZEND_BEGIN_ARG_INFO_EX(arginfo_lookupByName, 0, 0, 1)
@ -1025,7 +1010,7 @@ zend_class_entry *InternalDescriptorPool_class_entry;
* instance.
*/
PHP_METHOD(InternalDescriptorPool, getGeneratedPool) {
RETURN_COPY(get_generated_pool());
DescriptorPool_CreateWithSymbolTable(return_value, get_global_symtab());
}
static zend_function_entry InternalDescriptorPool_methods[] = {

@ -40,9 +40,9 @@ void Def_ModuleInit();
// Creates a new DescriptorPool to wrap the given symtab, which must not be
// NULL.
void DescriptorPool_CreateWithSymbolTable(zval *zv, upb_symtab *symtab);
void DescriptorPool_CreateWithSymbolTable(zval *zv, upb_DefPool *symtab);
upb_symtab *DescriptorPool_GetSymbolTable();
upb_DefPool *DescriptorPool_GetSymbolTable();
// Returns true if the global descriptor pool already has the given filename.
bool DescriptorPool_HasFile(const char *filename);
@ -52,38 +52,38 @@ void DescriptorPool_AddDescriptor(const char *filename, const char *data, int si
typedef struct Descriptor {
zend_object std;
const upb_msgdef *msgdef;
const upb_MessageDef *msgdef;
zend_class_entry *class_entry;
} Descriptor;
// Gets or creates a Descriptor* for the given class entry, upb_msgdef, or
// upb_fielddef. The returned Descriptor* will live for the entire request,
// Gets or creates a Descriptor* for the given class entry, upb_MessageDef, or
// upb_FieldDef. The returned Descriptor* will live for the entire request,
// so no ref is necessary to keep it alive. The caller does *not* own a ref
// on the returned object.
Descriptor* Descriptor_GetFromClassEntry(zend_class_entry *ce);
Descriptor* Descriptor_GetFromMessageDef(const upb_msgdef *m);
Descriptor* Descriptor_GetFromFieldDef(const upb_fielddef *f);
Descriptor* Descriptor_GetFromMessageDef(const upb_MessageDef *m);
Descriptor* Descriptor_GetFromFieldDef(const upb_FieldDef *f);
// Packages up a upb_fieldtype_t with a Descriptor, since many functions need
// Packages up a upb_CType with a Descriptor, since many functions need
// both.
typedef struct {
upb_fieldtype_t type;
const Descriptor *desc; // When type == UPB_TYPE_MESSAGE.
upb_CType type;
const Descriptor *desc; // When type == kUpb_CType_Message.
} TypeInfo;
static inline TypeInfo TypeInfo_Get(const upb_fielddef *f) {
TypeInfo ret = {upb_fielddef_type(f), Descriptor_GetFromFieldDef(f)};
static inline TypeInfo TypeInfo_Get(const upb_FieldDef *f) {
TypeInfo ret = {upb_FieldDef_CType(f), Descriptor_GetFromFieldDef(f)};
return ret;
}
static inline TypeInfo TypeInfo_FromType(upb_fieldtype_t type) {
static inline TypeInfo TypeInfo_FromType(upb_CType type) {
TypeInfo ret = {type};
return ret;
}
static inline bool TypeInfo_Eq(TypeInfo a, TypeInfo b) {
if (a.type != b.type) return false;
if (a.type == UPB_TYPE_MESSAGE && a.desc != b.desc) return false;
if (a.type == kUpb_CType_Message && a.desc != b.desc) return false;
return true;
}

@ -50,7 +50,7 @@ static void MapFieldIter_make(zval *val, zval *map_field);
typedef struct {
zend_object std;
zval arena;
upb_map *map;
upb_Map *map;
MapField_Type type;
} MapField;
@ -66,13 +66,13 @@ static TypeInfo KeyType(MapField_Type type) {
return ret;
}
MapField_Type MapType_Get(const upb_fielddef *f) {
const upb_msgdef *ent = upb_fielddef_msgsubdef(f);
const upb_fielddef *key_f = upb_msgdef_itof(ent, 1);
const upb_fielddef *val_f = upb_msgdef_itof(ent, 2);
MapField_Type MapType_Get(const upb_FieldDef *f) {
const upb_MessageDef *ent = upb_FieldDef_MessageSubDef(f);
const upb_FieldDef *key_f = upb_MessageDef_FindFieldByNumber(ent, 1);
const upb_FieldDef *val_f = upb_MessageDef_FindFieldByNumber(ent, 2);
MapField_Type type = {
upb_fielddef_type(key_f),
{upb_fielddef_type(val_f), Descriptor_GetFromFieldDef(val_f)}};
upb_FieldDef_CType(key_f),
{upb_FieldDef_CType(val_f), Descriptor_GetFromFieldDef(val_f)}};
return type;
}
@ -135,15 +135,15 @@ static int MapField_compare_objects(zval *map1, zval *map2) {
*/
static zend_object *MapField_clone_obj(PROTO_VAL *object) {
MapField* intern = PROTO_VAL_P(object);
upb_arena *arena = Arena_Get(&intern->arena);
upb_map *clone =
upb_map_new(arena, intern->type.key_type, intern->type.val_type.type);
size_t iter = UPB_MAP_BEGIN;
while (upb_mapiter_next(intern->map, &iter)) {
upb_msgval key = upb_mapiter_key(intern->map, iter);
upb_msgval val = upb_mapiter_value(intern->map, iter);
upb_map_set(clone, key, val, arena);
upb_Arena *arena = Arena_Get(&intern->arena);
upb_Map *clone =
upb_Map_New(arena, intern->type.key_type, intern->type.val_type.type);
size_t iter = kUpb_Map_Begin;
while (upb_MapIterator_Next(intern->map, &iter)) {
upb_MessageValue key = upb_MapIterator_Key(intern->map, iter);
upb_MessageValue val = upb_MapIterator_Value(intern->map, iter);
upb_Map_Set(clone, key, val, arena);
}
zval ret;
@ -164,7 +164,7 @@ static HashTable *Map_GetProperties(PROTO_VAL *object) {
// These are documented in the header file.
void MapField_GetPhpWrapper(zval *val, upb_map *map, MapField_Type type,
void MapField_GetPhpWrapper(zval *val, upb_Map *map, MapField_Type type,
zval *arena) {
if (!map) {
ZVAL_NULL(val);
@ -184,13 +184,13 @@ void MapField_GetPhpWrapper(zval *val, upb_map *map, MapField_Type type,
}
}
upb_map *MapField_GetUpbMap(zval *val, MapField_Type type, upb_arena *arena) {
upb_Map *MapField_GetUpbMap(zval *val, MapField_Type type, upb_Arena *arena) {
if (Z_ISREF_P(val)) {
ZVAL_DEREF(val);
}
if (Z_TYPE_P(val) == IS_ARRAY) {
upb_map *map = upb_map_new(arena, type.key_type, type.val_type.type);
upb_Map *map = upb_Map_New(arena, type.key_type, type.val_type.type);
HashTable *table = HASH_OF(val);
HashPosition pos;
@ -199,8 +199,8 @@ upb_map *MapField_GetUpbMap(zval *val, MapField_Type type, upb_arena *arena) {
while (true) {
zval php_key;
zval *php_val;
upb_msgval upb_key;
upb_msgval upb_val;
upb_MessageValue upb_key;
upb_MessageValue upb_val;
zend_hash_get_current_key_zval_ex(table, &php_key, &pos);
php_val = zend_hash_get_current_data_ex(table, &pos);
@ -212,7 +212,7 @@ upb_map *MapField_GetUpbMap(zval *val, MapField_Type type, upb_arena *arena) {
return NULL;
}
upb_map_set(map, upb_key, upb_val, arena);
upb_Map_Set(map, upb_key, upb_val, arena);
zend_hash_move_forward_ex(table, &pos);
zval_dtor(&php_key);
}
@ -225,7 +225,7 @@ upb_map *MapField_GetUpbMap(zval *val, MapField_Type type, upb_arena *arena) {
return NULL;
}
upb_arena_fuse(arena, Arena_Get(&intern->arena));
upb_Arena_Fuse(arena, Arena_Get(&intern->arena));
return intern->map;
} else {
php_error_docref(NULL, E_USER_ERROR, "Must be a map");
@ -233,19 +233,19 @@ upb_map *MapField_GetUpbMap(zval *val, MapField_Type type, upb_arena *arena) {
}
}
bool MapEq(const upb_map *m1, const upb_map *m2, MapField_Type type) {
size_t iter = UPB_MAP_BEGIN;
bool MapEq(const upb_Map *m1, const upb_Map *m2, MapField_Type type) {
size_t iter = kUpb_Map_Begin;
if ((m1 == NULL) != (m2 == NULL)) return false;
if (m1 == NULL) return true;
if (upb_map_size(m1) != upb_map_size(m2)) return false;
if (upb_Map_Size(m1) != upb_Map_Size(m2)) return false;
while (upb_mapiter_next(m1, &iter)) {
upb_msgval key = upb_mapiter_key(m1, iter);
upb_msgval val1 = upb_mapiter_value(m1, iter);
upb_msgval val2;
while (upb_MapIterator_Next(m1, &iter)) {
upb_MessageValue key = upb_MapIterator_Key(m1, iter);
upb_MessageValue val1 = upb_MapIterator_Value(m1, iter);
upb_MessageValue val2;
if (!upb_map_get(m2, key, &val2)) return false;
if (!upb_Map_Get(m2, key, &val2)) return false;
if (!ValueEq(val1, val2, type.val_type)) return false;
}
@ -265,7 +265,7 @@ bool MapEq(const upb_map *m1, const upb_map *m2, MapField_Type type) {
*/
PHP_METHOD(MapField, __construct) {
MapField *intern = (MapField*)Z_OBJ_P(getThis());
upb_arena *arena = Arena_Get(&intern->arena);
upb_Arena *arena = Arena_Get(&intern->arena);
zend_long key_type, val_type;
zend_class_entry* klass = NULL;
@ -280,27 +280,27 @@ PHP_METHOD(MapField, __construct) {
// Check that the key type is an allowed type.
switch (intern->type.key_type) {
case UPB_TYPE_INT32:
case UPB_TYPE_INT64:
case UPB_TYPE_UINT32:
case UPB_TYPE_UINT64:
case UPB_TYPE_BOOL:
case UPB_TYPE_STRING:
case UPB_TYPE_BYTES:
case kUpb_CType_Int32:
case kUpb_CType_Int64:
case kUpb_CType_UInt32:
case kUpb_CType_UInt64:
case kUpb_CType_Bool:
case kUpb_CType_String:
case kUpb_CType_Bytes:
// These are OK.
break;
default:
zend_error(E_USER_ERROR, "Invalid key type for map.");
}
if (intern->type.val_type.type == UPB_TYPE_MESSAGE && klass == NULL) {
if (intern->type.val_type.type == kUpb_CType_Message && klass == NULL) {
php_error_docref(NULL, E_USER_ERROR,
"Message/enum type must have concrete class.");
return;
}
intern->map =
upb_map_new(arena, intern->type.key_type, intern->type.val_type.type);
upb_Map_New(arena, intern->type.key_type, intern->type.val_type.type);
ObjCache_Add(intern->map, &intern->std);
}
@ -318,14 +318,14 @@ PHP_METHOD(MapField, __construct) {
PHP_METHOD(MapField, offsetExists) {
MapField *intern = (MapField*)Z_OBJ_P(getThis());
zval *key;
upb_msgval upb_key;
upb_MessageValue upb_key;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &key) != SUCCESS ||
!Convert_PhpToUpb(key, &upb_key, KeyType(intern->type), NULL)) {
return;
}
RETURN_BOOL(upb_map_get(intern->map, upb_key, NULL));
RETURN_BOOL(upb_Map_Get(intern->map, upb_key, NULL));
}
/**
@ -344,14 +344,14 @@ PHP_METHOD(MapField, offsetGet) {
MapField *intern = (MapField*)Z_OBJ_P(getThis());
zval *key;
zval ret;
upb_msgval upb_key, upb_val;
upb_MessageValue upb_key, upb_val;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &key) != SUCCESS ||
!Convert_PhpToUpb(key, &upb_key, KeyType(intern->type), NULL)) {
return;
}
if (!upb_map_get(intern->map, upb_key, &upb_val)) {
if (!upb_Map_Get(intern->map, upb_key, &upb_val)) {
zend_error(E_USER_ERROR, "Given key doesn't exist.");
return;
}
@ -375,9 +375,9 @@ PHP_METHOD(MapField, offsetGet) {
*/
PHP_METHOD(MapField, offsetSet) {
MapField *intern = (MapField*)Z_OBJ_P(getThis());
upb_arena *arena = Arena_Get(&intern->arena);
upb_Arena *arena = Arena_Get(&intern->arena);
zval *key, *val;
upb_msgval upb_key, upb_val;
upb_MessageValue upb_key, upb_val;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "zz", &key, &val) != SUCCESS ||
!Convert_PhpToUpb(key, &upb_key, KeyType(intern->type), NULL) ||
@ -385,7 +385,7 @@ PHP_METHOD(MapField, offsetSet) {
return;
}
upb_map_set(intern->map, upb_key, upb_val, arena);
upb_Map_Set(intern->map, upb_key, upb_val, arena);
}
/**
@ -402,14 +402,14 @@ PHP_METHOD(MapField, offsetSet) {
PHP_METHOD(MapField, offsetUnset) {
MapField *intern = (MapField*)Z_OBJ_P(getThis());
zval *key;
upb_msgval upb_key;
upb_MessageValue upb_key;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &key) != SUCCESS ||
!Convert_PhpToUpb(key, &upb_key, KeyType(intern->type), NULL)) {
return;
}
upb_map_delete(intern->map, upb_key);
upb_Map_Delete(intern->map, upb_key);
}
/**
@ -429,7 +429,7 @@ PHP_METHOD(MapField, count) {
return;
}
RETURN_LONG(upb_map_size(intern->map));
RETURN_LONG(upb_Map_Size(intern->map));
}
/**
@ -569,8 +569,8 @@ static void MapFieldIter_make(zval *val, zval *map_field) {
PHP_METHOD(MapFieldIter, rewind) {
MapFieldIter *intern = (MapFieldIter*)Z_OBJ_P(getThis());
MapField *map_field = (MapField*)Z_OBJ_P(&intern->map_field);
intern->position = UPB_MAP_BEGIN;
upb_mapiter_next(map_field->map, &intern->position);
intern->position = kUpb_Map_Begin;
upb_MapIterator_Next(map_field->map, &intern->position);
}
/**
@ -581,7 +581,7 @@ PHP_METHOD(MapFieldIter, rewind) {
PHP_METHOD(MapFieldIter, current) {
MapFieldIter *intern = (MapFieldIter*)Z_OBJ_P(getThis());
MapField *field = (MapField*)Z_OBJ_P(&intern->map_field);
upb_msgval upb_val = upb_mapiter_value(field->map, intern->position);
upb_MessageValue upb_val = upb_MapIterator_Value(field->map, intern->position);
zval ret;
Convert_UpbToPhp(upb_val, &ret, field->type.val_type, &field->arena);
RETURN_COPY_VALUE(&ret);
@ -595,7 +595,7 @@ PHP_METHOD(MapFieldIter, current) {
PHP_METHOD(MapFieldIter, key) {
MapFieldIter *intern = (MapFieldIter*)Z_OBJ_P(getThis());
MapField *field = (MapField*)Z_OBJ_P(&intern->map_field);
upb_msgval upb_key = upb_mapiter_key(field->map, intern->position);
upb_MessageValue upb_key = upb_MapIterator_Key(field->map, intern->position);
zval ret;
Convert_UpbToPhp(upb_key, &ret, KeyType(field->type), NULL);
RETURN_COPY_VALUE(&ret);
@ -609,7 +609,7 @@ PHP_METHOD(MapFieldIter, key) {
PHP_METHOD(MapFieldIter, next) {
MapFieldIter *intern = (MapFieldIter*)Z_OBJ_P(getThis());
MapField *field = (MapField*)Z_OBJ_P(&intern->map_field);
upb_mapiter_next(field->map, &intern->position);
upb_MapIterator_Next(field->map, &intern->position);
}
/**
@ -620,7 +620,7 @@ PHP_METHOD(MapFieldIter, next) {
PHP_METHOD(MapFieldIter, valid) {
MapFieldIter *intern = (MapFieldIter*)Z_OBJ_P(getThis());
MapField *field = (MapField*)Z_OBJ_P(&intern->map_field);
bool done = upb_mapiter_done(field->map, intern->position);
bool done = upb_MapIterator_Done(field->map, intern->position);
RETURN_BOOL(!done);
}

@ -39,32 +39,32 @@
void Map_ModuleInit();
typedef struct {
upb_fieldtype_t key_type;
upb_CType key_type;
TypeInfo val_type;
} MapField_Type;
MapField_Type MapType_Get(const upb_fielddef *f);
MapField_Type MapType_Get(const upb_FieldDef *f);
// Gets a upb_map* for the PHP object |val|:
// Gets a upb_Map* for the PHP object |val|:
// * If |val| is a RepeatedField object, we first check its type and verify
// that that the elements have the correct type for |f|. If so, we return the
// wrapped upb_map*. We also make sure that this map's arena is fused to
// |arena|, so the returned upb_map is guaranteed to live as long as
// wrapped upb_Map*. We also make sure that this map's arena is fused to
// |arena|, so the returned upb_Map is guaranteed to live as long as
// |arena|.
// * If |val| is a PHP Map, we attempt to create a new upb_map using
// * If |val| is a PHP Map, we attempt to create a new upb_Map using
// |arena| and add all of the PHP elements to it.
//
// If an error occurs, we raise a PHP error and return NULL.
upb_map *MapField_GetUpbMap(zval *val, MapField_Type type, upb_arena *arena);
upb_Map *MapField_GetUpbMap(zval *val, MapField_Type type, upb_Arena *arena);
// Creates a PHP MapField object for the given upb_map* and |f| and returns it
// Creates a PHP MapField object for the given upb_Map* and |f| and returns it
// in |val|. The PHP object will keep a reference to this |arena| to ensure the
// underlying array data stays alive.
//
// If |map| is NULL, this will return a PHP null object.
void MapField_GetPhpWrapper(zval *val, upb_map *arr, MapField_Type type,
void MapField_GetPhpWrapper(zval *val, upb_Map *arr, MapField_Type type,
zval *arena);
bool MapEq(const upb_map *m1, const upb_map *m2, MapField_Type type);
bool MapEq(const upb_Map *m1, const upb_Map *m2, MapField_Type type);
#endif // PHP_PROTOBUF_MAP_H_

@ -54,7 +54,7 @@ typedef struct {
zend_object std;
zval arena;
const Descriptor* desc;
upb_msg *msg;
upb_Message *msg;
} Message;
zend_class_entry *message_ce;
@ -110,10 +110,10 @@ static void Message_dtor(zend_object* obj) {
*
* Helper function to look up a field given a member name (as a string).
*/
static const upb_fielddef *get_field(Message *msg, PROTO_STR *member) {
const upb_msgdef *m = msg->desc->msgdef;
const upb_fielddef *f =
upb_msgdef_ntof(m, PROTO_STRVAL_P(member), PROTO_STRLEN_P(member));
static const upb_FieldDef *get_field(Message *msg, PROTO_STR *member) {
const upb_MessageDef *m = msg->desc->msgdef;
const upb_FieldDef *f =
upb_MessageDef_FindFieldByNameWithSize(m, PROTO_STRVAL_P(member), PROTO_STRLEN_P(member));
if (!f) {
zend_throw_exception_ex(NULL, 0, "No such property %s.",
@ -123,72 +123,91 @@ static const upb_fielddef *get_field(Message *msg, PROTO_STR *member) {
return f;
}
static void Message_get(Message *intern, const upb_fielddef *f, zval *rv) {
upb_arena *arena = Arena_Get(&intern->arena);
// Check if the field is a well known wrapper type
static bool IsWrapper(const upb_MessageDef* m) {
if (!m) return false;
switch (upb_MessageDef_WellKnownType(m)) {
case kUpb_WellKnown_DoubleValue:
case kUpb_WellKnown_FloatValue:
case kUpb_WellKnown_Int64Value:
case kUpb_WellKnown_UInt64Value:
case kUpb_WellKnown_Int32Value:
case kUpb_WellKnown_UInt32Value:
case kUpb_WellKnown_StringValue:
case kUpb_WellKnown_BytesValue:
case kUpb_WellKnown_BoolValue:
return true;
default:
return false;
}
}
static void Message_get(Message *intern, const upb_FieldDef *f, zval *rv) {
upb_Arena *arena = Arena_Get(&intern->arena);
if (upb_fielddef_ismap(f)) {
upb_mutmsgval msgval = upb_msg_mutable(intern->msg, f, arena);
if (upb_FieldDef_IsMap(f)) {
upb_MutableMessageValue msgval = upb_Message_Mutable(intern->msg, f, arena);
MapField_GetPhpWrapper(rv, msgval.map, MapType_Get(f), &intern->arena);
} else if (upb_fielddef_isseq(f)) {
upb_mutmsgval msgval = upb_msg_mutable(intern->msg, f, arena);
} else if (upb_FieldDef_IsRepeated(f)) {
upb_MutableMessageValue msgval = upb_Message_Mutable(intern->msg, f, arena);
RepeatedField_GetPhpWrapper(rv, msgval.array, TypeInfo_Get(f),
&intern->arena);
} else {
if (upb_fielddef_issubmsg(f) && !upb_msg_has(intern->msg, f)) {
if (upb_FieldDef_IsSubMessage(f) && !upb_Message_Has(intern->msg, f)) {
ZVAL_NULL(rv);
return;
}
upb_msgval msgval = upb_msg_get(intern->msg, f);
upb_MessageValue msgval = upb_Message_Get(intern->msg, f);
Convert_UpbToPhp(msgval, rv, TypeInfo_Get(f), &intern->arena);
}
}
static bool Message_set(Message *intern, const upb_fielddef *f, zval *val) {
upb_arena *arena = Arena_Get(&intern->arena);
upb_msgval msgval;
static bool Message_set(Message *intern, const upb_FieldDef *f, zval *val) {
upb_Arena *arena = Arena_Get(&intern->arena);
upb_MessageValue msgval;
if (upb_fielddef_ismap(f)) {
if (upb_FieldDef_IsMap(f)) {
msgval.map_val = MapField_GetUpbMap(val, MapType_Get(f), arena);
if (!msgval.map_val) return false;
} else if (upb_fielddef_isseq(f)) {
} else if (upb_FieldDef_IsRepeated(f)) {
msgval.array_val = RepeatedField_GetUpbArray(val, TypeInfo_Get(f), arena);
if (!msgval.array_val) return false;
} else if (upb_fielddef_issubmsg(f) && Z_TYPE_P(val) == IS_NULL) {
upb_msg_clearfield(intern->msg, f);
} else if (upb_FieldDef_IsSubMessage(f) && Z_TYPE_P(val) == IS_NULL) {
upb_Message_ClearField(intern->msg, f);
return true;
} else {
if (!Convert_PhpToUpb(val, &msgval, TypeInfo_Get(f), arena)) return false;
}
upb_msg_set(intern->msg, f, msgval, arena);
upb_Message_Set(intern->msg, f, msgval, arena);
return true;
}
static bool MessageEq(const upb_msg *m1, const upb_msg *m2, const upb_msgdef *m);
static bool MessageEq(const upb_Message *m1, const upb_Message *m2, const upb_MessageDef *m);
/**
* ValueEq()
*/
bool ValueEq(upb_msgval val1, upb_msgval val2, TypeInfo type) {
bool ValueEq(upb_MessageValue val1, upb_MessageValue val2, TypeInfo type) {
switch (type.type) {
case UPB_TYPE_BOOL:
case kUpb_CType_Bool:
return val1.bool_val == val2.bool_val;
case UPB_TYPE_INT32:
case UPB_TYPE_UINT32:
case UPB_TYPE_ENUM:
case kUpb_CType_Int32:
case kUpb_CType_UInt32:
case kUpb_CType_Enum:
return val1.int32_val == val2.int32_val;
case UPB_TYPE_INT64:
case UPB_TYPE_UINT64:
case kUpb_CType_Int64:
case kUpb_CType_UInt64:
return val1.int64_val == val2.int64_val;
case UPB_TYPE_FLOAT:
case kUpb_CType_Float:
return val1.float_val == val2.float_val;
case UPB_TYPE_DOUBLE:
case kUpb_CType_Double:
return val1.double_val == val2.double_val;
case UPB_TYPE_STRING:
case UPB_TYPE_BYTES:
case kUpb_CType_String:
case kUpb_CType_Bytes:
return val1.str_val.size == val2.str_val.size &&
memcmp(val1.str_val.data, val2.str_val.data, val1.str_val.size) == 0;
case UPB_TYPE_MESSAGE:
case kUpb_CType_Message:
return MessageEq(val1.msg_val, val2.msg_val, type.desc->msgdef);
default:
return false;
@ -198,27 +217,25 @@ bool ValueEq(upb_msgval val1, upb_msgval val2, TypeInfo type) {
/**
* MessageEq()
*/
static bool MessageEq(const upb_msg *m1, const upb_msg *m2, const upb_msgdef *m) {
upb_msg_field_iter i;
static bool MessageEq(const upb_Message *m1, const upb_Message *m2, const upb_MessageDef *m) {
int n = upb_MessageDef_FieldCount(m);
for(upb_msg_field_begin(&i, m);
!upb_msg_field_done(&i);
upb_msg_field_next(&i)) {
const upb_fielddef *f = upb_msg_iter_field(&i);
for(int i = 0; i < n; i++) {
const upb_FieldDef *f = upb_MessageDef_Field(m, i);
if (upb_fielddef_haspresence(f)) {
if (upb_msg_has(m1, f) != upb_msg_has(m2, f)) {
if (upb_FieldDef_HasPresence(f)) {
if (upb_Message_Has(m1, f) != upb_Message_Has(m2, f)) {
return false;
}
if (!upb_msg_has(m1, f)) continue;
if (!upb_Message_Has(m1, f)) continue;
}
upb_msgval val1 = upb_msg_get(m1, f);
upb_msgval val2 = upb_msg_get(m2, f);
upb_MessageValue val1 = upb_Message_Get(m1, f);
upb_MessageValue val2 = upb_Message_Get(m2, f);
if (upb_fielddef_ismap(f)) {
if (upb_FieldDef_IsMap(f)) {
if (!MapEq(val1.map_val, val2.map_val, MapType_Get(f))) return false;
} else if (upb_fielddef_isseq(f)) {
} else if (upb_FieldDef_IsRepeated(f)) {
if (!ArrayEq(val1.array_val, val2.array_val, TypeInfo_Get(f))) return false;
} else {
if (!ValueEq(val1, val2, TypeInfo_Get(f))) return false;
@ -239,7 +256,7 @@ static bool MessageEq(const upb_msg *m1, const upb_msg *m2, const upb_msgdef *m)
static int Message_compare_objects(zval *m1, zval *m2) {
Message* intern1 = (Message*)Z_OBJ_P(m1);
Message* intern2 = (Message*)Z_OBJ_P(m2);
const upb_msgdef *m = intern1->desc->msgdef;
const upb_MessageDef *m = intern1->desc->msgdef;
if (intern2->desc->msgdef != m) return 1;
@ -268,19 +285,19 @@ static int Message_has_property(PROTO_VAL *obj, PROTO_STR *member,
int has_set_exists,
void **cache_slot) {
Message* intern = PROTO_VAL_P(obj);
const upb_fielddef *f = get_field(intern, member);
const upb_FieldDef *f = get_field(intern, member);
if (!f) return 0;
if (!upb_fielddef_haspresence(f)) {
if (!upb_FieldDef_HasPresence(f)) {
zend_throw_exception_ex(
NULL, 0,
"Cannot call isset() on field %s which does not have presence.",
upb_fielddef_name(f));
upb_FieldDef_Name(f));
return 0;
}
return upb_msg_has(intern->msg, f);
return upb_Message_Has(intern->msg, f);
}
/**
@ -302,19 +319,19 @@ static int Message_has_property(PROTO_VAL *obj, PROTO_STR *member,
static void Message_unset_property(PROTO_VAL *obj, PROTO_STR *member,
void **cache_slot) {
Message* intern = PROTO_VAL_P(obj);
const upb_fielddef *f = get_field(intern, member);
const upb_FieldDef *f = get_field(intern, member);
if (!f) return;
if (!upb_fielddef_haspresence(f)) {
if (!upb_FieldDef_HasPresence(f)) {
zend_throw_exception_ex(
NULL, 0,
"Cannot call unset() on field %s which does not have presence.",
upb_fielddef_name(f));
upb_FieldDef_Name(f));
return;
}
upb_msg_clearfield(intern->msg, f);
upb_Message_ClearField(intern->msg, f);
}
@ -339,7 +356,7 @@ static void Message_unset_property(PROTO_VAL *obj, PROTO_STR *member,
static zval *Message_read_property(PROTO_VAL *obj, PROTO_STR *member,
int type, void **cache_slot, zval *rv) {
Message* intern = PROTO_VAL_P(obj);
const upb_fielddef *f = get_field(intern, member);
const upb_FieldDef *f = get_field(intern, member);
if (!f) return &EG(uninitialized_zval);
Message_get(intern, f, rv);
@ -370,7 +387,7 @@ static zval *Message_read_property(PROTO_VAL *obj, PROTO_STR *member,
static PROTO_RETURN_VAL Message_write_property(
PROTO_VAL *obj, PROTO_STR *member, zval *val, void **cache_slot) {
Message* intern = PROTO_VAL_P(obj);
const upb_fielddef *f = get_field(intern, member);
const upb_FieldDef *f = get_field(intern, member);
if (f && Message_set(intern, f, val)) {
#if PHP_VERSION_ID < 70400
@ -409,11 +426,11 @@ static zval *Message_get_property_ptr_ptr(PROTO_VAL *object, PROTO_STR *member,
*/
static zend_object *Message_clone_obj(PROTO_VAL *object) {
Message* intern = PROTO_VAL_P(object);
upb_msg *clone = upb_msg_new(intern->desc->msgdef, Arena_Get(&intern->arena));
upb_Message *clone = upb_Message_New(intern->desc->msgdef, Arena_Get(&intern->arena));
// TODO: copy unknown fields?
// TODO: use official upb msg copy function
memcpy(clone, intern->msg, upb_msgdef_layout(intern->desc->msgdef)->size);
memcpy(clone, intern->msg, upb_MessageDef_MiniTable(intern->desc->msgdef)->size);
zval ret;
Message_GetPhpWrapper(&ret, intern->desc, clone, &intern->arena);
return Z_OBJ_P(&ret);
@ -433,7 +450,7 @@ static HashTable *Message_get_properties(PROTO_VAL *object) {
// These are documented in the header file.
void Message_GetPhpWrapper(zval *val, const Descriptor *desc, upb_msg *msg,
void Message_GetPhpWrapper(zval *val, const Descriptor *desc, upb_Message *msg,
zval *arena) {
if (!msg) {
ZVAL_NULL(val);
@ -453,8 +470,8 @@ void Message_GetPhpWrapper(zval *val, const Descriptor *desc, upb_msg *msg,
}
}
bool Message_GetUpbMessage(zval *val, const Descriptor *desc, upb_arena *arena,
upb_msg **msg) {
bool Message_GetUpbMessage(zval *val, const Descriptor *desc, upb_Arena *arena,
upb_Message **msg) {
PBPHP_ASSERT(desc);
if (Z_ISREF_P(val)) {
@ -464,7 +481,7 @@ bool Message_GetUpbMessage(zval *val, const Descriptor *desc, upb_arena *arena,
if (Z_TYPE_P(val) == IS_OBJECT &&
instanceof_function(Z_OBJCE_P(val), desc->class_entry)) {
Message *intern = (Message*)Z_OBJ_P(val);
upb_arena_fuse(arena, Arena_Get(&intern->arena));
upb_Arena_Fuse(arena, Arena_Get(&intern->arena));
*msg = intern->msg;
return true;
} else {
@ -501,8 +518,8 @@ bool Message_GetUpbMessage(zval *val, const Descriptor *desc, upb_arena *arena,
*
* The initializer must be an array.
*/
bool Message_InitFromPhp(upb_msg *msg, const upb_msgdef *m, zval *init,
upb_arena *arena) {
bool Message_InitFromPhp(upb_Message *msg, const upb_MessageDef *m, zval *init,
upb_Arena *arena) {
HashTable* table = HASH_OF(init);
HashPosition pos;
@ -513,7 +530,7 @@ bool Message_InitFromPhp(upb_msg *msg, const upb_msgdef *m, zval *init,
if (Z_TYPE_P(init) != IS_ARRAY) {
zend_throw_exception_ex(NULL, 0,
"Initializer for a message %s must be an array.",
upb_msgdef_fullname(m));
upb_MessageDef_FullName(m));
return false;
}
@ -522,8 +539,8 @@ bool Message_InitFromPhp(upb_msg *msg, const upb_msgdef *m, zval *init,
while (true) { // Iterate over key/value pairs.
zval key;
zval *val;
const upb_fielddef *f;
upb_msgval msgval;
const upb_FieldDef *f;
upb_MessageValue msgval;
zend_hash_get_current_key_zval_ex(table, &key, &pos);
val = zend_hash_get_current_data_ex(table, &pos);
@ -534,7 +551,7 @@ bool Message_InitFromPhp(upb_msg *msg, const upb_msgdef *m, zval *init,
ZVAL_DEREF(val);
}
f = upb_msgdef_ntof(m, Z_STRVAL_P(&key), Z_STRLEN_P(&key));
f = upb_MessageDef_FindFieldByNameWithSize(m, Z_STRVAL_P(&key), Z_STRLEN_P(&key));
if (!f) {
zend_throw_exception_ex(NULL, 0,
@ -542,10 +559,10 @@ bool Message_InitFromPhp(upb_msg *msg, const upb_msgdef *m, zval *init,
return false;
}
if (upb_fielddef_ismap(f)) {
if (upb_FieldDef_IsMap(f)) {
msgval.map_val = MapField_GetUpbMap(val, MapType_Get(f), arena);
if (!msgval.map_val) return false;
} else if (upb_fielddef_isseq(f)) {
} else if (upb_FieldDef_IsRepeated(f)) {
msgval.array_val = RepeatedField_GetUpbArray(val, TypeInfo_Get(f), arena);
if (!msgval.array_val) return false;
} else {
@ -554,7 +571,7 @@ bool Message_InitFromPhp(upb_msg *msg, const upb_msgdef *m, zval *init,
}
}
upb_msg_set(msg, f, msgval, arena);
upb_Message_Set(msg, f, msgval, arena);
zend_hash_move_forward_ex(table, &pos);
zval_dtor(&key);
}
@ -562,7 +579,7 @@ bool Message_InitFromPhp(upb_msg *msg, const upb_msgdef *m, zval *init,
static void Message_Initialize(Message *intern, const Descriptor *desc) {
intern->desc = desc;
intern->msg = upb_msg_new(desc->msgdef, Arena_Get(&intern->arena));
intern->msg = upb_Message_New(desc->msgdef, Arena_Get(&intern->arena));
ObjCache_Add(intern->msg, &intern->std);
}
@ -576,7 +593,7 @@ PHP_METHOD(Message, __construct) {
Message* intern = (Message*)Z_OBJ_P(getThis());
const Descriptor* desc;
zend_class_entry *ce = Z_OBJCE_P(getThis());
upb_arena *arena = Arena_Get(&intern->arena);
upb_Arena *arena = Arena_Get(&intern->arena);
zval *init_arr = NULL;
// This descriptor should always be available, as the generated __construct
@ -617,7 +634,7 @@ PHP_METHOD(Message, __construct) {
*/
PHP_METHOD(Message, discardUnknownFields) {
Message* intern = (Message*)Z_OBJ_P(getThis());
upb_msg_discardunknown(intern->msg, intern->desc->msgdef, 64);
upb_Message_DiscardUnknown(intern->msg, intern->desc->msgdef, 64);
}
/**
@ -627,7 +644,7 @@ PHP_METHOD(Message, discardUnknownFields) {
*/
PHP_METHOD(Message, clear) {
Message* intern = (Message*)Z_OBJ_P(getThis());
upb_msg_clear(intern->msg, intern->desc->msgdef);
upb_Message_Clear(intern->msg, intern->desc->msgdef);
}
/**
@ -639,8 +656,8 @@ PHP_METHOD(Message, clear) {
PHP_METHOD(Message, mergeFrom) {
Message* intern = (Message*)Z_OBJ_P(getThis());
Message* from;
upb_arena *arena = Arena_Get(&intern->arena);
const upb_msglayout *l = upb_msgdef_layout(intern->desc->msgdef);
upb_Arena *arena = Arena_Get(&intern->arena);
const upb_MiniTable *l = upb_MessageDef_MiniTable(intern->desc->msgdef);
zval* value;
char *pb;
size_t size;
@ -659,14 +676,15 @@ PHP_METHOD(Message, mergeFrom) {
// TODO(haberman): use a temp arena for this once we can make upb_decode()
// copy strings.
pb = upb_encode(from->msg, l, arena, &size);
pb = upb_Encode(from->msg, l, 0, arena, &size);
if (!pb) {
zend_throw_exception_ex(NULL, 0, "Max nesting exceeded");
return;
}
ok = upb_decode(pb, size, intern->msg, l, arena);
ok = upb_Decode(pb, size, intern->msg, l, NULL, 0, arena) ==
kUpb_DecodeStatus_Ok;
PBPHP_ASSERT(ok);
}
@ -681,8 +699,8 @@ PHP_METHOD(Message, mergeFromString) {
char *data = NULL;
char *data_copy = NULL;
zend_long data_len;
const upb_msglayout *l = upb_msgdef_layout(intern->desc->msgdef);
upb_arena *arena = Arena_Get(&intern->arena);
const upb_MiniTable *l = upb_MessageDef_MiniTable(intern->desc->msgdef);
upb_Arena *arena = Arena_Get(&intern->arena);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &data, &data_len) ==
FAILURE) {
@ -690,10 +708,11 @@ PHP_METHOD(Message, mergeFromString) {
}
// TODO(haberman): avoid this copy when we can make the decoder copy.
data_copy = upb_arena_malloc(arena, data_len);
data_copy = upb_Arena_Malloc(arena, data_len);
memcpy(data_copy, data, data_len);
if (!upb_decode(data_copy, data_len, intern->msg, l, arena)) {
if (upb_Decode(data_copy, data_len, intern->msg, l, NULL, 0, arena) !=
kUpb_DecodeStatus_Ok) {
zend_throw_exception_ex(NULL, 0, "Error occurred during parsing");
return;
}
@ -707,21 +726,21 @@ PHP_METHOD(Message, mergeFromString) {
*/
PHP_METHOD(Message, serializeToString) {
Message* intern = (Message*)Z_OBJ_P(getThis());
const upb_msglayout *l = upb_msgdef_layout(intern->desc->msgdef);
upb_arena *tmp_arena = upb_arena_new();
const upb_MiniTable *l = upb_MessageDef_MiniTable(intern->desc->msgdef);
upb_Arena *tmp_arena = upb_Arena_New();
char *data;
size_t size;
data = upb_encode(intern->msg, l, tmp_arena, &size);
data = upb_Encode(intern->msg, l, 0, tmp_arena, &size);
if (!data) {
zend_throw_exception_ex(NULL, 0, "Error occurred during serialization");
upb_arena_free(tmp_arena);
upb_Arena_Free(tmp_arena);
return;
}
RETVAL_STRINGL(data, size);
upb_arena_free(tmp_arena);
upb_Arena_Free(tmp_arena);
}
/**
@ -735,8 +754,8 @@ PHP_METHOD(Message, mergeFromJsonString) {
char *data = NULL;
char *data_copy = NULL;
zend_long data_len;
upb_arena *arena = Arena_Get(&intern->arena);
upb_status status;
upb_Arena *arena = Arena_Get(&intern->arena);
upb_Status status;
zend_bool ignore_json_unknown = false;
int options = 0;
@ -746,20 +765,20 @@ PHP_METHOD(Message, mergeFromJsonString) {
}
// TODO(haberman): avoid this copy when we can make the decoder copy.
data_copy = upb_arena_malloc(arena, data_len + 1);
data_copy = upb_Arena_Malloc(arena, data_len + 1);
memcpy(data_copy, data, data_len);
data_copy[data_len] = '\0';
if (ignore_json_unknown) {
options |= UPB_JSONDEC_IGNOREUNKNOWN;
options |= upb_JsonDecode_IgnoreUnknown;
}
upb_status_clear(&status);
if (!upb_json_decode(data_copy, data_len, intern->msg, intern->desc->msgdef,
upb_Status_Clear(&status);
if (!upb_JsonDecode(data_copy, data_len, intern->msg, intern->desc->msgdef,
DescriptorPool_GetSymbolTable(), options, arena,
&status)) {
zend_throw_exception_ex(NULL, 0, "Error occurred during parsing: %s",
upb_status_errmsg(&status));
upb_Status_ErrorMessage(&status));
return;
}
}
@ -776,7 +795,7 @@ PHP_METHOD(Message, serializeToJsonString) {
int options = 0;
char buf[1024];
zend_bool preserve_proto_fieldnames = false;
upb_status status;
upb_Status status;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|b",
&preserve_proto_fieldnames) == FAILURE) {
@ -784,24 +803,24 @@ PHP_METHOD(Message, serializeToJsonString) {
}
if (preserve_proto_fieldnames) {
options |= UPB_JSONENC_PROTONAMES;
options |= upb_JsonEncode_UseProtoNames;
}
upb_status_clear(&status);
size = upb_json_encode(intern->msg, intern->desc->msgdef,
upb_Status_Clear(&status);
size = upb_JsonEncode(intern->msg, intern->desc->msgdef,
DescriptorPool_GetSymbolTable(), options, buf,
sizeof(buf), &status);
if (!upb_ok(&status)) {
if (!upb_Status_IsOk(&status)) {
zend_throw_exception_ex(NULL, 0,
"Error occurred during JSON serialization: %s",
upb_status_errmsg(&status));
upb_Status_ErrorMessage(&status));
return;
}
if (size >= sizeof(buf)) {
char *buf2 = malloc(size + 1);
upb_json_encode(intern->msg, intern->desc->msgdef,
upb_JsonEncode(intern->msg, intern->desc->msgdef,
DescriptorPool_GetSymbolTable(), options, buf2, size + 1,
&status);
RETVAL_STRINGL(buf2, size);
@ -827,26 +846,26 @@ PHP_METHOD(Message, serializeToJsonString) {
PHP_METHOD(Message, readWrapperValue) {
Message* intern = (Message*)Z_OBJ_P(getThis());
char* member;
const upb_fielddef *f;
const upb_FieldDef *f;
zend_long size;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &member, &size) == FAILURE) {
return;
}
f = upb_msgdef_ntof(intern->desc->msgdef, member, size);
f = upb_MessageDef_FindFieldByNameWithSize(intern->desc->msgdef, member, size);
if (!f || !upb_msgdef_iswrapper(upb_fielddef_msgsubdef(f))) {
if (!f || !IsWrapper(upb_FieldDef_MessageSubDef(f))) {
zend_throw_exception_ex(NULL, 0, "Message %s has no field %s",
upb_msgdef_fullname(intern->desc->msgdef), member);
upb_MessageDef_FullName(intern->desc->msgdef), member);
return;
}
if (upb_msg_has(intern->msg, f)) {
const upb_msg *wrapper = upb_msg_get(intern->msg, f).msg_val;
const upb_msgdef *m = upb_fielddef_msgsubdef(f);
const upb_fielddef *val_f = upb_msgdef_itof(m, 1);
upb_msgval msgval = upb_msg_get(wrapper, val_f);
if (upb_Message_Has(intern->msg, f)) {
const upb_Message *wrapper = upb_Message_Get(intern->msg, f).msg_val;
const upb_MessageDef *m = upb_FieldDef_MessageSubDef(f);
const upb_FieldDef *val_f = upb_MessageDef_FindFieldByNumber(m, 1);
upb_MessageValue msgval = upb_Message_Get(wrapper, val_f);
zval ret;
Convert_UpbToPhp(msgval, &ret, TypeInfo_Get(val_f), &intern->arena);
RETURN_COPY_VALUE(&ret);
@ -872,10 +891,10 @@ PHP_METHOD(Message, readWrapperValue) {
*/
PHP_METHOD(Message, writeWrapperValue) {
Message* intern = (Message*)Z_OBJ_P(getThis());
upb_arena *arena = Arena_Get(&intern->arena);
upb_Arena *arena = Arena_Get(&intern->arena);
char* member;
const upb_fielddef *f;
upb_msgval msgval;
const upb_FieldDef *f;
upb_MessageValue msgval;
zend_long size;
zval* val;
@ -884,11 +903,11 @@ PHP_METHOD(Message, writeWrapperValue) {
return;
}
f = upb_msgdef_ntof(intern->desc->msgdef, member, size);
f = upb_MessageDef_FindFieldByNameWithSize(intern->desc->msgdef, member, size);
if (!f || !upb_msgdef_iswrapper(upb_fielddef_msgsubdef(f))) {
if (!f || !IsWrapper(upb_FieldDef_MessageSubDef(f))) {
zend_throw_exception_ex(NULL, 0, "Message %s has no field %s",
upb_msgdef_fullname(intern->desc->msgdef), member);
upb_MessageDef_FullName(intern->desc->msgdef), member);
return;
}
@ -897,18 +916,18 @@ PHP_METHOD(Message, writeWrapperValue) {
}
if (Z_TYPE_P(val) == IS_NULL) {
upb_msg_clearfield(intern->msg, f);
upb_Message_ClearField(intern->msg, f);
} else {
const upb_msgdef *m = upb_fielddef_msgsubdef(f);
const upb_fielddef *val_f = upb_msgdef_itof(m, 1);
upb_msg *wrapper;
const upb_MessageDef *m = upb_FieldDef_MessageSubDef(f);
const upb_FieldDef *val_f = upb_MessageDef_FindFieldByNumber(m, 1);
upb_Message *wrapper;
if (!Convert_PhpToUpb(val, &msgval, TypeInfo_Get(val_f), arena)) {
return; // Error is already set.
}
wrapper = upb_msg_mutable(intern->msg, f, arena).msg;
upb_msg_set(wrapper, val_f, msgval, arena);
wrapper = upb_Message_Mutable(intern->msg, f, arena).msg;
upb_Message_Set(wrapper, val_f, msgval, arena);
}
}
@ -922,8 +941,8 @@ PHP_METHOD(Message, writeWrapperValue) {
*/
PHP_METHOD(Message, whichOneof) {
Message* intern = (Message*)Z_OBJ_P(getThis());
const upb_oneofdef* oneof;
const upb_fielddef* field;
const upb_OneofDef* oneof;
const upb_FieldDef* field;
char* name;
zend_long len;
@ -931,16 +950,16 @@ PHP_METHOD(Message, whichOneof) {
return;
}
oneof = upb_msgdef_ntoo(intern->desc->msgdef, name, len);
oneof = upb_MessageDef_FindOneofByNameWithSize(intern->desc->msgdef, name, len);
if (!oneof) {
zend_throw_exception_ex(NULL, 0, "Message %s has no oneof %s",
upb_msgdef_fullname(intern->desc->msgdef), name);
upb_MessageDef_FullName(intern->desc->msgdef), name);
return;
}
field = upb_msg_whichoneof(intern->msg, oneof);
RETURN_STRING(field ? upb_fielddef_name(field) : "");
field = upb_Message_WhichOneof(intern->msg, oneof);
RETURN_STRING(field ? upb_FieldDef_Name(field) : "");
}
/**
@ -959,21 +978,21 @@ PHP_METHOD(Message, whichOneof) {
PHP_METHOD(Message, hasOneof) {
Message* intern = (Message*)Z_OBJ_P(getThis());
zend_long field_num;
const upb_fielddef* f;
const upb_FieldDef* f;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &field_num) == FAILURE) {
return;
}
f = upb_msgdef_itof(intern->desc->msgdef, field_num);
f = upb_MessageDef_FindFieldByNumber(intern->desc->msgdef, field_num);
if (!f || !upb_fielddef_realcontainingoneof(f)) {
if (!f || !upb_FieldDef_RealContainingOneof(f)) {
php_error_docref(NULL, E_USER_ERROR,
"Internal error, no such oneof field %d\n",
(int)field_num);
}
RETVAL_BOOL(upb_msg_has(intern->msg, f));
RETVAL_BOOL(upb_Message_Has(intern->msg, f));
}
/**
@ -992,27 +1011,27 @@ PHP_METHOD(Message, hasOneof) {
PHP_METHOD(Message, readOneof) {
Message* intern = (Message*)Z_OBJ_P(getThis());
zend_long field_num;
const upb_fielddef* f;
const upb_FieldDef* f;
zval ret;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &field_num) == FAILURE) {
return;
}
f = upb_msgdef_itof(intern->desc->msgdef, field_num);
f = upb_MessageDef_FindFieldByNumber(intern->desc->msgdef, field_num);
if (!f || !upb_fielddef_realcontainingoneof(f)) {
if (!f || !upb_FieldDef_RealContainingOneof(f)) {
php_error_docref(NULL, E_USER_ERROR,
"Internal error, no such oneof field %d\n",
(int)field_num);
}
if (upb_fielddef_issubmsg(f) && !upb_msg_has(intern->msg, f)) {
if (upb_FieldDef_IsSubMessage(f) && !upb_Message_Has(intern->msg, f)) {
RETURN_NULL();
}
{
upb_msgval msgval = upb_msg_get(intern->msg, f);
upb_MessageValue msgval = upb_Message_Get(intern->msg, f);
Convert_UpbToPhp(msgval, &ret, TypeInfo_Get(f), &intern->arena);
}
@ -1042,9 +1061,9 @@ PHP_METHOD(Message, readOneof) {
PHP_METHOD(Message, writeOneof) {
Message* intern = (Message*)Z_OBJ_P(getThis());
zend_long field_num;
const upb_fielddef* f;
upb_arena *arena = Arena_Get(&intern->arena);
upb_msgval msgval;
const upb_FieldDef* f;
upb_Arena *arena = Arena_Get(&intern->arena);
upb_MessageValue msgval;
zval* val;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "lz", &field_num, &val) ==
@ -1052,16 +1071,16 @@ PHP_METHOD(Message, writeOneof) {
return;
}
f = upb_msgdef_itof(intern->desc->msgdef, field_num);
f = upb_MessageDef_FindFieldByNumber(intern->desc->msgdef, field_num);
if (upb_fielddef_issubmsg(f) && Z_TYPE_P(val) == IS_NULL) {
upb_msg_clearfield(intern->msg, f);
if (upb_FieldDef_IsSubMessage(f) && Z_TYPE_P(val) == IS_NULL) {
upb_Message_ClearField(intern->msg, f);
return;
} else if (!Convert_PhpToUpb(val, &msgval, TypeInfo_Get(f), arena)) {
return;
}
upb_msg_set(intern->msg, f, msgval, arena);
upb_Message_Set(intern->msg, f, msgval, arena);
}
ZEND_BEGIN_ARG_INFO_EX(arginfo_construct, 0, 0, 0)
@ -1108,26 +1127,27 @@ static zend_function_entry Message_methods[] = {
static const char TYPE_URL_PREFIX[] = "type.googleapis.com/";
static upb_msgval Message_getval(Message *intern, const char *field_name) {
const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, field_name);
static upb_MessageValue Message_getval(Message *intern, const char *field_name) {
const upb_FieldDef *f = upb_MessageDef_FindFieldByName(intern->desc->msgdef, field_name);
PBPHP_ASSERT(f);
return upb_msg_get(intern->msg, f);
return upb_Message_Get(intern->msg, f);
}
static void Message_setval(Message *intern, const char *field_name,
upb_msgval val) {
const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef, field_name);
upb_MessageValue val) {
const upb_FieldDef *f =
upb_MessageDef_FindFieldByName(intern->desc->msgdef, field_name);
PBPHP_ASSERT(f);
return upb_msg_set(intern->msg, f, val, Arena_Get(&intern->arena));
upb_Message_Set(intern->msg, f, val, Arena_Get(&intern->arena));
}
static upb_msgval StringVal(upb_strview view) {
upb_msgval ret;
static upb_MessageValue StringVal(upb_StringView view) {
upb_MessageValue ret;
ret.str_val = view;
return ret;
}
static bool TryStripUrlPrefix(upb_strview *str) {
static bool TryStripUrlPrefix(upb_StringView *str) {
size_t size = strlen(TYPE_URL_PREFIX);
if (str->size < size || memcmp(TYPE_URL_PREFIX, str->data, size) != 0) {
return false;
@ -1137,17 +1157,17 @@ static bool TryStripUrlPrefix(upb_strview *str) {
return true;
}
static bool StrViewEq(upb_strview view, const char *str) {
static bool StrViewEq(upb_StringView view, const char *str) {
size_t size = strlen(str);
return view.size == size && memcmp(view.data, str, size) == 0;
}
PHP_METHOD(google_protobuf_Any, unpack) {
Message* intern = (Message*)Z_OBJ_P(getThis());
upb_strview type_url = Message_getval(intern, "type_url").str_val;
upb_strview value = Message_getval(intern, "value").str_val;
upb_symtab *symtab = DescriptorPool_GetSymbolTable();
const upb_msgdef *m;
upb_StringView type_url = Message_getval(intern, "type_url").str_val;
upb_StringView value = Message_getval(intern, "value").str_val;
upb_DefPool *symtab = DescriptorPool_GetSymbolTable();
const upb_MessageDef *m;
Descriptor *desc;
zval ret;
@ -1159,7 +1179,7 @@ PHP_METHOD(google_protobuf_Any, unpack) {
return;
}
m = upb_symtab_lookupmsg2(symtab, type_url.data, type_url.size);
m = upb_DefPool_FindMessageByNameWithSize(symtab, type_url.data, type_url.size);
if (m == NULL) {
zend_throw_exception(
@ -1176,26 +1196,27 @@ PHP_METHOD(google_protobuf_Any, unpack) {
ZVAL_OBJ(&ret, obj);
// Get value.
if (!upb_decode(value.data, value.size, msg->msg,
upb_msgdef_layout(desc->msgdef), Arena_Get(&msg->arena))) {
if (upb_Decode(value.data, value.size, msg->msg,
upb_MessageDef_MiniTable(desc->msgdef), NULL, 0,
Arena_Get(&msg->arena)) != kUpb_DecodeStatus_Ok) {
zend_throw_exception_ex(NULL, 0, "Error occurred during parsing");
zval_dtor(&ret);
return;
}
// Fuse since the parsed message could alias "value".
upb_arena_fuse(Arena_Get(&intern->arena), Arena_Get(&msg->arena));
upb_Arena_Fuse(Arena_Get(&intern->arena), Arena_Get(&msg->arena));
RETURN_COPY_VALUE(&ret);
}
PHP_METHOD(google_protobuf_Any, pack) {
Message* intern = (Message*)Z_OBJ_P(getThis());
upb_arena *arena = Arena_Get(&intern->arena);
upb_Arena *arena = Arena_Get(&intern->arena);
zval *val;
Message *msg;
upb_strview value;
upb_strview type_url;
upb_StringView value;
upb_StringView type_url;
const char *full_name;
char *buf;
@ -1212,14 +1233,14 @@ PHP_METHOD(google_protobuf_Any, pack) {
msg = (Message*)Z_OBJ_P(val);
// Serialize and set value.
value.data = upb_encode(msg->msg, upb_msgdef_layout(msg->desc->msgdef), arena,
&value.size);
value.data = upb_Encode(msg->msg, upb_MessageDef_MiniTable(msg->desc->msgdef),
0, arena, &value.size);
Message_setval(intern, "value", StringVal(value));
// Set type url: type_url_prefix + fully_qualified_name
full_name = upb_msgdef_fullname(msg->desc->msgdef);
full_name = upb_MessageDef_FullName(msg->desc->msgdef);
type_url.size = strlen(TYPE_URL_PREFIX) + strlen(full_name);
buf = upb_arena_malloc(arena, type_url.size + 1);
buf = upb_Arena_Malloc(arena, type_url.size + 1);
memcpy(buf, TYPE_URL_PREFIX, strlen(TYPE_URL_PREFIX));
memcpy(buf + strlen(TYPE_URL_PREFIX), full_name, strlen(full_name));
type_url.data = buf;
@ -1228,9 +1249,9 @@ PHP_METHOD(google_protobuf_Any, pack) {
PHP_METHOD(google_protobuf_Any, is) {
Message* intern = (Message*)Z_OBJ_P(getThis());
upb_strview type_url = Message_getval(intern, "type_url").str_val;
upb_StringView type_url = Message_getval(intern, "type_url").str_val;
zend_class_entry *klass = NULL;
const upb_msgdef *m;
const upb_MessageDef *m;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "C", &klass) ==
FAILURE) {
@ -1244,7 +1265,7 @@ PHP_METHOD(google_protobuf_Any, is) {
}
RETURN_BOOL(TryStripUrlPrefix(&type_url) &&
StrViewEq(type_url, upb_msgdef_fullname(m)));
StrViewEq(type_url, upb_MessageDef_FullName(m)));
}
PHP_METHOD(google_protobuf_Timestamp, fromDateTime) {
@ -1266,7 +1287,7 @@ PHP_METHOD(google_protobuf_Timestamp, fromDateTime) {
return;
}
upb_msgval timestamp_seconds;
upb_MessageValue timestamp_seconds;
{
zval retval;
zval function_name;
@ -1276,7 +1297,7 @@ PHP_METHOD(google_protobuf_Timestamp, fromDateTime) {
if (call_user_function(EG(function_table), NULL, &function_name, &retval, 1,
datetime) == FAILURE ||
!Convert_PhpToUpb(&retval, &timestamp_seconds,
TypeInfo_FromType(UPB_TYPE_INT64), NULL)) {
TypeInfo_FromType(kUpb_CType_Int64), NULL)) {
zend_error(E_ERROR, "Cannot get timestamp from DateTime.");
return;
}
@ -1285,7 +1306,7 @@ PHP_METHOD(google_protobuf_Timestamp, fromDateTime) {
zval_dtor(&function_name);
}
upb_msgval timestamp_nanos;
upb_MessageValue timestamp_nanos;
{
zval retval;
zval function_name;
@ -1302,7 +1323,7 @@ PHP_METHOD(google_protobuf_Timestamp, fromDateTime) {
if (call_user_function(EG(function_table), NULL, &function_name, &retval, 2,
params) == FAILURE ||
!Convert_PhpToUpb(&retval, &timestamp_nanos,
TypeInfo_FromType(UPB_TYPE_INT32), NULL)) {
TypeInfo_FromType(kUpb_CType_Int32), NULL)) {
zend_error(E_ERROR, "Cannot format DateTime.");
return;
}
@ -1322,8 +1343,8 @@ PHP_METHOD(google_protobuf_Timestamp, fromDateTime) {
PHP_METHOD(google_protobuf_Timestamp, toDateTime) {
Message* intern = (Message*)Z_OBJ_P(getThis());
upb_msgval seconds = Message_getval(intern, "seconds");
upb_msgval nanos = Message_getval(intern, "nanos");
upb_MessageValue seconds = Message_getval(intern, "seconds");
upb_MessageValue nanos = Message_getval(intern, "nanos");
// Get formatted time string.
char formatted_time[32];

@ -38,24 +38,24 @@
// Registers the PHP Message class.
void Message_ModuleInit();
// Gets a upb_msg* for the PHP object |val|, which must either be a Message
// Gets a upb_Message* for the PHP object |val|, which must either be a Message
// object or 'null'. Returns true and stores the message in |msg| if the
// conversion succeeded (we can't return upb_msg* because null->NULL is a valid
// conversion succeeded (we can't return upb_Message* because null->NULL is a valid
// conversion). Returns false and raises a PHP error if this isn't a Message
// object or null, or if the Message object doesn't match this Descriptor.
//
// The given |arena| will be fused to this message's arena.
bool Message_GetUpbMessage(zval *val, const Descriptor *desc, upb_arena *arena,
upb_msg **msg);
bool Message_GetUpbMessage(zval *val, const Descriptor *desc, upb_Arena *arena,
upb_Message **msg);
// Gets or creates a PHP Message object to wrap the given upb_msg* and |desc|
// Gets or creates a PHP Message object to wrap the given upb_Message* and |desc|
// and returns it in |val|. The PHP object will keep a reference to this |arena|
// to ensure the underlying message data stays alive.
//
// If |msg| is NULL, this will return a PHP null.
void Message_GetPhpWrapper(zval *val, const Descriptor *desc, upb_msg *msg,
void Message_GetPhpWrapper(zval *val, const Descriptor *desc, upb_Message *msg,
zval *arena);
bool ValueEq(upb_msgval val1, upb_msgval val2, TypeInfo type);
bool ValueEq(upb_MessageValue val1, upb_MessageValue val2, TypeInfo type);
#endif // PHP_PROTOBUF_MESSAGE_H_

@ -208,14 +208,29 @@ static void fill_classname(const char *fullname,
}
}
char *GetPhpClassname(const upb_filedef *file, const char *fullname) {
char *str_view_dup(upb_StringView str) {
char *ret = malloc(str.size + 1);
memcpy(ret, str.data, str.size);
ret[str.size] = '\0';
return ret;
}
char *GetPhpClassname(const upb_FileDef *file, const char *fullname) {
// Prepend '.' to package name to make it absolute. In the 5 additional
// bytes allocated, one for '.', one for trailing 0, and 3 for 'GPB' if
// given message is google.protobuf.Empty.
const char *package = upb_filedef_package(file);
const char *php_namespace = upb_filedef_phpnamespace(file);
const char *prefix = upb_filedef_phpprefix(file);
const google_protobuf_FileOptions* opts = upb_FileDef_Options(file);
const char *package = upb_FileDef_Package(file);
char *php_namespace =
google_protobuf_FileOptions_has_php_namespace(opts)
? str_view_dup(google_protobuf_FileOptions_php_namespace(opts))
: NULL;
char *prefix =
google_protobuf_FileOptions_has_php_class_prefix(opts)
? str_view_dup(google_protobuf_FileOptions_php_class_prefix(opts))
: NULL;
char *ret;
stringsink namesink;
stringsink_init(&namesink);
@ -224,5 +239,7 @@ char *GetPhpClassname(const upb_filedef *file, const char *fullname) {
stringsink_string(&namesink, "\0", 1);
ret = strdup(namesink.ptr);
stringsink_uninit(&namesink);
free(php_namespace);
free(prefix);
return ret;
}

@ -35,6 +35,6 @@
// Translates a protobuf symbol name (eg. foo.bar.Baz) into a PHP class name
// (eg. \Foo\Bar\Baz).
char *GetPhpClassname(const upb_filedef *file, const char *fullname);
char *GetPhpClassname(const upb_FileDef *file, const char *fullname);
#endif // PHP_PROTOBUF_NAMES_H_

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<package packagerversion="1.9.5" version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd">
<package xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" packagerversion="1.9.5" version="2.0" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd">
<name>protobuf</name>
<channel>pecl.php.net</channel>
<summary>Google's language-neutral, platform-neutral, extensible mechanism for serializing structured data.</summary>
@ -10,15 +10,15 @@
<email>protobuf-opensource@google.com</email>
<active>yes</active>
</lead>
<date>2022-01-28</date>
<time>00:03:40</time>
<date>2022-03-04</date>
<time>16:28:14</time>
<version>
<release>3.19.4</release>
<api>3.19.4</api>
<release>3.20.0RC1</release>
<api>3.20.0</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
<release>beta</release>
<api>beta</api>
</stability>
<license uri="https://opensource.org/licenses/BSD-3-Clause">BSD-3-Clause</license>
<notes>
@ -46,6 +46,9 @@
<file baseinstalldir="/" name="protobuf.c" role="src"/>
<file baseinstalldir="/" name="protobuf.h" role="src"/>
<file baseinstalldir="/" name="wkt.inc" role="src"/>
<file baseinstalldir="/" name="third_party/utf8_range/naive.c" role="doc"/>
<file baseinstalldir="/" name="third_party/utf8_range/range2-neon.c" role="doc"/>
<file baseinstalldir="/" name="third_party/utf8_range/range2-sse.c" role="doc"/>
<file baseinstalldir="/" name="LICENSE" role="doc"/>
</dir>
</contents>
@ -1203,5 +1206,20 @@ G A release.
<notes>
</notes>
</release>
<release>
<version>
<release>3.20.0RC1</release>
<api>3.20.0</api>
</version>
<stability>
<release>beta</release>
<api>beta</api>
</stability>
<date>2022-03-04</date>
<time>16:28:14</time>
<license uri="https://opensource.org/licenses/BSD-3-Clause">BSD-3-Clause</license>
<notes>
</notes>
</release>
</changelog>
</package>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -56,17 +56,11 @@ ZEND_BEGIN_MODULE_GLOBALS(protobuf)
// Set by the user to make the descriptor pool persist between requests.
zend_bool keep_descriptor_pool_after_request;
// Currently we make the generated pool a "global", which means that if a user
// does explicitly create threads within their request, the other threads will
// get different results from DescriptorPool::getGeneratedPool(). We require
// that all descriptors are loaded from the main thread.
zval generated_pool;
// A upb_symtab that we are saving for the next request so that we don't have
// A upb_DefPool that we are saving for the next request so that we don't have
// to rebuild it from scratch. When keep_descriptor_pool_after_request==true,
// we steal the upb_symtab from the global DescriptorPool object just before
// we steal the upb_DefPool from the global DescriptorPool object just before
// destroying it.
upb_symtab *global_symtab;
upb_DefPool *global_symtab;
// Object cache (see interface in protobuf.h).
HashTable object_cache;
@ -85,14 +79,14 @@ ZEND_END_MODULE_GLOBALS(protobuf)
void free_protobuf_globals(zend_protobuf_globals *globals) {
zend_hash_destroy(&globals->name_msg_cache);
zend_hash_destroy(&globals->name_enum_cache);
upb_symtab_free(globals->global_symtab);
upb_DefPool_Free(globals->global_symtab);
globals->global_symtab = NULL;
}
ZEND_DECLARE_MODULE_GLOBALS(protobuf)
const zval *get_generated_pool() {
return &PROTOBUF_G(generated_pool);
upb_DefPool *get_global_symtab() {
return PROTOBUF_G(global_symtab);
}
// This is a PHP extension (not a Zend extension). What follows is a summary of
@ -159,7 +153,6 @@ static PHP_GSHUTDOWN_FUNCTION(protobuf) {
}
static PHP_GINIT_FUNCTION(protobuf) {
ZVAL_NULL(&protobuf_globals->generated_pool);
protobuf_globals->global_symtab = NULL;
}
@ -171,13 +164,12 @@ static PHP_GINIT_FUNCTION(protobuf) {
static PHP_RINIT_FUNCTION(protobuf) {
// Create the global generated pool.
// Reuse the symtab (if any) left to us by the last request.
upb_symtab *symtab = PROTOBUF_G(global_symtab);
upb_DefPool *symtab = PROTOBUF_G(global_symtab);
if (!symtab) {
PROTOBUF_G(global_symtab) = symtab = upb_symtab_new();
PROTOBUF_G(global_symtab) = symtab = upb_DefPool_New();
zend_hash_init(&PROTOBUF_G(name_msg_cache), 64, NULL, NULL, 0);
zend_hash_init(&PROTOBUF_G(name_enum_cache), 64, NULL, NULL, 0);
}
DescriptorPool_CreateWithSymbolTable(&PROTOBUF_G(generated_pool), symtab);
zend_hash_init(&PROTOBUF_G(object_cache), 64, NULL, NULL, 0);
zend_hash_init(&PROTOBUF_G(descriptors), 64, NULL, ZVAL_PTR_DTOR, 0);
@ -196,7 +188,6 @@ static PHP_RSHUTDOWN_FUNCTION(protobuf) {
free_protobuf_globals(ZEND_MODULE_GLOBALS_BULK(protobuf));
}
zval_dtor(&PROTOBUF_G(generated_pool));
zend_hash_destroy(&PROTOBUF_G(object_cache));
zend_hash_destroy(&PROTOBUF_G(descriptors));
@ -246,20 +237,20 @@ bool ObjCache_Get(const void *upb_obj, zval *val) {
// Name Cache.
// -----------------------------------------------------------------------------
void NameMap_AddMessage(const upb_msgdef *m) {
char *k = GetPhpClassname(upb_msgdef_file(m), upb_msgdef_fullname(m));
void NameMap_AddMessage(const upb_MessageDef *m) {
char *k = GetPhpClassname(upb_MessageDef_File(m), upb_MessageDef_FullName(m));
zend_hash_str_add_ptr(&PROTOBUF_G(name_msg_cache), k, strlen(k), (void*)m);
free(k);
}
void NameMap_AddEnum(const upb_enumdef *e) {
char *k = GetPhpClassname(upb_enumdef_file(e), upb_enumdef_fullname(e));
void NameMap_AddEnum(const upb_EnumDef *e) {
char *k = GetPhpClassname(upb_EnumDef_File(e), upb_EnumDef_FullName(e));
zend_hash_str_add_ptr(&PROTOBUF_G(name_enum_cache), k, strlen(k), (void*)e);
free(k);
}
const upb_msgdef *NameMap_GetMessage(zend_class_entry *ce) {
const upb_msgdef *ret =
const upb_MessageDef *NameMap_GetMessage(zend_class_entry *ce) {
const upb_MessageDef *ret =
zend_hash_find_ptr(&PROTOBUF_G(name_msg_cache), ce->name);
if (!ret && ce->create_object) {
@ -282,8 +273,8 @@ const upb_msgdef *NameMap_GetMessage(zend_class_entry *ce) {
return ret;
}
const upb_enumdef *NameMap_GetEnum(zend_class_entry *ce) {
const upb_enumdef *ret =
const upb_EnumDef *NameMap_GetEnum(zend_class_entry *ce) {
const upb_EnumDef *ret =
zend_hash_find_ptr(&PROTOBUF_G(name_enum_cache), ce->name);
return ret;
}

@ -36,7 +36,7 @@
#include "php-upb.h"
const zval *get_generated_pool();
upb_DefPool *get_global_symtab();
#if PHP_VERSION_ID < 70300
#define GC_ADDREF(h) ++GC_REFCOUNT(h)
@ -127,16 +127,16 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_setter, 0, 0, 1)
ZEND_ARG_INFO(0, value)
ZEND_END_ARG_INFO()
#define PHP_PROTOBUF_VERSION "3.19.4"
#define PHP_PROTOBUF_VERSION "3.20.0RC1"
// ptr -> PHP object cache. This is a weak map that caches lazily-created
// wrapper objects around upb types:
// * upb_msg* -> Message
// * upb_array* -> RepeatedField
// * upb_map*, -> MapField
// * upb_msgdef* -> Descriptor
// * upb_enumdef* -> EnumDescriptor
// * upb_msgdef* -> Descriptor
// * upb_Message* -> Message
// * upb_Array* -> RepeatedField
// * upb_Map*, -> MapField
// * upb_MessageDef* -> Descriptor
// * upb_EnumDef* -> EnumDescriptor
// * upb_MessageDef* -> Descriptor
//
// Each wrapped object should add itself to the map when it is constructed, and
// remove itself from the map when it is destroyed. This is how we ensure that
@ -149,12 +149,12 @@ bool ObjCache_Get(const void *key, zval *val);
// PHP class name map. This is necessary because the pb_name->php_class_name
// transformation is non-reversible, so when we need to look up a msgdef or
// enumdef by PHP class, we can't turn the class name into a pb_name.
// * php_class_name -> upb_msgdef*
// * php_class_name -> upb_enumdef*
void NameMap_AddMessage(const upb_msgdef *m);
void NameMap_AddEnum(const upb_enumdef *m);
const upb_msgdef *NameMap_GetMessage(zend_class_entry *ce);
const upb_enumdef *NameMap_GetEnum(zend_class_entry *ce);
// * php_class_name -> upb_MessageDef*
// * php_class_name -> upb_EnumDef*
void NameMap_AddMessage(const upb_MessageDef *m);
void NameMap_AddEnum(const upb_EnumDef *m);
const upb_MessageDef *NameMap_GetMessage(zend_class_entry *ce);
const upb_EnumDef *NameMap_GetEnum(zend_class_entry *ce);
// Add this descriptor object to the global list of descriptors that will be
// kept alive for the duration of the request but destroyed when the request

@ -0,0 +1,9 @@
--TEST--
unnecessary zval
--FILE--
<?php
var_dump(new \stdClass());
?>
--EXPECT--
object(stdClass)#1 (0) {
}

File diff suppressed because it is too large Load Diff

@ -698,6 +698,16 @@ class EncodeDecodeTest extends TestBase
$m->mergeFromString(hex2bin('7A01'));
}
public function testEncodeDecodeValidUtf8()
{
$m = new TestMessage();
$m->mergeFromJsonString("{\"optionalString\":\"\\u1000\"}");
$serialized = $m->serializeToString();
$m2 = new TestMessage();
$m2->mergeFromString($serialized);
$this->assertSame($m->getOptionalString(), $m2->getOptionalString());
}
public function testDecodeInvalidEnum()
{
$this->expectException(Exception::class);

@ -2,9 +2,18 @@
set -e
cd $(dirname $0)
cd $(dirname $0)/..
pushd ../ext/google/protobuf > /dev/null
# utf8_range has to live in the base third_party directory.
# We copy it into the ext/google/protobuf directory for the build
# (and for the release to PECL).
rm -rf ext/google/protobuf/third_party
mkdir -p ext/google/protobuf/third_party/utf8_range
cp ../third_party/utf8_range/* ext/google/protobuf/third_party/utf8_range
echo "Copied utf8_range from ../third_party -> ext/google/protobuf/third_party"
pushd ext/google/protobuf > /dev/null
CONFIGURE_OPTIONS=("./configure" "--with-php-config=$(which php-config)")
@ -25,4 +34,5 @@ if [[ ! -f BUILD_STAMP ]] || [[ "$(cat BUILD_STAMP)" != "$FINGERPRINT" ]]; then
fi
make
TEST_PHP_ARGS="-q" make test
popd > /dev/null

@ -1 +1 @@
PROTOBUF_VERSION = '3.19.4'
PROTOBUF_VERSION = '3.20.0-rc-1'

@ -8,7 +8,7 @@
</parent>
<groupId>com.google.protobuf</groupId>
<artifactId>protoc</artifactId>
<version>3.19.4</version>
<version>3.20.0-rc-1</version>
<packaging>pom</packaging>
<name>Protobuf Compiler</name>
<description>

@ -30,4 +30,4 @@
# Copyright 2007 Google Inc. All Rights Reserved.
__version__ = '3.19.4'
__version__ = '3.20.0rc1'

@ -44,7 +44,10 @@ if api_implementation.Type() == 'cpp':
# Used by MakeDescriptor in cpp mode
import binascii
import os
from google.protobuf.pyext import _message
if api_implementation._Version() == 3:
from google3.third_party.upb.python import _message
else:
from google.protobuf.pyext import _message
_USE_C_DESCRIPTORS = True

@ -31,6 +31,7 @@
"""Determine which implementation of the protobuf API is used in this process.
"""
import importlib
import os
import sys
import warnings
@ -48,6 +49,7 @@ if _api_version == 1:
raise ValueError('api_version=1 is no longer supported.')
_default_implementation_type = ('cpp' if _api_version > 0 else 'python')
@ -102,6 +104,11 @@ def _SetType(implementation_type):
_implementation_type = implementation_type
def _Version():
"""Never use! For protobuf internal use only."""
return _api_version
# See comment on 'Type' above.
def Version():
return 2

@ -129,10 +129,13 @@ class MessageTest(unittest.TestCase):
# TODO(jieluo): Fix cpp extension to raise error instead of warning.
# b/27494216
end_tag = encoder.TagBytes(1, 4)
if api_implementation.Type() == 'python':
if (api_implementation.Type() == 'python' or
api_implementation._Version() == 3):
with self.assertRaises(message.DecodeError) as context:
msg.FromString(end_tag)
self.assertEqual('Unexpected end-group tag.', str(context.exception))
if api_implementation.Type() == 'python':
# Only pure-Python has an error message this specific.
self.assertEqual('Unexpected end-group tag.', str(context.exception))
# Field number 0 is illegal.
self.assertRaises(message.DecodeError, msg.FromString, b'\3\4')

@ -48,6 +48,7 @@ from google.protobuf import unittest_pb2
from google.protobuf import unittest_proto3_arena_pb2
from google.protobuf import descriptor_pb2
from google.protobuf.internal import any_test_pb2 as test_extend_any
from google.protobuf.internal import api_implementation
from google.protobuf.internal import message_set_extensions_pb2
from google.protobuf.internal import test_proto3_optional_pb2
from google.protobuf.internal import test_util
@ -582,6 +583,10 @@ class TextFormatMessageToStringTests(TextFormatBase):
text_format.Parse(expected_text, parsed_proto)
self.assertEqual(message_proto, parsed_proto)
@unittest.skipIf(
api_implementation._Version() == 3,
"upb API doesn't support old UnknownField API. The TextFormat library "
"needs to convert to the new API.")
def testPrintUnknownFieldsEmbeddedMessageInBytes(self, message_module):
inner_msg = message_module.TestAllTypes()
inner_msg.optional_int32 = 101
@ -1470,9 +1475,11 @@ class Proto2Tests(TextFormatBase):
text = ('message_set {\n'
' [unknown_extension] {\n'
' i: 23\n'
' bin: "\xe0"'
' repeated_i: []\n'
' bin: "\xe0"\n'
' [nested_unknown_ext]: {\n'
' i: 23\n'
' repeated_i: [1, 2]\n'
' x: x\n'
' test: "test_string"\n'
' floaty_float: -0.315\n'
@ -1485,6 +1492,7 @@ class Proto2Tests(TextFormatBase):
' i: 24\n'
' pointfloat: .3\n'
' test: "test_string"\n'
' repeated_test: ["test_string1", "test_string2"]\n'
' floaty_float: -0.315\n'
' num: -inf\n'
' long_string: "test" "test2" \n'

@ -36,7 +36,12 @@ Descriptor objects at runtime backed by the protocol buffer C++ API.
__author__ = 'tibell@google.com (Johan Tibell)'
from google.protobuf.pyext import _message
from google.protobuf.internal import api_implementation
if api_implementation._Version() == 3:
from google3.third_party.upb.python import _message
else:
from google.protobuf.pyext import _message
class GeneratedProtocolMessageType(_message.MessageMeta):

@ -1143,9 +1143,12 @@ def _SkipFieldContents(tokenizer):
# start with "{" or "<" which indicates the beginning of a message body.
# If there is no ":" or there is a "{" or "<" after ":", this field has
# to be a message or the input is ill-formed.
if tokenizer.TryConsume(':') and not tokenizer.LookingAt(
'{') and not tokenizer.LookingAt('<'):
_SkipFieldValue(tokenizer)
if tokenizer.TryConsume(
':') and not tokenizer.LookingAt('{') and not tokenizer.LookingAt('<'):
if tokenizer.LookingAt('['):
_SkipRepeatedFieldValue(tokenizer)
else:
_SkipFieldValue(tokenizer)
else:
_SkipFieldMessage(tokenizer)
@ -1196,7 +1199,7 @@ def _SkipFieldValue(tokenizer):
"""Skips over a field value.
Args:
tokenizer: A tokenizer to parse the field name and values.
tokenizer: A tokenizer to parse the field value.
Raises:
ParseError: In case an invalid field value is found.
@ -1214,6 +1217,20 @@ def _SkipFieldValue(tokenizer):
raise ParseError('Invalid field value: ' + tokenizer.token)
def _SkipRepeatedFieldValue(tokenizer):
"""Skips over a repeated field value.
Args:
tokenizer: A tokenizer to parse the field value.
"""
tokenizer.Consume('[')
if not tokenizer.LookingAt(']'):
_SkipFieldValue(tokenizer)
while tokenizer.TryConsume(','):
_SkipFieldValue(tokenizer)
tokenizer.Consume(']')
class Tokenizer(object):
"""Protocol buffer text representation tokenizer.

@ -115,6 +115,8 @@ def GenerateUnittestProtos():
GenProto('google/protobuf/internal/factory_test1.proto', False)
GenProto('google/protobuf/internal/factory_test2.proto', False)
GenProto('google/protobuf/internal/file_options_test.proto', False)
GenProto('google/protobuf/internal/import_test_package/import_public.proto', False)
GenProto('google/protobuf/internal/import_test_package/import_public_nested.proto', False)
GenProto('google/protobuf/internal/import_test_package/inner.proto', False)
GenProto('google/protobuf/internal/import_test_package/outer.proto', False)
GenProto('google/protobuf/internal/missing_enum_values.proto', False)

@ -84,7 +84,9 @@ else
# We need utf8_range in-tree.
FileUtils.mkdir_p("ext/google/protobuf_c/third_party/utf8_range")
FileUtils.cp("../third_party/utf8_range/utf8_range.h", "ext/google/protobuf_c/third_party/utf8_range")
FileUtils.cp("../third_party/utf8_range/utf8_range.c", "ext/google/protobuf_c/third_party/utf8_range")
FileUtils.cp("../third_party/utf8_range/naive.c", "ext/google/protobuf_c/third_party/utf8_range")
FileUtils.cp("../third_party/utf8_range/range2-neon.c", "ext/google/protobuf_c/third_party/utf8_range")
FileUtils.cp("../third_party/utf8_range/range2-sse.c", "ext/google/protobuf_c/third_party/utf8_range")
FileUtils.cp("../third_party/utf8_range/LICENSE", "ext/google/protobuf_c/third_party/utf8_range")
end

@ -159,6 +159,7 @@ VALUE DescriptorPool_add_serialized_file(VALUE _self,
rb_raise(cTypeError, "Unable to build file to DescriptorPool: %s",
upb_Status_ErrorMessage(&status));
}
RB_GC_GUARD(arena_rb);
return get_filedef_obj(_self, filedef);
}

@ -23,6 +23,6 @@ $INCFLAGS << "$(srcdir)/third_party/utf8_range"
$srcs = ["protobuf.c", "convert.c", "defs.c", "message.c",
"repeated_field.c", "map.c", "ruby-upb.c", "wrap_memcpy.c",
"utf8_range.c"]
"naive.c", "range2-neon.c", "range2-sse.c"]
create_makefile(ext_name)

@ -1141,7 +1141,11 @@ static VALUE Message_encode_json(int argc, VALUE* argv, VALUE klass) {
if (argc == 2) {
VALUE hash_args = argv[1];
if (TYPE(hash_args) != T_HASH) {
rb_raise(rb_eArgError, "Expected hash arguments.");
if (RTEST(rb_funcall(hash_args, rb_intern("respond_to?"), 1, rb_str_new2("to_h")))) {
hash_args = rb_funcall(hash_args, rb_intern("to_h"), 0);
} else {
rb_raise(rb_eArgError, "Expected hash arguments.");
}
}
if (RTEST(rb_hash_lookup2(hash_args,

@ -193,9 +193,20 @@ const rb_data_type_t Arena_type = {
.flags = RUBY_TYPED_FREE_IMMEDIATELY,
};
static void* ruby_upb_allocfunc(upb_alloc* alloc, void* ptr, size_t oldsize, size_t size) {
if (size == 0) {
xfree(ptr);
return NULL;
} else {
return xrealloc(ptr, size);
}
}
upb_alloc ruby_upb_alloc = {&ruby_upb_allocfunc};
static VALUE Arena_alloc(VALUE klass) {
Arena *arena = ALLOC(Arena);
arena->arena = upb_Arena_New();
arena->arena = upb_Arena_Init(NULL, 0, &ruby_upb_alloc);
arena->pinned_objs = Qnil;
return TypedData_Wrap_Struct(klass, &Arena_type, arena);
}

@ -1,6 +1,6 @@
Gem::Specification.new do |s|
s.name = "google-protobuf"
s.version = "3.19.4"
s.version = "3.20.0.rc.1"
git_tag = "v#{s.version.to_s.sub('.rc.', '-rc')}" # Converts X.Y.Z.rc.N to vX.Y.Z-rcN, used for the git tag
s.licenses = ["BSD-3-Clause"]
s.summary = "Protocol Buffers"

@ -9,7 +9,7 @@
<groupId>com.google.protobuf.jruby</groupId>
<artifactId>protobuf-jruby</artifactId>
<version>3.19.4</version>
<version>3.20.0-rc-1</version>
<name>Protocol Buffer JRuby native extension</name>
<description>
Protocol Buffers are a way of encoding structured data in an efficient yet
@ -76,7 +76,7 @@
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java-util</artifactId>
<version>3.19.4</version>
<version>3.20.0-rc-1</version>
</dependency>
<dependency>
<groupId>org.jruby</groupId>

@ -555,7 +555,15 @@ public class RubyMessage extends RubyObject {
String result;
if (args.length > 1) {
RubyHash options = (RubyHash) args[1];
RubyHash options;
if (args[1] instanceof RubyHash) {
options = (RubyHash) args[1];
} else if (args[1].respondsTo("to_h")) {
options = (RubyHash) args[1].callMethod(context, "to_h");
} else {
throw runtime.newArgumentError("Expected hash arguments.");
}
IRubyObject emitDefaults = options.fastARef(runtime.newSymbol("emit_defaults"));
IRubyObject preserveNames = options.fastARef(runtime.newSymbol("preserve_proto_fieldnames"));

@ -658,5 +658,13 @@ module BasicTest
assert_equal str, m.optional_string
assert_equal str, m.optional_bytes
end
def test_utf8
m = proto_module::TestMessage.new(
optional_string: "µpb",
)
m2 = proto_module::TestMessage.decode(proto_module::TestMessage.encode(m))
assert_equal m2, m
end
end
end

@ -870,6 +870,9 @@ module CommonTests
decoded_msg = Google::Protobuf.decode_json(proto_module::TestMessage, encoded_msg)
assert_equal proto_module::TestMessage.decode_json(m.to_json), decoded_msg
assert_equal [m].to_json, Google::Protobuf.encode_json([m])
assert_equal proto_module::TestMessage.decode_json([m.to_json].first), decoded_msg
end
def test_def_errors

@ -94,7 +94,6 @@ class GCTest < Test::Unit::TestCase
from = get_msg_proto3
data = A::B::C::TestMessage.encode(from)
to = A::B::C::TestMessage.decode(data)
# This doesn't work for proto2 on JRuby because there is a nested required message.
# A::B::Proto2::TestMessage has :required_msg which is of type:
# A::B::Proto2::TestMessage so there is no way to generate a valid

@ -18,7 +18,7 @@ else
PTHREAD_DEF =
endif
PROTOBUF_VERSION = 30:4:0
PROTOBUF_VERSION = 31:0:0
if GCC
# Turn on all warnings except for sign comparison (we ignore sign comparison

@ -130,8 +130,8 @@ class PROTOBUF_EXPORT AnyMetadata {
// *full_type_name. Returns false if the type_url does not have a "/"
// in the type url separating the full type name.
//
// NOTE: this function is available publicly as:
// google::protobuf::Any() // static method on the generated message type.
// NOTE: this function is available publicly as a static method on the
// generated message type: google::protobuf::Any::ParseAnyTypeUrl()
bool ParseAnyTypeUrl(StringPiece type_url, std::string* full_type_name);
// Get the proto type name and prefix from Any::type_url value. For example,

@ -26,10 +26,11 @@ namespace _pbi = _pb::internal;
#endif // __llvm__
PROTOBUF_NAMESPACE_OPEN
PROTOBUF_CONSTEXPR Any::Any(
::_pbi::ConstantInitialized)
: type_url_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
, value_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
, _any_metadata_(&type_url_, &value_){}
::_pbi::ConstantInitialized): _impl_{
/*decltype(_impl_.type_url_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}}
, /*decltype(_impl_.value_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}}
, /*decltype(_impl_._cached_size_)*/{}
, /*decltype(_impl_._any_metadata_)*/{&_impl_.type_url_, &_impl_.value_}} {}
struct AnyDefaultTypeInternal {
PROTOBUF_CONSTEXPR AnyDefaultTypeInternal()
: _instance(::_pbi::ConstantInitialized{}) {}
@ -51,8 +52,8 @@ const uint32_t TableStruct_google_2fprotobuf_2fany_2eproto::offsets[] PROTOBUF_S
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
~0u, // no _inlined_string_donated_
PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Any, type_url_),
PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Any, value_),
PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Any, _impl_.type_url_),
PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Any, _impl_.value_),
};
static const ::_pbi::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
{ 0, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::Any)},
@ -108,43 +109,56 @@ class Any::_Internal {
Any::Any(::PROTOBUF_NAMESPACE_ID::Arena* arena,
bool is_message_owned)
: ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned),
_any_metadata_(&type_url_, &value_) {
SharedCtor();
: ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) {
SharedCtor(arena, is_message_owned);
// @@protoc_insertion_point(arena_constructor:google.protobuf.Any)
}
Any::Any(const Any& from)
: ::PROTOBUF_NAMESPACE_ID::Message(),
_any_metadata_(&type_url_, &value_) {
: ::PROTOBUF_NAMESPACE_ID::Message() {
new (&_impl_) Impl_{
decltype(_impl_.type_url_){}
, decltype(_impl_.value_){}
, /*decltype(_impl_._cached_size_)*/{}
, /*decltype(_impl_._any_metadata_)*/{&_impl_.type_url_, &_impl_.value_}};
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
type_url_.InitDefault();
_impl_.type_url_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
type_url_.Set("", GetArenaForAllocation());
_impl_.type_url_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (!from._internal_type_url().empty()) {
type_url_.Set(from._internal_type_url(),
_impl_.type_url_.Set(from._internal_type_url(),
GetArenaForAllocation());
}
value_.InitDefault();
_impl_.value_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
value_.Set("", GetArenaForAllocation());
_impl_.value_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (!from._internal_value().empty()) {
value_.Set(from._internal_value(),
_impl_.value_.Set(from._internal_value(),
GetArenaForAllocation());
}
// @@protoc_insertion_point(copy_constructor:google.protobuf.Any)
}
inline void Any::SharedCtor() {
type_url_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
type_url_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
value_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
value_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
inline void Any::SharedCtor(
::_pb::Arena* arena, bool is_message_owned) {
(void)arena;
(void)is_message_owned;
new (&_impl_) Impl_{
decltype(_impl_.type_url_){}
, decltype(_impl_.value_){}
, /*decltype(_impl_._cached_size_)*/{}
, /*decltype(_impl_._any_metadata_)*/{&_impl_.type_url_, &_impl_.value_}
};
_impl_.type_url_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.type_url_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.value_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.value_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
}
Any::~Any() {
@ -158,12 +172,13 @@ Any::~Any() {
inline void Any::SharedDtor() {
GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
type_url_.Destroy();
value_.Destroy();
_impl_.type_url_.Destroy();
_impl_.value_.Destroy();
_impl_._any_metadata_.~AnyMetadata();
}
void Any::SetCachedSize(int size) const {
_cached_size_.Set(size);
_impl_._cached_size_.Set(size);
}
void Any::Clear() {
@ -172,8 +187,8 @@ void Any::Clear() {
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
type_url_.ClearToEmpty();
value_.ClearToEmpty();
_impl_.type_url_.ClearToEmpty();
_impl_.value_.ClearToEmpty();
_internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}
@ -277,7 +292,7 @@ size_t Any::ByteSizeLong() const {
this->_internal_value());
}
return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_);
return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_);
}
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData Any::_class_data_ = {
@ -325,12 +340,12 @@ void Any::InternalSwap(Any* other) {
auto* rhs_arena = other->GetArenaForAllocation();
_internal_metadata_.InternalSwap(&other->_internal_metadata_);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
&type_url_, lhs_arena,
&other->type_url_, rhs_arena
&_impl_.type_url_, lhs_arena,
&other->_impl_.type_url_, rhs_arena
);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
&value_, lhs_arena,
&other->value_, rhs_arena
&_impl_.value_, lhs_arena,
&other->_impl_.value_, rhs_arena
);
}

@ -8,12 +8,12 @@
#include <string>
#include <google/protobuf/port_def.inc>
#if PROTOBUF_VERSION < 3019000
#if PROTOBUF_VERSION < 3020000
#error This file was generated by a newer version of protoc which is
#error incompatible with your Protocol Buffer headers. Please update
#error your headers.
#endif
#if 3019004 < PROTOBUF_MIN_PROTOC_VERSION
#if 3020000 < PROTOBUF_MIN_PROTOC_VERSION
#error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc.
@ -109,14 +109,14 @@ class PROTOBUF_EXPORT Any final :
// implements Any -----------------------------------------------
bool PackFrom(const ::PROTOBUF_NAMESPACE_ID::Message& message) {
return _any_metadata_.PackFrom(GetArena(), message);
return _impl_._any_metadata_.PackFrom(GetArena(), message);
}
bool PackFrom(const ::PROTOBUF_NAMESPACE_ID::Message& message,
::PROTOBUF_NAMESPACE_ID::ConstStringParam type_url_prefix) {
return _any_metadata_.PackFrom(GetArena(), message, type_url_prefix);
return _impl_._any_metadata_.PackFrom(GetArena(), message, type_url_prefix);
}
bool UnpackTo(::PROTOBUF_NAMESPACE_ID::Message* message) const {
return _any_metadata_.UnpackTo(message);
return _impl_._any_metadata_.UnpackTo(message);
}
static bool GetAnyFieldDescriptors(
const ::PROTOBUF_NAMESPACE_ID::Message& message,
@ -124,18 +124,18 @@ class PROTOBUF_EXPORT Any final :
const ::PROTOBUF_NAMESPACE_ID::FieldDescriptor** value_field);
template <typename T, class = typename std::enable_if<!std::is_convertible<T, const ::PROTOBUF_NAMESPACE_ID::Message&>::value>::type>
bool PackFrom(const T& message) {
return _any_metadata_.PackFrom<T>(GetArena(), message);
return _impl_._any_metadata_.PackFrom<T>(GetArena(), message);
}
template <typename T, class = typename std::enable_if<!std::is_convertible<T, const ::PROTOBUF_NAMESPACE_ID::Message&>::value>::type>
bool PackFrom(const T& message,
::PROTOBUF_NAMESPACE_ID::ConstStringParam type_url_prefix) {
return _any_metadata_.PackFrom<T>(GetArena(), message, type_url_prefix);}
return _impl_._any_metadata_.PackFrom<T>(GetArena(), message, type_url_prefix);}
template <typename T, class = typename std::enable_if<!std::is_convertible<T, const ::PROTOBUF_NAMESPACE_ID::Message&>::value>::type>
bool UnpackTo(T* message) const {
return _any_metadata_.UnpackTo<T>(message);
return _impl_._any_metadata_.UnpackTo<T>(message);
}
template<typename T> bool Is() const {
return _any_metadata_.Is<T>();
return _impl_._any_metadata_.Is<T>();
}
static bool ParseAnyTypeUrl(::PROTOBUF_NAMESPACE_ID::ConstStringParam type_url,
std::string* full_type_name);
@ -180,10 +180,10 @@ class PROTOBUF_EXPORT Any final :
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
uint8_t* _InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
int GetCachedSize() const final { return _cached_size_.Get(); }
int GetCachedSize() const final { return _impl_._cached_size_.Get(); }
private:
void SharedCtor();
void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned);
void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(Any* other);
@ -246,10 +246,13 @@ class PROTOBUF_EXPORT Any final :
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
typedef void InternalArenaConstructable_;
typedef void DestructorSkippable_;
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr type_url_;
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr value_;
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata _any_metadata_;
struct Impl_ {
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr type_url_;
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr value_;
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata _any_metadata_;
};
union { Impl_ _impl_; };
friend struct ::TableStruct_google_2fprotobuf_2fany_2eproto;
};
// ===================================================================
@ -265,7 +268,7 @@ class PROTOBUF_EXPORT Any final :
// string type_url = 1;
inline void Any::clear_type_url() {
type_url_.ClearToEmpty();
_impl_.type_url_.ClearToEmpty();
}
inline const std::string& Any::type_url() const {
// @@protoc_insertion_point(field_get:google.protobuf.Any.type_url)
@ -275,7 +278,7 @@ template <typename ArgT0, typename... ArgT>
inline PROTOBUF_ALWAYS_INLINE
void Any::set_type_url(ArgT0&& arg0, ArgT... args) {
type_url_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
_impl_.type_url_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.Any.type_url)
}
inline std::string* Any::mutable_type_url() {
@ -284,19 +287,19 @@ inline std::string* Any::mutable_type_url() {
return _s;
}
inline const std::string& Any::_internal_type_url() const {
return type_url_.Get();
return _impl_.type_url_.Get();
}
inline void Any::_internal_set_type_url(const std::string& value) {
type_url_.Set(value, GetArenaForAllocation());
_impl_.type_url_.Set(value, GetArenaForAllocation());
}
inline std::string* Any::_internal_mutable_type_url() {
return type_url_.Mutable(GetArenaForAllocation());
return _impl_.type_url_.Mutable(GetArenaForAllocation());
}
inline std::string* Any::release_type_url() {
// @@protoc_insertion_point(field_release:google.protobuf.Any.type_url)
return type_url_.Release();
return _impl_.type_url_.Release();
}
inline void Any::set_allocated_type_url(std::string* type_url) {
if (type_url != nullptr) {
@ -304,10 +307,10 @@ inline void Any::set_allocated_type_url(std::string* type_url) {
} else {
}
type_url_.SetAllocated(type_url, GetArenaForAllocation());
_impl_.type_url_.SetAllocated(type_url, GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (type_url_.IsDefault()) {
type_url_.Set("", GetArenaForAllocation());
if (_impl_.type_url_.IsDefault()) {
_impl_.type_url_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Any.type_url)
@ -315,7 +318,7 @@ inline void Any::set_allocated_type_url(std::string* type_url) {
// bytes value = 2;
inline void Any::clear_value() {
value_.ClearToEmpty();
_impl_.value_.ClearToEmpty();
}
inline const std::string& Any::value() const {
// @@protoc_insertion_point(field_get:google.protobuf.Any.value)
@ -325,7 +328,7 @@ template <typename ArgT0, typename... ArgT>
inline PROTOBUF_ALWAYS_INLINE
void Any::set_value(ArgT0&& arg0, ArgT... args) {
value_.SetBytes(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
_impl_.value_.SetBytes(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.Any.value)
}
inline std::string* Any::mutable_value() {
@ -334,19 +337,19 @@ inline std::string* Any::mutable_value() {
return _s;
}
inline const std::string& Any::_internal_value() const {
return value_.Get();
return _impl_.value_.Get();
}
inline void Any::_internal_set_value(const std::string& value) {
value_.Set(value, GetArenaForAllocation());
_impl_.value_.Set(value, GetArenaForAllocation());
}
inline std::string* Any::_internal_mutable_value() {
return value_.Mutable(GetArenaForAllocation());
return _impl_.value_.Mutable(GetArenaForAllocation());
}
inline std::string* Any::release_value() {
// @@protoc_insertion_point(field_release:google.protobuf.Any.value)
return value_.Release();
return _impl_.value_.Release();
}
inline void Any::set_allocated_value(std::string* value) {
if (value != nullptr) {
@ -354,10 +357,10 @@ inline void Any::set_allocated_value(std::string* value) {
} else {
}
value_.SetAllocated(value, GetArenaForAllocation());
_impl_.value_.SetAllocated(value, GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (value_.IsDefault()) {
value_.Set("", GetArenaForAllocation());
if (_impl_.value_.IsDefault()) {
_impl_.value_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Any.value)

@ -22,15 +22,15 @@ namespace _pbi = _pb::internal;
PROTOBUF_NAMESPACE_OPEN
PROTOBUF_CONSTEXPR Api::Api(
::_pbi::ConstantInitialized)
: methods_()
, options_()
, mixins_()
, name_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
, version_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
, source_context_(nullptr)
, syntax_(0)
{}
::_pbi::ConstantInitialized): _impl_{
/*decltype(_impl_.methods_)*/{}
, /*decltype(_impl_.options_)*/{}
, /*decltype(_impl_.mixins_)*/{}
, /*decltype(_impl_.name_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}}
, /*decltype(_impl_.version_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}}
, /*decltype(_impl_.source_context_)*/nullptr
, /*decltype(_impl_.syntax_)*/0
, /*decltype(_impl_._cached_size_)*/{}} {}
struct ApiDefaultTypeInternal {
PROTOBUF_CONSTEXPR ApiDefaultTypeInternal()
: _instance(::_pbi::ConstantInitialized{}) {}
@ -41,15 +41,15 @@ struct ApiDefaultTypeInternal {
};
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 ApiDefaultTypeInternal _Api_default_instance_;
PROTOBUF_CONSTEXPR Method::Method(
::_pbi::ConstantInitialized)
: options_()
, name_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
, request_type_url_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
, response_type_url_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
, request_streaming_(false)
, response_streaming_(false)
, syntax_(0)
{}
::_pbi::ConstantInitialized): _impl_{
/*decltype(_impl_.options_)*/{}
, /*decltype(_impl_.name_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}}
, /*decltype(_impl_.request_type_url_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}}
, /*decltype(_impl_.response_type_url_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}}
, /*decltype(_impl_.request_streaming_)*/false
, /*decltype(_impl_.response_streaming_)*/false
, /*decltype(_impl_.syntax_)*/0
, /*decltype(_impl_._cached_size_)*/{}} {}
struct MethodDefaultTypeInternal {
PROTOBUF_CONSTEXPR MethodDefaultTypeInternal()
: _instance(::_pbi::ConstantInitialized{}) {}
@ -60,9 +60,10 @@ struct MethodDefaultTypeInternal {
};
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 MethodDefaultTypeInternal _Method_default_instance_;
PROTOBUF_CONSTEXPR Mixin::Mixin(
::_pbi::ConstantInitialized)
: name_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
, root_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}){}
::_pbi::ConstantInitialized): _impl_{
/*decltype(_impl_.name_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}}
, /*decltype(_impl_.root_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}}
, /*decltype(_impl_._cached_size_)*/{}} {}
struct MixinDefaultTypeInternal {
PROTOBUF_CONSTEXPR MixinDefaultTypeInternal()
: _instance(::_pbi::ConstantInitialized{}) {}
@ -84,34 +85,34 @@ const uint32_t TableStruct_google_2fprotobuf_2fapi_2eproto::offsets[] PROTOBUF_S
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
~0u, // no _inlined_string_donated_
PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Api, name_),
PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Api, methods_),
PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Api, options_),
PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Api, version_),
PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Api, source_context_),
PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Api, mixins_),
PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Api, syntax_),
PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Api, _impl_.name_),
PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Api, _impl_.methods_),
PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Api, _impl_.options_),
PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Api, _impl_.version_),
PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Api, _impl_.source_context_),
PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Api, _impl_.mixins_),
PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Api, _impl_.syntax_),
~0u, // no _has_bits_
PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Method, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
~0u, // no _inlined_string_donated_
PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Method, name_),
PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Method, request_type_url_),
PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Method, request_streaming_),
PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Method, response_type_url_),
PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Method, response_streaming_),
PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Method, options_),
PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Method, syntax_),
PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Method, _impl_.name_),
PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Method, _impl_.request_type_url_),
PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Method, _impl_.request_streaming_),
PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Method, _impl_.response_type_url_),
PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Method, _impl_.response_streaming_),
PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Method, _impl_.options_),
PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Method, _impl_.syntax_),
~0u, // no _has_bits_
PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Mixin, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
~0u, // no _inlined_string_donated_
PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Mixin, name_),
PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Mixin, root_),
PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Mixin, _impl_.name_),
PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Mixin, _impl_.root_),
};
static const ::_pbi::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
{ 0, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::Api)},
@ -176,70 +177,81 @@ class Api::_Internal {
const ::PROTOBUF_NAMESPACE_ID::SourceContext&
Api::_Internal::source_context(const Api* msg) {
return *msg->source_context_;
return *msg->_impl_.source_context_;
}
void Api::clear_options() {
options_.Clear();
_impl_.options_.Clear();
}
void Api::clear_source_context() {
if (GetArenaForAllocation() == nullptr && source_context_ != nullptr) {
delete source_context_;
if (GetArenaForAllocation() == nullptr && _impl_.source_context_ != nullptr) {
delete _impl_.source_context_;
}
source_context_ = nullptr;
_impl_.source_context_ = nullptr;
}
Api::Api(::PROTOBUF_NAMESPACE_ID::Arena* arena,
bool is_message_owned)
: ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned),
methods_(arena),
options_(arena),
mixins_(arena) {
SharedCtor();
: ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) {
SharedCtor(arena, is_message_owned);
// @@protoc_insertion_point(arena_constructor:google.protobuf.Api)
}
Api::Api(const Api& from)
: ::PROTOBUF_NAMESPACE_ID::Message(),
methods_(from.methods_),
options_(from.options_),
mixins_(from.mixins_) {
: ::PROTOBUF_NAMESPACE_ID::Message() {
new (&_impl_) Impl_{
decltype(_impl_.methods_){from._impl_.methods_}
, decltype(_impl_.options_){from._impl_.options_}
, decltype(_impl_.mixins_){from._impl_.mixins_}
, decltype(_impl_.name_){}
, decltype(_impl_.version_){}
, decltype(_impl_.source_context_){nullptr}
, decltype(_impl_.syntax_){}
, /*decltype(_impl_._cached_size_)*/{}};
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
name_.InitDefault();
_impl_.name_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
name_.Set("", GetArenaForAllocation());
_impl_.name_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (!from._internal_name().empty()) {
name_.Set(from._internal_name(),
_impl_.name_.Set(from._internal_name(),
GetArenaForAllocation());
}
version_.InitDefault();
_impl_.version_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
version_.Set("", GetArenaForAllocation());
_impl_.version_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (!from._internal_version().empty()) {
version_.Set(from._internal_version(),
_impl_.version_.Set(from._internal_version(),
GetArenaForAllocation());
}
if (from._internal_has_source_context()) {
source_context_ = new ::PROTOBUF_NAMESPACE_ID::SourceContext(*from.source_context_);
} else {
source_context_ = nullptr;
_impl_.source_context_ = new ::PROTOBUF_NAMESPACE_ID::SourceContext(*from._impl_.source_context_);
}
syntax_ = from.syntax_;
_impl_.syntax_ = from._impl_.syntax_;
// @@protoc_insertion_point(copy_constructor:google.protobuf.Api)
}
inline void Api::SharedCtor() {
name_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
name_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
version_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
version_.Set("", 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_) -
reinterpret_cast<char*>(&source_context_)) + sizeof(syntax_));
inline void Api::SharedCtor(
::_pb::Arena* arena, bool is_message_owned) {
(void)arena;
(void)is_message_owned;
new (&_impl_) Impl_{
decltype(_impl_.methods_){arena}
, decltype(_impl_.options_){arena}
, decltype(_impl_.mixins_){arena}
, decltype(_impl_.name_){}
, decltype(_impl_.version_){}
, decltype(_impl_.source_context_){nullptr}
, decltype(_impl_.syntax_){0}
, /*decltype(_impl_._cached_size_)*/{}
};
_impl_.name_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.name_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.version_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.version_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
}
Api::~Api() {
@ -253,13 +265,16 @@ Api::~Api() {
inline void Api::SharedDtor() {
GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
name_.Destroy();
version_.Destroy();
if (this != internal_default_instance()) delete source_context_;
_impl_.methods_.~RepeatedPtrField();
_impl_.options_.~RepeatedPtrField();
_impl_.mixins_.~RepeatedPtrField();
_impl_.name_.Destroy();
_impl_.version_.Destroy();
if (this != internal_default_instance()) delete _impl_.source_context_;
}
void Api::SetCachedSize(int size) const {
_cached_size_.Set(size);
_impl_._cached_size_.Set(size);
}
void Api::Clear() {
@ -268,16 +283,16 @@ void Api::Clear() {
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
methods_.Clear();
options_.Clear();
mixins_.Clear();
name_.ClearToEmpty();
version_.ClearToEmpty();
if (GetArenaForAllocation() == nullptr && source_context_ != nullptr) {
delete source_context_;
_impl_.methods_.Clear();
_impl_.options_.Clear();
_impl_.mixins_.Clear();
_impl_.name_.ClearToEmpty();
_impl_.version_.ClearToEmpty();
if (GetArenaForAllocation() == nullptr && _impl_.source_context_ != nullptr) {
delete _impl_.source_context_;
}
source_context_ = nullptr;
syntax_ = 0;
_impl_.source_context_ = nullptr;
_impl_.syntax_ = 0;
_internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}
@ -468,21 +483,21 @@ size_t Api::ByteSizeLong() const {
// repeated .google.protobuf.Method methods = 2;
total_size += 1UL * this->_internal_methods_size();
for (const auto& msg : this->methods_) {
for (const auto& msg : this->_impl_.methods_) {
total_size +=
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg);
}
// repeated .google.protobuf.Option options = 3;
total_size += 1UL * this->_internal_options_size();
for (const auto& msg : this->options_) {
for (const auto& msg : this->_impl_.options_) {
total_size +=
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg);
}
// repeated .google.protobuf.Mixin mixins = 6;
total_size += 1UL * this->_internal_mixins_size();
for (const auto& msg : this->mixins_) {
for (const auto& msg : this->_impl_.mixins_) {
total_size +=
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg);
}
@ -505,7 +520,7 @@ size_t Api::ByteSizeLong() const {
if (this->_internal_has_source_context()) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
*source_context_);
*_impl_.source_context_);
}
// .google.protobuf.Syntax syntax = 7;
@ -514,7 +529,7 @@ size_t Api::ByteSizeLong() const {
::_pbi::WireFormatLite::EnumSize(this->_internal_syntax());
}
return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_);
return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_);
}
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData Api::_class_data_ = {
@ -536,9 +551,9 @@ void Api::MergeFrom(const Api& from) {
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
methods_.MergeFrom(from.methods_);
options_.MergeFrom(from.options_);
mixins_.MergeFrom(from.mixins_);
_impl_.methods_.MergeFrom(from._impl_.methods_);
_impl_.options_.MergeFrom(from._impl_.options_);
_impl_.mixins_.MergeFrom(from._impl_.mixins_);
if (!from._internal_name().empty()) {
_internal_set_name(from._internal_name());
}
@ -570,23 +585,23 @@ void Api::InternalSwap(Api* other) {
auto* lhs_arena = GetArenaForAllocation();
auto* rhs_arena = other->GetArenaForAllocation();
_internal_metadata_.InternalSwap(&other->_internal_metadata_);
methods_.InternalSwap(&other->methods_);
options_.InternalSwap(&other->options_);
mixins_.InternalSwap(&other->mixins_);
_impl_.methods_.InternalSwap(&other->_impl_.methods_);
_impl_.options_.InternalSwap(&other->_impl_.options_);
_impl_.mixins_.InternalSwap(&other->_impl_.mixins_);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
&name_, lhs_arena,
&other->name_, rhs_arena
&_impl_.name_, lhs_arena,
&other->_impl_.name_, rhs_arena
);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
&version_, lhs_arena,
&other->version_, rhs_arena
&_impl_.version_, lhs_arena,
&other->_impl_.version_, rhs_arena
);
::PROTOBUF_NAMESPACE_ID::internal::memswap<
PROTOBUF_FIELD_OFFSET(Api, syntax_)
+ sizeof(Api::syntax_)
- PROTOBUF_FIELD_OFFSET(Api, source_context_)>(
reinterpret_cast<char*>(&source_context_),
reinterpret_cast<char*>(&other->source_context_));
PROTOBUF_FIELD_OFFSET(Api, _impl_.syntax_)
+ sizeof(Api::_impl_.syntax_)
- PROTOBUF_FIELD_OFFSET(Api, _impl_.source_context_)>(
reinterpret_cast<char*>(&_impl_.source_context_),
reinterpret_cast<char*>(&other->_impl_.source_context_));
}
::PROTOBUF_NAMESPACE_ID::Metadata Api::GetMetadata() const {
@ -602,66 +617,83 @@ class Method::_Internal {
};
void Method::clear_options() {
options_.Clear();
_impl_.options_.Clear();
}
Method::Method(::PROTOBUF_NAMESPACE_ID::Arena* arena,
bool is_message_owned)
: ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned),
options_(arena) {
SharedCtor();
: ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) {
SharedCtor(arena, is_message_owned);
// @@protoc_insertion_point(arena_constructor:google.protobuf.Method)
}
Method::Method(const Method& from)
: ::PROTOBUF_NAMESPACE_ID::Message(),
options_(from.options_) {
: ::PROTOBUF_NAMESPACE_ID::Message() {
new (&_impl_) Impl_{
decltype(_impl_.options_){from._impl_.options_}
, decltype(_impl_.name_){}
, decltype(_impl_.request_type_url_){}
, decltype(_impl_.response_type_url_){}
, decltype(_impl_.request_streaming_){}
, decltype(_impl_.response_streaming_){}
, decltype(_impl_.syntax_){}
, /*decltype(_impl_._cached_size_)*/{}};
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
name_.InitDefault();
_impl_.name_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
name_.Set("", GetArenaForAllocation());
_impl_.name_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (!from._internal_name().empty()) {
name_.Set(from._internal_name(),
_impl_.name_.Set(from._internal_name(),
GetArenaForAllocation());
}
request_type_url_.InitDefault();
_impl_.request_type_url_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
request_type_url_.Set("", GetArenaForAllocation());
_impl_.request_type_url_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (!from._internal_request_type_url().empty()) {
request_type_url_.Set(from._internal_request_type_url(),
_impl_.request_type_url_.Set(from._internal_request_type_url(),
GetArenaForAllocation());
}
response_type_url_.InitDefault();
_impl_.response_type_url_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
response_type_url_.Set("", GetArenaForAllocation());
_impl_.response_type_url_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (!from._internal_response_type_url().empty()) {
response_type_url_.Set(from._internal_response_type_url(),
_impl_.response_type_url_.Set(from._internal_response_type_url(),
GetArenaForAllocation());
}
::memcpy(&request_streaming_, &from.request_streaming_,
static_cast<size_t>(reinterpret_cast<char*>(&syntax_) -
reinterpret_cast<char*>(&request_streaming_)) + sizeof(syntax_));
::memcpy(&_impl_.request_streaming_, &from._impl_.request_streaming_,
static_cast<size_t>(reinterpret_cast<char*>(&_impl_.syntax_) -
reinterpret_cast<char*>(&_impl_.request_streaming_)) + sizeof(_impl_.syntax_));
// @@protoc_insertion_point(copy_constructor:google.protobuf.Method)
}
inline void Method::SharedCtor() {
name_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
name_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
request_type_url_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
request_type_url_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
response_type_url_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
response_type_url_.Set("", 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_) -
reinterpret_cast<char*>(&request_streaming_)) + sizeof(syntax_));
inline void Method::SharedCtor(
::_pb::Arena* arena, bool is_message_owned) {
(void)arena;
(void)is_message_owned;
new (&_impl_) Impl_{
decltype(_impl_.options_){arena}
, decltype(_impl_.name_){}
, decltype(_impl_.request_type_url_){}
, decltype(_impl_.response_type_url_){}
, decltype(_impl_.request_streaming_){false}
, decltype(_impl_.response_streaming_){false}
, decltype(_impl_.syntax_){0}
, /*decltype(_impl_._cached_size_)*/{}
};
_impl_.name_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.name_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.request_type_url_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.request_type_url_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.response_type_url_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.response_type_url_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
}
Method::~Method() {
@ -675,13 +707,14 @@ Method::~Method() {
inline void Method::SharedDtor() {
GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
name_.Destroy();
request_type_url_.Destroy();
response_type_url_.Destroy();
_impl_.options_.~RepeatedPtrField();
_impl_.name_.Destroy();
_impl_.request_type_url_.Destroy();
_impl_.response_type_url_.Destroy();
}
void Method::SetCachedSize(int size) const {
_cached_size_.Set(size);
_impl_._cached_size_.Set(size);
}
void Method::Clear() {
@ -690,13 +723,13 @@ void Method::Clear() {
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
options_.Clear();
name_.ClearToEmpty();
request_type_url_.ClearToEmpty();
response_type_url_.ClearToEmpty();
::memset(&request_streaming_, 0, static_cast<size_t>(
reinterpret_cast<char*>(&syntax_) -
reinterpret_cast<char*>(&request_streaming_)) + sizeof(syntax_));
_impl_.options_.Clear();
_impl_.name_.ClearToEmpty();
_impl_.request_type_url_.ClearToEmpty();
_impl_.response_type_url_.ClearToEmpty();
::memset(&_impl_.request_streaming_, 0, static_cast<size_t>(
reinterpret_cast<char*>(&_impl_.syntax_) -
reinterpret_cast<char*>(&_impl_.request_streaming_)) + sizeof(_impl_.syntax_));
_internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}
@ -729,7 +762,7 @@ const char* Method::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
// bool request_streaming = 3;
case 3:
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 24)) {
request_streaming_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
_impl_.request_streaming_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
CHK_(ptr);
} else
goto handle_unusual;
@ -747,7 +780,7 @@ const char* Method::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
// bool response_streaming = 5;
case 5:
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 40)) {
response_streaming_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
_impl_.response_streaming_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
CHK_(ptr);
} else
goto handle_unusual;
@ -878,7 +911,7 @@ size_t Method::ByteSizeLong() const {
// repeated .google.protobuf.Option options = 6;
total_size += 1UL * this->_internal_options_size();
for (const auto& msg : this->options_) {
for (const auto& msg : this->_impl_.options_) {
total_size +=
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg);
}
@ -920,7 +953,7 @@ size_t Method::ByteSizeLong() const {
::_pbi::WireFormatLite::EnumSize(this->_internal_syntax());
}
return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_);
return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_);
}
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData Method::_class_data_ = {
@ -942,7 +975,7 @@ void Method::MergeFrom(const Method& from) {
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
options_.MergeFrom(from.options_);
_impl_.options_.MergeFrom(from._impl_.options_);
if (!from._internal_name().empty()) {
_internal_set_name(from._internal_name());
}
@ -980,25 +1013,25 @@ void Method::InternalSwap(Method* other) {
auto* lhs_arena = GetArenaForAllocation();
auto* rhs_arena = other->GetArenaForAllocation();
_internal_metadata_.InternalSwap(&other->_internal_metadata_);
options_.InternalSwap(&other->options_);
_impl_.options_.InternalSwap(&other->_impl_.options_);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
&name_, lhs_arena,
&other->name_, rhs_arena
&_impl_.name_, lhs_arena,
&other->_impl_.name_, rhs_arena
);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
&request_type_url_, lhs_arena,
&other->request_type_url_, rhs_arena
&_impl_.request_type_url_, lhs_arena,
&other->_impl_.request_type_url_, rhs_arena
);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
&response_type_url_, lhs_arena,
&other->response_type_url_, rhs_arena
&_impl_.response_type_url_, lhs_arena,
&other->_impl_.response_type_url_, rhs_arena
);
::PROTOBUF_NAMESPACE_ID::internal::memswap<
PROTOBUF_FIELD_OFFSET(Method, syntax_)
+ sizeof(Method::syntax_)
- PROTOBUF_FIELD_OFFSET(Method, request_streaming_)>(
reinterpret_cast<char*>(&request_streaming_),
reinterpret_cast<char*>(&other->request_streaming_));
PROTOBUF_FIELD_OFFSET(Method, _impl_.syntax_)
+ sizeof(Method::_impl_.syntax_)
- PROTOBUF_FIELD_OFFSET(Method, _impl_.request_streaming_)>(
reinterpret_cast<char*>(&_impl_.request_streaming_),
reinterpret_cast<char*>(&other->_impl_.request_streaming_));
}
::PROTOBUF_NAMESPACE_ID::Metadata Method::GetMetadata() const {
@ -1016,40 +1049,53 @@ class Mixin::_Internal {
Mixin::Mixin(::PROTOBUF_NAMESPACE_ID::Arena* arena,
bool is_message_owned)
: ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) {
SharedCtor();
SharedCtor(arena, is_message_owned);
// @@protoc_insertion_point(arena_constructor:google.protobuf.Mixin)
}
Mixin::Mixin(const Mixin& from)
: ::PROTOBUF_NAMESPACE_ID::Message() {
new (&_impl_) Impl_{
decltype(_impl_.name_){}
, decltype(_impl_.root_){}
, /*decltype(_impl_._cached_size_)*/{}};
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
name_.InitDefault();
_impl_.name_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
name_.Set("", GetArenaForAllocation());
_impl_.name_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (!from._internal_name().empty()) {
name_.Set(from._internal_name(),
_impl_.name_.Set(from._internal_name(),
GetArenaForAllocation());
}
root_.InitDefault();
_impl_.root_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
root_.Set("", GetArenaForAllocation());
_impl_.root_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (!from._internal_root().empty()) {
root_.Set(from._internal_root(),
_impl_.root_.Set(from._internal_root(),
GetArenaForAllocation());
}
// @@protoc_insertion_point(copy_constructor:google.protobuf.Mixin)
}
inline void Mixin::SharedCtor() {
name_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
name_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
root_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
root_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
inline void Mixin::SharedCtor(
::_pb::Arena* arena, bool is_message_owned) {
(void)arena;
(void)is_message_owned;
new (&_impl_) Impl_{
decltype(_impl_.name_){}
, decltype(_impl_.root_){}
, /*decltype(_impl_._cached_size_)*/{}
};
_impl_.name_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.name_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.root_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.root_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
}
Mixin::~Mixin() {
@ -1063,12 +1109,12 @@ Mixin::~Mixin() {
inline void Mixin::SharedDtor() {
GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
name_.Destroy();
root_.Destroy();
_impl_.name_.Destroy();
_impl_.root_.Destroy();
}
void Mixin::SetCachedSize(int size) const {
_cached_size_.Set(size);
_impl_._cached_size_.Set(size);
}
void Mixin::Clear() {
@ -1077,8 +1123,8 @@ void Mixin::Clear() {
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
name_.ClearToEmpty();
root_.ClearToEmpty();
_impl_.name_.ClearToEmpty();
_impl_.root_.ClearToEmpty();
_internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}
@ -1187,7 +1233,7 @@ size_t Mixin::ByteSizeLong() const {
this->_internal_root());
}
return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_);
return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_);
}
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData Mixin::_class_data_ = {
@ -1235,12 +1281,12 @@ void Mixin::InternalSwap(Mixin* other) {
auto* rhs_arena = other->GetArenaForAllocation();
_internal_metadata_.InternalSwap(&other->_internal_metadata_);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
&name_, lhs_arena,
&other->name_, rhs_arena
&_impl_.name_, lhs_arena,
&other->_impl_.name_, rhs_arena
);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
&root_, lhs_arena,
&other->root_, rhs_arena
&_impl_.root_, lhs_arena,
&other->_impl_.root_, rhs_arena
);
}

@ -8,12 +8,12 @@
#include <string>
#include <google/protobuf/port_def.inc>
#if PROTOBUF_VERSION < 3019000
#if PROTOBUF_VERSION < 3020000
#error This file was generated by a newer version of protoc which is
#error incompatible with your Protocol Buffer headers. Please update
#error your headers.
#endif
#if 3019004 < PROTOBUF_MIN_PROTOC_VERSION
#if 3020000 < PROTOBUF_MIN_PROTOC_VERSION
#error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc.
@ -157,10 +157,10 @@ class PROTOBUF_EXPORT Api final :
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
uint8_t* _InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
int GetCachedSize() const final { return _cached_size_.Get(); }
int GetCachedSize() const final { return _impl_._cached_size_.Get(); }
private:
void SharedCtor();
void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned);
void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(Api* other);
@ -309,14 +309,17 @@ class PROTOBUF_EXPORT Api final :
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
typedef void InternalArenaConstructable_;
typedef void DestructorSkippable_;
::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Method > methods_;
::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Option > options_;
::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Mixin > mixins_;
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr name_;
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr version_;
::PROTOBUF_NAMESPACE_ID::SourceContext* source_context_;
int syntax_;
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
struct Impl_ {
::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Method > methods_;
::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Option > options_;
::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Mixin > mixins_;
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr name_;
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr version_;
::PROTOBUF_NAMESPACE_ID::SourceContext* source_context_;
int syntax_;
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
};
union { Impl_ _impl_; };
friend struct ::TableStruct_google_2fprotobuf_2fapi_2eproto;
};
// -------------------------------------------------------------------
@ -412,10 +415,10 @@ class PROTOBUF_EXPORT Method final :
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
uint8_t* _InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
int GetCachedSize() const final { return _cached_size_.Get(); }
int GetCachedSize() const final { return _impl_._cached_size_.Get(); }
private:
void SharedCtor();
void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned);
void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(Method* other);
@ -542,14 +545,17 @@ class PROTOBUF_EXPORT Method final :
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
typedef void InternalArenaConstructable_;
typedef void DestructorSkippable_;
::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Option > options_;
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr name_;
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr request_type_url_;
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr response_type_url_;
bool request_streaming_;
bool response_streaming_;
int syntax_;
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
struct Impl_ {
::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Option > options_;
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr name_;
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr request_type_url_;
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr response_type_url_;
bool request_streaming_;
bool response_streaming_;
int syntax_;
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
};
union { Impl_ _impl_; };
friend struct ::TableStruct_google_2fprotobuf_2fapi_2eproto;
};
// -------------------------------------------------------------------
@ -645,10 +651,10 @@ class PROTOBUF_EXPORT Mixin final :
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
uint8_t* _InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
int GetCachedSize() const final { return _cached_size_.Get(); }
int GetCachedSize() const final { return _impl_._cached_size_.Get(); }
private:
void SharedCtor();
void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned);
void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(Mixin* other);
@ -711,9 +717,12 @@ class PROTOBUF_EXPORT Mixin final :
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
typedef void InternalArenaConstructable_;
typedef void DestructorSkippable_;
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr name_;
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr root_;
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
struct Impl_ {
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr name_;
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr root_;
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
};
union { Impl_ _impl_; };
friend struct ::TableStruct_google_2fprotobuf_2fapi_2eproto;
};
// ===================================================================
@ -729,7 +738,7 @@ class PROTOBUF_EXPORT Mixin final :
// string name = 1;
inline void Api::clear_name() {
name_.ClearToEmpty();
_impl_.name_.ClearToEmpty();
}
inline const std::string& Api::name() const {
// @@protoc_insertion_point(field_get:google.protobuf.Api.name)
@ -739,7 +748,7 @@ template <typename ArgT0, typename... ArgT>
inline PROTOBUF_ALWAYS_INLINE
void Api::set_name(ArgT0&& arg0, ArgT... args) {
name_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
_impl_.name_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.Api.name)
}
inline std::string* Api::mutable_name() {
@ -748,19 +757,19 @@ inline std::string* Api::mutable_name() {
return _s;
}
inline const std::string& Api::_internal_name() const {
return name_.Get();
return _impl_.name_.Get();
}
inline void Api::_internal_set_name(const std::string& value) {
name_.Set(value, GetArenaForAllocation());
_impl_.name_.Set(value, GetArenaForAllocation());
}
inline std::string* Api::_internal_mutable_name() {
return name_.Mutable(GetArenaForAllocation());
return _impl_.name_.Mutable(GetArenaForAllocation());
}
inline std::string* Api::release_name() {
// @@protoc_insertion_point(field_release:google.protobuf.Api.name)
return name_.Release();
return _impl_.name_.Release();
}
inline void Api::set_allocated_name(std::string* name) {
if (name != nullptr) {
@ -768,10 +777,10 @@ inline void Api::set_allocated_name(std::string* name) {
} else {
}
name_.SetAllocated(name, GetArenaForAllocation());
_impl_.name_.SetAllocated(name, GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (name_.IsDefault()) {
name_.Set("", GetArenaForAllocation());
if (_impl_.name_.IsDefault()) {
_impl_.name_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Api.name)
@ -779,32 +788,32 @@ inline void Api::set_allocated_name(std::string* name) {
// repeated .google.protobuf.Method methods = 2;
inline int Api::_internal_methods_size() const {
return methods_.size();
return _impl_.methods_.size();
}
inline int Api::methods_size() const {
return _internal_methods_size();
}
inline void Api::clear_methods() {
methods_.Clear();
_impl_.methods_.Clear();
}
inline ::PROTOBUF_NAMESPACE_ID::Method* Api::mutable_methods(int index) {
// @@protoc_insertion_point(field_mutable:google.protobuf.Api.methods)
return methods_.Mutable(index);
return _impl_.methods_.Mutable(index);
}
inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Method >*
Api::mutable_methods() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.Api.methods)
return &methods_;
return &_impl_.methods_;
}
inline const ::PROTOBUF_NAMESPACE_ID::Method& Api::_internal_methods(int index) const {
return methods_.Get(index);
return _impl_.methods_.Get(index);
}
inline const ::PROTOBUF_NAMESPACE_ID::Method& Api::methods(int index) const {
// @@protoc_insertion_point(field_get:google.protobuf.Api.methods)
return _internal_methods(index);
}
inline ::PROTOBUF_NAMESPACE_ID::Method* Api::_internal_add_methods() {
return methods_.Add();
return _impl_.methods_.Add();
}
inline ::PROTOBUF_NAMESPACE_ID::Method* Api::add_methods() {
::PROTOBUF_NAMESPACE_ID::Method* _add = _internal_add_methods();
@ -814,34 +823,34 @@ inline ::PROTOBUF_NAMESPACE_ID::Method* Api::add_methods() {
inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Method >&
Api::methods() const {
// @@protoc_insertion_point(field_list:google.protobuf.Api.methods)
return methods_;
return _impl_.methods_;
}
// repeated .google.protobuf.Option options = 3;
inline int Api::_internal_options_size() const {
return options_.size();
return _impl_.options_.size();
}
inline int Api::options_size() const {
return _internal_options_size();
}
inline ::PROTOBUF_NAMESPACE_ID::Option* Api::mutable_options(int index) {
// @@protoc_insertion_point(field_mutable:google.protobuf.Api.options)
return options_.Mutable(index);
return _impl_.options_.Mutable(index);
}
inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Option >*
Api::mutable_options() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.Api.options)
return &options_;
return &_impl_.options_;
}
inline const ::PROTOBUF_NAMESPACE_ID::Option& Api::_internal_options(int index) const {
return options_.Get(index);
return _impl_.options_.Get(index);
}
inline const ::PROTOBUF_NAMESPACE_ID::Option& Api::options(int index) const {
// @@protoc_insertion_point(field_get:google.protobuf.Api.options)
return _internal_options(index);
}
inline ::PROTOBUF_NAMESPACE_ID::Option* Api::_internal_add_options() {
return options_.Add();
return _impl_.options_.Add();
}
inline ::PROTOBUF_NAMESPACE_ID::Option* Api::add_options() {
::PROTOBUF_NAMESPACE_ID::Option* _add = _internal_add_options();
@ -851,12 +860,12 @@ inline ::PROTOBUF_NAMESPACE_ID::Option* Api::add_options() {
inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Option >&
Api::options() const {
// @@protoc_insertion_point(field_list:google.protobuf.Api.options)
return options_;
return _impl_.options_;
}
// string version = 4;
inline void Api::clear_version() {
version_.ClearToEmpty();
_impl_.version_.ClearToEmpty();
}
inline const std::string& Api::version() const {
// @@protoc_insertion_point(field_get:google.protobuf.Api.version)
@ -866,7 +875,7 @@ template <typename ArgT0, typename... ArgT>
inline PROTOBUF_ALWAYS_INLINE
void Api::set_version(ArgT0&& arg0, ArgT... args) {
version_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
_impl_.version_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.Api.version)
}
inline std::string* Api::mutable_version() {
@ -875,19 +884,19 @@ inline std::string* Api::mutable_version() {
return _s;
}
inline const std::string& Api::_internal_version() const {
return version_.Get();
return _impl_.version_.Get();
}
inline void Api::_internal_set_version(const std::string& value) {
version_.Set(value, GetArenaForAllocation());
_impl_.version_.Set(value, GetArenaForAllocation());
}
inline std::string* Api::_internal_mutable_version() {
return version_.Mutable(GetArenaForAllocation());
return _impl_.version_.Mutable(GetArenaForAllocation());
}
inline std::string* Api::release_version() {
// @@protoc_insertion_point(field_release:google.protobuf.Api.version)
return version_.Release();
return _impl_.version_.Release();
}
inline void Api::set_allocated_version(std::string* version) {
if (version != nullptr) {
@ -895,10 +904,10 @@ inline void Api::set_allocated_version(std::string* version) {
} else {
}
version_.SetAllocated(version, GetArenaForAllocation());
_impl_.version_.SetAllocated(version, GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (version_.IsDefault()) {
version_.Set("", GetArenaForAllocation());
if (_impl_.version_.IsDefault()) {
_impl_.version_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Api.version)
@ -906,13 +915,13 @@ inline void Api::set_allocated_version(std::string* version) {
// .google.protobuf.SourceContext source_context = 5;
inline bool Api::_internal_has_source_context() const {
return this != internal_default_instance() && source_context_ != nullptr;
return this != internal_default_instance() && _impl_.source_context_ != nullptr;
}
inline bool Api::has_source_context() const {
return _internal_has_source_context();
}
inline const ::PROTOBUF_NAMESPACE_ID::SourceContext& Api::_internal_source_context() const {
const ::PROTOBUF_NAMESPACE_ID::SourceContext* p = source_context_;
const ::PROTOBUF_NAMESPACE_ID::SourceContext* p = _impl_.source_context_;
return p != nullptr ? *p : reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::SourceContext&>(
::PROTOBUF_NAMESPACE_ID::_SourceContext_default_instance_);
}
@ -923,9 +932,9 @@ inline const ::PROTOBUF_NAMESPACE_ID::SourceContext& Api::source_context() const
inline void Api::unsafe_arena_set_allocated_source_context(
::PROTOBUF_NAMESPACE_ID::SourceContext* source_context) {
if (GetArenaForAllocation() == nullptr) {
delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(source_context_);
delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.source_context_);
}
source_context_ = source_context;
_impl_.source_context_ = source_context;
if (source_context) {
} else {
@ -935,8 +944,8 @@ inline void Api::unsafe_arena_set_allocated_source_context(
}
inline ::PROTOBUF_NAMESPACE_ID::SourceContext* Api::release_source_context() {
::PROTOBUF_NAMESPACE_ID::SourceContext* temp = source_context_;
source_context_ = nullptr;
::PROTOBUF_NAMESPACE_ID::SourceContext* temp = _impl_.source_context_;
_impl_.source_context_ = nullptr;
#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE
auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp);
temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
@ -951,17 +960,17 @@ inline ::PROTOBUF_NAMESPACE_ID::SourceContext* Api::release_source_context() {
inline ::PROTOBUF_NAMESPACE_ID::SourceContext* Api::unsafe_arena_release_source_context() {
// @@protoc_insertion_point(field_release:google.protobuf.Api.source_context)
::PROTOBUF_NAMESPACE_ID::SourceContext* temp = source_context_;
source_context_ = nullptr;
::PROTOBUF_NAMESPACE_ID::SourceContext* temp = _impl_.source_context_;
_impl_.source_context_ = nullptr;
return temp;
}
inline ::PROTOBUF_NAMESPACE_ID::SourceContext* Api::_internal_mutable_source_context() {
if (source_context_ == nullptr) {
if (_impl_.source_context_ == nullptr) {
auto* p = CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::SourceContext>(GetArenaForAllocation());
source_context_ = p;
_impl_.source_context_ = p;
}
return source_context_;
return _impl_.source_context_;
}
inline ::PROTOBUF_NAMESPACE_ID::SourceContext* Api::mutable_source_context() {
::PROTOBUF_NAMESPACE_ID::SourceContext* _msg = _internal_mutable_source_context();
@ -971,7 +980,7 @@ inline ::PROTOBUF_NAMESPACE_ID::SourceContext* Api::mutable_source_context() {
inline void Api::set_allocated_source_context(::PROTOBUF_NAMESPACE_ID::SourceContext* source_context) {
::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
if (message_arena == nullptr) {
delete reinterpret_cast< ::PROTOBUF_NAMESPACE_ID::MessageLite*>(source_context_);
delete reinterpret_cast< ::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.source_context_);
}
if (source_context) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
@ -985,38 +994,38 @@ inline void Api::set_allocated_source_context(::PROTOBUF_NAMESPACE_ID::SourceCon
} else {
}
source_context_ = source_context;
_impl_.source_context_ = source_context;
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Api.source_context)
}
// repeated .google.protobuf.Mixin mixins = 6;
inline int Api::_internal_mixins_size() const {
return mixins_.size();
return _impl_.mixins_.size();
}
inline int Api::mixins_size() const {
return _internal_mixins_size();
}
inline void Api::clear_mixins() {
mixins_.Clear();
_impl_.mixins_.Clear();
}
inline ::PROTOBUF_NAMESPACE_ID::Mixin* Api::mutable_mixins(int index) {
// @@protoc_insertion_point(field_mutable:google.protobuf.Api.mixins)
return mixins_.Mutable(index);
return _impl_.mixins_.Mutable(index);
}
inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Mixin >*
Api::mutable_mixins() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.Api.mixins)
return &mixins_;
return &_impl_.mixins_;
}
inline const ::PROTOBUF_NAMESPACE_ID::Mixin& Api::_internal_mixins(int index) const {
return mixins_.Get(index);
return _impl_.mixins_.Get(index);
}
inline const ::PROTOBUF_NAMESPACE_ID::Mixin& Api::mixins(int index) const {
// @@protoc_insertion_point(field_get:google.protobuf.Api.mixins)
return _internal_mixins(index);
}
inline ::PROTOBUF_NAMESPACE_ID::Mixin* Api::_internal_add_mixins() {
return mixins_.Add();
return _impl_.mixins_.Add();
}
inline ::PROTOBUF_NAMESPACE_ID::Mixin* Api::add_mixins() {
::PROTOBUF_NAMESPACE_ID::Mixin* _add = _internal_add_mixins();
@ -1026,15 +1035,15 @@ inline ::PROTOBUF_NAMESPACE_ID::Mixin* Api::add_mixins() {
inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Mixin >&
Api::mixins() const {
// @@protoc_insertion_point(field_list:google.protobuf.Api.mixins)
return mixins_;
return _impl_.mixins_;
}
// .google.protobuf.Syntax syntax = 7;
inline void Api::clear_syntax() {
syntax_ = 0;
_impl_.syntax_ = 0;
}
inline ::PROTOBUF_NAMESPACE_ID::Syntax Api::_internal_syntax() const {
return static_cast< ::PROTOBUF_NAMESPACE_ID::Syntax >(syntax_);
return static_cast< ::PROTOBUF_NAMESPACE_ID::Syntax >(_impl_.syntax_);
}
inline ::PROTOBUF_NAMESPACE_ID::Syntax Api::syntax() const {
// @@protoc_insertion_point(field_get:google.protobuf.Api.syntax)
@ -1042,7 +1051,7 @@ inline ::PROTOBUF_NAMESPACE_ID::Syntax Api::syntax() const {
}
inline void Api::_internal_set_syntax(::PROTOBUF_NAMESPACE_ID::Syntax value) {
syntax_ = value;
_impl_.syntax_ = value;
}
inline void Api::set_syntax(::PROTOBUF_NAMESPACE_ID::Syntax value) {
_internal_set_syntax(value);
@ -1055,7 +1064,7 @@ inline void Api::set_syntax(::PROTOBUF_NAMESPACE_ID::Syntax value) {
// string name = 1;
inline void Method::clear_name() {
name_.ClearToEmpty();
_impl_.name_.ClearToEmpty();
}
inline const std::string& Method::name() const {
// @@protoc_insertion_point(field_get:google.protobuf.Method.name)
@ -1065,7 +1074,7 @@ template <typename ArgT0, typename... ArgT>
inline PROTOBUF_ALWAYS_INLINE
void Method::set_name(ArgT0&& arg0, ArgT... args) {
name_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
_impl_.name_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.Method.name)
}
inline std::string* Method::mutable_name() {
@ -1074,19 +1083,19 @@ inline std::string* Method::mutable_name() {
return _s;
}
inline const std::string& Method::_internal_name() const {
return name_.Get();
return _impl_.name_.Get();
}
inline void Method::_internal_set_name(const std::string& value) {
name_.Set(value, GetArenaForAllocation());
_impl_.name_.Set(value, GetArenaForAllocation());
}
inline std::string* Method::_internal_mutable_name() {
return name_.Mutable(GetArenaForAllocation());
return _impl_.name_.Mutable(GetArenaForAllocation());
}
inline std::string* Method::release_name() {
// @@protoc_insertion_point(field_release:google.protobuf.Method.name)
return name_.Release();
return _impl_.name_.Release();
}
inline void Method::set_allocated_name(std::string* name) {
if (name != nullptr) {
@ -1094,10 +1103,10 @@ inline void Method::set_allocated_name(std::string* name) {
} else {
}
name_.SetAllocated(name, GetArenaForAllocation());
_impl_.name_.SetAllocated(name, GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (name_.IsDefault()) {
name_.Set("", GetArenaForAllocation());
if (_impl_.name_.IsDefault()) {
_impl_.name_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Method.name)
@ -1105,7 +1114,7 @@ inline void Method::set_allocated_name(std::string* name) {
// string request_type_url = 2;
inline void Method::clear_request_type_url() {
request_type_url_.ClearToEmpty();
_impl_.request_type_url_.ClearToEmpty();
}
inline const std::string& Method::request_type_url() const {
// @@protoc_insertion_point(field_get:google.protobuf.Method.request_type_url)
@ -1115,7 +1124,7 @@ template <typename ArgT0, typename... ArgT>
inline PROTOBUF_ALWAYS_INLINE
void Method::set_request_type_url(ArgT0&& arg0, ArgT... args) {
request_type_url_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
_impl_.request_type_url_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.Method.request_type_url)
}
inline std::string* Method::mutable_request_type_url() {
@ -1124,19 +1133,19 @@ inline std::string* Method::mutable_request_type_url() {
return _s;
}
inline const std::string& Method::_internal_request_type_url() const {
return request_type_url_.Get();
return _impl_.request_type_url_.Get();
}
inline void Method::_internal_set_request_type_url(const std::string& value) {
request_type_url_.Set(value, GetArenaForAllocation());
_impl_.request_type_url_.Set(value, GetArenaForAllocation());
}
inline std::string* Method::_internal_mutable_request_type_url() {
return request_type_url_.Mutable(GetArenaForAllocation());
return _impl_.request_type_url_.Mutable(GetArenaForAllocation());
}
inline std::string* Method::release_request_type_url() {
// @@protoc_insertion_point(field_release:google.protobuf.Method.request_type_url)
return request_type_url_.Release();
return _impl_.request_type_url_.Release();
}
inline void Method::set_allocated_request_type_url(std::string* request_type_url) {
if (request_type_url != nullptr) {
@ -1144,10 +1153,10 @@ inline void Method::set_allocated_request_type_url(std::string* request_type_url
} else {
}
request_type_url_.SetAllocated(request_type_url, GetArenaForAllocation());
_impl_.request_type_url_.SetAllocated(request_type_url, GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (request_type_url_.IsDefault()) {
request_type_url_.Set("", GetArenaForAllocation());
if (_impl_.request_type_url_.IsDefault()) {
_impl_.request_type_url_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Method.request_type_url)
@ -1155,10 +1164,10 @@ inline void Method::set_allocated_request_type_url(std::string* request_type_url
// bool request_streaming = 3;
inline void Method::clear_request_streaming() {
request_streaming_ = false;
_impl_.request_streaming_ = false;
}
inline bool Method::_internal_request_streaming() const {
return request_streaming_;
return _impl_.request_streaming_;
}
inline bool Method::request_streaming() const {
// @@protoc_insertion_point(field_get:google.protobuf.Method.request_streaming)
@ -1166,7 +1175,7 @@ inline bool Method::request_streaming() const {
}
inline void Method::_internal_set_request_streaming(bool value) {
request_streaming_ = value;
_impl_.request_streaming_ = value;
}
inline void Method::set_request_streaming(bool value) {
_internal_set_request_streaming(value);
@ -1175,7 +1184,7 @@ inline void Method::set_request_streaming(bool value) {
// string response_type_url = 4;
inline void Method::clear_response_type_url() {
response_type_url_.ClearToEmpty();
_impl_.response_type_url_.ClearToEmpty();
}
inline const std::string& Method::response_type_url() const {
// @@protoc_insertion_point(field_get:google.protobuf.Method.response_type_url)
@ -1185,7 +1194,7 @@ template <typename ArgT0, typename... ArgT>
inline PROTOBUF_ALWAYS_INLINE
void Method::set_response_type_url(ArgT0&& arg0, ArgT... args) {
response_type_url_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
_impl_.response_type_url_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.Method.response_type_url)
}
inline std::string* Method::mutable_response_type_url() {
@ -1194,19 +1203,19 @@ inline std::string* Method::mutable_response_type_url() {
return _s;
}
inline const std::string& Method::_internal_response_type_url() const {
return response_type_url_.Get();
return _impl_.response_type_url_.Get();
}
inline void Method::_internal_set_response_type_url(const std::string& value) {
response_type_url_.Set(value, GetArenaForAllocation());
_impl_.response_type_url_.Set(value, GetArenaForAllocation());
}
inline std::string* Method::_internal_mutable_response_type_url() {
return response_type_url_.Mutable(GetArenaForAllocation());
return _impl_.response_type_url_.Mutable(GetArenaForAllocation());
}
inline std::string* Method::release_response_type_url() {
// @@protoc_insertion_point(field_release:google.protobuf.Method.response_type_url)
return response_type_url_.Release();
return _impl_.response_type_url_.Release();
}
inline void Method::set_allocated_response_type_url(std::string* response_type_url) {
if (response_type_url != nullptr) {
@ -1214,10 +1223,10 @@ inline void Method::set_allocated_response_type_url(std::string* response_type_u
} else {
}
response_type_url_.SetAllocated(response_type_url, GetArenaForAllocation());
_impl_.response_type_url_.SetAllocated(response_type_url, GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (response_type_url_.IsDefault()) {
response_type_url_.Set("", GetArenaForAllocation());
if (_impl_.response_type_url_.IsDefault()) {
_impl_.response_type_url_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Method.response_type_url)
@ -1225,10 +1234,10 @@ inline void Method::set_allocated_response_type_url(std::string* response_type_u
// bool response_streaming = 5;
inline void Method::clear_response_streaming() {
response_streaming_ = false;
_impl_.response_streaming_ = false;
}
inline bool Method::_internal_response_streaming() const {
return response_streaming_;
return _impl_.response_streaming_;
}
inline bool Method::response_streaming() const {
// @@protoc_insertion_point(field_get:google.protobuf.Method.response_streaming)
@ -1236,7 +1245,7 @@ inline bool Method::response_streaming() const {
}
inline void Method::_internal_set_response_streaming(bool value) {
response_streaming_ = value;
_impl_.response_streaming_ = value;
}
inline void Method::set_response_streaming(bool value) {
_internal_set_response_streaming(value);
@ -1245,29 +1254,29 @@ inline void Method::set_response_streaming(bool value) {
// repeated .google.protobuf.Option options = 6;
inline int Method::_internal_options_size() const {
return options_.size();
return _impl_.options_.size();
}
inline int Method::options_size() const {
return _internal_options_size();
}
inline ::PROTOBUF_NAMESPACE_ID::Option* Method::mutable_options(int index) {
// @@protoc_insertion_point(field_mutable:google.protobuf.Method.options)
return options_.Mutable(index);
return _impl_.options_.Mutable(index);
}
inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Option >*
Method::mutable_options() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.Method.options)
return &options_;
return &_impl_.options_;
}
inline const ::PROTOBUF_NAMESPACE_ID::Option& Method::_internal_options(int index) const {
return options_.Get(index);
return _impl_.options_.Get(index);
}
inline const ::PROTOBUF_NAMESPACE_ID::Option& Method::options(int index) const {
// @@protoc_insertion_point(field_get:google.protobuf.Method.options)
return _internal_options(index);
}
inline ::PROTOBUF_NAMESPACE_ID::Option* Method::_internal_add_options() {
return options_.Add();
return _impl_.options_.Add();
}
inline ::PROTOBUF_NAMESPACE_ID::Option* Method::add_options() {
::PROTOBUF_NAMESPACE_ID::Option* _add = _internal_add_options();
@ -1277,15 +1286,15 @@ inline ::PROTOBUF_NAMESPACE_ID::Option* Method::add_options() {
inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Option >&
Method::options() const {
// @@protoc_insertion_point(field_list:google.protobuf.Method.options)
return options_;
return _impl_.options_;
}
// .google.protobuf.Syntax syntax = 7;
inline void Method::clear_syntax() {
syntax_ = 0;
_impl_.syntax_ = 0;
}
inline ::PROTOBUF_NAMESPACE_ID::Syntax Method::_internal_syntax() const {
return static_cast< ::PROTOBUF_NAMESPACE_ID::Syntax >(syntax_);
return static_cast< ::PROTOBUF_NAMESPACE_ID::Syntax >(_impl_.syntax_);
}
inline ::PROTOBUF_NAMESPACE_ID::Syntax Method::syntax() const {
// @@protoc_insertion_point(field_get:google.protobuf.Method.syntax)
@ -1293,7 +1302,7 @@ inline ::PROTOBUF_NAMESPACE_ID::Syntax Method::syntax() const {
}
inline void Method::_internal_set_syntax(::PROTOBUF_NAMESPACE_ID::Syntax value) {
syntax_ = value;
_impl_.syntax_ = value;
}
inline void Method::set_syntax(::PROTOBUF_NAMESPACE_ID::Syntax value) {
_internal_set_syntax(value);
@ -1306,7 +1315,7 @@ inline void Method::set_syntax(::PROTOBUF_NAMESPACE_ID::Syntax value) {
// string name = 1;
inline void Mixin::clear_name() {
name_.ClearToEmpty();
_impl_.name_.ClearToEmpty();
}
inline const std::string& Mixin::name() const {
// @@protoc_insertion_point(field_get:google.protobuf.Mixin.name)
@ -1316,7 +1325,7 @@ template <typename ArgT0, typename... ArgT>
inline PROTOBUF_ALWAYS_INLINE
void Mixin::set_name(ArgT0&& arg0, ArgT... args) {
name_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
_impl_.name_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.Mixin.name)
}
inline std::string* Mixin::mutable_name() {
@ -1325,19 +1334,19 @@ inline std::string* Mixin::mutable_name() {
return _s;
}
inline const std::string& Mixin::_internal_name() const {
return name_.Get();
return _impl_.name_.Get();
}
inline void Mixin::_internal_set_name(const std::string& value) {
name_.Set(value, GetArenaForAllocation());
_impl_.name_.Set(value, GetArenaForAllocation());
}
inline std::string* Mixin::_internal_mutable_name() {
return name_.Mutable(GetArenaForAllocation());
return _impl_.name_.Mutable(GetArenaForAllocation());
}
inline std::string* Mixin::release_name() {
// @@protoc_insertion_point(field_release:google.protobuf.Mixin.name)
return name_.Release();
return _impl_.name_.Release();
}
inline void Mixin::set_allocated_name(std::string* name) {
if (name != nullptr) {
@ -1345,10 +1354,10 @@ inline void Mixin::set_allocated_name(std::string* name) {
} else {
}
name_.SetAllocated(name, GetArenaForAllocation());
_impl_.name_.SetAllocated(name, GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (name_.IsDefault()) {
name_.Set("", GetArenaForAllocation());
if (_impl_.name_.IsDefault()) {
_impl_.name_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Mixin.name)
@ -1356,7 +1365,7 @@ inline void Mixin::set_allocated_name(std::string* name) {
// string root = 2;
inline void Mixin::clear_root() {
root_.ClearToEmpty();
_impl_.root_.ClearToEmpty();
}
inline const std::string& Mixin::root() const {
// @@protoc_insertion_point(field_get:google.protobuf.Mixin.root)
@ -1366,7 +1375,7 @@ template <typename ArgT0, typename... ArgT>
inline PROTOBUF_ALWAYS_INLINE
void Mixin::set_root(ArgT0&& arg0, ArgT... args) {
root_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
_impl_.root_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.Mixin.root)
}
inline std::string* Mixin::mutable_root() {
@ -1375,19 +1384,19 @@ inline std::string* Mixin::mutable_root() {
return _s;
}
inline const std::string& Mixin::_internal_root() const {
return root_.Get();
return _impl_.root_.Get();
}
inline void Mixin::_internal_set_root(const std::string& value) {
root_.Set(value, GetArenaForAllocation());
_impl_.root_.Set(value, GetArenaForAllocation());
}
inline std::string* Mixin::_internal_mutable_root() {
return root_.Mutable(GetArenaForAllocation());
return _impl_.root_.Mutable(GetArenaForAllocation());
}
inline std::string* Mixin::release_root() {
// @@protoc_insertion_point(field_release:google.protobuf.Mixin.root)
return root_.Release();
return _impl_.root_.Release();
}
inline void Mixin::set_allocated_root(std::string* root) {
if (root != nullptr) {
@ -1395,10 +1404,10 @@ inline void Mixin::set_allocated_root(std::string* root) {
} else {
}
root_.SetAllocated(root, GetArenaForAllocation());
_impl_.root_.SetAllocated(root, GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (root_.IsDefault()) {
root_.Set("", GetArenaForAllocation());
if (_impl_.root_.IsDefault()) {
_impl_.root_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Mixin.root)

@ -55,13 +55,13 @@ void UnsampleSlow(ThreadSafeArenaStats* info) {
namespace {
PROTOBUF_CONSTINIT std::atomic<bool> g_arenaz_enabled{true};
PROTOBUF_CONSTINIT std::atomic<int32_t> g_arenaz_sample_parameter{1 << 20};
PROTOBUF_CONSTINIT std::atomic<int32_t> g_arenaz_sample_parameter{1 << 15};
PROTOBUF_THREAD_LOCAL absl::profiling_internal::ExponentialBiased
g_exponential_biased_generator;
} // namespace
PROTOBUF_THREAD_LOCAL int64_t global_next_sample = 1LL << 20;
PROTOBUF_THREAD_LOCAL int64_t global_next_sample = 1LL << 15;
ThreadSafeArenaStats::ThreadSafeArenaStats() { PrepareForSampling(); }
ThreadSafeArenaStats::~ThreadSafeArenaStats() = default;

@ -34,8 +34,6 @@
#include <google/protobuf/compiler/command_line_interface.h>
#include <cstdint>
#include <google/protobuf/stubs/platform_macros.h>
#include <stdio.h>
@ -70,20 +68,20 @@
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/logging.h>
#include <google/protobuf/compiler/subprocess.h>
#include <google/protobuf/compiler/zip_writer.h>
#include <google/protobuf/compiler/plugin.pb.h>
#include <google/protobuf/stubs/strutil.h>
#include <google/protobuf/stubs/stringprintf.h>
#include <google/protobuf/stubs/substitute.h>
#include <google/protobuf/compiler/code_generator.h>
#include <google/protobuf/compiler/importer.h>
#include <google/protobuf/compiler/zip_writer.h>
#include <google/protobuf/descriptor.h>
#include <google/protobuf/dynamic_message.h>
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/io/io_win32.h>
#include <google/protobuf/io/printer.h>
#include <google/protobuf/io/zero_copy_stream_impl.h>
#include <google/protobuf/descriptor.h>
#include <google/protobuf/dynamic_message.h>
#include <google/protobuf/text_format.h>
#include <google/protobuf/stubs/strutil.h>
#include <google/protobuf/stubs/stringprintf.h>
#include <google/protobuf/stubs/substitute.h>
#include <google/protobuf/io/io_win32.h>
#include <google/protobuf/stubs/map_util.h>
#include <google/protobuf/stubs/stl_util.h>

@ -131,11 +131,6 @@ void EnumFieldGenerator::GenerateSwappingCode(io::Printer* printer) const {
format("swap($field$, other->$field$);\n");
}
void EnumFieldGenerator::GenerateConstructorCode(io::Printer* printer) const {
Formatter format(printer, variables_);
format("$field$ = $default$;\n");
}
void EnumFieldGenerator::GenerateCopyConstructorCode(
io::Printer* printer) const {
Formatter format(printer, variables_);
@ -158,10 +153,22 @@ void EnumFieldGenerator::GenerateByteSize(io::Printer* printer) const {
" ::_pbi::WireFormatLite::EnumSize(this->_internal_$name$());\n");
}
void EnumFieldGenerator::GenerateConstinitInitializer(
void EnumFieldGenerator::GenerateConstexprAggregateInitializer(
io::Printer* printer) const {
Formatter format(printer, variables_);
format("/*decltype($field$)*/$default$");
}
void EnumFieldGenerator::GenerateAggregateInitializer(
io::Printer* printer) const {
Formatter format(printer, variables_);
format("$name$_($default$)\n");
format("decltype($field$){$default$}");
}
void EnumFieldGenerator::GenerateCopyAggregateInitializer(
io::Printer* printer) const {
Formatter format(printer, variables_);
format("decltype($field$){}");
}
// ===================================================================
@ -336,6 +343,12 @@ void RepeatedEnumFieldGenerator::GenerateConstructorCode(
// Not needed for repeated fields.
}
void RepeatedEnumFieldGenerator::GenerateDestructorCode(
io::Printer* printer) const {
Formatter format(printer, variables_);
format("$field$.~RepeatedField();\n");
}
void RepeatedEnumFieldGenerator::GenerateSerializeWithCachedSizesToArray(
io::Printer* printer) const {
Formatter format(printer, variables_);
@ -392,13 +405,36 @@ void RepeatedEnumFieldGenerator::GenerateByteSize(io::Printer* printer) const {
format("}\n");
}
void RepeatedEnumFieldGenerator::GenerateConstinitInitializer(
void RepeatedEnumFieldGenerator::GenerateConstexprAggregateInitializer(
io::Printer* printer) const {
Formatter format(printer, variables_);
format("/*decltype($field$)*/{}");
if (descriptor_->is_packed() &&
HasGeneratedMethods(descriptor_->file(), options_)) {
format("\n, /*decltype($cached_byte_size_field$)*/{0}");
}
}
void RepeatedEnumFieldGenerator::GenerateAggregateInitializer(
io::Printer* printer) const {
Formatter format(printer, variables_);
format("decltype($field$){arena}");
if (descriptor_->is_packed() &&
HasGeneratedMethods(descriptor_->file(), options_)) {
// std::atomic has no copy constructor, which prevents explicit aggregate
// initialization pre-C++17.
format("\n, /*decltype($cached_byte_size_field$)*/{0}");
}
}
void RepeatedEnumFieldGenerator::GenerateCopyAggregateInitializer(
io::Printer* printer) const {
Formatter format(printer, variables_);
format("$name$_()");
format("decltype($field$){from.$field$}");
if (descriptor_->is_packed() &&
HasGeneratedMethods(descriptor_->file(), options_)) {
format("\n, $cached_byte_size_name$(0)");
// std::atomic has no copy constructor.
format("\n, /*decltype($cached_byte_size_field$)*/{0}");
}
}

@ -57,12 +57,15 @@ class EnumFieldGenerator : public FieldGenerator {
void GenerateClearingCode(io::Printer* printer) const override;
void GenerateMergingCode(io::Printer* printer) const override;
void GenerateSwappingCode(io::Printer* printer) const override;
void GenerateConstructorCode(io::Printer* printer) const override;
void GenerateConstructorCode(io::Printer* printer) const override {}
void GenerateCopyConstructorCode(io::Printer* printer) const override;
void GenerateSerializeWithCachedSizesToArray(
io::Printer* printer) const override;
void GenerateByteSize(io::Printer* printer) const override;
void GenerateConstinitInitializer(io::Printer* printer) const override;
void GenerateConstexprAggregateInitializer(
io::Printer* printer) const override;
void GenerateAggregateInitializer(io::Printer* printer) const override;
void GenerateCopyAggregateInitializer(io::Printer* printer) const override;
private:
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(EnumFieldGenerator);
@ -99,10 +102,14 @@ class RepeatedEnumFieldGenerator : public FieldGenerator {
void GenerateSwappingCode(io::Printer* printer) const override;
void GenerateConstructorCode(io::Printer* printer) const override;
void GenerateCopyConstructorCode(io::Printer* printer) const override {}
void GenerateDestructorCode(io::Printer* printer) const override;
void GenerateSerializeWithCachedSizesToArray(
io::Printer* printer) const override;
void GenerateByteSize(io::Printer* printer) const override;
void GenerateConstinitInitializer(io::Printer* printer) const override;
void GenerateConstexprAggregateInitializer(
io::Printer* printer) const override;
void GenerateAggregateInitializer(io::Printer* printer) const override;
void GenerateCopyAggregateInitializer(io::Printer* printer) const override;
private:
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedEnumFieldGenerator);

@ -78,7 +78,7 @@ ExtensionGenerator::ExtensionGenerator(const FieldDescriptor* descriptor,
break;
}
SetCommonVars(options, &variables_);
SetCommonMessageDataVariables(&variables_);
SetCommonMessageDataVariables(descriptor_->containing_type(), &variables_);
variables_["extendee"] =
QualifiedClassName(descriptor_->containing_type(), options_);
variables_["type_traits"] = type_traits_;

@ -236,7 +236,7 @@ void SetCommonFieldVariables(const FieldDescriptor* descriptor,
std::map<std::string, std::string>* variables,
const Options& options) {
SetCommonVars(options, variables);
SetCommonMessageDataVariables(variables);
SetCommonMessageDataVariables(descriptor->containing_type(), variables);
(*variables)["ns"] = Namespace(descriptor, options);
(*variables)["name"] = FieldName(descriptor);
@ -304,6 +304,23 @@ void FieldGenerator::SetInlinedStringIndex(int32_t inlined_string_index) {
"u");
}
void FieldGenerator::GenerateAggregateInitializer(io::Printer* printer) const {
Formatter format(printer, variables_);
format("decltype($field$){arena}");
}
void FieldGenerator::GenerateConstexprAggregateInitializer(
io::Printer* printer) const {
Formatter format(printer, variables_);
format("/*decltype($field$)*/{}");
}
void FieldGenerator::GenerateCopyAggregateInitializer(
io::Printer* printer) const {
Formatter format(printer, variables_);
format("decltype($field$){from.$field$}");
}
void SetCommonOneofFieldVariables(
const FieldDescriptor* descriptor,
std::map<std::string, std::string>* variables) {

@ -165,10 +165,32 @@ class FieldGenerator {
}
// Generate initialization code for private members declared by
// GeneratePrivateMembers(), specifically for the constexpr constructor.
// These go into the constructor's initializer list and must follow that
// syntax (eg `field_(args)`). Does not include `:` or `,` separators.
virtual void GenerateConstinitInitializer(io::Printer* printer) const {}
// GeneratePrivateMembers(). These go into the SharedCtor's
// aggregate initialization of the _impl_ struct and must follow the syntax
// (e.g. `decltype($field$){$default$}`). Does not include `:` or `,`
// separators. Default values should be specified here when possible.
//
// Note: We use `decltype($field$)` for both explicit construction and the
// fact that it's self-documenting. Pre-C++17, copy elision isn't guaranteed
// in aggregate initialization so a valid copy/move constructor must exist
// (even though it's not used). Because of this, we need to comment out the
// decltype and fallback to implicit construction.
virtual void GenerateAggregateInitializer(io::Printer* printer) const;
// Generate constinit initialization code for private members declared by
// GeneratePrivateMembers(). These go into the constexpr constructor's
// aggregate initialization of the _impl_ struct and must follow the syntax
// (e.g. `/*decltype($field$)*/{}`, see above). Does not
// include `:` or `,` separators.
virtual void GenerateConstexprAggregateInitializer(
io::Printer* printer) const;
// Generate copy initialization code for private members declared by
// GeneratePrivateMembers(). These go into the copy constructor's
// aggregate initialization of the _impl_ struct and must follow the syntax
// (e.g. `decltype($field$){from.$field$}`, see above). Does not
// include `:` or `,` separators.
virtual void GenerateCopyAggregateInitializer(io::Printer* printer) const;
// Generate lines to serialize this field directly to the array "target",
// which are placed within the message's SerializeWithCachedSizesToArray()

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

Loading…
Cancel
Save