diff -Nru protobuf-3.0.0/appveyor.bat protobuf-3.6.1.3/appveyor.bat --- protobuf-3.0.0/appveyor.bat 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/appveyor.bat 2018-12-08 01:32:11.000000000 +0000 @@ -10,7 +10,7 @@ echo Building C++ mkdir build_msvc cd build_msvc -cmake -G "%generator%" -Dprotobuf_BUILD_SHARED_LIBS=%BUILD_DLL% ../cmake +cmake -G "%generator%" -Dprotobuf_BUILD_SHARED_LIBS=%BUILD_DLL% -Dprotobuf_UNICODE=%UNICODE% ../cmake msbuild protobuf.sln /p:Platform=%vcplatform% /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" || goto error cd %configuration% tests.exe || goto error @@ -19,11 +19,15 @@ :build_csharp echo Building C# cd csharp\src +REM The platform environment variable is implicitly used by msbuild; +REM we don't want it. +set platform= dotnet restore -dotnet build -c %configuration% Google.Protobuf Google.Protobuf.Test Google.Protobuf.Conformance || goto error +dotnet build -c %configuration% || goto error echo Testing C# -dotnet test -c %configuration% Google.Protobuf.Test || goto error +dotnet test -c %configuration% -f netcoreapp1.0 Google.Protobuf.Test\Google.Protobuf.Test.csproj || goto error +dotnet test -c %configuration% -f net451 Google.Protobuf.Test\Google.Protobuf.Test.csproj || goto error goto :EOF diff -Nru protobuf-3.0.0/appveyor.yml protobuf-3.6.1.3/appveyor.yml --- protobuf-3.0.0/appveyor.yml 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/appveyor.yml 2018-12-08 01:32:11.000000000 +0000 @@ -1,6 +1,3 @@ -# Only test one combination: "Visual Studio 12 + Win64 + Debug + DLL". We can -# test more combinations but AppVeyor just takes too long to finish (each -# combination takes ~15mins). platform: - Win64 @@ -10,24 +7,28 @@ environment: matrix: - language: cpp + image: Visual Studio 2015 BUILD_DLL: ON + UNICODE: ON + + - language: cpp + image: Visual Studio 2017 + BUILD_DLL: OFF + UNICODE: ON - language: csharp + image: Visual Studio 2017 # Our build scripts run tests automatically; we don't want AppVeyor # to try to detect them itself. test: off install: - - ps: Start-FileDownload https://googlemock.googlecode.com/files/gmock-1.7.0.zip - - 7z x gmock-1.7.0.zip - - rename gmock-1.7.0 gmock - - ps: Start-FileDownload https://go.microsoft.com/fwlink/?LinkID=809122 -FileName dotnetsdk.exe - - dotnetsdk.exe /install /quiet /norestart + - git submodule update --init --recursive before_build: - - if %platform%==Win32 set generator=Visual Studio 12 - - if %platform%==Win64 set generator=Visual Studio 12 Win64 + - if %platform%==Win32 set generator=Visual Studio 14 + - if %platform%==Win64 set generator=Visual Studio 14 Win64 - if %platform%==Win32 set vcplatform=Win32 - if %platform%==Win64 set vcplatform=x64 diff -Nru protobuf-3.0.0/autogen.sh protobuf-3.6.1.3/autogen.sh --- protobuf-3.0.0/autogen.sh 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/autogen.sh 2018-12-08 01:32:11.000000000 +0000 @@ -17,7 +17,6 @@ done fi - # Check that we're being run from the right directory. if test ! -f src/google/protobuf/stubs/common.h; then cat >&2 << __EOF__ @@ -27,18 +26,13 @@ exit 1 fi -# Check that gmock is present. Usually it is already there since the -# directory is set up as an SVN external. -if test ! -e gmock; then - echo "Google Mock not present. Fetching gmock-1.7.0 from the web..." - curl $curlopts -O https://googlemock.googlecode.com/files/gmock-1.7.0.zip - unzip -q gmock-1.7.0.zip - rm gmock-1.7.0.zip - mv gmock-1.7.0 gmock -fi - set -ex +# The absence of a m4 directory in googletest causes autoreconf to fail when +# building under the CentOS docker image. It's a warning in regular build on +# Ubuntu/gLinux as well. +mkdir -p third_party/googletest/m4 + # TODO(kenton): Remove the ",no-obsolete" part and fix the resulting warnings. autoreconf -f -i -Wall,no-obsolete diff -Nru protobuf-3.0.0/benchmarks/benchmark_messages_proto2.proto protobuf-3.6.1.3/benchmarks/benchmark_messages_proto2.proto --- protobuf-3.0.0/benchmarks/benchmark_messages_proto2.proto 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/benchmarks/benchmark_messages_proto2.proto 1970-01-01 00:00:00.000000000 +0000 @@ -1,141 +0,0 @@ -// Benchmark messages for proto2. - -syntax = "proto2"; - -package benchmarks.proto2; -option java_package = "com.google.protobuf.benchmarks"; - -// This is the default, but we specify it here explicitly. -option optimize_for = SPEED; - -message GoogleMessage1 { - required string field1 = 1; - optional string field9 = 9; - optional string field18 = 18; - optional bool field80 = 80 [default=false]; - optional bool field81 = 81 [default=true]; - required int32 field2 = 2; - required int32 field3 = 3; - optional int32 field280 = 280; - optional int32 field6 = 6 [default=0]; - optional int64 field22 = 22; - optional string field4 = 4; - repeated fixed64 field5 = 5; - optional bool field59 = 59 [default=false]; - optional string field7 = 7; - optional int32 field16 = 16; - optional int32 field130 = 130 [default=0]; - optional bool field12 = 12 [default=true]; - optional bool field17 = 17 [default=true]; - optional bool field13 = 13 [default=true]; - optional bool field14 = 14 [default=true]; - optional int32 field104 = 104 [default=0]; - optional int32 field100 = 100 [default=0]; - optional int32 field101 = 101 [default=0]; - optional string field102 = 102; - optional string field103 = 103; - optional int32 field29 = 29 [default=0]; - optional bool field30 = 30 [default=false]; - optional int32 field60 = 60 [default=-1]; - optional int32 field271 = 271 [default=-1]; - optional int32 field272 = 272 [default=-1]; - optional int32 field150 = 150; - optional int32 field23 = 23 [default=0]; - optional bool field24 = 24 [default=false]; - optional int32 field25 = 25 [default=0]; - optional GoogleMessage1SubMessage field15 = 15; - optional bool field78 = 78; - optional int32 field67 = 67 [default=0]; - optional int32 field68 = 68; - optional int32 field128 = 128 [default=0]; - optional string field129 = 129 [default="xxxxxxxxxxxxxxxxxxxxx"]; - optional int32 field131 = 131 [default=0]; -} - -message GoogleMessage1SubMessage { - optional int32 field1 = 1 [default=0]; - optional int32 field2 = 2 [default=0]; - optional int32 field3 = 3 [default=0]; - optional string field15 = 15; - optional bool field12 = 12 [default=true]; - optional int64 field13 = 13; - optional int64 field14 = 14; - optional int32 field16 = 16; - optional int32 field19 = 19 [default=2]; - optional bool field20 = 20 [default=true]; - optional bool field28 = 28 [default=true]; - optional fixed64 field21 = 21; - optional int32 field22 = 22; - optional bool field23 = 23 [ default=false ]; - optional bool field206 = 206 [default=false]; - optional fixed32 field203 = 203; - optional int32 field204 = 204; - optional string field205 = 205; - optional uint64 field207 = 207; - optional uint64 field300 = 300; -} - -message GoogleMessage2 { - optional string field1 = 1; - optional int64 field3 = 3; - optional int64 field4 = 4; - optional int64 field30 = 30; - optional bool field75 = 75 [default=false]; - optional string field6 = 6; - optional bytes field2 = 2; - optional int32 field21 = 21 [default=0]; - optional int32 field71 = 71; - optional float field25 = 25; - optional int32 field109 = 109 [default=0]; - optional int32 field210 = 210 [default=0]; - optional int32 field211 = 211 [default=0]; - optional int32 field212 = 212 [default=0]; - optional int32 field213 = 213 [default=0]; - optional int32 field216 = 216 [default=0]; - optional int32 field217 = 217 [default=0]; - optional int32 field218 = 218 [default=0]; - optional int32 field220 = 220 [default=0]; - optional int32 field221 = 221 [default=0]; - optional float field222 = 222 [default=0.0]; - optional int32 field63 = 63; - - repeated group Group1 = 10 { - required float field11 = 11; - optional float field26 = 26; - optional string field12 = 12; - optional string field13 = 13; - repeated string field14 = 14; - required uint64 field15 = 15; - optional int32 field5 = 5; - optional string field27 = 27; - optional int32 field28 = 28; - optional string field29 = 29; - optional string field16 = 16; - repeated string field22 = 22; - repeated int32 field73 = 73; - optional int32 field20 = 20 [default=0]; - optional string field24 = 24; - optional GoogleMessage2GroupedMessage field31 = 31; - } - repeated string field128 = 128; - optional int64 field131 = 131; - repeated string field127 = 127; - optional int32 field129 = 129; - repeated int64 field130 = 130; - optional bool field205 = 205 [default=false]; - optional bool field206 = 206 [default=false]; -} - -message GoogleMessage2GroupedMessage { - optional float field1 = 1; - optional float field2 = 2; - optional float field3 = 3 [default=0.0]; - optional bool field4 = 4; - optional bool field5 = 5; - optional bool field6 = 6 [default=true]; - optional bool field7 = 7 [default=false]; - optional float field8 = 8; - optional bool field9 = 9; - optional float field10 = 10; - optional int64 field11 = 11; -} diff -Nru protobuf-3.0.0/benchmarks/benchmark_messages_proto3.proto protobuf-3.6.1.3/benchmarks/benchmark_messages_proto3.proto --- protobuf-3.0.0/benchmarks/benchmark_messages_proto3.proto 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/benchmarks/benchmark_messages_proto3.proto 1970-01-01 00:00:00.000000000 +0000 @@ -1,76 +0,0 @@ -// Benchmark messages for proto3. - -syntax = "proto3"; - -package benchmarks.proto3; -option java_package = "com.google.protobuf.benchmarks"; - -// This is the default, but we specify it here explicitly. -option optimize_for = SPEED; - -message GoogleMessage1 { - string field1 = 1; - string field9 = 9; - string field18 = 18; - bool field80 = 80; - bool field81 = 81; - int32 field2 = 2; - int32 field3 = 3; - int32 field280 = 280; - int32 field6 = 6; - int64 field22 = 22; - string field4 = 4; - repeated fixed64 field5 = 5; - bool field59 = 59; - string field7 = 7; - int32 field16 = 16; - int32 field130 = 130; - bool field12 = 12; - bool field17 = 17; - bool field13 = 13; - bool field14 = 14; - int32 field104 = 104; - int32 field100 = 100; - int32 field101 = 101; - string field102 = 102; - string field103 = 103; - int32 field29 = 29; - bool field30 = 30; - int32 field60 = 60; - int32 field271 = 271; - int32 field272 = 272; - int32 field150 = 150; - int32 field23 = 23; - bool field24 = 24; - int32 field25 = 25; - GoogleMessage1SubMessage field15 = 15; - bool field78 = 78; - int32 field67 = 67; - int32 field68 = 68; - int32 field128 = 128; - string field129 = 129; - int32 field131 = 131; -} - -message GoogleMessage1SubMessage { - int32 field1 = 1; - int32 field2 = 2; - int32 field3 = 3; - string field15 = 15; - bool field12 = 12; - int64 field13 = 13; - int64 field14 = 14; - int32 field16 = 16; - int32 field19 = 19; - bool field20 = 20; - bool field28 = 28; - fixed64 field21 = 21; - int32 field22 = 22; - bool field23 = 23; - bool field206 = 206; - fixed32 field203 = 203; - int32 field204 = 204; - string field205 = 205; - uint64 field207 = 207; - uint64 field300 = 300; -} diff -Nru protobuf-3.0.0/benchmarks/cpp/cpp_benchmark.cc protobuf-3.6.1.3/benchmarks/cpp/cpp_benchmark.cc --- protobuf-3.0.0/benchmarks/cpp/cpp_benchmark.cc 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/benchmarks/cpp/cpp_benchmark.cc 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,254 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include +#include +#include "benchmark/benchmark_api.h" +#include "benchmarks.pb.h" +#include "datasets/google_message1/proto2/benchmark_message1_proto2.pb.h" +#include "datasets/google_message1/proto3/benchmark_message1_proto3.pb.h" +#include "datasets/google_message2/benchmark_message2.pb.h" +#include "datasets/google_message3/benchmark_message3.pb.h" +#include "datasets/google_message4/benchmark_message4.pb.h" + + +#define PREFIX "dataset." +#define SUFFIX ".pb" + +using benchmarks::BenchmarkDataset; +using google::protobuf::Arena; +using google::protobuf::Descriptor; +using google::protobuf::DescriptorPool; +using google::protobuf::Message; +using google::protobuf::MessageFactory; + +class Fixture : public benchmark::Fixture { + public: + Fixture(const BenchmarkDataset& dataset, const std::string& suffix) { + for (int i = 0; i < dataset.payload_size(); i++) { + payloads_.push_back(dataset.payload(i)); + } + + const Descriptor* d = + DescriptorPool::generated_pool()->FindMessageTypeByName( + dataset.message_name()); + + if (!d) { + std::cerr << "Couldn't find message named '" << dataset.message_name() + << "\n"; + } + + prototype_ = MessageFactory::generated_factory()->GetPrototype(d); + SetName((dataset.name() + suffix).c_str()); + } + + protected: + std::vector payloads_; + const Message* prototype_; +}; + +class WrappingCounter { + public: + WrappingCounter(size_t limit) : value_(0), limit_(limit) {} + + size_t Next() { + size_t ret = value_; + if (++value_ == limit_) { + value_ = 0; + } + return ret; + } + + private: + size_t value_; + size_t limit_; +}; + +template +class ParseNewFixture : public Fixture { + public: + ParseNewFixture(const BenchmarkDataset& dataset) + : Fixture(dataset, "_parse_new") {} + + virtual void BenchmarkCase(benchmark::State& state) { + WrappingCounter i(payloads_.size()); + size_t total = 0; + + while (state.KeepRunning()) { + T m; + const std::string& payload = payloads_[i.Next()]; + total += payload.size(); + m.ParseFromString(payload); + } + + state.SetBytesProcessed(total); + } +}; + +template +class ParseNewArenaFixture : public Fixture { + public: + ParseNewArenaFixture(const BenchmarkDataset& dataset) + : Fixture(dataset, "_parse_newarena") {} + + virtual void BenchmarkCase(benchmark::State& state) { + WrappingCounter i(payloads_.size()); + size_t total = 0; + Arena arena; + + while (state.KeepRunning()) { + arena.Reset(); + Message* m = Arena::CreateMessage(&arena); + const std::string& payload = payloads_[i.Next()]; + total += payload.size(); + m->ParseFromString(payload); + } + + state.SetBytesProcessed(total); + } +}; + +template +class ParseReuseFixture : public Fixture { + public: + ParseReuseFixture(const BenchmarkDataset& dataset) + : Fixture(dataset, "_parse_reuse") {} + + virtual void BenchmarkCase(benchmark::State& state) { + T m; + WrappingCounter i(payloads_.size()); + size_t total = 0; + + while (state.KeepRunning()) { + const std::string& payload = payloads_[i.Next()]; + total += payload.size(); + m.ParseFromString(payload); + } + + state.SetBytesProcessed(total); + } +}; + +template +class SerializeFixture : public Fixture { + public: + SerializeFixture(const BenchmarkDataset& dataset) + : Fixture(dataset, "_serialize") { + for (size_t i = 0; i < payloads_.size(); i++) { + message_.push_back(new T); + message_.back()->ParseFromString(payloads_[i]); + } + } + + ~SerializeFixture() { + for (size_t i = 0; i < message_.size(); i++) { + delete message_[i]; + } + } + + virtual void BenchmarkCase(benchmark::State& state) { + size_t total = 0; + std::string str; + WrappingCounter i(payloads_.size()); + + while (state.KeepRunning()) { + str.clear(); + message_[i.Next()]->SerializeToString(&str); + total += str.size(); + } + + state.SetBytesProcessed(total); + } + + private: + std::vector message_; +}; + +std::string ReadFile(const std::string& name) { + std::ifstream file(name.c_str()); + GOOGLE_CHECK(file.is_open()) << "Couldn't find file '" << name << + "', please make sure you are running " + "this command from the benchmarks/ " + "directory.\n"; + return std::string((std::istreambuf_iterator(file)), + std::istreambuf_iterator()); +} + +template +void RegisterBenchmarksForType(const BenchmarkDataset& dataset) { + ::benchmark::internal::RegisterBenchmarkInternal( + new ParseNewFixture(dataset)); + ::benchmark::internal::RegisterBenchmarkInternal( + new ParseReuseFixture(dataset)); + ::benchmark::internal::RegisterBenchmarkInternal( + new ParseNewArenaFixture(dataset)); + ::benchmark::internal::RegisterBenchmarkInternal( + new SerializeFixture(dataset)); +} + +void RegisterBenchmarks(const std::string& dataset_bytes) { + BenchmarkDataset dataset; + GOOGLE_CHECK(dataset.ParseFromString(dataset_bytes)); + + if (dataset.message_name() == "benchmarks.proto3.GoogleMessage1") { + RegisterBenchmarksForType(dataset); + } else if (dataset.message_name() == "benchmarks.proto2.GoogleMessage1") { + RegisterBenchmarksForType(dataset); + } else if (dataset.message_name() == "benchmarks.proto2.GoogleMessage2") { + RegisterBenchmarksForType(dataset); + } else if (dataset.message_name() == + "benchmarks.google_message3.GoogleMessage3") { + RegisterBenchmarksForType + (dataset); + } else if (dataset.message_name() == + "benchmarks.google_message4.GoogleMessage4") { + RegisterBenchmarksForType + (dataset); + } else { + std::cerr << "Unknown message type: " << dataset.message_name(); + exit(1); + } +} + +int main(int argc, char *argv[]) { + ::benchmark::Initialize(&argc, argv); + if (argc == 1) { + std::cerr << "Usage: ./cpp-benchmark " << std::endl; + std::cerr << "input data is in the format of \"benchmarks.proto\"" + << std::endl; + return 1; + } else { + for (int i = 1; i < argc; i++) { + RegisterBenchmarks(ReadFile(argv[i])); + } + } + + ::benchmark::RunSpecifiedBenchmarks(); +} diff -Nru protobuf-3.0.0/benchmarks/datasets/google_message1/proto2/benchmark_message1_proto2.proto protobuf-3.6.1.3/benchmarks/datasets/google_message1/proto2/benchmark_message1_proto2.proto --- protobuf-3.0.0/benchmarks/datasets/google_message1/proto2/benchmark_message1_proto2.proto 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/benchmarks/datasets/google_message1/proto2/benchmark_message1_proto2.proto 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,78 @@ +// Benchmark messages for proto2. + +syntax = "proto2"; + +package benchmarks.proto2; +option java_package = "com.google.protobuf.benchmarks"; + +// This is the default, but we specify it here explicitly. +option optimize_for = SPEED; + +option cc_enable_arenas = true; + +message GoogleMessage1 { + required string field1 = 1; + optional string field9 = 9; + optional string field18 = 18; + optional bool field80 = 80 [default = false]; + optional bool field81 = 81 [default = true]; + required int32 field2 = 2; + required int32 field3 = 3; + optional int32 field280 = 280; + optional int32 field6 = 6 [default = 0]; + optional int64 field22 = 22; + optional string field4 = 4; + repeated fixed64 field5 = 5; + optional bool field59 = 59 [default = false]; + optional string field7 = 7; + optional int32 field16 = 16; + optional int32 field130 = 130 [default = 0]; + optional bool field12 = 12 [default = true]; + optional bool field17 = 17 [default = true]; + optional bool field13 = 13 [default = true]; + optional bool field14 = 14 [default = true]; + optional int32 field104 = 104 [default = 0]; + optional int32 field100 = 100 [default = 0]; + optional int32 field101 = 101 [default = 0]; + optional string field102 = 102; + optional string field103 = 103; + optional int32 field29 = 29 [default = 0]; + optional bool field30 = 30 [default = false]; + optional int32 field60 = 60 [default = -1]; + optional int32 field271 = 271 [default = -1]; + optional int32 field272 = 272 [default = -1]; + optional int32 field150 = 150; + optional int32 field23 = 23 [default = 0]; + optional bool field24 = 24 [default = false]; + optional int32 field25 = 25 [default = 0]; + optional GoogleMessage1SubMessage field15 = 15; + optional bool field78 = 78; + optional int32 field67 = 67 [default = 0]; + optional int32 field68 = 68; + optional int32 field128 = 128 [default = 0]; + optional string field129 = 129 [default = "xxxxxxxxxxxxxxxxxxxxx"]; + optional int32 field131 = 131 [default = 0]; +} + +message GoogleMessage1SubMessage { + optional int32 field1 = 1 [default = 0]; + optional int32 field2 = 2 [default = 0]; + optional int32 field3 = 3 [default = 0]; + optional string field15 = 15; + optional bool field12 = 12 [default = true]; + optional int64 field13 = 13; + optional int64 field14 = 14; + optional int32 field16 = 16; + optional int32 field19 = 19 [default = 2]; + optional bool field20 = 20 [default = true]; + optional bool field28 = 28 [default = true]; + optional fixed64 field21 = 21; + optional int32 field22 = 22; + optional bool field23 = 23 [default = false]; + optional bool field206 = 206 [default = false]; + optional fixed32 field203 = 203; + optional int32 field204 = 204; + optional string field205 = 205; + optional uint64 field207 = 207; + optional uint64 field300 = 300; +} Binary files /tmp/tmpj7etzznp/eU58d9NyCB/protobuf-3.0.0/benchmarks/datasets/google_message1/proto2/dataset.google_message1_proto2.pb and /tmp/tmpj7etzznp/thzUZBtgHC/protobuf-3.6.1.3/benchmarks/datasets/google_message1/proto2/dataset.google_message1_proto2.pb differ diff -Nru protobuf-3.0.0/benchmarks/datasets/google_message1/proto3/benchmark_message1_proto3.proto protobuf-3.6.1.3/benchmarks/datasets/google_message1/proto3/benchmark_message1_proto3.proto --- protobuf-3.0.0/benchmarks/datasets/google_message1/proto3/benchmark_message1_proto3.proto 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/benchmarks/datasets/google_message1/proto3/benchmark_message1_proto3.proto 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,78 @@ +// Benchmark messages for proto3. + +syntax = "proto3"; + +package benchmarks.proto3; +option java_package = "com.google.protobuf.benchmarks"; + +// This is the default, but we specify it here explicitly. +option optimize_for = SPEED; + +option cc_enable_arenas = true; + +message GoogleMessage1 { + string field1 = 1; + string field9 = 9; + string field18 = 18; + bool field80 = 80; + bool field81 = 81; + int32 field2 = 2; + int32 field3 = 3; + int32 field280 = 280; + int32 field6 = 6; + int64 field22 = 22; + string field4 = 4; + repeated fixed64 field5 = 5; + bool field59 = 59; + string field7 = 7; + int32 field16 = 16; + int32 field130 = 130; + bool field12 = 12; + bool field17 = 17; + bool field13 = 13; + bool field14 = 14; + int32 field104 = 104; + int32 field100 = 100; + int32 field101 = 101; + string field102 = 102; + string field103 = 103; + int32 field29 = 29; + bool field30 = 30; + int32 field60 = 60; + int32 field271 = 271; + int32 field272 = 272; + int32 field150 = 150; + int32 field23 = 23; + bool field24 = 24; + int32 field25 = 25; + GoogleMessage1SubMessage field15 = 15; + bool field78 = 78; + int32 field67 = 67; + int32 field68 = 68; + int32 field128 = 128; + string field129 = 129; + int32 field131 = 131; +} + +message GoogleMessage1SubMessage { + int32 field1 = 1; + int32 field2 = 2; + int32 field3 = 3; + string field15 = 15; + bool field12 = 12; + int64 field13 = 13; + int64 field14 = 14; + int32 field16 = 16; + int32 field19 = 19; + bool field20 = 20; + bool field28 = 28; + fixed64 field21 = 21; + int32 field22 = 22; + bool field23 = 23; + bool field206 = 206; + fixed32 field203 = 203; + int32 field204 = 204; + string field205 = 205; + uint64 field207 = 207; + uint64 field300 = 300; +} Binary files /tmp/tmpj7etzznp/eU58d9NyCB/protobuf-3.0.0/benchmarks/datasets/google_message1/proto3/dataset.google_message1_proto3.pb and /tmp/tmpj7etzznp/thzUZBtgHC/protobuf-3.6.1.3/benchmarks/datasets/google_message1/proto3/dataset.google_message1_proto3.pb differ diff -Nru protobuf-3.0.0/benchmarks/datasets/google_message2/benchmark_message2.proto protobuf-3.6.1.3/benchmarks/datasets/google_message2/benchmark_message2.proto --- protobuf-3.0.0/benchmarks/datasets/google_message2/benchmark_message2.proto 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/benchmarks/datasets/google_message2/benchmark_message2.proto 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,76 @@ +// Benchmark messages for proto2. + +syntax = "proto2"; + +package benchmarks.proto2; +option java_package = "com.google.protobuf.benchmarks"; + +// This is the default, but we specify it here explicitly. +option optimize_for = SPEED; + +option cc_enable_arenas = true; + +message GoogleMessage2 { + optional string field1 = 1; + optional int64 field3 = 3; + optional int64 field4 = 4; + optional int64 field30 = 30; + optional bool field75 = 75 [default = false]; + optional string field6 = 6; + optional bytes field2 = 2; + optional int32 field21 = 21 [default = 0]; + optional int32 field71 = 71; + optional float field25 = 25; + optional int32 field109 = 109 [default = 0]; + optional int32 field210 = 210 [default = 0]; + optional int32 field211 = 211 [default = 0]; + optional int32 field212 = 212 [default = 0]; + optional int32 field213 = 213 [default = 0]; + optional int32 field216 = 216 [default = 0]; + optional int32 field217 = 217 [default = 0]; + optional int32 field218 = 218 [default = 0]; + optional int32 field220 = 220 [default = 0]; + optional int32 field221 = 221 [default = 0]; + optional float field222 = 222 [default = 0.0]; + optional int32 field63 = 63; + + repeated group Group1 = 10 { + required float field11 = 11; + optional float field26 = 26; + optional string field12 = 12; + optional string field13 = 13; + repeated string field14 = 14; + required uint64 field15 = 15; + optional int32 field5 = 5; + optional string field27 = 27; + optional int32 field28 = 28; + optional string field29 = 29; + optional string field16 = 16; + repeated string field22 = 22; + repeated int32 field73 = 73; + optional int32 field20 = 20 [default = 0]; + optional string field24 = 24; + optional GoogleMessage2GroupedMessage field31 = 31; + } + repeated string field128 = 128; + optional int64 field131 = 131; + repeated string field127 = 127; + optional int32 field129 = 129; + repeated int64 field130 = 130; + optional bool field205 = 205 [default = false]; + optional bool field206 = 206 [default = false]; +} + +message GoogleMessage2GroupedMessage { + optional float field1 = 1; + optional float field2 = 2; + optional float field3 = 3 [default = 0.0]; + optional bool field4 = 4; + optional bool field5 = 5; + optional bool field6 = 6 [default = true]; + optional bool field7 = 7 [default = false]; + optional float field8 = 8; + optional bool field9 = 9; + optional float field10 = 10; + optional int64 field11 = 11; +} Binary files /tmp/tmpj7etzznp/eU58d9NyCB/protobuf-3.0.0/benchmarks/datasets/google_message2/dataset.google_message2.pb and /tmp/tmpj7etzznp/thzUZBtgHC/protobuf-3.6.1.3/benchmarks/datasets/google_message2/dataset.google_message2.pb differ diff -Nru protobuf-3.0.0/benchmarks/datasets/google_message3/benchmark_message3_1.proto protobuf-3.6.1.3/benchmarks/datasets/google_message3/benchmark_message3_1.proto --- protobuf-3.0.0/benchmarks/datasets/google_message3/benchmark_message3_1.proto 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/benchmarks/datasets/google_message3/benchmark_message3_1.proto 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,1280 @@ +syntax = "proto2"; + +import "datasets/google_message3/benchmark_message3_2.proto"; +import "datasets/google_message3/benchmark_message3_3.proto"; +import "datasets/google_message3/benchmark_message3_5.proto"; +import "datasets/google_message3/benchmark_message3_7.proto"; +import "datasets/google_message3/benchmark_message3_8.proto"; +package benchmarks.google_message3; + +option cc_enable_arenas = true; +option java_package = "com.google.protobuf.benchmarks"; + +message Message34390 { + repeated .benchmarks.google_message3.Message34387 field34452 = 1; + extend .benchmarks.google_message3.Message0 { + optional .benchmarks.google_message3.Message34390 field34453 = 92144610; + } +} + +message Message34624 { + optional .benchmarks.google_message3.Message34621 field34683 = 1; + optional .benchmarks.google_message3.Message34621 field34684 = 2; + extend .benchmarks.google_message3.Message0 { + optional .benchmarks.google_message3.Message34624 field34685 = 18178548; + } +} + +message Message34791 { + optional fixed64 field34793 = 1; + repeated group Message34792 = 2 { + required string field34808 = 3; + optional string field34809 = 4; + } + optional int32 field34795 = 5; + optional int32 field34796 = 6; + optional int32 field34797 = 7; + optional int32 field34798 = 8; + optional int32 field34799 = 9; + optional int32 field34800 = 10; + optional bool field34801 = 11; + optional float field34802 = 12; + optional int32 field34803 = 13; + optional string field34804 = 14; + optional int64 field34805 = 15; + repeated fixed64 field34806 = 17 [packed = true]; + extend .benchmarks.google_message3.Message0 { + optional .benchmarks.google_message3.Message34791 field34807 = 6330340; + } +} + +message Message35483 { + optional int32 field35499 = 1; + optional string field35500 = 2; + optional string field35501 = 3; + optional string field35502 = 4; + repeated .benchmarks.google_message3.Message35476 field35503 = 5; + optional .benchmarks.google_message3.UnusedEmptyMessage field35504 = 6; + extend .benchmarks.google_message3.Message0 { + optional .benchmarks.google_message3.Message35483 field35505 = 7913554; + } +} + +message Message35807 { + optional int32 field35810 = 1; + optional int32 field35811 = 2; + optional int32 field35812 = 3; + optional int32 field35813 = 4; + optional int32 field35814 = 5; + optional int32 field35815 = 6; + optional int32 field35816 = 7; + optional int32 field35817 = 8; + extend .benchmarks.google_message3.Message0 { + optional .benchmarks.google_message3.Message35807 field35818 = 3803299; + } +} + +message Message37487 { + optional bytes field37501 = 2; + optional bool field37502 = 3; +} + +message Message13062 { + optional int64 field13075 = 1; + optional string field13076 = 2; + optional int32 field13077 = 3; + optional string field13078 = 4; + optional int32 field13079 = 5; +} + +message Message952 { + repeated .benchmarks.google_message3.Message949 field963 = 1; +} + +message Message36876 { + optional .benchmarks.google_message3.Message2356 field36980 = 1; + repeated group Message36877 = 111 { + required string field37044 = 112; + optional int32 field37045 = 113; + optional bytes field37046 = 114; + optional int32 field37047 = 115; + optional int32 field37048 = 157; + } + repeated group Message36878 = 168 { + } + repeated group Message36879 = 55 { + required string field37050 = 56; + optional int32 field37051 = 69; + } + repeated .benchmarks.google_message3.UnusedEmptyMessage field36984 = 78; + optional group Message36880 = 137 { + } + optional uint64 field36986 = 59; + optional bytes field36987 = 121; + optional .benchmarks.google_message3.UnusedEmptyMessage field36988 = 2; + optional .benchmarks.google_message3.Message7029 field36989 = 118; + optional .benchmarks.google_message3.Message35573 field36990 = 11; + optional .benchmarks.google_message3.UnusedEmptyMessage field36991 = 21; + optional .benchmarks.google_message3.UnusedEmptyMessage field36992 = 22; + optional float field36993 = 13; + optional int32 field36994 = 20; + optional bool field36995 = 51; + optional bool field36996 = 57; + repeated .benchmarks.google_message3.UnusedEmptyMessage field36997 = 100; + optional int32 field36998 = 47; + optional int32 field36999 = 48; + optional .benchmarks.google_message3.UnusedEmptyMessage field37000 = 68; + repeated group Message36881 = 23 { + } + optional .benchmarks.google_message3.Message4144 field37002 = 125; + repeated group Message36882 = 35 { + } + optional .benchmarks.google_message3.UnusedEmptyMessage field37004 = 49; + optional .benchmarks.google_message3.Message18921 field37005 = 52; + optional .benchmarks.google_message3.Message36858 field37006 = 46; + optional .benchmarks.google_message3.Message18831 field37007 = 54; + optional .benchmarks.google_message3.UnusedEmptyMessage field37008 = 58; + optional .benchmarks.google_message3.Message18283 field37009 = 10; + optional string field37010 = 44; + optional string field37011 = 103; + optional .benchmarks.google_message3.Message0 field37012 = 43; + optional .benchmarks.google_message3.Message0 field37013 = 143; + optional .benchmarks.google_message3.UnusedEmptyMessage field37014 = 53; + optional .benchmarks.google_message3.Message36869 field37015 = 15; + optional group Message36883 = 3 { + } + repeated group Message36884 = 16 { + } + repeated group Message36885 = 27 { + } + optional group Message36886 = 32 { + } + repeated .benchmarks.google_message3.UnusedEnum field37020 = 71; + repeated int32 field37021 = 70; + optional .benchmarks.google_message3.UnusedEmptyMessage field37022 = 66; + optional .benchmarks.google_message3.Message13090 field37023 = 67; + optional group Message36887 = 62 { + } + repeated .benchmarks.google_message3.Message10155 field37025 = 50; + repeated .benchmarks.google_message3.Message11874 field37026 = 151; + optional string field37027 = 12; + optional int64 field37028 = 72; + optional .benchmarks.google_message3.UnusedEmptyMessage field37029 = 73; + optional .benchmarks.google_message3.Message35546 field37030 = 108; + optional group Message36888 = 74 { + optional uint64 field37089 = 75; + optional bool field37090 = 76; + optional uint64 field37091 = 165; + optional double field37092 = 166; + optional uint64 field37093 = 109; + optional bytes field37094 = 122; + } + repeated .benchmarks.google_message3.Message19255 field37032 = 104; + optional .benchmarks.google_message3.Message33968 field37033 = 105; + optional bool field37034 = 106; + repeated .benchmarks.google_message3.UnusedEmptyMessage field37035 = 107; + optional .benchmarks.google_message3.Message6644 field37036 = 110; + optional bytes field37037 = 133; + optional group Message36889 = 116 { + optional int64 field37095 = 117; + optional string field37096 = 145; + optional int32 field37097 = 123; + optional bool field37098 = 163; + optional int32 field37099 = 164; + optional int32 field37100 = 149; + optional .benchmarks.google_message3.UnusedEmptyMessage field37101 = 129; + optional .benchmarks.google_message3.Message13174 field37102 = 124; + optional .benchmarks.google_message3.Message13169 field37103 = 128; + optional uint64 field37104 = 132; + repeated .benchmarks.google_message3.Enum36890 field37105 = 131; + optional bool field37106 = 134; + optional bool field37107 = 140; + optional .benchmarks.google_message3.UnusedEmptyMessage field37108 = 135; + optional float field37109 = 136; + optional float field37110 = 156; + optional bool field37111 = 142; + optional int64 field37112 = 167; + optional .benchmarks.google_message3.UnusedEmptyMessage field37113 = 146; + optional bool field37114 = 148; + optional .benchmarks.google_message3.UnusedEmptyMessage field37115 = 154; + optional .benchmarks.google_message3.UnusedEnum field37116 = 158; + repeated .benchmarks.google_message3.UnusedEnum field37117 = 159; + optional int32 field37118 = 160; + repeated string field37119 = 161; + } + repeated group Message36910 = 119 { + } + optional group Message36911 = 126 { + optional .benchmarks.google_message3.UnusedEmptyMessage field37121 = 127; + optional .benchmarks.google_message3.Message35538 field37122 = 130; + optional .benchmarks.google_message3.Message35540 field37123 = 144; + optional .benchmarks.google_message3.Message35542 field37124 = 150; + } + optional group Message36912 = 152 { + optional .benchmarks.google_message3.Message3901 field37125 = 153; + optional .benchmarks.google_message3.Message3901 field37126 = 162; + } + optional .benchmarks.google_message3.UnusedEmptyMessage field37042 = 155; +} + +message Message1328 { +} + +message Message6850 { +} + +message Message6863 { + optional .benchmarks.google_message3.Enum6858 field6931 = 1; + optional .benchmarks.google_message3.Enum6858 field6932 = 2; + optional .benchmarks.google_message3.UnusedEnum field6933 = 36; + optional bool field6934 = 27; + optional .benchmarks.google_message3.Message6773 field6935 = 26; + optional int32 field6936 = 30; + optional int32 field6937 = 37; + optional .benchmarks.google_message3.Enum6815 field6938 = 31; + optional string field6939 = 3; + optional int32 field6940 = 4; + optional .benchmarks.google_message3.Enum6822 field6941 = 15; + optional bool field6942 = 10; + optional bool field6943 = 17; + optional float field6944 = 18; + optional float field6945 = 19; + optional int32 field6946 = 5; + optional int32 field6947 = 6; + optional bool field6948 = 7; + optional int32 field6949 = 12; + optional .benchmarks.google_message3.UnusedEmptyMessage field6950 = 8; + optional uint64 field6951 = 9; + optional string field6952 = 11; + optional bytes field6953 = 13; + optional int32 field6954 = 14; + optional .benchmarks.google_message3.UnusedEmptyMessage field6955 = 16; + optional .benchmarks.google_message3.UnusedEmptyMessage field6956 = 22; + optional .benchmarks.google_message3.Message3886 field6957 = 38; + optional string field6958 = 20; + optional uint32 field6959 = 21; + optional .benchmarks.google_message3.Message6743 field6960 = 23; + optional .benchmarks.google_message3.UnusedEmptyMessage field6961 = 29; + optional .benchmarks.google_message3.UnusedEmptyMessage field6962 = 33; + optional bool field6963 = 34; +} + +message Message6871 { +} + +message Message7547 { + required bytes field7549 = 1; + required int32 field7550 = 2; +} + +message Message7648 { + optional string field7669 = 1; + optional int32 field7670 = 2; + optional int32 field7671 = 3; + optional int32 field7672 = 4; + optional int32 field7673 = 5; + optional int32 field7674 = 6; + optional float field7675 = 7; + optional bool field7676 = 8; + optional bool field7677 = 9; + optional bool field7678 = 10; + optional bool field7679 = 11; + optional bool field7680 = 12; +} + +message Message7865 { +} + +message Message7928 { + optional string field7940 = 1; + optional int64 field7941 = 2; +} + +message Message7919 { + optional fixed64 field7931 = 1; + optional int64 field7932 = 2; + optional bytes field7933 = 3; +} + +message Message7920 { + optional int64 field7934 = 1; + optional int64 field7935 = 2; +} + +message Message7921 { + optional int32 field7936 = 1; + optional int64 field7937 = 2; + optional float field7938 = 3; + optional .benchmarks.google_message3.UnusedEnum field7939 = 4; +} + +message Message8511 { + optional .benchmarks.google_message3.Message8224 field8539 = 1; + optional string field8540 = 2; + optional bool field8541 = 3; + optional int64 field8542 = 4; + optional string field8543 = 5; +} + +message Message8512 { + optional .benchmarks.google_message3.Message8301 field8544 = 1; + optional .benchmarks.google_message3.Message8302 field8545 = 2; + optional string field8546 = 3; + optional bool field8547 = 4; + optional int64 field8548 = 5; + optional string field8549 = 6; +} + +message Message8513 { + repeated .benchmarks.google_message3.Message8392 field8550 = 1; + optional string field8551 = 2; + optional bool field8552 = 3; + optional string field8553 = 4; +} + +message Message8514 { + optional string field8554 = 1; + optional int64 field8555 = 2; + optional bool field8556 = 3; + repeated .benchmarks.google_message3.Message8130 field8557 = 4; + optional string field8558 = 5; +} + +message Message8515 { + optional .benchmarks.google_message3.Message8479 field8559 = 1; + optional .benchmarks.google_message3.Message8478 field8560 = 2; + optional string field8561 = 3; +} + +message Message10320 { + optional .benchmarks.google_message3.Enum10335 field10347 = 1; + repeated .benchmarks.google_message3.Message10319 field10348 = 2; + optional int32 field10349 = 3; + optional int32 field10350 = 4; + optional int32 field10351 = 5; + optional int32 field10352 = 6; + optional .benchmarks.google_message3.Enum10337 field10353 = 7; +} + +message Message10321 { + optional int32 field10354 = 1; + optional int32 field10355 = 2; + optional uint64 field10356 = 3; +} + +message Message10322 { + optional .benchmarks.google_message3.Message4016 field10357 = 1; + optional bool field10358 = 2; + optional bool field10359 = 3; +} + +message Message11988 { + optional string field12021 = 1; + optional string field12022 = 2; + optional .benchmarks.google_message3.UnusedEmptyMessage field12023 = 3; + optional .benchmarks.google_message3.Message10155 field12024 = 4; +} + +message Message12668 { + repeated .benchmarks.google_message3.Message12669 field12677 = 1; + optional int32 field12678 = 2; + optional int32 field12679 = 3; + optional int32 field12680 = 4; +} + +message Message12825 { + repeated .benchmarks.google_message3.Message12818 field12862 = 1; + optional int32 field12863 = 2; + optional .benchmarks.google_message3.Message12819 field12864 = 3; + optional .benchmarks.google_message3.Message12820 field12865 = 4; + optional int32 field12866 = 5; + repeated .benchmarks.google_message3.Message12821 field12867 = 6; + repeated .benchmarks.google_message3.UnusedEmptyMessage field12868 = 7; +} + +message Message16478 { + repeated .benchmarks.google_message3.Message16479 field16481 = 1; + optional bool field16482 = 3; + optional int32 field16483 = 2; +} + +message Message16552 { + optional fixed64 field16565 = 1; + optional int32 field16566 = 2; + optional .benchmarks.google_message3.Enum16553 field16567 = 3; +} + +message Message16660 { + optional string field16668 = 1; + optional string field16669 = 2; + optional int32 field16670 = 3; +} + +message Message16727 { + required .benchmarks.google_message3.Enum16728 field16782 = 1; + required string field16783 = 2; + optional string field16784 = 3; + optional int32 field16785 = 23; + required string field16786 = 4; + optional string field16787 = 5; + optional string field16788 = 6; + required .benchmarks.google_message3.Enum16732 field16789 = 7; + optional string field16790 = 8; + optional string field16791 = 9; + optional string field16792 = 10; + optional .benchmarks.google_message3.Enum16738 field16793 = 11; + optional int32 field16794 = 12; + repeated .benchmarks.google_message3.Message16722 field16795 = 13; + optional bool field16796 = 19; + optional bool field16797 = 24; + optional string field16798 = 14; + optional int64 field16799 = 15; + optional bool field16800 = 16; + optional string field16801 = 17; + optional .benchmarks.google_message3.Enum16698 field16802 = 18; + optional .benchmarks.google_message3.Message16724 field16803 = 20; + optional bool field16804 = 22; + optional .benchmarks.google_message3.UnusedEmptyMessage field16805 = 25; + extensions 1000 to 536870911; +} + +message Message16725 { + optional .benchmarks.google_message3.Enum16728 field16774 = 1; + repeated string field16775 = 2; +} + +message Message17726 { + optional string field17801 = 1; + repeated string field17802 = 2; + optional string field17803 = 3; + repeated string field17804 = 4; + optional string field17805 = 5; + repeated string field17806 = 6; + optional string field17807 = 7; + optional string field17808 = 8; + repeated string field17809 = 15; + repeated string field17810 = 16; + repeated string field17811 = 17; + repeated .benchmarks.google_message3.UnusedEmptyMessage field17812 = 18; + optional string field17813 = 9; + optional string field17814 = 10; + optional string field17815 = 11; + optional string field17816 = 12; + optional string field17817 = 13; + optional string field17818 = 14; + optional string field17819 = 19; + repeated .benchmarks.google_message3.Message17728 field17820 = 20; + repeated .benchmarks.google_message3.Message17728 field17821 = 21; + repeated .benchmarks.google_message3.UnusedEmptyMessage field17822 = 30; +} + +message Message17782 { + optional string field18153 = 1; + optional string field18154 = 2; +} + +message Message17783 { + optional string field18155 = 1; + optional string field18156 = 2; + optional string field18157 = 3; + repeated group Message17784 = 4 { + optional string field18162 = 5; + optional string field18163 = 6; + optional string field18164 = 7; + repeated string field18165 = 8; + optional string field18166 = 17; + optional string field18167 = 18; + } + repeated group Message17785 = 9 { + optional string field18168 = 10; + optional string field18169 = 11; + optional .benchmarks.google_message3.Message17783 field18170 = 12; + optional string field18171 = 13; + optional string field18172 = 14; + repeated string field18173 = 15; + } + repeated string field18160 = 16; +} + +message Message16945 { + optional string field16946 = 1; + optional string field16947 = 2; + optional string field16948 = 3; + optional string field16949 = 4; + optional string field16950 = 5; + optional .benchmarks.google_message3.UnusedEmptyMessage field16951 = 872; + repeated .benchmarks.google_message3.Message0 field16952 = 16; + repeated .benchmarks.google_message3.UnusedEmptyMessage field16953 = 54; + repeated .benchmarks.google_message3.Message0 field16954 = 55; + repeated string field16955 = 58; + repeated string field16956 = 59; + repeated string field16957 = 62; + repeated string field16958 = 37; + repeated string field16959 = 18; + repeated .benchmarks.google_message3.UnusedEmptyMessage field16960 = 38; + repeated .benchmarks.google_message3.Message0 field16961 = 67; + repeated .benchmarks.google_message3.Message0 field16962 = 130; + repeated .benchmarks.google_message3.UnusedEmptyMessage field16963 = 136; + repeated string field16964 = 138; + repeated .benchmarks.google_message3.UnusedEmptyMessage field16965 = 156; + repeated string field16966 = 139; + repeated .benchmarks.google_message3.UnusedEmptyMessage field16967 = 126; + repeated string field16968 = 152; + repeated .benchmarks.google_message3.Message0 field16969 = 183; + repeated string field16970 = 168; + repeated string field16971 = 212; + repeated string field16972 = 213; + repeated .benchmarks.google_message3.UnusedEmptyMessage field16973 = 189; + repeated .benchmarks.google_message3.UnusedEmptyMessage field16974 = 190; + repeated string field16975 = 191; + repeated string field16976 = 192; + repeated .benchmarks.google_message3.Message0 field16977 = 193; + repeated .benchmarks.google_message3.UnusedEmptyMessage field16978 = 194; + repeated .benchmarks.google_message3.UnusedEmptyMessage field16979 = 195; + repeated int32 field16980 = 196; + repeated .benchmarks.google_message3.UnusedEmptyMessage field16981 = 95; + repeated string field16982 = 96; + repeated .benchmarks.google_message3.UnusedEmptyMessage field16983 = 97; + repeated string field16984 = 1086; + repeated .benchmarks.google_message3.UnusedEmptyMessage field16985 = 98; + repeated string field16986 = 99; + repeated string field16987 = 100; + repeated string field16988 = 48; + optional string field16989 = 22; + repeated .benchmarks.google_message3.UnusedEmptyMessage field16990 = 51; + repeated string field16991 = 81; + repeated string field16992 = 85; + repeated string field16993 = 169; + optional .benchmarks.google_message3.UnusedEmptyMessage field16994 = 260; + optional int32 field16995 = 198; + optional int32 field16996 = 204; + optional string field16997 = 1087; + repeated string field16998 = 197; + repeated string field16999 = 206; + optional string field17000 = 211; + repeated string field17001 = 205; + repeated .benchmarks.google_message3.UnusedEmptyMessage field17002 = 68; + repeated .benchmarks.google_message3.UnusedEmptyMessage field17003 = 69; + repeated .benchmarks.google_message3.UnusedEmptyMessage field17004 = 70; + repeated .benchmarks.google_message3.UnusedEmptyMessage field17005 = 71; + repeated .benchmarks.google_message3.UnusedEmptyMessage field17006 = 72; + repeated .benchmarks.google_message3.UnusedEmptyMessage field17007 = 19; + repeated .benchmarks.google_message3.UnusedEmptyMessage field17008 = 24; + optional .benchmarks.google_message3.UnusedEmptyMessage field17009 = 23; + repeated .benchmarks.google_message3.Message0 field17010 = 131; + repeated string field17011 = 133; + repeated .benchmarks.google_message3.UnusedEmptyMessage field17012 = 142; + repeated string field17013 = 143; + repeated .benchmarks.google_message3.UnusedEmptyMessage field17014 = 153; + repeated .benchmarks.google_message3.Message0 field17015 = 170; + repeated string field17016 = 171; + repeated string field17017 = 172; + repeated string field17018 = 173; + repeated string field17019 = 174; + repeated string field17020 = 175; + repeated string field17021 = 186; + repeated string field17022 = 101; + repeated .benchmarks.google_message3.Message0 field17023 = 102; + repeated string field17024 = 274; + extensions 17 to 17; + extensions 21 to 21; + extensions 25 to 25; + extensions 27 to 27; + extensions 29 to 29; + extensions 30 to 30; + extensions 31 to 31; + extensions 32 to 32; + extensions 33 to 33; + extensions 34 to 34; + extensions 35 to 35; + extensions 36 to 36; + extensions 39 to 39; + extensions 40 to 40; + extensions 41 to 41; + extensions 42 to 42; + extensions 43 to 43; + extensions 44 to 44; + extensions 45 to 45; + extensions 46 to 46; + extensions 47 to 47; + extensions 49 to 49; + extensions 50 to 50; + extensions 52 to 52; + extensions 53 to 53; + extensions 56 to 56; + extensions 57 to 57; + extensions 60 to 60; + extensions 61 to 61; + extensions 63 to 63; + extensions 64 to 64; + extensions 65 to 65; + extensions 66 to 66; + extensions 73 to 73; + extensions 74 to 74; + extensions 75 to 75; + extensions 76 to 76; + extensions 77 to 77; + extensions 78 to 78; + extensions 79 to 79; + extensions 80 to 80; + extensions 82 to 82; + extensions 83 to 83; + extensions 84 to 84; + extensions 86 to 86; + extensions 87 to 87; + extensions 88 to 88; + extensions 89 to 89; + extensions 90 to 90; + extensions 91 to 91; + extensions 92 to 92; + extensions 93 to 93; + extensions 94 to 94; + extensions 103 to 103; + extensions 104 to 104; + extensions 105 to 105; + extensions 106 to 106; + extensions 107 to 107; + extensions 108 to 108; + extensions 109 to 109; + extensions 110 to 110; + extensions 111 to 111; + extensions 112 to 112; + extensions 113 to 113; + extensions 114 to 114; + extensions 115 to 115; + extensions 116 to 116; + extensions 117 to 117; + extensions 118 to 118; + extensions 119 to 119; + extensions 120 to 120; + extensions 121 to 121; + extensions 122 to 122; + extensions 123 to 123; + extensions 124 to 124; + extensions 125 to 125; + extensions 127 to 127; + extensions 128 to 128; + extensions 129 to 129; + extensions 132 to 132; + extensions 134 to 134; + extensions 135 to 135; + extensions 137 to 137; + extensions 140 to 140; + extensions 141 to 141; + extensions 144 to 144; + extensions 145 to 145; + extensions 146 to 146; + extensions 147 to 147; + extensions 148 to 148; + extensions 149 to 149; + extensions 150 to 150; + extensions 151 to 151; + extensions 154 to 154; + extensions 155 to 155; + extensions 157 to 157; + extensions 158 to 158; + extensions 159 to 159; + extensions 160 to 160; + extensions 161 to 161; + extensions 162 to 162; + extensions 163 to 163; + extensions 164 to 164; + extensions 165 to 165; + extensions 166 to 166; + extensions 167 to 167; + extensions 176 to 176; + extensions 177 to 177; + extensions 178 to 178; + extensions 179 to 179; + extensions 180 to 180; + extensions 181 to 181; + extensions 182 to 182; + extensions 184 to 184; + extensions 185 to 185; + extensions 187 to 187; + extensions 188 to 188; + extensions 199 to 199; + extensions 200 to 200; + extensions 201 to 201; + extensions 202 to 202; + extensions 203 to 203; + extensions 207 to 207; + extensions 208 to 208; + extensions 209 to 209; + extensions 210 to 210; + extensions 214 to 214; + extensions 215 to 215; + extensions 216 to 216; + extensions 217 to 217; + extensions 218 to 218; + extensions 219 to 219; + extensions 220 to 220; + extensions 221 to 221; + extensions 222 to 222; + extensions 223 to 223; + extensions 224 to 224; + extensions 225 to 225; + extensions 226 to 226; + extensions 227 to 227; + extensions 228 to 228; + extensions 229 to 229; + extensions 230 to 230; + extensions 231 to 231; + extensions 232 to 232; + extensions 233 to 233; + extensions 234 to 234; + extensions 235 to 235; + extensions 236 to 236; + extensions 237 to 237; + extensions 238 to 238; + extensions 239 to 239; + extensions 240 to 240; + extensions 241 to 241; + extensions 242 to 242; + extensions 243 to 243; + extensions 244 to 244; + extensions 245 to 245; + extensions 246 to 246; + extensions 247 to 247; + extensions 248 to 248; + extensions 249 to 249; + extensions 250 to 250; + extensions 251 to 251; + extensions 252 to 252; + extensions 253 to 253; + extensions 254 to 254; + extensions 255 to 255; + extensions 256 to 256; + extensions 257 to 257; + extensions 258 to 258; + extensions 259 to 259; + extensions 261 to 261; + extensions 262 to 262; + extensions 263 to 263; + extensions 264 to 264; + extensions 265 to 265; + extensions 266 to 266; + extensions 267 to 267; + extensions 268 to 268; + extensions 269 to 269; + extensions 270 to 270; + extensions 271 to 271; + extensions 272 to 272; + extensions 273 to 273; + extensions 275 to 275; + extensions 276 to 276; + extensions 277 to 277; + extensions 278 to 278; + extensions 279 to 279; + extensions 280 to 280; + extensions 281 to 281; + extensions 282 to 282; + extensions 283 to 283; + extensions 284 to 284; + extensions 285 to 285; + extensions 286 to 286; + extensions 290 to 290; + extensions 291 to 291; + extensions 292 to 292; + extensions 293 to 293; + extensions 294 to 294; + extensions 295 to 295; + extensions 296 to 296; + extensions 297 to 297; + extensions 298 to 298; + extensions 299 to 299; + extensions 300 to 300; + extensions 301 to 301; + extensions 302 to 302; + extensions 303 to 303; + extensions 304 to 304; + extensions 305 to 305; + extensions 306 to 306; + extensions 307 to 307; + extensions 308 to 308; + extensions 309 to 309; + extensions 310 to 310; + extensions 311 to 311; + extensions 312 to 312; + extensions 313 to 313; + extensions 314 to 314; + extensions 315 to 315; + extensions 316 to 316; + extensions 317 to 317; + extensions 318 to 318; + extensions 319 to 319; + extensions 320 to 320; + extensions 321 to 321; + extensions 322 to 322; + extensions 323 to 323; + extensions 324 to 324; + extensions 325 to 325; + extensions 326 to 326; + extensions 327 to 327; + extensions 328 to 328; + extensions 329 to 329; + extensions 330 to 330; + extensions 331 to 331; + extensions 332 to 332; + extensions 333 to 333; + extensions 334 to 334; + extensions 335 to 335; + extensions 336 to 336; + extensions 337 to 337; + extensions 338 to 338; + extensions 339 to 339; + extensions 340 to 340; + extensions 341 to 341; + extensions 342 to 342; + extensions 343 to 343; + extensions 344 to 344; + extensions 345 to 345; + extensions 346 to 346; + extensions 347 to 347; + extensions 348 to 348; + extensions 349 to 349; + extensions 350 to 350; + extensions 351 to 351; + extensions 352 to 352; + extensions 353 to 353; + extensions 354 to 354; + extensions 355 to 355; + extensions 356 to 356; + extensions 357 to 357; + extensions 358 to 358; + extensions 359 to 359; + extensions 360 to 360; + extensions 361 to 361; + extensions 362 to 362; + extensions 363 to 363; + extensions 364 to 364; + extensions 365 to 365; + extensions 366 to 366; + extensions 367 to 367; + extensions 368 to 368; + extensions 369 to 369; + extensions 370 to 370; + extensions 371 to 371; + extensions 372 to 372; + extensions 373 to 373; + extensions 374 to 374; + extensions 375 to 375; + extensions 376 to 376; + extensions 377 to 377; + extensions 378 to 378; + extensions 379 to 379; + extensions 380 to 380; + extensions 381 to 381; + extensions 382 to 382; + extensions 383 to 383; + extensions 384 to 384; + extensions 385 to 385; + extensions 386 to 386; + extensions 387 to 387; + extensions 388 to 388; + extensions 389 to 389; + extensions 390 to 390; + extensions 391 to 391; + extensions 392 to 392; + extensions 393 to 393; + extensions 394 to 394; + extensions 395 to 395; + extensions 396 to 396; + extensions 397 to 397; + extensions 398 to 398; + extensions 399 to 399; + extensions 400 to 400; + extensions 401 to 401; + extensions 402 to 402; + extensions 403 to 403; + extensions 404 to 404; + extensions 405 to 405; + extensions 406 to 406; + extensions 407 to 407; + extensions 408 to 408; + extensions 409 to 409; + extensions 410 to 410; + extensions 411 to 411; + extensions 412 to 412; + extensions 413 to 413; + extensions 414 to 414; + extensions 415 to 415; + extensions 416 to 416; + extensions 417 to 417; + extensions 418 to 418; + extensions 419 to 419; + extensions 420 to 420; + extensions 421 to 421; + extensions 422 to 422; + extensions 423 to 423; + extensions 424 to 424; + extensions 425 to 425; + extensions 426 to 426; + extensions 427 to 427; + extensions 428 to 428; + extensions 429 to 429; + extensions 430 to 430; + extensions 431 to 431; + extensions 432 to 432; + extensions 433 to 433; + extensions 434 to 434; + extensions 435 to 435; + extensions 436 to 436; + extensions 437 to 437; + extensions 438 to 438; + extensions 439 to 439; + extensions 440 to 440; + extensions 441 to 441; + extensions 442 to 442; + extensions 443 to 443; + extensions 444 to 444; + extensions 445 to 445; + extensions 446 to 446; + extensions 447 to 447; + extensions 448 to 448; + extensions 449 to 449; + extensions 450 to 450; + extensions 451 to 451; + extensions 452 to 452; + extensions 453 to 453; + extensions 454 to 454; + extensions 455 to 455; + extensions 456 to 456; + extensions 457 to 457; + extensions 458 to 458; + extensions 459 to 459; + extensions 460 to 460; + extensions 461 to 461; + extensions 462 to 462; + extensions 463 to 463; + extensions 464 to 464; + extensions 465 to 465; + extensions 466 to 466; + extensions 467 to 467; + extensions 468 to 468; + extensions 469 to 469; + extensions 470 to 470; + extensions 471 to 471; + extensions 472 to 472; + extensions 473 to 473; + extensions 474 to 474; + extensions 509 to 509; + extensions 511 to 511; + extensions 512 to 512; + extensions 513 to 513; + extensions 514 to 514; + extensions 515 to 515; + extensions 516 to 516; + extensions 517 to 517; + extensions 518 to 518; + extensions 519 to 519; + extensions 520 to 520; + extensions 521 to 521; + extensions 522 to 522; + extensions 523 to 523; + extensions 524 to 524; + extensions 525 to 525; + extensions 526 to 526; + extensions 527 to 527; + extensions 528 to 528; + extensions 529 to 529; + extensions 530 to 530; + extensions 531 to 531; + extensions 532 to 532; + extensions 533 to 533; + extensions 534 to 534; + extensions 535 to 535; + extensions 536 to 536; + extensions 537 to 537; + extensions 538 to 538; + extensions 539 to 539; + extensions 540 to 540; + extensions 541 to 541; + extensions 542 to 542; + extensions 543 to 543; + extensions 544 to 544; + extensions 545 to 545; + extensions 546 to 546; + extensions 547 to 547; + extensions 548 to 548; + extensions 549 to 549; + extensions 550 to 550; + extensions 551 to 551; + extensions 552 to 552; + extensions 553 to 553; + extensions 554 to 554; + extensions 555 to 555; + extensions 556 to 556; + extensions 557 to 557; + extensions 558 to 558; + extensions 559 to 559; + extensions 560 to 560; + extensions 561 to 561; + extensions 562 to 562; + extensions 563 to 563; + extensions 564 to 564; + extensions 565 to 565; + extensions 566 to 566; + extensions 567 to 567; + extensions 568 to 568; + extensions 569 to 569; + extensions 570 to 570; + extensions 571 to 571; + extensions 572 to 572; + extensions 573 to 573; + extensions 574 to 574; + extensions 575 to 575; + extensions 576 to 576; + extensions 577 to 577; + extensions 578 to 578; + extensions 579 to 579; + extensions 580 to 580; + extensions 581 to 581; + extensions 582 to 582; + extensions 583 to 583; + extensions 584 to 584; + extensions 585 to 585; + extensions 586 to 586; + extensions 587 to 587; + extensions 588 to 588; + extensions 589 to 589; + extensions 590 to 590; + extensions 604 to 604; + extensions 605 to 605; + extensions 606 to 606; + extensions 607 to 607; + extensions 608 to 608; + extensions 609 to 609; + extensions 610 to 610; + extensions 611 to 611; + extensions 612 to 612; + extensions 613 to 613; + extensions 614 to 614; + extensions 615 to 615; + extensions 616 to 616; + extensions 617 to 617; + extensions 618 to 618; + extensions 619 to 619; + extensions 620 to 620; + extensions 621 to 621; + extensions 622 to 622; + extensions 623 to 623; + extensions 624 to 624; + extensions 625 to 625; + extensions 626 to 626; + extensions 627 to 627; + extensions 628 to 628; + extensions 629 to 629; + extensions 813 to 813; + extensions 814 to 814; + extensions 815 to 815; + extensions 816 to 816; + extensions 817 to 817; + extensions 818 to 818; + extensions 819 to 819; + extensions 820 to 820; + extensions 821 to 821; + extensions 822 to 822; + extensions 823 to 823; + extensions 824 to 824; + extensions 827 to 827; + extensions 828 to 828; + extensions 829 to 829; + extensions 830 to 830; + extensions 831 to 831; + extensions 832 to 832; + extensions 833 to 833; + extensions 834 to 834; + extensions 835 to 835; + extensions 836 to 836; + extensions 837 to 837; + extensions 838 to 838; + extensions 839 to 839; + extensions 840 to 840; + extensions 841 to 841; + extensions 842 to 842; + extensions 843 to 843; + extensions 844 to 844; + extensions 845 to 845; + extensions 846 to 846; + extensions 847 to 847; + extensions 848 to 848; + extensions 849 to 849; + extensions 850 to 850; + extensions 851 to 851; + extensions 852 to 852; + extensions 853 to 853; + extensions 854 to 854; + extensions 855 to 855; + extensions 856 to 856; + extensions 857 to 857; + extensions 858 to 858; + extensions 859 to 859; + extensions 860 to 860; + extensions 861 to 861; + extensions 862 to 862; + extensions 863 to 863; + extensions 864 to 864; + extensions 865 to 865; + extensions 866 to 866; + extensions 867 to 867; + extensions 868 to 868; + extensions 869 to 869; + extensions 870 to 870; + extensions 871 to 871; + extensions 880 to 880; + extensions 881 to 881; + extensions 882 to 882; + extensions 883 to 883; + extensions 884 to 884; + extensions 885 to 885; + extensions 886 to 886; + extensions 887 to 887; + extensions 888 to 888; + extensions 890 to 890; + extensions 891 to 891; + extensions 892 to 892; + extensions 912 to 912; + extensions 914 to 914; + extensions 915 to 915; + extensions 916 to 916; + extensions 917 to 917; + extensions 918 to 918; + extensions 919 to 919; + extensions 920 to 920; + extensions 921 to 921; + extensions 922 to 922; + extensions 923 to 923; + extensions 924 to 924; + extensions 925 to 925; + extensions 926 to 926; + extensions 927 to 927; + extensions 928 to 928; + extensions 929 to 929; + extensions 930 to 930; + extensions 931 to 931; + extensions 932 to 932; + extensions 933 to 933; + extensions 934 to 934; + extensions 935 to 935; + extensions 936 to 936; + extensions 937 to 937; + extensions 938 to 938; + extensions 939 to 939; + extensions 940 to 940; + extensions 941 to 941; + extensions 942 to 942; + extensions 943 to 943; + extensions 944 to 944; + extensions 945 to 945; + extensions 946 to 946; + extensions 947 to 947; + extensions 949 to 949; + extensions 950 to 950; + extensions 951 to 951; + extensions 952 to 952; + extensions 954 to 954; + extensions 955 to 955; + extensions 956 to 956; + extensions 957 to 957; + extensions 958 to 958; + extensions 959 to 959; + extensions 960 to 960; + extensions 961 to 961; + extensions 962 to 962; + extensions 963 to 963; + extensions 964 to 964; + extensions 965 to 965; + extensions 966 to 966; + extensions 967 to 967; + extensions 968 to 968; + extensions 969 to 969; + extensions 970 to 970; + extensions 971 to 971; + extensions 972 to 972; + extensions 973 to 973; + extensions 974 to 974; + extensions 975 to 975; + extensions 976 to 976; + extensions 977 to 977; + extensions 978 to 978; + extensions 979 to 979; + extensions 980 to 980; + extensions 981 to 981; + extensions 982 to 982; + extensions 983 to 983; + extensions 984 to 984; + extensions 985 to 985; + extensions 987 to 987; + extensions 988 to 988; + extensions 1000 to 1000; + extensions 1001 to 1001; + extensions 1002 to 1002; + extensions 1003 to 1003; + extensions 1004 to 1004; + extensions 1005 to 1005; + extensions 1006 to 1006; + extensions 1007 to 1007; + extensions 1008 to 1008; + extensions 1009 to 1009; + extensions 1010 to 1010; + extensions 1011 to 1011; + extensions 1012 to 1012; + extensions 1013 to 1013; + extensions 1014 to 1014; + extensions 1015 to 1015; + extensions 1016 to 1016; + extensions 1017 to 1017; + extensions 1018 to 1018; + extensions 1019 to 1019; + extensions 1020 to 1020; + extensions 1021 to 1021; + extensions 1022 to 1022; + extensions 1023 to 1023; + extensions 1024 to 1024; + extensions 1025 to 1025; + extensions 1026 to 1026; + extensions 1027 to 1027; + extensions 1028 to 1028; + extensions 1029 to 1029; + extensions 1030 to 1030; + extensions 1031 to 1031; + extensions 1032 to 1032; + extensions 1033 to 1033; + extensions 1034 to 1034; + extensions 1035 to 1035; + extensions 1036 to 1036; + extensions 1037 to 1037; + extensions 1038 to 1038; + extensions 1039 to 1039; + extensions 1040 to 1040; + extensions 1041 to 1041; + extensions 1042 to 1042; + extensions 1043 to 1043; + extensions 1044 to 1044; + extensions 1045 to 1045; + extensions 1046 to 1046; + extensions 1047 to 1047; + extensions 1048 to 1048; + extensions 1049 to 1049; + extensions 1050 to 1050; + extensions 1051 to 1051; + extensions 1052 to 1052; + extensions 1053 to 1053; + extensions 1054 to 1054; + extensions 1055 to 1055; + extensions 1056 to 1056; + extensions 1057 to 1057; + extensions 1058 to 1058; + extensions 1079 to 1079; + extensions 1080 to 1080; + extensions 1081 to 1081; + extensions 1082 to 1082; + extensions 1083 to 1083; + extensions 1084 to 1084; + extensions 1085 to 1085; + extend .benchmarks.google_message3.Message0 { + optional .benchmarks.google_message3.Message16945 field17025 = 22068132; + } +} + diff -Nru protobuf-3.0.0/benchmarks/datasets/google_message3/benchmark_message3_2.proto protobuf-3.6.1.3/benchmarks/datasets/google_message3/benchmark_message3_2.proto --- protobuf-3.0.0/benchmarks/datasets/google_message3/benchmark_message3_2.proto 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/benchmarks/datasets/google_message3/benchmark_message3_2.proto 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,499 @@ +syntax = "proto2"; + +import "datasets/google_message3/benchmark_message3_3.proto"; +import "datasets/google_message3/benchmark_message3_4.proto"; +import "datasets/google_message3/benchmark_message3_5.proto"; +import "datasets/google_message3/benchmark_message3_7.proto"; +import "datasets/google_message3/benchmark_message3_8.proto"; +package benchmarks.google_message3; + +option cc_enable_arenas = true; +option java_package = "com.google.protobuf.benchmarks"; + +message Message22853 { + optional .benchmarks.google_message3.Enum22854 field22869 = 1; + repeated uint32 field22870 = 2 [packed = true]; + repeated float field22871 = 3 [packed = true]; + repeated float field22872 = 5 [packed = true]; + optional .benchmarks.google_message3.UnusedEmptyMessage field22873 = 4; +} + +message Message24345 { + optional string field24533 = 1; + optional .benchmarks.google_message3.UnusedEnum field24534 = 22; + optional .benchmarks.google_message3.Message24346 field24535 = 2; + optional string field24536 = 3; + optional string field24537 = 4; + optional .benchmarks.google_message3.UnusedEnum field24538 = 23; + optional string field24539 = 5; + required string field24540 = 6; + optional string field24541 = 7; + optional string field24542 = 8; + optional .benchmarks.google_message3.Message24316 field24543 = 9; + optional .benchmarks.google_message3.Message24376 field24544 = 10; + optional string field24545 = 11; + optional string field24546 = 19; + optional string field24547 = 20; + optional string field24548 = 21; + optional .benchmarks.google_message3.UnusedEmptyMessage field24549 = 12; + optional .benchmarks.google_message3.UnusedEmptyMessage field24550 = 13; + repeated string field24551 = 14; + optional string field24552 = 15; + optional int32 field24553 = 18; + optional .benchmarks.google_message3.Message24379 field24554 = 16; + optional string field24555 = 17; + repeated .benchmarks.google_message3.Message24356 field24556 = 24; + repeated .benchmarks.google_message3.Message24366 field24557 = 25; +} + +message Message24403 { + optional .benchmarks.google_message3.Message24401 field24681 = 1; + optional .benchmarks.google_message3.Message24402 field24682 = 2; +} + +message Message24391 { + optional string field24631 = 1; + optional string field24632 = 2; + repeated string field24633 = 3; + optional string field24634 = 4; + repeated string field24635 = 5; + repeated string field24636 = 16; + optional string field24637 = 17; + optional .benchmarks.google_message3.UnusedEmptyMessage field24638 = 25; + optional string field24639 = 7; + optional string field24640 = 18; + optional string field24641 = 19; + optional string field24642 = 20; + optional int32 field24643 = 24; + optional .benchmarks.google_message3.Message24379 field24644 = 8; + repeated .benchmarks.google_message3.UnusedEmptyMessage field24645 = 9; + optional .benchmarks.google_message3.UnusedEmptyMessage field24646 = 10; + optional .benchmarks.google_message3.UnusedEmptyMessage field24647 = 11; + optional .benchmarks.google_message3.UnusedEmptyMessage field24648 = 12; + repeated .benchmarks.google_message3.UnusedEmptyMessage field24649 = 13; + optional .benchmarks.google_message3.UnusedEmptyMessage field24650 = 14; + optional string field24651 = 21; + optional int32 field24652 = 22; + optional int32 field24653 = 23; + repeated string field24654 = 15; + repeated string field24655 = 6; +} + +message Message27454 { +} + +message Message27357 { + optional string field27410 = 1; + optional float field27411 = 2; + optional string field27412 = 3; + optional bool field27413 = 4; + optional bool field27414 = 5; +} + +message Message27360 { + optional .benchmarks.google_message3.Message27358 field27426 = 1; + optional .benchmarks.google_message3.Enum27361 field27427 = 2; + optional .benchmarks.google_message3.Message27358 field27428 = 3; + repeated .benchmarks.google_message3.UnusedEmptyMessage field27429 = 4; +} + +message Message34387 { + optional string field34446 = 1; + repeated .benchmarks.google_message3.Message34381 field34447 = 2; + optional .benchmarks.google_message3.UnusedEnum field34448 = 3; + optional .benchmarks.google_message3.Enum34388 field34449 = 4; + optional int64 field34450 = 5; +} + +message Message34621 { + optional double field34651 = 1; + optional double field34652 = 2; + optional double field34653 = 3; + optional double field34654 = 4; + optional double field34655 = 11; + optional .benchmarks.google_message3.UnusedEmptyMessage field34656 = 13; + optional .benchmarks.google_message3.Message34619 field34657 = 14; + optional string field34658 = 5; + optional string field34659 = 9; + optional double field34660 = 12; + optional bytes field34661 = 19; + optional string field34662 = 15; + optional string field34663 = 16; + optional string field34664 = 17; + optional .benchmarks.google_message3.UnusedEmptyMessage field34665 = 18; + optional .benchmarks.google_message3.Message34621 field34666 = 20; + repeated .benchmarks.google_message3.UnusedEmptyMessage field34667 = 100; + optional .benchmarks.google_message3.UnusedEmptyMessage field34668 = 101; + extend .benchmarks.google_message3.Message0 { + optional .benchmarks.google_message3.Message34621 field34669 = 17562023; + } +} + +message Message35476 { + optional string field35484 = 1; + optional string field35485 = 2; + optional string field35486 = 3; + optional .benchmarks.google_message3.Enum35477 field35487 = 4; + optional float field35488 = 5; + optional float field35489 = 6; + optional float field35490 = 7; + optional float field35491 = 8; + optional .benchmarks.google_message3.UnusedEmptyMessage field35492 = 9; + optional int32 field35493 = 10; + optional int32 field35494 = 11; + optional int32 field35495 = 12; + optional string field35496 = 13; + optional string field35497 = 14; +} + +message Message949 { + optional string field955 = 1; + optional int64 field956 = 2; + optional int64 field957 = 3; + optional .benchmarks.google_message3.Message730 field958 = 4; + repeated string field959 = 5; + optional string field960 = 6; + optional bool field961 = 7; +} + +message Message36869 { + optional int32 field36970 = 1; + optional int32 field36971 = 2; +} + +message Message33968 { + repeated group Message33969 = 1 { + } + repeated .benchmarks.google_message3.Message33958 field33989 = 3; + optional .benchmarks.google_message3.UnusedEmptyMessage field33990 = 106; + optional bool field33991 = 108; + optional .benchmarks.google_message3.UnusedEnum field33992 = 107; +} + +message Message6644 { + optional .benchmarks.google_message3.UnusedEmptyMessage field6701 = 8; + optional string field6702 = 1; + optional double field6703 = 2; + optional .benchmarks.google_message3.UnusedEmptyMessage field6704 = 9; + optional bytes field6705 = 3; + optional bytes field6706 = 19; + optional .benchmarks.google_message3.Message6637 field6707 = 4; + repeated .benchmarks.google_message3.Message6126 field6708 = 18; + optional bool field6709 = 6; + optional .benchmarks.google_message3.Message6643 field6710 = 10; + optional string field6711 = 12; + optional .benchmarks.google_message3.UnusedEmptyMessage field6712 = 14; + optional .benchmarks.google_message3.UnusedEmptyMessage field6713 = 15; + optional .benchmarks.google_message3.UnusedEmptyMessage field6714 = 16; + optional int32 field6715 = 17; + optional .benchmarks.google_message3.UnusedEmptyMessage field6716 = 20; +} + +message Message18831 { + repeated group Message18832 = 1 { + optional int32 field18836 = 2; + optional string field18837 = 5; + optional float field18838 = 3; + optional float field18839 = 9; + optional int32 field18840 = 11; + repeated uint64 field18841 = 4; + repeated group Message18833 = 6 { + required uint64 field18843 = 7; + optional string field18844 = 8; + optional float field18845 = 10; + optional int32 field18846 = 12; + optional bool field18847 = 13; + } + } +} + +message Message13090 { + optional .benchmarks.google_message3.Message13083 field13141 = 1; + optional .benchmarks.google_message3.Message13088 field13142 = 2; +} + +message Message11874 { + optional .benchmarks.google_message3.Message10391 field11888 = 3; + optional string field11889 = 4; + optional .benchmarks.google_message3.Message11873 field11890 = 6; + optional bool field11891 = 7; + extensions 1 to 1; + extensions 2 to 2; + extensions 5 to 5; +} + +message Message4144 { + repeated group Message4145 = 1 { + required .benchmarks.google_message3.Enum4146 field4165 = 2; + required int32 field4166 = 3; + optional .benchmarks.google_message3.Enum4160 field4167 = 9; + optional bytes field4168 = 4; + optional .benchmarks.google_message3.Enum4152 field4169 = 5; + optional string field4170 = 6; + } +} + +message Message35573 { + optional fixed64 field35695 = 16; + optional string field35696 = 1000; + optional string field35697 = 1004; + optional int32 field35698 = 1003; + repeated group Message35574 = 1012 { + } + optional int64 field35700 = 1011; + optional int64 field35701 = 1005; + optional int64 field35702 = 1006; + optional int64 field35703 = 1007; + optional int64 field35704 = 1008; + repeated group Message35575 = 1 { + optional int64 field35709 = 2; + optional string field35710 = 3; + optional string field35711 = 19; + optional int32 field35712 = 20; + optional int32 field35713 = 21; + optional int32 field35714 = 22; + optional bool field35715 = 23; + optional int32 field35716 = 47; + optional int32 field35717 = 48; + optional bool field35718 = 24; + optional fixed64 field35719 = 25; + optional bytes field35720 = 52; + optional int32 field35721 = 18; + optional fixed32 field35722 = 43; + optional bool field35723 = 26; + optional int32 field35724 = 27; + optional int32 field35725 = 17; + optional bool field35726 = 45; + repeated int32 field35727 = 33; + repeated int32 field35728 = 58; + optional float field35729 = 34; + optional float field35730 = 1009; + optional int32 field35731 = 28; + repeated fixed64 field35732 = 1001; + repeated fixed64 field35733 = 1002; + optional int32 field35734 = 44; + optional int32 field35735 = 50; + optional int32 field35736 = 36; + optional int32 field35737 = 40; + optional bool field35738 = 1016; + optional bool field35739 = 1010; + optional int32 field35740 = 37; + optional int32 field35741 = 38; + optional string field35742 = 46; + optional uint32 field35743 = 60; + repeated bytes field35744 = 56; + optional .benchmarks.google_message3.Message0 field35745 = 57; + required group Message35576 = 4 { + optional fixed64 field35747 = 5; + optional int32 field35748 = 6; + optional int32 field35749 = 49; + optional int32 field35750 = 7; + optional uint32 field35751 = 59; + optional int32 field35752 = 14; + optional int32 field35753 = 15; + optional int32 field35754 = 35; + optional bytes field35755 = 53; + optional int32 field35756 = 8; + optional string field35757 = 9; + optional fixed64 field35758 = 10; + optional int32 field35759 = 11; + optional int32 field35760 = 12; + optional int32 field35761 = 41; + optional int32 field35762 = 30; + optional int32 field35763 = 31; + optional int32 field35764 = 13; + optional bytes field35765 = 39; + optional string field35766 = 29; + optional int32 field35767 = 42; + repeated int32 field35768 = 32; + repeated int32 field35769 = 51; + optional int64 field35770 = 54; + optional .benchmarks.google_message3.Message0 field35771 = 55; + } + } +} + +message Message36858 { + repeated int32 field36956 = 1; + repeated string field36957 = 2; + repeated string field36958 = 12; + optional int32 field36959 = 3; + optional int32 field36960 = 4; + optional int32 field36961 = 14; + optional string field36962 = 11; + optional bool field36963 = 5; + optional bool field36964 = 13; + optional int64 field36965 = 6; + optional .benchmarks.google_message3.Message35506 field36966 = 7; + repeated group Message36859 = 8 { + required .benchmarks.google_message3.Enum36860 field36968 = 9; + optional float field36969 = 10; + } +} + +message Message13174 { + required int32 field13237 = 6; + optional int32 field13238 = 3; + required int32 field13239 = 4; + optional int32 field13240 = 8; + optional double field13241 = 5; + optional double field13242 = 7; + optional int32 field13243 = 17; + optional int32 field13244 = 19; + optional double field13245 = 20; + optional int32 field13246 = 9; + optional double field13247 = 10; + optional int32 field13248 = 11; + optional .benchmarks.google_message3.Message13151 field13249 = 21; + optional int32 field13250 = 1; + optional double field13251 = 2; + optional double field13252 = 15; + optional double field13253 = 16; + optional double field13254 = 12; + optional double field13255 = 13; + optional double field13256 = 14; + optional int32 field13257 = 18; +} + +message Message18283 { + optional .benchmarks.google_message3.UnusedEmptyMessage field18478 = 1; + optional int32 field18479 = 4; + optional int32 field18480 = 106; + optional int32 field18481 = 107; + optional int32 field18482 = 108; + optional int32 field18483 = 109; + optional int32 field18484 = 105; + optional int32 field18485 = 113; + optional int32 field18486 = 114; + optional int32 field18487 = 124; + optional int32 field18488 = 125; + optional int32 field18489 = 128; + optional int32 field18490 = 135; + optional bool field18491 = 166; + optional bool field18492 = 136; + optional int32 field18493 = 140; + optional int32 field18494 = 171; + optional int32 field18495 = 148; + optional int32 field18496 = 145; + optional float field18497 = 117; + optional int32 field18498 = 146; + optional string field18499 = 3; + optional .benchmarks.google_message3.UnusedEmptyMessage field18500 = 5; + optional .benchmarks.google_message3.UnusedEmptyMessage field18501 = 6; + optional .benchmarks.google_message3.UnusedEmptyMessage field18502 = 9; + optional .benchmarks.google_message3.Message18253 field18503 = 155; + optional .benchmarks.google_message3.UnusedEmptyMessage field18504 = 184; + optional .benchmarks.google_message3.UnusedEmptyMessage field18505 = 163; + optional .benchmarks.google_message3.UnusedEmptyMessage field18506 = 16; + repeated int32 field18507 = 20; + repeated int32 field18508 = 7; + repeated string field18509 = 194; + optional bytes field18510 = 30; + optional int32 field18511 = 31; + optional .benchmarks.google_message3.UnusedEmptyMessage field18512 = 178; + optional string field18513 = 8; + optional float field18514 = 2; + optional float field18515 = 100; + optional float field18516 = 101; + optional float field18517 = 102; + optional int32 field18518 = 103; + repeated .benchmarks.google_message3.UnusedEmptyMessage field18519 = 104; + optional int32 field18520 = 110; + optional int32 field18521 = 112; + optional .benchmarks.google_message3.UnusedEmptyMessage field18522 = 111; + optional .benchmarks.google_message3.UnusedEmptyMessage field18523 = 115; + optional .benchmarks.google_message3.UnusedEmptyMessage field18524 = 119; + optional .benchmarks.google_message3.UnusedEmptyMessage field18525 = 127; + optional .benchmarks.google_message3.UnusedEmptyMessage field18526 = 185; + optional int32 field18527 = 120; + optional int32 field18528 = 132; + optional .benchmarks.google_message3.UnusedEmptyMessage field18529 = 126; + optional .benchmarks.google_message3.UnusedEmptyMessage field18530 = 129; + optional .benchmarks.google_message3.UnusedEmptyMessage field18531 = 131; + optional fixed64 field18532 = 150; + optional int32 field18533 = 133; + optional int32 field18534 = 134; + optional int32 field18535 = 139; + optional fixed64 field18536 = 137; + optional fixed64 field18537 = 138; + optional .benchmarks.google_message3.UnusedEmptyMessage field18538 = 141; + optional int32 field18539 = 142; + optional int32 field18540 = 181; + optional .benchmarks.google_message3.Message16816 field18541 = 143; + optional .benchmarks.google_message3.Message16685 field18542 = 154; + optional int32 field18543 = 144; + optional int64 field18544 = 147; + optional int64 field18545 = 149; + optional int32 field18546 = 151; + optional int32 field18547 = 152; + optional int32 field18548 = 153; + optional float field18549 = 161; + optional .benchmarks.google_message3.Message0 field18550 = 123; + repeated int64 field18551 = 156; + optional int32 field18552 = 157; + repeated fixed64 field18553 = 188; + optional int32 field18554 = 158; + optional .benchmarks.google_message3.UnusedEmptyMessage field18555 = 159; + optional bool field18556 = 160; + optional uint64 field18557 = 162; + optional int32 field18558 = 164; + optional .benchmarks.google_message3.UnusedEmptyMessage field18559 = 10; + optional .benchmarks.google_message3.UnusedEmptyMessage field18560 = 167; + optional int32 field18561 = 168; + repeated fixed64 field18562 = 169; + repeated string field18563 = 170; + optional .benchmarks.google_message3.UnusedEmptyMessage field18564 = 172; + optional int64 field18565 = 173; + optional .benchmarks.google_message3.UnusedEmptyMessage field18566 = 174; + optional int64 field18567 = 175; + optional uint32 field18568 = 189; + optional .benchmarks.google_message3.UnusedEmptyMessage field18569 = 176; + optional .benchmarks.google_message3.UnusedEmptyMessage field18570 = 177; + optional uint32 field18571 = 179; + optional uint32 field18572 = 180; + optional .benchmarks.google_message3.UnusedEmptyMessage field18573 = 182; + optional .benchmarks.google_message3.UnusedEmptyMessage field18574 = 183; + optional .benchmarks.google_message3.UnusedEmptyMessage field18575 = 121; + optional .benchmarks.google_message3.UnusedEmptyMessage field18576 = 186; + optional .benchmarks.google_message3.UnusedEmptyMessage field18577 = 187; + optional .benchmarks.google_message3.UnusedEmptyMessage field18578 = 190; + optional int32 field18579 = 191; + optional float field18580 = 192; + optional bool field18581 = 193; + extensions 116 to 116; + extensions 118 to 118; + extensions 130 to 130; + extensions 165 to 165; +} + +message Message13169 { + repeated .benchmarks.google_message3.Message13168 field13223 = 1; + required .benchmarks.google_message3.Message13167 field13224 = 2; + optional string field13225 = 3; +} + +message Message19255 { + optional string field19257 = 1; +} + +message Message35542 { + optional bool field35543 = 1; + optional bool field35544 = 2; + optional bool field35545 = 3; +} + +message Message3901 { + optional int32 field3990 = 1; + optional int32 field3991 = 2; + optional int32 field3992 = 3; + optional int32 field3993 = 4; + optional int32 field3994 = 7; + optional int32 field3995 = 8; + optional int32 field3996 = 9; + optional int32 field3997 = 10; + optional int32 field3998 = 11; + optional int32 field3999 = 12; + optional .benchmarks.google_message3.UnusedEnum field4000 = 6; + optional int32 field4001 = 5; +} + diff -Nru protobuf-3.0.0/benchmarks/datasets/google_message3/benchmark_message3_3.proto protobuf-3.6.1.3/benchmarks/datasets/google_message3/benchmark_message3_3.proto --- protobuf-3.0.0/benchmarks/datasets/google_message3/benchmark_message3_3.proto 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/benchmarks/datasets/google_message3/benchmark_message3_3.proto 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,466 @@ +syntax = "proto2"; + +import "datasets/google_message3/benchmark_message3_4.proto"; +import "datasets/google_message3/benchmark_message3_5.proto"; +import "datasets/google_message3/benchmark_message3_7.proto"; +import "datasets/google_message3/benchmark_message3_8.proto"; +package benchmarks.google_message3; + +option cc_enable_arenas = true; +option java_package = "com.google.protobuf.benchmarks"; + +message Message35546 { + optional int64 field35556 = 1; + optional int32 field35557 = 2; + optional bool field35558 = 3; + optional int64 field35559 = 13; + optional group Message35547 = 4 { + required int32 field35569 = 5; + required int32 field35570 = 6; + } + optional group Message35548 = 10 { + required int64 field35571 = 11; + required int64 field35572 = 12; + } + optional bool field35562 = 14; + optional bool field35563 = 15; + optional int32 field35564 = 16; + optional bool field35565 = 17; + optional bool field35566 = 18; + optional string field35567 = 100; +} + +message Message2356 { + optional .benchmarks.google_message3.Message1374 field2368 = 121; + optional uint64 field2369 = 1; + optional int32 field2370 = 2; + optional int32 field2371 = 17; + required string field2372 = 3; + optional int32 field2373 = 7; + optional bytes field2374 = 8; + optional string field2375 = 4; + optional string field2376 = 101; + optional int32 field2377 = 102; + optional int32 field2378 = 103; + optional int32 field2379 = 104; + optional int32 field2380 = 113; + optional int32 field2381 = 114; + optional int32 field2382 = 115; + optional int32 field2383 = 117; + optional int32 field2384 = 118; + optional int32 field2385 = 119; + optional int32 field2386 = 105; + optional bytes field2387 = 5; + optional group Message2357 = 6 { + optional int64 field2399 = 9; + optional int32 field2400 = 10; + optional int32 field2401 = 11; + optional int32 field2402 = 12; + optional int32 field2403 = 13; + optional int32 field2404 = 116; + optional int32 field2405 = 106; + required bytes field2406 = 14; + optional int32 field2407 = 45; + optional int32 field2408 = 112; + optional bool field2409 = 122; + optional bytes field2410 = 124; + } + optional string field2389 = 120; + optional group Message2358 = 107 { + } + repeated group Message2359 = 40 { + optional string field2413 = 41; + optional string field2414 = 42; + optional string field2415 = 43; + optional string field2416 = 44; + optional int32 field2417 = 46; + optional string field2418 = 47; + optional float field2419 = 110; + optional float field2420 = 111; + } + optional int32 field2392 = 50; + optional .benchmarks.google_message3.UnusedEmptyMessage field2393 = 60; + optional .benchmarks.google_message3.UnusedEmptyMessage field2394 = 70; + optional .benchmarks.google_message3.UnusedEmptyMessage field2395 = 80; + optional .benchmarks.google_message3.UnusedEmptyMessage field2396 = 90; + optional string field2397 = 100; + optional string field2398 = 123; +} + +message Message7029 { + required int32 field7183 = 1; + optional int32 field7184 = 2; + optional int32 field7185 = 3; + optional int32 field7186 = 4; + optional int32 field7187 = 5; + optional int32 field7188 = 6; + optional int32 field7189 = 17; + optional int32 field7190 = 18; + optional int32 field7191 = 49; + optional int32 field7192 = 28; + optional int32 field7193 = 33; + optional int32 field7194 = 25; + optional int32 field7195 = 26; + optional int32 field7196 = 40; + optional int32 field7197 = 41; + optional int32 field7198 = 42; + optional int32 field7199 = 43; + optional int32 field7200 = 19; + optional int32 field7201 = 7; + optional int32 field7202 = 8; + optional int32 field7203 = 9; + optional int32 field7204 = 10; + optional int32 field7205 = 11; + optional int32 field7206 = 12; + repeated group Message7030 = 13 { + optional string field7226 = 14; + optional string field7227 = 15; + optional int64 field7228 = 16; + } + repeated group Message7031 = 21 { + optional string field7229 = 22; + optional int32 field7230 = 23; + optional int32 field7231 = 24; + optional int32 field7232 = 30; + optional int32 field7233 = 31; + optional int32 field7234 = 35; + } + optional int32 field7209 = 20; + optional float field7210 = 27; + optional int32 field7211 = 29; + optional int32 field7212 = 32; + optional string field7213 = 48; + optional bool field7214 = 34; + optional int32 field7215 = 36; + optional float field7216 = 37; + optional bool field7217 = 38; + optional bool field7218 = 39; + optional .benchmarks.google_message3.UnusedEmptyMessage field7219 = 44; + optional int32 field7220 = 45; + optional int32 field7221 = 46; + optional int32 field7222 = 47; + optional .benchmarks.google_message3.UnusedEmptyMessage field7223 = 50; + optional int32 field7224 = 51; +} + +message Message35538 { + required int64 field35539 = 1; +} + +message Message18921 { + optional string field18946 = 1; + optional fixed64 field18947 = 2; + optional int32 field18948 = 3; + optional double field18949 = 4; + optional bool field18950 = 17; + optional bool field18951 = 23; + optional .benchmarks.google_message3.UnusedEmptyMessage field18952 = 24; + repeated group Message18922 = 5 { + optional uint64 field18959 = 6; + optional string field18960 = 13; + optional bool field18961 = 21; + optional bool field18962 = 33; + optional int32 field18963 = 7; + optional int32 field18964 = 8; + optional string field18965 = 9; + optional .benchmarks.google_message3.Message18856 field18966 = 10; + optional uint64 field18967 = 34; + optional .benchmarks.google_message3.UnusedEmptyMessage field18968 = 11; + optional uint64 field18969 = 35; + optional float field18970 = 12; + repeated string field18971 = 14; + optional bool field18972 = 15; + optional bool field18973 = 16; + optional float field18974 = 22; + optional int32 field18975 = 18; + optional int32 field18976 = 19; + optional int32 field18977 = 20; + optional .benchmarks.google_message3.UnusedEmptyMessage field18978 = 25; + optional .benchmarks.google_message3.UnusedEnum field18979 = 26; + repeated string field18980 = 27; + optional float field18981 = 28; + } + repeated .benchmarks.google_message3.UnusedEmptyMessage field18954 = 29; + repeated .benchmarks.google_message3.Message18943 field18955 = 30; + repeated .benchmarks.google_message3.Message18944 field18956 = 31; + repeated .benchmarks.google_message3.UnusedEmptyMessage field18957 = 32; +} + +message Message35540 { + optional bool field35541 = 1; +} + +message Message3886 { + repeated group Message3887 = 1 { + required string field3932 = 2; + optional string field3933 = 9; + optional .benchmarks.google_message3.Message3850 field3934 = 3; + optional bytes field3935 = 8; + } +} + +message Message6743 { + optional .benchmarks.google_message3.Message6721 field6759 = 1; + optional .benchmarks.google_message3.Message6723 field6760 = 2; + optional .benchmarks.google_message3.Message6723 field6761 = 8; + optional .benchmarks.google_message3.Message6725 field6762 = 3; + optional .benchmarks.google_message3.Message6726 field6763 = 4; + optional .benchmarks.google_message3.Message6733 field6764 = 5; + optional .benchmarks.google_message3.Message6734 field6765 = 6; + optional .benchmarks.google_message3.Message6742 field6766 = 7; +} + +message Message6773 { + optional .benchmarks.google_message3.Enum6769 field6794 = 1; + optional int32 field6795 = 9; + optional .benchmarks.google_message3.UnusedEnum field6796 = 10; + optional int32 field6797 = 11; + optional int32 field6798 = 2; + optional .benchmarks.google_message3.Enum6774 field6799 = 3; + optional double field6800 = 5; + optional double field6801 = 7; + optional double field6802 = 8; + optional .benchmarks.google_message3.Enum6782 field6803 = 6; +} + +message Message8224 { + optional .benchmarks.google_message3.UnusedEmptyMessage field8255 = 1; + optional .benchmarks.google_message3.Message8184 field8256 = 2; + optional .benchmarks.google_message3.Message7966 field8257 = 3; + optional string field8258 = 4; + optional string field8259 = 5; + optional bool field8260 = 6; + optional int64 field8261 = 7; + optional string field8262 = 8; + optional int64 field8263 = 9; + optional double field8264 = 10; + optional int64 field8265 = 11; + repeated string field8266 = 12; + optional int64 field8267 = 13; + optional int32 field8268 = 14; + optional int32 field8269 = 15; + optional int64 field8270 = 16; + optional double field8271 = 17; + optional .benchmarks.google_message3.UnusedEmptyMessage field8272 = 18; + optional .benchmarks.google_message3.UnusedEmptyMessage field8273 = 19; + repeated .benchmarks.google_message3.UnusedEmptyMessage field8274 = 20; + optional bool field8275 = 21; + optional .benchmarks.google_message3.UnusedEmptyMessage field8276 = 22; + optional .benchmarks.google_message3.UnusedEmptyMessage field8277 = 23; + repeated .benchmarks.google_message3.UnusedEmptyMessage field8278 = 24; + optional .benchmarks.google_message3.UnusedEmptyMessage field8279 = 25; + optional bool field8280 = 26; + repeated .benchmarks.google_message3.UnusedEmptyMessage field8281 = 27; +} + +message Message8392 { + optional string field8395 = 1; + optional string field8396 = 2; + optional .benchmarks.google_message3.Message7966 field8397 = 3; + optional string field8398 = 4; + optional string field8399 = 5; + optional string field8400 = 6; + optional string field8401 = 7; + optional string field8402 = 8; + optional string field8403 = 9; +} + +message Message8130 { + optional string field8156 = 1; + optional string field8157 = 2; + optional string field8158 = 4; + optional .benchmarks.google_message3.UnusedEmptyMessage field8159 = 6; + repeated string field8160 = 7; + optional int64 field8161 = 8; + optional .benchmarks.google_message3.UnusedEmptyMessage field8162 = 9; + optional string field8163 = 10; + optional string field8164 = 11; + optional string field8165 = 12; + optional string field8166 = 13; + optional .benchmarks.google_message3.UnusedEmptyMessage field8167 = 14; + optional .benchmarks.google_message3.UnusedEmptyMessage field8168 = 15; + optional string field8169 = 16; + optional .benchmarks.google_message3.UnusedEnum field8170 = 17; + optional .benchmarks.google_message3.UnusedEnum field8171 = 18; + optional bool field8172 = 19; + optional bool field8173 = 20; + optional double field8174 = 21; + optional int32 field8175 = 22; + optional int32 field8176 = 23; + optional .benchmarks.google_message3.UnusedEmptyMessage field8177 = 24; + repeated .benchmarks.google_message3.UnusedEmptyMessage field8178 = 25; + repeated .benchmarks.google_message3.UnusedEmptyMessage field8179 = 26; +} + +message Message8478 { + optional string field8489 = 7; + optional .benchmarks.google_message3.Message7966 field8490 = 1; + optional .benchmarks.google_message3.Message8476 field8491 = 2; + optional int64 field8492 = 3; + optional .benchmarks.google_message3.Message8476 field8493 = 4; + repeated .benchmarks.google_message3.Message8477 field8494 = 5; + optional .benchmarks.google_message3.Message8454 field8495 = 6; + optional .benchmarks.google_message3.UnusedEmptyMessage field8496 = 8; +} + +message Message8479 { + optional .benchmarks.google_message3.Message8475 field8497 = 1; + optional .benchmarks.google_message3.Message7966 field8498 = 2; + optional .benchmarks.google_message3.Message8476 field8499 = 3; + optional .benchmarks.google_message3.Message8476 field8500 = 4; + optional string field8501 = 6; + optional string field8502 = 7; + optional .benchmarks.google_message3.Message7966 field8503 = 8; + optional .benchmarks.google_message3.Message8455 field8504 = 5; + optional .benchmarks.google_message3.UnusedEmptyMessage field8505 = 9; +} + +message Message10319 { + optional .benchmarks.google_message3.Enum10325 field10340 = 1; + optional int32 field10341 = 4; + optional int32 field10342 = 5; + optional bytes field10343 = 3; + optional string field10344 = 2; + optional string field10345 = 6; + optional string field10346 = 7; +} + +message Message4016 { + required int32 field4017 = 1; + required int32 field4018 = 2; + required int32 field4019 = 3; + required int32 field4020 = 4; +} + +message Message12669 { + optional .benchmarks.google_message3.Message12559 field12681 = 1; + optional float field12682 = 2; + optional bool field12683 = 3; + optional .benchmarks.google_message3.Enum12670 field12684 = 4; +} + +message Message12819 { + optional double field12834 = 1; + optional double field12835 = 2; + optional double field12836 = 3; + optional double field12837 = 4; + optional double field12838 = 5; + optional double field12839 = 6; +} + +message Message12820 { + optional int32 field12840 = 1; + optional int32 field12841 = 2; + optional int32 field12842 = 3; + optional int32 field12843 = 8; + optional int32 field12844 = 4; + optional int32 field12845 = 5; + optional int32 field12846 = 6; + optional int32 field12847 = 7; +} + +message Message12821 { + optional int32 field12848 = 1; + optional int32 field12849 = 2; + optional int32 field12850 = 3; + optional int32 field12851 = 4; + optional int32 field12852 = 5; +} + +message Message12818 { + optional uint64 field12829 = 1; + optional int32 field12830 = 2; + optional int32 field12831 = 3; + optional int32 field12832 = 5; + repeated .benchmarks.google_message3.Message12817 field12833 = 4; +} + +message Message16479 { + optional .benchmarks.google_message3.Message16480 field16484 = 1; + optional int32 field16485 = 5; + optional float field16486 = 2; + optional uint32 field16487 = 4; + optional bool field16488 = 3; + optional uint32 field16489 = 6; +} + +message Message16722 { + optional string field16752 = 1; + optional string field16753 = 2; + optional string field16754 = 3; + optional int32 field16755 = 5; + optional string field16756 = 4; +} + +message Message16724 { + optional int64 field16761 = 1; + optional float field16762 = 2; + optional int64 field16763 = 3; + optional int64 field16764 = 4; + optional bool field16765 = 5; + repeated string field16766 = 6; + repeated string field16767 = 7; + optional .benchmarks.google_message3.UnusedEmptyMessage field16768 = 8; + optional bool field16769 = 9; + optional uint32 field16770 = 10; + optional .benchmarks.google_message3.Enum16728 field16771 = 11; + repeated int32 field16772 = 12; + optional bool field16773 = 13; +} + +message Message17728 { +} + +message Message24356 { + optional string field24559 = 1; + optional string field24560 = 2; + optional int32 field24561 = 14; + optional string field24562 = 3; + optional string field24563 = 4; + optional string field24564 = 5; + optional .benchmarks.google_message3.UnusedEnum field24565 = 13; + optional string field24566 = 6; + optional .benchmarks.google_message3.Enum24361 field24567 = 12; + optional string field24568 = 7; + optional string field24569 = 8; + optional string field24570 = 9; + repeated .benchmarks.google_message3.UnusedEmptyMessage field24571 = 10; + repeated string field24572 = 11; + repeated string field24573 = 15; +} + +message Message24376 { + optional string field24589 = 1; + optional string field24590 = 2; + optional string field24591 = 3; + required .benchmarks.google_message3.Message24377 field24592 = 4; + optional .benchmarks.google_message3.Message24317 field24593 = 5; + optional string field24594 = 6; + optional .benchmarks.google_message3.Message24378 field24595 = 7; + repeated string field24596 = 8; + repeated .benchmarks.google_message3.UnusedEmptyMessage field24597 = 14; + repeated string field24598 = 9; + repeated string field24599 = 10; + repeated string field24600 = 11; + optional string field24601 = 12; + repeated string field24602 = 13; +} + +message Message24366 { + optional string field24574 = 1; + optional string field24575 = 2; + optional string field24576 = 3; + optional int32 field24577 = 10; + optional string field24578 = 13; + optional string field24579 = 4; + optional string field24580 = 5; + optional .benchmarks.google_message3.UnusedEnum field24581 = 9; + optional string field24582 = 14; + optional .benchmarks.google_message3.UnusedEnum field24583 = 15; + optional string field24584 = 6; + optional string field24585 = 12; + repeated .benchmarks.google_message3.UnusedEmptyMessage field24586 = 7; + repeated string field24587 = 8; + repeated string field24588 = 11; +} + diff -Nru protobuf-3.0.0/benchmarks/datasets/google_message3/benchmark_message3_4.proto protobuf-3.6.1.3/benchmarks/datasets/google_message3/benchmark_message3_4.proto --- protobuf-3.0.0/benchmarks/datasets/google_message3/benchmark_message3_4.proto 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/benchmarks/datasets/google_message3/benchmark_message3_4.proto 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,491 @@ +syntax = "proto2"; + +import "datasets/google_message3/benchmark_message3_5.proto"; +import "datasets/google_message3/benchmark_message3_6.proto"; +import "datasets/google_message3/benchmark_message3_7.proto"; +import "datasets/google_message3/benchmark_message3_8.proto"; +package benchmarks.google_message3; + +option cc_enable_arenas = true; +option java_package = "com.google.protobuf.benchmarks"; + +message Message24346 { +} + +message Message24401 { + optional .benchmarks.google_message3.Message24400 field24679 = 1; +} + +message Message24402 { + optional .benchmarks.google_message3.Message24400 field24680 = 1; +} + +message Message24379 { + optional string field24603 = 1; + optional string field24604 = 2; + optional string field24605 = 3; + required .benchmarks.google_message3.Message24380 field24606 = 4; + optional .benchmarks.google_message3.UnusedEmptyMessage field24607 = 5; + optional string field24608 = 6; + optional .benchmarks.google_message3.Message24381 field24609 = 7; + repeated string field24610 = 8; + repeated .benchmarks.google_message3.UnusedEmptyMessage field24611 = 17; + repeated string field24612 = 9; + repeated string field24613 = 10; + repeated string field24614 = 11; + optional string field24615 = 14; + optional string field24616 = 12; + optional string field24617 = 16; + repeated .benchmarks.google_message3.UnusedEmptyMessage field24618 = 13; + repeated string field24619 = 15; + repeated string field24620 = 18; +} + +message Message27358 { + optional int32 field27415 = 1; + optional int32 field27416 = 2; +} + +message Message34381 { + optional string field34398 = 1; + optional .benchmarks.google_message3.UnusedEmptyMessage field34399 = 2; + optional .benchmarks.google_message3.UnusedEmptyMessage field34400 = 3; + optional .benchmarks.google_message3.UnusedEmptyMessage field34401 = 4; + optional .benchmarks.google_message3.UnusedEmptyMessage field34402 = 5; + optional bool field34403 = 6; + optional bool field34404 = 7; + optional .benchmarks.google_message3.UnusedEmptyMessage field34405 = 8; + optional bool field34406 = 9; + optional .benchmarks.google_message3.UnusedEmptyMessage field34407 = 10; +} + +message Message34619 { + optional double field34641 = 1; + optional double field34642 = 2; + optional double field34643 = 3; + optional double field34644 = 4; + optional double field34645 = 11; + optional double field34646 = 5; + optional .benchmarks.google_message3.UnusedEmptyMessage field34647 = 100; +} + +message Message730 { + optional string field897 = 19; + repeated string field898 = 27; + repeated string field899 = 28; + repeated string field900 = 21; + optional string field901 = 30; + repeated uint32 field902 = 20; + repeated uint32 field903 = 32; + repeated string field904 = 16; + repeated .benchmarks.google_message3.Message697 field905 = 6; + repeated .benchmarks.google_message3.Message704 field906 = 7; + repeated string field907 = 18; + repeated .benchmarks.google_message3.Message703 field908 = 8; + repeated string field909 = 9; + optional .benchmarks.google_message3.Message716 field910 = 10; + optional .benchmarks.google_message3.Message718 field911 = 11; + optional bool field912 = 14; + repeated .benchmarks.google_message3.Message715 field913 = 4; + repeated string field914 = 17; + repeated string field915 = 23; + repeated .benchmarks.google_message3.Message719 field916 = 24; + repeated .benchmarks.google_message3.Message728 field917 = 26; + repeated .benchmarks.google_message3.Message702 field918 = 35; + optional string field919 = 36; + repeated string field920 = 37; + optional int64 field921 = 38; + repeated .benchmarks.google_message3.UnusedEmptyMessage field922 = 39; + repeated .benchmarks.google_message3.UnusedEmptyMessage field923 = 1; + optional .benchmarks.google_message3.UnusedEmptyMessage field924 = 2; + optional .benchmarks.google_message3.UnusedEmptyMessage field925 = 3; + optional .benchmarks.google_message3.UnusedEmptyMessage field926 = 5; + optional .benchmarks.google_message3.UnusedEmptyMessage field927 = 13; + repeated string field928 = 22; + optional bytes field929 = 31; + extensions 25 to 25; + extensions 29 to 29; + extensions 34 to 34; + extensions 15 to 15; +} + +message Message33958 { + optional string field33977 = 1; + optional string field33978 = 9; + repeated group Message33959 = 2 { + required string field33982 = 3; + optional string field33983 = 4; + optional string field33984 = 5; + optional fixed64 field33985 = 8; + optional bool field33986 = 10; + optional .benchmarks.google_message3.Message0 field33987 = 6; + } + optional .benchmarks.google_message3.Enum33960 field33980 = 7; + extend .benchmarks.google_message3.Message0 { + optional .benchmarks.google_message3.Message33958 field33981 = 10747482; + } +} + +message Message6637 { + optional .benchmarks.google_message3.UnusedEmptyMessage field6670 = 2; + repeated .benchmarks.google_message3.UnusedEmptyMessage field6671 = 1; + optional int32 field6672 = 3; + repeated string field6673 = 4; + optional .benchmarks.google_message3.UnusedEmptyMessage field6674 = 5; +} + +message Message6643 { + optional .benchmarks.google_message3.UnusedEmptyMessage field6683 = 3; + optional .benchmarks.google_message3.UnusedEmptyMessage field6684 = 4; + optional double field6685 = 5; + optional double field6686 = 6; + optional int32 field6687 = 1; + optional int32 field6688 = 2; + optional double field6689 = 9; + optional bytes field6690 = 10; + optional int32 field6691 = 11; + optional bool field6692 = 12; + optional bool field6693 = 13; + optional .benchmarks.google_message3.Message6578 field6694 = 15; + optional .benchmarks.google_message3.UnusedEnum field6695 = 16; + optional int64 field6696 = 17; + repeated .benchmarks.google_message3.UnusedEmptyMessage field6697 = 22; + optional .benchmarks.google_message3.UnusedEmptyMessage field6698 = 19; + optional .benchmarks.google_message3.UnusedEmptyMessage field6699 = 20; + optional int32 field6700 = 21; +} + +message Message6126 { + required string field6152 = 1; + repeated .benchmarks.google_message3.UnusedEmptyMessage field6153 = 9; + optional int32 field6154 = 14; + optional bytes field6155 = 10; + optional .benchmarks.google_message3.Message6024 field6156 = 12; + optional int32 field6157 = 4; + optional string field6158 = 5; + optional int32 field6159 = 6; + repeated int32 field6160 = 2; + repeated int32 field6161 = 3; + repeated .benchmarks.google_message3.Message6052 field6162 = 7; + repeated .benchmarks.google_message3.UnusedEmptyMessage field6163 = 11; + optional .benchmarks.google_message3.Enum6065 field6164 = 15; + repeated .benchmarks.google_message3.UnusedEmptyMessage field6165 = 8; + optional bool field6166 = 13; + optional bool field6167 = 16; + optional bool field6168 = 18; + repeated .benchmarks.google_message3.Message6054 field6169 = 17; + optional int32 field6170 = 19; +} + +message Message13083 { + optional float field13096 = 1; + repeated group Message13084 = 2 { + required float field13107 = 3; + required int32 field13108 = 4; + optional float field13109 = 5; + repeated .benchmarks.google_message3.Enum13092 field13110 = 6; + } + optional float field13098 = 44; + optional float field13099 = 45; + optional uint64 field13100 = 46; + optional float field13101 = 47; + optional group Message13085 = 16 { + } + repeated group Message13086 = 23 { + } + repeated group Message13087 = 29 { + } + optional .benchmarks.google_message3.UnusedEmptyMessage field13105 = 43; +} + +message Message13088 { + repeated group Message13089 = 1 { + required string field13139 = 2; + optional float field13140 = 3; + } + optional int64 field13136 = 4; + optional bool field13137 = 5; +} + +message Message10391 { + optional .benchmarks.google_message3.Enum10392 field10411 = 1; + optional .benchmarks.google_message3.UnusedEnum field10412 = 2; + optional int64 field10413 = 3; + optional string field10414 = 4; + optional string field10415 = 5; + optional bytes field10416 = 6; + optional bool field10417 = 8; + optional .benchmarks.google_message3.UnusedEmptyMessage field10418 = 9; + optional bool field10419 = 10; +} + +message Message11873 { + optional string field11876 = 1; + optional string field11877 = 4; + optional .benchmarks.google_message3.Message10573 field11878 = 5; + optional .benchmarks.google_message3.Message10582 field11879 = 6; + optional .benchmarks.google_message3.Message10824 field11880 = 7; + optional .benchmarks.google_message3.Message10773 field11881 = 12; + optional .benchmarks.google_message3.Message11866 field11882 = 8; + optional .benchmarks.google_message3.Message10818 field11883 = 13; + optional .benchmarks.google_message3.UnusedEmptyMessage field11884 = 16; + optional .benchmarks.google_message3.Message10155 field11885 = 11; + optional .benchmarks.google_message3.Message10469 field11886 = 14; + optional .benchmarks.google_message3.UnusedEmptyMessage field11887 = 15; + extensions 9 to 9; + extensions 10 to 10; +} + +message Message35506 { + optional int32 field35524 = 1; + optional string field35525 = 2; + optional .benchmarks.google_message3.Enum35507 field35526 = 3; + repeated .benchmarks.google_message3.UnusedEmptyMessage field35527 = 4; +} + +message Message13151 { + repeated .benchmarks.google_message3.Message13145 field13158 = 1; +} + +message Message18253 { + repeated group Message18254 = 1 { + required fixed64 field18362 = 2; + required double field18363 = 3; + } +} + +message Message16685 { + repeated .benchmarks.google_message3.Message16686 field16694 = 2; +} + +message Message16816 { + optional float field16826 = 1; + optional .benchmarks.google_message3.Enum16819 field16827 = 2; + optional float field16828 = 3; + repeated group Message16817 = 4 { + } + optional bool field16830 = 7; + optional bool field16831 = 8; + repeated group Message16818 = 12 { + } + optional string field16833 = 10; + optional bool field16834 = 13; + optional bool field16835 = 14; +} + +message Message13168 { + required int32 field13212 = 1; + optional fixed64 field13213 = 7; + optional bool field13214 = 8; + optional fixed64 field13215 = 10; + optional bool field13216 = 11; + optional .benchmarks.google_message3.Message12796 field13217 = 9; + required double field13218 = 2; + required bool field13219 = 3; + optional int32 field13220 = 4; + required bool field13221 = 5; + optional int32 field13222 = 6; +} + +message Message13167 { + required int32 field13199 = 1; + optional int32 field13200 = 2; + optional int32 field13201 = 3; + optional bool field13202 = 8; + optional fixed64 field13203 = 12; + optional bool field13204 = 13; + optional .benchmarks.google_message3.Message12796 field13205 = 11; + optional fixed64 field13206 = 9; + optional bool field13207 = 10; + repeated int32 field13208 = 4; + optional int32 field13209 = 5; + optional int32 field13210 = 6; + optional int32 field13211 = 7; +} + +message Message1374 { + required string field1375 = 1; + optional string field1376 = 2; +} + +message Message18943 { +} + +message Message18944 { +} + +message Message18856 { + optional string field18857 = 1; + optional string field18858 = 2; + optional bool field18859 = 31; + optional string field18860 = 26; + optional string field18861 = 3; + optional string field18862 = 4; + optional string field18863 = 5; + optional string field18864 = 17; + optional string field18865 = 6; + optional string field18866 = 7; + optional string field18867 = 8; + optional string field18868 = 9; + optional string field18869 = 10; + optional string field18870 = 11; + optional string field18871 = 21; + optional string field18872 = 18; + optional string field18873 = 19; + optional string field18874 = 20; + optional string field18875 = 22; + optional string field18876 = 23; + optional string field18877 = 24; + optional string field18878 = 25; + optional string field18879 = 12; + optional string field18880 = 13; + optional string field18881 = 29; + optional string field18882 = 30; + optional string field18883 = 15; + optional string field18884 = 16; + repeated string field18885 = 14; + optional string field18886 = 27; + optional string field18887 = 28; +} + +message Message3850 { + optional .benchmarks.google_message3.Enum3851 field3924 = 2; + optional bool field3925 = 12; + optional int32 field3926 = 4; + optional bool field3927 = 10; + optional bool field3928 = 13; + optional bool field3929 = 14; +} + +message Message6721 { + optional .benchmarks.google_message3.Message6722 field6744 = 1; + optional bool field6745 = 2; + optional bool field6746 = 3; + optional bool field6747 = 4; +} + +message Message6742 { + optional bool field6758 = 1; +} + +message Message6726 { + optional int64 field6752 = 1; + repeated .benchmarks.google_message3.Message6727 field6753 = 2; +} + +message Message6733 { + optional int64 field6754 = 1; + optional int64 field6755 = 2; + optional bool field6756 = 3; +} + +message Message6723 { + optional int64 field6748 = 1; + repeated .benchmarks.google_message3.Message6724 field6749 = 2; +} + +message Message6725 { + optional int32 field6750 = 1; + optional int32 field6751 = 2; +} + +message Message6734 { + repeated .benchmarks.google_message3.Message6735 field6757 = 1; +} + +message Message8184 { + optional .benchmarks.google_message3.Message7966 field8228 = 1; + optional bool field8229 = 2; + repeated .benchmarks.google_message3.Message8183 field8230 = 3; +} + +message Message8477 { + optional .benchmarks.google_message3.Message7966 field8486 = 1; + optional int64 field8487 = 2; + optional string field8488 = 3; +} + +message Message8454 { + optional .benchmarks.google_message3.Message8449 field8465 = 1; + optional int64 field8466 = 3; + optional int32 field8467 = 4; + optional bool field8468 = 5; + extend .benchmarks.google_message3.Message8301 { + optional .benchmarks.google_message3.Message8454 field8469 = 66; + } +} + +message Message8476 { + optional string field8483 = 1; + optional string field8484 = 2; + optional string field8485 = 3; +} + +message Message8455 { + optional .benchmarks.google_message3.Message8449 field8470 = 1; + repeated .benchmarks.google_message3.Message8456 field8471 = 2; + optional .benchmarks.google_message3.Message8457 field8472 = 5; + optional .benchmarks.google_message3.UnusedEmptyMessage field8473 = 6; + extend .benchmarks.google_message3.Message8302 { + optional .benchmarks.google_message3.Message8455 field8474 = 66; + } +} + +message Message8475 { + optional string field8481 = 1; + optional int64 field8482 = 2; +} + +message Message12559 { +} + +message Message12817 { + optional int32 field12826 = 1; + optional int32 field12827 = 2; + optional int32 field12828 = 3; +} + +message Message16480 { + optional .benchmarks.google_message3.Message13358 field16490 = 1; + optional .benchmarks.google_message3.Enum16042 field16491 = 2; + optional .benchmarks.google_message3.Message13912 field16492 = 3; + optional string field16493 = 4; + optional string field16494 = 5; + optional string field16495 = 6; + optional string field16496 = 7; + optional .benchmarks.google_message3.Message13358 field16497 = 8; + optional fixed32 field16498 = 9; +} + +message Message24317 { + optional string field24446 = 1; + optional .benchmarks.google_message3.Message24312 field24447 = 2; + repeated .benchmarks.google_message3.Message24315 field24448 = 3; + repeated .benchmarks.google_message3.Message24313 field24449 = 4; + repeated .benchmarks.google_message3.Message24316 field24450 = 5; + repeated .benchmarks.google_message3.UnusedEmptyMessage field24451 = 6; + optional .benchmarks.google_message3.UnusedEmptyMessage field24452 = 7; + repeated string field24453 = 8; + repeated string field24454 = 9; + repeated string field24455 = 10; + repeated string field24456 = 28; + optional string field24457 = 11; + optional string field24458 = 12; + optional string field24459 = 13; + optional string field24460 = 14; + repeated string field24461 = 15; + optional string field24462 = 16; + repeated string field24463 = 17; + repeated string field24464 = 18; + repeated string field24465 = 19; + repeated string field24466 = 20; + repeated string field24467 = 21; + repeated string field24468 = 22; + repeated string field24469 = 23; + repeated string field24470 = 24; + optional string field24471 = 25; + optional string field24472 = 26; + repeated string field24473 = 27; + optional bool field24474 = 40; +} + diff -Nru protobuf-3.0.0/benchmarks/datasets/google_message3/benchmark_message3_5.proto protobuf-3.6.1.3/benchmarks/datasets/google_message3/benchmark_message3_5.proto --- protobuf-3.0.0/benchmarks/datasets/google_message3/benchmark_message3_5.proto 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/benchmarks/datasets/google_message3/benchmark_message3_5.proto 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,473 @@ +syntax = "proto2"; + +import "datasets/google_message3/benchmark_message3_6.proto"; +import "datasets/google_message3/benchmark_message3_7.proto"; +import "datasets/google_message3/benchmark_message3_8.proto"; +package benchmarks.google_message3; + +option cc_enable_arenas = true; +option java_package = "com.google.protobuf.benchmarks"; + +message Message24377 { +} + +message Message24378 { +} + +message Message24400 { + optional int32 field24674 = 1; + optional int32 field24675 = 2; + optional int32 field24676 = 3; + optional int32 field24677 = 4; + optional int32 field24678 = 5; +} + +message Message24380 { +} + +message Message24381 { +} + +message Message719 { + repeated string field881 = 1; + repeated string field882 = 2; + repeated string field883 = 3; + optional .benchmarks.google_message3.Enum720 field884 = 4; +} + +message Message728 { + required string field887 = 1; + repeated string field888 = 2; + repeated .benchmarks.google_message3.Message703 field889 = 3; + repeated .benchmarks.google_message3.Message715 field890 = 4; + repeated string field891 = 5; + repeated string field892 = 6; + optional .benchmarks.google_message3.Message718 field893 = 7; + optional .benchmarks.google_message3.Message716 field894 = 8; + repeated string field895 = 9; + extensions 10 to 10; + extensions 11 to 11; + extensions 12 to 12; +} + +message Message704 { + optional string field800 = 1; + optional string field801 = 7; + optional string field802 = 2; + optional string field803 = 3; + optional string field804 = 4; + optional string field805 = 5; + optional .benchmarks.google_message3.UnusedEmptyMessage field806 = 6; +} + +message Message697 { + optional string field743 = 7; + repeated string field744 = 1; + repeated string field745 = 2; + repeated string field746 = 33; + repeated string field747 = 29; + repeated string field748 = 30; + repeated string field749 = 31; + repeated string field750 = 32; + repeated string field751 = 13; + repeated string field752 = 6; + repeated string field753 = 3; + repeated string field754 = 14; + repeated string field755 = 15; + repeated string field756 = 16; + repeated string field757 = 4; + repeated string field758 = 34; + repeated string field759 = 35; + repeated string field760 = 5; + repeated string field761 = 17; + repeated string field762 = 18; + repeated string field763 = 19; + optional bool field764 = 36; + repeated string field765 = 8; + repeated string field766 = 9; + optional string field767 = 27; + optional bool field768 = 25; + optional .benchmarks.google_message3.Message700 field769 = 10; + optional bool field770 = 11; + optional bool field771 = 24; + repeated string field772 = 12; + repeated string field773 = 20; + repeated string field774 = 21; + repeated string field775 = 22; + repeated .benchmarks.google_message3.Message699 field776 = 23; + repeated .benchmarks.google_message3.Message698 field777 = 37; + optional int64 field778 = 38; + extensions 28 to 28; + extensions 26 to 26; +} + +message Message0 { + option message_set_wire_format = true; + extensions 4 to 2147483646; +} + +message Message6578 { + optional .benchmarks.google_message3.Enum6579 field6632 = 1; + optional .benchmarks.google_message3.Enum6588 field6633 = 2; +} + +message Message6024 { + optional .benchmarks.google_message3.Enum6025 field6048 = 1; + optional string field6049 = 2; + optional .benchmarks.google_message3.UnusedEmptyMessage field6050 = 3; +} + +message Message6052 { + required string field6084 = 1; + required bytes field6085 = 2; +} + +message Message6054 { + required string field6089 = 1; + optional string field6090 = 2; +} + +message Message10573 { + repeated .benchmarks.google_message3.Message10576 field10580 = 1; + optional string field10581 = 2; + extensions 10000 to 536870911; +} + +message Message10824 { + required string field10825 = 1; + optional int32 field10826 = 2; +} + +message Message10582 { + required bool field10583 = 1; + required double field10584 = 2; + optional bool field10585 = 3; + optional double field10586 = 4; + optional double field10587 = 5; + optional bool field10588 = 6; +} + +message Message10155 { + required int32 field10195 = 1; + required int32 field10196 = 2; + optional .benchmarks.google_message3.Enum10157 field10197 = 59; + optional int32 field10198 = 18; + optional int32 field10199 = 19; + optional int32 field10200 = 21; + repeated group Message10156 = 50 { + optional .benchmarks.google_message3.Enum8862 field10266 = 51; + optional int32 field10267 = 52; + optional int32 field10268 = 53; + optional int32 field10269 = 54; + } + optional int32 field10202 = 3; + optional int32 field10203 = 4; + optional int32 field10204 = 5; + optional bool field10205 = 84; + optional bool field10206 = 33; + optional int32 field10207 = 75; + optional float field10208 = 26; + optional int32 field10209 = 27; + optional int32 field10210 = 49; + optional int32 field10211 = 10; + optional float field10212 = 78; + optional .benchmarks.google_message3.Message9151 field10213 = 91; + optional int32 field10214 = 11; + optional int32 field10215 = 12; + optional float field10216 = 41; + optional .benchmarks.google_message3.Message10154 field10217 = 61; + optional int32 field10218 = 23; + optional bytes field10219 = 24; + optional int32 field10220 = 65; + repeated bytes field10221 = 66; + optional int32 field10222 = 70; + optional bytes field10223 = 71; + repeated fixed64 field10224 = 73; + optional float field10225 = 29; + optional int32 field10226 = 30; + optional float field10227 = 31; + optional int32 field10228 = 32; + optional float field10229 = 34; + optional int32 field10230 = 35; + optional string field10231 = 22; + optional fixed64 field10232 = 13; + optional fixed64 field10233 = 20; + optional bool field10234 = 79; + repeated .benchmarks.google_message3.Enum10167 field10235 = 80 [packed = true]; + optional int32 field10236 = 14; + optional int32 field10237 = 15; + optional int32 field10238 = 28; + repeated string field10239 = 16; + optional .benchmarks.google_message3.Message9182 field10240 = 17; + optional int32 field10241 = 63; + optional float field10242 = 64; + optional float field10243 = 37; + repeated float field10244 = 43; + optional int32 field10245 = 44; + optional .benchmarks.google_message3.Message9242 field10246 = 45; + optional .benchmarks.google_message3.UnusedEmptyMessage field10247 = 46; + optional .benchmarks.google_message3.UnusedEmptyMessage field10248 = 62; + optional .benchmarks.google_message3.Message8944 field10249 = 48; + optional .benchmarks.google_message3.UnusedEmptyMessage field10250 = 87; + optional int32 field10251 = 58; + optional int32 field10252 = 92; + optional .benchmarks.google_message3.Message9123 field10253 = 93; + optional .benchmarks.google_message3.Message9160 field10254 = 60; + optional .benchmarks.google_message3.Message8890 field10255 = 67; + optional string field10256 = 69; + optional int64 field10257 = 74; + optional float field10258 = 82; + optional float field10259 = 85; + optional float field10260 = 86; + optional int64 field10261 = 83; + optional string field10262 = 77; + optional bool field10263 = 88; + repeated .benchmarks.google_message3.Message9628 field10264 = 94; + extensions 57 to 57; + extensions 1000 to 536870911; +} + +message Message11866 { + required .benchmarks.google_message3.Message11014 field11868 = 1; + optional bool field11869 = 2; + optional double field11870 = 3; + optional double field11871 = 4; + repeated .benchmarks.google_message3.UnusedEmptyMessage field11872 = 5; +} + +message Message10469 { + optional string field10473 = 1; + optional float field10474 = 2; + optional int32 field10475 = 3; + optional int32 field10476 = 4; + optional int32 field10477 = 5; + optional bool field10478 = 6; + optional bool field10479 = 7; + optional int32 field10480 = 8; + optional float field10481 = 9; +} + +message Message10818 { + optional .benchmarks.google_message3.Message10800 field10819 = 1; + optional .benchmarks.google_message3.Message10801 field10820 = 2; +} + +message Message10773 { + optional bool field10774 = 9; + optional bool field10775 = 1; + optional bool field10776 = 23; + optional bool field10777 = 2; + optional bool field10778 = 3; + optional int32 field10779 = 4; + optional int32 field10780 = 5; + optional int32 field10781 = 6; + optional int32 field10782 = 7; + optional int32 field10783 = 8; + optional int32 field10784 = 10; + optional .benchmarks.google_message3.Message10749 field10785 = 11; + repeated .benchmarks.google_message3.UnusedEmptyMessage field10786 = 12; + optional bool field10787 = 13; + optional bool field10788 = 15; + optional bool field10789 = 16; + optional int32 field10790 = 17; + optional int32 field10791 = 18; + optional bool field10792 = 19; + optional bool field10793 = 20; + optional bool field10794 = 21; + optional .benchmarks.google_message3.UnusedEnum field10795 = 14; + optional .benchmarks.google_message3.UnusedEnum field10796 = 22; +} + +message Message13145 { + required .benchmarks.google_message3.Enum13146 field13155 = 1; + optional float field13156 = 2; + optional float field13157 = 3; + extensions 1000 to 536870911; +} + +message Message16686 { +} + +message Message12796 { + repeated fixed64 field12800 = 1; + optional uint64 field12801 = 2; +} + +message Message6722 { +} + +message Message6727 { +} + +message Message6724 { +} + +message Message6735 { +} + +message Message8183 { + optional string field8226 = 1; + optional string field8227 = 2; +} + +message Message8301 { + optional string field8328 = 1; + optional .benchmarks.google_message3.Message7966 field8329 = 2; + optional string field8330 = 3; + optional string field8331 = 4; + repeated .benchmarks.google_message3.Message8290 field8332 = 5; + optional .benchmarks.google_message3.Message7966 field8333 = 6; + repeated .benchmarks.google_message3.Message8298 field8334 = 7; + optional .benchmarks.google_message3.Message8300 field8335 = 8; + optional int64 field8336 = 9; + optional .benchmarks.google_message3.UnusedEmptyMessage field8337 = 10; + optional .benchmarks.google_message3.Message7965 field8338 = 11; + extensions 64 to 536870911; +} + +message Message8456 { +} + +message Message8302 { + optional string field8339 = 1; + optional .benchmarks.google_message3.Message7966 field8340 = 2; + optional string field8341 = 3; + optional string field8342 = 4; + optional string field8343 = 5; + optional string field8344 = 6; + optional string field8345 = 7; + optional int64 field8346 = 8; + optional int64 field8347 = 9; + repeated .benchmarks.google_message3.Message8290 field8348 = 10; + optional string field8349 = 11; + optional .benchmarks.google_message3.UnusedEmptyMessage field8350 = 12; + optional .benchmarks.google_message3.Message8291 field8351 = 13; + optional int64 field8352 = 14; + optional .benchmarks.google_message3.Message8296 field8353 = 15; + optional string field8354 = 16; + optional .benchmarks.google_message3.UnusedEmptyMessage field8355 = 17; + repeated int32 field8356 = 18; + repeated int32 field8357 = 19; + repeated .benchmarks.google_message3.UnusedEmptyMessage field8358 = 20; + optional .benchmarks.google_message3.Message7965 field8359 = 21; + extensions 64 to 536870911; +} + +message Message8457 { +} + +message Message8449 { + optional string field8458 = 1; + optional bool field8459 = 2; + optional .benchmarks.google_message3.Enum8450 field8460 = 3; + repeated string field8461 = 4; + optional string field8462 = 5; + optional string field8463 = 6; + optional .benchmarks.google_message3.Message7966 field8464 = 7; +} + +message Message13358 { + required fixed64 field13359 = 1; + required fixed64 field13360 = 2; + optional .benchmarks.google_message3.UnusedEmptyMessage field13361 = 3; +} + +message Message13912 { + required fixed32 field13913 = 1; + required fixed32 field13914 = 2; + optional .benchmarks.google_message3.UnusedEmptyMessage field13915 = 500; + optional .benchmarks.google_message3.UnusedEmptyMessage field13916 = 15; +} + +message Message24316 { + repeated string field24443 = 1; + repeated string field24444 = 2; + repeated string field24445 = 3; +} + +message Message24312 { + optional string field24421 = 1; + optional string field24422 = 2; + repeated string field24423 = 3; + repeated string field24424 = 4; + repeated string field24425 = 5; + repeated string field24426 = 6; +} + +message Message24313 { + optional string field24427 = 1; + optional string field24428 = 2; + repeated string field24429 = 3; + optional string field24430 = 4; + optional string field24431 = 5; + optional string field24432 = 6; + optional string field24433 = 7; + repeated string field24434 = 8; + optional string field24435 = 9; + repeated string field24436 = 10; +} + +message Message24315 { + required string field24440 = 1; + repeated string field24441 = 2; + repeated string field24442 = 3; +} + +message Message716 { + required string field872 = 1; + required int32 field873 = 2; + optional bool field874 = 3; + optional .benchmarks.google_message3.Message717 field875 = 4; +} + +message Message718 { + repeated string field878 = 1; + repeated string field879 = 2; + optional string field880 = 3; +} + +message Message703 { + required string field795 = 1; + repeated string field796 = 2; + repeated string field797 = 3; + optional string field798 = 4; + repeated string field799 = 5; +} + +message Message715 { + required string field859 = 1; + optional string field860 = 7; + repeated .benchmarks.google_message3.Message707 field861 = 2; + repeated .benchmarks.google_message3.Message708 field862 = 3; + repeated .benchmarks.google_message3.Message711 field863 = 4; + repeated .benchmarks.google_message3.Message712 field864 = 5; + repeated .benchmarks.google_message3.Message713 field865 = 6; + repeated .benchmarks.google_message3.Message714 field866 = 8; + repeated .benchmarks.google_message3.Message710 field867 = 9; + repeated .benchmarks.google_message3.Message709 field868 = 10; + repeated .benchmarks.google_message3.Message705 field869 = 11; + repeated .benchmarks.google_message3.Message702 field870 = 12; + repeated .benchmarks.google_message3.Message706 field871 = 13; +} + +message Message700 { + repeated string field789 = 1; + repeated string field790 = 2; +} + +message Message699 { + required string field787 = 1; + repeated string field788 = 2; +} + +message Message698 { + optional string field779 = 1; + optional string field780 = 2; + optional string field781 = 3; + optional string field782 = 4; + optional uint64 field783 = 5; + optional uint32 field784 = 6; + optional int64 field785 = 7; + repeated string field786 = 8; +} + diff -Nru protobuf-3.0.0/benchmarks/datasets/google_message3/benchmark_message3_6.proto protobuf-3.6.1.3/benchmarks/datasets/google_message3/benchmark_message3_6.proto --- protobuf-3.0.0/benchmarks/datasets/google_message3/benchmark_message3_6.proto 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/benchmarks/datasets/google_message3/benchmark_message3_6.proto 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,454 @@ +syntax = "proto2"; + +import "datasets/google_message3/benchmark_message3_7.proto"; +import "datasets/google_message3/benchmark_message3_8.proto"; +package benchmarks.google_message3; + +option cc_enable_arenas = true; +option java_package = "com.google.protobuf.benchmarks"; + +message Message10576 { +} + +message Message10154 { + optional bytes field10192 = 1; + optional int32 field10193 = 2; +} + +message Message8944 { + optional string field9045 = 2; + optional string field9046 = 3; + optional string field9047 = 23; + optional string field9048 = 52; + optional int32 field9049 = 53; + optional int32 field9050 = 54; + optional float field9051 = 55; + optional float field9052 = 56; + optional string field9053 = 57; + optional int64 field9054 = 1; + optional bool field9055 = 4; + optional int32 field9056 = 5; + optional int32 field9057 = 6; + optional int32 field9058 = 7; + optional float field9059 = 8; + optional float field9060 = 11; + optional float field9061 = 9; + optional float field9062 = 10; + optional float field9063 = 13; + optional bool field9064 = 14; + optional float field9065 = 70; + optional int32 field9066 = 71; + optional .benchmarks.google_message3.Enum8945 field9067 = 15; + optional int32 field9068 = 16; + optional int32 field9069 = 17; + optional float field9070 = 18; + optional float field9071 = 19; + optional int32 field9072 = 28; + optional int32 field9073 = 29; + optional float field9074 = 60; + optional float field9075 = 61; + optional int32 field9076 = 72; + optional int32 field9077 = 73; + optional .benchmarks.google_message3.Enum8951 field9078 = 62; + optional string field9079 = 20; + optional string field9080 = 21; + optional string field9081 = 22; + optional double field9082 = 31; + optional double field9083 = 32; + optional double field9084 = 33; + optional double field9085 = 36; + optional .benchmarks.google_message3.UnusedEnum field9086 = 37; + optional double field9087 = 38; + optional double field9088 = 39; + optional double field9089 = 63; + optional double field9090 = 64; + optional double field9091 = 65; + optional double field9092 = 34; + optional .benchmarks.google_message3.UnusedEnum field9093 = 35; + optional .benchmarks.google_message3.UnusedEnum field9094 = 66; + optional string field9095 = 40; + optional string field9096 = 41; + optional string field9097 = 42; + optional string field9098 = 43; + optional string field9099 = 44; + optional string field9100 = 45; + optional string field9101 = 46; + optional string field9102 = 47; + optional string field9103 = 48; + optional string field9104 = 49; + optional .benchmarks.google_message3.Message8939 field9105 = 100; + optional int64 field9106 = 101; +} + +message Message9182 { + optional string field9205 = 1; + optional string field9206 = 2; + optional float field9207 = 16; + optional int32 field9208 = 17; + optional int32 field9209 = 27; + optional int32 field9210 = 7; + optional int32 field9211 = 8; + optional float field9212 = 26; + optional float field9213 = 22; + optional bool field9214 = 28; + repeated .benchmarks.google_message3.UnusedEmptyMessage field9215 = 21; + repeated .benchmarks.google_message3.UnusedEmptyMessage field9216 = 25; + repeated .benchmarks.google_message3.Message9181 field9217 = 29; + optional bool field9218 = 18; + optional bool field9219 = 19; + optional bool field9220 = 20; + optional .benchmarks.google_message3.Message9164 field9221 = 30; + optional .benchmarks.google_message3.Message9165 field9222 = 31; + optional .benchmarks.google_message3.Message9166 field9223 = 32; + optional float field9224 = 33; + optional .benchmarks.google_message3.Message9151 field9225 = 34; + optional float field9226 = 35; + optional float field9227 = 36; + optional float field9228 = 37; + optional float field9229 = 38; + optional float field9230 = 39; + extensions 3 to 6; + extensions 9 to 15; + extensions 23 to 23; + extensions 24 to 24; + extensions 1000 to 536870911; +} + +message Message9160 { + optional int32 field9161 = 1; + optional bytes field9162 = 2; +} + +message Message9242 { + repeated .benchmarks.google_message3.Enum9243 field9327 = 1; +} + +message Message8890 { + repeated .benchmarks.google_message3.Message8888 field8916 = 1; +} + +message Message9123 { + optional float field9135 = 1; +} + +message Message9628 { + optional .benchmarks.google_message3.Message9627 field9673 = 1; + optional string field9674 = 2; + repeated int32 field9675 = 3; + optional int32 field9676 = 4; +} + +message Message11014 { + optional int32 field11780 = 40; + optional string field11781 = 46; + optional bool field11782 = 47; + optional .benchmarks.google_message3.Enum11107 field11783 = 1; + optional int32 field11784 = 2; + optional double field11785 = 4; + optional int32 field11786 = 5; + optional int32 field11787 = 6; + optional double field11788 = 7; + optional double field11789 = 8; + optional int64 field11790 = 9; + optional bool field11791 = 10; + optional int64 field11792 = 28; + optional bool field11793 = 37; + optional .benchmarks.google_message3.Enum11541 field11794 = 44; + optional double field11795 = 49; + optional double field11796 = 51; + optional int64 field11797 = 54; + optional int64 field11798 = 55; + optional .benchmarks.google_message3.UnusedEnum field11799 = 57; + optional .benchmarks.google_message3.Enum11468 field11800 = 58; + optional int32 field11801 = 59; + optional .benchmarks.google_message3.UnusedEnum field11802 = 60; + optional int32 field11803 = 61; + optional int32 field11804 = 62; + optional int32 field11805 = 69; + optional .benchmarks.google_message3.UnusedEmptyMessage field11806 = 68; + repeated .benchmarks.google_message3.Message11018 field11807 = 71; + optional bool field11808 = 50; + optional bool field11809 = 56; + optional bool field11810 = 66; + optional bool field11811 = 63; + optional bool field11812 = 64; + optional bool field11813 = 65; + optional bool field11814 = 67; + optional .benchmarks.google_message3.Enum11107 field11815 = 15; + optional int64 field11816 = 16; + optional double field11817 = 17; + optional int64 field11818 = 18; + optional int32 field11819 = 19; + optional int64 field11820 = 20; + optional int32 field11821 = 42; + optional int64 field11822 = 52; + optional int64 field11823 = 53; + optional int64 field11824 = 41; + optional double field11825 = 48; + repeated .benchmarks.google_message3.Message11020 field11826 = 70; + repeated .benchmarks.google_message3.UnusedEmptyMessage field11827 = 72; + optional double field11828 = 25; + optional string field11829 = 26; + optional int64 field11830 = 27; + optional int64 field11831 = 32; + optional uint64 field11832 = 33; + optional bool field11833 = 29; + optional bool field11834 = 34; + optional string field11835 = 30; + optional int32 field11836 = 3; + optional int32 field11837 = 31; + optional int32 field11838 = 73; + optional int32 field11839 = 35; + optional .benchmarks.google_message3.Enum11022 field11840 = 36; + optional .benchmarks.google_message3.Message11013 field11841 = 38; + optional double field11842 = 39; + optional int32 field11843 = 45; + optional bool field11844 = 74; +} + +message Message10801 { + optional .benchmarks.google_message3.Message10800 field10812 = 1; + repeated .benchmarks.google_message3.Message10802 field10813 = 2; + optional int32 field10814 = 3; +} + +message Message10749 { + repeated .benchmarks.google_message3.Message10748 field10754 = 1; +} + +message Message8298 { + optional .benchmarks.google_message3.Message7966 field8321 = 1; + optional int64 field8322 = 2; + optional string field8323 = 3; +} + +message Message8300 { + optional string field8326 = 1; + optional .benchmarks.google_message3.Message7966 field8327 = 2; +} + +message Message8291 { + optional string field8306 = 1; + optional int32 field8307 = 2; + optional string field8308 = 3; + optional string field8309 = 4; + optional .benchmarks.google_message3.Enum8292 field8310 = 5; +} + +message Message8296 { + optional .benchmarks.google_message3.Message7966 field8311 = 1; + optional string field8312 = 2; + optional .benchmarks.google_message3.Message7966 field8313 = 3; + optional int32 field8314 = 4; + optional int32 field8315 = 5; + optional string field8316 = 6; +} + +message Message7965 { + optional int32 field7967 = 1; + optional int32 field7968 = 2; +} + +message Message8290 { + optional string field8304 = 1; + optional string field8305 = 2; +} + +message Message717 { + repeated string field876 = 1; + optional double field877 = 2; +} + +message Message713 { + required .benchmarks.google_message3.Message708 field852 = 1; + repeated string field853 = 2; +} + +message Message705 { + required string field807 = 1; + optional string field808 = 2; + optional string field809 = 3; + optional bool field810 = 4; + optional string field811 = 5; + optional string field812 = 6; + repeated string field813 = 7; +} + +message Message709 { + repeated string field829 = 1; + repeated string field830 = 2; + repeated string field831 = 3; + repeated string field832 = 4; + repeated string field833 = 5; +} + +message Message702 { + optional string field793 = 1; + optional string field794 = 2; +} + +message Message714 { + optional string field854 = 1; + optional string field855 = 2; + optional string field856 = 3; + optional string field857 = 4; + optional uint32 field858 = 5; +} + +message Message710 { + repeated string field834 = 1; + optional string field835 = 2; + optional string field836 = 3; + repeated string field837 = 4; + repeated string field838 = 5; +} + +message Message706 { + repeated string field814 = 1; + optional string field815 = 2; + repeated string field816 = 3; + repeated string field817 = 4; +} + +message Message707 { + required string field818 = 1; + required string field819 = 2; + required string field820 = 3; + optional bool field821 = 4; + repeated string field822 = 5; +} + +message Message711 { + optional .benchmarks.google_message3.UnusedEmptyMessage field839 = 1; + repeated string field840 = 4; + repeated string field841 = 2; + repeated string field842 = 3; +} + +message Message712 { + repeated string field843 = 1; + required string field844 = 2; + optional string field845 = 3; + repeated string field846 = 4; + repeated string field847 = 5; + optional string field848 = 6; + repeated string field849 = 7; + optional string field850 = 8; + optional string field851 = 9; +} + +message Message8939 { + optional string field9010 = 1; + optional string field9011 = 2; + optional string field9012 = 3; + repeated string field9013 = 4; + optional string field9014 = 5; + repeated group Message8940 = 11 { + } + optional int64 field9016 = 21; + optional int64 field9017 = 22; + optional int64 field9018 = 23; + optional group Message8941 = 31 { + optional string field9033 = 32; + optional string field9034 = 33; + optional string field9035 = 34; + optional string field9036 = 35; + optional string field9037 = 36; + optional string field9038 = 37; + } + optional .benchmarks.google_message3.Message8942 field9020 = 38; + repeated .benchmarks.google_message3.UnusedEmptyMessage field9021 = 39; + repeated string field9022 = 41; + optional string field9023 = 42; + optional string field9024 = 43; + optional string field9025 = 44; + optional string field9026 = 45; + optional string field9027 = 46; + optional string field9028 = 47; + optional .benchmarks.google_message3.UnusedEnum field9029 = 48; + optional .benchmarks.google_message3.UnusedEnum field9030 = 49; + optional group Message8943 = 51 { + optional string field9039 = 1; + optional string field9040 = 2; + optional string field9041 = 3; + optional string field9042 = 4; + optional string field9043 = 5; + optional string field9044 = 6; + } +} + +message Message9181 { + optional string field9204 = 1; +} + +message Message9164 { + optional int32 field9168 = 1; + optional int32 field9169 = 2; + optional int32 field9170 = 3; +} + +message Message9165 { + optional float field9171 = 1; + optional float field9172 = 2; +} + +message Message9166 { + optional float field9173 = 1; + optional int32 field9174 = 2; +} + +message Message9151 { + optional double field9152 = 1; + optional double field9153 = 2; + optional float field9154 = 3; + optional float field9155 = 4; + optional float field9156 = 5; + optional float field9157 = 6; + optional float field9158 = 7; + optional float field9159 = 8; +} + +message Message8888 { + optional int32 field8908 = 1; + optional .benchmarks.google_message3.Enum8900 field8909 = 4; + repeated int32 field8910 = 2 [packed = true]; + optional bytes field8911 = 3; +} + +message Message9627 { + required int32 field9668 = 1; + required int32 field9669 = 2; + required int32 field9670 = 3; + required int32 field9671 = 4; + optional float field9672 = 5; +} + +message Message11020 { +} + +message Message11013 { + optional bytes field11757 = 19; + optional bytes field11758 = 1; + optional bytes field11759 = 2; + optional bytes field11760 = 3; + optional bytes field11761 = 4; + optional bytes field11762 = 5; + optional bytes field11763 = 6; + optional bytes field11764 = 7; + optional bytes field11765 = 8; + optional bytes field11766 = 9; + optional bytes field11767 = 10; + optional bytes field11768 = 11; + optional bytes field11769 = 12; + optional bytes field11770 = 13; + optional bytes field11771 = 14; + optional bytes field11772 = 15; + optional bytes field11773 = 16; + optional bytes field11774 = 17; + optional bytes field11775 = 18; + optional bytes field11776 = 20; + optional bytes field11777 = 21; + optional .benchmarks.google_message3.UnusedEmptyMessage field11778 = 23; + repeated .benchmarks.google_message3.Message11011 field11779 = 22; +} + diff -Nru protobuf-3.0.0/benchmarks/datasets/google_message3/benchmark_message3_7.proto protobuf-3.6.1.3/benchmarks/datasets/google_message3/benchmark_message3_7.proto --- protobuf-3.0.0/benchmarks/datasets/google_message3/benchmark_message3_7.proto 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/benchmarks/datasets/google_message3/benchmark_message3_7.proto 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,56 @@ +syntax = "proto2"; + +package benchmarks.google_message3; + +option cc_enable_arenas = true; +option java_package = "com.google.protobuf.benchmarks"; + +message Message11018 { +} + +message Message10800 { + optional string field10808 = 1; + optional int64 field10809 = 2; + optional bool field10810 = 3; + optional float field10811 = 4; +} + +message Message10802 { +} + +message Message10748 { + optional string field10750 = 1; + optional int32 field10751 = 2; + optional int32 field10752 = 3; + optional int32 field10753 = 4; +} + +message Message7966 { + optional string field7969 = 1; + optional bool field7970 = 2; +} + +message Message708 { + optional .benchmarks.google_message3.Message741 field823 = 1; + repeated string field824 = 6; + optional string field825 = 2; + optional string field826 = 3; + repeated string field827 = 4; + repeated string field828 = 5; +} + +message Message8942 { +} + +message Message11011 { + required bytes field11752 = 1; + required bytes field11753 = 2; +} + +message UnusedEmptyMessage { +} + +message Message741 { + repeated string field936 = 1; +} + diff -Nru protobuf-3.0.0/benchmarks/datasets/google_message3/benchmark_message3_8.proto protobuf-3.6.1.3/benchmarks/datasets/google_message3/benchmark_message3_8.proto --- protobuf-3.0.0/benchmarks/datasets/google_message3/benchmark_message3_8.proto 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/benchmarks/datasets/google_message3/benchmark_message3_8.proto 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,1900 @@ +syntax = "proto2"; + +package benchmarks.google_message3; + +option cc_enable_arenas = true; +option java_package = "com.google.protobuf.benchmarks"; + +enum Enum720 { + ENUM_VALUE721 = 1; + ENUM_VALUE722 = 2; +} + +enum Enum3476 { + ENUM_VALUE3477 = 0; + ENUM_VALUE3478 = 1; + ENUM_VALUE3479 = 2; + ENUM_VALUE3480 = 3; + ENUM_VALUE3481 = 4; + ENUM_VALUE3482 = 5; + ENUM_VALUE3483 = 6; + ENUM_VALUE3484 = 7; + ENUM_VALUE3485 = 8; + ENUM_VALUE3486 = 9; + ENUM_VALUE3487 = 10; + ENUM_VALUE3488 = 11; + ENUM_VALUE3489 = 12; + ENUM_VALUE3490 = 13; + ENUM_VALUE3491 = 14; + ENUM_VALUE3492 = 15; + ENUM_VALUE3493 = 16; + ENUM_VALUE3494 = 17; + ENUM_VALUE3495 = 18; + ENUM_VALUE3496 = 19; + ENUM_VALUE3497 = 20; + ENUM_VALUE3498 = 21; + ENUM_VALUE3499 = 22; + ENUM_VALUE3500 = 23; + ENUM_VALUE3501 = 24; + ENUM_VALUE3502 = 25; + ENUM_VALUE3503 = 26; + ENUM_VALUE3504 = 27; + ENUM_VALUE3505 = 28; + ENUM_VALUE3506 = 29; + ENUM_VALUE3507 = 30; + ENUM_VALUE3508 = 31; + ENUM_VALUE3509 = 32; + ENUM_VALUE3510 = 33; + ENUM_VALUE3511 = 34; + ENUM_VALUE3512 = 35; + ENUM_VALUE3513 = 36; + ENUM_VALUE3514 = 37; + ENUM_VALUE3515 = 38; + ENUM_VALUE3516 = 39; + ENUM_VALUE3517 = 40; + ENUM_VALUE3518 = 41; + ENUM_VALUE3519 = 42; + ENUM_VALUE3520 = 43; + ENUM_VALUE3521 = 44; + ENUM_VALUE3522 = 45; + ENUM_VALUE3523 = 46; + ENUM_VALUE3524 = 47; + ENUM_VALUE3525 = 48; + ENUM_VALUE3526 = 49; + ENUM_VALUE3527 = 50; + ENUM_VALUE3528 = 51; + ENUM_VALUE3529 = 52; + ENUM_VALUE3530 = 53; + ENUM_VALUE3531 = 54; + ENUM_VALUE3532 = 55; + ENUM_VALUE3533 = 56; + ENUM_VALUE3534 = 57; + ENUM_VALUE3535 = 58; + ENUM_VALUE3536 = 59; + ENUM_VALUE3537 = 60; + ENUM_VALUE3538 = 61; + ENUM_VALUE3539 = 62; + ENUM_VALUE3540 = 63; + ENUM_VALUE3541 = 64; + ENUM_VALUE3542 = 65; + ENUM_VALUE3543 = 66; + ENUM_VALUE3544 = 67; + ENUM_VALUE3545 = 68; + ENUM_VALUE3546 = 69; + ENUM_VALUE3547 = 70; + ENUM_VALUE3548 = 71; + ENUM_VALUE3549 = 72; + ENUM_VALUE3550 = 73; + ENUM_VALUE3551 = 74; + ENUM_VALUE3552 = 75; + ENUM_VALUE3553 = 76; + ENUM_VALUE3554 = 77; + ENUM_VALUE3555 = 78; + ENUM_VALUE3556 = 79; + ENUM_VALUE3557 = 80; + ENUM_VALUE3558 = 81; + ENUM_VALUE3559 = 82; + ENUM_VALUE3560 = 83; + ENUM_VALUE3561 = 84; + ENUM_VALUE3562 = 85; + ENUM_VALUE3563 = 86; + ENUM_VALUE3564 = 87; + ENUM_VALUE3565 = 88; + ENUM_VALUE3566 = 89; + ENUM_VALUE3567 = 90; + ENUM_VALUE3568 = 91; + ENUM_VALUE3569 = 92; + ENUM_VALUE3570 = 93; + ENUM_VALUE3571 = 94; + ENUM_VALUE3572 = 95; + ENUM_VALUE3573 = 96; + ENUM_VALUE3574 = 97; + ENUM_VALUE3575 = 98; + ENUM_VALUE3576 = 99; + ENUM_VALUE3577 = 100; + ENUM_VALUE3578 = 101; + ENUM_VALUE3579 = 102; + ENUM_VALUE3580 = 103; + ENUM_VALUE3581 = 104; + ENUM_VALUE3582 = 105; + ENUM_VALUE3583 = 106; + ENUM_VALUE3584 = 107; + ENUM_VALUE3585 = 108; + ENUM_VALUE3586 = 109; + ENUM_VALUE3587 = 110; + ENUM_VALUE3588 = 111; + ENUM_VALUE3589 = 112; + ENUM_VALUE3590 = 113; + ENUM_VALUE3591 = 114; + ENUM_VALUE3592 = 115; + ENUM_VALUE3593 = 116; + ENUM_VALUE3594 = 117; + ENUM_VALUE3595 = 118; + ENUM_VALUE3596 = 119; + ENUM_VALUE3597 = 120; + ENUM_VALUE3598 = 121; + ENUM_VALUE3599 = 122; + ENUM_VALUE3600 = 123; + ENUM_VALUE3601 = 124; + ENUM_VALUE3602 = 125; + ENUM_VALUE3603 = 126; + ENUM_VALUE3604 = 127; + ENUM_VALUE3605 = 128; + ENUM_VALUE3606 = 129; + ENUM_VALUE3607 = 130; + ENUM_VALUE3608 = 131; + ENUM_VALUE3609 = 132; + ENUM_VALUE3610 = 133; + ENUM_VALUE3611 = 134; + ENUM_VALUE3612 = 135; + ENUM_VALUE3613 = 136; + ENUM_VALUE3614 = 137; + ENUM_VALUE3615 = 138; + ENUM_VALUE3616 = 139; + ENUM_VALUE3617 = 140; + ENUM_VALUE3618 = 141; + ENUM_VALUE3619 = 142; + ENUM_VALUE3620 = 143; + ENUM_VALUE3621 = 144; + ENUM_VALUE3622 = 145; + ENUM_VALUE3623 = 146; + ENUM_VALUE3624 = 147; + ENUM_VALUE3625 = 148; + ENUM_VALUE3626 = 149; + ENUM_VALUE3627 = 150; + ENUM_VALUE3628 = 151; + ENUM_VALUE3629 = 152; + ENUM_VALUE3630 = 153; + ENUM_VALUE3631 = 154; + ENUM_VALUE3632 = 155; + ENUM_VALUE3633 = 156; + ENUM_VALUE3634 = 157; + ENUM_VALUE3635 = 158; + ENUM_VALUE3636 = 159; + ENUM_VALUE3637 = 160; + ENUM_VALUE3638 = 161; + ENUM_VALUE3639 = 162; + ENUM_VALUE3640 = 163; + ENUM_VALUE3641 = 164; + ENUM_VALUE3642 = 165; + ENUM_VALUE3643 = 166; + ENUM_VALUE3644 = 167; + ENUM_VALUE3645 = 168; + ENUM_VALUE3646 = 169; + ENUM_VALUE3647 = 170; + ENUM_VALUE3648 = 171; + ENUM_VALUE3649 = 172; + ENUM_VALUE3650 = 173; + ENUM_VALUE3651 = 174; + ENUM_VALUE3652 = 175; + ENUM_VALUE3653 = 176; + ENUM_VALUE3654 = 177; + ENUM_VALUE3655 = 178; + ENUM_VALUE3656 = 179; + ENUM_VALUE3657 = 180; + ENUM_VALUE3658 = 181; + ENUM_VALUE3659 = 182; + ENUM_VALUE3660 = 183; +} + +enum Enum3805 { + ENUM_VALUE3806 = 0; + ENUM_VALUE3807 = 1; + ENUM_VALUE3808 = 2; + ENUM_VALUE3809 = 3; + ENUM_VALUE3810 = 4; + ENUM_VALUE3811 = 5; + ENUM_VALUE3812 = 6; + ENUM_VALUE3813 = 7; + ENUM_VALUE3814 = 8; + ENUM_VALUE3815 = 9; + ENUM_VALUE3816 = 11; + ENUM_VALUE3817 = 10; +} + +enum Enum3783 { + ENUM_VALUE3784 = 0; + ENUM_VALUE3785 = 1; + ENUM_VALUE3786 = 2; + ENUM_VALUE3787 = 3; + ENUM_VALUE3788 = 4; + ENUM_VALUE3789 = 5; + ENUM_VALUE3790 = 6; + ENUM_VALUE3791 = 7; + ENUM_VALUE3792 = 8; + ENUM_VALUE3793 = 9; + ENUM_VALUE3794 = 10; + ENUM_VALUE3795 = 11; + ENUM_VALUE3796 = 12; + ENUM_VALUE3797 = 13; + ENUM_VALUE3798 = 14; + ENUM_VALUE3799 = 15; + ENUM_VALUE3800 = 16; + ENUM_VALUE3801 = 20; + ENUM_VALUE3802 = 21; + ENUM_VALUE3803 = 50; +} + +enum Enum3851 { + ENUM_VALUE3852 = 0; + ENUM_VALUE3853 = 1; + ENUM_VALUE3854 = 2; + ENUM_VALUE3855 = 3; + ENUM_VALUE3856 = 4; + ENUM_VALUE3857 = 5; + ENUM_VALUE3858 = 6; + ENUM_VALUE3859 = 7; + ENUM_VALUE3860 = 8; + ENUM_VALUE3861 = 9; + ENUM_VALUE3862 = 10; + ENUM_VALUE3863 = 11; + ENUM_VALUE3864 = 12; + ENUM_VALUE3865 = 13; + ENUM_VALUE3866 = 14; + ENUM_VALUE3867 = 15; + ENUM_VALUE3868 = 16; + ENUM_VALUE3869 = 17; +} + +enum UnusedEnum { + UNUSED_ENUM_VALUE1 = 0; + UNUSED_ENUM_VALUE2 = 1; +} + +enum Enum4146 { + ENUM_VALUE4147 = 0; + ENUM_VALUE4148 = 1; + ENUM_VALUE4149 = 2; + ENUM_VALUE4150 = 3; + ENUM_VALUE4151 = 4; +} + +enum Enum4160 { + ENUM_VALUE4161 = 0; + ENUM_VALUE4162 = 1; +} + +enum Enum4152 { + ENUM_VALUE4153 = 0; + ENUM_VALUE4154 = 1; + ENUM_VALUE4155 = 2; + ENUM_VALUE4156 = 3; + ENUM_VALUE4157 = 4; + ENUM_VALUE4158 = 5; + ENUM_VALUE4159 = 6; +} + +enum Enum6025 { + ENUM_VALUE6026 = 0; + ENUM_VALUE6027 = 1; + ENUM_VALUE6028 = 2; + ENUM_VALUE6029 = 3; + ENUM_VALUE6030 = 4; + ENUM_VALUE6031 = 5; + ENUM_VALUE6032 = 6; + ENUM_VALUE6033 = 7; + ENUM_VALUE6034 = 8; + ENUM_VALUE6035 = 9; + ENUM_VALUE6036 = 10; + ENUM_VALUE6037 = 11; + ENUM_VALUE6038 = 12; + ENUM_VALUE6039 = 13; + ENUM_VALUE6040 = 14; + ENUM_VALUE6041 = 15; + ENUM_VALUE6042 = 16; + ENUM_VALUE6043 = 17; + ENUM_VALUE6044 = 18; + ENUM_VALUE6045 = 19; + ENUM_VALUE6046 = 20; + ENUM_VALUE6047 = 21; +} + +enum Enum6065 { + ENUM_VALUE6066 = 0; + ENUM_VALUE6067 = 1; + ENUM_VALUE6068 = 2; + ENUM_VALUE6069 = 3; + ENUM_VALUE6070 = 4; + ENUM_VALUE6071 = 5; + ENUM_VALUE6072 = 6; + ENUM_VALUE6073 = 7; + ENUM_VALUE6074 = 8; + ENUM_VALUE6075 = 9; + ENUM_VALUE6076 = 10; + ENUM_VALUE6077 = 11; + ENUM_VALUE6078 = 12; + ENUM_VALUE6079 = 13; + ENUM_VALUE6080 = 14; +} + +enum Enum6579 { + ENUM_VALUE6580 = 0; + ENUM_VALUE6581 = 2; + ENUM_VALUE6582 = 3; + ENUM_VALUE6583 = 5; + ENUM_VALUE6584 = 10; + ENUM_VALUE6585 = 15; + ENUM_VALUE6586 = 25; + ENUM_VALUE6587 = 30; +} + +enum Enum6588 { + ENUM_VALUE6589 = 0; + ENUM_VALUE6590 = 1; + ENUM_VALUE6591 = 2; + ENUM_VALUE6592 = 3; + ENUM_VALUE6593 = 4; + ENUM_VALUE6594 = 5; + ENUM_VALUE6595 = 6; + ENUM_VALUE6596 = 7; + ENUM_VALUE6597 = 8; + ENUM_VALUE6598 = 9; + ENUM_VALUE6599 = 10; + ENUM_VALUE6600 = 11; + ENUM_VALUE6601 = 12; + ENUM_VALUE6602 = 13; + ENUM_VALUE6603 = 14; + ENUM_VALUE6604 = 15; + ENUM_VALUE6605 = 16; + ENUM_VALUE6606 = 17; + ENUM_VALUE6607 = 19; + ENUM_VALUE6608 = 20; + ENUM_VALUE6609 = 21; + ENUM_VALUE6610 = 22; + ENUM_VALUE6611 = 23; + ENUM_VALUE6612 = 24; + ENUM_VALUE6613 = 25; + ENUM_VALUE6614 = 26; + ENUM_VALUE6615 = 27; + ENUM_VALUE6616 = 28; + ENUM_VALUE6617 = 29; + ENUM_VALUE6618 = 30; + ENUM_VALUE6619 = 31; + ENUM_VALUE6620 = 32; + ENUM_VALUE6621 = 33; + ENUM_VALUE6622 = 34; +} + +enum Enum6769 { + ENUM_VALUE6770 = 0; + ENUM_VALUE6771 = 1; + ENUM_VALUE6772 = 2; +} + +enum Enum6774 { + ENUM_VALUE6775 = 0; + ENUM_VALUE6776 = 1; + ENUM_VALUE6777 = 2; + ENUM_VALUE6778 = 3; + ENUM_VALUE6779 = 4; + ENUM_VALUE6780 = 5; + ENUM_VALUE6781 = 6; +} + +enum Enum6782 { + ENUM_VALUE6783 = 0; + ENUM_VALUE6784 = 1; + ENUM_VALUE6785 = 2; + ENUM_VALUE6786 = 3; + ENUM_VALUE6787 = 4; + ENUM_VALUE6788 = 5; +} + +enum Enum6858 { + ENUM_VALUE6859 = 1; + ENUM_VALUE6860 = 2; + ENUM_VALUE6861 = 3; + ENUM_VALUE6862 = 4; +} + +enum Enum6815 { + ENUM_VALUE6816 = 0; + ENUM_VALUE6817 = 1; + ENUM_VALUE6818 = 2; + ENUM_VALUE6819 = 3; + ENUM_VALUE6820 = 4; + ENUM_VALUE6821 = 5; +} + +enum Enum6822 { + ENUM_VALUE6823 = 0; + ENUM_VALUE6824 = 1; + ENUM_VALUE6825 = 2; + ENUM_VALUE6826 = 3; +} + +enum Enum7654 { + ENUM_VALUE7655 = 1; + ENUM_VALUE7656 = 2; + ENUM_VALUE7657 = 3; +} + +enum Enum8292 { + ENUM_VALUE8293 = 0; + ENUM_VALUE8294 = 1; + ENUM_VALUE8295 = 2; +} + +enum Enum8450 { + ENUM_VALUE8451 = 0; + ENUM_VALUE8452 = 1; + ENUM_VALUE8453 = 2; +} + +enum Enum8900 { + ENUM_VALUE8901 = 0; + ENUM_VALUE8902 = 1; + ENUM_VALUE8903 = 2; + ENUM_VALUE8904 = 3; + ENUM_VALUE8905 = 4; +} + +enum Enum8945 { + ENUM_VALUE8946 = 0; + ENUM_VALUE8947 = 1; + ENUM_VALUE8948 = 2; + ENUM_VALUE8949 = 3; + ENUM_VALUE8950 = 4; +} + +enum Enum8951 { + ENUM_VALUE8952 = 1; + ENUM_VALUE8953 = 2; + ENUM_VALUE8954 = 3; + ENUM_VALUE8955 = 4; + ENUM_VALUE8956 = 5; + ENUM_VALUE8957 = 6; + ENUM_VALUE8958 = 7; + ENUM_VALUE8959 = 8; +} + +enum Enum9243 { + ENUM_VALUE9244 = -1; + ENUM_VALUE9245 = 0; + ENUM_VALUE9246 = 1; + ENUM_VALUE9247 = 2; + ENUM_VALUE9248 = 3; + ENUM_VALUE9249 = 4; + ENUM_VALUE9250 = 5; + ENUM_VALUE9251 = 6; + ENUM_VALUE9252 = 7; + ENUM_VALUE9253 = 8; + ENUM_VALUE9254 = 9; + ENUM_VALUE9255 = 10; + ENUM_VALUE9256 = 11; + ENUM_VALUE9257 = 12; + ENUM_VALUE9258 = 13; + ENUM_VALUE9259 = 14; + ENUM_VALUE9260 = 15; + ENUM_VALUE9261 = 16; + ENUM_VALUE9262 = 17; + ENUM_VALUE9263 = 71; + ENUM_VALUE9264 = 72; + ENUM_VALUE9265 = 73; + ENUM_VALUE9266 = 74; + ENUM_VALUE9267 = 18; + ENUM_VALUE9268 = 20; + ENUM_VALUE9269 = 21; + ENUM_VALUE9270 = 22; + ENUM_VALUE9271 = 23; + ENUM_VALUE9272 = 61; + ENUM_VALUE9273 = 62; + ENUM_VALUE9274 = 63; + ENUM_VALUE9275 = 64; + ENUM_VALUE9276 = 66; + ENUM_VALUE9277 = 67; + ENUM_VALUE9278 = 24; + ENUM_VALUE9279 = 25; + ENUM_VALUE9280 = 26; + ENUM_VALUE9281 = 27; + ENUM_VALUE9282 = 28; + ENUM_VALUE9283 = 29; + ENUM_VALUE9284 = 30; + ENUM_VALUE9285 = 31; + ENUM_VALUE9286 = 32; + ENUM_VALUE9287 = 33; + ENUM_VALUE9288 = 34; + ENUM_VALUE9289 = 35; + ENUM_VALUE9290 = 36; + ENUM_VALUE9291 = 37; + ENUM_VALUE9292 = 38; + ENUM_VALUE9293 = 39; + ENUM_VALUE9294 = 40; + ENUM_VALUE9295 = 41; + ENUM_VALUE9296 = 42; + ENUM_VALUE9297 = 43; + ENUM_VALUE9298 = 44; + ENUM_VALUE9299 = 45; + ENUM_VALUE9300 = 46; + ENUM_VALUE9301 = 47; + ENUM_VALUE9302 = 48; + ENUM_VALUE9303 = 49; + ENUM_VALUE9304 = 50; + ENUM_VALUE9305 = 51; + ENUM_VALUE9306 = 52; + ENUM_VALUE9307 = 53; + ENUM_VALUE9308 = 54; + ENUM_VALUE9309 = 55; + ENUM_VALUE9310 = 56; + ENUM_VALUE9311 = 57; + ENUM_VALUE9312 = 58; + ENUM_VALUE9313 = 59; + ENUM_VALUE9314 = 60; + ENUM_VALUE9315 = 68; + ENUM_VALUE9316 = 69; + ENUM_VALUE9317 = 70; + ENUM_VALUE9318 = 1000; + ENUM_VALUE9319 = 1001; + ENUM_VALUE9320 = 1002; + ENUM_VALUE9321 = 1003; + ENUM_VALUE9322 = 1004; + ENUM_VALUE9323 = 1005; + ENUM_VALUE9324 = 1006; + ENUM_VALUE9325 = 1007; + ENUM_VALUE9326 = 65; +} + +enum Enum10157 { + ENUM_VALUE10158 = 0; + ENUM_VALUE10159 = 1; + ENUM_VALUE10160 = 2; + ENUM_VALUE10161 = 3; + ENUM_VALUE10162 = 4; + ENUM_VALUE10163 = 5; + ENUM_VALUE10164 = 6; + ENUM_VALUE10165 = 7; + ENUM_VALUE10166 = 8; +} + +enum Enum10167 { + ENUM_VALUE10168 = 0; + ENUM_VALUE10169 = 1; + ENUM_VALUE10170 = 2; + ENUM_VALUE10171 = 3; + ENUM_VALUE10172 = 4; + ENUM_VALUE10173 = 5; + ENUM_VALUE10174 = 6; + ENUM_VALUE10175 = 7; + ENUM_VALUE10176 = 8; +} + +enum Enum8862 { + ENUM_VALUE8863 = 0; + ENUM_VALUE8864 = 1; + ENUM_VALUE8865 = 2; + ENUM_VALUE8866 = 3; + ENUM_VALUE8867 = 4; + ENUM_VALUE8868 = 5; + ENUM_VALUE8869 = 6; + ENUM_VALUE8870 = 7; + ENUM_VALUE8871 = 13; + ENUM_VALUE8872 = 14; + ENUM_VALUE8873 = 8; + ENUM_VALUE8874 = 9; + ENUM_VALUE8875 = 10; + ENUM_VALUE8876 = 11; + ENUM_VALUE8877 = 12; + ENUM_VALUE8878 = 15; +} + +enum Enum10325 { + ENUM_VALUE10326 = 0; + ENUM_VALUE10327 = 1; + ENUM_VALUE10328 = 2; + ENUM_VALUE10329 = 3; + ENUM_VALUE10330 = 4; + ENUM_VALUE10331 = 5; + ENUM_VALUE10332 = 6; + ENUM_VALUE10333 = 7; + ENUM_VALUE10334 = 8; +} + +enum Enum10335 { + ENUM_VALUE10336 = 0; +} + +enum Enum10337 { + ENUM_VALUE10338 = 0; + ENUM_VALUE10339 = 1; +} + +enum Enum10392 { + ENUM_VALUE10393 = 0; + ENUM_VALUE10394 = 1; + ENUM_VALUE10395 = 2; + ENUM_VALUE10396 = 3; + ENUM_VALUE10397 = 4; + ENUM_VALUE10398 = 5; + ENUM_VALUE10399 = 6; + ENUM_VALUE10400 = 7; + ENUM_VALUE10401 = 8; + ENUM_VALUE10402 = 15; + ENUM_VALUE10403 = 9; + ENUM_VALUE10404 = 10; + ENUM_VALUE10405 = 11; + ENUM_VALUE10406 = 12; + ENUM_VALUE10407 = 13; + ENUM_VALUE10408 = 14; + ENUM_VALUE10409 = 101; + ENUM_VALUE10410 = 102; +} + +enum Enum11107 { + ENUM_VALUE11108 = 0; + ENUM_VALUE11109 = 1; + ENUM_VALUE11110 = 2; + ENUM_VALUE11111 = 3; + ENUM_VALUE11112 = 4; + ENUM_VALUE11113 = 5; + ENUM_VALUE11114 = 6; + ENUM_VALUE11115 = 7; + ENUM_VALUE11116 = 8; + ENUM_VALUE11117 = 9; + ENUM_VALUE11118 = 10; + ENUM_VALUE11119 = 11; + ENUM_VALUE11120 = 12; + ENUM_VALUE11121 = 13; + ENUM_VALUE11122 = 14; + ENUM_VALUE11123 = 15; + ENUM_VALUE11124 = 16; + ENUM_VALUE11125 = 17; + ENUM_VALUE11126 = 18; + ENUM_VALUE11127 = 19; + ENUM_VALUE11128 = 20; + ENUM_VALUE11129 = 21; + ENUM_VALUE11130 = 22; + ENUM_VALUE11131 = 23; + ENUM_VALUE11132 = 24; + ENUM_VALUE11133 = 25; + ENUM_VALUE11134 = 26; + ENUM_VALUE11135 = 27; + ENUM_VALUE11136 = 28; + ENUM_VALUE11137 = 29; + ENUM_VALUE11138 = 30; + ENUM_VALUE11139 = 31; + ENUM_VALUE11140 = 32; + ENUM_VALUE11141 = 33; + ENUM_VALUE11142 = 34; + ENUM_VALUE11143 = 35; + ENUM_VALUE11144 = 36; + ENUM_VALUE11145 = 37; + ENUM_VALUE11146 = 38; + ENUM_VALUE11147 = 39; + ENUM_VALUE11148 = 40; + ENUM_VALUE11149 = 41; + ENUM_VALUE11150 = 42; + ENUM_VALUE11151 = 43; + ENUM_VALUE11152 = 44; + ENUM_VALUE11153 = 45; + ENUM_VALUE11154 = 46; + ENUM_VALUE11155 = 47; + ENUM_VALUE11156 = 48; + ENUM_VALUE11157 = 49; + ENUM_VALUE11158 = 50; + ENUM_VALUE11159 = 51; + ENUM_VALUE11160 = 52; + ENUM_VALUE11161 = 53; + ENUM_VALUE11162 = 54; + ENUM_VALUE11163 = 55; + ENUM_VALUE11164 = 56; + ENUM_VALUE11165 = 57; + ENUM_VALUE11166 = 58; + ENUM_VALUE11167 = 59; + ENUM_VALUE11168 = 60; + ENUM_VALUE11169 = 61; + ENUM_VALUE11170 = 62; + ENUM_VALUE11171 = 63; + ENUM_VALUE11172 = 64; + ENUM_VALUE11173 = 65; + ENUM_VALUE11174 = 66; + ENUM_VALUE11175 = 67; + ENUM_VALUE11176 = 68; + ENUM_VALUE11177 = 69; + ENUM_VALUE11178 = 70; + ENUM_VALUE11179 = 71; + ENUM_VALUE11180 = 72; + ENUM_VALUE11181 = 73; + ENUM_VALUE11182 = 74; + ENUM_VALUE11183 = 75; + ENUM_VALUE11184 = 76; + ENUM_VALUE11185 = 77; + ENUM_VALUE11186 = 78; + ENUM_VALUE11187 = 79; + ENUM_VALUE11188 = 80; + ENUM_VALUE11189 = 81; + ENUM_VALUE11190 = 82; + ENUM_VALUE11191 = 83; + ENUM_VALUE11192 = 84; + ENUM_VALUE11193 = 85; + ENUM_VALUE11194 = 86; + ENUM_VALUE11195 = 87; + ENUM_VALUE11196 = 88; + ENUM_VALUE11197 = 89; + ENUM_VALUE11198 = 90; + ENUM_VALUE11199 = 91; + ENUM_VALUE11200 = 92; + ENUM_VALUE11201 = 93; + ENUM_VALUE11202 = 94; + ENUM_VALUE11203 = 95; + ENUM_VALUE11204 = 96; + ENUM_VALUE11205 = 97; + ENUM_VALUE11206 = 98; + ENUM_VALUE11207 = 99; + ENUM_VALUE11208 = 100; + ENUM_VALUE11209 = 101; + ENUM_VALUE11210 = 102; + ENUM_VALUE11211 = 103; + ENUM_VALUE11212 = 104; + ENUM_VALUE11213 = 105; + ENUM_VALUE11214 = 106; + ENUM_VALUE11215 = 107; + ENUM_VALUE11216 = 108; + ENUM_VALUE11217 = 109; + ENUM_VALUE11218 = 110; + ENUM_VALUE11219 = 111; + ENUM_VALUE11220 = 112; + ENUM_VALUE11221 = 113; + ENUM_VALUE11222 = 114; + ENUM_VALUE11223 = 115; + ENUM_VALUE11224 = 116; + ENUM_VALUE11225 = 117; + ENUM_VALUE11226 = 118; + ENUM_VALUE11227 = 119; + ENUM_VALUE11228 = 120; + ENUM_VALUE11229 = 121; + ENUM_VALUE11230 = 122; + ENUM_VALUE11231 = 123; + ENUM_VALUE11232 = 124; + ENUM_VALUE11233 = 125; + ENUM_VALUE11234 = 126; + ENUM_VALUE11235 = 127; + ENUM_VALUE11236 = 128; + ENUM_VALUE11237 = 129; + ENUM_VALUE11238 = 130; + ENUM_VALUE11239 = 131; + ENUM_VALUE11240 = 132; + ENUM_VALUE11241 = 133; + ENUM_VALUE11242 = 134; + ENUM_VALUE11243 = 135; + ENUM_VALUE11244 = 136; + ENUM_VALUE11245 = 137; + ENUM_VALUE11246 = 138; + ENUM_VALUE11247 = 139; + ENUM_VALUE11248 = 140; + ENUM_VALUE11249 = 141; + ENUM_VALUE11250 = 142; + ENUM_VALUE11251 = 143; + ENUM_VALUE11252 = 144; + ENUM_VALUE11253 = 145; + ENUM_VALUE11254 = 146; + ENUM_VALUE11255 = 147; + ENUM_VALUE11256 = 148; + ENUM_VALUE11257 = 149; + ENUM_VALUE11258 = 150; + ENUM_VALUE11259 = 151; + ENUM_VALUE11260 = 152; + ENUM_VALUE11261 = 153; + ENUM_VALUE11262 = 154; + ENUM_VALUE11263 = 155; + ENUM_VALUE11264 = 156; + ENUM_VALUE11265 = 157; + ENUM_VALUE11266 = 158; + ENUM_VALUE11267 = 159; + ENUM_VALUE11268 = 160; + ENUM_VALUE11269 = 161; + ENUM_VALUE11270 = 163; + ENUM_VALUE11271 = 164; + ENUM_VALUE11272 = 165; + ENUM_VALUE11273 = 166; + ENUM_VALUE11274 = 167; + ENUM_VALUE11275 = 168; + ENUM_VALUE11276 = 169; + ENUM_VALUE11277 = 170; + ENUM_VALUE11278 = 171; + ENUM_VALUE11279 = 172; + ENUM_VALUE11280 = 173; + ENUM_VALUE11281 = 174; + ENUM_VALUE11282 = 175; + ENUM_VALUE11283 = 176; + ENUM_VALUE11284 = 177; + ENUM_VALUE11285 = 178; + ENUM_VALUE11286 = 179; + ENUM_VALUE11287 = 180; + ENUM_VALUE11288 = 181; + ENUM_VALUE11289 = 182; + ENUM_VALUE11290 = 183; + ENUM_VALUE11291 = 184; + ENUM_VALUE11292 = 185; + ENUM_VALUE11293 = 187; + ENUM_VALUE11294 = 188; + ENUM_VALUE11295 = 189; + ENUM_VALUE11296 = 190; + ENUM_VALUE11297 = 191; + ENUM_VALUE11298 = 192; + ENUM_VALUE11299 = 193; + ENUM_VALUE11300 = 194; + ENUM_VALUE11301 = 195; + ENUM_VALUE11302 = 196; + ENUM_VALUE11303 = 197; + ENUM_VALUE11304 = 198; + ENUM_VALUE11305 = 65535; + ENUM_VALUE11306 = 65536; + ENUM_VALUE11307 = 65537; + ENUM_VALUE11308 = 65538; + ENUM_VALUE11309 = 65539; + ENUM_VALUE11310 = 65540; + ENUM_VALUE11311 = 65541; + ENUM_VALUE11312 = 65542; + ENUM_VALUE11313 = 65543; + ENUM_VALUE11314 = 65544; + ENUM_VALUE11315 = 65545; + ENUM_VALUE11316 = 65546; + ENUM_VALUE11317 = 65547; + ENUM_VALUE11318 = 65548; + ENUM_VALUE11319 = 65549; + ENUM_VALUE11320 = 65550; + ENUM_VALUE11321 = 65551; + ENUM_VALUE11322 = 65552; + ENUM_VALUE11323 = 65553; + ENUM_VALUE11324 = 65554; + ENUM_VALUE11325 = 65555; + ENUM_VALUE11326 = 65556; + ENUM_VALUE11327 = 65557; + ENUM_VALUE11328 = 65558; + ENUM_VALUE11329 = 65559; + ENUM_VALUE11330 = 65560; + ENUM_VALUE11331 = 65561; + ENUM_VALUE11332 = 65562; + ENUM_VALUE11333 = 65563; + ENUM_VALUE11334 = 69632; + ENUM_VALUE11335 = 69633; + ENUM_VALUE11336 = 69634; + ENUM_VALUE11337 = 69635; + ENUM_VALUE11338 = 69636; + ENUM_VALUE11339 = 69637; + ENUM_VALUE11340 = 69638; + ENUM_VALUE11341 = 69639; + ENUM_VALUE11342 = 69640; + ENUM_VALUE11343 = 69641; + ENUM_VALUE11344 = 69642; + ENUM_VALUE11345 = 69643; + ENUM_VALUE11346 = 69644; + ENUM_VALUE11347 = 69645; + ENUM_VALUE11348 = 69646; + ENUM_VALUE11349 = 69647; + ENUM_VALUE11350 = 69648; + ENUM_VALUE11351 = 69649; + ENUM_VALUE11352 = 69650; + ENUM_VALUE11353 = 69651; + ENUM_VALUE11354 = 69652; + ENUM_VALUE11355 = 69653; + ENUM_VALUE11356 = 69654; + ENUM_VALUE11357 = 69655; + ENUM_VALUE11358 = 69656; + ENUM_VALUE11359 = 69657; + ENUM_VALUE11360 = 69658; + ENUM_VALUE11361 = 69659; + ENUM_VALUE11362 = 69660; + ENUM_VALUE11363 = 69661; + ENUM_VALUE11364 = 69662; + ENUM_VALUE11365 = 73728; + ENUM_VALUE11366 = 73729; + ENUM_VALUE11367 = 77824; + ENUM_VALUE11368 = 77825; + ENUM_VALUE11369 = 81920; + ENUM_VALUE11370 = 81921; + ENUM_VALUE11371 = 81922; + ENUM_VALUE11372 = 81923; + ENUM_VALUE11373 = 86016; + ENUM_VALUE11374 = 86017; + ENUM_VALUE11375 = 86018; + ENUM_VALUE11376 = 86019; + ENUM_VALUE11377 = 86020; + ENUM_VALUE11378 = 86021; + ENUM_VALUE11379 = 86022; + ENUM_VALUE11380 = 86023; + ENUM_VALUE11381 = 86024; + ENUM_VALUE11382 = 86025; + ENUM_VALUE11383 = 86026; + ENUM_VALUE11384 = 86027; + ENUM_VALUE11385 = 86028; + ENUM_VALUE11386 = 86029; + ENUM_VALUE11387 = 86030; + ENUM_VALUE11388 = 86031; + ENUM_VALUE11389 = 86032; + ENUM_VALUE11390 = 86033; + ENUM_VALUE11391 = 86034; + ENUM_VALUE11392 = 86035; + ENUM_VALUE11393 = 86036; + ENUM_VALUE11394 = 86037; + ENUM_VALUE11395 = 86038; + ENUM_VALUE11396 = 86039; + ENUM_VALUE11397 = 86040; + ENUM_VALUE11398 = 86041; + ENUM_VALUE11399 = 86042; + ENUM_VALUE11400 = 86043; + ENUM_VALUE11401 = 86044; + ENUM_VALUE11402 = 86045; + ENUM_VALUE11403 = 86046; + ENUM_VALUE11404 = 86047; + ENUM_VALUE11405 = 86048; + ENUM_VALUE11406 = 86049; + ENUM_VALUE11407 = 86050; + ENUM_VALUE11408 = 86051; + ENUM_VALUE11409 = 86052; + ENUM_VALUE11410 = 86053; + ENUM_VALUE11411 = 86054; + ENUM_VALUE11412 = 86055; + ENUM_VALUE11413 = 86056; + ENUM_VALUE11414 = 86057; + ENUM_VALUE11415 = 86058; + ENUM_VALUE11416 = 86059; + ENUM_VALUE11417 = 86060; + ENUM_VALUE11418 = 86061; + ENUM_VALUE11419 = 86062; + ENUM_VALUE11420 = 86063; + ENUM_VALUE11421 = 86064; + ENUM_VALUE11422 = 86065; + ENUM_VALUE11423 = 86066; + ENUM_VALUE11424 = 86067; + ENUM_VALUE11425 = 86068; + ENUM_VALUE11426 = 86069; + ENUM_VALUE11427 = 86070; + ENUM_VALUE11428 = 86071; + ENUM_VALUE11429 = 86072; + ENUM_VALUE11430 = 86073; + ENUM_VALUE11431 = 86074; + ENUM_VALUE11432 = 86077; + ENUM_VALUE11433 = 86078; + ENUM_VALUE11434 = 86079; + ENUM_VALUE11435 = 86080; + ENUM_VALUE11436 = 86081; + ENUM_VALUE11437 = 86082; + ENUM_VALUE11438 = 86083; + ENUM_VALUE11439 = 86084; + ENUM_VALUE11440 = 90112; + ENUM_VALUE11441 = 94208; + ENUM_VALUE11442 = 94209; + ENUM_VALUE11443 = 94210; + ENUM_VALUE11444 = 94211; + ENUM_VALUE11445 = 94212; + ENUM_VALUE11446 = 94213; + ENUM_VALUE11447 = 94214; + ENUM_VALUE11448 = 94215; + ENUM_VALUE11449 = 94216; + ENUM_VALUE11450 = 94217; + ENUM_VALUE11451 = 94218; + ENUM_VALUE11452 = 94219; + ENUM_VALUE11453 = 94220; + ENUM_VALUE11454 = 94221; + ENUM_VALUE11455 = 94222; + ENUM_VALUE11456 = 94223; + ENUM_VALUE11457 = 94224; + ENUM_VALUE11458 = 98304; + ENUM_VALUE11459 = 98305; + ENUM_VALUE11460 = 98306; + ENUM_VALUE11461 = 98307; + ENUM_VALUE11462 = 98308; + ENUM_VALUE11463 = 102400; + ENUM_VALUE11464 = 131072; + ENUM_VALUE11465 = 131073; + ENUM_VALUE11466 = 135168; + ENUM_VALUE11467 = 9439507; +} + +enum Enum11541 { + ENUM_VALUE11542 = -1; + ENUM_VALUE11543 = 0; + ENUM_VALUE11544 = 1; + ENUM_VALUE11545 = 2; + ENUM_VALUE11546 = 3; + ENUM_VALUE11547 = 4; + ENUM_VALUE11548 = 5; + ENUM_VALUE11549 = 6; + ENUM_VALUE11550 = 7; + ENUM_VALUE11551 = 8; + ENUM_VALUE11552 = 9; + ENUM_VALUE11553 = 10; + ENUM_VALUE11554 = 11; + ENUM_VALUE11555 = 12; + ENUM_VALUE11556 = 13; + ENUM_VALUE11557 = 14; + ENUM_VALUE11558 = 15; + ENUM_VALUE11559 = 16; + ENUM_VALUE11560 = 17; + ENUM_VALUE11561 = 18; + ENUM_VALUE11562 = 19; + ENUM_VALUE11563 = 20; + ENUM_VALUE11564 = 21; + ENUM_VALUE11565 = 22; + ENUM_VALUE11566 = 23; + ENUM_VALUE11567 = 24; + ENUM_VALUE11568 = 25; + ENUM_VALUE11569 = 26; + ENUM_VALUE11570 = 27; + ENUM_VALUE11571 = 28; + ENUM_VALUE11572 = 29; + ENUM_VALUE11573 = 30; + ENUM_VALUE11574 = 31; + ENUM_VALUE11575 = 32; + ENUM_VALUE11576 = 33; + ENUM_VALUE11577 = 34; + ENUM_VALUE11578 = 35; + ENUM_VALUE11579 = 36; + ENUM_VALUE11580 = 37; + ENUM_VALUE11581 = 38; + ENUM_VALUE11582 = 39; + ENUM_VALUE11583 = 40; + ENUM_VALUE11584 = 41; + ENUM_VALUE11585 = 42; + ENUM_VALUE11586 = 43; + ENUM_VALUE11587 = 44; + ENUM_VALUE11588 = 45; + ENUM_VALUE11589 = 46; + ENUM_VALUE11590 = 47; + ENUM_VALUE11591 = 48; + ENUM_VALUE11592 = 49; + ENUM_VALUE11593 = 50; + ENUM_VALUE11594 = 51; + ENUM_VALUE11595 = 52; + ENUM_VALUE11596 = 53; + ENUM_VALUE11597 = 54; + ENUM_VALUE11598 = 55; + ENUM_VALUE11599 = 56; + ENUM_VALUE11600 = 57; + ENUM_VALUE11601 = 58; + ENUM_VALUE11602 = 59; + ENUM_VALUE11603 = 60; + ENUM_VALUE11604 = 61; + ENUM_VALUE11605 = 62; + ENUM_VALUE11606 = 63; + ENUM_VALUE11607 = 64; + ENUM_VALUE11608 = 65; + ENUM_VALUE11609 = 66; + ENUM_VALUE11610 = 67; + ENUM_VALUE11611 = 68; + ENUM_VALUE11612 = 69; + ENUM_VALUE11613 = 70; + ENUM_VALUE11614 = 71; + ENUM_VALUE11615 = 72; + ENUM_VALUE11616 = 73; + ENUM_VALUE11617 = 74; + ENUM_VALUE11618 = 75; + ENUM_VALUE11619 = 76; + ENUM_VALUE11620 = 77; + ENUM_VALUE11621 = 78; + ENUM_VALUE11622 = 79; + ENUM_VALUE11623 = 80; + ENUM_VALUE11624 = 81; + ENUM_VALUE11625 = 82; + ENUM_VALUE11626 = 83; + ENUM_VALUE11627 = 84; + ENUM_VALUE11628 = 85; + ENUM_VALUE11629 = 86; + ENUM_VALUE11630 = 87; + ENUM_VALUE11631 = 88; + ENUM_VALUE11632 = 89; + ENUM_VALUE11633 = 90; + ENUM_VALUE11634 = 91; + ENUM_VALUE11635 = 92; + ENUM_VALUE11636 = 93; + ENUM_VALUE11637 = 94; + ENUM_VALUE11638 = 95; + ENUM_VALUE11639 = 96; + ENUM_VALUE11640 = 97; + ENUM_VALUE11641 = 98; + ENUM_VALUE11642 = 99; + ENUM_VALUE11643 = 100; + ENUM_VALUE11644 = 101; + ENUM_VALUE11645 = 102; + ENUM_VALUE11646 = 103; + ENUM_VALUE11647 = 104; + ENUM_VALUE11648 = 105; + ENUM_VALUE11649 = 106; + ENUM_VALUE11650 = 107; + ENUM_VALUE11651 = 108; + ENUM_VALUE11652 = 109; + ENUM_VALUE11653 = 110; + ENUM_VALUE11654 = 111; + ENUM_VALUE11655 = 112; + ENUM_VALUE11656 = 113; + ENUM_VALUE11657 = 114; + ENUM_VALUE11658 = 115; + ENUM_VALUE11659 = 116; + ENUM_VALUE11660 = 117; + ENUM_VALUE11661 = 118; + ENUM_VALUE11662 = 119; + ENUM_VALUE11663 = 120; + ENUM_VALUE11664 = 121; + ENUM_VALUE11665 = 122; + ENUM_VALUE11666 = 123; + ENUM_VALUE11667 = 124; + ENUM_VALUE11668 = 125; + ENUM_VALUE11669 = 126; + ENUM_VALUE11670 = 127; + ENUM_VALUE11671 = 128; + ENUM_VALUE11672 = 129; + ENUM_VALUE11673 = 130; + ENUM_VALUE11674 = 131; + ENUM_VALUE11675 = 132; + ENUM_VALUE11676 = 133; + ENUM_VALUE11677 = 134; + ENUM_VALUE11678 = 135; + ENUM_VALUE11679 = 136; + ENUM_VALUE11680 = 137; + ENUM_VALUE11681 = 138; + ENUM_VALUE11682 = 139; + ENUM_VALUE11683 = 140; + ENUM_VALUE11684 = 141; + ENUM_VALUE11685 = 142; + ENUM_VALUE11686 = 143; + ENUM_VALUE11687 = 144; + ENUM_VALUE11688 = 145; + ENUM_VALUE11689 = 146; + ENUM_VALUE11690 = 147; + ENUM_VALUE11691 = 148; + ENUM_VALUE11692 = 149; + ENUM_VALUE11693 = 150; + ENUM_VALUE11694 = 151; + ENUM_VALUE11695 = 152; + ENUM_VALUE11696 = 153; + ENUM_VALUE11697 = 154; + ENUM_VALUE11698 = 155; + ENUM_VALUE11699 = 156; + ENUM_VALUE11700 = 157; + ENUM_VALUE11701 = 158; + ENUM_VALUE11702 = 159; + ENUM_VALUE11703 = 160; + ENUM_VALUE11704 = 161; + ENUM_VALUE11705 = 162; + ENUM_VALUE11706 = 163; + ENUM_VALUE11707 = 164; + ENUM_VALUE11708 = 165; + ENUM_VALUE11709 = 166; + ENUM_VALUE11710 = 167; + ENUM_VALUE11711 = 168; + ENUM_VALUE11712 = 169; + ENUM_VALUE11713 = 170; + ENUM_VALUE11714 = 171; + ENUM_VALUE11715 = 172; + ENUM_VALUE11716 = 173; + ENUM_VALUE11717 = 174; + ENUM_VALUE11718 = 175; + ENUM_VALUE11719 = 176; + ENUM_VALUE11720 = 177; + ENUM_VALUE11721 = 178; + ENUM_VALUE11722 = 179; + ENUM_VALUE11723 = 180; + ENUM_VALUE11724 = 181; + ENUM_VALUE11725 = 182; + ENUM_VALUE11726 = 183; + ENUM_VALUE11727 = 184; + ENUM_VALUE11728 = 185; + ENUM_VALUE11729 = 186; + ENUM_VALUE11730 = 187; + ENUM_VALUE11731 = 188; + ENUM_VALUE11732 = 16777215; +} + +enum Enum11468 { + ENUM_VALUE11469 = -99; + ENUM_VALUE11470 = 0; + ENUM_VALUE11471 = 1; + ENUM_VALUE11472 = 2; + ENUM_VALUE11473 = 3; + ENUM_VALUE11474 = 4; + ENUM_VALUE11475 = 28; + ENUM_VALUE11476 = 22; + ENUM_VALUE11477 = 38; + ENUM_VALUE11478 = 512; + ENUM_VALUE11479 = 2048; + ENUM_VALUE11480 = 66; + ENUM_VALUE11481 = 578; + ENUM_VALUE11482 = 77; + ENUM_VALUE11483 = 88; + ENUM_VALUE11484 = 100; + ENUM_VALUE11485 = 110; + ENUM_VALUE11486 = 2158; + ENUM_VALUE11487 = 122; + ENUM_VALUE11488 = 2170; + ENUM_VALUE11489 = 144; + ENUM_VALUE11490 = 244; + ENUM_VALUE11491 = 2292; + ENUM_VALUE11492 = 44; +} + +enum Enum11022 { + ENUM_VALUE11023 = 0; + ENUM_VALUE11024 = 1; + ENUM_VALUE11025 = 2; + ENUM_VALUE11026 = 3; + ENUM_VALUE11027 = 4; + ENUM_VALUE11028 = 5; + ENUM_VALUE11029 = 6; + ENUM_VALUE11030 = 7; + ENUM_VALUE11031 = 8; + ENUM_VALUE11032 = 9; + ENUM_VALUE11033 = 10; + ENUM_VALUE11034 = 11; + ENUM_VALUE11035 = 12; + ENUM_VALUE11036 = 13; + ENUM_VALUE11037 = 14; + ENUM_VALUE11038 = 15; + ENUM_VALUE11039 = 16; + ENUM_VALUE11040 = 17; + ENUM_VALUE11041 = 18; + ENUM_VALUE11042 = 19; + ENUM_VALUE11043 = 20; + ENUM_VALUE11044 = 21; + ENUM_VALUE11045 = 22; + ENUM_VALUE11046 = 23; + ENUM_VALUE11047 = 24; + ENUM_VALUE11048 = 25; + ENUM_VALUE11049 = 26; + ENUM_VALUE11050 = 27; + ENUM_VALUE11051 = 28; + ENUM_VALUE11052 = 29; + ENUM_VALUE11053 = 30; + ENUM_VALUE11054 = 31; + ENUM_VALUE11055 = 32; + ENUM_VALUE11056 = 33; + ENUM_VALUE11057 = 34; + ENUM_VALUE11058 = 35; + ENUM_VALUE11059 = 36; + ENUM_VALUE11060 = 37; + ENUM_VALUE11061 = 38; + ENUM_VALUE11062 = 39; + ENUM_VALUE11063 = 40; + ENUM_VALUE11064 = 41; + ENUM_VALUE11065 = 42; + ENUM_VALUE11066 = 43; + ENUM_VALUE11067 = 44; + ENUM_VALUE11068 = 45; + ENUM_VALUE11069 = 46; + ENUM_VALUE11070 = 47; + ENUM_VALUE11071 = 48; + ENUM_VALUE11072 = 49; + ENUM_VALUE11073 = 50; + ENUM_VALUE11074 = 51; + ENUM_VALUE11075 = 52; + ENUM_VALUE11076 = 53; + ENUM_VALUE11077 = 54; + ENUM_VALUE11078 = 55; + ENUM_VALUE11079 = 56; + ENUM_VALUE11080 = 57; + ENUM_VALUE11081 = 58; + ENUM_VALUE11082 = 59; + ENUM_VALUE11083 = 60; + ENUM_VALUE11084 = 61; + ENUM_VALUE11085 = 62; + ENUM_VALUE11086 = 63; + ENUM_VALUE11087 = 64; + ENUM_VALUE11088 = 65; + ENUM_VALUE11089 = 66; + ENUM_VALUE11090 = 67; + ENUM_VALUE11091 = 68; + ENUM_VALUE11092 = 69; + ENUM_VALUE11093 = 70; + ENUM_VALUE11094 = 71; + ENUM_VALUE11095 = 72; + ENUM_VALUE11096 = 73; + ENUM_VALUE11097 = 74; + ENUM_VALUE11098 = 75; + ENUM_VALUE11099 = 76; + ENUM_VALUE11100 = 77; + ENUM_VALUE11101 = 78; + ENUM_VALUE11102 = 79; + ENUM_VALUE11103 = 80; + ENUM_VALUE11104 = 81; + ENUM_VALUE11105 = 82; + ENUM_VALUE11106 = 83; +} + +enum Enum12670 { + ENUM_VALUE12671 = 0; + ENUM_VALUE12672 = 1; + ENUM_VALUE12673 = 2; +} + +enum Enum12871 { + ENUM_VALUE12872 = 1; + ENUM_VALUE12873 = 2; + ENUM_VALUE12874 = 3; + ENUM_VALUE12875 = 4; + ENUM_VALUE12876 = 5; + ENUM_VALUE12877 = 6; +} + +enum Enum13092 { + ENUM_VALUE13093 = 1; + ENUM_VALUE13094 = 2; + ENUM_VALUE13095 = 3; +} + +enum Enum13146 { + ENUM_VALUE13147 = 0; + ENUM_VALUE13148 = 1; + ENUM_VALUE13149 = 2; + ENUM_VALUE13150 = 3; +} + +enum Enum16042 { + ENUM_VALUE16043 = 0; + ENUM_VALUE16044 = 1; + ENUM_VALUE16045 = 17; + ENUM_VALUE16046 = 273; + ENUM_VALUE16047 = 274; + ENUM_VALUE16048 = 4385; + ENUM_VALUE16049 = 4386; + ENUM_VALUE16050 = 4387; + ENUM_VALUE16051 = 4388; + ENUM_VALUE16052 = 4389; + ENUM_VALUE16053 = 4390; + ENUM_VALUE16054 = 4391; + ENUM_VALUE16055 = 4392; + ENUM_VALUE16056 = 4393; + ENUM_VALUE16057 = 276; + ENUM_VALUE16058 = 277; + ENUM_VALUE16059 = 18; + ENUM_VALUE16060 = 289; + ENUM_VALUE16061 = 291; + ENUM_VALUE16062 = 4657; + ENUM_VALUE16063 = 74513; + ENUM_VALUE16064 = 4658; + ENUM_VALUE16065 = 4659; + ENUM_VALUE16066 = 4660; + ENUM_VALUE16067 = 4661; + ENUM_VALUE16068 = 4662; + ENUM_VALUE16069 = 4663; + ENUM_VALUE16070 = 4664; + ENUM_VALUE16071 = 292; + ENUM_VALUE16072 = 4673; + ENUM_VALUE16073 = 4674; + ENUM_VALUE16074 = 293; + ENUM_VALUE16075 = 19; + ENUM_VALUE16076 = 20; + ENUM_VALUE16077 = 321; + ENUM_VALUE16078 = 5137; + ENUM_VALUE16079 = 5138; + ENUM_VALUE16080 = 5139; + ENUM_VALUE16081 = 5140; + ENUM_VALUE16082 = 5141; + ENUM_VALUE16083 = 5142; + ENUM_VALUE16084 = 82273; + ENUM_VALUE16085 = 82274; + ENUM_VALUE16086 = 82275; + ENUM_VALUE16087 = 82276; + ENUM_VALUE16088 = 82277; + ENUM_VALUE16089 = 82278; + ENUM_VALUE16090 = 5143; + ENUM_VALUE16091 = 5144; + ENUM_VALUE16092 = 5145; + ENUM_VALUE16093 = 5146; + ENUM_VALUE16094 = 82337; + ENUM_VALUE16095 = 5147; + ENUM_VALUE16096 = 5148; + ENUM_VALUE16097 = 322; + ENUM_VALUE16098 = 323; + ENUM_VALUE16099 = 324; + ENUM_VALUE16100 = 325; + ENUM_VALUE16101 = 326; + ENUM_VALUE16102 = 327; + ENUM_VALUE16103 = 328; + ENUM_VALUE16104 = 21; + ENUM_VALUE16105 = 337; + ENUM_VALUE16106 = 22; + ENUM_VALUE16107 = 23; + ENUM_VALUE16108 = 24; + ENUM_VALUE16109 = 2; + ENUM_VALUE16110 = 33; + ENUM_VALUE16111 = 34; + ENUM_VALUE16112 = 545; + ENUM_VALUE16113 = 8721; + ENUM_VALUE16114 = 8723; + ENUM_VALUE16115 = 8724; + ENUM_VALUE16116 = 546; + ENUM_VALUE16117 = 8739; + ENUM_VALUE16118 = 8740; + ENUM_VALUE16119 = 547; + ENUM_VALUE16120 = 548; + ENUM_VALUE16121 = 549; + ENUM_VALUE16122 = 550; + ENUM_VALUE16123 = 551; + ENUM_VALUE16124 = 552; + ENUM_VALUE16125 = 553; + ENUM_VALUE16126 = 35; + ENUM_VALUE16127 = 36; + ENUM_VALUE16128 = 37; + ENUM_VALUE16129 = 593; + ENUM_VALUE16130 = 594; + ENUM_VALUE16131 = 595; + ENUM_VALUE16132 = 596; + ENUM_VALUE16133 = 597; + ENUM_VALUE16134 = 38; + ENUM_VALUE16135 = 609; + ENUM_VALUE16136 = 610; + ENUM_VALUE16137 = 617; + ENUM_VALUE16138 = 614; + ENUM_VALUE16139 = 615; + ENUM_VALUE16140 = 616; + ENUM_VALUE16141 = 618; + ENUM_VALUE16142 = 620; + ENUM_VALUE16143 = 9937; + ENUM_VALUE16144 = 9938; + ENUM_VALUE16145 = 9939; + ENUM_VALUE16146 = 9940; + ENUM_VALUE16147 = 9941; + ENUM_VALUE16148 = 39; + ENUM_VALUE16149 = 40; + ENUM_VALUE16150 = 41; + ENUM_VALUE16151 = 42; + ENUM_VALUE16152 = 43; + ENUM_VALUE16153 = 44; + ENUM_VALUE16154 = 45; + ENUM_VALUE16155 = 11793; + ENUM_VALUE16156 = 3; + ENUM_VALUE16157 = 49; + ENUM_VALUE16158 = 50; + ENUM_VALUE16159 = 51; + ENUM_VALUE16160 = 817; + ENUM_VALUE16161 = 818; + ENUM_VALUE16162 = 819; + ENUM_VALUE16163 = 52; + ENUM_VALUE16164 = 833; + ENUM_VALUE16165 = 53; + ENUM_VALUE16166 = 54; + ENUM_VALUE16167 = 4; + ENUM_VALUE16168 = 1041; + ENUM_VALUE16169 = 16657; + ENUM_VALUE16170 = 16658; + ENUM_VALUE16171 = 16659; + ENUM_VALUE16172 = 16660; + ENUM_VALUE16173 = 16661; + ENUM_VALUE16174 = 1042; + ENUM_VALUE16175 = 16673; + ENUM_VALUE16176 = 1043; + ENUM_VALUE16177 = 16689; + ENUM_VALUE16178 = 16690; + ENUM_VALUE16179 = 16691; + ENUM_VALUE16180 = 16692; + ENUM_VALUE16181 = 16693; + ENUM_VALUE16182 = 16694; + ENUM_VALUE16183 = 16695; + ENUM_VALUE16184 = 1044; + ENUM_VALUE16185 = 16705; + ENUM_VALUE16186 = 16706; + ENUM_VALUE16187 = 16707; + ENUM_VALUE16188 = 16708; + ENUM_VALUE16189 = 16709; + ENUM_VALUE16190 = 16710; + ENUM_VALUE16191 = 16711; + ENUM_VALUE16192 = 16712; + ENUM_VALUE16193 = 16713; + ENUM_VALUE16194 = 1046; + ENUM_VALUE16195 = 16737; + ENUM_VALUE16196 = 1047; + ENUM_VALUE16197 = 16753; + ENUM_VALUE16198 = 268049; + ENUM_VALUE16199 = 268050; + ENUM_VALUE16200 = 268051; + ENUM_VALUE16201 = 268052; + ENUM_VALUE16202 = 1048; + ENUM_VALUE16203 = 16769; + ENUM_VALUE16204 = 16770; + ENUM_VALUE16205 = 16771; + ENUM_VALUE16206 = 16772; + ENUM_VALUE16207 = 16773; + ENUM_VALUE16208 = 1049; + ENUM_VALUE16209 = 1056; + ENUM_VALUE16210 = 1058; + ENUM_VALUE16211 = 1059; + ENUM_VALUE16212 = 1060; + ENUM_VALUE16213 = 1061; + ENUM_VALUE16214 = 5; + ENUM_VALUE16215 = 6; + ENUM_VALUE16216 = 97; + ENUM_VALUE16217 = 98; + ENUM_VALUE16218 = 99; + ENUM_VALUE16219 = 100; + ENUM_VALUE16220 = 101; + ENUM_VALUE16221 = 102; + ENUM_VALUE16222 = 103; + ENUM_VALUE16223 = 104; + ENUM_VALUE16224 = 105; + ENUM_VALUE16225 = 106; + ENUM_VALUE16226 = 108; + ENUM_VALUE16227 = 1729; + ENUM_VALUE16228 = 1730; + ENUM_VALUE16229 = 1731; + ENUM_VALUE16230 = 7; + ENUM_VALUE16231 = 8; + ENUM_VALUE16232 = 9; + ENUM_VALUE16233 = 10; + ENUM_VALUE16234 = 161; + ENUM_VALUE16235 = 2577; + ENUM_VALUE16236 = 41233; + ENUM_VALUE16237 = 41234; + ENUM_VALUE16238 = 2578; + ENUM_VALUE16239 = 2579; + ENUM_VALUE16240 = 41265; + ENUM_VALUE16241 = 2580; + ENUM_VALUE16242 = 2581; + ENUM_VALUE16243 = 41297; + ENUM_VALUE16244 = 41298; + ENUM_VALUE16245 = 41299; + ENUM_VALUE16246 = 41300; + ENUM_VALUE16247 = 2582; + ENUM_VALUE16248 = 2583; + ENUM_VALUE16249 = 2584; + ENUM_VALUE16250 = 162; + ENUM_VALUE16251 = 2593; + ENUM_VALUE16252 = 41489; + ENUM_VALUE16253 = 663825; + ENUM_VALUE16254 = 663826; + ENUM_VALUE16255 = 41490; + ENUM_VALUE16256 = 41491; + ENUM_VALUE16257 = 41492; + ENUM_VALUE16258 = 663873; + ENUM_VALUE16259 = 2594; + ENUM_VALUE16260 = 41505; + ENUM_VALUE16261 = 41506; + ENUM_VALUE16262 = 41507; + ENUM_VALUE16263 = 2595; + ENUM_VALUE16264 = 41521; + ENUM_VALUE16265 = 41522; + ENUM_VALUE16266 = 41523; + ENUM_VALUE16267 = 41524; + ENUM_VALUE16268 = 41525; + ENUM_VALUE16269 = 664401; + ENUM_VALUE16270 = 664402; + ENUM_VALUE16271 = 41526; + ENUM_VALUE16272 = 41527; + ENUM_VALUE16273 = 2596; + ENUM_VALUE16274 = 2597; + ENUM_VALUE16275 = 2598; + ENUM_VALUE16276 = 41569; + ENUM_VALUE16277 = 41570; + ENUM_VALUE16278 = 41571; + ENUM_VALUE16279 = 41572; + ENUM_VALUE16280 = 41573; + ENUM_VALUE16281 = 665169; + ENUM_VALUE16282 = 665170; + ENUM_VALUE16283 = 665171; + ENUM_VALUE16284 = 665172; + ENUM_VALUE16285 = 2599; + ENUM_VALUE16286 = 2600; + ENUM_VALUE16287 = 2601; + ENUM_VALUE16288 = 2603; + ENUM_VALUE16289 = 2604; + ENUM_VALUE16290 = 163; + ENUM_VALUE16291 = 2608; + ENUM_VALUE16292 = 2609; + ENUM_VALUE16293 = 2610; + ENUM_VALUE16294 = 2611; + ENUM_VALUE16295 = 2612; + ENUM_VALUE16296 = 164; + ENUM_VALUE16297 = 2625; + ENUM_VALUE16298 = 2626; + ENUM_VALUE16299 = 42017; + ENUM_VALUE16300 = 42018; + ENUM_VALUE16301 = 42019; + ENUM_VALUE16302 = 2627; + ENUM_VALUE16303 = 2628; + ENUM_VALUE16304 = 165; + ENUM_VALUE16305 = 2641; + ENUM_VALUE16306 = 42257; + ENUM_VALUE16307 = 42258; + ENUM_VALUE16308 = 2642; + ENUM_VALUE16309 = 2643; + ENUM_VALUE16310 = 2644; + ENUM_VALUE16311 = 2646; + ENUM_VALUE16312 = 2647; + ENUM_VALUE16313 = 42353; + ENUM_VALUE16314 = 2648; + ENUM_VALUE16315 = 2649; + ENUM_VALUE16316 = 2650; + ENUM_VALUE16317 = 2651; + ENUM_VALUE16318 = 2652; + ENUM_VALUE16319 = 2653; + ENUM_VALUE16320 = 2654; + ENUM_VALUE16321 = 42481; + ENUM_VALUE16322 = 42482; + ENUM_VALUE16323 = 42483; + ENUM_VALUE16324 = 166; + ENUM_VALUE16325 = 2657; + ENUM_VALUE16326 = 2658; + ENUM_VALUE16327 = 42529; + ENUM_VALUE16328 = 2659; + ENUM_VALUE16329 = 2660; + ENUM_VALUE16330 = 2661; + ENUM_VALUE16331 = 2662; + ENUM_VALUE16332 = 2663; + ENUM_VALUE16333 = 42609; + ENUM_VALUE16334 = 2664; + ENUM_VALUE16335 = 2665; + ENUM_VALUE16336 = 42753; + ENUM_VALUE16337 = 42754; + ENUM_VALUE16338 = 42755; + ENUM_VALUE16339 = 11; + ENUM_VALUE16340 = 177; + ENUM_VALUE16341 = 2833; + ENUM_VALUE16342 = 179; + ENUM_VALUE16343 = 180; + ENUM_VALUE16344 = 2881; + ENUM_VALUE16345 = 182; + ENUM_VALUE16346 = 183; + ENUM_VALUE16347 = 12; + ENUM_VALUE16348 = 3089; + ENUM_VALUE16349 = 194; + ENUM_VALUE16350 = 195; + ENUM_VALUE16351 = 196; + ENUM_VALUE16352 = 198; + ENUM_VALUE16353 = 3169; + ENUM_VALUE16354 = 199; + ENUM_VALUE16355 = 200; + ENUM_VALUE16356 = 208; + ENUM_VALUE16357 = 3329; + ENUM_VALUE16358 = 3330; + ENUM_VALUE16359 = 3331; + ENUM_VALUE16360 = 209; + ENUM_VALUE16361 = 210; + ENUM_VALUE16362 = 211; + ENUM_VALUE16363 = 3377; + ENUM_VALUE16364 = 3378; + ENUM_VALUE16365 = 3379; + ENUM_VALUE16366 = 3380; + ENUM_VALUE16367 = 3381; + ENUM_VALUE16368 = 865809; + ENUM_VALUE16369 = 865810; + ENUM_VALUE16370 = 865811; + ENUM_VALUE16371 = 865812; + ENUM_VALUE16372 = 865813; + ENUM_VALUE16373 = 865814; + ENUM_VALUE16374 = 865815; + ENUM_VALUE16375 = 865816; + ENUM_VALUE16376 = 865817; + ENUM_VALUE16377 = 865818; + ENUM_VALUE16378 = 865819; + ENUM_VALUE16379 = 865820; + ENUM_VALUE16380 = 865821; + ENUM_VALUE16381 = 865822; + ENUM_VALUE16382 = 865823; + ENUM_VALUE16383 = 865824; + ENUM_VALUE16384 = 865825; + ENUM_VALUE16385 = 865826; + ENUM_VALUE16386 = 865827; + ENUM_VALUE16387 = 865828; + ENUM_VALUE16388 = 865829; + ENUM_VALUE16389 = 212; + ENUM_VALUE16390 = 3393; + ENUM_VALUE16391 = 3394; + ENUM_VALUE16392 = 3395; + ENUM_VALUE16393 = 213; + ENUM_VALUE16394 = 214; + ENUM_VALUE16395 = 215; + ENUM_VALUE16396 = 3441; + ENUM_VALUE16397 = 3442; + ENUM_VALUE16398 = 216; + ENUM_VALUE16399 = 217; + ENUM_VALUE16400 = 3473; + ENUM_VALUE16401 = 3474; + ENUM_VALUE16402 = 3475; + ENUM_VALUE16403 = 254; + ENUM_VALUE16404 = 255; +} + +enum Enum16553 { + ENUM_VALUE16554 = 0; + ENUM_VALUE16555 = 1; + ENUM_VALUE16556 = 2; + ENUM_VALUE16557 = 3; + ENUM_VALUE16558 = 4; + ENUM_VALUE16559 = 5; + ENUM_VALUE16560 = 6; + ENUM_VALUE16561 = 7; + ENUM_VALUE16562 = 8; + ENUM_VALUE16563 = 9; +} + +enum Enum16728 { + ENUM_VALUE16729 = 1; + ENUM_VALUE16730 = 2; + ENUM_VALUE16731 = 3; +} + +enum Enum16732 { + ENUM_VALUE16733 = 1; + ENUM_VALUE16734 = 2; + ENUM_VALUE16735 = 3; + ENUM_VALUE16736 = 4; + ENUM_VALUE16737 = 5; +} + +enum Enum16738 { + ENUM_VALUE16739 = 1; + ENUM_VALUE16740 = 2; + ENUM_VALUE16741 = 3; + ENUM_VALUE16742 = 4; + ENUM_VALUE16743 = 5; + ENUM_VALUE16744 = 6; + ENUM_VALUE16745 = 7; +} + +enum Enum16698 { + ENUM_VALUE16699 = -1; + ENUM_VALUE16700 = 100; + ENUM_VALUE16701 = 2; + ENUM_VALUE16702 = 0; + ENUM_VALUE16703 = 1; + ENUM_VALUE16704 = 4; + ENUM_VALUE16705 = 11; + ENUM_VALUE16706 = 12; + ENUM_VALUE16707 = 3; + ENUM_VALUE16708 = 5; + ENUM_VALUE16709 = 6; + ENUM_VALUE16710 = 7; + ENUM_VALUE16711 = 8; + ENUM_VALUE16712 = 9; + ENUM_VALUE16713 = 10; + ENUM_VALUE16714 = 13; + ENUM_VALUE16715 = 14; + ENUM_VALUE16716 = 15; + ENUM_VALUE16717 = 16; + ENUM_VALUE16718 = 18; + ENUM_VALUE16719 = 17; + ENUM_VALUE16720 = 19; + ENUM_VALUE16721 = 20; +} + +enum Enum16819 { + ENUM_VALUE16820 = 0; + ENUM_VALUE16821 = 1; + ENUM_VALUE16822 = 2; + ENUM_VALUE16823 = 3; + ENUM_VALUE16824 = 4; + ENUM_VALUE16825 = 5; +} + +enum Enum16925 { + ENUM_VALUE16926 = 0; + ENUM_VALUE16927 = 1; + ENUM_VALUE16928 = 2; + ENUM_VALUE16929 = 3; + ENUM_VALUE16930 = 4; + ENUM_VALUE16931 = 5; + ENUM_VALUE16932 = 6; + ENUM_VALUE16933 = 7; + ENUM_VALUE16934 = 8; + ENUM_VALUE16935 = 9; + ENUM_VALUE16936 = 10; + ENUM_VALUE16937 = 11; + ENUM_VALUE16938 = 12; + ENUM_VALUE16939 = 13; +} + +enum Enum22854 { + ENUM_VALUE22855 = 0; + ENUM_VALUE22856 = 1; +} + +enum Enum24361 { + ENUM_VALUE24362 = 0; + ENUM_VALUE24363 = 1; + ENUM_VALUE24364 = 2; + ENUM_VALUE24365 = 3; +} + +enum Enum16891 { + ENUM_VALUE16892 = 0; + ENUM_VALUE16893 = 1; + ENUM_VALUE16894 = 2; + ENUM_VALUE16895 = 3; + ENUM_VALUE16896 = 4; + ENUM_VALUE16897 = 5; + ENUM_VALUE16898 = 6; + ENUM_VALUE16899 = 7; + ENUM_VALUE16900 = 8; + ENUM_VALUE16901 = 9; + ENUM_VALUE16902 = 10; + ENUM_VALUE16903 = 11; + ENUM_VALUE16904 = 12; + ENUM_VALUE16905 = 13; + ENUM_VALUE16906 = 14; + ENUM_VALUE16907 = 15; + ENUM_VALUE16908 = 16; + ENUM_VALUE16909 = 17; + ENUM_VALUE16910 = 18; + ENUM_VALUE16911 = 19; + ENUM_VALUE16912 = 20; + ENUM_VALUE16913 = 21; + ENUM_VALUE16914 = 22; + ENUM_VALUE16915 = 23; + ENUM_VALUE16916 = 24; + ENUM_VALUE16917 = 25; + ENUM_VALUE16918 = 26; + ENUM_VALUE16919 = 27; + ENUM_VALUE16920 = 28; + ENUM_VALUE16921 = 29; + ENUM_VALUE16922 = 30; + ENUM_VALUE16923 = 31; +} + +enum Enum27361 { + ENUM_VALUE27362 = 0; + ENUM_VALUE27363 = 1; + ENUM_VALUE27364 = 2; + ENUM_VALUE27365 = 3; + ENUM_VALUE27366 = 4; +} + +enum Enum33960 { + ENUM_VALUE33961 = 0; + ENUM_VALUE33962 = 1; + ENUM_VALUE33963 = 2; + ENUM_VALUE33964 = 3; + ENUM_VALUE33965 = 4; + ENUM_VALUE33966 = 5; + ENUM_VALUE33967 = 6; +} + +enum Enum34388 { + ENUM_VALUE34389 = 1; +} + +enum Enum35477 { + ENUM_VALUE35478 = 4; + ENUM_VALUE35479 = 3; + ENUM_VALUE35480 = 2; + ENUM_VALUE35481 = 1; + ENUM_VALUE35482 = 0; +} + +enum Enum35507 { + ENUM_VALUE35508 = 0; + ENUM_VALUE35509 = 1; + ENUM_VALUE35510 = 2; + ENUM_VALUE35511 = 3; + ENUM_VALUE35512 = 4; + ENUM_VALUE35513 = 5; + ENUM_VALUE35514 = 6; + ENUM_VALUE35515 = 7; + ENUM_VALUE35516 = 8; + ENUM_VALUE35517 = 9; +} + +enum Enum36860 { + ENUM_VALUE36861 = 0; + ENUM_VALUE36862 = 1; + ENUM_VALUE36863 = 2; + ENUM_VALUE36864 = 3; + ENUM_VALUE36865 = 4; + ENUM_VALUE36866 = 5; + ENUM_VALUE36867 = 6; + ENUM_VALUE36868 = 7; +} + +enum Enum36890 { + ENUM_VALUE36891 = 0; + ENUM_VALUE36892 = 1; +} + diff -Nru protobuf-3.0.0/benchmarks/datasets/google_message3/benchmark_message3.proto protobuf-3.6.1.3/benchmarks/datasets/google_message3/benchmark_message3.proto --- protobuf-3.0.0/benchmarks/datasets/google_message3/benchmark_message3.proto 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/benchmarks/datasets/google_message3/benchmark_message3.proto 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,534 @@ +syntax = "proto2"; + +import "datasets/google_message3/benchmark_message3_1.proto"; +import "datasets/google_message3/benchmark_message3_2.proto"; +import "datasets/google_message3/benchmark_message3_3.proto"; +import "datasets/google_message3/benchmark_message3_4.proto"; +import "datasets/google_message3/benchmark_message3_5.proto"; +import "datasets/google_message3/benchmark_message3_7.proto"; +import "datasets/google_message3/benchmark_message3_8.proto"; +package benchmarks.google_message3; + +option cc_enable_arenas = true; +option java_package = "com.google.protobuf.benchmarks"; + +message GoogleMessage3 { + optional .benchmarks.google_message3.Message37487 field37519 = 2; + optional .benchmarks.google_message3.Message36876 field37520 = 3; + optional .benchmarks.google_message3.Message13062 field37521 = 4; + optional .benchmarks.google_message3.Message952 field37522 = 5; + optional .benchmarks.google_message3.UnusedEmptyMessage field37523 = 6; + optional .benchmarks.google_message3.UnusedEmptyMessage field37524 = 7; + optional .benchmarks.google_message3.UnusedEmptyMessage field37525 = 8; + optional .benchmarks.google_message3.UnusedEmptyMessage field37526 = 9; + optional .benchmarks.google_message3.UnusedEmptyMessage field37527 = 10; + optional .benchmarks.google_message3.UnusedEmptyMessage field37528 = 11; + optional .benchmarks.google_message3.UnusedEmptyMessage field37529 = 12; + optional .benchmarks.google_message3.UnusedEmptyMessage field37530 = 13; + optional .benchmarks.google_message3.UnusedEmptyMessage field37531 = 14; + optional .benchmarks.google_message3.UnusedEmptyMessage field37532 = 15; + optional .benchmarks.google_message3.UnusedEmptyMessage field37533 = 16; +} + +message Message1327 { + repeated .benchmarks.google_message3.UnusedEmptyMessage field1369 = 1; + repeated .benchmarks.google_message3.Message1328 field1370 = 3; + repeated .benchmarks.google_message3.UnusedEmptyMessage field1371 = 5; + repeated .benchmarks.google_message3.UnusedEmptyMessage field1372 = 6; + extend .benchmarks.google_message3.Message0 { + optional .benchmarks.google_message3.Message1327 field1373 = 23104162; + } +} + +message Message3672 { + optional .benchmarks.google_message3.Enum3476 field3727 = 1; + optional int32 field3728 = 11; + optional int32 field3729 = 2; + repeated group Message3673 = 3 { + required .benchmarks.google_message3.Enum3476 field3738 = 4; + required int32 field3739 = 5; + } + repeated group Message3674 = 6 { + required .benchmarks.google_message3.Enum3476 field3740 = 7; + required int32 field3741 = 8; + } + optional bool field3732 = 9; + optional int32 field3733 = 10; + optional .benchmarks.google_message3.Enum3476 field3734 = 20; + optional int32 field3735 = 21; + optional .benchmarks.google_message3.UnusedEmptyMessage field3736 = 50; + extend .benchmarks.google_message3.Message0 { + optional .benchmarks.google_message3.Message3672 field3737 = 3144435; + } +} + +message Message3804 { + required int64 field3818 = 1; + required bool field3819 = 2; + repeated .benchmarks.google_message3.Enum3805 field3820 = 4; + optional int32 field3821 = 5; + optional bool field3822 = 6; + optional int64 field3823 = 7; + optional .benchmarks.google_message3.Enum3783 field3824 = 8; + extend .benchmarks.google_message3.Message0 { + optional .benchmarks.google_message3.Message3804 field3825 = 59241828; + } +} + +message Message6849 { + repeated .benchmarks.google_message3.Message6850 field6910 = 1; + extend .benchmarks.google_message3.Message0 { + optional .benchmarks.google_message3.Message6849 field6911 = 107558455; + } +} + +message Message6866 { + repeated .benchmarks.google_message3.Message6863 field6973 = 1; + extend .benchmarks.google_message3.Message0 { + optional .benchmarks.google_message3.Message6866 field6974 = 22259060; + } +} + +message Message6870 { + repeated .benchmarks.google_message3.Message6871 field6991 = 1; + extend .benchmarks.google_message3.Message0 { + optional .benchmarks.google_message3.Message6870 field6992 = 90034652; + } +} + +message Message7651 { + optional string field7685 = 1; + optional int64 field7686 = 2; + optional int64 field7687 = 3; + optional int64 field7688 = 4; + optional int32 field7689 = 5; + optional int32 field7690 = 6; + optional int32 field7691 = 7; + optional int32 field7692 = 8; + optional int32 field7693 = 9; + optional int32 field7694 = 10; + optional int32 field7695 = 11; + optional int32 field7696 = 12; + optional int32 field7697 = 13; + optional int32 field7698 = 14; + optional int32 field7699 = 15; + optional int32 field7700 = 16; + optional int32 field7701 = 17; + optional int32 field7702 = 18; + optional bool field7703 = 19; + repeated int32 field7704 = 20; + repeated int32 field7705 = 21; + repeated string field7706 = 22; + repeated string field7707 = 23; + optional .benchmarks.google_message3.UnusedEmptyMessage field7708 = 24; + optional int32 field7709 = 25; + optional int32 field7710 = 26; + optional int32 field7711 = 27; + optional int32 field7712 = 43; + optional int32 field7713 = 28; + optional int32 field7714 = 29; + repeated .benchmarks.google_message3.Message7547 field7715 = 30; + repeated .benchmarks.google_message3.Message7547 field7716 = 31; + repeated .benchmarks.google_message3.UnusedEmptyMessage field7717 = 32; + repeated string field7718 = 33; + repeated string field7719 = 34; + repeated .benchmarks.google_message3.Message7648 field7720 = 35; + optional bool field7721 = 36; + optional bool field7722 = 37; + optional bool field7723 = 38; + optional bool field7724 = 39; + optional .benchmarks.google_message3.UnusedEmptyMessage field7725 = 40; + optional .benchmarks.google_message3.UnusedEnum field7726 = 41; + optional .benchmarks.google_message3.Enum7654 field7727 = 42; + optional string field7728 = 44; + optional .benchmarks.google_message3.UnusedEmptyMessage field7729 = 45; + extend .benchmarks.google_message3.Message0 { + optional .benchmarks.google_message3.Message7651 field7730 = 55876009; + } +} + +message Message7864 { + optional string field7866 = 1; + optional string field7867 = 2; + repeated .benchmarks.google_message3.Message7865 field7868 = 5; + repeated .benchmarks.google_message3.Message7865 field7869 = 6; + repeated .benchmarks.google_message3.Message7865 field7870 = 7; + repeated .benchmarks.google_message3.UnusedEmptyMessage field7871 = 8; + extend .benchmarks.google_message3.Message0 { + optional .benchmarks.google_message3.Message7864 field7872 = 44542730; + } +} + +message Message7929 { + optional int64 field7942 = 1; + optional int64 field7943 = 4; + optional int64 field7944 = 5; + optional int64 field7945 = 12; + optional int64 field7946 = 13; + optional int64 field7947 = 18; + optional int64 field7948 = 6; + optional int64 field7949 = 7; + repeated .benchmarks.google_message3.Message7919 field7950 = 8; + repeated .benchmarks.google_message3.UnusedEmptyMessage field7951 = 20; + repeated .benchmarks.google_message3.Message7920 field7952 = 14; + repeated .benchmarks.google_message3.Message7921 field7953 = 15; + repeated .benchmarks.google_message3.Message7928 field7954 = 17; + optional int64 field7955 = 19; + optional bool field7956 = 2; + optional int64 field7957 = 3; + optional int64 field7958 = 9; + repeated .benchmarks.google_message3.UnusedEmptyMessage field7959 = 10; + repeated bytes field7960 = 11; + optional int64 field7961 = 16; + extend .benchmarks.google_message3.Message0 { + optional .benchmarks.google_message3.Message7929 field7962 = 53392238; + } +} + +message Message8508 { + repeated .benchmarks.google_message3.Message8511 field8517 = 8; + repeated .benchmarks.google_message3.Message8512 field8518 = 9; + repeated .benchmarks.google_message3.Message8513 field8519 = 11; + optional bool field8520 = 13; + optional .benchmarks.google_message3.Message8514 field8521 = 14; + repeated .benchmarks.google_message3.UnusedEmptyMessage field8522 = 15; + repeated .benchmarks.google_message3.Message8515 field8523 = 16; + repeated .benchmarks.google_message3.UnusedEmptyMessage field8524 = 17; + optional int64 field8525 = 1; + optional float field8526 = 2; + optional int64 field8527 = 3; + optional int64 field8528 = 4; + optional int32 field8529 = 5; + optional bytes field8530 = 6; + repeated bytes field8531 = 7; + optional bool field8532 = 10; + optional bytes field8533 = 12; + extend .benchmarks.google_message3.Message0 { + optional .benchmarks.google_message3.Message8508 field8534 = 3811804; + } +} + +message Message9122 { + optional float field9132 = 1; + optional float field9133 = 2; + extend .benchmarks.google_message3.Message0 { + optional .benchmarks.google_message3.Message9122 field9134 = 120398939; + } +} + +message Message10177 { + repeated .benchmarks.google_message3.Message10155 field10270 = 1; + extend .benchmarks.google_message3.Message0 { + optional .benchmarks.google_message3.Message10177 field10271 = 26801105; + } +} + +message Message10278 { + repeated int32 field10286 = 1 [packed = true]; + repeated int32 field10287 = 2 [packed = true]; + optional int32 field10288 = 3; + extend .benchmarks.google_message3.Message10155 { + optional .benchmarks.google_message3.Message10278 field10289 = 29374161; + } +} + +message Message10323 { + repeated .benchmarks.google_message3.Message10320 field10360 = 1; + extend .benchmarks.google_message3.Message10155 { + optional .benchmarks.google_message3.Message10323 field10361 = 27922524; + } +} + +message Message10324 { + repeated .benchmarks.google_message3.Message10322 field10362 = 1; + optional .benchmarks.google_message3.Message10321 field10363 = 2; + extend .benchmarks.google_message3.Message10155 { + optional .benchmarks.google_message3.Message10324 field10364 = 27832297; + } +} + +message Message11990 { + repeated .benchmarks.google_message3.Message11988 field12030 = 1; + extend .benchmarks.google_message3.Message0 { + optional .benchmarks.google_message3.Message11990 field12031 = 21265426; + } +} + +message Message12691 { + optional string field12713 = 1; + optional int32 field12714 = 2; + optional .benchmarks.google_message3.Message12668 field12715 = 3; + extend .benchmarks.google_message3.Message0 { + optional .benchmarks.google_message3.Message12691 field12716 = 28426536; + } +} + +message Message12870 { + required int32 field12879 = 1; + optional int32 field12880 = 7; + required int32 field12881 = 2; + optional uint64 field12882 = 3; + optional string field12883 = 2001; + optional fixed64 field12884 = 4; + repeated fixed64 field12885 = 14; + optional int32 field12886 = 9; + optional int64 field12887 = 18; + repeated .benchmarks.google_message3.Message12870 field12888 = 8; + optional int32 field12889 = 5; + optional uint64 field12890 = 6; + optional int32 field12891 = 10; + optional int32 field12892 = 11; + optional double field12893 = 12; + optional .benchmarks.google_message3.Message12825 field12894 = 13; + optional double field12895 = 15; + optional string field12896 = 16; + optional .benchmarks.google_message3.Enum12871 field12897 = 17; + optional int32 field12898 = 19; + extend .benchmarks.google_message3.Message0 { + optional .benchmarks.google_message3.Message12870 field12899 = 5447656; + } +} + +message Message13154 { + required float field13164 = 1; + required float field13165 = 2; + extend .benchmarks.google_message3.Message13145 { + optional .benchmarks.google_message3.Message13154 field13166 = 47301086; + } +} + +message Message16507 { + optional bool field16510 = 3; + optional bool field16511 = 4; + optional bool field16512 = 14; + repeated string field16513 = 5; + repeated string field16514 = 6; + optional string field16515 = 8; + repeated int32 field16516 = 9; + repeated int32 field16517 = 10; + optional int32 field16518 = 7; + optional string field16519 = 15; + repeated string field16520 = 11; + repeated .benchmarks.google_message3.UnusedEmptyMessage field16521 = 27; + repeated .benchmarks.google_message3.UnusedEmptyMessage field16522 = 22; + repeated .benchmarks.google_message3.UnusedEmptyMessage field16523 = 28; + optional string field16524 = 18; + optional int32 field16525 = 19; + optional int32 field16526 = 20; + optional .benchmarks.google_message3.UnusedEmptyMessage field16527 = 23; + optional bool field16528 = 24; + repeated string field16529 = 25; + optional double field16530 = 26; + optional .benchmarks.google_message3.Message16478 field16531 = 30; + optional bool field16532 = 31; + optional string field16533 = 32; + optional bool field16534 = 33; + optional bool field16535 = 35; + optional bool field16536 = 36; + optional bool field16537 = 37; + optional bool field16538 = 38; + optional bool field16539 = 39; + optional bool field16540 = 40; + repeated string field16541 = 41; + extensions 21 to 21; + extend .benchmarks.google_message3.Message0 { + optional .benchmarks.google_message3.Message16507 field16542 = 5569941; + } +} + +message Message16564 { + repeated .benchmarks.google_message3.Message16552 field16568 = 1; + extend .benchmarks.google_message3.Message0 { + optional .benchmarks.google_message3.Message16564 field16569 = 25830030; + } +} + +message Message16661 { + repeated .benchmarks.google_message3.Message16660 field16671 = 1; + repeated uint64 field16672 = 2; + extend .benchmarks.google_message3.Message0 { + optional .benchmarks.google_message3.Message16661 field16673 = 31274398; + } +} + +message Message16746 { + repeated .benchmarks.google_message3.Message16727 field16806 = 1; + optional bool field16807 = 2; + optional bool field16808 = 3; + repeated .benchmarks.google_message3.Message16725 field16809 = 4; + extend .benchmarks.google_message3.Message0 { + optional .benchmarks.google_message3.Message16746 field16810 = 28406765; + } +} + +message Message17786 { + repeated group Message17787 = 1 { + required int32 field18177 = 2; + required int32 field18178 = 3; + optional .benchmarks.google_message3.Message17783 field18179 = 4; + optional .benchmarks.google_message3.UnusedEmptyMessage field18180 = 5; + optional .benchmarks.google_message3.UnusedEmptyMessage field18181 = 6; + repeated .benchmarks.google_message3.UnusedEmptyMessage field18182 = 8; + optional .benchmarks.google_message3.UnusedEmptyMessage field18183 = 9; + optional .benchmarks.google_message3.Message17726 field18184 = 10; + optional .benchmarks.google_message3.UnusedEmptyMessage field18185 = 11; + optional .benchmarks.google_message3.Message16945 field18186 = 102; + optional .benchmarks.google_message3.UnusedEmptyMessage field18187 = 12; + optional .benchmarks.google_message3.UnusedEmptyMessage field18188 = 13; + optional .benchmarks.google_message3.UnusedEmptyMessage field18189 = 7; + optional .benchmarks.google_message3.UnusedEmptyMessage field18190 = 100; + optional .benchmarks.google_message3.UnusedEmptyMessage field18191 = 101; + optional .benchmarks.google_message3.UnusedEmptyMessage field18192 = 14; + optional .benchmarks.google_message3.UnusedEmptyMessage field18193 = 19; + optional .benchmarks.google_message3.UnusedEmptyMessage field18194 = 22; + optional .benchmarks.google_message3.UnusedEmptyMessage field18195 = 24; + optional .benchmarks.google_message3.Enum16925 field18196 = 21; + optional bool field18197 = 18; + repeated .benchmarks.google_message3.UnusedEnum field18198 = 23; + optional .benchmarks.google_message3.UnusedEmptyMessage field18199 = 15; + optional string field18200 = 16; + optional string field18201 = 17; + optional bool field18202 = 99; + } + repeated .benchmarks.google_message3.Message17782 field18175 = 20; + extend .benchmarks.google_message3.Message0 { + optional .benchmarks.google_message3.Message17786 field18176 = 11823055; + } +} + +message Message22857 { + repeated .benchmarks.google_message3.Message22853 field22874 = 1; + extend .benchmarks.google_message3.Message10155 { + optional .benchmarks.google_message3.Message22857 field22875 = 67799715; + } +} + +message Message24404 { + repeated group Message24405 = 1 { + required int32 field24686 = 2; + required int32 field24687 = 3; + optional .benchmarks.google_message3.Message24317 field24688 = 4; + optional .benchmarks.google_message3.UnusedEmptyMessage field24689 = 5; + optional .benchmarks.google_message3.Message24376 field24690 = 6; + optional .benchmarks.google_message3.Message24345 field24691 = 7; + optional .benchmarks.google_message3.UnusedEmptyMessage field24692 = 8; + optional .benchmarks.google_message3.Message24379 field24693 = 9; + optional .benchmarks.google_message3.UnusedEmptyMessage field24694 = 10; + optional .benchmarks.google_message3.UnusedEmptyMessage field24695 = 11; + optional .benchmarks.google_message3.Message24391 field24696 = 12; + optional .benchmarks.google_message3.UnusedEmptyMessage field24697 = 13; + optional .benchmarks.google_message3.UnusedEmptyMessage field24698 = 14; + optional .benchmarks.google_message3.UnusedEmptyMessage field24699 = 22; + optional .benchmarks.google_message3.UnusedEmptyMessage field24700 = 23; + optional .benchmarks.google_message3.UnusedEmptyMessage field24701 = 25; + optional .benchmarks.google_message3.Enum16925 field24702 = 18; + optional float field24703 = 20; + optional bool field24704 = 19; + repeated .benchmarks.google_message3.Enum16891 field24705 = 24; + optional .benchmarks.google_message3.UnusedEmptyMessage field24706 = 15; + optional string field24707 = 16; + optional string field24708 = 17; + optional float field24709 = 21; + optional bool field24710 = 26; + optional .benchmarks.google_message3.UnusedEnum field24711 = 27; + optional bool field24712 = 28; + optional .benchmarks.google_message3.UnusedEnum field24713 = 29; + optional bool field24714 = 31; + optional bool field24715 = 99; + optional int64 field24716 = 32; + } + optional .benchmarks.google_message3.Message24403 field24684 = 30; + extend .benchmarks.google_message3.Message0 { + optional .benchmarks.google_message3.Message24404 field24685 = 9129287; + } +} + +message Message27300 { + repeated .benchmarks.google_message3.UnusedEmptyMessage field27302 = 1; + optional string field27303 = 2; + extend .benchmarks.google_message3.Message0 { + optional .benchmarks.google_message3.Message27300 field27304 = 24956467; + } +} + +message Message27453 { + optional string field27459 = 15; + repeated string field27460 = 1; + repeated float field27461 = 6; + repeated int32 field27462 = 27; + repeated int32 field27463 = 28; + repeated .benchmarks.google_message3.Message27454 field27464 = 24; + repeated string field27465 = 2; + repeated float field27466 = 7; + repeated string field27467 = 22; + repeated string field27468 = 23; + optional string field27469 = 26; + repeated .benchmarks.google_message3.Message27357 field27470 = 8; + optional .benchmarks.google_message3.Message27360 field27471 = 16; + optional string field27472 = 25; + optional string field27473 = 11; + optional bool field27474 = 13; + optional bool field27475 = 14; + optional bool field27476 = 17; + optional .benchmarks.google_message3.UnusedEmptyMessage field27477 = 12; + optional bool field27478 = 34268945; + optional bool field27479 = 20; + optional string field27480 = 21; + optional .benchmarks.google_message3.UnusedEmptyMessage field27481 = 10; + extend .benchmarks.google_message3.Message0 { + optional .benchmarks.google_message3.Message27453 field27482 = 8086204; + } +} + +extend .benchmarks.google_message3.Message16945 { + optional string field17026 = 472; + repeated string field17027 = 818; + optional .benchmarks.google_message3.Message0 field17031 = 215; + repeated .benchmarks.google_message3.Message0 field17032 = 292; + repeated .benchmarks.google_message3.Message0 field17038 = 234; + repeated .benchmarks.google_message3.Message0 field17039 = 235; + optional .benchmarks.google_message3.Message0 field17042 = 246; + optional string field17043 = 224; + optional string field17044 = 225; + repeated string field17048 = 63; + repeated string field17049 = 64; + repeated .benchmarks.google_message3.Message0 field17052 = 233; + repeated .benchmarks.google_message3.Message0 field17053 = 66; + repeated string field17056 = 275; + optional string field17057 = 226; + repeated .benchmarks.google_message3.Message0 field17060 = 27; + repeated string field17073 = 75; + repeated .benchmarks.google_message3.Message0 field17076 = 77; + repeated string field17078 = 296; + repeated .benchmarks.google_message3.Message0 field17082 = 160; + repeated .benchmarks.google_message3.Message0 field17091 = 585; + repeated .benchmarks.google_message3.Message0 field17098 = 987; + repeated .benchmarks.google_message3.Message0 field17101 = 157; + repeated string field17102 = 158; + repeated string field17107 = 166; + repeated string field17133 = 567; + repeated string field17134 = 572; + repeated string field17160 = 49; + repeated string field17168 = 32; + repeated string field17170 = 34; + repeated .benchmarks.google_message3.Message0 field17172 = 509; + repeated string field17174 = 39; + repeated .benchmarks.google_message3.Message0 field17175 = 40; + repeated .benchmarks.google_message3.Message0 field17178 = 511; + repeated .benchmarks.google_message3.Message0 field17185 = 50; + repeated int32 field17207 = 1081; + repeated .benchmarks.google_message3.Message0 field17238 = 184; + repeated .benchmarks.google_message3.Message0 field17289 = 177; + repeated .benchmarks.google_message3.Message0 field17290 = 178; + repeated .benchmarks.google_message3.Message0 field17296 = 474; + repeated string field17298 = 44; + repeated .benchmarks.google_message3.Message0 field17301 = 47; + optional .benchmarks.google_message3.Message0 field17412 = 21; + repeated .benchmarks.google_message3.Message0 field17438 = 132; + repeated .benchmarks.google_message3.Message0 field17458 = 512; + repeated string field17460 = 560; + repeated string field17466 = 552; + repeated .benchmarks.google_message3.Message0 field17617 = 1080; + repeated int32 field17618 = 1084; +} + diff -Nru protobuf-3.0.0/benchmarks/datasets/google_message4/benchmark_message4_1.proto protobuf-3.6.1.3/benchmarks/datasets/google_message4/benchmark_message4_1.proto --- protobuf-3.0.0/benchmarks/datasets/google_message4/benchmark_message4_1.proto 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/benchmarks/datasets/google_message4/benchmark_message4_1.proto 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,474 @@ +syntax = "proto2"; + +import "datasets/google_message4/benchmark_message4_2.proto"; +import "datasets/google_message4/benchmark_message4_3.proto"; +package benchmarks.google_message4; + +option cc_enable_arenas = true; +option java_package = "com.google.protobuf.benchmarks"; + +message Message2463 { + repeated .benchmarks.google_message4.Message2462 field2498 = 1; +} + +message Message12686 { + optional string field12699 = 1; + optional .benchmarks.google_message4.Message12685 field12700 = 2; +} + +message Message11949 { +} + +message Message11975 { + optional string field11992 = 1; + optional int32 field11993 = 2; + repeated .benchmarks.google_message4.Message10320 field11994 = 3; + optional .benchmarks.google_message4.Message11947 field11995 = 4; + optional .benchmarks.google_message4.Message11920 field11996 = 5; + optional bool field11997 = 6; + repeated string field11998 = 7; + optional float field11999 = 8; + repeated .benchmarks.google_message4.UnusedEnum field12000 = 9; + optional int32 field12001 = 11; +} + +message Message7287 { + optional .benchmarks.google_message4.Message6133 field7311 = 1; + optional .benchmarks.google_message4.UnusedEmptyMessage field7312 = 8; + optional string field7313 = 3; + optional .benchmarks.google_message4.Message6643 field7314 = 4; + optional .benchmarks.google_message4.Enum7288 field7315 = 5; + optional bytes field7316 = 6; + optional .benchmarks.google_message4.UnusedEmptyMessage field7317 = 7; + optional .benchmarks.google_message4.UnusedEmptyMessage field7318 = 9; +} + +message Message3061 { + optional string field3286 = 2; + optional int32 field3287 = 77; + optional string field3288 = 49; + required .benchmarks.google_message4.Message3046 field3289 = 3; + optional .benchmarks.google_message4.Message3046 field3290 = 58; + optional group Message3062 = 4 { + required int32 field3335 = 5; + optional int32 field3336 = 6; + optional int32 field3337 = 7; + } + optional .benchmarks.google_message4.Message3060 field3292 = 104; + optional int64 field3293 = 32; + optional int32 field3294 = 41; + optional group Message3063 = 13 { + required int32 field3338 = 14; + optional .benchmarks.google_message4.Enum2851 field3339 = 18; + optional int64 field3340 = 15; + optional int64 field3341 = 23; + } + optional .benchmarks.google_message4.Enum2834 field3296 = 94; + optional bool field3297 = 25; + optional bool field3298 = 50; + optional string field3299 = 89; + optional string field3300 = 91; + optional string field3301 = 105; + optional .benchmarks.google_message4.Message3050 field3302 = 53; + optional fixed64 field3303 = 51; + optional fixed64 field3304 = 106; + optional int32 field3305 = 60; + optional string field3306 = 44; + optional bytes field3307 = 81; + optional string field3308 = 70; + optional bytes field3309 = 45; + optional .benchmarks.google_message4.Enum2806 field3310 = 71; + optional int32 field3311 = 72; + optional bytes field3312 = 78; + optional int32 field3313 = 20; + repeated group Message3064 = 8 { + required .benchmarks.google_message4.Enum2602 field3342 = 9; + optional int32 field3343 = 92; + optional string field3344 = 10; + optional bytes field3345 = 11; + optional int32 field3346 = 12; + optional .benchmarks.google_message4.Message3060 field3347 = 98; + optional .benchmarks.google_message4.UnusedEmptyMessage field3348 = 82; + optional .benchmarks.google_message4.Message3050 field3349 = 80; + optional fixed64 field3350 = 52; + optional int32 field3351 = 33; + optional string field3352 = 42; + optional string field3353 = 69; + optional bytes field3354 = 43; + optional .benchmarks.google_message4.Enum2806 field3355 = 73; + optional int32 field3356 = 74; + optional int32 field3357 = 90; + optional bytes field3358 = 79; + optional int32 field3359 = 19; + optional .benchmarks.google_message4.Enum2834 field3360 = 95; + } + optional .benchmarks.google_message4.UnusedEmptyMessage field3315 = 39; + optional int32 field3316 = 76; + optional group Message3065 = 63 { + } + optional .benchmarks.google_message4.Enum2806 field3318 = 54; + optional int32 field3319 = 46; + repeated string field3320 = 24; + optional fixed32 field3321 = 38; + optional bytes field3322 = 99; + optional fixed64 field3323 = 1; + optional fixed64 field3324 = 97; + repeated .benchmarks.google_message4.Message3040 field3325 = 16; + repeated .benchmarks.google_message4.Message3041 field3326 = 61; + optional group Message3066 = 21 { + optional int32 field3366 = 22; + optional int32 field3367 = 55; + optional int32 field3368 = 88; + optional int32 field3369 = 56; + optional int32 field3370 = 75; + optional int32 field3371 = 57; + optional .benchmarks.google_message4.UnusedEmptyMessage field3372 = 85; + optional .benchmarks.google_message4.UnusedEmptyMessage field3373 = 96; + } + optional .benchmarks.google_message4.UnusedEmptyMessage field3328 = 47; + optional .benchmarks.google_message4.UnusedEmptyMessage field3329 = 48; + optional fixed64 field3330 = 40; + optional .benchmarks.google_message4.UnusedEmptyMessage field3331 = 86; + optional .benchmarks.google_message4.UnusedEmptyMessage field3332 = 59; + optional int32 field3333 = 17; +} + +message Message12949 { +} + +message Message8572 { + optional bytes field8647 = 1; + optional bytes field8648 = 3; + optional .benchmarks.google_message4.Message3886 field8649 = 4; + optional .benchmarks.google_message4.Message3919 field8650 = 57; + optional bool field8651 = 5; + optional int32 field8652 = 6; + optional int32 field8653 = 49; + optional .benchmarks.google_message4.Message7905 field8654 = 7; + optional int32 field8655 = 10; + optional .benchmarks.google_message4.UnusedEmptyMessage field8656 = 11; + optional bool field8657 = 35; + optional bytes field8658 = 12; + optional string field8659 = 14; + optional .benchmarks.google_message4.UnusedEmptyMessage field8660 = 13; + optional bytes field8661 = 15; + optional .benchmarks.google_message4.UnusedEmptyMessage field8662 = 17; + optional int32 field8663 = 18; + optional int32 field8664 = 19; + optional bool field8665 = 20; + optional .benchmarks.google_message4.Enum3476 field8666 = 31; + optional bool field8667 = 36; + optional .benchmarks.google_message4.UnusedEmptyMessage field8668 = 39; + optional bytes field8669 = 22; + optional int32 field8670 = 24; + optional .benchmarks.google_message4.Message3052 field8671 = 25; + optional bytes field8672 = 26; + optional bytes field8673 = 28; + optional int32 field8674 = 29; + optional bytes field8675 = 30; + optional bytes field8676 = 32; + optional string field8677 = 33; + optional int32 field8678 = 34; + optional int32 field8679 = 37; + optional double field8680 = 38; + optional double field8681 = 42; + optional .benchmarks.google_message4.Message3922 field8682 = 40; + optional .benchmarks.google_message4.UnusedEmptyMessage field8683 = 43; + optional int64 field8684 = 44; + optional .benchmarks.google_message4.Message7929 field8685 = 45; + optional uint64 field8686 = 46; + optional uint32 field8687 = 48; + optional .benchmarks.google_message4.Message7843 field8688 = 47; + optional .benchmarks.google_message4.Message7864 field8689 = 50; + optional .benchmarks.google_message4.UnusedEmptyMessage field8690 = 52; + optional bool field8691 = 58; + optional bool field8692 = 54; + optional string field8693 = 55; + optional .benchmarks.google_message4.UnusedEmptyMessage field8694 = 41; + optional .benchmarks.google_message4.UnusedEmptyMessage field8695 = 53; + optional .benchmarks.google_message4.Message8575 field8696 = 61; +} + +message Message8774 { + optional string field8810 = 1; + optional string field8811 = 2; + optional string field8812 = 3; + optional string field8813 = 4; + optional string field8814 = 5; +} + +message Message12776 { + optional string field12786 = 1; + optional fixed64 field12787 = 11; + optional int32 field12788 = 6; + optional int32 field12789 = 13; + optional int32 field12790 = 14; + optional int32 field12791 = 15; + optional int32 field12792 = 16; + optional .benchmarks.google_message4.UnusedEmptyMessage field12793 = 8; + optional .benchmarks.google_message4.Message12774 field12794 = 10; + optional .benchmarks.google_message4.UnusedEmptyMessage field12795 = 12; + extensions 2 to 2; + extensions 3 to 3; + extensions 4 to 4; + extensions 5 to 5; + extensions 7 to 7; + extensions 9 to 9; +} + +message Message12798 { + optional int32 field12805 = 1; + optional int32 field12806 = 2; + optional .benchmarks.google_message4.Message12774 field12807 = 6; + optional bool field12808 = 7; +} + +message Message12797 { + optional .benchmarks.google_message4.Message12796 field12802 = 1; + repeated .benchmarks.google_message4.Message12796 field12803 = 2; + optional string field12804 = 3; +} + +message Message12825 { + repeated .benchmarks.google_message4.Message12818 field12862 = 1; + optional int32 field12863 = 2; + optional .benchmarks.google_message4.Message12819 field12864 = 3; + optional .benchmarks.google_message4.Message12820 field12865 = 4; + optional int32 field12866 = 5; + repeated .benchmarks.google_message4.Message12821 field12867 = 6; + repeated .benchmarks.google_message4.UnusedEmptyMessage field12868 = 7; +} + +message Message8590 { +} + +message Message8587 { +} + +message Message1374 { + required string field1375 = 1; + optional string field1376 = 2; +} + +message Message2462 { + required bytes field2496 = 1; + required double field2497 = 2; +} + +message Message12685 { + repeated string field12692 = 1; + repeated string field12693 = 2; + optional int64 field12694 = 3; + optional uint32 field12695 = 4; + repeated string field12696 = 5; + optional string field12697 = 6; + optional string field12698 = 7; +} + +message Message10320 { + optional .benchmarks.google_message4.Enum10335 field10347 = 1; + repeated .benchmarks.google_message4.Message10319 field10348 = 2; + optional int32 field10349 = 3; + optional int32 field10350 = 4; + optional int32 field10351 = 5; + optional int32 field10352 = 6; + optional .benchmarks.google_message4.Enum10337 field10353 = 7; +} + +message Message11947 { + optional uint32 field11951 = 1; + optional bool field11952 = 2; + optional int32 field11953 = 3; +} + +message Message11920 { + optional .benchmarks.google_message4.Enum11901 field11945 = 1; + optional .benchmarks.google_message4.UnusedEnum field11946 = 2; +} + +message Message6643 { + optional .benchmarks.google_message4.UnusedEmptyMessage field6683 = 3; + optional .benchmarks.google_message4.UnusedEmptyMessage field6684 = 4; + optional double field6685 = 5; + optional double field6686 = 6; + optional int32 field6687 = 1; + optional int32 field6688 = 2; + optional double field6689 = 9; + optional bytes field6690 = 10; + optional int32 field6691 = 11; + optional bool field6692 = 12; + optional bool field6693 = 13; + optional .benchmarks.google_message4.Message6578 field6694 = 15; + optional .benchmarks.google_message4.UnusedEnum field6695 = 16; + optional int64 field6696 = 17; + repeated .benchmarks.google_message4.UnusedEmptyMessage field6697 = 22; + optional .benchmarks.google_message4.UnusedEmptyMessage field6698 = 19; + optional .benchmarks.google_message4.UnusedEmptyMessage field6699 = 20; + optional int32 field6700 = 21; +} + +message Message6133 { + optional .benchmarks.google_message4.Message4016 field6173 = 12; + optional double field6174 = 16; + required string field6175 = 1; + required string field6176 = 2; + required string field6177 = 3; + optional string field6178 = 4; + optional string field6179 = 8; + repeated .benchmarks.google_message4.Message6109 field6180 = 5; + repeated .benchmarks.google_message4.Message5908 field6181 = 13; + repeated .benchmarks.google_message4.Message6107 field6182 = 7; + repeated .benchmarks.google_message4.Message6126 field6183 = 9; + repeated .benchmarks.google_message4.Message6129 field6184 = 15; + optional int32 field6185 = 10; + optional int32 field6186 = 11; + optional .benchmarks.google_message4.Message4016 field6187 = 17; + optional double field6188 = 14; + optional double field6189 = 18; + optional string field6190 = 19; + optional string field6191 = 20; + repeated .benchmarks.google_message4.Message5881 field6192 = 21; +} + +message Message6109 { + optional string field6140 = 1; + required .benchmarks.google_message4.Enum6111 field6141 = 2; + optional int32 field6142 = 9; + optional string field6143 = 3; + repeated .benchmarks.google_message4.Message6110 field6144 = 4; + repeated int32 field6145 = 7; + repeated int32 field6146 = 8; + optional .benchmarks.google_message4.Message6133 field6147 = 10; + repeated int32 field6148 = 11; + optional string field6149 = 12; + optional string field6150 = 13; + optional bool field6151 = 14; + extensions 1000 to 536870911; +} + +message Message3046 { + required .benchmarks.google_message4.Enum2593 field3222 = 1; + optional int32 field3223 = 4; +} + +message Message3060 { + optional int64 field3283 = 1; + optional int64 field3284 = 2; + optional int64 field3285 = 3; +} + +message Message3041 { + optional string field3214 = 1; + optional int32 field3215 = 2; +} + +message Message3040 { + required fixed64 field3209 = 1; + repeated fixed64 field3210 = 4; + optional int32 field3211 = 5; + optional fixed64 field3212 = 2; + required string field3213 = 3; +} + +message Message3050 { + optional bytes field3245 = 5; + optional int32 field3246 = 2; + optional bytes field3247 = 6; + optional int32 field3248 = 4; + optional fixed32 field3249 = 1; + optional fixed32 field3250 = 3; +} + +message Message7905 { + optional int32 field7911 = 1; + optional bool field7912 = 2; + optional bytes field7913 = 3; + optional int32 field7914 = 4; + optional int32 field7915 = 5; + optional bytes field7916 = 6; + optional int32 field7917 = 7; +} + +message Message3886 { + repeated group Message3887 = 1 { + required string field3932 = 2; + optional string field3933 = 9; + optional .benchmarks.google_message4.Message3850 field3934 = 3; + optional bytes field3935 = 8; + } +} + +message Message7864 { + optional string field7866 = 1; + optional string field7867 = 2; + repeated .benchmarks.google_message4.Message7865 field7868 = 5; + repeated .benchmarks.google_message4.Message7865 field7869 = 6; + repeated .benchmarks.google_message4.Message7865 field7870 = 7; + repeated .benchmarks.google_message4.UnusedEmptyMessage field7871 = 8; +} + +message Message3922 { + optional uint64 field4012 = 1; +} + +message Message3052 { + repeated string field3254 = 1; + repeated string field3255 = 2; + repeated bytes field3256 = 3; + repeated string field3257 = 4; + optional bool field3258 = 5; + optional int32 field3259 = 6; + optional int32 field3260 = 7; + optional string field3261 = 8; + optional string field3262 = 9; +} + +message Message8575 { +} + +message Message7843 { + optional bool field7844 = 5; + optional int32 field7845 = 1; + optional .benchmarks.google_message4.UnusedEmptyMessage field7846 = 22; + repeated int32 field7847 = 3; + repeated string field7848 = 11; + optional .benchmarks.google_message4.UnusedEnum field7849 = 15; + optional .benchmarks.google_message4.UnusedEmptyMessage field7850 = 6; + optional .benchmarks.google_message4.UnusedEmptyMessage field7851 = 14; + optional .benchmarks.google_message4.UnusedEmptyMessage field7852 = 10; + optional .benchmarks.google_message4.Message7511 field7853 = 13; + optional .benchmarks.google_message4.UnusedEmptyMessage field7854 = 16; + optional .benchmarks.google_message4.UnusedEmptyMessage field7855 = 17; + optional .benchmarks.google_message4.UnusedEmptyMessage field7856 = 19; + optional .benchmarks.google_message4.UnusedEmptyMessage field7857 = 18; + optional .benchmarks.google_message4.UnusedEnum field7858 = 20; + optional int32 field7859 = 2; +} + +message Message3919 { + repeated .benchmarks.google_message4.Message3920 field4009 = 1; +} + +message Message7929 { + optional int64 field7942 = 1; + optional int64 field7943 = 4; + optional int64 field7944 = 5; + optional int64 field7945 = 12; + optional int64 field7946 = 13; + optional int64 field7947 = 18; + optional int64 field7948 = 6; + optional int64 field7949 = 7; + repeated .benchmarks.google_message4.Message7919 field7950 = 8; + repeated .benchmarks.google_message4.UnusedEmptyMessage field7951 = 20; + repeated .benchmarks.google_message4.Message7920 field7952 = 14; + repeated .benchmarks.google_message4.Message7921 field7953 = 15; + repeated .benchmarks.google_message4.Message7928 field7954 = 17; + optional int64 field7955 = 19; + optional bool field7956 = 2; + optional int64 field7957 = 3; + optional int64 field7958 = 9; + repeated .benchmarks.google_message4.UnusedEmptyMessage field7959 = 10; + repeated bytes field7960 = 11; + optional int64 field7961 = 16; +} + diff -Nru protobuf-3.0.0/benchmarks/datasets/google_message4/benchmark_message4_2.proto protobuf-3.6.1.3/benchmarks/datasets/google_message4/benchmark_message4_2.proto --- protobuf-3.0.0/benchmarks/datasets/google_message4/benchmark_message4_2.proto 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/benchmarks/datasets/google_message4/benchmark_message4_2.proto 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,292 @@ +syntax = "proto2"; + +import "datasets/google_message4/benchmark_message4_3.proto"; +package benchmarks.google_message4; + +option cc_enable_arenas = true; +option java_package = "com.google.protobuf.benchmarks"; + +message Message12774 { + optional uint32 field12777 = 1; + optional uint32 field12778 = 2; + optional uint32 field12779 = 3; + optional uint32 field12780 = 4; + optional uint32 field12781 = 5; + optional bool field12782 = 6; +} + +message Message12796 { + repeated fixed64 field12800 = 1; + optional uint64 field12801 = 2; +} + +message Message12821 { + optional int32 field12848 = 1; + optional int32 field12849 = 2; + optional int32 field12850 = 3; + optional int32 field12851 = 4; + optional int32 field12852 = 5; +} + +message Message12820 { + optional int32 field12840 = 1; + optional int32 field12841 = 2; + optional int32 field12842 = 3; + optional int32 field12843 = 8; + optional int32 field12844 = 4; + optional int32 field12845 = 5; + optional int32 field12846 = 6; + optional int32 field12847 = 7; +} + +message Message12819 { + optional double field12834 = 1; + optional double field12835 = 2; + optional double field12836 = 3; + optional double field12837 = 4; + optional double field12838 = 5; + optional double field12839 = 6; +} + +message Message12818 { + optional uint64 field12829 = 1; + optional int32 field12830 = 2; + optional int32 field12831 = 3; + optional int32 field12832 = 5; + repeated .benchmarks.google_message4.Message12817 field12833 = 4; +} + +message Message10319 { + optional .benchmarks.google_message4.Enum10325 field10340 = 1; + optional int32 field10341 = 4; + optional int32 field10342 = 5; + optional bytes field10343 = 3; + optional string field10344 = 2; + optional string field10345 = 6; + optional string field10346 = 7; +} + +message Message6578 { + optional .benchmarks.google_message4.Enum6579 field6632 = 1; + optional .benchmarks.google_message4.Enum6588 field6633 = 2; +} + +message Message6126 { + required string field6152 = 1; + repeated .benchmarks.google_message4.Message6127 field6153 = 9; + optional int32 field6154 = 14; + optional bytes field6155 = 10; + optional .benchmarks.google_message4.Message6024 field6156 = 12; + optional int32 field6157 = 4; + optional string field6158 = 5; + optional int32 field6159 = 6; + repeated int32 field6160 = 2; + repeated int32 field6161 = 3; + repeated .benchmarks.google_message4.Message6052 field6162 = 7; + repeated .benchmarks.google_message4.UnusedEmptyMessage field6163 = 11; + optional .benchmarks.google_message4.Enum6065 field6164 = 15; + repeated .benchmarks.google_message4.Message6127 field6165 = 8; + optional bool field6166 = 13; + optional bool field6167 = 16; + optional bool field6168 = 18; + repeated .benchmarks.google_message4.Message6054 field6169 = 17; + optional int32 field6170 = 19; +} + +message Message5881 { + required double field5897 = 1; + optional string field5898 = 5; + optional .benchmarks.google_message4.Message5861 field5899 = 2; + optional .benchmarks.google_message4.UnusedEmptyMessage field5900 = 3; + optional .benchmarks.google_message4.Message5867 field5901 = 4; + optional .benchmarks.google_message4.Message5880 field5902 = 6; +} + +message Message6110 { +} + +message Message6107 { + optional .benchmarks.google_message4.Message4016 field6134 = 1; + optional int32 field6135 = 2; + optional string field6136 = 3; + repeated int32 field6137 = 4; + optional int32 field6138 = 5; + repeated .benchmarks.google_message4.Message6108 field6139 = 6; +} + +message Message6129 { + required .benchmarks.google_message4.Enum6130 field6171 = 1; + required string field6172 = 2; +} + +message Message5908 { + optional string field5971 = 1; + optional int32 field5972 = 2; + optional int32 field5973 = 3; + optional .benchmarks.google_message4.Enum5909 field5974 = 45; + optional .benchmarks.google_message4.Enum5912 field5975 = 4; + optional fixed32 field5976 = 50; + optional fixed32 field5977 = 5; + optional fixed32 field5978 = 6; + optional string field5979 = 7; + optional .benchmarks.google_message4.Enum5915 field5980 = 8; + optional .benchmarks.google_message4.Message5903 field5981 = 9; + optional .benchmarks.google_message4.Message5903 field5982 = 10; + optional .benchmarks.google_message4.Enum5920 field5983 = 11; + optional .benchmarks.google_message4.Enum5923 field5984 = 40; + optional .benchmarks.google_message4.Message5903 field5985 = 41; + optional .benchmarks.google_message4.Message5903 field5986 = 42; + optional .benchmarks.google_message4.Enum5928 field5987 = 47; + optional bool field5988 = 48; + repeated fixed32 field5989 = 49; + optional string field5990 = 12; + optional .benchmarks.google_message4.Message5903 field5991 = 13; + optional .benchmarks.google_message4.Message5903 field5992 = 14; + optional .benchmarks.google_message4.Message5903 field5993 = 15; + optional .benchmarks.google_message4.Message5903 field5994 = 16; + optional .benchmarks.google_message4.Message5903 field5995 = 32; + optional .benchmarks.google_message4.Message5903 field5996 = 33; + optional .benchmarks.google_message4.Message5903 field5997 = 34; + optional .benchmarks.google_message4.Message5903 field5998 = 35; + optional .benchmarks.google_message4.Enum5931 field5999 = 17; + optional .benchmarks.google_message4.Enum5935 field6000 = 18; + optional .benchmarks.google_message4.Enum5939 field6001 = 36; + optional .benchmarks.google_message4.Enum5939 field6002 = 37; + repeated int32 field6003 = 19; + optional uint32 field6004 = 20; + optional uint32 field6005 = 21; + optional uint32 field6006 = 22; + optional uint32 field6007 = 23; + optional .benchmarks.google_message4.Enum5946 field6008 = 24; + optional .benchmarks.google_message4.Enum5946 field6009 = 25; + optional .benchmarks.google_message4.Enum5946 field6010 = 26; + optional .benchmarks.google_message4.Enum5946 field6011 = 27; + optional fixed32 field6012 = 28; + optional fixed32 field6013 = 29; + optional fixed32 field6014 = 30; + optional fixed32 field6015 = 31; + optional int32 field6016 = 38; + optional float field6017 = 39; + optional .benchmarks.google_message4.Enum5957 field6018 = 43; + optional .benchmarks.google_message4.Message5907 field6019 = 44; + optional .benchmarks.google_message4.Enum5962 field6020 = 46; +} + +message Message3850 { + optional .benchmarks.google_message4.Enum3851 field3924 = 2; + optional bool field3925 = 12; + optional int32 field3926 = 4; + optional bool field3927 = 10; + optional bool field3928 = 13; + optional bool field3929 = 14; +} + +message Message7865 { +} + +message Message7511 { + optional bool field7523 = 1; + optional .benchmarks.google_message4.Enum7512 field7524 = 2; + optional int32 field7525 = 3; + optional int32 field7526 = 4; + optional bool field7527 = 5; + optional int32 field7528 = 6; + optional int32 field7529 = 7; +} + +message Message3920 { +} + +message Message7928 { + optional string field7940 = 1; + optional int64 field7941 = 2; +} + +message Message7921 { + optional int32 field7936 = 1; + optional int64 field7937 = 2; + optional float field7938 = 3; + optional .benchmarks.google_message4.Enum7922 field7939 = 4; +} + +message Message7920 { + optional int64 field7934 = 1; + optional int64 field7935 = 2; +} + +message Message7919 { + optional fixed64 field7931 = 1; + optional int64 field7932 = 2; + optional bytes field7933 = 3; +} + +message Message12817 { + optional int32 field12826 = 1; + optional int32 field12827 = 2; + optional int32 field12828 = 3; +} + +message Message6054 { + required string field6089 = 1; + optional string field6090 = 2; +} + +message Message6127 { +} + +message Message6052 { + required string field6084 = 1; + required bytes field6085 = 2; +} + +message Message6024 { + optional .benchmarks.google_message4.Enum6025 field6048 = 1; + optional string field6049 = 2; + optional .benchmarks.google_message4.UnusedEmptyMessage field6050 = 3; +} + +message Message5861 { + required .benchmarks.google_message4.Enum5862 field5882 = 1; + required string field5883 = 2; + optional bool field5884 = 3; + optional string field5885 = 4; +} + +message Message5880 { + optional string field5896 = 1; +} + +message Message5867 { + optional .benchmarks.google_message4.Enum5868 field5890 = 1; + optional string field5891 = 2; + optional .benchmarks.google_message4.Enum5873 field5892 = 3; + optional int32 field5893 = 4; + optional .benchmarks.google_message4.UnusedEnum field5894 = 5; + optional bool field5895 = 6; +} + +message Message4016 { + required int32 field4017 = 1; + required int32 field4018 = 2; + required int32 field4019 = 3; + required int32 field4020 = 4; +} + +message Message6108 { +} + +message Message5907 { + optional .benchmarks.google_message4.Message5903 field5967 = 1; + optional .benchmarks.google_message4.Message5903 field5968 = 2; + optional .benchmarks.google_message4.Message5903 field5969 = 3; + optional .benchmarks.google_message4.Message5903 field5970 = 4; +} + +message UnusedEmptyMessage { +} + +message Message5903 { + required int32 field5965 = 1; + optional .benchmarks.google_message4.Enum5904 field5966 = 2; +} + diff -Nru protobuf-3.0.0/benchmarks/datasets/google_message4/benchmark_message4_3.proto protobuf-3.6.1.3/benchmarks/datasets/google_message4/benchmark_message4_3.proto --- protobuf-3.0.0/benchmarks/datasets/google_message4/benchmark_message4_3.proto 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/benchmarks/datasets/google_message4/benchmark_message4_3.proto 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,751 @@ +syntax = "proto2"; + +package benchmarks.google_message4; + +option cc_enable_arenas = true; +option java_package = "com.google.protobuf.benchmarks"; + +enum UnusedEnum { + UNUSED_ENUM_VALUE1 = 0; + UNUSED_ENUM_VALUE2 = 1; +} + +enum Enum2593 { + ENUM_VALUE2594 = 0; + ENUM_VALUE2595 = 1; + ENUM_VALUE2596 = 2; + ENUM_VALUE2597 = 3; + ENUM_VALUE2598 = 4; + ENUM_VALUE2599 = 5; + ENUM_VALUE2600 = 6; + ENUM_VALUE2601 = 7; +} + +enum Enum2834 { + ENUM_VALUE2835 = 0; + ENUM_VALUE2836 = 1; + ENUM_VALUE2837 = 2; +} + +enum Enum2806 { + ENUM_VALUE2807 = 0; + ENUM_VALUE2808 = 1; + ENUM_VALUE2809 = 2; + ENUM_VALUE2810 = 3; + ENUM_VALUE2811 = 4; + ENUM_VALUE2812 = 5; + ENUM_VALUE2813 = 6; + ENUM_VALUE2814 = 7; + ENUM_VALUE2815 = 8; + ENUM_VALUE2816 = 9; + ENUM_VALUE2817 = 10; + ENUM_VALUE2818 = 11; + ENUM_VALUE2819 = 12; + ENUM_VALUE2820 = 13; + ENUM_VALUE2821 = 14; +} + +enum Enum2851 { + option allow_alias = true; + ENUM_VALUE2852 = 0; + ENUM_VALUE2853 = 0; + ENUM_VALUE2854 = 1; + ENUM_VALUE2855 = 2; + ENUM_VALUE2856 = 3; + ENUM_VALUE2857 = 4; + ENUM_VALUE2858 = 5; + ENUM_VALUE2859 = 6; + ENUM_VALUE2860 = 7; + ENUM_VALUE2861 = 8; + ENUM_VALUE2862 = 9; + ENUM_VALUE2863 = 10; + ENUM_VALUE2864 = 11; + ENUM_VALUE2865 = 12; + ENUM_VALUE2866 = 13; + ENUM_VALUE2867 = 14; + ENUM_VALUE2868 = 15; + ENUM_VALUE2869 = 16; + ENUM_VALUE2870 = 17; + ENUM_VALUE2871 = 18; + ENUM_VALUE2872 = 19; + ENUM_VALUE2873 = 20; + ENUM_VALUE2874 = 21; + ENUM_VALUE2875 = 22; + ENUM_VALUE2876 = 23; + ENUM_VALUE2877 = 24; + ENUM_VALUE2878 = 25; + ENUM_VALUE2879 = 26; + ENUM_VALUE2880 = 27; + ENUM_VALUE2881 = 28; + ENUM_VALUE2882 = 29; + ENUM_VALUE2883 = 30; + ENUM_VALUE2884 = 31; + ENUM_VALUE2885 = 32; + ENUM_VALUE2886 = 33; + ENUM_VALUE2887 = 34; + ENUM_VALUE2888 = 35; + ENUM_VALUE2889 = 36; + ENUM_VALUE2890 = 37; + ENUM_VALUE2891 = 38; + ENUM_VALUE2892 = 39; + ENUM_VALUE2893 = 40; + ENUM_VALUE2894 = 41; + ENUM_VALUE2895 = 42; + ENUM_VALUE2896 = 43; + ENUM_VALUE2897 = 44; + ENUM_VALUE2898 = 45; + ENUM_VALUE2899 = 46; + ENUM_VALUE2900 = 47; + ENUM_VALUE2901 = 48; + ENUM_VALUE2902 = 49; + ENUM_VALUE2903 = 50; + ENUM_VALUE2904 = 51; + ENUM_VALUE2905 = 52; + ENUM_VALUE2906 = 53; + ENUM_VALUE2907 = 54; + ENUM_VALUE2908 = 55; + ENUM_VALUE2909 = 56; + ENUM_VALUE2910 = 57; + ENUM_VALUE2911 = 58; + ENUM_VALUE2912 = 59; + ENUM_VALUE2913 = 60; + ENUM_VALUE2914 = 61; + ENUM_VALUE2915 = 62; + ENUM_VALUE2916 = 63; + ENUM_VALUE2917 = 64; + ENUM_VALUE2918 = 65; + ENUM_VALUE2919 = 66; + ENUM_VALUE2920 = 67; + ENUM_VALUE2921 = 68; + ENUM_VALUE2922 = 69; + ENUM_VALUE2923 = 70; + ENUM_VALUE2924 = 71; + ENUM_VALUE2925 = 72; + ENUM_VALUE2926 = 73; + ENUM_VALUE2927 = 74; + ENUM_VALUE2928 = 75; + ENUM_VALUE2929 = 76; + ENUM_VALUE2930 = 77; + ENUM_VALUE2931 = 78; + ENUM_VALUE2932 = 79; + ENUM_VALUE2933 = 80; + ENUM_VALUE2934 = 81; + ENUM_VALUE2935 = 82; + ENUM_VALUE2936 = 83; + ENUM_VALUE2937 = 84; + ENUM_VALUE2938 = 85; + ENUM_VALUE2939 = 86; + ENUM_VALUE2940 = 87; + ENUM_VALUE2941 = 88; + ENUM_VALUE2942 = 89; + ENUM_VALUE2943 = 90; + ENUM_VALUE2944 = 91; + ENUM_VALUE2945 = 92; + ENUM_VALUE2946 = 93; + ENUM_VALUE2947 = 94; + ENUM_VALUE2948 = 95; + ENUM_VALUE2949 = 96; + ENUM_VALUE2950 = 97; + ENUM_VALUE2951 = 98; + ENUM_VALUE2952 = 99; + ENUM_VALUE2953 = 100; + ENUM_VALUE2954 = 101; + ENUM_VALUE2955 = 102; + ENUM_VALUE2956 = 103; + ENUM_VALUE2957 = 104; + ENUM_VALUE2958 = 105; + ENUM_VALUE2959 = 106; + ENUM_VALUE2960 = 107; + ENUM_VALUE2961 = 108; + ENUM_VALUE2962 = 109; + ENUM_VALUE2963 = 110; + ENUM_VALUE2964 = 111; + ENUM_VALUE2965 = 112; + ENUM_VALUE2966 = 113; + ENUM_VALUE2967 = 114; + ENUM_VALUE2968 = 115; + ENUM_VALUE2969 = 116; + ENUM_VALUE2970 = 117; + ENUM_VALUE2971 = 118; + ENUM_VALUE2972 = 119; +} + +enum Enum2602 { + ENUM_VALUE2603 = 0; + ENUM_VALUE2604 = 1; + ENUM_VALUE2605 = 2; + ENUM_VALUE2606 = 3; + ENUM_VALUE2607 = 4; + ENUM_VALUE2608 = 5; + ENUM_VALUE2609 = 6; + ENUM_VALUE2610 = 7; + ENUM_VALUE2611 = 8; + ENUM_VALUE2612 = 9; + ENUM_VALUE2613 = 10; + ENUM_VALUE2614 = 11; +} + +enum Enum3071 { + ENUM_VALUE3072 = 1; + ENUM_VALUE3073 = 2; + ENUM_VALUE3074 = 3; + ENUM_VALUE3075 = 4; + ENUM_VALUE3076 = 5; + ENUM_VALUE3077 = 6; + ENUM_VALUE3078 = 7; + ENUM_VALUE3079 = 8; + ENUM_VALUE3080 = 9; + ENUM_VALUE3081 = 10; + ENUM_VALUE3082 = 11; + ENUM_VALUE3083 = 12; + ENUM_VALUE3084 = 13; + ENUM_VALUE3085 = 14; + ENUM_VALUE3086 = 15; + ENUM_VALUE3087 = 16; + ENUM_VALUE3088 = 17; + ENUM_VALUE3089 = 18; + ENUM_VALUE3090 = 19; + ENUM_VALUE3091 = 20; + ENUM_VALUE3092 = 21; + ENUM_VALUE3093 = 22; + ENUM_VALUE3094 = 23; + ENUM_VALUE3095 = 24; + ENUM_VALUE3096 = 25; + ENUM_VALUE3097 = 26; + ENUM_VALUE3098 = 27; + ENUM_VALUE3099 = 28; +} + +enum Enum3805 { + ENUM_VALUE3806 = 0; + ENUM_VALUE3807 = 1; + ENUM_VALUE3808 = 2; + ENUM_VALUE3809 = 3; + ENUM_VALUE3810 = 4; + ENUM_VALUE3811 = 5; + ENUM_VALUE3812 = 6; + ENUM_VALUE3813 = 7; + ENUM_VALUE3814 = 8; + ENUM_VALUE3815 = 9; + ENUM_VALUE3816 = 11; + ENUM_VALUE3817 = 10; +} + +enum Enum3783 { + ENUM_VALUE3784 = 0; + ENUM_VALUE3785 = 1; + ENUM_VALUE3786 = 2; + ENUM_VALUE3787 = 3; + ENUM_VALUE3788 = 4; + ENUM_VALUE3789 = 5; + ENUM_VALUE3790 = 6; + ENUM_VALUE3791 = 7; + ENUM_VALUE3792 = 8; + ENUM_VALUE3793 = 9; + ENUM_VALUE3794 = 10; + ENUM_VALUE3795 = 11; + ENUM_VALUE3796 = 12; + ENUM_VALUE3797 = 13; + ENUM_VALUE3798 = 14; + ENUM_VALUE3799 = 15; + ENUM_VALUE3800 = 16; + ENUM_VALUE3801 = 20; + ENUM_VALUE3802 = 21; + ENUM_VALUE3803 = 50; +} + +enum Enum3851 { + ENUM_VALUE3852 = 0; + ENUM_VALUE3853 = 1; + ENUM_VALUE3854 = 2; + ENUM_VALUE3855 = 3; + ENUM_VALUE3856 = 4; + ENUM_VALUE3857 = 5; + ENUM_VALUE3858 = 6; + ENUM_VALUE3859 = 7; + ENUM_VALUE3860 = 8; + ENUM_VALUE3861 = 9; + ENUM_VALUE3862 = 10; + ENUM_VALUE3863 = 11; + ENUM_VALUE3864 = 12; + ENUM_VALUE3865 = 13; + ENUM_VALUE3866 = 14; + ENUM_VALUE3867 = 15; + ENUM_VALUE3868 = 16; + ENUM_VALUE3869 = 17; +} + +enum Enum5862 { + ENUM_VALUE5863 = 1; + ENUM_VALUE5864 = 2; + ENUM_VALUE5865 = 3; +} + +enum Enum5868 { + ENUM_VALUE5869 = 0; + ENUM_VALUE5870 = 1; + ENUM_VALUE5871 = 2; + ENUM_VALUE5872 = 3; +} + +enum Enum5873 { + ENUM_VALUE5874 = 0; + ENUM_VALUE5875 = 1; + ENUM_VALUE5876 = 2; +} + +enum Enum5904 { + ENUM_VALUE5905 = 0; + ENUM_VALUE5906 = 1; +} + +enum Enum5909 { + ENUM_VALUE5910 = 0; + ENUM_VALUE5911 = 1; +} + +enum Enum5912 { + ENUM_VALUE5913 = 0; + ENUM_VALUE5914 = 1; +} + +enum Enum5915 { + ENUM_VALUE5916 = 0; + ENUM_VALUE5917 = 1; + ENUM_VALUE5918 = 2; + ENUM_VALUE5919 = 3; +} + +enum Enum5920 { + ENUM_VALUE5921 = 0; + ENUM_VALUE5922 = 1; +} + +enum Enum5923 { + ENUM_VALUE5924 = 0; + ENUM_VALUE5925 = 1; + ENUM_VALUE5926 = 2; + ENUM_VALUE5927 = 3; +} + +enum Enum5928 { + ENUM_VALUE5929 = 0; + ENUM_VALUE5930 = 1; +} + +enum Enum5931 { + ENUM_VALUE5932 = 0; + ENUM_VALUE5933 = 1; + ENUM_VALUE5934 = 2; +} + +enum Enum5935 { + ENUM_VALUE5936 = 0; + ENUM_VALUE5937 = 1; + ENUM_VALUE5938 = 2; +} + +enum Enum5939 { + ENUM_VALUE5940 = 0; + ENUM_VALUE5941 = 1; + ENUM_VALUE5942 = 2; + ENUM_VALUE5943 = 3; + ENUM_VALUE5944 = 4; + ENUM_VALUE5945 = 5; +} + +enum Enum5946 { + ENUM_VALUE5947 = 0; + ENUM_VALUE5948 = 1; + ENUM_VALUE5949 = 2; + ENUM_VALUE5950 = 3; + ENUM_VALUE5951 = 4; + ENUM_VALUE5952 = 5; + ENUM_VALUE5953 = 6; + ENUM_VALUE5954 = 7; + ENUM_VALUE5955 = 8; + ENUM_VALUE5956 = 9; +} + +enum Enum5957 { + ENUM_VALUE5958 = 0; + ENUM_VALUE5959 = 1; + ENUM_VALUE5960 = 2; + ENUM_VALUE5961 = 3; +} + +enum Enum5962 { + ENUM_VALUE5963 = 0; + ENUM_VALUE5964 = 1; +} + +enum Enum6025 { + ENUM_VALUE6026 = 0; + ENUM_VALUE6027 = 1; + ENUM_VALUE6028 = 2; + ENUM_VALUE6029 = 3; + ENUM_VALUE6030 = 4; + ENUM_VALUE6031 = 5; + ENUM_VALUE6032 = 6; + ENUM_VALUE6033 = 7; + ENUM_VALUE6034 = 8; + ENUM_VALUE6035 = 9; + ENUM_VALUE6036 = 10; + ENUM_VALUE6037 = 11; + ENUM_VALUE6038 = 12; + ENUM_VALUE6039 = 13; + ENUM_VALUE6040 = 14; + ENUM_VALUE6041 = 15; + ENUM_VALUE6042 = 16; + ENUM_VALUE6043 = 17; + ENUM_VALUE6044 = 18; + ENUM_VALUE6045 = 19; + ENUM_VALUE6046 = 20; + ENUM_VALUE6047 = 21; +} + +enum Enum6111 { + ENUM_VALUE6112 = 1; + ENUM_VALUE6113 = 2; + ENUM_VALUE6114 = 3; + ENUM_VALUE6115 = 4; + ENUM_VALUE6116 = 5; + ENUM_VALUE6117 = 6; + ENUM_VALUE6118 = 7; + ENUM_VALUE6119 = 8; + ENUM_VALUE6120 = 9; + ENUM_VALUE6121 = 10; + ENUM_VALUE6122 = 11; + ENUM_VALUE6123 = 12; + ENUM_VALUE6124 = 13; + ENUM_VALUE6125 = 14; +} + +enum Enum6065 { + ENUM_VALUE6066 = 0; + ENUM_VALUE6067 = 1; + ENUM_VALUE6068 = 2; + ENUM_VALUE6069 = 3; + ENUM_VALUE6070 = 4; + ENUM_VALUE6071 = 5; + ENUM_VALUE6072 = 6; + ENUM_VALUE6073 = 7; + ENUM_VALUE6074 = 8; + ENUM_VALUE6075 = 9; + ENUM_VALUE6076 = 10; + ENUM_VALUE6077 = 11; + ENUM_VALUE6078 = 12; + ENUM_VALUE6079 = 13; + ENUM_VALUE6080 = 14; +} + +enum Enum6130 { + ENUM_VALUE6131 = 0; + ENUM_VALUE6132 = 1; +} + +enum Enum6579 { + ENUM_VALUE6580 = 0; + ENUM_VALUE6581 = 2; + ENUM_VALUE6582 = 3; + ENUM_VALUE6583 = 5; + ENUM_VALUE6584 = 10; + ENUM_VALUE6585 = 15; + ENUM_VALUE6586 = 25; + ENUM_VALUE6587 = 30; +} + +enum Enum6588 { + ENUM_VALUE6589 = 0; + ENUM_VALUE6590 = 1; + ENUM_VALUE6591 = 2; + ENUM_VALUE6592 = 3; + ENUM_VALUE6593 = 4; + ENUM_VALUE6594 = 5; + ENUM_VALUE6595 = 6; + ENUM_VALUE6596 = 7; + ENUM_VALUE6597 = 8; + ENUM_VALUE6598 = 9; + ENUM_VALUE6599 = 10; + ENUM_VALUE6600 = 11; + ENUM_VALUE6601 = 12; + ENUM_VALUE6602 = 13; + ENUM_VALUE6603 = 14; + ENUM_VALUE6604 = 15; + ENUM_VALUE6605 = 16; + ENUM_VALUE6606 = 17; + ENUM_VALUE6607 = 19; + ENUM_VALUE6608 = 20; + ENUM_VALUE6609 = 21; + ENUM_VALUE6610 = 22; + ENUM_VALUE6611 = 23; + ENUM_VALUE6612 = 24; + ENUM_VALUE6613 = 25; + ENUM_VALUE6614 = 26; + ENUM_VALUE6615 = 27; + ENUM_VALUE6616 = 28; + ENUM_VALUE6617 = 29; + ENUM_VALUE6618 = 30; + ENUM_VALUE6619 = 31; + ENUM_VALUE6620 = 32; + ENUM_VALUE6621 = 33; + ENUM_VALUE6622 = 34; +} + +enum Enum7288 { + ENUM_VALUE7289 = 0; + ENUM_VALUE7290 = 1; + ENUM_VALUE7291 = 2; + ENUM_VALUE7292 = 3; +} + +enum Enum7512 { + ENUM_VALUE7513 = 0; + ENUM_VALUE7514 = 1; + ENUM_VALUE7515 = 2; + ENUM_VALUE7516 = 3; + ENUM_VALUE7517 = 4; + ENUM_VALUE7518 = 5; + ENUM_VALUE7519 = 6; + ENUM_VALUE7520 = 7; +} + +enum Enum7922 { + ENUM_VALUE7923 = 1; + ENUM_VALUE7924 = 2; + ENUM_VALUE7925 = 3; + ENUM_VALUE7926 = 4; + ENUM_VALUE7927 = 5; +} + +enum Enum3476 { + ENUM_VALUE3477 = 0; + ENUM_VALUE3478 = 1; + ENUM_VALUE3479 = 2; + ENUM_VALUE3480 = 3; + ENUM_VALUE3481 = 4; + ENUM_VALUE3482 = 5; + ENUM_VALUE3483 = 6; + ENUM_VALUE3484 = 7; + ENUM_VALUE3485 = 8; + ENUM_VALUE3486 = 9; + ENUM_VALUE3487 = 10; + ENUM_VALUE3488 = 11; + ENUM_VALUE3489 = 12; + ENUM_VALUE3490 = 13; + ENUM_VALUE3491 = 14; + ENUM_VALUE3492 = 15; + ENUM_VALUE3493 = 16; + ENUM_VALUE3494 = 17; + ENUM_VALUE3495 = 18; + ENUM_VALUE3496 = 19; + ENUM_VALUE3497 = 20; + ENUM_VALUE3498 = 21; + ENUM_VALUE3499 = 22; + ENUM_VALUE3500 = 23; + ENUM_VALUE3501 = 24; + ENUM_VALUE3502 = 25; + ENUM_VALUE3503 = 26; + ENUM_VALUE3504 = 27; + ENUM_VALUE3505 = 28; + ENUM_VALUE3506 = 29; + ENUM_VALUE3507 = 30; + ENUM_VALUE3508 = 31; + ENUM_VALUE3509 = 32; + ENUM_VALUE3510 = 33; + ENUM_VALUE3511 = 34; + ENUM_VALUE3512 = 35; + ENUM_VALUE3513 = 36; + ENUM_VALUE3514 = 37; + ENUM_VALUE3515 = 38; + ENUM_VALUE3516 = 39; + ENUM_VALUE3517 = 40; + ENUM_VALUE3518 = 41; + ENUM_VALUE3519 = 42; + ENUM_VALUE3520 = 43; + ENUM_VALUE3521 = 44; + ENUM_VALUE3522 = 45; + ENUM_VALUE3523 = 46; + ENUM_VALUE3524 = 47; + ENUM_VALUE3525 = 48; + ENUM_VALUE3526 = 49; + ENUM_VALUE3527 = 50; + ENUM_VALUE3528 = 51; + ENUM_VALUE3529 = 52; + ENUM_VALUE3530 = 53; + ENUM_VALUE3531 = 54; + ENUM_VALUE3532 = 55; + ENUM_VALUE3533 = 56; + ENUM_VALUE3534 = 57; + ENUM_VALUE3535 = 58; + ENUM_VALUE3536 = 59; + ENUM_VALUE3537 = 60; + ENUM_VALUE3538 = 61; + ENUM_VALUE3539 = 62; + ENUM_VALUE3540 = 63; + ENUM_VALUE3541 = 64; + ENUM_VALUE3542 = 65; + ENUM_VALUE3543 = 66; + ENUM_VALUE3544 = 67; + ENUM_VALUE3545 = 68; + ENUM_VALUE3546 = 69; + ENUM_VALUE3547 = 70; + ENUM_VALUE3548 = 71; + ENUM_VALUE3549 = 72; + ENUM_VALUE3550 = 73; + ENUM_VALUE3551 = 74; + ENUM_VALUE3552 = 75; + ENUM_VALUE3553 = 76; + ENUM_VALUE3554 = 77; + ENUM_VALUE3555 = 78; + ENUM_VALUE3556 = 79; + ENUM_VALUE3557 = 80; + ENUM_VALUE3558 = 81; + ENUM_VALUE3559 = 82; + ENUM_VALUE3560 = 83; + ENUM_VALUE3561 = 84; + ENUM_VALUE3562 = 85; + ENUM_VALUE3563 = 86; + ENUM_VALUE3564 = 87; + ENUM_VALUE3565 = 88; + ENUM_VALUE3566 = 89; + ENUM_VALUE3567 = 90; + ENUM_VALUE3568 = 91; + ENUM_VALUE3569 = 92; + ENUM_VALUE3570 = 93; + ENUM_VALUE3571 = 94; + ENUM_VALUE3572 = 95; + ENUM_VALUE3573 = 96; + ENUM_VALUE3574 = 97; + ENUM_VALUE3575 = 98; + ENUM_VALUE3576 = 99; + ENUM_VALUE3577 = 100; + ENUM_VALUE3578 = 101; + ENUM_VALUE3579 = 102; + ENUM_VALUE3580 = 103; + ENUM_VALUE3581 = 104; + ENUM_VALUE3582 = 105; + ENUM_VALUE3583 = 106; + ENUM_VALUE3584 = 107; + ENUM_VALUE3585 = 108; + ENUM_VALUE3586 = 109; + ENUM_VALUE3587 = 110; + ENUM_VALUE3588 = 111; + ENUM_VALUE3589 = 112; + ENUM_VALUE3590 = 113; + ENUM_VALUE3591 = 114; + ENUM_VALUE3592 = 115; + ENUM_VALUE3593 = 116; + ENUM_VALUE3594 = 117; + ENUM_VALUE3595 = 118; + ENUM_VALUE3596 = 119; + ENUM_VALUE3597 = 120; + ENUM_VALUE3598 = 121; + ENUM_VALUE3599 = 122; + ENUM_VALUE3600 = 123; + ENUM_VALUE3601 = 124; + ENUM_VALUE3602 = 125; + ENUM_VALUE3603 = 126; + ENUM_VALUE3604 = 127; + ENUM_VALUE3605 = 128; + ENUM_VALUE3606 = 129; + ENUM_VALUE3607 = 130; + ENUM_VALUE3608 = 131; + ENUM_VALUE3609 = 132; + ENUM_VALUE3610 = 133; + ENUM_VALUE3611 = 134; + ENUM_VALUE3612 = 135; + ENUM_VALUE3613 = 136; + ENUM_VALUE3614 = 137; + ENUM_VALUE3615 = 138; + ENUM_VALUE3616 = 139; + ENUM_VALUE3617 = 140; + ENUM_VALUE3618 = 141; + ENUM_VALUE3619 = 142; + ENUM_VALUE3620 = 143; + ENUM_VALUE3621 = 144; + ENUM_VALUE3622 = 145; + ENUM_VALUE3623 = 146; + ENUM_VALUE3624 = 147; + ENUM_VALUE3625 = 148; + ENUM_VALUE3626 = 149; + ENUM_VALUE3627 = 150; + ENUM_VALUE3628 = 151; + ENUM_VALUE3629 = 152; + ENUM_VALUE3630 = 153; + ENUM_VALUE3631 = 154; + ENUM_VALUE3632 = 155; + ENUM_VALUE3633 = 156; + ENUM_VALUE3634 = 157; + ENUM_VALUE3635 = 158; + ENUM_VALUE3636 = 159; + ENUM_VALUE3637 = 160; + ENUM_VALUE3638 = 161; + ENUM_VALUE3639 = 162; + ENUM_VALUE3640 = 163; + ENUM_VALUE3641 = 164; + ENUM_VALUE3642 = 165; + ENUM_VALUE3643 = 166; + ENUM_VALUE3644 = 167; + ENUM_VALUE3645 = 168; + ENUM_VALUE3646 = 169; + ENUM_VALUE3647 = 170; + ENUM_VALUE3648 = 171; + ENUM_VALUE3649 = 172; + ENUM_VALUE3650 = 173; + ENUM_VALUE3651 = 174; + ENUM_VALUE3652 = 175; + ENUM_VALUE3653 = 176; + ENUM_VALUE3654 = 177; + ENUM_VALUE3655 = 178; + ENUM_VALUE3656 = 179; + ENUM_VALUE3657 = 180; + ENUM_VALUE3658 = 181; + ENUM_VALUE3659 = 182; + ENUM_VALUE3660 = 183; +} + +enum Enum10325 { + ENUM_VALUE10326 = 0; + ENUM_VALUE10327 = 1; + ENUM_VALUE10328 = 2; + ENUM_VALUE10329 = 3; + ENUM_VALUE10330 = 4; + ENUM_VALUE10331 = 5; + ENUM_VALUE10332 = 6; + ENUM_VALUE10333 = 7; + ENUM_VALUE10334 = 8; +} + +enum Enum10335 { + ENUM_VALUE10336 = 0; +} + +enum Enum10337 { + ENUM_VALUE10338 = 0; + ENUM_VALUE10339 = 1; +} + +enum Enum11901 { + ENUM_VALUE11902 = 0; + ENUM_VALUE11903 = 1; + ENUM_VALUE11904 = 2; + ENUM_VALUE11905 = 3; +} + +enum Enum12735 { + ENUM_VALUE12736 = 0; + ENUM_VALUE12737 = 1; + ENUM_VALUE12738 = 2; + ENUM_VALUE12739 = 3; +} + +enum Enum12871 { + ENUM_VALUE12872 = 1; + ENUM_VALUE12873 = 2; + ENUM_VALUE12874 = 3; + ENUM_VALUE12875 = 4; + ENUM_VALUE12876 = 5; + ENUM_VALUE12877 = 6; +} + diff -Nru protobuf-3.0.0/benchmarks/datasets/google_message4/benchmark_message4.proto protobuf-3.6.1.3/benchmarks/datasets/google_message4/benchmark_message4.proto --- protobuf-3.0.0/benchmarks/datasets/google_message4/benchmark_message4.proto 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/benchmarks/datasets/google_message4/benchmark_message4.proto 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,454 @@ +syntax = "proto2"; + +import "datasets/google_message4/benchmark_message4_1.proto"; +import "datasets/google_message4/benchmark_message4_2.proto"; +import "datasets/google_message4/benchmark_message4_3.proto"; +package benchmarks.google_message4; + +option cc_enable_arenas = true; +option java_package = "com.google.protobuf.benchmarks"; + +message GoogleMessage4 { + optional int32 field37503 = 1; + optional .benchmarks.google_message4.UnusedEmptyMessage field37504 = 2; + optional .benchmarks.google_message4.UnusedEmptyMessage field37505 = 3; + optional .benchmarks.google_message4.UnusedEmptyMessage field37506 = 4; + optional .benchmarks.google_message4.UnusedEmptyMessage field37507 = 5; + optional .benchmarks.google_message4.Message37489 field37508 = 6; + optional .benchmarks.google_message4.UnusedEmptyMessage field37509 = 7; + optional .benchmarks.google_message4.UnusedEmptyMessage field37510 = 8; + optional .benchmarks.google_message4.UnusedEmptyMessage field37511 = 9; + optional .benchmarks.google_message4.UnusedEmptyMessage field37512 = 10; + optional .benchmarks.google_message4.UnusedEmptyMessage field37513 = 11; + optional .benchmarks.google_message4.UnusedEmptyMessage field37514 = 12; + optional .benchmarks.google_message4.UnusedEmptyMessage field37515 = 13; + optional .benchmarks.google_message4.UnusedEmptyMessage field37516 = 14; + optional .benchmarks.google_message4.UnusedEmptyMessage field37517 = 15; + optional .benchmarks.google_message4.UnusedEmptyMessage field37518 = 16; +} + +message Message37489 { + optional .benchmarks.google_message4.Message2517 field37534 = 3; + optional .benchmarks.google_message4.Message7330 field37535 = 4; + optional .benchmarks.google_message4.Message8815 field37536 = 6; + optional .benchmarks.google_message4.Message8817 field37537 = 7; + optional .benchmarks.google_message4.Message8835 field37538 = 8; + optional .benchmarks.google_message4.Message8848 field37539 = 9; + optional .benchmarks.google_message4.Message8856 field37540 = 11; + optional .benchmarks.google_message4.Message12717 field37541 = 15; + optional .benchmarks.google_message4.Message12748 field37542 = 20; + optional .benchmarks.google_message4.Message7319 field37543 = 22; + optional .benchmarks.google_message4.Message12908 field37544 = 24; + optional .benchmarks.google_message4.Message12910 field37545 = 25; + optional .benchmarks.google_message4.Message12960 field37546 = 30; + optional .benchmarks.google_message4.Message176 field37547 = 33; + optional .benchmarks.google_message4.Message13000 field37548 = 34; + optional .benchmarks.google_message4.Message13035 field37549 = 35; + optional .benchmarks.google_message4.Message37331 field37550 = 36; + optional .benchmarks.google_message4.Message37329 field37551 = 37; + optional .benchmarks.google_message4.Message37327 field37552 = 38; + optional .benchmarks.google_message4.Message37333 field37553 = 39; + optional .benchmarks.google_message4.Message37335 field37554 = 40; +} + +message Message7319 { + optional .benchmarks.google_message4.UnusedEmptyMessage field7321 = 1; + optional .benchmarks.google_message4.UnusedEmptyMessage field7322 = 7; +} + +message Message12717 { + optional .benchmarks.google_message4.UnusedEmptyMessage field12719 = 1; + optional string field12720 = 2; + optional uint32 field12721 = 3; + optional .benchmarks.google_message4.Message11976 field12722 = 4; + repeated .benchmarks.google_message4.Message11948 field12723 = 5; + optional .benchmarks.google_message4.Message11947 field12724 = 6; + optional .benchmarks.google_message4.Message12687 field12725 = 7; + repeated .benchmarks.google_message4.Message11948 field12726 = 8; + optional int64 field12727 = 9; +} + +message Message37331 { + optional .benchmarks.google_message4.UnusedEmptyMessage field37367 = 4; + required .benchmarks.google_message4.Message37326 field37368 = 1; + required int64 field37369 = 2; + required bytes field37370 = 3; +} + +message Message8815 { + optional .benchmarks.google_message4.UnusedEmptyMessage field8819 = 1; + repeated .benchmarks.google_message4.Message8768 field8820 = 2; + optional bool field8821 = 3; +} + +message Message7330 { + optional .benchmarks.google_message4.UnusedEmptyMessage field7332 = 1; + optional .benchmarks.google_message4.Message3069 field7333 = 2; + optional .benchmarks.google_message4.Message7320 field7334 = 3; + optional .benchmarks.google_message4.UnusedEmptyMessage field7335 = 4; + optional bool field7336 = 5; + optional int64 field7337 = 6; +} + +message Message12960 { + optional .benchmarks.google_message4.UnusedEmptyMessage field12962 = 1; + optional .benchmarks.google_message4.Message12948 field12963 = 2; +} + +message Message176 { + required string field408 = 1; + optional int32 field409 = 4; + optional string field410 = 50; + optional int32 field411 = 2; + optional uint64 field412 = 47; + optional string field413 = 56; + optional int32 field414 = 24; + optional string field415 = 21; + optional bytes field416 = 3; + optional string field417 = 57; + optional int32 field418 = 51; + optional float field419 = 7; + optional bool field420 = 5; + optional bool field421 = 28; + optional int32 field422 = 6; + repeated int32 field423 = 40; + optional .benchmarks.google_message4.UnusedEmptyMessage field424 = 41; + optional bool field425 = 25; + optional uint64 field426 = 26; + optional int32 field427 = 38; + optional bytes field428 = 15; + optional bytes field429 = 55; + optional bytes field430 = 16; + optional bytes field431 = 23; + optional bool field432 = 33; + optional bytes field433 = 31; + optional bytes field434 = 32; + optional int32 field435 = 36; + optional uint64 field436 = 17; + optional int32 field437 = 45; + optional uint64 field438 = 18; + optional string field439 = 46; + optional .benchmarks.google_message4.UnusedEmptyMessage field440 = 64; + optional int32 field441 = 39; + optional uint64 field442 = 48; + optional bytes field443 = 19; + optional bytes field444 = 42; + optional bytes field445 = 43; + optional string field446 = 44; + optional string field447 = 49; + optional int64 field448 = 20; + optional bool field449 = 53; + optional .benchmarks.google_message4.UnusedEmptyMessage field450 = 54; + repeated .benchmarks.google_message4.UnusedEmptyMessage field451 = 22; + optional .benchmarks.google_message4.UnusedEnum field452 = 27; + optional int32 field453 = 29; + optional int32 field454 = 30; + optional .benchmarks.google_message4.UnusedEnum field455 = 37; + optional .benchmarks.google_message4.UnusedEnum field456 = 34; + optional int32 field457 = 35; + repeated group Message178 = 101 { + } + optional bool field459 = 52; + optional uint64 field460 = 58; + optional uint64 field461 = 59; + optional .benchmarks.google_message4.UnusedEmptyMessage field462 = 60; + optional .benchmarks.google_message4.UnusedEmptyMessage field463 = 61; + optional .benchmarks.google_message4.UnusedEnum field464 = 62; + repeated string field465 = 63; + optional .benchmarks.google_message4.UnusedEmptyMessage field466 = 65; +} + +message Message8817 { + optional .benchmarks.google_message4.UnusedEmptyMessage field8825 = 1; + repeated .benchmarks.google_message4.Message8768 field8826 = 2; + optional string field8827 = 3; +} + +message Message8835 { + optional .benchmarks.google_message4.UnusedEmptyMessage field8837 = 1; + repeated string field8838 = 2; + optional .benchmarks.google_message4.UnusedEnum field8839 = 3; +} + +message Message37333 { + optional .benchmarks.google_message4.UnusedEmptyMessage field37372 = 3; + required .benchmarks.google_message4.Message37326 field37373 = 1; + optional uint64 field37374 = 2; +} + +message Message13000 { + optional int64 field13015 = 1; + repeated .benchmarks.google_message4.Message12979 field13016 = 2; +} + +message Message37335 { + optional .benchmarks.google_message4.UnusedEmptyMessage field37376 = 4; + required .benchmarks.google_message4.Message37326 field37377 = 1; + required .benchmarks.google_message4.Message37173 field37378 = 2; + optional uint64 field37379 = 3; +} + +message Message8848 { + optional .benchmarks.google_message4.UnusedEmptyMessage field8850 = 1; + optional string field8851 = 2; + optional bytes field8852 = 3; +} + +message Message13035 { + optional int64 field13058 = 1; + repeated int64 field13059 = 2; +} + +message Message8856 { + optional .benchmarks.google_message4.UnusedEmptyMessage field8858 = 1; + optional string field8859 = 2; +} + +message Message12908 { + optional .benchmarks.google_message4.UnusedEmptyMessage field12912 = 1; + optional string field12913 = 2; + optional .benchmarks.google_message4.Message12799 field12914 = 3; + optional int64 field12915 = 4; + optional .benchmarks.google_message4.Message3804 field12916 = 5; + optional .benchmarks.google_message4.Message12870 field12917 = 6; +} + +message Message12910 { + optional .benchmarks.google_message4.UnusedEmptyMessage field12920 = 1; + optional .benchmarks.google_message4.Message12818 field12921 = 2; + repeated .benchmarks.google_message4.Message12903 field12922 = 3; +} + +message Message37327 { + optional .benchmarks.google_message4.UnusedEmptyMessage field37347 = 11; + required .benchmarks.google_message4.Message37326 field37348 = 1; + optional bool field37349 = 2; + optional bool field37350 = 3; + optional bool field37351 = 4; + optional bool field37352 = 5; + optional bool field37353 = 6; + optional .benchmarks.google_message4.UnusedEmptyMessage field37354 = 7; + optional uint64 field37355 = 8; + optional bool field37356 = 9; + optional bool field37357 = 10; +} + +message Message37329 { + optional .benchmarks.google_message4.UnusedEmptyMessage field37359 = 6; + required .benchmarks.google_message4.Message37326 field37360 = 1; + required int64 field37361 = 2; + required int64 field37362 = 3; + optional bool field37363 = 4; +} + +message Message2517 { + optional .benchmarks.google_message4.UnusedEmptyMessage field2519 = 1; + optional .benchmarks.google_message4.Message2356 field2520 = 2; + optional .benchmarks.google_message4.Message0 field2521 = 3; + optional .benchmarks.google_message4.Message2463 field2522 = 4; + repeated .benchmarks.google_message4.Message971 field2523 = 5; +} + +message Message12748 { + optional .benchmarks.google_message4.UnusedEmptyMessage field12754 = 1; + optional string field12755 = 2; + optional string field12756 = 3; + optional .benchmarks.google_message4.Enum12735 field12757 = 4; +} + +message Message12687 { + repeated .benchmarks.google_message4.Message12686 field12701 = 1; +} + +message Message11948 { + optional string field11954 = 1; + repeated .benchmarks.google_message4.Message11949 field11955 = 2; + optional bool field11956 = 3; +} + +message Message11976 { + repeated .benchmarks.google_message4.Message11975 field12002 = 1; +} + +message Message7320 { + optional .benchmarks.google_message4.UnusedEmptyMessage field7323 = 1; + optional .benchmarks.google_message4.Message7287 field7324 = 8; +} + +message Message3069 { + optional .benchmarks.google_message4.Message3061 field3374 = 1; + optional bytes field3375 = 2; + repeated group Message3070 = 3 { + required .benchmarks.google_message4.Enum3071 field3378 = 4; + required bytes field3379 = 5; + } + extensions 10000 to 536870911; +} + +message Message12948 { + repeated .benchmarks.google_message4.Message12949 field12958 = 1; +} + +message Message8768 { + optional string field8782 = 1; + optional .benchmarks.google_message4.Message8572 field8783 = 2; + optional bool field8784 = 3; + repeated .benchmarks.google_message4.Message8774 field8785 = 4; + optional int64 field8786 = 5; + optional .benchmarks.google_message4.UnusedEmptyMessage field8787 = 6; + optional string field8788 = 7; +} + +message Message12979 { + required bytes field12981 = 1; + repeated string field12982 = 2; + optional .benchmarks.google_message4.UnusedEmptyMessage field12983 = 3; + optional int64 field12984 = 4; + optional string field12985 = 5; + optional int32 field12986 = 6; + optional .benchmarks.google_message4.UnusedEmptyMessage field12987 = 7; +} + +message Message37173 { + optional string field37252 = 1; + optional int64 field37253 = 2; + optional .benchmarks.google_message4.UnusedEnum field37254 = 4; + optional bool field37255 = 5; + optional bool field37256 = 6; + optional bool field37257 = 7; + optional string field37258 = 8; + optional string field37259 = 9; + optional uint32 field37260 = 10; + optional fixed32 field37261 = 11; + optional string field37262 = 12; + optional string field37263 = 13; + optional string field37264 = 14; + optional int32 field37265 = 15; + optional int64 field37266 = 16; + optional int64 field37267 = 17; + optional int32 field37268 = 18; + optional int32 field37269 = 19; + optional .benchmarks.google_message4.UnusedEmptyMessage field37270 = 20; + optional .benchmarks.google_message4.UnusedEmptyMessage field37271 = 21; + optional .benchmarks.google_message4.UnusedEmptyMessage field37272 = 22; + optional .benchmarks.google_message4.UnusedEmptyMessage field37273 = 23; + optional .benchmarks.google_message4.UnusedEmptyMessage field37274 = 24; + optional string field37275 = 25; + optional bool field37276 = 26; +} + +message Message12799 { + required string field12809 = 1; + repeated fixed64 field12810 = 2; + repeated .benchmarks.google_message4.Message12776 field12811 = 8; + repeated int32 field12812 = 4; + repeated .benchmarks.google_message4.Message12798 field12813 = 5; + required int32 field12814 = 3; + optional int32 field12815 = 6; + optional .benchmarks.google_message4.Message12797 field12816 = 7; +} + +message Message12870 { + required int32 field12879 = 1; + optional int32 field12880 = 7; + required int32 field12881 = 2; + optional uint64 field12882 = 3; + optional string field12883 = 2001; + optional fixed64 field12884 = 4; + repeated fixed64 field12885 = 14; + optional int32 field12886 = 9; + optional int64 field12887 = 18; + repeated .benchmarks.google_message4.Message12870 field12888 = 8; + optional int32 field12889 = 5; + optional uint64 field12890 = 6; + optional int32 field12891 = 10; + optional int32 field12892 = 11; + optional double field12893 = 12; + optional .benchmarks.google_message4.Message12825 field12894 = 13; + optional double field12895 = 15; + optional string field12896 = 16; + optional .benchmarks.google_message4.Enum12871 field12897 = 17; + optional int32 field12898 = 19; +} + +message Message3804 { + required int64 field3818 = 1; + required bool field3819 = 2; + repeated .benchmarks.google_message4.Enum3805 field3820 = 4; + optional int32 field3821 = 5; + optional bool field3822 = 6; + optional int64 field3823 = 7; + optional .benchmarks.google_message4.Enum3783 field3824 = 8; +} + +message Message12903 { + optional string field12905 = 1; + optional .benchmarks.google_message4.Message8587 field12906 = 2; + repeated .benchmarks.google_message4.Message8590 field12907 = 3; +} + +message Message37326 { + required string field37345 = 1; + optional string field37346 = 2; +} + +message Message2356 { + optional .benchmarks.google_message4.Message1374 field2368 = 121; + optional uint64 field2369 = 1; + optional int32 field2370 = 2; + optional int32 field2371 = 17; + required string field2372 = 3; + optional int32 field2373 = 7; + optional bytes field2374 = 8; + optional string field2375 = 4; + optional string field2376 = 101; + optional int32 field2377 = 102; + optional int32 field2378 = 103; + optional int32 field2379 = 104; + optional int32 field2380 = 113; + optional int32 field2381 = 114; + optional int32 field2382 = 115; + optional int32 field2383 = 117; + optional int32 field2384 = 118; + optional int32 field2385 = 119; + optional int32 field2386 = 105; + optional bytes field2387 = 5; + optional group Message2357 = 6 { + optional int64 field2399 = 9; + optional int32 field2400 = 10; + optional int32 field2401 = 11; + optional int32 field2402 = 12; + optional int32 field2403 = 13; + optional int32 field2404 = 116; + optional int32 field2405 = 106; + required bytes field2406 = 14; + optional int32 field2407 = 45; + optional int32 field2408 = 112; + optional bool field2409 = 122; + optional bytes field2410 = 124; + } + optional string field2389 = 120; + optional group Message2358 = 107 { + } + repeated group Message2359 = 40 { + } + optional int32 field2392 = 50; + optional .benchmarks.google_message4.UnusedEmptyMessage field2393 = 60; + optional .benchmarks.google_message4.UnusedEmptyMessage field2394 = 70; + optional .benchmarks.google_message4.UnusedEmptyMessage field2395 = 80; + optional .benchmarks.google_message4.UnusedEmptyMessage field2396 = 90; + optional string field2397 = 100; + optional string field2398 = 123; +} + +message Message0 { + option message_set_wire_format = true; + extensions 4 to 2147483646; +} + +message Message971 { + optional string field972 = 1; + optional int32 field973 = 2; + optional bool field974 = 3; +} + diff -Nru protobuf-3.0.0/benchmarks/download_data.sh protobuf-3.6.1.3/benchmarks/download_data.sh --- protobuf-3.0.0/benchmarks/download_data.sh 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/benchmarks/download_data.sh 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,5 @@ +#! /bin/sh + +curl -O https://storage.googleapis.com/protobuf_opensource_benchmark_data/datasets.tar.gz +tar -zvxf datasets.tar.gz + diff -Nru protobuf-3.0.0/benchmarks/generate_datasets.cc protobuf-3.6.1.3/benchmarks/generate_datasets.cc --- protobuf-3.0.0/benchmarks/generate_datasets.cc 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/benchmarks/generate_datasets.cc 1970-01-01 00:00:00.000000000 +0000 @@ -1,117 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -#include -#include -#include "benchmarks.pb.h" - -using benchmarks::BenchmarkDataset; -using google::protobuf::Descriptor; -using google::protobuf::DescriptorPool; -using google::protobuf::Message; -using google::protobuf::MessageFactory; - -std::set names; - -const char *file_prefix = "dataset."; -const char *file_suffix = ".pb"; - -void WriteFileWithPayloads(const std::string& name, - const std::string& message_name, - const std::vector& payload) { - if (!names.insert(name).second) { - std::cerr << "Duplicate test name: " << name << "\n"; - abort(); - } - - // First verify that this message name exists in our set of benchmark messages - // and that these payloads are valid for the given message. - const Descriptor* d = - DescriptorPool::generated_pool()->FindMessageTypeByName(message_name); - - if (!d) { - std::cerr << "For dataset " << name << ", no such message: " - << message_name << "\n"; - abort(); - } - - Message* m = MessageFactory::generated_factory()->GetPrototype(d)->New(); - - for (size_t i = 0; i < payload.size(); i++) { - if (!m->ParseFromString(payload[i])) { - std::cerr << "For dataset " << name << ", payload[" << i << "] fails " - << "to parse\n"; - abort(); - } - } - - BenchmarkDataset dataset; - dataset.set_name(name); - dataset.set_message_name(message_name); - for (size_t i = 0; i < payload.size(); i++) { - dataset.add_payload()->assign(payload[i]); - } - - std::ofstream writer; - std::string fname = file_prefix + name + file_suffix; - writer.open(fname.c_str()); - dataset.SerializeToOstream(&writer); - writer.close(); - - std::cerr << "Wrote dataset: " << fname << "\n"; -} - -void WriteFile(const std::string& name, const std::string& message_name, - const std::string& payload) { - std::vector payloads; - payloads.push_back(payload); - WriteFileWithPayloads(name, message_name, payloads); -} - -std::string ReadFile(const std::string& name) { - std::ifstream file(name.c_str()); - GOOGLE_CHECK(file.is_open()) << "Couldn't find file '" << name << - "', please make sure you are running " - "this command from the benchmarks/ " - "directory.\n"; - return std::string((std::istreambuf_iterator(file)), - std::istreambuf_iterator()); -} - -int main() { - WriteFile("google_message1_proto3", "benchmarks.proto3.GoogleMessage1", - ReadFile("google_message1.dat")); - WriteFile("google_message1_proto2", "benchmarks.proto2.GoogleMessage1", - ReadFile("google_message1.dat")); - - // Not in proto3 because it has a group, which is not supported. - WriteFile("google_message2", "benchmarks.proto2.GoogleMessage2", - ReadFile("google_message2.dat")); -} diff -Nru protobuf-3.0.0/benchmarks/go/go_benchmark_test.go protobuf-3.6.1.3/benchmarks/go/go_benchmark_test.go --- protobuf-3.0.0/benchmarks/go/go_benchmark_test.go 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/benchmarks/go/go_benchmark_test.go 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,124 @@ +package main + +import ( + benchmarkWrapper "../tmp" + googleMessage1Proto2 "../tmp/datasets/google_message1/proto2" + googleMessage1Proto3 "../tmp/datasets/google_message1/proto3" + googleMessage2 "../tmp/datasets/google_message2" + googleMessage3 "../tmp/datasets/google_message3" + googleMessage4 "../tmp/datasets/google_message4" + "flag" + "github.com/golang/protobuf/proto" + "io/ioutil" + "testing" +) + +// Data is returned by the Load function. +type Dataset struct { + name string + newMessage func() proto.Message + marshaled [][]byte + unmarshaled []proto.Message +} + +var datasets []Dataset + +// This is used to getDefaultInstance for a message type. +func generateNewMessageFunction(dataset benchmarkWrapper.BenchmarkDataset) func() proto.Message { + switch dataset.MessageName { + case "benchmarks.proto3.GoogleMessage1": + return func() proto.Message { return new(googleMessage1Proto3.GoogleMessage1) } + case "benchmarks.proto2.GoogleMessage1": + return func() proto.Message { return new(googleMessage1Proto2.GoogleMessage1) } + case "benchmarks.proto2.GoogleMessage2": + return func() proto.Message { return new(googleMessage2.GoogleMessage2) } + case "benchmarks.google_message3.GoogleMessage3": + return func() proto.Message { return new(googleMessage3.GoogleMessage3) } + case "benchmarks.google_message4.GoogleMessage4": + return func() proto.Message { return new(googleMessage4.GoogleMessage4) } + default: + panic("Unknown message type: " + dataset.MessageName) + } +} + +func init() { + flag.Parse() + for _, f := range flag.Args() { + // Load the benchmark. + b, err := ioutil.ReadFile(f) + if err != nil { + panic(err) + } + + // Parse the benchmark. + var dm benchmarkWrapper.BenchmarkDataset + if err := proto.Unmarshal(b, &dm); err != nil { + panic(err) + } + + // Determine the concrete protobuf message type to use. + var ds Dataset + ds.newMessage = generateNewMessageFunction(dm) + + // Unmarshal each test message. + for _, payload := range dm.Payload { + ds.marshaled = append(ds.marshaled, payload) + m := ds.newMessage() + if err := proto.Unmarshal(payload, m); err != nil { + panic(err) + } + ds.unmarshaled = append(ds.unmarshaled, m) + } + ds.name = f + + datasets = append(datasets, ds) + } +} + +func Benchmark(b *testing.B) { + for _, ds := range datasets { + b.Run(ds.name, func(b *testing.B) { + b.Run("Unmarshal", func(b *testing.B) { + for i := 0; i < b.N; i++ { + for j, payload := range ds.marshaled { + out := ds.newMessage() + if err := proto.Unmarshal(payload, out); err != nil { + b.Fatalf("can't unmarshal message %d %v", j, err) + } + } + } + }) + b.Run("Marshal", func(b *testing.B) { + for i := 0; i < b.N; i++ { + for j, m := range ds.unmarshaled { + if _, err := proto.Marshal(m); err != nil { + b.Fatalf("can't marshal message %d %+v: %v", j, m, err) + } + } + } + }) + b.Run("Size", func(b *testing.B) { + for i := 0; i < b.N; i++ { + for _, m := range ds.unmarshaled { + proto.Size(m) + } + } + }) + b.Run("Clone", func(b *testing.B) { + for i := 0; i < b.N; i++ { + for _, m := range ds.unmarshaled { + proto.Clone(m) + } + } + }) + b.Run("Merge", func(b *testing.B) { + for i := 0; i < b.N; i++ { + for _, m := range ds.unmarshaled { + out := ds.newMessage() + proto.Merge(out, m) + } + } + }) + }) + } +} Binary files /tmp/tmpj7etzznp/eU58d9NyCB/protobuf-3.0.0/benchmarks/google_message1.dat and /tmp/tmpj7etzznp/thzUZBtgHC/protobuf-3.6.1.3/benchmarks/google_message1.dat differ Binary files /tmp/tmpj7etzznp/eU58d9NyCB/protobuf-3.0.0/benchmarks/google_message2.dat and /tmp/tmpj7etzznp/thzUZBtgHC/protobuf-3.6.1.3/benchmarks/google_message2.dat differ diff -Nru protobuf-3.0.0/benchmarks/java/pom.xml protobuf-3.6.1.3/benchmarks/java/pom.xml --- protobuf-3.0.0/benchmarks/java/pom.xml 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/benchmarks/java/pom.xml 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,95 @@ + + + + 4.0.0 + protobuf-java-benchmark + com.google.protobuf + 1.0.0 + Protocol Buffers [Benchmark] + The benchmark tools for Protobuf Java. + + + + com.google.protobuf + protobuf-java + 3.5.0 + + + com.google.caliper + caliper + 1.0-beta-2 + + + + + + + + org.apache.maven.plugins + maven-assembly-plugin + 2.4.1 + + + + jar-with-dependencies + + + + + com.mkyong.core.utils.App + + + + + + make-assembly + + package + + single + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.5.1 + + 1.8 + 1.8 + + + + org.apache.maven.plugins + maven-jar-plugin + 2.5 + + + + true + com.google.protocolbuffers.ProtoBench + + + + + + org.apache.maven.plugins + maven-source-plugin + 2.4 + + + attach-sources + + jar-no-fork + + + + + + + + + diff -Nru protobuf-3.0.0/benchmarks/java/src/main/java/com/google/protobuf/ProtoCaliperBenchmark.java protobuf-3.6.1.3/benchmarks/java/src/main/java/com/google/protobuf/ProtoCaliperBenchmark.java --- protobuf-3.0.0/benchmarks/java/src/main/java/com/google/protobuf/ProtoCaliperBenchmark.java 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/benchmarks/java/src/main/java/com/google/protobuf/ProtoCaliperBenchmark.java 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,232 @@ + +package com.google.protobuf; + +import com.google.caliper.BeforeExperiment; +import com.google.caliper.AfterExperiment; +import com.google.caliper.Benchmark; +import com.google.caliper.Param; +import com.google.protobuf.ByteString; +import com.google.protobuf.CodedOutputStream; +import com.google.protobuf.ExtensionRegistry; +import com.google.protobuf.Message; +import com.google.protobuf.benchmarks.Benchmarks.BenchmarkDataset; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.FileWriter; +import java.io.IOException; +import java.io.RandomAccessFile; +import java.util.ArrayList; +import java.util.List; + +public class ProtoCaliperBenchmark { + public enum BenchmarkMessageType { + GOOGLE_MESSAGE1_PROTO3 { + @Override ExtensionRegistry getExtensionRegistry() { return ExtensionRegistry.newInstance(); } + @Override + Message getDefaultInstance() { + return com.google.protobuf.benchmarks.BenchmarkMessage1Proto3.GoogleMessage1 + .getDefaultInstance(); + } + }, + GOOGLE_MESSAGE1_PROTO2 { + @Override ExtensionRegistry getExtensionRegistry() { return ExtensionRegistry.newInstance(); } + @Override + Message getDefaultInstance() { + return com.google.protobuf.benchmarks.BenchmarkMessage1Proto2.GoogleMessage1 + .getDefaultInstance(); + } + }, + GOOGLE_MESSAGE2 { + @Override ExtensionRegistry getExtensionRegistry() { return ExtensionRegistry.newInstance(); } + @Override + Message getDefaultInstance() { + return com.google.protobuf.benchmarks.BenchmarkMessage2.GoogleMessage2.getDefaultInstance(); + } + }, + GOOGLE_MESSAGE3 { + @Override + ExtensionRegistry getExtensionRegistry() { + ExtensionRegistry extensions = ExtensionRegistry.newInstance(); + com.google.protobuf.benchmarks.BenchmarkMessage38.registerAllExtensions(extensions); + com.google.protobuf.benchmarks.BenchmarkMessage37.registerAllExtensions(extensions); + com.google.protobuf.benchmarks.BenchmarkMessage36.registerAllExtensions(extensions); + com.google.protobuf.benchmarks.BenchmarkMessage35.registerAllExtensions(extensions); + com.google.protobuf.benchmarks.BenchmarkMessage34.registerAllExtensions(extensions); + com.google.protobuf.benchmarks.BenchmarkMessage33.registerAllExtensions(extensions); + com.google.protobuf.benchmarks.BenchmarkMessage32.registerAllExtensions(extensions); + com.google.protobuf.benchmarks.BenchmarkMessage31.registerAllExtensions(extensions); + com.google.protobuf.benchmarks.BenchmarkMessage3.registerAllExtensions(extensions); + return extensions; + } + @Override + Message getDefaultInstance() { + return com.google.protobuf.benchmarks.BenchmarkMessage3.GoogleMessage3.getDefaultInstance(); + } + }, + GOOGLE_MESSAGE4 { + @Override + ExtensionRegistry getExtensionRegistry() { + ExtensionRegistry extensions = ExtensionRegistry.newInstance(); + com.google.protobuf.benchmarks.BenchmarkMessage43.registerAllExtensions(extensions); + com.google.protobuf.benchmarks.BenchmarkMessage42.registerAllExtensions(extensions); + com.google.protobuf.benchmarks.BenchmarkMessage41.registerAllExtensions(extensions); + com.google.protobuf.benchmarks.BenchmarkMessage4.registerAllExtensions(extensions); + return extensions; + } + @Override + Message getDefaultInstance() { + return com.google.protobuf.benchmarks.BenchmarkMessage4.GoogleMessage4.getDefaultInstance(); + } + }; + + abstract ExtensionRegistry getExtensionRegistry(); + abstract Message getDefaultInstance(); + } + + private BenchmarkMessageType benchmarkMessageType; + @Param("") + private String dataFile; + + private byte[] inputData; + private BenchmarkDataset benchmarkDataset; + private Message defaultMessage; + private ExtensionRegistry extensions; + private List inputDataList; + private List inputStreamList; + private List inputStringList; + private List sampleMessageList; + + private BenchmarkMessageType getMessageType() throws IOException { + if (benchmarkDataset.getMessageName().equals("benchmarks.proto3.GoogleMessage1")) { + return BenchmarkMessageType.GOOGLE_MESSAGE1_PROTO3; + } else if (benchmarkDataset.getMessageName().equals("benchmarks.proto2.GoogleMessage1")) { + return BenchmarkMessageType.GOOGLE_MESSAGE1_PROTO2; + } else if (benchmarkDataset.getMessageName().equals("benchmarks.proto2.GoogleMessage2")) { + return BenchmarkMessageType.GOOGLE_MESSAGE2; + } else if (benchmarkDataset.getMessageName(). + equals("benchmarks.google_message3.GoogleMessage3")) { + return BenchmarkMessageType.GOOGLE_MESSAGE3; + } else if (benchmarkDataset.getMessageName(). + equals("benchmarks.google_message4.GoogleMessage4")) { + return BenchmarkMessageType.GOOGLE_MESSAGE4; + } else { + throw new IllegalStateException("Invalid DataFile! There's no testing message named " + + benchmarkDataset.getMessageName()); + } + } + + @BeforeExperiment + void setUp() throws IOException { + if (!dataFile.equals("")) { + RandomAccessFile file = new RandomAccessFile(new File(dataFile), "r"); + inputData = new byte[(int) file.length()]; + file.readFully(inputData); + benchmarkDataset = BenchmarkDataset.parseFrom(inputData); + benchmarkMessageType = getMessageType(); + } else { + inputData = new byte[0]; + benchmarkDataset = BenchmarkDataset.parseFrom(inputData); + benchmarkMessageType = BenchmarkMessageType.GOOGLE_MESSAGE2; + } + defaultMessage = benchmarkMessageType.getDefaultInstance(); + extensions = benchmarkMessageType.getExtensionRegistry(); + inputDataList = new ArrayList(); + inputStreamList = new ArrayList(); + inputStringList = new ArrayList(); + sampleMessageList = new ArrayList(); + + for (int i = 0; i < benchmarkDataset.getPayloadCount(); i++) { + byte[] singleInputData = benchmarkDataset.getPayload(i).toByteArray(); + inputDataList.add(benchmarkDataset.getPayload(i).toByteArray()); + inputStreamList.add(new ByteArrayInputStream( + benchmarkDataset.getPayload(i).toByteArray())); + inputStringList.add(benchmarkDataset.getPayload(i)); + sampleMessageList.add( + defaultMessage.newBuilderForType().mergeFrom(singleInputData, extensions).build()); + } + } + + + @Benchmark + void serializeToByteString(int reps) throws IOException { + if (sampleMessageList.size() == 0) { + return; + } + for (int i = 0; i < reps; i++) { + for (int j = 0; j < sampleMessageList.size(); j++) { + sampleMessageList.get(j).toByteString(); + } + } + } + + @Benchmark + void serializeToByteArray(int reps) throws IOException { + if (sampleMessageList.size() == 0) { + return; + } + for (int i = 0; i < reps; i++) { + for (int j = 0; j < sampleMessageList.size(); j++) { + sampleMessageList.get(j).toByteArray(); + } + } + } + + @Benchmark + void serializeToMemoryStream(int reps) throws IOException { + if (sampleMessageList.size() == 0) { + return; + } + for (int i = 0; i < reps; i++) { + for (int j = 0; j < sampleMessageList.size(); j++) { + ByteArrayOutputStream output = new ByteArrayOutputStream(); + sampleMessageList.get(j).writeTo(output); + } + } + } + + @Benchmark + void deserializeFromByteString(int reps) throws IOException { + if (inputStringList.size() == 0) { + return; + } + for (int i = 0; i < reps; i++) { + for (int j = 0; j < inputStringList.size(); j++) { + benchmarkMessageType.getDefaultInstance().getParserForType().parseFrom( + inputStringList.get(j), extensions); + } + } + } + + @Benchmark + void deserializeFromByteArray(int reps) throws IOException { + if (inputDataList.size() == 0) { + return; + } + for (int i = 0; i < reps; i++) { + for (int j = 0; j < inputDataList.size(); j++) { + benchmarkMessageType.getDefaultInstance().getParserForType().parseFrom( + inputDataList.get(j), extensions); + } + } + } + + @Benchmark + void deserializeFromMemoryStream(int reps) throws IOException { + if (inputStreamList.size() == 0) { + return; + } + for (int i = 0; i < reps; i++) { + for (int j = 0; j < inputStreamList.size(); j++) { + benchmarkMessageType.getDefaultInstance().getParserForType().parseFrom( + inputStreamList.get(j), extensions); + inputStreamList.get(j).reset(); + } + } + } +} + + diff -Nru protobuf-3.0.0/benchmarks/Makefile.am protobuf-3.6.1.3/benchmarks/Makefile.am --- protobuf-3.0.0/benchmarks/Makefile.am 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/benchmarks/Makefile.am 2018-12-08 01:32:11.000000000 +0000 @@ -1,69 +1,519 @@ +benchmarks_protoc_inputs_benchmark_wrapper = \ + benchmarks.proto -benchmarks_protoc_inputs = \ - benchmarks.proto \ - benchmark_messages_proto3.proto - -benchmarks_protoc_inputs_proto2 = \ - benchmark_messages_proto2.proto - -benchmarks_protoc_outputs = \ - benchmarks.pb.cc \ - benchmarks.pb.h \ - benchmark_messages_proto3.pb.cc \ - benchmark_messages_proto3.pb.h - -benchmarks_protoc_outputs_proto2 = \ - benchmark_messages_proto2.pb.cc \ - benchmark_messages_proto2.pb.h - -bin_PROGRAMS = generate-datasets - -generate_datasets_LDADD = $(top_srcdir)/src/libprotobuf.la -generate_datasets_SOURCES = generate_datasets.cc -generate_datasets_CPPFLAGS = -I$(top_srcdir)/src -I$(srcdir) -nodist_generate_datasets_SOURCES = \ - $(benchmarks_protoc_outputs) \ - $(benchmarks_protoc_outputs_proto2) +benchmarks_protoc_inputs = \ + datasets/google_message1/proto3/benchmark_message1_proto3.proto -# Explicit deps because BUILT_SOURCES are only done before a "make all/check" -# so a direct "make test_cpp" could fail if parallel enough. -# See: https://www.gnu.org/software/automake/manual/html_node/Built-Sources-Example.html#Recording-Dependencies-manually -generate_datasets-generate_datasets.$(OBJEXT): benchmarks.pb.h +benchmarks_protoc_inputs_proto2 = \ + datasets/google_message1/proto2/benchmark_message1_proto2.proto \ + datasets/google_message2/benchmark_message2.proto \ + datasets/google_message3/benchmark_message3.proto \ + datasets/google_message3/benchmark_message3_1.proto \ + datasets/google_message3/benchmark_message3_2.proto \ + datasets/google_message3/benchmark_message3_3.proto \ + datasets/google_message3/benchmark_message3_4.proto \ + datasets/google_message3/benchmark_message3_5.proto \ + datasets/google_message3/benchmark_message3_6.proto \ + datasets/google_message3/benchmark_message3_7.proto \ + datasets/google_message3/benchmark_message3_8.proto \ + datasets/google_message4/benchmark_message4.proto \ + datasets/google_message4/benchmark_message4_1.proto \ + datasets/google_message4/benchmark_message4_2.proto \ + datasets/google_message4/benchmark_message4_3.proto + +make_tmp_dir: + mkdir -p 'tmp/java/src/main/java' + touch make_tmp_dir -$(benchmarks_protoc_outputs): protoc_middleman -$(benchmarks_protoc_outputs_proto2): protoc_middleman2 +# We have to cd to $(srcdir) before executing protoc because $(protoc_inputs) is +# relative to srcdir, which may not be the same as the current directory when +# building out-of-tree. +protoc_middleman: make_tmp_dir $(top_srcdir)/src/protoc$(EXEEXT) $(benchmarks_protoc_inputs) $(well_known_type_protoc_inputs) $(benchmarks_protoc_inputs_benchmark_wrapper) + oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$(top_srcdir)/src --cpp_out=$$oldpwd/cpp --java_out=$$oldpwd/tmp/java/src/main/java --python_out=$$oldpwd/tmp $(benchmarks_protoc_inputs) $(benchmarks_protoc_inputs_benchmark_wrapper) ) + touch protoc_middleman -CLEANFILES = \ - $(benchmarks_protoc_outputs) \ - $(benchmarks_protoc_outputs_proto2) \ - protoc_middleman \ - protoc_middleman2 \ - dataset.* +protoc_middleman2: make_tmp_dir $(top_srcdir)/src/protoc$(EXEEXT) $(benchmarks_protoc_inputs_proto2) $(well_known_type_protoc_inputs) + oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$(top_srcdir)/src --cpp_out=$$oldpwd/cpp --java_out=$$oldpwd/tmp/java/src/main/java --python_out=$$oldpwd/tmp $(benchmarks_protoc_inputs_proto2) ) + touch protoc_middleman2 -MAINTAINERCLEANFILES = \ - Makefile.in +all_data = $$(find $(srcdir) -type f -name "dataset.*.pb" -not -path "./tmp/*") -if USE_EXTERNAL_PROTOC +############# CPP RULES ############## -protoc_middleman: $(benchmarks_protoc_inputs) - $(PROTOC) -I$(srcdir) -I$(top_srcdir) --cpp_out=. $(benchmarks_protoc_inputs) - touch protoc_middleman +benchmarks_protoc_outputs = \ + cpp/benchmarks.pb.cc \ + cpp/datasets/google_message1/proto3/benchmark_message1_proto3.pb.cc + +benchmarks_protoc_outputs_header = \ + cpp/benchmarks.pb.h \ + cpp/datasets/google_message1/proto3/benchmark_message1_proto3.pb.h + +benchmarks_protoc_outputs_proto2_header = \ + cpp/datasets/google_message1/proto2/benchmark_message1_proto2.pb.h \ + cpp/datasets/google_message2/benchmark_message2.pb.h \ + cpp/datasets/google_message3/benchmark_message3.pb.h \ + cpp/datasets/google_message3/benchmark_message3_1.pb.h \ + cpp/datasets/google_message3/benchmark_message3_2.pb.h \ + cpp/datasets/google_message3/benchmark_message3_3.pb.h \ + cpp/datasets/google_message3/benchmark_message3_4.pb.h \ + cpp/datasets/google_message3/benchmark_message3_5.pb.h \ + cpp/datasets/google_message3/benchmark_message3_6.pb.h \ + cpp/datasets/google_message3/benchmark_message3_7.pb.h \ + cpp/datasets/google_message3/benchmark_message3_8.pb.h \ + cpp/datasets/google_message4/benchmark_message4.pb.h \ + cpp/datasets/google_message4/benchmark_message4_1.pb.h \ + cpp/datasets/google_message4/benchmark_message4_2.pb.h \ + cpp/datasets/google_message4/benchmark_message4_3.pb.h + +benchmarks_protoc_outputs_proto2 = \ + cpp/datasets/google_message1/proto2/benchmark_message1_proto2.pb.cc \ + cpp/datasets/google_message2/benchmark_message2.pb.cc \ + cpp/datasets/google_message3/benchmark_message3.pb.cc \ + cpp/datasets/google_message3/benchmark_message3_1.pb.cc \ + cpp/datasets/google_message3/benchmark_message3_2.pb.cc \ + cpp/datasets/google_message3/benchmark_message3_3.pb.cc \ + cpp/datasets/google_message3/benchmark_message3_4.pb.cc \ + cpp/datasets/google_message3/benchmark_message3_5.pb.cc \ + cpp/datasets/google_message3/benchmark_message3_6.pb.cc \ + cpp/datasets/google_message3/benchmark_message3_7.pb.cc \ + cpp/datasets/google_message3/benchmark_message3_8.pb.cc \ + cpp/datasets/google_message4/benchmark_message4.pb.cc \ + cpp/datasets/google_message4/benchmark_message4_1.pb.cc \ + cpp/datasets/google_message4/benchmark_message4_2.pb.cc \ + cpp/datasets/google_message4/benchmark_message4_3.pb.cc -protoc_middleman2: $(benchmarks_protoc_inputs_proto2) - $(PROTOC) -I$(srcdir) -I$(top_srcdir) --cpp_out=. $(benchmarks_protoc_inputs_proto2) - touch protoc_middleman2 -else +$(benchmarks_protoc_outputs): protoc_middleman +$(benchmarks_protoc_outputs_header): protoc_middleman +$(benchmarks_protoc_outputs_proto2): protoc_middleman2 +$(benchmarks_protoc_outputs_proto2_header): protoc_middleman2 + +initialize_submodule: + oldpwd=`pwd` + cd $(top_srcdir)/third_party + git submodule update --init -r + cd $(top_srcdir)/third_party/benchmark && cmake -DCMAKE_BUILD_TYPE=Release && make + cd $$oldpwd + touch initialize_submodule -# We have to cd to $(srcdir) before executing protoc because $(protoc_inputs) is -# relative to srcdir, which may not be the same as the current directory when -# building out-of-tree. -protoc_middleman: $(top_srcdir)/src/protoc$(EXEEXT) $(benchmarks_protoc_inputs) $(well_known_type_protoc_inputs) - oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$(top_srcdir)/src --cpp_out=$$oldpwd $(benchmarks_protoc_inputs) ) - touch protoc_middleman +$(top_srcdir)/third_party/benchmark/src/libbenchmark.a: initialize_submodule -protoc_middleman2: $(top_srcdir)/src/protoc$(EXEEXT) $(benchmarks_protoc_inputs_proto2) $(well_known_type_protoc_inputs) - oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$(top_srcdir)/src --cpp_out=$$oldpwd $(benchmarks_protoc_inputs_proto2) ) - touch protoc_middleman +AM_CXXFLAGS = $(NO_OPT_CXXFLAGS) $(PROTOBUF_OPT_FLAG) -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare + +bin_PROGRAMS = cpp-benchmark + +cpp_benchmark_LDADD = $(top_srcdir)/src/libprotobuf.la $(top_srcdir)/third_party/benchmark/src/libbenchmark.a +cpp_benchmark_SOURCES = cpp/cpp_benchmark.cc +cpp_benchmark_CPPFLAGS = -I$(top_srcdir)/src -I$(srcdir)/cpp -I$(top_srcdir)/third_party/benchmark/include +# Explicit deps because BUILT_SOURCES are only done before a "make all/check" +# so a direct "make test_cpp" could fail if parallel enough. +# See: https://www.gnu.org/software/automake/manual/html_node/Built-Sources-Example.html#Recording-Dependencies-manually +cpp/cpp_benchmark-cpp_benchmark.$(OBJEXT): $(benchmarks_protoc_outputs) $(benchmarks_protoc_outputs_proto2) $(benchmarks_protoc_outputs_header) $(benchmarks_protoc_outputs_proto2_header) $(top_srcdir)/src/libprotobuf.la $(top_srcdir)/third_party/benchmark/src/libbenchmark.a +cpp/benchmark-cpp_benchmark.$(OBJEXT): $(benchmarks_protoc_outputs) $(benchmarks_protoc_outputs_proto2) $(benchmarks_protoc_outputs_header) $(benchmarks_protoc_outputs_proto2_header) $(top_srcdir)/src/libprotobuf.la $(top_srcdir)/third_party/benchmark/src/libbenchmark.a +nodist_cpp_benchmark_SOURCES = \ + $(benchmarks_protoc_outputs) \ + $(benchmarks_protoc_outputs_proto2) \ + $(benchmarks_protoc_outputs_proto2_header) \ + $(benchmarks_protoc_outputs_header) + +cpp: protoc_middleman protoc_middleman2 cpp-benchmark initialize_submodule + ./cpp-benchmark $(all_data) + +############ CPP RULES END ############ + +############# JAVA RULES ############## + +java_benchmark_testing_files = \ + java/src/main/java/com/google/protobuf/ProtoCaliperBenchmark.java + +javac_middleman: $(java_benchmark_testing_files) protoc_middleman protoc_middleman2 + cp -r $(srcdir)/java tmp && cd tmp/java && mvn clean compile assembly:single + cd ../.. + @touch javac_middleman + +java-benchmark: javac_middleman + @echo "Writing shortcut script java-benchmark..." + @echo '#! /bin/bash' > java-benchmark + @echo 'all_data=""' >> java-benchmark + @echo 'conf=()' >> java-benchmark + @echo 'data_files=""' >> java-benchmark + @echo 'for arg in $$@; do if [[ $${arg:0:1} == "-" ]]; then conf+=($$arg); else data_files+="$$arg,"; fi; done' >> java-benchmark + @echo 'java -cp '"tmp/java/target/*.jar"' com.google.caliper.runner.CaliperMain com.google.protobuf.ProtoCaliperBenchmark -i runtime '"\\" >> java-benchmark + @echo '-b serializeToByteString,serializeToByteArray,serializeToMemoryStream,'"\\" >> java-benchmark + @echo 'deserializeFromByteString,deserializeFromByteArray,deserializeFromMemoryStream '"\\" >> java-benchmark + @echo '-DdataFile=$${data_files:0:-1} $${conf[*]}' >> java-benchmark + @chmod +x java-benchmark + +java: protoc_middleman protoc_middleman2 java-benchmark + ./java-benchmark $(all_data) + +############# JAVA RULES END ############## + + +############# PYTHON RULES ############## + +python_add_init: protoc_middleman protoc_middleman2 + all_file=`find tmp -type f -regex '.*\.py'` && \ + for file in $${all_file[@]}; do \ + path="$${file%/*}"; \ + while true; do \ + touch "$$path/__init__.py" && chmod +x "$$path/__init__.py"; \ + if [[ $$path != *"/"* ]]; then break; fi; \ + path=$${path%/*}; \ + done \ + done + +python_cpp_pkg_flags = `pkg-config --cflags --libs python` + +lib_LTLIBRARIES = libbenchmark_messages.la +libbenchmark_messages_la_SOURCES = python/python_benchmark_messages.cc +libbenchmark_messages_la_LIBADD = $(top_srcdir)/src/.libs/libprotobuf.la +libbenchmark_messages_la_LDFLAGS = -version-info 1:0:0 -export-dynamic +libbenchmark_messages_la_CPPFLAGS = -I$(top_srcdir)/src -I$(srcdir)/cpp $(python_cpp_pkg_flags) +libbenchmark_messages_la-python_benchmark_messages.$(OBJEXT): $(benchmarks_protoc_outputs_header) $(benchmarks_protoc_outputs_proto2_header) $(benchmarks_protoc_outputs) $(benchmarks_protoc_outputs_proto2) +nodist_libbenchmark_messages_la_SOURCES = \ + $(benchmarks_protoc_outputs) \ + $(benchmarks_protoc_outputs_proto2) \ + $(benchmarks_protoc_outputs_proto2_header) \ + $(benchmarks_protoc_outputs_header) + +python-pure-python-benchmark: python_add_init + @echo "Writing shortcut script python-pure-python-benchmark..." + @echo '#! /bin/bash' > python-pure-python-benchmark + @echo export LD_LIBRARY_PATH=$(top_srcdir)/src/libprotobuf.la >> python-pure-python-benchmark + @echo export DYLD_LIBRARY_PATH=$(top_srcdir)/src/libprotobuf.la >> python-pure-python-benchmark + @echo export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=\'python\' >> python-pure-python-benchmark + @echo cp $(srcdir)/python/py_benchmark.py tmp >> python-pure-python-benchmark + @echo python tmp/py_benchmark.py '$$@' >> python-pure-python-benchmark + @chmod +x python-pure-python-benchmark + +python-cpp-reflection-benchmark: python_add_init + @echo "Writing shortcut script python-cpp-reflection-benchmark..." + @echo '#! /bin/bash' > python-cpp-reflection-benchmark + @echo export LD_LIBRARY_PATH=$(top_srcdir)/src/libprotobuf.la >> python-cpp-reflection-benchmark + @echo export DYLD_LIBRARY_PATH=$(top_srcdir)/src/libprotobuf.la >> python-cpp-reflection-benchmark + @echo export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=\'cpp\' >> python-cpp-reflection-benchmark + @echo cp $(srcdir)/python/py_benchmark.py tmp >> python-cpp-reflection-benchmark + @echo python tmp/py_benchmark.py '$$@' >> python-cpp-reflection-benchmark + @chmod +x python-cpp-reflection-benchmark + +python-cpp-generated-code-benchmark: python_add_init libbenchmark_messages.la + @echo "Writing shortcut script python-cpp-generated-code-benchmark..." + @echo '#! /bin/bash' > python-cpp-generated-code-benchmark + @echo export LD_LIBRARY_PATH=$(top_srcdir)/src/libprotobuf.la >> python-cpp-generated-code-benchmark + @echo export DYLD_LIBRARY_PATH=$(top_srcdir)/src/libprotobuf.la >> python-cpp-generated-code-benchmark + @echo export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=\'cpp\' >> python-cpp-generated-code-benchmark + @echo cp $(srcdir)/python/py_benchmark.py tmp >> python-cpp-generated-code-benchmark + @echo python tmp/py_benchmark.py --cpp_generated '$$@' >> python-cpp-generated-code-benchmark + @chmod +x python-cpp-generated-code-benchmark + +python-pure-python: python-pure-python-benchmark + ./python-pure-python-benchmark $(all_data) + +python-cpp-reflection: python-cpp-reflection-benchmark + ./python-cpp-reflection-benchmark $(all_data) + +python-cpp-generated-code: python-cpp-generated-code-benchmark + ./python-cpp-generated-code-benchmark $(all_data) + +############# PYTHON RULES END ############## + +############# GO RULES BEGIN ############## + +benchmarks_protoc_inputs_proto2_message1 = \ + datasets/google_message1/proto2/benchmark_message1_proto2.proto + +benchmarks_protoc_inputs_proto2_message2 = \ + datasets/google_message2/benchmark_message2.proto + +benchmarks_protoc_inputs_proto2_message3 = \ + datasets/google_message3/benchmark_message3.proto \ + datasets/google_message3/benchmark_message3_1.proto \ + datasets/google_message3/benchmark_message3_2.proto \ + datasets/google_message3/benchmark_message3_3.proto \ + datasets/google_message3/benchmark_message3_4.proto \ + datasets/google_message3/benchmark_message3_5.proto \ + datasets/google_message3/benchmark_message3_6.proto \ + datasets/google_message3/benchmark_message3_7.proto \ + datasets/google_message3/benchmark_message3_8.proto + +benchmarks_protoc_inputs_proto2_message4 = \ + datasets/google_message4/benchmark_message4.proto \ + datasets/google_message4/benchmark_message4_1.proto \ + datasets/google_message4/benchmark_message4_2.proto \ + datasets/google_message4/benchmark_message4_3.proto + +go_protoc_middleman: make_tmp_dir $(top_srcdir)/src/protoc$(EXEEXT) $(benchmarks_protoc_inputs) $(well_known_type_protoc_inputs) $(benchmarks_protoc_inputs_proto2_message1) $(benchmarks_protoc_inputs_proto2_message2) $(benchmarks_protoc_inputs_proto2_message3) $(benchmarks_protoc_inputs_proto2_message4) $(well_known_type_protoc_inputs) + oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$(top_srcdir)/src --go_out=$$oldpwd/tmp $(benchmarks_protoc_inputs) ) + oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$(top_srcdir)/src --go_out=$$oldpwd/tmp $(benchmarks_protoc_inputs_benchmark_wrapper) ) + oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$(top_srcdir)/src --go_out=$$oldpwd/tmp $(benchmarks_protoc_inputs_proto2_message1) ) + oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$(top_srcdir)/src --go_out=$$oldpwd/tmp $(benchmarks_protoc_inputs_proto2_message2) ) + oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$(top_srcdir)/src --go_out=$$oldpwd/tmp $(benchmarks_protoc_inputs_proto2_message3) ) + oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$(top_srcdir)/src --go_out=$$oldpwd/tmp $(benchmarks_protoc_inputs_proto2_message4) ) + touch go_protoc_middleman + +go-benchmark: go_protoc_middleman + @echo "Writing shortcut script go-benchmark..." + @echo '#! /bin/bash' > go-benchmark + @echo 'cd $(srcdir)/go' >> go-benchmark + @echo 'all_data=""' >> go-benchmark + @echo 'conf=()' >> go-benchmark + @echo 'data_files=()' >> go-benchmark + @echo 'for arg in $$@; do if [[ $${arg:0:1} == "-" ]]; then conf+=($$arg); else data_files+=("../$$arg"); fi; done' >> go-benchmark + @echo 'go test -bench=. $${conf[*]} -- $${data_files[*]}' >> go-benchmark + @echo 'cd ..' >> go-benchmark + @chmod +x go-benchmark + +go: go_protoc_middleman go-benchmark + ./go-benchmark $(all_data) + +############# GO RULES END ############## + +############# GOGO RULES BEGIN ############ + +cpp_no_group_benchmarks_protoc_outputs_header = \ + gogo/cpp_no_group/benchmarks.pb.h \ + gogo/cpp_no_group/datasets/google_message1/proto3/benchmark_message1_proto3.pb.h + +cpp_no_group_benchmarks_protoc_outputs = \ + gogo/cpp_no_group/benchmarks.pb.cc \ + gogo/cpp_no_group/datasets/google_message1/proto3/benchmark_message1_proto3.pb.cc + +cpp_no_group_benchmarks_protoc_outputs_proto2_header = \ + gogo/cpp_no_group/datasets/google_message1/proto2/benchmark_message1_proto2.pb.h \ + gogo/cpp_no_group/datasets/google_message2/benchmark_message2.pb.h \ + gogo/cpp_no_group/datasets/google_message3/benchmark_message3.pb.h \ + gogo/cpp_no_group/datasets/google_message3/benchmark_message3_1.pb.h \ + gogo/cpp_no_group/datasets/google_message3/benchmark_message3_2.pb.h \ + gogo/cpp_no_group/datasets/google_message3/benchmark_message3_3.pb.h \ + gogo/cpp_no_group/datasets/google_message3/benchmark_message3_4.pb.h \ + gogo/cpp_no_group/datasets/google_message3/benchmark_message3_5.pb.h \ + gogo/cpp_no_group/datasets/google_message3/benchmark_message3_6.pb.h \ + gogo/cpp_no_group/datasets/google_message3/benchmark_message3_7.pb.h \ + gogo/cpp_no_group/datasets/google_message3/benchmark_message3_8.pb.h \ + gogo/cpp_no_group/datasets/google_message4/benchmark_message4.pb.h \ + gogo/cpp_no_group/datasets/google_message4/benchmark_message4_1.pb.h \ + gogo/cpp_no_group/datasets/google_message4/benchmark_message4_2.pb.h \ + gogo/cpp_no_group/datasets/google_message4/benchmark_message4_3.pb.h + +cpp_no_group_benchmarks_protoc_outputs_proto2 = \ + gogo/cpp_no_group/datasets/google_message1/proto2/benchmark_message1_proto2.pb.cc \ + gogo/cpp_no_group/datasets/google_message2/benchmark_message2.pb.cc \ + gogo/cpp_no_group/datasets/google_message3/benchmark_message3.pb.cc \ + gogo/cpp_no_group/datasets/google_message3/benchmark_message3_1.pb.cc \ + gogo/cpp_no_group/datasets/google_message3/benchmark_message3_2.pb.cc \ + gogo/cpp_no_group/datasets/google_message3/benchmark_message3_3.pb.cc \ + gogo/cpp_no_group/datasets/google_message3/benchmark_message3_4.pb.cc \ + gogo/cpp_no_group/datasets/google_message3/benchmark_message3_5.pb.cc \ + gogo/cpp_no_group/datasets/google_message3/benchmark_message3_6.pb.cc \ + gogo/cpp_no_group/datasets/google_message3/benchmark_message3_7.pb.cc \ + gogo/cpp_no_group/datasets/google_message3/benchmark_message3_8.pb.cc \ + gogo/cpp_no_group/datasets/google_message4/benchmark_message4.pb.cc \ + gogo/cpp_no_group/datasets/google_message4/benchmark_message4_1.pb.cc \ + gogo/cpp_no_group/datasets/google_message4/benchmark_message4_2.pb.cc \ + gogo/cpp_no_group/datasets/google_message4/benchmark_message4_3.pb.cc + +$(cpp_no_group_benchmarks_protoc_outputs): cpp_no_group_protoc_middleman +$(cpp_no_group_benchmarks_protoc_outputs_header): cpp_no_group_protoc_middleman +$(cpp_no_group_benchmarks_protoc_outputs_proto2): cpp_no_group_protoc_middleman +$(cpp_no_group_benchmarks_protoc_outputs_proto2_header): cpp_no_group_protoc_middleman + +generate_cpp_no_group_benchmark_code: + cp $(srcdir)/cpp/cpp_benchmark.cc gogo/cpp_no_group/cpp_benchmark.cc + sed -i -e "s/\#include \"datasets/\#include \"gogo\/cpp_no_group\/datasets/g" gogo/cpp_no_group/cpp_benchmark.cc + sed -i -e "s/\#include \"benchmarks.pb.h/\#include \"gogo\/cpp_no_group\/benchmarks.pb.h/g" gogo/cpp_no_group/cpp_benchmark.cc + touch generate_cpp_no_group_benchmark_code + +bin_PROGRAMS += cpp-no-group-benchmark +cpp_no_group_benchmark_LDADD = $(top_srcdir)/src/libprotobuf.la $(top_srcdir)/third_party/benchmark/src/libbenchmark.a +cpp_no_group_benchmark_SOURCES = gogo/cpp_no_group/cpp_benchmark.cc +cpp_no_group_benchmark_CPPFLAGS = -I$(top_srcdir)/src -I$(srcdir)/gogo/cpp_no_group -I$(top_srcdir)/third_party/benchmark/include +# Explicit deps because BUILT_SOURCES are only done before a "make all/check" +# so a direct "make test_cpp" could fail if parallel enough. +# See: https://www.gnu.org/software/automake/manual/html_node/Built-Sources-Example.html#Recording-Dependencies-manually +gogo/cpp_no_group/cpp_no_group_benchmark-cpp_benchmark.$(OBJEXT): $(cpp_no_group_benchmarks_protoc_outputs) $(cpp_no_group_benchmarks_protoc_outputs_proto2) $(cpp_no_group_benchmarks_protoc_outputs_header) \ + $(cpp_no_group_benchmarks_protoc_outputs_proto2_header) $(top_srcdir)/third_party/benchmark/src/libbenchmark.a generate_cpp_no_group_benchmark_code +gogo/cpp_no_group/cpp_benchmark.cc: generate_cpp_no_group_benchmark_code +nodist_cpp_no_group_benchmark_SOURCES = \ + $(cpp_no_group_benchmarks_protoc_outputs_proto2) \ + $(cpp_no_group_benchmarks_protoc_outputs) \ + $(cpp_no_group_benchmarks_protoc_outputs_header) \ + $(cpp_no_group_benchmarks_protoc_outputs_proto2_header) + +cpp_no_group: cpp_no_group_protoc_middleman generate_gogo_data cpp-no-group-benchmark + ./cpp-no-group-benchmark $(gogo_data) + +gogo_proto_middleman: protoc-gen-gogoproto + mkdir -p "tmp/gogo_proto" + oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I$(srcdir) -I$(top_srcdir) --plugin=protoc-gen-gogoproto --gogoproto_out=$$oldpwd/tmp/gogo_proto $(benchmarks_protoc_inputs) $(benchmarks_protoc_inputs_benchmark_wrapper) $(benchmarks_protoc_inputs_proto2) ) + touch gogo_proto_middleman + +new_data = $$(for data in $(all_data); do echo "tmp$${data\#$(srcdir)}"; done | xargs) + +generate_gogo_data: protoc_middleman protoc_middleman2 gogo-data-scrubber + mkdir -p `dirname $(new_data)` + ./gogo-data-scrubber $(all_data) $(new_data) + touch generate_gogo_data + +make_tmp_dir_gogo: + mkdir -p tmp/go_no_group/benchmark_code + mkdir -p tmp/gogofast/benchmark_code + mkdir -p tmp/gogofaster/benchmark_code + mkdir -p tmp/gogoslick/benchmark_code + touch make_tmp_dir_gogo + +go_no_group_protoc_middleman: make_tmp_dir_gogo $(top_srcdir)/src/protoc$(EXEEXT) gogo_proto_middleman $(well_known_type_protoc_inputs) + oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --go_out=$$oldpwd/tmp/go_no_group $(benchmarks_protoc_inputs) ) + oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --go_out=$$oldpwd/tmp/go_no_group $(benchmarks_protoc_inputs_benchmark_wrapper) ) + oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --go_out=$$oldpwd/tmp/go_no_group $(benchmarks_protoc_inputs_proto2_message1) ) + oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --go_out=$$oldpwd/tmp/go_no_group $(benchmarks_protoc_inputs_proto2_message2) ) + oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --go_out=$$oldpwd/tmp/go_no_group $(benchmarks_protoc_inputs_proto2_message3) ) + oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --go_out=$$oldpwd/tmp/go_no_group $(benchmarks_protoc_inputs_proto2_message4) ) + touch go_no_group_protoc_middleman + +cpp_no_group_protoc_middleman: make_tmp_dir_gogo $(top_srcdir)/src/protoc$(EXEEXT) gogo_proto_middleman $(well_known_type_protoc_inputs) + oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --cpp_out=$$oldpwd/gogo/cpp_no_group $(benchmarks_protoc_inputs) ) + oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --cpp_out=$$oldpwd/gogo/cpp_no_group $(benchmarks_protoc_inputs_benchmark_wrapper) ) + oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --cpp_out=$$oldpwd/gogo/cpp_no_group $(benchmarks_protoc_inputs_proto2_message1) ) + oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --cpp_out=$$oldpwd/gogo/cpp_no_group $(benchmarks_protoc_inputs_proto2_message2) ) + oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --cpp_out=$$oldpwd/gogo/cpp_no_group $(benchmarks_protoc_inputs_proto2_message3) ) + oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --cpp_out=$$oldpwd/gogo/cpp_no_group $(benchmarks_protoc_inputs_proto2_message4) ) + touch cpp_no_group_protoc_middleman + +gogofast_protoc_middleman: make_tmp_dir_gogo $(top_srcdir)/src/protoc$(EXEEXT) gogo_proto_middleman $(well_known_type_protoc_inputs) + oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --gogofast_out=$$oldpwd/tmp/gogofast $(benchmarks_protoc_inputs) ) + oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --gogofast_out=$$oldpwd/tmp/gogofast $(benchmarks_protoc_inputs_benchmark_wrapper) ) + oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --gogofast_out=$$oldpwd/tmp/gogofast $(benchmarks_protoc_inputs_proto2_message1) ) + oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --gogofast_out=$$oldpwd/tmp/gogofast $(benchmarks_protoc_inputs_proto2_message2) ) + oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --gogofast_out=$$oldpwd/tmp/gogofast $(benchmarks_protoc_inputs_proto2_message3) ) + oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --gogofast_out=$$oldpwd/tmp/gogofast $(benchmarks_protoc_inputs_proto2_message4) ) + touch gogofast_protoc_middleman + +gogofaster_protoc_middleman: make_tmp_dir_gogo $(top_srcdir)/src/protoc$(EXEEXT) gogo_proto_middleman $(well_known_type_protoc_inputs) + oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --gogofaster_out=$$oldpwd/tmp/gogofaster $(benchmarks_protoc_inputs) ) + oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --gogofaster_out=$$oldpwd/tmp/gogofaster $(benchmarks_protoc_inputs_benchmark_wrapper) ) + oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --gogofaster_out=$$oldpwd/tmp/gogofaster $(benchmarks_protoc_inputs_proto2_message1) ) + oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --gogofaster_out=$$oldpwd/tmp/gogofaster $(benchmarks_protoc_inputs_proto2_message2) ) + oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --gogofaster_out=$$oldpwd/tmp/gogofaster $(benchmarks_protoc_inputs_proto2_message3) ) + oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --gogofaster_out=$$oldpwd/tmp/gogofaster $(benchmarks_protoc_inputs_proto2_message4) ) + touch gogofaster_protoc_middleman + +gogoslick_protoc_middleman: make_tmp_dir_gogo $(top_srcdir)/src/protoc$(EXEEXT) gogo_proto_middleman $(well_known_type_protoc_inputs) + oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --gogoslick_out=$$oldpwd/tmp/gogoslick $(benchmarks_protoc_inputs) ) + oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --gogoslick_out=$$oldpwd/tmp/gogoslick $(benchmarks_protoc_inputs_benchmark_wrapper) ) + oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --gogoslick_out=$$oldpwd/tmp/gogoslick $(benchmarks_protoc_inputs_proto2_message1) ) + oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --gogoslick_out=$$oldpwd/tmp/gogoslick $(benchmarks_protoc_inputs_proto2_message2) ) + oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --gogoslick_out=$$oldpwd/tmp/gogoslick $(benchmarks_protoc_inputs_proto2_message3) ) + oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --gogoslick_out=$$oldpwd/tmp/gogoslick $(benchmarks_protoc_inputs_proto2_message4) ) + touch gogoslick_protoc_middleman + +gogo_data = $$(find . -type f -name "dataset.*.pb" -path "./tmp/*") + +generate-gogo-benchmark-code: + @echo '#! /bin/bash' > generate-gogo-benchmark-code + @echo 'cp $(srcdir)/go/go_benchmark_test.go tmp/$$1/benchmark_code/$$1_benchmark1_test.go' >> generate-gogo-benchmark-code + @echo 'sed -i -e "s/\.\.\/tmp/../g" tmp/$$1/benchmark_code/$$1_benchmark1_test.go' >> generate-gogo-benchmark-code + @echo 'sed -i -e "s/b\.Run(\"\(.*\)\"/b.Run(\"\1\_$$1\"/g" tmp/$$1/benchmark_code/$$1_benchmark1_test.go' >> generate-gogo-benchmark-code + @echo 'if [[ $$2 == 1 ]]; then sed -i -e "s/github\.com\/golang/github.com\/gogo/g" tmp/$$1/benchmark_code/$$1_benchmark1_test.go; fi ' >> generate-gogo-benchmark-code + @chmod +x generate-gogo-benchmark-code + +generate_all_gogo_benchmark_code: generate-gogo-benchmark-code make_tmp_dir_gogo + ./generate-gogo-benchmark-code go_no_group 0 + ./generate-gogo-benchmark-code gogofast 1 + ./generate-gogo-benchmark-code gogofaster 1 + ./generate-gogo-benchmark-code gogoslick 1 + +gogo-benchmark: + @echo "Writing shortcut script gogo-benchmark..." + @echo '#! /bin/bash' > gogo-benchmark + @echo 'cd tmp/$$1/benchmark_code' >> gogo-benchmark + @echo 'shift' >> gogo-benchmark + @echo 'all_data=""' >> gogo-benchmark + @echo 'for data_file in $$@; do all_data="$$all_data ../../../$$data_file"; done' >> gogo-benchmark + @echo 'go test -bench=. -- $$all_data' >> gogo-benchmark + @echo 'cd ../..' >> gogo-benchmark + @chmod +x gogo-benchmark + +go_no_group: go_no_group_protoc_middleman generate_gogo_data generate_all_gogo_benchmark_code gogo-benchmark + ./gogo-benchmark go_no_group $(gogo_data) + +gogofast: gogofast_protoc_middleman generate_gogo_data gogo-benchmark generate_all_gogo_benchmark_code + ./gogo-benchmark gogofast $(gogo_data) + +gogofaster: gogofaster_protoc_middleman generate_gogo_data gogo-benchmark generate_all_gogo_benchmark_code + ./gogo-benchmark gogofaster $(gogo_data) + +gogoslick: gogoslick_protoc_middleman generate_gogo_data gogo-benchmark generate_all_gogo_benchmark_code + ./gogo-benchmark gogoslick $(gogo_data) + + +############# GOGO RULES END ############ + + +############ UTIL RULES BEGIN ############ + +bin_PROGRAMS += protoc-gen-gogoproto gogo-data-scrubber + +protoc_gen_gogoproto_LDADD = $(top_srcdir)/src/libprotobuf.la $(top_srcdir)/src/libprotoc.la +protoc_gen_gogoproto_SOURCES = util/protoc-gen-gogoproto.cc +protoc_gen_gogoproto_CPPFLAGS = -I$(top_srcdir)/src -I$(srcdir)/cpp -I$(srcdir)/util + +gogo_data_scrubber_LDADD = $(top_srcdir)/src/libprotobuf.la +gogo_data_scrubber_SOURCES = util/gogo_data_scrubber.cc +gogo_data_scrubber_CPPFLAGS = -I$(top_srcdir)/src -I$(srcdir)/cpp -I$(srcdir)/util +util/gogo_data_scrubber-gogo_data_scrubber.$(OBJEXT): $(benchmarks_protoc_outputs) $(benchmarks_protoc_outputs_proto2) $(benchmarks_protoc_outputs_header) $(benchmarks_protoc_outputs_proto2_header) +nodist_gogo_data_scrubber_SOURCES = \ + $(benchmarks_protoc_outputs) \ + $(benchmarks_protoc_outputs_proto2) \ + $(benchmarks_protoc_outputs_proto2_header) \ + $(benchmarks_protoc_outputs_header) + +############ UTIL RULES END ############ + +MAINTAINERCLEANFILES = \ + Makefile.in + +CLEANFILES = \ + $(benchmarks_protoc_outputs) \ + $(benchmarks_protoc_outputs_header) \ + $(benchmarks_protoc_outputs_proto2) \ + $(benchmarks_protoc_outputs_proto2_header) \ + initialize_submodule \ + make_tmp_dir \ + protoc_middleman \ + protoc_middleman2 \ + javac_middleman \ + java-benchmark \ + python_cpp_proto_library \ + python-pure-python-benchmark \ + python-cpp-reflection-benchmark \ + python-cpp-generated-code-benchmark \ + go-benchmark \ + go_protoc_middleman \ + make_tmp_dir_gogo \ + gogo_proto_middleman \ + generate_gogo_data \ + go_no_group_protoc_middleman \ + go_no_group \ + go-no-group-benchmark \ + $(cpp_no_group_benchmarks_protoc_outputs_header) \ + $(cpp_no_group_benchmarks_protoc_outputs) \ + $(cpp_no_group_benchmarks_protoc_outputs_proto2_header) \ + $(cpp_no_group_benchmarks_protoc_outputs_proto2) \ + generate_all_gogo_benchmark_code \ + generate-gogo-benchmark-code \ + cpp_no_group_protoc_middleman \ + generate_cpp_no_group_benchmark_code \ + generate_gogo_benchmark_code \ + gogofast_protoc_middleman \ + gogofast \ + gogofaster_protoc_middleman \ + gogofaster \ + gogoslick_protoc_middleman \ + gogoslick \ + gogo-benchmark \ + gogo/cpp_no_group/cpp_benchmark.* + -endif +clean-local: + -rm -rf tmp/* diff -Nru protobuf-3.0.0/benchmarks/ProtoBench.java protobuf-3.6.1.3/benchmarks/ProtoBench.java --- protobuf-3.0.0/benchmarks/ProtoBench.java 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/benchmarks/ProtoBench.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,203 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2009 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package com.google.protocolbuffers; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.RandomAccessFile; -import java.lang.reflect.Method; - -import com.google.protobuf.ByteString; -import com.google.protobuf.CodedInputStream; -import com.google.protobuf.CodedOutputStream; -import com.google.protobuf.Message; - -public class ProtoBench { - - private static final long MIN_SAMPLE_TIME_MS = 2 * 1000; - private static final long TARGET_TIME_MS = 30 * 1000; - - private ProtoBench() { - // Prevent instantiation - } - - public static void main(String[] args) { - if (args.length < 2 || (args.length % 2) != 0) { - System.err.println("Usage: ProtoBench "); - System.err.println("The descriptor type name is the fully-qualified message name,"); - System.err.println("e.g. com.google.protocolbuffers.benchmark.Message1"); - System.err.println("(You can specify multiple pairs of descriptor type name and input data.)"); - System.exit(1); - } - boolean success = true; - for (int i = 0; i < args.length; i += 2) { - success &= runTest(args[i], args[i + 1]); - } - System.exit(success ? 0 : 1); - } - - /** - * Runs a single test. Error messages are displayed to stderr, and the return value - * indicates general success/failure. - */ - public static boolean runTest(String type, String file) { - System.out.println("Benchmarking " + type + " with file " + file); - final Message defaultMessage; - try { - Class clazz = Class.forName(type); - Method method = clazz.getDeclaredMethod("getDefaultInstance"); - defaultMessage = (Message) method.invoke(null); - } catch (Exception e) { - // We want to do the same thing with all exceptions. Not generally nice, - // but this is slightly different. - System.err.println("Unable to get default message for " + type); - return false; - } - - try { - final byte[] inputData = readAllBytes(file); - final ByteArrayInputStream inputStream = new ByteArrayInputStream(inputData); - final ByteString inputString = ByteString.copyFrom(inputData); - final Message sampleMessage = defaultMessage.newBuilderForType().mergeFrom(inputString).build(); - FileOutputStream devNullTemp = null; - CodedOutputStream reuseDevNullTemp = null; - try { - devNullTemp = new FileOutputStream("/dev/null"); - reuseDevNullTemp = CodedOutputStream.newInstance(devNullTemp); - } catch (FileNotFoundException e) { - // ignore: this is probably Windows, where /dev/null does not exist - } - final FileOutputStream devNull = devNullTemp; - final CodedOutputStream reuseDevNull = reuseDevNullTemp; - benchmark("Serialize to byte string", inputData.length, new Action() { - public void execute() { sampleMessage.toByteString(); } - }); - benchmark("Serialize to byte array", inputData.length, new Action() { - public void execute() { sampleMessage.toByteArray(); } - }); - benchmark("Serialize to memory stream", inputData.length, new Action() { - public void execute() throws IOException { - sampleMessage.writeTo(new ByteArrayOutputStream()); - } - }); - if (devNull != null) { - benchmark("Serialize to /dev/null with FileOutputStream", inputData.length, new Action() { - public void execute() throws IOException { - sampleMessage.writeTo(devNull); - } - }); - benchmark("Serialize to /dev/null reusing FileOutputStream", inputData.length, new Action() { - public void execute() throws IOException { - sampleMessage.writeTo(reuseDevNull); - reuseDevNull.flush(); // force the write to the OutputStream - } - }); - } - benchmark("Deserialize from byte string", inputData.length, new Action() { - public void execute() throws IOException { - defaultMessage.newBuilderForType().mergeFrom(inputString).build(); - } - }); - benchmark("Deserialize from byte array", inputData.length, new Action() { - public void execute() throws IOException { - defaultMessage.newBuilderForType() - .mergeFrom(CodedInputStream.newInstance(inputData)).build(); - } - }); - benchmark("Deserialize from memory stream", inputData.length, new Action() { - public void execute() throws IOException { - defaultMessage.newBuilderForType() - .mergeFrom(CodedInputStream.newInstance(inputStream)).build(); - inputStream.reset(); - } - }); - System.out.println(); - return true; - } catch (Exception e) { - System.err.println("Error: " + e.getMessage()); - System.err.println("Detailed exception information:"); - e.printStackTrace(System.err); - return false; - } - } - - private static void benchmark(String name, long dataSize, Action action) throws IOException { - // Make sure it's JITted "reasonably" hard before running the first progress test - for (int i=0; i < 100; i++) { - action.execute(); - } - - // Run it progressively more times until we've got a reasonable sample - int iterations = 1; - long elapsed = timeAction(action, iterations); - while (elapsed < MIN_SAMPLE_TIME_MS) { - iterations *= 2; - elapsed = timeAction(action, iterations); - } - - // Upscale the sample to the target time. Do this in floating point arithmetic - // to avoid overflow issues. - iterations = (int) ((TARGET_TIME_MS / (double) elapsed) * iterations); - elapsed = timeAction(action, iterations); - System.out.println(name + ": " + iterations + " iterations in " - + (elapsed/1000f) + "s; " - + (iterations * dataSize) / (elapsed * 1024 * 1024 / 1000f) - + "MB/s"); - } - - private static long timeAction(Action action, int iterations) throws IOException { - System.gc(); - long start = System.currentTimeMillis(); - for (int i = 0; i < iterations; i++) { - action.execute(); - } - long end = System.currentTimeMillis(); - return end - start; - } - - private static byte[] readAllBytes(String filename) throws IOException { - RandomAccessFile file = new RandomAccessFile(new File(filename), "r"); - byte[] content = new byte[(int) file.length()]; - file.readFully(content); - return content; - } - - /** - * Interface used to capture a single action to benchmark. - */ - interface Action { - void execute() throws IOException; - } -} diff -Nru protobuf-3.0.0/benchmarks/python/py_benchmark.py protobuf-3.6.1.3/benchmarks/python/py_benchmark.py --- protobuf-3.0.0/benchmarks/python/py_benchmark.py 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/benchmarks/python/py_benchmark.py 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,152 @@ +import sys +import os +import timeit +import math +import argparse +import fnmatch +import json + +parser = argparse.ArgumentParser(description="Python protobuf benchmark") +parser.add_argument("data_files", metavar="dataFile", nargs="+", + help="testing data files.") +parser.add_argument("--json", action="store_const", dest="json", + const="yes", default="no", + help="Whether to output json results") +parser.add_argument("--behavior_prefix", dest="behavior_prefix", + help="The output json format's behavior's name's prefix", + default="") +# BEGIN CPP GENERATED MESSAGE +parser.add_argument("--cpp_generated", action="store_const", + dest="cpp_generated", const="yes", default="no", + help="Whether to link generated code library") +# END CPP GENERATED MESSAGE +args = parser.parse_args() +# BEGIN CPP GENERATED MESSAGE +# CPP generated code must be linked before importing the generated Python code +# for the descriptor can be found in the pool +if args.cpp_generated != "no": + sys.path.append( os.path.dirname( os.path.dirname( os.path.abspath(__file__) ) ) + "/.libs" ) + import libbenchmark_messages + sys.path.append( os.path.dirname( os.path.dirname( os.path.abspath(__file__) ) ) + "/tmp" ) +# END CPP GENERATED MESSAGE + + +import datasets.google_message1.proto2.benchmark_message1_proto2_pb2 as benchmark_message1_proto2_pb2 +import datasets.google_message1.proto3.benchmark_message1_proto3_pb2 as benchmark_message1_proto3_pb2 +import datasets.google_message2.benchmark_message2_pb2 as benchmark_message2_pb2 +import datasets.google_message3.benchmark_message3_pb2 as benchmark_message3_pb2 +import datasets.google_message4.benchmark_message4_pb2 as benchmark_message4_pb2 +import benchmarks_pb2 as benchmarks_pb2 + + +def run_one_test(filename): + data = open(filename).read() + benchmark_dataset = benchmarks_pb2.BenchmarkDataset() + benchmark_dataset.ParseFromString(data) + benchmark_util = Benchmark(full_iteration=len(benchmark_dataset.payload), + module="py_benchmark", + setup_method="init") + result={} + result["filename"] = filename + result["message_name"] = benchmark_dataset.message_name + result["benchmarks"] = {} + benchmark_util.set_test_method("parse_from_benchmark") + result["benchmarks"][args.behavior_prefix + "_parse_from_benchmark"] = \ + benchmark_util.run_benchmark(setup_method_args='"%s"' % (filename)) + benchmark_util.set_test_method("serialize_to_benchmark") + result["benchmarks"][args.behavior_prefix + "_serialize_to_benchmark"] = \ + benchmark_util.run_benchmark(setup_method_args='"%s"' % (filename)) + return result + + +def init(filename): + global benchmark_dataset, message_class, message_list, counter + message_list=[] + counter = 0 + data = open(os.path.dirname(sys.argv[0]) + "/../" + filename).read() + benchmark_dataset = benchmarks_pb2.BenchmarkDataset() + benchmark_dataset.ParseFromString(data) + + if benchmark_dataset.message_name == "benchmarks.proto3.GoogleMessage1": + message_class = benchmark_message1_proto3_pb2.GoogleMessage1 + elif benchmark_dataset.message_name == "benchmarks.proto2.GoogleMessage1": + message_class = benchmark_message1_proto2_pb2.GoogleMessage1 + elif benchmark_dataset.message_name == "benchmarks.proto2.GoogleMessage2": + message_class = benchmark_message2_pb2.GoogleMessage2 + elif benchmark_dataset.message_name == "benchmarks.google_message3.GoogleMessage3": + message_class = benchmark_message3_pb2.GoogleMessage3 + elif benchmark_dataset.message_name == "benchmarks.google_message4.GoogleMessage4": + message_class = benchmark_message4_pb2.GoogleMessage4 + else: + raise IOError("Message %s not found!" % (benchmark_dataset.message_name)) + + for one_payload in benchmark_dataset.payload: + temp = message_class() + temp.ParseFromString(one_payload) + message_list.append(temp) + + +def parse_from_benchmark(): + global counter, message_class, benchmark_dataset + m = message_class().ParseFromString(benchmark_dataset.payload[counter % len(benchmark_dataset.payload)]) + counter = counter + 1 + + +def serialize_to_benchmark(): + global counter, message_list, message_class + s = message_list[counter % len(benchmark_dataset.payload)].SerializeToString() + counter = counter + 1 + + +class Benchmark: + def __init__(self, module=None, test_method=None, + setup_method=None, full_iteration = 1): + self.full_iteration = full_iteration + self.module = module + self.test_method = test_method + self.setup_method = setup_method + + def set_test_method(self, test_method): + self.test_method = test_method + + def full_setup_code(self, setup_method_args=''): + setup_code = "" + setup_code += "from %s import %s\n" % (self.module, self.test_method) + setup_code += "from %s import %s\n" % (self.module, self.setup_method) + setup_code += "%s(%s)\n" % (self.setup_method, setup_method_args) + return setup_code + + def dry_run(self, test_method_args='', setup_method_args=''): + return timeit.timeit(stmt="%s(%s)" % (self.test_method, test_method_args), + setup=self.full_setup_code(setup_method_args), + number=self.full_iteration); + + def run_benchmark(self, test_method_args='', setup_method_args=''): + reps = self.full_iteration; + t = self.dry_run(test_method_args, setup_method_args); + if t < 3 : + reps = int(math.ceil(3 / t)) * self.full_iteration + t = timeit.timeit(stmt="%s(%s)" % (self.test_method, test_method_args), + setup=self.full_setup_code(setup_method_args), + number=reps); + return 1.0 * t / reps * (10 ** 9) + + +if __name__ == "__main__": + results = [] + for file in args.data_files: + results.append(run_one_test(file)) + + if args.json != "no": + print json.dumps(results) + else: + for result in results: + print "Message %s of dataset file %s" % \ + (result["message_name"], result["filename"]) + print "Average time for parse_from_benchmark: %.2f ns" % \ + (result["benchmarks"][ \ + args.behavior_prefix + "_parse_from_benchmark"]) + print "Average time for serialize_to_benchmark: %.2f ns" % \ + (result["benchmarks"][ \ + args.behavior_prefix + "_serialize_to_benchmark"]) + print "" diff -Nru protobuf-3.0.0/benchmarks/python/python_benchmark_messages.cc protobuf-3.6.1.3/benchmarks/python/python_benchmark_messages.cc --- protobuf-3.0.0/benchmarks/python/python_benchmark_messages.cc 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/benchmarks/python/python_benchmark_messages.cc 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,29 @@ +#include + +#include "benchmarks.pb.h" +#include "datasets/google_message1/proto2/benchmark_message1_proto2.pb.h" +#include "datasets/google_message1/proto3/benchmark_message1_proto3.pb.h" +#include "datasets/google_message2/benchmark_message2.pb.h" +#include "datasets/google_message3/benchmark_message3.pb.h" +#include "datasets/google_message4/benchmark_message4.pb.h" + +static PyMethodDef python_benchmark_methods[] = { + {NULL, NULL, 0, NULL} /* Sentinel */ +}; + + +PyMODINIT_FUNC +initlibbenchmark_messages() { + benchmarks::BenchmarkDataset().descriptor(); + benchmarks::proto3::GoogleMessage1().descriptor(); + benchmarks::proto2::GoogleMessage1().descriptor(); + benchmarks::proto2::GoogleMessage2().descriptor(); + benchmarks::google_message3::GoogleMessage3().descriptor(); + benchmarks::google_message4::GoogleMessage4().descriptor(); + + PyObject *m; + + m = Py_InitModule("libbenchmark_messages", python_benchmark_methods); + if (m == NULL) + return; +} diff -Nru protobuf-3.0.0/benchmarks/README.md protobuf-3.6.1.3/benchmarks/README.md --- protobuf-3.0.0/benchmarks/README.md 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/benchmarks/README.md 2018-12-08 01:32:11.000000000 +0000 @@ -3,23 +3,182 @@ This directory contains benchmarking schemas and data sets that you can use to test a variety of performance scenarios against your -protobuf language runtime. +protobuf language runtime. If you are looking for performance +numbers of officially support languages, see [here]( +https://github.com/google/protobuf/blob/master/docs/Performance.md) + +## Prerequisite + +First, you need to follow the instruction in the root directory's README to +build your language's protobuf, then: + +### CPP +You need to install [cmake](https://cmake.org/) before building the benchmark. + +We are using [google/benchmark](https://github.com/google/benchmark) as the +benchmark tool for testing cpp. This will be automaticly made during build the +cpp benchmark. + +The cpp protobuf performance can be improved by linking with [tcmalloc library]( +https://gperftools.github.io/gperftools/tcmalloc.html). For using tcmalloc, you +need to build [gpertools](https://github.com/gperftools/gperftools) to generate +libtcmallc.so library. + +### Java +We're using maven to build the java benchmarks, which is the same as to build +the Java protobuf. There're no other tools need to install. We're using +[google/caliper](https://github.com/google/caliper) as benchmark tool, which +can be automaticly included by maven. + +### Python +We're using python C++ API for testing the generated +CPP proto version of python protobuf, which is also a prerequisite for Python +protobuf cpp implementation. You need to install the correct version of Python +C++ extension package before run generated CPP proto version of Python +protobuf's benchmark. e.g. under Ubuntu, you need to -The schema for the datasets is described in `benchmarks.proto`. +``` +$ sudo apt-get install python-dev +$ sudo apt-get install python3-dev +``` +And you also need to make sure `pkg-config` is installed. + +### Go +Go protobufs are maintained at [github.com/golang/protobuf]( +http://github.com/golang/protobuf). If not done already, you need to install the +toolchain and the Go protoc-gen-go plugin for protoc. + +To install protoc-gen-go, run: + +``` +$ go get -u github.com/golang/protobuf/protoc-gen-go +$ export PATH=$PATH:$(go env GOPATH)/bin +``` + +The first command installs `protoc-gen-go` into the `bin` directory in your local `GOPATH`. +The second command adds the `bin` directory to your `PATH` so that `protoc` can locate the plugin later. + +### Big data + +There's some optional big testing data which is not included in the directory +initially, you need to run the following command to download the testing data: + +``` +$ ./download_data.sh +``` + +After doing this the big data file will automaticly generated in the +benchmark directory. + +## Run instructions + +To run all the benchmark dataset: + +### Java: + +``` +$ make java +``` + +### CPP: + +``` +$ make cpp +``` + +For linking with tcmalloc: + +``` +$ env LD_PRELOAD={directory to libtcmalloc.so} make cpp +``` + +### Python: + +We have three versions of python protobuf implementation: pure python, cpp +reflection and cpp generated code. To run these version benchmark, you need to: + +#### Pure Python: + +``` +$ make python-pure-python +``` + +#### CPP reflection: + +``` +$ make python-cpp-reflection +``` + +#### CPP generated code: + +``` +$ make python-cpp-generated-code +``` + +### Go +``` +$ make go +``` + +To run a specific dataset or run with specific options: -Generate the data sets like so: +### Java: ``` -$ make -$ ./generate-datasets -Wrote dataset: dataset.google_message1_proto3.pb -Wrote dataset: dataset.google_message1_proto2.pb -Wrote dataset: dataset.google_message2.pb -$ +$ make java-benchmark +$ ./java-benchmark $(specific generated dataset file name) [$(caliper options)] +``` + +### CPP: + +``` +$ make cpp-benchmark +$ ./cpp-benchmark $(specific generated dataset file name) [$(benchmark options)] +``` + +### Python: + +For Python benchmark we have `--json` for outputing the json result + +#### Pure Python: + ``` +$ make python-pure-python-benchmark +$ ./python-pure-python-benchmark [--json] $(specific generated dataset file name) +``` + +#### CPP reflection: + +``` +$ make python-cpp-reflection-benchmark +$ ./python-cpp-reflection-benchmark [--json] $(specific generated dataset file name) +``` + +#### CPP generated code: + +``` +$ make python-cpp-generated-code-benchmark +$ ./python-cpp-generated-code-benchmark [--json] $(specific generated dataset file name) +``` + +### Go: +``` +$ make go-benchmark +$ ./go-benchmark $(specific generated dataset file name) [go testing options] +``` + + +## Benchmark datasets + +Each data set is in the format of benchmarks.proto: + +1. name is the benchmark dataset's name. +2. message_name is the benchmark's message type full name (including package and message name) +3. payload is the list of raw data. + +The schema for the datasets is described in `benchmarks.proto`. -Each data set will be written to its own file. Benchmarks will -likely want to run several benchmarks against each data set (parse, +Benchmark likely want to run several benchmarks against each data set (parse, serialize, possibly JSON, possibly using different APIs, etc). We would like to add more data sets. In general we will favor data sets diff -Nru protobuf-3.0.0/benchmarks/readme.txt protobuf-3.6.1.3/benchmarks/readme.txt --- protobuf-3.0.0/benchmarks/readme.txt 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/benchmarks/readme.txt 1970-01-01 00:00:00.000000000 +0000 @@ -1,50 +0,0 @@ -Contents --------- - -This folder contains three kinds of file: - -- Code, such as ProtoBench.java, to build the benchmarking framework. -- Protocol buffer definitions (.proto files) -- Sample data files - -If we end up with a lot of different benchmarks it may be worth -separating these out info different directories, but while there are -so few they might as well all be together. - -Running a benchmark (Java) --------------------------- - -1) Build protoc and the Java protocol buffer library. The examples - below assume a jar file (protobuf.jar) has been built and copied - into this directory. - -2) Build ProtoBench: - $ javac -d tmp -cp protobuf.jar ProtoBench.java - -3) Generate code for the relevant benchmark protocol buffer, e.g. - $ protoc --java_out=tmp google_size.proto google_speed.proto - -4) Build the generated code, e.g. - $ cd tmp - $ javac -d . -cp ../protobuf.jar benchmarks/*.java - -5) Run the test. Arguments are given in pairs - the first argument - is the descriptor type; the second is the filename. For example: - $ java -cp .;../protobuf.jar com.google.protocolbuffers.ProtoBench - benchmarks.GoogleSize$SizeMessage1 ../google_message1.dat - benchmarks.GoogleSpeed$SpeedMessage1 ../google_message1.dat - benchmarks.GoogleSize$SizeMessage2 ../google_message2.dat - benchmarks.GoogleSpeed$SpeedMessage2 ../google_message2.dat - -6) Wait! Each test runs for around 30 seconds, and there are 6 tests - per class/data combination. The above command would therefore take - about 12 minutes to run. - - -Benchmarks available --------------------- - -From Google: -google_size.proto and google_speed.proto, messages -google_message1.dat and google_message2.dat. The proto files are -equivalent, but optimized differently. diff -Nru protobuf-3.0.0/benchmarks/util/big_query_utils.py protobuf-3.6.1.3/benchmarks/util/big_query_utils.py --- protobuf-3.0.0/benchmarks/util/big_query_utils.py 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/benchmarks/util/big_query_utils.py 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,188 @@ +#!/usr/bin/env python2.7 + +import argparse +import json +import uuid +import httplib2 + +from apiclient import discovery +from apiclient.errors import HttpError +from oauth2client.client import GoogleCredentials + +# 30 days in milliseconds +_EXPIRATION_MS = 30 * 24 * 60 * 60 * 1000 +NUM_RETRIES = 3 + + +def create_big_query(): + """Authenticates with cloud platform and gets a BiqQuery service object + """ + creds = GoogleCredentials.get_application_default() + return discovery.build( + 'bigquery', 'v2', credentials=creds, cache_discovery=False) + + +def create_dataset(biq_query, project_id, dataset_id): + is_success = True + body = { + 'datasetReference': { + 'projectId': project_id, + 'datasetId': dataset_id + } + } + + try: + dataset_req = biq_query.datasets().insert( + projectId=project_id, body=body) + dataset_req.execute(num_retries=NUM_RETRIES) + except HttpError as http_error: + if http_error.resp.status == 409: + print 'Warning: The dataset %s already exists' % dataset_id + else: + # Note: For more debugging info, print "http_error.content" + print 'Error in creating dataset: %s. Err: %s' % (dataset_id, + http_error) + is_success = False + return is_success + + +def create_table(big_query, project_id, dataset_id, table_id, table_schema, + description): + fields = [{ + 'name': field_name, + 'type': field_type, + 'description': field_description + } for (field_name, field_type, field_description) in table_schema] + return create_table2(big_query, project_id, dataset_id, table_id, fields, + description) + + +def create_partitioned_table(big_query, + project_id, + dataset_id, + table_id, + table_schema, + description, + partition_type='DAY', + expiration_ms=_EXPIRATION_MS): + """Creates a partitioned table. By default, a date-paritioned table is created with + each partition lasting 30 days after it was last modified. + """ + fields = [{ + 'name': field_name, + 'type': field_type, + 'description': field_description + } for (field_name, field_type, field_description) in table_schema] + return create_table2(big_query, project_id, dataset_id, table_id, fields, + description, partition_type, expiration_ms) + + +def create_table2(big_query, + project_id, + dataset_id, + table_id, + fields_schema, + description, + partition_type=None, + expiration_ms=None): + is_success = True + + body = { + 'description': description, + 'schema': { + 'fields': fields_schema + }, + 'tableReference': { + 'datasetId': dataset_id, + 'projectId': project_id, + 'tableId': table_id + } + } + + if partition_type and expiration_ms: + body["timePartitioning"] = { + "type": partition_type, + "expirationMs": expiration_ms + } + + try: + table_req = big_query.tables().insert( + projectId=project_id, datasetId=dataset_id, body=body) + res = table_req.execute(num_retries=NUM_RETRIES) + print 'Successfully created %s "%s"' % (res['kind'], res['id']) + except HttpError as http_error: + if http_error.resp.status == 409: + print 'Warning: Table %s already exists' % table_id + else: + print 'Error in creating table: %s. Err: %s' % (table_id, + http_error) + is_success = False + return is_success + + +def patch_table(big_query, project_id, dataset_id, table_id, fields_schema): + is_success = True + + body = { + 'schema': { + 'fields': fields_schema + }, + 'tableReference': { + 'datasetId': dataset_id, + 'projectId': project_id, + 'tableId': table_id + } + } + + try: + table_req = big_query.tables().patch( + projectId=project_id, + datasetId=dataset_id, + tableId=table_id, + body=body) + res = table_req.execute(num_retries=NUM_RETRIES) + print 'Successfully patched %s "%s"' % (res['kind'], res['id']) + except HttpError as http_error: + print 'Error in creating table: %s. Err: %s' % (table_id, http_error) + is_success = False + return is_success + + +def insert_rows(big_query, project_id, dataset_id, table_id, rows_list): + is_success = True + body = {'rows': rows_list} + try: + insert_req = big_query.tabledata().insertAll( + projectId=project_id, + datasetId=dataset_id, + tableId=table_id, + body=body) + res = insert_req.execute(num_retries=NUM_RETRIES) + if res.get('insertErrors', None): + print 'Error inserting rows! Response: %s' % res + is_success = False + except HttpError as http_error: + print 'Error inserting rows to the table %s' % table_id + is_success = False + + return is_success + + +def sync_query_job(big_query, project_id, query, timeout=5000): + query_data = {'query': query, 'timeoutMs': timeout} + query_job = None + try: + query_job = big_query.jobs().query( + projectId=project_id, + body=query_data).execute(num_retries=NUM_RETRIES) + except HttpError as http_error: + print 'Query execute job failed with error: %s' % http_error + print http_error.content + return query_job + + + # List of (column name, column type, description) tuples +def make_row(unique_row_id, row_values_dict): + """row_values_dict is a dictionary of column name and column value. + """ + return {'insertId': unique_row_id, 'json': row_values_dict} diff -Nru protobuf-3.0.0/benchmarks/util/gogo_data_scrubber.cc protobuf-3.6.1.3/benchmarks/util/gogo_data_scrubber.cc --- protobuf-3.0.0/benchmarks/util/gogo_data_scrubber.cc 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/benchmarks/util/gogo_data_scrubber.cc 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,105 @@ +#include "benchmarks.pb.h" +#include "datasets/google_message1/proto2/benchmark_message1_proto2.pb.h" +#include "datasets/google_message1/proto3/benchmark_message1_proto3.pb.h" +#include "datasets/google_message2/benchmark_message2.pb.h" +#include "datasets/google_message3/benchmark_message3.pb.h" +#include "datasets/google_message4/benchmark_message4.pb.h" + +#include "google/protobuf/message.h" +#include "google/protobuf/descriptor.h" + +#include + +using google::protobuf::FieldDescriptor; +using google::protobuf::Message; +using google::protobuf::Reflection; + + +class DataGroupStripper { + public: + static void StripMessage(Message *message) { + std::vector set_fields; + const Reflection* reflection = message->GetReflection(); + reflection->ListFields(*message, &set_fields); + + for (size_t i = 0; i < set_fields.size(); i++) { + const FieldDescriptor* field = set_fields[i]; + if (field->type() == FieldDescriptor::TYPE_GROUP) { + reflection->ClearField(message, field); + } + if (field->type() == FieldDescriptor::TYPE_MESSAGE) { + if (field->is_repeated()) { + for (int j = 0; j < reflection->FieldSize(*message, field); j++) { + StripMessage(reflection->MutableRepeatedMessage(message, field, j)); + } + } else { + StripMessage(reflection->MutableMessage(message, field)); + } + } + } + + reflection->MutableUnknownFields(message)->Clear(); + } +}; + +std::string ReadFile(const std::string& name) { + std::ifstream file(name.c_str()); + GOOGLE_CHECK(file.is_open()) << "Couldn't find file '" + << name + << "', please make sure you are running this command from the benchmarks" + << " directory.\n"; + return std::string((std::istreambuf_iterator(file)), + std::istreambuf_iterator()); +} + +int main(int argc, char *argv[]) { + if (argc % 2 == 0 || argc == 1) { + std::cerr << "Usage: [input_files] [output_file_names] where " << + "input_files are one to one mapping to output_file_names." << + std::endl; + return 1; + } + + for (int i = argc / 2; i > 0; i--) { + const std::string &input_file = argv[i]; + const std::string &output_file = argv[i + argc / 2]; + + std::cerr << "Generating " << input_file + << " to " << output_file << std::endl; + benchmarks::BenchmarkDataset dataset; + Message* message; + std::string dataset_payload = ReadFile(input_file); + GOOGLE_CHECK(dataset.ParseFromString(dataset_payload)) + << "Can' t parse data file " << input_file; + + if (dataset.message_name() == "benchmarks.proto3.GoogleMessage1") { + message = new benchmarks::proto3::GoogleMessage1; + } else if (dataset.message_name() == "benchmarks.proto2.GoogleMessage1") { + message = new benchmarks::proto2::GoogleMessage1; + } else if (dataset.message_name() == "benchmarks.proto2.GoogleMessage2") { + message = new benchmarks::proto2::GoogleMessage2; + } else if (dataset.message_name() == + "benchmarks.google_message3.GoogleMessage3") { + message = new benchmarks::google_message3::GoogleMessage3; + } else if (dataset.message_name() == + "benchmarks.google_message4.GoogleMessage4") { + message = new benchmarks::google_message4::GoogleMessage4; + } else { + std::cerr << "Unknown message type: " << dataset.message_name(); + exit(1); + } + + for (int i = 0; i < dataset.payload_size(); i++) { + message->ParseFromString(dataset.payload(i)); + DataGroupStripper::StripMessage(message); + dataset.set_payload(i, message->SerializeAsString()); + } + + std::ofstream ofs(output_file); + ofs << dataset.SerializeAsString(); + ofs.close(); + } + + + return 0; +} diff -Nru protobuf-3.0.0/benchmarks/util/protoc-gen-gogoproto.cc protobuf-3.6.1.3/benchmarks/util/protoc-gen-gogoproto.cc --- protobuf-3.0.0/benchmarks/util/protoc-gen-gogoproto.cc 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/benchmarks/util/protoc-gen-gogoproto.cc 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,103 @@ +#include "google/protobuf/compiler/code_generator.h" +#include "google/protobuf/io/zero_copy_stream.h" +#include "google/protobuf/io/printer.h" +#include "google/protobuf/descriptor.h" +#include "google/protobuf/descriptor.pb.h" +#include "schema_proto2_to_proto3_util.h" + +#include "google/protobuf/compiler/plugin.h" + +using google::protobuf::FileDescriptorProto; +using google::protobuf::FileDescriptor; +using google::protobuf::DescriptorPool; +using google::protobuf::io::Printer; +using google::protobuf::util::SchemaGroupStripper; +using google::protobuf::util::SchemaAddZeroEnumValue; + +namespace google { +namespace protobuf { +namespace compiler { + +namespace { + +string StripProto(string filename) { + if (filename.substr(filename.size() - 11) == ".protodevel") { + // .protodevel + return filename.substr(0, filename.size() - 11); + } else { + // .proto + return filename.substr(0, filename.size() - 6); + } +} + +DescriptorPool new_pool_; + +} // namespace + +class GoGoProtoGenerator : public CodeGenerator { + public: + virtual bool GenerateAll(const std::vector& files, + const string& parameter, + GeneratorContext* context, + string* error) const { + for (int i = 0; i < files.size(); i++) { + for (auto file : files) { + bool can_generate = + (new_pool_.FindFileByName(file->name()) == nullptr); + for (int j = 0; j < file->dependency_count(); j++) { + can_generate &= (new_pool_.FindFileByName( + file->dependency(j)->name()) != nullptr); + } + for (int j = 0; j < file->public_dependency_count(); j++) { + can_generate &= (new_pool_.FindFileByName( + file->public_dependency(j)->name()) != nullptr); + } + for (int j = 0; j < file->weak_dependency_count(); j++) { + can_generate &= (new_pool_.FindFileByName( + file->weak_dependency(j)->name()) != nullptr); + } + if (can_generate) { + Generate(file, parameter, context, error); + break; + } + } + } + + return true; + } + + virtual bool Generate(const FileDescriptor* file, + const string& parameter, + GeneratorContext* context, + string* error) const { + FileDescriptorProto new_file; + file->CopyTo(&new_file); + SchemaGroupStripper::StripFile(file, &new_file); + + SchemaAddZeroEnumValue enum_scrubber; + enum_scrubber.ScrubFile(&new_file); + + string filename = file->name(); + string basename = StripProto(filename); + + std::vector> option_pairs; + ParseGeneratorParameter(parameter, &option_pairs); + + std::unique_ptr output( + context->Open(basename + ".proto")); + string content = new_pool_.BuildFile(new_file)->DebugString(); + Printer printer(output.get(), '$'); + printer.WriteRaw(content.c_str(), content.size()); + + return true; + } +}; + +} // namespace compiler +} // namespace protobuf +} // namespace google + +int main(int argc, char* argv[]) { + google::protobuf::compiler::GoGoProtoGenerator generator; + return google::protobuf::compiler::PluginMain(argc, argv, &generator); +} diff -Nru protobuf-3.0.0/benchmarks/util/run_and_upload.py protobuf-3.6.1.3/benchmarks/util/run_and_upload.py --- protobuf-3.0.0/benchmarks/util/run_and_upload.py 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/benchmarks/util/run_and_upload.py 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,290 @@ +import argparse +import os +import re +import copy +import uuid +import calendar +import time +import big_query_utils +import datetime +import json +# This import depends on the automake rule protoc_middleman, please make sure +# protoc_middleman has been built before run this file. +import os.path, sys +sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir)) +import tmp.benchmarks_pb2 as benchmarks_pb2 +from click.types import STRING + +_PROJECT_ID = 'grpc-testing' +_DATASET = 'protobuf_benchmark_result' +_TABLE = 'opensource_result_v1' +_NOW = "%d%02d%02d" % (datetime.datetime.now().year, + datetime.datetime.now().month, + datetime.datetime.now().day) + +file_size_map = {} + +def get_data_size(file_name): + if file_name in file_size_map: + return file_size_map[file_name] + benchmark_dataset = benchmarks_pb2.BenchmarkDataset() + benchmark_dataset.ParseFromString( + open(os.path.dirname(os.path.abspath(__file__)) + "/../" + file_name).read()) + size = 0 + count = 0 + for payload in benchmark_dataset.payload: + size += len(payload) + count += 1 + file_size_map[file_name] = (size, 1.0 * size / count) + return size, 1.0 * size / count + + +def extract_file_name(file_name): + name_list = re.split("[/\.]", file_name) + short_file_name = "" + for name in name_list: + if name[:14] == "google_message": + short_file_name = name + return short_file_name + + +cpp_result = [] +python_result = [] +java_result = [] +go_result = [] + + +# CPP results example: +# [ +# "benchmarks": [ +# { +# "bytes_per_second": int, +# "cpu_time": int, +# "name: string, +# "time_unit: string, +# ... +# }, +# ... +# ], +# ... +# ] +def parse_cpp_result(filename): + global cpp_result + if filename == "": + return + if filename[0] != '/': + filename = os.path.dirname(os.path.abspath(__file__)) + '/' + filename + with open(filename) as f: + results = json.loads(f.read()) + for benchmark in results["benchmarks"]: + data_filename = "".join( + re.split("(_parse_|_serialize)", benchmark["name"])[0]) + behavior = benchmark["name"][len(data_filename) + 1:] + cpp_result.append({ + "language": "cpp", + "dataFileName": data_filename, + "behavior": behavior, + "throughput": benchmark["bytes_per_second"] / 2.0 ** 20 + }) + + +# Python results example: +# [ +# [ +# { +# "filename": string, +# "benchmarks": { +# behavior: results, +# ... +# }, +# "message_name": STRING +# }, +# ... +# ], #pure-python +# ... +# ] +def parse_python_result(filename): + global python_result + if filename == "": + return + if filename[0] != '/': + filename = os.path.dirname(os.path.abspath(__file__)) + '/' + filename + with open(filename) as f: + results_list = json.loads(f.read()) + for results in results_list: + for result in results: + _, avg_size = get_data_size(result["filename"]) + for behavior in result["benchmarks"]: + python_result.append({ + "language": "python", + "dataFileName": extract_file_name(result["filename"]), + "behavior": behavior, + "throughput": avg_size / + result["benchmarks"][behavior] * 1e9 / 2 ** 20 + }) + + +# Java results example: +# [ +# { +# "id": string, +# "instrumentSpec": {...}, +# "measurements": [ +# { +# "weight": float, +# "value": { +# "magnitude": float, +# "unit": string +# }, +# ... +# }, +# ... +# ], +# "run": {...}, +# "scenario": { +# "benchmarkSpec": { +# "methodName": string, +# "parameters": { +# defined parameters in the benchmark: parameters value +# }, +# ... +# }, +# ... +# } +# +# }, +# ... +# ] +def parse_java_result(filename): + global average_bytes_per_message, java_result + if filename == "": + return + if filename[0] != '/': + filename = os.path.dirname(os.path.abspath(__file__)) + '/' + filename + with open(filename) as f: + results = json.loads(f.read()) + for result in results: + total_weight = 0 + total_value = 0 + for measurement in result["measurements"]: + total_weight += measurement["weight"] + total_value += measurement["value"]["magnitude"] + avg_time = total_value * 1.0 / total_weight + total_size, _ = get_data_size( + result["scenario"]["benchmarkSpec"]["parameters"]["dataFile"]) + java_result.append({ + "language": "java", + "throughput": total_size / avg_time * 1e9 / 2 ** 20, + "behavior": result["scenario"]["benchmarkSpec"]["methodName"], + "dataFileName": extract_file_name( + result["scenario"]["benchmarkSpec"]["parameters"]["dataFile"]) + }) + + +# Go benchmark results: +# +# goos: linux +# goarch: amd64 +# Benchmark/.././datasets/google_message2/dataset.google_message2.pb/Unmarshal-12 3000 705784 ns/op +# Benchmark/.././datasets/google_message2/dataset.google_message2.pb/Marshal-12 2000 634648 ns/op +# Benchmark/.././datasets/google_message2/dataset.google_message2.pb/Size-12 5000 244174 ns/op +# Benchmark/.././datasets/google_message2/dataset.google_message2.pb/Clone-12 300 4120954 ns/op +# Benchmark/.././datasets/google_message2/dataset.google_message2.pb/Merge-12 300 4108632 ns/op +# PASS +# ok _/usr/local/google/home/yilunchong/mygit/protobuf/benchmarks 124.173s +def parse_go_result(filename): + global go_result + if filename == "": + return + if filename[0] != '/': + filename = os.path.dirname(os.path.abspath(__file__)) + '/' + filename + with open(filename) as f: + for line in f: + result_list = re.split("[\ \t]+", line) + if result_list[0][:9] != "Benchmark": + continue + first_slash_index = result_list[0].find('/') + last_slash_index = result_list[0].rfind('/') + full_filename = result_list[0][first_slash_index+4:last_slash_index] # delete ../ prefix + total_bytes, _ = get_data_size(full_filename) + behavior_with_suffix = result_list[0][last_slash_index+1:] + last_dash = behavior_with_suffix.rfind("-") + if last_dash == -1: + behavior = behavior_with_suffix + else: + behavior = behavior_with_suffix[:last_dash] + go_result.append({ + "dataFilename": extract_file_name(full_filename), + "throughput": total_bytes / float(result_list[2]) * 1e9 / 2 ** 20, + "behavior": behavior, + "language": "go" + }) + + +def get_metadata(): + build_number = os.getenv('BUILD_NUMBER') + build_url = os.getenv('BUILD_URL') + job_name = os.getenv('JOB_NAME') + git_commit = os.getenv('GIT_COMMIT') + # actual commit is the actual head of PR that is getting tested + git_actual_commit = os.getenv('ghprbActualCommit') + + utc_timestamp = str(calendar.timegm(time.gmtime())) + metadata = {'created': utc_timestamp} + + if build_number: + metadata['buildNumber'] = build_number + if build_url: + metadata['buildUrl'] = build_url + if job_name: + metadata['jobName'] = job_name + if git_commit: + metadata['gitCommit'] = git_commit + if git_actual_commit: + metadata['gitActualCommit'] = git_actual_commit + + return metadata + + +def upload_result(result_list, metadata): + for result in result_list: + new_result = copy.deepcopy(result) + new_result['metadata'] = metadata + bq = big_query_utils.create_big_query() + row = big_query_utils.make_row(str(uuid.uuid4()), new_result) + if not big_query_utils.insert_rows(bq, _PROJECT_ID, _DATASET, + _TABLE + "$" + _NOW, + [row]): + print 'Error when uploading result', new_result + + +if __name__ == "__main__": + parser = argparse.ArgumentParser() + parser.add_argument("-cpp", "--cpp_input_file", + help="The CPP benchmark result file's name", + default="") + parser.add_argument("-java", "--java_input_file", + help="The Java benchmark result file's name", + default="") + parser.add_argument("-python", "--python_input_file", + help="The Python benchmark result file's name", + default="") + parser.add_argument("-go", "--go_input_file", + help="The golang benchmark result file's name", + default="") + args = parser.parse_args() + + parse_cpp_result(args.cpp_input_file) + parse_python_result(args.python_input_file) + parse_java_result(args.java_input_file) + parse_go_result(args.go_input_file) + + metadata = get_metadata() + print "uploading cpp results..." + upload_result(cpp_result, metadata) + print "uploading java results..." + upload_result(java_result, metadata) + print "uploading python results..." + upload_result(python_result, metadata) + print "uploading go results..." + upload_result(go_result, metadata) diff -Nru protobuf-3.0.0/benchmarks/util/schema_proto2_to_proto3_util.h protobuf-3.6.1.3/benchmarks/util/schema_proto2_to_proto3_util.h --- protobuf-3.0.0/benchmarks/util/schema_proto2_to_proto3_util.h 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/benchmarks/util/schema_proto2_to_proto3_util.h 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,137 @@ +#ifndef PROTOBUF_BENCHMARKS_UTIL_SCHEMA_PROTO2_TO_PROTO3_UTIL_H_ +#define PROTOBUF_BENCHMARKS_UTIL_SCHEMA_PROTO2_TO_PROTO3_UTIL_H_ + +#include "google/protobuf/message.h" +#include "google/protobuf/descriptor.h" +#include "google/protobuf/descriptor.pb.h" + +#include +#include + +using google::protobuf::Descriptor; +using google::protobuf::DescriptorProto; +using google::protobuf::FileDescriptorProto; +using google::protobuf::FieldDescriptorProto; +using google::protobuf::Message; +using google::protobuf::EnumValueDescriptorProto; + +namespace google { +namespace protobuf { +namespace util { + +class SchemaGroupStripper { + + public: + static void StripFile(const FileDescriptor* old_file, + FileDescriptorProto *file) { + for (int i = file->mutable_message_type()->size() - 1; i >= 0; i--) { + if (IsMessageSet(old_file->message_type(i))) { + file->mutable_message_type()->DeleteSubrange(i, 1); + continue; + } + StripMessage(old_file->message_type(i), file->mutable_message_type(i)); + } + for (int i = file->mutable_extension()->size() - 1; i >= 0; i--) { + auto field = old_file->extension(i); + if (field->type() == FieldDescriptor::TYPE_GROUP || + IsMessageSet(field->message_type()) || + IsMessageSet(field->containing_type())) { + file->mutable_extension()->DeleteSubrange(i, 1); + } + } + } + + private: + static bool IsMessageSet(const Descriptor *descriptor) { + if (descriptor != nullptr + && descriptor->options().message_set_wire_format()) { + return true; + } + return false; + } + + static void StripMessage(const Descriptor *old_message, + DescriptorProto *new_message) { + for (int i = new_message->mutable_field()->size() - 1; i >= 0; i--) { + if (old_message->field(i)->type() == FieldDescriptor::TYPE_GROUP || + IsMessageSet(old_message->field(i)->message_type())) { + new_message->mutable_field()->DeleteSubrange(i, 1); + } + } + for (int i = new_message->mutable_extension()->size() - 1; i >= 0; i--) { + auto field_type_name = new_message->mutable_extension(i)->type_name(); + if (old_message->extension(i)->type() == FieldDescriptor::TYPE_GROUP || + IsMessageSet(old_message->extension(i)->containing_type()) || + IsMessageSet(old_message->extension(i)->message_type())) { + new_message->mutable_extension()->DeleteSubrange(i, 1); + } + } + for (int i = 0; i < new_message->mutable_nested_type()->size(); i++) { + StripMessage(old_message->nested_type(i), + new_message->mutable_nested_type(i)); + } + } + +}; + +class SchemaAddZeroEnumValue { + + public: + SchemaAddZeroEnumValue() + : total_added_(0) { + } + + void ScrubFile(FileDescriptorProto *file) { + for (int i = 0; i < file->enum_type_size(); i++) { + ScrubEnum(file->mutable_enum_type(i)); + } + for (int i = 0; i < file->mutable_message_type()->size(); i++) { + ScrubMessage(file->mutable_message_type(i)); + } + } + + private: + void ScrubEnum(EnumDescriptorProto *enum_type) { + if (enum_type->value(0).number() != 0) { + bool has_zero = false; + for (int j = 0; j < enum_type->value().size(); j++) { + if (enum_type->value(j).number() == 0) { + EnumValueDescriptorProto temp_enum_value; + temp_enum_value.CopyFrom(enum_type->value(j)); + enum_type->mutable_value(j)->CopyFrom(enum_type->value(0)); + enum_type->mutable_value(0)->CopyFrom(temp_enum_value); + has_zero = true; + break; + } + } + if (!has_zero) { + enum_type->mutable_value()->Add(); + for (int i = enum_type->mutable_value()->size() - 1; i > 0; i--) { + enum_type->mutable_value(i)->CopyFrom( + *enum_type->mutable_value(i - 1)); + } + enum_type->mutable_value(0)->set_number(0); + enum_type->mutable_value(0)->set_name("ADDED_ZERO_VALUE_" + + std::to_string(total_added_++)); + } + } + + } + + void ScrubMessage(DescriptorProto *message_type) { + for (int i = 0; i < message_type->mutable_enum_type()->size(); i++) { + ScrubEnum(message_type->mutable_enum_type(i)); + } + for (int i = 0; i < message_type->mutable_nested_type()->size(); i++) { + ScrubMessage(message_type->mutable_nested_type(i)); + } + } + + int total_added_; +}; + +} // namespace util +} // namespace protobuf +} // namespace google + +#endif // PROTOBUF_BENCHMARKS_UTIL_SCHEMA_PROTO2_TO_PROTO3_UTIL_H_ diff -Nru protobuf-3.0.0/BUILD protobuf-3.6.1.3/BUILD --- protobuf-3.0.0/BUILD 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/BUILD 2018-12-08 01:32:11.000000000 +0000 @@ -2,19 +2,47 @@ licenses(["notice"]) +exports_files(["LICENSE"]) + +################################################################################ +# Java 9 configuration +################################################################################ + +config_setting( + name = "jdk9", + values = { + "java_toolchain": "@bazel_tools//tools/jdk:toolchain_jdk9", + }, +) + ################################################################################ # Protobuf Runtime Library ################################################################################ -COPTS = [ - "-DHAVE_PTHREAD", - "-Wall", - "-Wwrite-strings", - "-Woverloaded-virtual", - "-Wno-sign-compare", - "-Wno-error=unused-function", +MSVC_COPTS = [ + "/DHAVE_PTHREAD", + "/wd4018", # -Wno-sign-compare + "/wd4514", # -Wno-unused-function ] +COPTS = select({ + ":msvc" : MSVC_COPTS, + "//conditions:default": [ + "-DHAVE_PTHREAD", + "-Wall", + "-Wwrite-strings", + "-Woverloaded-virtual", + "-Wno-sign-compare", + "-Wno-unused-function", + # Prevents ISO C++ const string assignment warnings for pyext sources. + "-Wno-writable-strings", + ], +}) + +load(":compiler_config_setting.bzl", "create_compiler_config_setting") + +create_compiler_config_setting(name = "msvc", value = "msvc-cl") + config_setting( name = "android", values = { @@ -22,14 +50,15 @@ }, ) -# Android builds do not need to link in a separate pthread library. +# Android and MSVC builds do not need to link in a separate pthread library. LINK_OPTS = select({ ":android": [], - "//conditions:default": ["-lpthread"], + ":msvc": [], + "//conditions:default": ["-lpthread", "-lm"], }) load( - "protobuf", + ":protobuf.bzl", "cc_proto_library", "py_proto_library", "internal_copied_filegroup", @@ -37,37 +66,6 @@ "internal_protobuf_py_tests", ) -config_setting( - name = "ios_armv7", - values = { - "ios_cpu": "armv7", - }, -) - -config_setting( - name = "ios_armv7s", - values = { - "ios_cpu": "armv7s", - }, -) - -config_setting( - name = "ios_arm64", - values = { - "ios_cpu": "arm64", - }, -) - -IOS_ARM_COPTS = COPTS + [ - "-DOS_IOS", - "-miphoneos-version-min=7.0", - "-arch armv7", - "-arch armv7s", - "-arch arm64", - "-D__thread=", - "-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.2.sdk/", -] - cc_library( name = "protobuf_lite", srcs = [ @@ -75,18 +73,18 @@ "src/google/protobuf/arena.cc", "src/google/protobuf/arenastring.cc", "src/google/protobuf/extension_set.cc", + "src/google/protobuf/generated_message_table_driven_lite.cc", "src/google/protobuf/generated_message_util.cc", + "src/google/protobuf/implicit_weak_message.cc", "src/google/protobuf/io/coded_stream.cc", "src/google/protobuf/io/zero_copy_stream.cc", "src/google/protobuf/io/zero_copy_stream_impl_lite.cc", "src/google/protobuf/message_lite.cc", "src/google/protobuf/repeated_field.cc", - "src/google/protobuf/stubs/atomicops_internals_x86_gcc.cc", - "src/google/protobuf/stubs/atomicops_internals_x86_msvc.cc", "src/google/protobuf/stubs/bytestream.cc", "src/google/protobuf/stubs/common.cc", "src/google/protobuf/stubs/int128.cc", - "src/google/protobuf/stubs/once.cc", + "src/google/protobuf/stubs/io_win32.cc", "src/google/protobuf/stubs/status.cc", "src/google/protobuf/stubs/statusor.cc", "src/google/protobuf/stubs/stringpiece.cc", @@ -97,12 +95,7 @@ "src/google/protobuf/wire_format_lite.cc", ], hdrs = glob(["src/google/protobuf/**/*.h"]), - copts = select({ - ":ios_armv7": IOS_ARM_COPTS, - ":ios_armv7s": IOS_ARM_COPTS, - ":ios_arm64": IOS_ARM_COPTS, - "//conditions:default": COPTS, - }), + copts = COPTS, includes = ["src/"], linkopts = LINK_OPTS, visibility = ["//visibility:public"], @@ -126,6 +119,7 @@ "src/google/protobuf/extension_set_heavy.cc", "src/google/protobuf/field_mask.pb.cc", "src/google/protobuf/generated_message_reflection.cc", + "src/google/protobuf/generated_message_table_driven.cc", "src/google/protobuf/io/gzip_stream.cc", "src/google/protobuf/io/printer.cc", "src/google/protobuf/io/strtod.cc", @@ -143,6 +137,7 @@ "src/google/protobuf/timestamp.pb.cc", "src/google/protobuf/type.pb.cc", "src/google/protobuf/unknown_field_set.cc", + "src/google/protobuf/util/delimited_message_util.cc", "src/google/protobuf/util/field_comparator.cc", "src/google/protobuf/util/field_mask_util.cc", "src/google/protobuf/util/internal/datapiece.cc", @@ -167,18 +162,24 @@ "src/google/protobuf/wrappers.pb.cc", ], hdrs = glob(["src/**/*.h"]), - copts = select({ - ":ios_armv7": IOS_ARM_COPTS, - ":ios_armv7s": IOS_ARM_COPTS, - ":ios_arm64": IOS_ARM_COPTS, - "//conditions:default": COPTS, - }), + copts = COPTS, includes = ["src/"], linkopts = LINK_OPTS, visibility = ["//visibility:public"], deps = [":protobuf_lite"], ) +# This provides just the header files for use in projects that need to build +# shared libraries for dynamic loading. This target is available until Bazel +# adds native support for such use cases. +# TODO(keveman): Remove this target once the support gets added to Bazel. +cc_library( + name = "protobuf_headers", + hdrs = glob(["src/**/*.h"]), + includes = ["src/"], + visibility = ["//visibility:public"], +) + objc_library( name = "protobuf_objc", hdrs = ["objectivec/GPBProtocolBuffers.h"], @@ -187,21 +188,24 @@ visibility = ["//visibility:public"], ) -RELATIVE_WELL_KNOWN_PROTOS = [ - # AUTOGEN(well_known_protos) - "google/protobuf/any.proto", - "google/protobuf/api.proto", - "google/protobuf/compiler/plugin.proto", - "google/protobuf/descriptor.proto", - "google/protobuf/duration.proto", - "google/protobuf/empty.proto", - "google/protobuf/field_mask.proto", - "google/protobuf/source_context.proto", - "google/protobuf/struct.proto", - "google/protobuf/timestamp.proto", - "google/protobuf/type.proto", - "google/protobuf/wrappers.proto", -] +# Map of all well known protos. +# name => (include path, imports) +WELL_KNOWN_PROTO_MAP = { + "any" : ("google/protobuf/any.proto", []), + "api" : ("google/protobuf/api.proto", ["source_context", "type"]), + "compiler_plugin" : ("google/protobuf/compiler/plugin.proto", ["descriptor"]), + "descriptor" : ("google/protobuf/descriptor.proto", []), + "duration" : ("google/protobuf/duration.proto", []), + "empty" : ("google/protobuf/empty.proto", []), + "field_mask" : ("google/protobuf/field_mask.proto", []), + "source_context" : ("google/protobuf/source_context.proto", []), + "struct" : ("google/protobuf/struct.proto", []), + "timestamp" : ("google/protobuf/timestamp.proto", []), + "type" : ("google/protobuf/type.proto", ["any", "source_context"]), + "wrappers" : ("google/protobuf/wrappers.proto", []), +} + +RELATIVE_WELL_KNOWN_PROTOS = [proto[1][0] for proto in WELL_KNOWN_PROTO_MAP.items()] WELL_KNOWN_PROTOS = ["src/" + s for s in RELATIVE_WELL_KNOWN_PROTOS] @@ -222,6 +226,33 @@ ) ################################################################################ +# Well Known Types Proto Library Rules +# +# These proto_library rules can be used with one of the language specific proto +# library rules i.e. java_proto_library: +# +# java_proto_library( +# name = "any_java_proto", +# deps = ["@com_google_protobuf//:any_proto], +# ) +################################################################################ + +internal_copied_filegroup( + name = "_internal_wkt_protos", + srcs = WELL_KNOWN_PROTOS, + dest = "", + strip_prefix = "src", + visibility = ["//visibility:private"], +) + +[proto_library( + name = proto[0] + "_proto", + srcs = [proto[1][0]], + deps = [dep + "_proto" for dep in proto[1][1]], + visibility = ["//visibility:public"], + ) for proto in WELL_KNOWN_PROTO_MAP.items()] + +################################################################################ # Protocol Buffers Compiler ################################################################################ @@ -241,6 +272,7 @@ "src/google/protobuf/compiler/cpp/cpp_map_field.cc", "src/google/protobuf/compiler/cpp/cpp_message.cc", "src/google/protobuf/compiler/cpp/cpp_message_field.cc", + "src/google/protobuf/compiler/cpp/cpp_padding_optimizer.cc", "src/google/protobuf/compiler/cpp/cpp_primitive_field.cc", "src/google/protobuf/compiler/cpp/cpp_service.cc", "src/google/protobuf/compiler/cpp/cpp_string_field.cc", @@ -290,18 +322,8 @@ "src/google/protobuf/compiler/java/java_shared_code_generator.cc", "src/google/protobuf/compiler/java/java_string_field.cc", "src/google/protobuf/compiler/java/java_string_field_lite.cc", - "src/google/protobuf/compiler/javanano/javanano_enum.cc", - "src/google/protobuf/compiler/javanano/javanano_enum_field.cc", - "src/google/protobuf/compiler/javanano/javanano_extension.cc", - "src/google/protobuf/compiler/javanano/javanano_field.cc", - "src/google/protobuf/compiler/javanano/javanano_file.cc", - "src/google/protobuf/compiler/javanano/javanano_generator.cc", - "src/google/protobuf/compiler/javanano/javanano_helpers.cc", - "src/google/protobuf/compiler/javanano/javanano_map_field.cc", - "src/google/protobuf/compiler/javanano/javanano_message.cc", - "src/google/protobuf/compiler/javanano/javanano_message_field.cc", - "src/google/protobuf/compiler/javanano/javanano_primitive_field.cc", "src/google/protobuf/compiler/js/js_generator.cc", + "src/google/protobuf/compiler/js/well_known_types_embed.cc", "src/google/protobuf/compiler/objectivec/objectivec_enum.cc", "src/google/protobuf/compiler/objectivec/objectivec_enum_field.cc", "src/google/protobuf/compiler/objectivec/objectivec_extension.cc", @@ -314,6 +336,7 @@ "src/google/protobuf/compiler/objectivec/objectivec_message_field.cc", "src/google/protobuf/compiler/objectivec/objectivec_oneof.cc", "src/google/protobuf/compiler/objectivec/objectivec_primitive_field.cc", + "src/google/protobuf/compiler/php/php_generator.cc", "src/google/protobuf/compiler/plugin.cc", "src/google/protobuf/compiler/plugin.pb.cc", "src/google/protobuf/compiler/python/python_generator.cc", @@ -367,6 +390,9 @@ "google/protobuf/unittest_enormous_descriptor.proto", "google/protobuf/unittest_import.proto", "google/protobuf/unittest_import_public.proto", + "google/protobuf/unittest_lazy_dependencies.proto", + "google/protobuf/unittest_lazy_dependencies_custom_option.proto", + "google/protobuf/unittest_lazy_dependencies_enum.proto", "google/protobuf/unittest_lite_imports_nonlite.proto", "google/protobuf/unittest_mset.proto", "google/protobuf/unittest_mset_wire_format.proto", @@ -388,8 +414,10 @@ "google/protobuf/util/internal/testdata/field_mask.proto", "google/protobuf/util/internal/testdata/maps.proto", "google/protobuf/util/internal/testdata/oneofs.proto", + "google/protobuf/util/internal/testdata/proto3.proto", "google/protobuf/util/internal/testdata/struct.proto", "google/protobuf/util/internal/testdata/timestamp_duration.proto", + "google/protobuf/util/internal/testdata/wrappers.proto", "google/protobuf/util/json_format_proto3.proto", "google/protobuf/util/message_differencer_unittest.proto", ] @@ -410,6 +438,7 @@ "src/google/protobuf/arena_test_util.cc", "src/google/protobuf/map_test_util.cc", "src/google/protobuf/test_util.cc", + "src/google/protobuf/test_util.inc", "src/google/protobuf/testing/file.cc", "src/google/protobuf/testing/googletest.cc", ] @@ -430,17 +459,31 @@ ) cc_test( + name = "win32_test", + srcs = ["src/google/protobuf/stubs/io_win32_unittest.cc"], + deps = [ + ":protobuf_lite", + "//external:gtest_main", + ], + tags = ["manual", "windows"], +) + +cc_test( name = "protobuf_test", srcs = COMMON_TEST_SRCS + [ # AUTOGEN(test_srcs) "src/google/protobuf/any_test.cc", "src/google/protobuf/arena_unittest.cc", "src/google/protobuf/arenastring_unittest.cc", + "src/google/protobuf/compiler/annotation_test_util.cc", "src/google/protobuf/compiler/command_line_interface_unittest.cc", "src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc", + "src/google/protobuf/compiler/cpp/cpp_move_unittest.cc", "src/google/protobuf/compiler/cpp/cpp_plugin_unittest.cc", "src/google/protobuf/compiler/cpp/cpp_unittest.cc", + "src/google/protobuf/compiler/cpp/cpp_unittest.inc", "src/google/protobuf/compiler/cpp/metadata_test.cc", + "src/google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc", "src/google/protobuf/compiler/csharp/csharp_generator_unittest.cc", "src/google/protobuf/compiler/importer_unittest.cc", "src/google/protobuf/compiler/java/java_doc_comment_unittest.cc", @@ -463,6 +506,7 @@ "src/google/protobuf/map_field_test.cc", "src/google/protobuf/map_test.cc", "src/google/protobuf/message_unittest.cc", + "src/google/protobuf/message_unittest.inc", "src/google/protobuf/no_field_presence_test.cc", "src/google/protobuf/preserve_unknown_enum_test.cc", "src/google/protobuf/proto3_arena_lite_unittest.cc", @@ -474,7 +518,7 @@ "src/google/protobuf/stubs/bytestream_unittest.cc", "src/google/protobuf/stubs/common_unittest.cc", "src/google/protobuf/stubs/int128_unittest.cc", - "src/google/protobuf/stubs/once_unittest.cc", + "src/google/protobuf/stubs/io_win32_unittest.cc", "src/google/protobuf/stubs/status_test.cc", "src/google/protobuf/stubs/statusor_test.cc", "src/google/protobuf/stubs/stringpiece_unittest.cc", @@ -483,9 +527,9 @@ "src/google/protobuf/stubs/strutil_unittest.cc", "src/google/protobuf/stubs/template_util_unittest.cc", "src/google/protobuf/stubs/time_test.cc", - "src/google/protobuf/stubs/type_traits_unittest.cc", "src/google/protobuf/text_format_unittest.cc", "src/google/protobuf/unknown_field_set_unittest.cc", + "src/google/protobuf/util/delimited_message_util_test.cc", "src/google/protobuf/util/field_comparator_test.cc", "src/google/protobuf/util/field_mask_util_test.cc", "src/google/protobuf/util/internal/default_value_objectwriter_test.cc", @@ -506,6 +550,9 @@ ":test_plugin", ] + glob([ "src/google/protobuf/**/*", + # Files for csharp_bootstrap_unittest.cc. + "conformance/**/*", + "csharp/src/**/*", ]), includes = [ "src/", @@ -533,6 +580,10 @@ ]) + [ ":gen_well_known_protos_java", ], + javacopts = select({ + "//:jdk9": ["--add-modules=jdk.unsupported"], + "//conditions:default": ["-source 7", "-target 7"], + }), visibility = ["//visibility:public"], ) @@ -541,12 +592,13 @@ srcs = glob([ "java/util/src/main/java/com/google/protobuf/util/*.java", ]), + javacopts = ["-source 7", "-target 7"], + visibility = ["//visibility:public"], deps = [ "protobuf_java", "//external:gson", "//external:guava", ], - visibility = ["//visibility:public"], ) ################################################################################ @@ -567,12 +619,12 @@ "python/google/protobuf/internal/test_util.py", ], ), - srcs_version = "PY2AND3", imports = ["python"], + srcs_version = "PY2AND3", ) cc_binary( - name = "internal/_api_implementation.so", + name = "python/google/protobuf/internal/_api_implementation.so", srcs = ["python/google/protobuf/internal/api_implementation.cc"], copts = COPTS + [ "-DPYTHON_PROTO2_CPP_IMPL_V2", @@ -586,7 +638,7 @@ ) cc_binary( - name = "pyext/_message.so", + name = "python/google/protobuf/pyext/_message.so", srcs = glob([ "python/google/protobuf/pyext/*.cc", "python/google/protobuf/pyext/*.h", @@ -633,8 +685,8 @@ internal_copied_filegroup( name = "protos_python", srcs = WELL_KNOWN_PROTOS, - strip_prefix = "src", dest = "python", + strip_prefix = "src", ) # TODO(dzc): Remove this once py_proto_library can have labels in srcs, in @@ -648,16 +700,17 @@ data = select({ "//conditions:default": [], ":use_fast_cpp_protos": [ - ":internal/_api_implementation.so", - ":pyext/_message.so", + ":python/google/protobuf/internal/_api_implementation.so", + ":python/google/protobuf/pyext/_message.so", ], }), default_runtime = "", protoc = ":protoc", py_libs = [ ":python_srcs", - "//external:six" + "//external:six", ], + py_extra_srcs = glob(["python/**/__init__.py"]), srcs_version = "PY2AND3", visibility = ["//visibility:public"], ) @@ -670,13 +723,14 @@ internal_copied_filegroup( name = "protos_python_test", srcs = LITE_TEST_PROTOS + TEST_PROTOS, - strip_prefix = "src", dest = "python", + strip_prefix = "src", ) # TODO(dzc): Remove this once py_proto_library can have labels in srcs, in # which case we can simply add :protos_python_test in srcs. COPIED_LITE_TEST_PROTOS = ["python/" + s for s in RELATIVE_LITE_TEST_PROTOS] + COPIED_TEST_PROTOS = ["python/" + s for s in RELATIVE_TEST_PROTOS] py_proto_library( @@ -744,3 +798,99 @@ ], deps = [":python_tests"], ) + +proto_lang_toolchain( + name = "cc_toolchain", + command_line = "--cpp_out=$(OUT)", + runtime = ":protobuf", + visibility = ["//visibility:public"], + blacklisted_protos = [":_internal_wkt_protos_genrule"], +) + +proto_lang_toolchain( + name = "java_toolchain", + command_line = "--java_out=$(OUT)", + runtime = ":protobuf_java", + visibility = ["//visibility:public"], +) + +OBJC_HDRS = [ + "objectivec/GPBArray.h", + "objectivec/GPBBootstrap.h", + "objectivec/GPBCodedInputStream.h", + "objectivec/GPBCodedOutputStream.h", + "objectivec/GPBDescriptor.h", + "objectivec/GPBDictionary.h", + "objectivec/GPBExtensionInternals.h", + "objectivec/GPBExtensionRegistry.h", + "objectivec/GPBMessage.h", + "objectivec/GPBProtocolBuffers.h", + "objectivec/GPBProtocolBuffers_RuntimeSupport.h", + "objectivec/GPBRootObject.h", + "objectivec/GPBRuntimeTypes.h", + "objectivec/GPBUnknownField.h", + "objectivec/GPBUnknownFieldSet.h", + "objectivec/GPBUtilities.h", + "objectivec/GPBWellKnownTypes.h", + "objectivec/GPBWireFormat.h", + "objectivec/google/protobuf/Any.pbobjc.h", + "objectivec/google/protobuf/Api.pbobjc.h", + "objectivec/google/protobuf/Duration.pbobjc.h", + "objectivec/google/protobuf/Empty.pbobjc.h", + "objectivec/google/protobuf/FieldMask.pbobjc.h", + "objectivec/google/protobuf/SourceContext.pbobjc.h", + "objectivec/google/protobuf/Struct.pbobjc.h", + "objectivec/google/protobuf/Timestamp.pbobjc.h", + "objectivec/google/protobuf/Type.pbobjc.h", + "objectivec/google/protobuf/Wrappers.pbobjc.h", +] + +OBJC_PRIVATE_HDRS = [ + "objectivec/GPBArray_PackagePrivate.h", + "objectivec/GPBCodedInputStream_PackagePrivate.h", + "objectivec/GPBCodedOutputStream_PackagePrivate.h", + "objectivec/GPBDescriptor_PackagePrivate.h", + "objectivec/GPBDictionary_PackagePrivate.h", + "objectivec/GPBMessage_PackagePrivate.h", + "objectivec/GPBRootObject_PackagePrivate.h", + "objectivec/GPBUnknownFieldSet_PackagePrivate.h", + "objectivec/GPBUnknownField_PackagePrivate.h", + "objectivec/GPBUtilities_PackagePrivate.h", +] + +OBJC_SRCS = [ + "objectivec/GPBArray.m", + "objectivec/GPBCodedInputStream.m", + "objectivec/GPBCodedOutputStream.m", + "objectivec/GPBDescriptor.m", + "objectivec/GPBDictionary.m", + "objectivec/GPBExtensionInternals.m", + "objectivec/GPBExtensionRegistry.m", + "objectivec/GPBMessage.m", + "objectivec/GPBRootObject.m", + "objectivec/GPBUnknownField.m", + "objectivec/GPBUnknownFieldSet.m", + "objectivec/GPBUtilities.m", + "objectivec/GPBWellKnownTypes.m", + "objectivec/GPBWireFormat.m", + "objectivec/google/protobuf/Any.pbobjc.m", + "objectivec/google/protobuf/Api.pbobjc.m", + "objectivec/google/protobuf/Duration.pbobjc.m", + "objectivec/google/protobuf/Empty.pbobjc.m", + "objectivec/google/protobuf/FieldMask.pbobjc.m", + "objectivec/google/protobuf/SourceContext.pbobjc.m", + "objectivec/google/protobuf/Struct.pbobjc.m", + "objectivec/google/protobuf/Timestamp.pbobjc.m", + "objectivec/google/protobuf/Type.pbobjc.m", + "objectivec/google/protobuf/Wrappers.pbobjc.m", +] + +objc_library( + name = "objectivec", + hdrs = OBJC_HDRS + OBJC_PRIVATE_HDRS, + includes = [ + "objectivec", + ], + non_arc_srcs = OBJC_SRCS, + visibility = ["//visibility:public"], +) diff -Nru protobuf-3.0.0/CHANGES.txt protobuf-3.6.1.3/CHANGES.txt --- protobuf-3.0.0/CHANGES.txt 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/CHANGES.txt 2018-12-08 01:32:11.000000000 +0000 @@ -1,3 +1,622 @@ +2018-07-27 version 3.6.1 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript) + + C++ + * Introduced workaround for Windows issue with std::atomic and std::once_flag + initialization (#4777, #4773). + + PHP + * Added compatibility with PHP 7.3 (#4898). + + Ruby + * Fixed Ruby crash involving Any encoding (#4718). + +2018-06-01 version 3.6.0 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript) + + C++ + * Starting from this release, we now require C++11. For those we cannot yet + upgrade to C++11, we will try to keep the 3.5.x branch updated with + critical bug fixes only. If you have any concerns about this, please + comment on issue #2780. + * Moved to C++11 types like std::atomic and std::unique_ptr and away from our + old custom-built equivalents. + * Added support for repeated message fields in lite protos using implicit + weak fields. This is an experimental feature that allows the linker to + strip out more unused messages than previously was possible. + * Fixed SourceCodeInfo for interpreted options and extension range options. + * Fixed always_print_enums_as_ints option for JSON serialization. + * Added support for ignoring unknown enum values when parsing JSON. + * Create std::string in Arena memory. + * Fixed ValidateDateTime to correctly check the day. + * Fixed bug in ZeroCopyStreamByteSink. + * Various other cleanups and fixes. + + Java + * Dropped support for Java 6. + * Added a UTF-8 decoder that uses Unsafe to directly decode a byte buffer. + * Added deprecation annotations to generated code for deprecated oneof + fields. + * Fixed map field serialization in DynamicMessage. + * Cleanup and documentation for Java Lite runtime. + * Various other fixes and cleanups + * Fixed unboxed arraylists to handle an edge case + * Improved performance for copying between unboxed arraylists + * Fixed lite protobuf to avoid Java compiler warnings + * Improved test coverage for lite runtime + * Performance improvements for lite runtime + + Python + * Fixed bytes/string map key incompatibility between C++ and pure-Python + implementations (issue #4029) + * Added __init__.py files to compiler and util subpackages + * Use /MT for all Windows versions + * Fixed an issue affecting the Python-C++ implementation when used with + Cython (issue #2896) + * Various text format fixes + * Various fixes to resolve behavior differences between the pure-Python and + Python-C++ implementations + + PHP + * Added php_metadata_namespace to control the file path of generated metadata + file. + * Changed generated classes of nested message/enum. E.g., Foo.Bar, which + previously generates Foo_Bar, now generates Foo/Bar + * Added array constructor. When creating a message, users can pass a php + array whose content is field name to value pairs into constructor. The + created message will be initialized according to the array. Note that + message field should use a message value instead of a sub-array. + * Various bug fixes. + + Objective-C + * We removed some helper class methods from GPBDictionary to shrink the size + of the library, the functionary is still there, but you may need to do some + specific +alloc / -init… methods instead. + * Minor improvements in the performance of object field getters/setters by + avoiding some memory management overhead. + * Fix a memory leak during the raising of some errors. + * Make header importing completely order independent. + * Small code improvements for things the undefined behaviors compiler option + was flagging. + + Ruby + * Added ruby_package file option to control the module of generated class. + * Various bug fixes. + + Javascript + * Allow setting string to int64 field. + + Csharp + * Unknown fields are now parsed and then sent back on the wire. They can be + discarded at parse time via a CodedInputStream option. + * Movement towards working with .NET 3.5 and Unity + * Expression trees are no longer used + * AOT generics issues in Unity/il2cpp have a workaround (see this commit for + details) + * Floating point values are now compared bitwise (affects NaN value + comparisons) + * The default size limit when parsing is now 2GB rather than 64MB + * MessageParser now supports parsing from a slice of a byte array + * JSON list parsing now accepts null values where the underlying proto + representation does + +2017-12-20 version 3.5.1 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript) + Planned Future Changes + * Make C++ implementation C++11 only: we plan to require C++11 to build + protobuf code starting from 3.6.0 release. Please join this github issue: + https://github.com/google/protobuf/issues/2780 to provide your feedback. + + protoc + * Fixed a bug introduced in 3.5.0 and protoc in Windows now accepts non-ascii + characters in paths again. + + C++ + * Removed several usages of C++11 features in the code base. + * Fixed some compiler warnings. + + PHP + * Fixed memory leak in C-extension implementation. + * Added discardUnknokwnFields API. + * Removed duplicatd typedef in C-extension headers. + * Avoided calling private php methods (timelib_update_ts). + * Fixed Any.php to use fully-qualified name for DescriptorPool. + + Ruby + * Added Google_Protobuf_discard_unknown for discarding unknown fields in + messages. + + C# + * Unknown fields are now preserved by default. + * Floating point values are now bitwise compared, affecting message equality + check and Contains() API in map and repeated fields. + + +2017-11-13 version 3.5.0 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript) + Planned Future Changes + * Make C++ implementation C++11 only: we plan to require C++11 to build + protobuf code starting from 3.6.0 release. Please join this github issue: + https://github.com/google/protobuf/issues/2780 to provide your feedback. + + General + * Unknown fields are now preserved in proto3 for most of the language + implementations for proto3 by default. See the per-language section for + details. + * reserve keyword are now supported in enums + + C++ + * Proto3 messages are now preserving unknown fields by default. If you rely on + unknowns fields being dropped. Please use DiscardUnknownFields() explicitly. + * Deprecated the unsafe_arena_release_* and unsafe_arena_add_allocated_* + methods for string fields. + * Added move constructor and move assignment to RepeatedField, + RepeatedPtrField and google::protobuf::Any. + * Added perfect forwarding in Arena::CreateMessage + * In-progress experimental support for implicit weak fields with lite protos. + This feature allows the linker to strip out more unused messages and reduce + binary size. + * Various performance optimizations. + + Java + * Proto3 messages are now preserving unknown fields by default. If you’d like + to drop unknown fields, please use the DiscardUnknownFieldsParser API. For + example: + Parser parser = DiscardUnknownFieldsParser.wrap(Foo.parser()); + Foo foo = parser.parseFrom(input); + * Added a new CodedInputStream decoder for Iterable with direct + ByteBuffers. + * TextFormat now prints unknown length-delimited fields as messages if + possible. + * FieldMaskUtil.merge() no longer creates unnecessary empty messages when a + message field is unset in both source message and destination message. + * Various performance optimizations. + + Python + * Proto3 messages are now preserving unknown fields by default. Use + message.DiscardUnknownFields() to drop unknown fields. + * Add FieldDescriptor.file in generated code. + * Add descriptor pool FindOneofByName in pure python. + * Change unknown enum values into unknown field set . + * Add more Python dict/list compatibility for Struct/ListValue. + * Add utf-8 support for text_format.Merge()/Parse(). + * Support numeric unknown enum values for proto3 JSON format. + * Add warning for Unexpected end-group tag in cpp extension. + + PHP + * Proto3 messages are now preserving unknown fields. + * Provide well known type messages in runtime. + * Add prefix ‘PB’ to generated class of reserved names. + * Fixed all conformance tests for encode/decode json in php runtime. C + extension needs more work. + + Objective-C + * Fixed some issues around copying of messages with unknown fields and then + mutating the unknown fields in the copy. + + C# + * Added unknown field support in JsonParser. + * Fixed oneof message field merge. + * Simplify parsing messages from array slices. + + Ruby + * Unknown fields are now preserved by default. + * Fixed several bugs for segment fault. + + Javascript + * Decoder can handle both paced and unpacked data no matter how the proto is + defined. + * Decoder now accept long varint for 32 bit integers. + + +2017-08-14 version 3.4.0 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript) + Planned Future Changes + * There are some changes that are not included in this release but are planned + for the near future + - Preserve unknown fields in proto3: We are going to bring unknown fields + back into proto3. In this release, some languages start to support + preserving unknown fields in proto3, controlled by flags/options. Some + languages also introduce explicit APIs to drop unknown fields for + migration. Please read the change log sections by languages for details. + For general timeline and plan: + + https://docs.google.com/document/d/1KMRX-G91Aa-Y2FkEaHeeviLRRNblgIahbsk4wA14gRk/view + + For issues and discussions: + + https://github.com/google/protobuf/issues/272 + + - Make C++ implementation C++11 only: we plan to require C++11 to build + protobuf code starting from 3.5.0 or 3.6.0 release, after unknown fields + semantic changes are finished. Please join this + github issue: + + https://github.com/google/protobuf/issues/2780 + + to provide your feedback. + + General + * Extension ranges now accept options and are customizable. + * "reserve" keyword now supports “max” in field number ranges, + e.g. reserve 1000 to max; + + C++ + * Proto3 messages are now able to preserve unknown fields. The default + behavior is still to drop unknowns, which will be flipped in a future + release. If you rely on unknowns fields being dropped. Please use + Message::DiscardUnknownFields() explicitly. + * Packable proto3 fields are now packed by default in serialization. + * Following C++11 features are introduced when C++11 is available: + - move-constructor and move-assignment are introduced to messages + - Repeated fields constructor now takes std::initializer_list + - rvalue setters are introduced for string fields + * Experimental Table-Driven parsing and serialization available to test. To + enable it, pass in table_driven_parsing table_driven_serialization protoc + generator flags for C++ + + $ protoc --cpp_out=table_driven_parsing,table_driven_serialization:./ \ + test.proto + + * lite generator parameter supported by the generator. Once set, all generated + files, use lite runtime regardless of the optimizer_for setting in the + .proto file. + * Various optimizations to make C++ code more performant on PowerPC platform + * Fixed maps data corruption when the maps are modified by both reflection API + and generated API. + * Deterministic serialization on maps reflection now uses stable sort. + * file() accessors are introduced to various *Descriptor classes to make + writing template function easier. + * ByteSize() and SpaceUsed() are deprecated.Use ByteSizeLong() and + SpaceUsedLong() instead + * Consistent hash function is used for maps in DEBUG and NDEBUG build. + * "using namespace std" is removed from stubs/common.h + * Various performance optimizations and bug fixes + + Java + * Introduced new parser API DiscardUnknownFieldsParser in preparation of + proto3 unknown fields preservation change. Users who want to drop unknown + fields should migrate to use this new parser API. For example: + + Parser parser = DiscardUnknownFieldsParser.wrap(Foo.parser()); + Foo foo = parser.parseFrom(input); + + * Introduced new TextFormat API printUnicodeFieldValue() that prints field + value without escaping unicode characters. + * Added Durations.compare(Duration, Duration) and + Timestamps.compare(Timestamp, Timestamp). + * JsonFormat now accepts base64url encoded bytes fields. + * Optimized CodedInputStream to do less copies when parsing large bytes + fields. + * Optimized TextFormat to allocate less memory when printing. + + Python + * SerializeToString API is changed to SerializeToString(self, **kwargs), + deterministic parameter is accepted for deterministic serialization. + * Added sort_keys parameter in json format to make the output deterministic. + * Added indent parameter in json format. + * Added extension support in json format. + * Added __repr__ support for repeated field in cpp implementation. + * Added file in FieldDescriptor. + * Added pretty-print filter to text format. + * Services and method descriptors are always printed even if generic_service + option is turned off. + * Note: AppEngine 2.5 is deprecated on June 2017 that AppEngine 2.5 will + never update protobuf runtime. Users who depend on AppEngine 2.5 should use + old protoc. + + PHP + * Support PHP generic services. Specify file option php_generic_service=true + to enable generating service interface. + * Message, repeated and map fields setters take value instead of reference. + * Added map iterator in c extension. + * Support json  encode/decode. + * Added more type info in getter/setter phpdoc + * Fixed the problem that c extension and php implementation cannot be used + together. + * Added file option php_namespace to use custom php namespace instead of + package. + * Added fluent setter. + * Added descriptor API in runtime for custom encode/decode. + * Various bug fixes. + + Objective-C + * Fix for GPBExtensionRegistry copying and add tests. + * Optimize GPBDictionary.m codegen to reduce size of overall library by 46K + per architecture. + * Fix some cases of reading of 64bit map values. + * Properly error on a tag with field number zero. + * Preserve unknown fields in proto3 syntax files. + * Document the exceptions on some of the writing apis. + + C# + * Implemented IReadOnlyDictionary in MapField + * Added TryUnpack method for Any message in addition to Unpack. + * Converted C# projects to MSBuild (csproj) format. + + Ruby + * Several bug fixes. + + Javascript + * Added support of field option js_type. Now one can specify the JS type of a + 64-bit integer field to be string in the generated code by adding option + [jstype = JS_STRING] on the field. + +2017-04-05 version 3.3.0 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript) + Planned Future Changes + * There are some changes that are not included in this release but are + planned for the near future: + - Preserve unknown fields in proto3: please read this doc: + + https://docs.google.com/document/d/1KMRX-G91Aa-Y2FkEaHeeviLRRNblgIahbsk4wA14gRk/view + + for the timeline and follow up this github issue: + + https://github.com/google/protobuf/issues/272 + + for discussion. + - Make C++ implementation C++11 only: we plan to require C++11 to build + protobuf code starting from 3.4.0 or 3.5.0 release. Please join this + github issue: + + https://github.com/google/protobuf/issues/2780 + + to provide your feedback. + + C++ + * Fixed map fields serialization of DynamicMessage to correctly serialize + both key and value regardless of their presence. + * Parser now rejects field number 0 correctly. + * New API Message::SpaceUsedLong() that’s equivalent to + Message::SpaceUsed() but returns the value in size_t. + * JSON support + - New flag always_print_enums_as_ints in JsonPrintOptions. + - New flag preserve_proto_field_names in JsonPrintOptions. It will instruct + the JSON printer to use the original field name declared in the .proto + file instead of converting them to lowerCamelCase when printing JSON. + - JsonPrintOptions.always_print_primtive_fields now works for oneof message + fields. + - Fixed a bug that doesn’t allow different fields to set the same json_name + value. + - Fixed a performance bug that causes excessive memory copy when printing + large messages. + * Various performance optimizations. + + Java + * Map field setters eagerly validate inputs and throw NullPointerExceptions + as appropriate. + * Added ByteBuffer overloads to the generated parsing methods and the Parser + interface. + * proto3 enum's getNumber() method now throws on UNRECOGNIZED values. + * Output of JsonFormat is now locale independent. + + Python + * Added FindServiceByName() in the pure-Python DescriptorPool. This works only + for descriptors added with DescriptorPool.Add(). Generated descriptor_pool + does not support this yet. + * Added a descriptor_pool parameter for parsing Any in text_format.Parse(). + * descriptor_pool.FindFileContainingSymbol() now is able to find nested + extensions. + * Extending empty [] to repeated field now sets parent message presence. + + PHP + * Added file option php_class_prefix. The prefix will be prepended to all + generated classes defined in the file. + * When encoding, negative int32 values are sign-extended to int64. + * Repeated/Map field setter accepts a regular PHP array. Type checking is + done on the array elements. + * encode/decode are renamed to serializeToString/mergeFromString. + * Added mergeFrom, clear method on Message. + * Fixed a bug that oneof accessor didn’t return the field name that is + actually set. + * C extension now works with php7. + * This is the first GA release of PHP. We guarantee that old generated code + can always work with new runtime and new generated code. + + Objective-C + * Fixed help for GPBTimestamp for dates before the epoch that contain + fractional seconds. + * Added GPBMessageDropUnknownFieldsRecursively() to remove unknowns from a + message and any sub messages. + * Addressed a threading race in extension registration/lookup. + * Increased the max message parsing depth to 100 to match the other languages. + * Removed some use of dispatch_once in favor of atomic compare/set since it + needs to be heap based. + * Fixes for new Xcode 8.3 warnings. + + C# + * Fixed MapField.Values.CopyTo, which would throw an exception unnecessarily + if provided exactly the right size of array to copy to. + * Fixed enum JSON formatting when multiple names mapped to the same numeric + value. + * Added JSON formatting option to format enums as integers. + * Modified RepeatedField to implement IReadOnlyList. + * Introduced the start of custom option handling; it's not as pleasant as it + might be, but the information is at least present. We expect to extend code + generation to improve this in the future. + * Introduced ByteString.FromStream and ByteString.FromStreamAsync to + efficiently create a ByteString from a stream. + * Added whole-message deprecation, which decorates the class with [Obsolete]. + + Ruby + * Fixed Message#to_h for messages with map fields. + * Fixed memcpy() in binary gems to work for old glibc, without breaking the + build for non-glibc libc’s like musl. + + Javascript + * Added compatibility tests for version 3.0.0. + * Added conformance tests. + * Fixed serialization of extensions: we need to emit a value even if it is + falsy (like the number 0). + * Use closurebuilder.py in favor of calcdeps.py for compiling JavaScript. + +2017-01-23 version 3.2.0 (C++/Java/Python/PHP/Ruby/Objective-C/C#/JavaScript/Lite) + General + * Added protoc version number to protoc plugin protocol. It can be used by + protoc plugin to detect which version of protoc is used with the plugin and + mitigate known problems in certain version of protoc. + + C++ + * The default parsing byte size limit has been raised from 64MB to 2GB. + * Added rvalue setters for non-arena string fields. + * Enabled debug logging for Android. + * Fixed a double-free problem when using Reflection::SetAllocatedMessage() + with extension fields. + * Fixed several deterministic serialization bugs: + * MessageLite::SerializeAsString() now respects the global deterministic + serialization flag. + * Extension fields are serialized deterministically as well. Fixed protocol + compiler to correctly report importing-self as an error. + * Fixed FileDescriptor::DebugString() to print custom options correctly. + * Various performance/codesize optimizations and cleanups. + + Java + * The default parsing byte size limit has been raised from 64MB to 2GB. + * Added recursion limit when parsing JSON. + * Fixed a bug that enumType.getDescriptor().getOptions() doesn't have custom + options. + * Fixed generated code to support field numbers up to 2^29-1. + + Python + * You can now assign NumPy scalars/arrays (np.int32, np.int64) to protobuf + fields, and assigning other numeric types has been optimized for + performance. + * Pure-Python: message types are now garbage-collectable. + * Python/C++: a lot of internal cleanup/refactoring. + + PHP (Alpha) + * For 64-bit integers type (int64/uint64/sfixed64/fixed64/sint64), use PHP + integer on 64-bit environment and PHP string on 32-bit environment. + * PHP generated code also conforms to PSR-4 now. + * Fixed ZTS build for c extension. + * Fixed c extension build on Mac. + * Fixed c extension build on 32-bit linux. + * Fixed the bug that message without namespace is not found in the descriptor + pool. (#2240) + * Fixed the bug that repeated field is not iterable in c extension. + * Message names Empty will be converted to GPBEmpty in generated code. + * Added phpdoc in generated files. + * The released API is almost stable. Unless there is large problem, we won't + change it. See + https://developers.google.com/protocol-buffers/docs/reference/php-generated + for more details. + + Objective-C + * Added support for push/pop of the stream limit on CodedInputStream for + anyone doing manual parsing. + + C# + * No changes. + + Ruby + * Message objects now support #respond_to? for field getters/setters. + * You can now compare “message == non_message_object” and it will return false + instead of throwing an exception. + * JRuby: fixed #hashCode to properly reflect the values in the message. + + Javascript + * Deserialization of repeated fields no longer has quadratic performance + behavior. + * UTF-8 encoding/decoding now properly supports high codepoints. + * Added convenience methods for some well-known types: Any, Struct, and + Timestamp. These make it easier to convert data between native JavaScript + types and the well-known protobuf types. + +2016-09-23 version 3.1.0 (C++/Java/Python/PHP/Ruby/Objective-C/C#/JavaScript/Lite) + General + * Proto3 support in PHP (alpha). + * Various bug fixes. + + C++ + * Added MessageLite::ByteSizeLong() that’s equivalent to + MessageLite::ByteSize() but returns the value in size_t. Useful to check + whether a message is over the 2G size limit that protobuf can support. + * Moved default_instances to global variables. This allows default_instance + addresses to be known at compile time. + * Adding missing generic gcc 64-bit atomicops. + * Restore New*Callback into google::protobuf namespace since these are used + by the service stubs code + * JSON support. + * Fixed some conformance issues. + * Fixed a JSON serialization bug for bytes fields. + + Java + * Fixed a bug in TextFormat that doesn’t accept empty repeated fields (i.e., + “field: [ ]”). + * JSON support + * Fixed JsonFormat to do correct snake_case-to-camelCase conversion for + non-style-conforming field names. + * Fixed JsonFormat to parse empty Any message correctly. + * Added an option to JsonFormat.Parser to ignore unknown fields. + * Experimental API + * Added UnsafeByteOperations.unsafeWrap(byte[]) to wrap a byte array into + ByteString without copy. + + Python + * JSON support + * Fixed some conformance issues. + + PHP (Alpha) + * We have added the proto3 support for PHP via both a pure PHP package and a + native c extension. The pure PHP package is intended to provide usability + to wider range of PHP platforms, while the c extension is intended to + provide higher performance. Both implementations provide the same runtime + APIs and share the same generated code. Users don’t need to re-generate + code for the same proto definition when they want to switch the + implementation later. The pure PHP package is included in the php/src + directory, and the c extension is included in the php/ext directory. + + Both implementations provide idiomatic PHP APIs: + * All messages and enums are defined as PHP classes. + * All message fields can only be accessed via getter/setter. + * Both repeated field elements and map elements are stored in containers + that act like a normal PHP array. + + Unlike several existing third-party PHP implementations for protobuf, our + implementations are built on a "strongly-typed" philosophy: message fields + and array/map containers will throw exceptions eagerly when values of the + incorrect type (not including those that can be type converted, e.g., + double <-> integer <-> numeric string) are inserted. + + Currently, pure PHP runtime supports php5.5, 5.6 and 7 on linux. C + extension runtime supports php5.5 and 5.6 on linux. + + See php/README.md for more details about installment. See + https://developers.google.com/protocol-buffers/docs/phptutorial for more + details about APIs. + + Objective-C + * Helpers are now provided for working the the Any well known type (see + GPBWellKnownTypes.h for the api additions). + * Some improvements in startup code (especially when extensions aren’t used). + + Javascript + * Fixed missing import of jspb.Map + * Fixed valueWriterFn variable name + + Ruby + * Fixed hash computation for JRuby's RubyMessage + * Make sure map parsing frames are GC-rooted. + * Added API support for well-known types. + + C# + * Removed check on dependency in the C# reflection API. + +2016-09-06 version 3.0.2 (C++/Java/Python/Ruby/Objective-C/C#/JavaScript/Lite) + General + * Various bug fixes. + + Objective C + * Fix for oneofs in proto3 syntax files where fields were set to the zero + value. + * Fix for embedded null character in strings. + * CocoaDocs support + + Ruby + * Fixed memory corruption bug in parsing that could occur under GC pressure. + + Javascript + * jspb.Map is now properly exported to CommonJS modules. + + C# + * Removed legacy_enum_values flag. + + 2016-07-27 version 3.0.0 (C++/Java/Python/Ruby/Objective-C/C#/JavaScript/Lite) General * This log only contains changes since the beta-4 release. Summarized change @@ -1209,7 +1828,7 @@ 2008-09-29 version 2.0.2: General - * License changed from Apache 2.0 to New BSD. + * License changed from Apache 2.0 to 3-Clause BSD. * It is now possible to define custom "options", which are basically annotations which may be placed on definitions in a .proto file. For example, you might define a field option called "foo" like so: diff -Nru protobuf-3.0.0/cmake/CMakeLists.txt protobuf-3.6.1.3/cmake/CMakeLists.txt --- protobuf-3.0.0/cmake/CMakeLists.txt 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/cmake/CMakeLists.txt 2018-12-08 01:32:11.000000000 +0000 @@ -1,5 +1,5 @@ # Minimum CMake required -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.1.3) if(protobuf_VERBOSE) message(STATUS "Protocol Buffers Configuring...") @@ -8,12 +8,26 @@ # CMake policies cmake_policy(SET CMP0022 NEW) +if(POLICY CMP0048) + cmake_policy(SET CMP0048 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() + # Options option(protobuf_BUILD_TESTS "Build tests" ON) option(protobuf_BUILD_EXAMPLES "Build examples" OFF) +option(protobuf_BUILD_PROTOC_BINARIES "Build libprotoc and protoc compiler" ON) if (BUILD_SHARED_LIBS) set(protobuf_BUILD_SHARED_LIBS_DEFAULT ON) else (BUILD_SHARED_LIBS) @@ -23,11 +37,7 @@ include(CMakeDependentOption) cmake_dependent_option(protobuf_MSVC_STATIC_RUNTIME "Link static runtime libraries" ON "NOT protobuf_BUILD_SHARED_LIBS" OFF) -if (MSVC) - set(protobuf_WITH_ZLIB_DEFAULT OFF) -else (MSVC) - set(protobuf_WITH_ZLIB_DEFAULT ON) -endif (MSVC) +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") @@ -86,6 +96,7 @@ add_definitions(-DHAVE_PTHREAD) endif (CMAKE_USE_PTHREADS_INIT) +set(_protobuf_FIND_ZLIB) if (protobuf_WITH_ZLIB) find_package(ZLIB) if (ZLIB_FOUND) @@ -96,6 +107,7 @@ # 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) @@ -133,14 +145,44 @@ if (MSVC) # Build with multiple processes add_definitions(/MP) - add_definitions(/wd4244 /wd4267 /wd4018 /wd4355 /wd4800 /wd4251 /wd4996 /wd4146 /wd4305) + # MSVC warning suppressions + add_definitions( + /wd4018 # 'expression' : signed/unsigned mismatch + /wd4065 # switch statement contains 'default' but no 'case' labels + /wd4146 # unary minus operator applied to unsigned type, result still unsigned + /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 /ignore:4221) + + # 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 " ${rc_flags} /fo ") + + 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( @@ -157,10 +199,16 @@ set(LIB_PREFIX) endif (MSVC) +if (protobuf_UNICODE) + add_definitions(-DUNICODE -D_UNICODE) +endif (protobuf_UNICODE) + include(libprotobuf-lite.cmake) include(libprotobuf.cmake) -include(libprotoc.cmake) -include(protoc.cmake) +if (protobuf_BUILD_PROTOC_BINARIES) + include(libprotoc.cmake) + include(protoc.cmake) +endif (protobuf_BUILD_PROTOC_BINARIES) if (protobuf_BUILD_TESTS) include(tests.cmake) diff -Nru protobuf-3.0.0/cmake/extract_includes.bat.in protobuf-3.6.1.3/cmake/extract_includes.bat.in --- protobuf-3.0.0/cmake/extract_includes.bat.in 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/cmake/extract_includes.bat.in 2018-12-08 01:32:11.000000000 +0000 @@ -5,121 +5,121 @@ mkdir include\google\protobuf\compiler\cpp mkdir include\google\protobuf\compiler\csharp mkdir include\google\protobuf\compiler\java -mkdir include\google\protobuf\compiler\javanano mkdir include\google\protobuf\compiler\js mkdir include\google\protobuf\compiler\objectivec +mkdir include\google\protobuf\compiler\php mkdir include\google\protobuf\compiler\python 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\arenastring.h include\google\protobuf\arenastring.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_generator.h include\google\protobuf\compiler\cpp\cpp_generator.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_names.h include\google\protobuf\compiler\java\java_names.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\javanano\javanano_generator.h include\google\protobuf\compiler\javanano\javanano_generator.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\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\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\extension_set.h include\google\protobuf\extension_set.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_reflection.h include\google\protobuf\generated_message_reflection.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\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\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\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_field_reflection.h include\google\protobuf\repeated_field_reflection.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\atomic_sequence_num.h include\google\protobuf\stubs\atomic_sequence_num.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomicops.h include\google\protobuf\stubs\atomicops.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomicops_internals_arm64_gcc.h include\google\protobuf\stubs\atomicops_internals_arm64_gcc.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomicops_internals_arm_gcc.h include\google\protobuf\stubs\atomicops_internals_arm_gcc.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomicops_internals_arm_qnx.h include\google\protobuf\stubs\atomicops_internals_arm_qnx.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomicops_internals_atomicword_compat.h include\google\protobuf\stubs\atomicops_internals_atomicword_compat.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomicops_internals_generic_gcc.h include\google\protobuf\stubs\atomicops_internals_generic_gcc.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomicops_internals_macosx.h include\google\protobuf\stubs\atomicops_internals_macosx.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomicops_internals_mips_gcc.h include\google\protobuf\stubs\atomicops_internals_mips_gcc.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomicops_internals_pnacl.h include\google\protobuf\stubs\atomicops_internals_pnacl.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomicops_internals_power.h include\google\protobuf\stubs\atomicops_internals_power.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomicops_internals_solaris.h include\google\protobuf\stubs\atomicops_internals_solaris.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomicops_internals_tsan.h include\google\protobuf\stubs\atomicops_internals_tsan.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomicops_internals_x86_gcc.h include\google\protobuf\stubs\atomicops_internals_x86_gcc.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomicops_internals_x86_msvc.h include\google\protobuf\stubs\atomicops_internals_x86_msvc.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\fastmem.h include\google\protobuf\stubs\fastmem.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\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\scoped_ptr.h include\google\protobuf\stubs\scoped_ptr.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\shared_ptr.h include\google\protobuf\stubs\shared_ptr.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\singleton.h include\google\protobuf\stubs\singleton.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\template_util.h include\google\protobuf\stubs\template_util.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\type_traits.h include\google\protobuf\stubs\type_traits.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\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\wire_format_lite_inl.h include\google\protobuf\wire_format_lite_inl.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.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\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_generator.h" include\google\protobuf\compiler\cpp\cpp_generator.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\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_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\js\well_known_types_embed.h" include\google\protobuf\compiler\js\well_known_types_embed.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\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\extension_set.h" include\google\protobuf\extension_set.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_reflection.h" include\google\protobuf\generated_message_reflection.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_message_table_driven.h" include\google\protobuf\generated_message_table_driven.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\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\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\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\fastmem.h" include\google\protobuf\stubs\fastmem.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\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\singleton.h" include\google\protobuf\stubs\singleton.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\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\wire_format_lite_inl.h" include\google\protobuf\wire_format_lite_inl.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 diff -Nru protobuf-3.0.0/cmake/install.cmake protobuf-3.6.1.3/cmake/install.cmake --- protobuf-3.0.0/cmake/install.cmake 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/cmake/install.cmake 2018-12-08 01:32:11.000000000 +0000 @@ -1,9 +1,16 @@ include(GNUInstallDirs) -foreach(_library - libprotobuf-lite - libprotobuf - libprotoc) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/protobuf.pc.cmake + ${CMAKE_CURRENT_BINARY_DIR}/protobuf.pc @ONLY) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/protobuf-lite.pc.cmake + ${CMAKE_CURRENT_BINARY_DIR}/protobuf-lite.pc @ONLY) + +set(_protobuf_libraries libprotobuf-lite libprotobuf) +if (protobuf_BUILD_PROTOC_BINARIES) + list(APPEND _protobuf_libraries libprotoc) +endif (protobuf_BUILD_PROTOC_BINARIES) + +foreach(_library ${_protobuf_libraries}) set_property(TARGET ${_library} PROPERTY INTERFACE_INCLUDE_DIRECTORIES $ @@ -14,24 +21,22 @@ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT ${_library}) endforeach() -install(TARGETS protoc EXPORT protobuf-targets - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT protoc) +if (protobuf_BUILD_PROTOC_BINARIES) + install(TARGETS protoc EXPORT protobuf-targets + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT protoc) +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 REGEX "^copy") foreach(_extract_string ${_extract_strings}) - string(REPLACE "copy \${PROTOBUF_SOURCE_WIN32_PATH}\\" "" - _extract_string ${_extract_string}) - string(REPLACE "\\" "/" _extract_string ${_extract_string}) - string(REGEX MATCH "^[^ ]+" - _extract_from ${_extract_string}) - string(REGEX REPLACE "^${_extract_from} ([^$]+)" "\\1" - _extract_to ${_extract_string}) - get_filename_component(_extract_from "${protobuf_SOURCE_DIR}/${_extract_from}" ABSOLUTE) - get_filename_component(_extract_name ${_extract_to} NAME) - get_filename_component(_extract_to ${_extract_to} PATH) - string(REPLACE "include/" "${CMAKE_INSTALL_INCLUDEDIR}/" - _extract_to "${_extract_to}") + 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_name ${_header} NAME) + get_filename_component(_extract_to "${CMAKE_INSTALL_INCLUDEDIR}/${_header}" PATH) if(EXISTS "${_extract_from}") install(FILES "${_extract_from}" DESTINATION "${_extract_to}" @@ -100,17 +105,25 @@ ${CMAKE_INSTALL_CMAKEDIR}/protobuf-options.cmake @ONLY) # Allows the build directory to be used as a find directory. -export(TARGETS libprotobuf-lite libprotobuf libprotoc protoc - NAMESPACE protobuf:: - FILE ${CMAKE_INSTALL_CMAKEDIR}/protobuf-targets.cmake -) + +if (protobuf_BUILD_PROTOC_BINARIES) + export(TARGETS libprotobuf-lite libprotobuf libprotoc protoc + NAMESPACE protobuf:: + FILE ${CMAKE_INSTALL_CMAKEDIR}/protobuf-targets.cmake + ) +else (protobuf_BUILD_PROTOC_BINARIES) + export(TARGETS libprotobuf-lite libprotobuf + NAMESPACE protobuf:: + FILE ${CMAKE_INSTALL_CMAKEDIR}/protobuf-targets.cmake + ) +endif (protobuf_BUILD_PROTOC_BINARIES) install(EXPORT protobuf-targets DESTINATION "${CMAKE_INSTALL_CMAKEDIR}" NAMESPACE protobuf:: COMPONENT protobuf-export) -install(DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_CMAKEDIR}/ +install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_INSTALL_CMAKEDIR}/ DESTINATION "${CMAKE_INSTALL_CMAKEDIR}" COMPONENT protobuf-export PATTERN protobuf-targets.cmake EXCLUDE diff -Nru protobuf-3.0.0/cmake/libprotobuf.cmake protobuf-3.6.1.3/cmake/libprotobuf.cmake --- protobuf-3.0.0/cmake/libprotobuf.cmake 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/cmake/libprotobuf.cmake 2018-12-08 01:32:11.000000000 +0000 @@ -13,6 +13,7 @@ ${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_reflection.cc + ${protobuf_source_dir}/src/google/protobuf/generated_message_table_driven.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/strtod.cc @@ -30,6 +31,7 @@ ${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 @@ -54,9 +56,74 @@ ${protobuf_source_dir}/src/google/protobuf/wrappers.pb.cc ) +set(libprotobuf_includes + ${protobuf_source_dir}/src/google/protobuf/any.h + ${protobuf_source_dir}/src/google/protobuf/any.pb.h + ${protobuf_source_dir}/src/google/protobuf/api.pb.h + ${protobuf_source_dir}/src/google/protobuf/compiler/importer.h + ${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_mask.pb.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/strtod.h + ${protobuf_source_dir}/src/google/protobuf/io/tokenizer.h + ${protobuf_source_dir}/src/google/protobuf/io/zero_copy_stream_impl.h + ${protobuf_source_dir}/src/google/protobuf/map_field.h + ${protobuf_source_dir}/src/google/protobuf/message.h + ${protobuf_source_dir}/src/google/protobuf/reflection_ops.h + ${protobuf_source_dir}/src/google/protobuf/service.h + ${protobuf_source_dir}/src/google/protobuf/source_context.pb.h + ${protobuf_source_dir}/src/google/protobuf/struct.pb.h + ${protobuf_source_dir}/src/google/protobuf/stubs/mathlimits.h + ${protobuf_source_dir}/src/google/protobuf/stubs/substitute.h + ${protobuf_source_dir}/src/google/protobuf/text_format.h + ${protobuf_source_dir}/src/google/protobuf/timestamp.pb.h + ${protobuf_source_dir}/src/google/protobuf/type.pb.h + ${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/internal/datapiece.h + ${protobuf_source_dir}/src/google/protobuf/util/internal/default_value_objectwriter.h + ${protobuf_source_dir}/src/google/protobuf/util/internal/error_listener.h + ${protobuf_source_dir}/src/google/protobuf/util/internal/field_mask_utility.h + ${protobuf_source_dir}/src/google/protobuf/util/internal/json_escaping.h + ${protobuf_source_dir}/src/google/protobuf/util/internal/json_objectwriter.h + ${protobuf_source_dir}/src/google/protobuf/util/internal/json_stream_parser.h + ${protobuf_source_dir}/src/google/protobuf/util/internal/object_writer.h + ${protobuf_source_dir}/src/google/protobuf/util/internal/proto_writer.h + ${protobuf_source_dir}/src/google/protobuf/util/internal/protostream_objectsource.h + ${protobuf_source_dir}/src/google/protobuf/util/internal/protostream_objectwriter.h + ${protobuf_source_dir}/src/google/protobuf/util/internal/type_info.h + ${protobuf_source_dir}/src/google/protobuf/util/internal/type_info_test_helper.h + ${protobuf_source_dir}/src/google/protobuf/util/internal/utility.h + ${protobuf_source_dir}/src/google/protobuf/util/json_util.h + ${protobuf_source_dir}/src/google/protobuf/util/message_differencer.h + ${protobuf_source_dir}/src/google/protobuf/util/time_util.h + ${protobuf_source_dir}/src/google/protobuf/util/type_resolver_util.h + ${protobuf_source_dir}/src/google/protobuf/wire_format.h + ${protobuf_source_dir}/src/google/protobuf/wrappers.pb.h +) + +if (MSVC) +set(libprotoc_rc_files + ${CMAKE_CURRENT_BINARY_DIR}/version.rc +) +endif() + add_library(libprotobuf ${protobuf_SHARED_OR_STATIC} - ${libprotobuf_lite_files} ${libprotobuf_files}) -target_link_libraries(libprotobuf ${CMAKE_THREAD_LIBS_INIT} ${ZLIB_LIBRARIES}) + ${libprotobuf_lite_files} ${libprotobuf_files} ${libprotobuf_includes} ${libprotobuf_rc_files}) +target_link_libraries(libprotobuf ${CMAKE_THREAD_LIBS_INIT}) +if(protobuf_WITH_ZLIB) + target_link_libraries(libprotobuf ${ZLIB_LIBRARIES}) +endif() target_include_directories(libprotobuf PUBLIC ${protobuf_source_dir}/src) if(MSVC AND protobuf_BUILD_SHARED_LIBS) target_compile_definitions(libprotobuf @@ -64,5 +131,7 @@ PRIVATE LIBPROTOBUF_EXPORTS) endif() set_target_properties(libprotobuf PROPERTIES + VERSION ${protobuf_VERSION} OUTPUT_NAME ${LIB_PREFIX}protobuf DEBUG_POSTFIX "${protobuf_DEBUG_POSTFIX}") +add_library(protobuf::libprotobuf ALIAS libprotobuf) diff -Nru protobuf-3.0.0/cmake/libprotobuf-lite.cmake protobuf-3.6.1.3/cmake/libprotobuf-lite.cmake --- protobuf-3.0.0/cmake/libprotobuf-lite.cmake 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/cmake/libprotobuf-lite.cmake 2018-12-08 01:32:11.000000000 +0000 @@ -2,18 +2,18 @@ ${protobuf_source_dir}/src/google/protobuf/arena.cc ${protobuf_source_dir}/src/google/protobuf/arenastring.cc ${protobuf_source_dir}/src/google/protobuf/extension_set.cc + ${protobuf_source_dir}/src/google/protobuf/generated_message_table_driven_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/io/coded_stream.cc ${protobuf_source_dir}/src/google/protobuf/io/zero_copy_stream.cc ${protobuf_source_dir}/src/google/protobuf/io/zero_copy_stream_impl_lite.cc ${protobuf_source_dir}/src/google/protobuf/message_lite.cc ${protobuf_source_dir}/src/google/protobuf/repeated_field.cc - ${protobuf_source_dir}/src/google/protobuf/stubs/atomicops_internals_x86_gcc.cc - ${protobuf_source_dir}/src/google/protobuf/stubs/atomicops_internals_x86_msvc.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/once.cc + ${protobuf_source_dir}/src/google/protobuf/stubs/io_win32.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 @@ -24,8 +24,38 @@ ${protobuf_source_dir}/src/google/protobuf/wire_format_lite.cc ) +set(libprotobuf_lite_includes + ${protobuf_source_dir}/src/google/protobuf/arena.h + ${protobuf_source_dir}/src/google/protobuf/arenastring.h + ${protobuf_source_dir}/src/google/protobuf/extension_set.h + ${protobuf_source_dir}/src/google/protobuf/generated_message_util.h + ${protobuf_source_dir}/src/google/protobuf/implicit_weak_message.h + ${protobuf_source_dir}/src/google/protobuf/io/coded_stream.h + ${protobuf_source_dir}/src/google/protobuf/io/zero_copy_stream.h + ${protobuf_source_dir}/src/google/protobuf/io/zero_copy_stream_impl_lite.h + ${protobuf_source_dir}/src/google/protobuf/message_lite.h + ${protobuf_source_dir}/src/google/protobuf/repeated_field.h + ${protobuf_source_dir}/src/google/protobuf/stubs/bytestream.h + ${protobuf_source_dir}/src/google/protobuf/stubs/common.h + ${protobuf_source_dir}/src/google/protobuf/stubs/int128.h + ${protobuf_source_dir}/src/google/protobuf/stubs/once.h + ${protobuf_source_dir}/src/google/protobuf/stubs/status.h + ${protobuf_source_dir}/src/google/protobuf/stubs/statusor.h + ${protobuf_source_dir}/src/google/protobuf/stubs/stringpiece.h + ${protobuf_source_dir}/src/google/protobuf/stubs/stringprintf.h + ${protobuf_source_dir}/src/google/protobuf/stubs/strutil.h + ${protobuf_source_dir}/src/google/protobuf/stubs/time.h + ${protobuf_source_dir}/src/google/protobuf/wire_format_lite.h +) + +if (MSVC) +set(libprotoc_rc_files + ${CMAKE_CURRENT_BINARY_DIR}/version.rc +) +endif() + add_library(libprotobuf-lite ${protobuf_SHARED_OR_STATIC} - ${libprotobuf_lite_files}) + ${libprotobuf_lite_files} ${libprotobuf_lite_includes} ${libprotobuf_lite_rc_files}) target_link_libraries(libprotobuf-lite ${CMAKE_THREAD_LIBS_INIT}) target_include_directories(libprotobuf-lite PUBLIC ${protobuf_source_dir}/src) if(MSVC AND protobuf_BUILD_SHARED_LIBS) @@ -34,5 +64,7 @@ PRIVATE LIBPROTOBUF_EXPORTS) endif() set_target_properties(libprotobuf-lite PROPERTIES + VERSION ${protobuf_VERSION} OUTPUT_NAME ${LIB_PREFIX}protobuf-lite DEBUG_POSTFIX "${protobuf_DEBUG_POSTFIX}") +add_library(protobuf::libprotobuf-lite ALIAS libprotobuf-lite) diff -Nru protobuf-3.0.0/cmake/libprotoc.cmake protobuf-3.6.1.3/cmake/libprotoc.cmake --- protobuf-3.0.0/cmake/libprotoc.cmake 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/cmake/libprotoc.cmake 2018-12-08 01:32:11.000000000 +0000 @@ -11,6 +11,7 @@ ${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_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 @@ -60,18 +61,8 @@ ${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/javanano/javanano_enum.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/javanano/javanano_enum_field.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/javanano/javanano_extension.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/javanano/javanano_field.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/javanano/javanano_file.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/javanano/javanano_generator.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/javanano/javanano_helpers.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/javanano/javanano_map_field.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/javanano/javanano_message.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/javanano/javanano_message_field.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/javanano/javanano_primitive_field.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_field.cc ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_extension.cc @@ -84,6 +75,7 @@ ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_message_field.cc ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_oneof.cc ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.cc + ${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 @@ -92,8 +84,91 @@ ${protobuf_source_dir}/src/google/protobuf/compiler/zip_writer.cc ) +set(libprotoc_headers + ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_enum.h + ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_enum_field.h + ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_extension.h + ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_field.h + ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_file.h + ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_helpers.h + ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_map_field.h + ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_message.h + ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_message_field.h + ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_message_layout_helper.h + ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_options.h + ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_padding_optimizer.h + ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_primitive_field.h + ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_service.h + ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_string_field.h + ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_doc_comment.h + ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_enum.h + ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_enum_field.h + ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_field_base.h + ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_helpers.h + ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_map_field.h + ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_message.h + ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_message_field.h + ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_options.h + ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_primitive_field.h + ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_reflection_class.h + ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.h + ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.h + ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.h + ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_source_generator_base.h + ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_wrapper_field.h + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_context.h + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_doc_comment.h + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_enum.h + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_enum_field.h + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_enum_field_lite.h + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_enum_lite.h + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_extension.h + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_extension_lite.h + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_field.h + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_file.h + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_generator_factory.h + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_helpers.h + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_lazy_message_field.h + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_lazy_message_field_lite.h + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_map_field.h + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_map_field_lite.h + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message.h + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message_builder.h + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message_builder_lite.h + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message_field.h + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message_field_lite.h + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message_lite.h + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_name_resolver.h + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_options.h + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_primitive_field.h + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_primitive_field_lite.h + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_service.h + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_shared_code_generator.h + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_string_field.h + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_string_field_lite.h + ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_enum.h + ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_enum_field.h + ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_extension.h + ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_field.h + ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_file.h + ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_helpers.h + ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_map_field.h + ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_message.h + ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_message_field.h + ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_oneof.h + ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.h + ${protobuf_source_dir}/src/google/protobuf/compiler/subprocess.h + ${protobuf_source_dir}/src/google/protobuf/compiler/zip_writer.h +) + +if (MSVC) +set(libprotoc_rc_files + ${CMAKE_CURRENT_BINARY_DIR}/version.rc +) +endif() + add_library(libprotoc ${protobuf_SHARED_OR_STATIC} - ${libprotoc_files}) + ${libprotoc_files} ${libprotoc_headers} ${libprotoc_rc_files}) target_link_libraries(libprotoc libprotobuf) if(MSVC AND protobuf_BUILD_SHARED_LIBS) target_compile_definitions(libprotoc @@ -102,5 +177,7 @@ endif() set_target_properties(libprotoc PROPERTIES COMPILE_DEFINITIONS LIBPROTOC_EXPORTS + VERSION ${protobuf_VERSION} OUTPUT_NAME ${LIB_PREFIX}protoc DEBUG_POSTFIX "${protobuf_DEBUG_POSTFIX}") +add_library(protobuf::libprotoc ALIAS libprotoc) diff -Nru protobuf-3.0.0/cmake/protobuf-config.cmake.in protobuf-3.6.1.3/cmake/protobuf-config.cmake.in --- protobuf-3.0.0/cmake/protobuf-config.cmake.in 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/cmake/protobuf-config.cmake.in 2018-12-08 01:32:11.000000000 +0000 @@ -1,9 +1,120 @@ # User options include("${CMAKE_CURRENT_LIST_DIR}/protobuf-options.cmake") +# Depend packages +@_protobuf_FIND_ZLIB@ + # Imported targets include("${CMAKE_CURRENT_LIST_DIR}/protobuf-targets.cmake") +function(protobuf_generate) + include(CMakeParseArguments) + + set(_options APPEND_PATH) + set(_singleargs LANGUAGE OUT_VAR EXPORT_MACRO) + if(COMMAND target_sources) + list(APPEND _singleargs TARGET) + endif() + set(_multiargs PROTOS IMPORT_DIRS GENERATE_EXTENSIONS) + + cmake_parse_arguments(protobuf_generate "${_options}" "${_singleargs}" "${_multiargs}" "${ARGN}") + + if(NOT protobuf_generate_PROTOS AND NOT protobuf_generate_TARGET) + message(SEND_ERROR "Error: protobuf_generate called without any targets or source files") + return() + endif() + + if(NOT protobuf_generate_OUT_VAR AND NOT protobuf_generate_TARGET) + message(SEND_ERROR "Error: protobuf_generate called without a target or output variable") + return() + endif() + + if(NOT protobuf_generate_LANGUAGE) + set(protobuf_generate_LANGUAGE cpp) + endif() + string(TOLOWER ${protobuf_generate_LANGUAGE} protobuf_generate_LANGUAGE) + + if(protobuf_generate_EXPORT_MACRO AND protobuf_generate_LANGUAGE STREQUAL cpp) + set(_dll_export_decl "dllexport_decl=${protobuf_generate_EXPORT_MACRO}:") + endif() + + if(NOT protobuf_GENERATE_EXTENSIONS) + if(protobuf_generate_LANGUAGE STREQUAL cpp) + set(protobuf_GENERATE_EXTENSIONS .pb.h .pb.cc) + elseif(protobuf_generate_LANGUAGE STREQUAL python) + set(protobuf_GENERATE_EXTENSIONS _pb2.py) + else() + message(SEND_ERROR "Error: protobuf_generate given unknown Language ${LANGUAGE}, please provide a value for GENERATE_EXTENSIONS") + return() + endif() + endif() + + if(protobuf_generate_TARGET) + get_target_property(_source_list ${protobuf_generate_TARGET} SOURCES) + foreach(_file ${_source_list}) + if(_file MATCHES "proto$") + list(APPEND protobuf_generate_PROTOS ${_file}) + endif() + endforeach() + endif() + + if(NOT protobuf_generate_PROTOS) + message(SEND_ERROR "Error: protobuf_generate could not find any .proto files") + return() + endif() + + if(protobuf_generate_APPEND_PATH) + # Create an include path for each file specified + foreach(_file ${protobuf_generate_PROTOS}) + get_filename_component(_abs_file ${_file} ABSOLUTE) + get_filename_component(_abs_path ${_abs_file} PATH) + list(FIND _protobuf_include_path ${_abs_path} _contains_already) + if(${_contains_already} EQUAL -1) + list(APPEND _protobuf_include_path -I ${_abs_path}) + endif() + endforeach() + else() + set(_protobuf_include_path -I ${CMAKE_CURRENT_SOURCE_DIR}) + endif() + + foreach(DIR ${protobuf_generate_IMPORT_DIRS}) + get_filename_component(ABS_PATH ${DIR} ABSOLUTE) + list(FIND _protobuf_include_path ${ABS_PATH} _contains_already) + if(${_contains_already} EQUAL -1) + list(APPEND _protobuf_include_path -I ${ABS_PATH}) + endif() + endforeach() + + set(_generated_srcs_all) + foreach(_proto ${protobuf_generate_PROTOS}) + get_filename_component(_abs_file ${_proto} ABSOLUTE) + get_filename_component(_basename ${_proto} NAME_WE) + + set(_generated_srcs) + foreach(_ext ${protobuf_GENERATE_EXTENSIONS}) + list(APPEND _generated_srcs "${CMAKE_CURRENT_BINARY_DIR}/${_basename}${_ext}") + endforeach() + list(APPEND _generated_srcs_all ${_generated_srcs}) + + add_custom_command( + OUTPUT ${_generated_srcs} + COMMAND protobuf::protoc + ARGS --${protobuf_generate_LANGUAGE}_out ${_dll_export_decl}${CMAKE_CURRENT_BINARY_DIR} ${_protobuf_include_path} ${_abs_file} + DEPENDS ${ABS_FIL} protobuf::protoc + COMMENT "Running ${protobuf_generate_LANGUAGE} protocol buffer compiler on ${_proto}" + VERBATIM ) + endforeach() + + set_source_files_properties(${_generated_srcs_all} PROPERTIES GENERATED TRUE) + if(protobuf_generate_OUT_VAR) + set(${protobuf_generate_OUT_VAR} ${_generated_srcs_all} PARENT_SCOPE) + endif() + if(protobuf_generate_TARGET) + target_sources(${protobuf_generate_TARGET} PRIVATE ${_generated_srcs_all}) + endif() + +endfunction() + # CMake FindProtobuf module compatible file if(protobuf_MODULE_COMPATIBLE) include("${CMAKE_CURRENT_LIST_DIR}/protobuf-module.cmake") diff -Nru protobuf-3.0.0/cmake/protobuf-config-version.cmake.in protobuf-3.6.1.3/cmake/protobuf-config-version.cmake.in --- protobuf-3.0.0/cmake/protobuf-config-version.cmake.in 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/cmake/protobuf-config-version.cmake.in 2018-12-08 01:32:11.000000000 +0000 @@ -17,39 +17,41 @@ set(PACKAGE_VERSION_COMPATIBLE TRUE) #Assume true until shown otherwise -if(NOT PACKAGE_FIND_VERSION_MAJOR EQUAL "@protobuf_VERSION_MAJOR@") - set(PACKAGE_VERSION_COMPATIBLE FALSE) -elseif(PACKAGE_FIND_VERSION VERSION_GREATER PACKAGE_VERSION) - set(PACKAGE_VERSION_COMPATIBLE FALSE) -elseif(PACKAGE_FIND_VERSION VERSION_EQUAL PACKAGE_VERSION) - # Do not match prerelease versions to non-prerelease version requests. - if(NOT "@protobuf_VERSION_PRERELEASE@" STREQUAL "" AND PACKAGE_FIND_VERSION_PRERELEASE STREQUAL "") - message(AUTHOR_WARNING "To use this prerelease version of ${PACKAGE_FIND_NAME}, set ${PACKAGE_FIND_NAME}_FIND_VERSION_PRERELEASE to '@protobuf_VERSION_PRERELEASE@' or greater.") +if(PACKAGE_FIND_VERSION) #Only perform version checks if one is given + if(NOT PACKAGE_FIND_VERSION_MAJOR EQUAL "@protobuf_VERSION_MAJOR@") set(PACKAGE_VERSION_COMPATIBLE FALSE) - endif() - - # Not robustly SemVer compliant, but protobuf never uses '.' separated prerelease identifiers. - if(PACKAGE_FIND_VERSION_PRERELEASE STRGREATER "@protobuf_VERSION_PRERELEASE@") + elseif(PACKAGE_FIND_VERSION VERSION_GREATER PACKAGE_VERSION) set(PACKAGE_VERSION_COMPATIBLE FALSE) + elseif(PACKAGE_FIND_VERSION VERSION_EQUAL PACKAGE_VERSION) + # Do not match prerelease versions to non-prerelease version requests. + if(NOT "@protobuf_VERSION_PRERELEASE@" STREQUAL "" AND PACKAGE_FIND_VERSION_PRERELEASE STREQUAL "") + message(AUTHOR_WARNING "To use this prerelease version of ${PACKAGE_FIND_NAME}, set ${PACKAGE_FIND_NAME}_FIND_VERSION_PRERELEASE to '@protobuf_VERSION_PRERELEASE@' or greater.") + set(PACKAGE_VERSION_COMPATIBLE FALSE) + endif() + + # Not robustly SemVer compliant, but protobuf never uses '.' separated prerelease identifiers. + if(PACKAGE_FIND_VERSION_PRERELEASE STRGREATER "@protobuf_VERSION_PRERELEASE@") + set(PACKAGE_VERSION_COMPATIBLE FALSE) + endif() endif() endif() # Check and save build options used to create this package macro(_check_and_save_build_option OPTION VALUE) if(DEFINED ${PACKAGE_FIND_NAME}_${OPTION} AND - NOT ${PACKAGE_FIND_NAME}_${OPTION} EQUAL VALUE) + NOT ${PACKAGE_FIND_NAME}_${OPTION} STREQUAL ${VALUE}) set(PACKAGE_VERSION_UNSUITABLE TRUE) endif() - set(${PACKAGE_FIND_NAME}_${OPTION} ${VALUE}) + set(${PACKAGE_FIND_NAME}_${OPTION} ${VALUE} PARENT_SCOPE) endmacro() _check_and_save_build_option(WITH_ZLIB @protobuf_WITH_ZLIB@) _check_and_save_build_option(MSVC_STATIC_RUNTIME @protobuf_MSVC_STATIC_RUNTIME@) _check_and_save_build_option(BUILD_SHARED_LIBS @protobuf_BUILD_SHARED_LIBS@) # if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it: -if(NOT "${CMAKE_SIZEOF_VOID_P}" STREQUAL "" AND NOT "@CMAKE_SIZEOF_VOID_P@" STREQUAL "") +if(CMAKE_SIZEOF_VOID_P AND "@CMAKE_SIZEOF_VOID_P@") # check that the installed version has the same 32/64bit-ness as the one which is currently searching: - if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "@CMAKE_SIZEOF_VOID_P@") + if(NOT CMAKE_SIZEOF_VOID_P EQUAL "@CMAKE_SIZEOF_VOID_P@") math(EXPR installedBits "@CMAKE_SIZEOF_VOID_P@ * 8") set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)") set(PACKAGE_VERSION_UNSUITABLE TRUE) diff -Nru protobuf-3.0.0/cmake/protobuf-lite.pc.cmake protobuf-3.6.1.3/cmake/protobuf-lite.pc.cmake --- protobuf-3.0.0/cmake/protobuf-lite.pc.cmake 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/cmake/protobuf-lite.pc.cmake 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,11 @@ +prefix=@CMAKE_INSTALL_PREFIX@ +exec_prefix=@CMAKE_INSTALL_PREFIX@ +libdir=@CMAKE_INSTALL_FULL_LIBDIR@ +includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ + +Name: Protocol Buffers +Description: Google's Data Interchange Format +Version: @protobuf_VERSION@ +Libs: -L${libdir} -lprotobuf-lite @CMAKE_THREAD_LIBS_INIT@ +Cflags: -I${includedir} @CMAKE_THREAD_LIBS_INIT@ +Conflicts: protobuf diff -Nru protobuf-3.0.0/cmake/protobuf-module.cmake.in protobuf-3.6.1.3/cmake/protobuf-module.cmake.in --- protobuf-3.0.0/cmake/protobuf-module.cmake.in 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/cmake/protobuf-module.cmake.in 2018-12-08 01:32:11.000000000 +0000 @@ -1,55 +1,35 @@ +# This file contains backwards compatibility patches for various legacy functions and variables # Functions function(PROTOBUF_GENERATE_CPP SRCS HDRS) - if(NOT ARGN) + cmake_parse_arguments(protobuf_generate_cpp "" "EXPORT_MACRO" "" ${ARGN}) + + set(_proto_files "${protobuf_generate_cpp_UNPARSED_ARGUMENTS}") + if(NOT _proto_files) message(SEND_ERROR "Error: PROTOBUF_GENERATE_CPP() called without any proto files") return() endif() if(PROTOBUF_GENERATE_CPP_APPEND_PATH) - # Create an include path for each file specified - foreach(FIL ${ARGN}) - get_filename_component(ABS_FIL ${FIL} ABSOLUTE) - get_filename_component(ABS_PATH ${ABS_FIL} PATH) - list(FIND _protobuf_include_path ${ABS_PATH} _contains_already) - if(${_contains_already} EQUAL -1) - list(APPEND _protobuf_include_path -I ${ABS_PATH}) - endif() - endforeach() - else() - set(_protobuf_include_path -I ${CMAKE_CURRENT_SOURCE_DIR}) + set(_append_arg APPEND_PATH) endif() if(DEFINED Protobuf_IMPORT_DIRS) - foreach(DIR ${Protobuf_IMPORT_DIRS}) - get_filename_component(ABS_PATH ${DIR} ABSOLUTE) - list(FIND _protobuf_include_path ${ABS_PATH} _contains_already) - if(${_contains_already} EQUAL -1) - list(APPEND _protobuf_include_path -I ${ABS_PATH}) - endif() - endforeach() + set(_import_arg IMPORT_DIRS ${Protobuf_IMPORT_DIRS}) endif() + set(_outvar) + protobuf_generate(${_append_arg} LANGUAGE cpp EXPORT_MACRO ${protobuf_generate_cpp_EXPORT_MACRO} OUT_VAR _outvar ${_import_arg} PROTOS ${_proto_files}) + set(${SRCS}) set(${HDRS}) - foreach(FIL ${ARGN}) - get_filename_component(ABS_FIL ${FIL} ABSOLUTE) - get_filename_component(FIL_WE ${FIL} NAME_WE) - - list(APPEND ${SRCS} "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.cc") - list(APPEND ${HDRS} "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.h") - - add_custom_command( - OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.cc" - "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.h" - COMMAND ${Protobuf_PROTOC_EXECUTABLE} - ARGS --cpp_out ${CMAKE_CURRENT_BINARY_DIR} ${_protobuf_include_path} ${ABS_FIL} - DEPENDS ${ABS_FIL} ${Protobuf_PROTOC_EXECUTABLE} - COMMENT "Running C++ protocol buffer compiler on ${FIL}" - VERBATIM ) + foreach(_file ${_outvar}) + if(_file MATCHES "cc$") + list(APPEND ${SRCS} ${_file}) + else() + list(APPEND ${HDRS} ${_file}) + endif() endforeach() - - set_source_files_properties(${${SRCS}} ${${HDRS}} PROPERTIES GENERATED TRUE) set(${SRCS} ${${SRCS}} PARENT_SCOPE) set(${HDRS} ${${HDRS}} PARENT_SCOPE) endfunction() @@ -61,44 +41,16 @@ endif() if(PROTOBUF_GENERATE_CPP_APPEND_PATH) - # Create an include path for each file specified - foreach(FIL ${ARGN}) - get_filename_component(ABS_FIL ${FIL} ABSOLUTE) - get_filename_component(ABS_PATH ${ABS_FIL} PATH) - list(FIND _protobuf_include_path ${ABS_PATH} _contains_already) - if(${_contains_already} EQUAL -1) - list(APPEND _protobuf_include_path -I ${ABS_PATH}) - endif() - endforeach() - else() - set(_protobuf_include_path -I ${CMAKE_CURRENT_SOURCE_DIR}) + set(_append_arg APPEND_PATH) endif() if(DEFINED Protobuf_IMPORT_DIRS) - foreach(DIR ${Protobuf_IMPORT_DIRS}) - get_filename_component(ABS_PATH ${DIR} ABSOLUTE) - list(FIND _protobuf_include_path ${ABS_PATH} _contains_already) - if(${_contains_already} EQUAL -1) - list(APPEND _protobuf_include_path -I ${ABS_PATH}) - endif() - endforeach() + set(_import_arg IMPORT_DIRS ${Protobuf_IMPORT_DIRS}) endif() - set(${SRCS}) - foreach(FIL ${ARGN}) - get_filename_component(ABS_FIL ${FIL} ABSOLUTE) - get_filename_component(FIL_WE ${FIL} NAME_WE) - - list(APPEND ${SRCS} "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}_pb2.py") - add_custom_command( - OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}_pb2.py" - COMMAND ${Protobuf_PROTOC_EXECUTABLE} --python_out ${CMAKE_CURRENT_BINARY_DIR} ${_protobuf_include_path} ${ABS_FIL} - DEPENDS ${ABS_FIL} ${Protobuf_PROTOC_EXECUTABLE} - COMMENT "Running Python protocol buffer compiler on ${FIL}" - VERBATIM ) - endforeach() - - set(${SRCS} ${${SRCS}} PARENT_SCOPE) + set(_outvar) + protobuf_generate(${_append_arg} LANGUAGE python OUT_VAR _outvar ${_import_arg} PROTOS ${ARGN}) + set(${SRCS} ${_outvar} PARENT_SCOPE) endfunction() # Environment @@ -147,7 +99,6 @@ LOCATION_RELEASE) get_target_property(${name}_LIBRARY_DEBUG protobuf::lib${filename} LOCATION_DEBUG) - endif() select_library_configurations(${name}) set(${name}_LIBRARY ${${name}_LIBRARY} PARENT_SCOPE) @@ -199,6 +150,10 @@ get_target_property(Protobuf_PROTOC_EXECUTABLE protobuf::protoc IMPORTED_LOCATION_DEBUG) endif() +if(NOT EXISTS "${Protobuf_PROTOC_EXECUTABLE}") + get_target_property(Protobuf_PROTOC_EXECUTABLE protobuf::protoc + IMPORTED_LOCATION_NOCONFIG) +endif() # Version info variable set(Protobuf_VERSION "@protobuf_VERSION@") diff -Nru protobuf-3.0.0/cmake/protobuf.pc.cmake protobuf-3.6.1.3/cmake/protobuf.pc.cmake --- protobuf-3.0.0/cmake/protobuf.pc.cmake 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/cmake/protobuf.pc.cmake 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,11 @@ +prefix=@CMAKE_INSTALL_PREFIX@ +exec_prefix=@CMAKE_INSTALL_PREFIX@ +libdir=@CMAKE_INSTALL_FULL_LIBDIR@ +includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ + +Name: Protocol Buffers +Description: Google's Data Interchange Format +Version: @protobuf_VERSION@ +Libs: -L${libdir} -lprotobuf @CMAKE_THREAD_LIBS_INIT@ +Cflags: -I${includedir} @CMAKE_THREAD_LIBS_INIT@ +Conflicts: protobuf-lite diff -Nru protobuf-3.0.0/cmake/protoc.cmake protobuf-3.6.1.3/cmake/protoc.cmake --- protobuf-3.0.0/cmake/protoc.cmake 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/cmake/protoc.cmake 2018-12-08 01:32:11.000000000 +0000 @@ -2,5 +2,13 @@ ${protobuf_source_dir}/src/google/protobuf/compiler/main.cc ) -add_executable(protoc ${protoc_files}) +set(protoc_rc_files + ${CMAKE_CURRENT_BINARY_DIR}/version.rc +) + +add_executable(protoc ${protoc_files} ${protoc_rc_files}) target_link_libraries(protoc libprotobuf libprotoc) +add_executable(protobuf::protoc ALIAS protoc) + +set_target_properties(protoc PROPERTIES + VERSION ${protobuf_VERSION}) diff -Nru protobuf-3.0.0/cmake/README.md protobuf-3.6.1.3/cmake/README.md --- protobuf-3.0.0/cmake/README.md 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/cmake/README.md 2018-12-08 01:32:11.000000000 +0000 @@ -41,9 +41,16 @@ Getting Sources =============== -You can get the latest stable source packages from the -[releases](https://github.com/google/protobuf/releases) page. -Or you can type: +You can get the latest stable source packages from the release page: + + https://github.com/google/protobuf/releases/latest + +For example: if you only need C++, download `protobuf-cpp-[VERSION].tar.gz`; if +you need C++ and Java, download `protobuf-java-[VERSION].tar.gz` (every package +contains C++ source already); if you need C++ and multiple other languages, +download `protobuf-all-[VERSION].tar.gz`. + +Or you can use git to clone from protobuf git repository. C:\Path\to> git clone -b [release_tag] https://github.com/google/protobuf.git @@ -55,26 +62,16 @@ C:\Path\to>cd protobuf C:\Path\to\protobuf> -Protobuf unit-tests require gmock to build. If you download protobuf source code -from the *releases* page, the *gmock* directory should already be there. If you checkout -the code via `git clone`, this *gmock* directory won't exist and you will have to -download it manually or skip building protobuf unit-tests. - -You can download gmock as follows: +Remember to update any submodules if you are using git clone (you can skip this +step if you are using a release .tar.gz or .zip package): - C:\Path\to\protobuf>git clone -b release-1.7.0 https://github.com/google/googlemock.git gmock - -Then go to *gmock* folder and download gtest: - - C:\Path\to\protobuf>cd gmock - C:\Path\to\protobuf\gmock>git clone -b release-1.7.0 https://github.com/google/googletest.git gtest - -If you absolutely don't want to build and run protobuf unit-tests, skip -this steps and use protobuf at your own risk. +```console +C:\Path\to> git submodule update --init --recursive +``` Now go to *cmake* folder in protobuf sources: - C:\Path\to\protobuf\gmock>cd ..\cmake + C:\Path\to\protobuf>cd cmake C:\Path\to\protobuf\cmake> Good. Now you are ready to *CMake* configuration. @@ -124,7 +121,7 @@ To create *Visual Studio* solution file: C:\Path\to\protobuf\cmake\build>mkdir solution & cd solution - C:\Path\to\protobuf\cmake\build\solution>cmake -G "Visual Studio 12 2013 Win64" ^ + C:\Path\to\protobuf\cmake\build\solution>cmake -G "Visual Studio 14 2015 Win64" ^ -DCMAKE_INSTALL_PREFIX=../../../../install ^ ../.. @@ -302,6 +299,11 @@ If it reports NOTFOUND for zlib_include or zlib_lib, you might haven't put the headers or the .lib file in the right directory. +If you already have ZLIB library and headers at some other location on your system then alternatively you can define following configuration flags to locate them: + + -DZLIB_INCLUDE_DIR= + -DZLIB_LIB= + Build and testing protobuf as usual. Notes on Compiler Warnings diff -Nru protobuf-3.0.0/cmake/tests.cmake protobuf-3.6.1.3/cmake/tests.cmake --- protobuf-3.0.0/cmake/tests.cmake 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/cmake/tests.cmake 2018-12-08 01:32:11.000000000 +0000 @@ -1,23 +1,31 @@ -if (NOT EXISTS "${PROJECT_SOURCE_DIR}/../gmock/CMakeLists.txt") - message(FATAL_ERROR "Cannot find gmock directory.") +if (NOT EXISTS "${PROJECT_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" + " git submodule update --init --recursive\n" + "If instead you want to skip tests, run cmake with:\n" + " cmake -Dprotobuf_BUILD_TESTS=OFF\n") endif() option(protobuf_ABSOLUTE_TEST_PLUGIN_PATH "Using absolute test_plugin path in tests" ON) mark_as_advanced(protobuf_ABSOLUTE_TEST_PLUGIN_PATH) +set(googlemock_source_dir "${protobuf_source_dir}/third_party/googletest/googlemock") +set(googletest_source_dir "${protobuf_source_dir}/third_party/googletest/googletest") include_directories( - ${protobuf_source_dir}/gmock - ${protobuf_source_dir}/gmock/gtest - ${protobuf_source_dir}/gmock/gtest/include - ${protobuf_source_dir}/gmock/include + ${googlemock_source_dir} + ${googletest_source_dir} + ${googletest_source_dir}/include + ${googlemock_source_dir}/include ) add_library(gmock STATIC - ${protobuf_source_dir}/gmock/src/gmock-all.cc - ${protobuf_source_dir}/gmock/gtest/src/gtest-all.cc + "${googlemock_source_dir}/src/gmock-all.cc" + "${googletest_source_dir}/src/gtest-all.cc" ) -add_library(gmock_main STATIC ${protobuf_source_dir}/gmock/src/gmock_main.cc) +target_link_libraries(gmock ${CMAKE_THREAD_LIBS_INIT}) +add_library(gmock_main STATIC "${googlemock_source_dir}/src/gmock_main.cc") target_link_libraries(gmock_main gmock) set(lite_test_protos @@ -42,6 +50,9 @@ google/protobuf/unittest_empty.proto google/protobuf/unittest_import.proto google/protobuf/unittest_import_public.proto + google/protobuf/unittest_lazy_dependencies.proto + google/protobuf/unittest_lazy_dependencies_custom_option.proto + google/protobuf/unittest_lazy_dependencies_enum.proto google/protobuf/unittest_lite_imports_nonlite.proto google/protobuf/unittest_mset.proto google/protobuf/unittest_mset_wire_format.proto @@ -63,8 +74,10 @@ google/protobuf/util/internal/testdata/field_mask.proto google/protobuf/util/internal/testdata/maps.proto google/protobuf/util/internal/testdata/oneofs.proto + google/protobuf/util/internal/testdata/proto3.proto google/protobuf/util/internal/testdata/struct.proto google/protobuf/util/internal/testdata/timestamp_duration.proto + google/protobuf/util/internal/testdata/wrappers.proto google/protobuf/util/json_format_proto3.proto google/protobuf/util/message_differencer_unittest.proto ) @@ -101,6 +114,7 @@ ${protobuf_source_dir}/src/google/protobuf/arena_test_util.cc ${protobuf_source_dir}/src/google/protobuf/map_test_util.cc ${protobuf_source_dir}/src/google/protobuf/test_util.cc + ${protobuf_source_dir}/src/google/protobuf/test_util.inc ${protobuf_source_dir}/src/google/protobuf/testing/file.cc ${protobuf_source_dir}/src/google/protobuf/testing/googletest.cc ) @@ -115,11 +129,15 @@ ${protobuf_source_dir}/src/google/protobuf/any_test.cc ${protobuf_source_dir}/src/google/protobuf/arena_unittest.cc ${protobuf_source_dir}/src/google/protobuf/arenastring_unittest.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/annotation_test_util.cc ${protobuf_source_dir}/src/google/protobuf/compiler/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 @@ -142,6 +160,7 @@ ${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/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 @@ -153,7 +172,7 @@ ${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/once_unittest.cc + ${protobuf_source_dir}/src/google/protobuf/stubs/io_win32_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 @@ -162,9 +181,9 @@ ${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/stubs/type_traits_unittest.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 @@ -202,7 +221,7 @@ ${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) +target_link_libraries(lite-test libprotobuf-lite gmock_main) set(lite_arena_test_files ${protobuf_source_dir}/src/google/protobuf/lite_arena_unittest.cc @@ -212,4 +231,5 @@ add_custom_target(check COMMAND tests + DEPENDS tests test_plugin WORKING_DIRECTORY ${protobuf_source_dir}) diff -Nru protobuf-3.0.0/cmake/version.rc.in protobuf-3.6.1.3/cmake/version.rc.in --- protobuf-3.0.0/cmake/version.rc.in 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/cmake/version.rc.in 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,45 @@ +#define VS_FF_DEBUG 0x1L +#define VS_VERSION_INFO 0x1L +#define VS_FFI_FILEFLAGSMASK 0x17L +#define VER_PRIVATEBUILD 0x0L +#define VER_PRERELEASE 0x0L +#define VOS__WINDOWS32 0x4L +#define VFT_DLL 0x2L +#define VFT2_UNKNOWN 0x0L + +#ifndef DEBUG +#define VER_DEBUG 0 +#else +#define VER_DEBUG VS_FF_DEBUG +#endif + + +VS_VERSION_INFO VERSIONINFO + FILEVERSION @protobuf_RC_FILEVERSION@,0 + PRODUCTVERSION @protobuf_RC_FILEVERSION@,0 + FILEFLAGSMASK VS_FFI_FILEFLAGSMASK + FILEFLAGS VER_DEBUG + FILEOS VOS__WINDOWS32 + FILETYPE VFT_DLL +BEGIN + BLOCK "VarFileInfo" + BEGIN + // English language (0x409) and the Windows Unicode codepage (1200) + VALUE "Translation", 0x409, 1200 + END + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "FileDescription", "Compiled with @CMAKE_CXX_COMPILER_ID@ @CMAKE_CXX_COMPILER_VERSION@\0" + VALUE "ProductVersion", "@protobuf_VERSION@\0" + VALUE "FileVersion", "@protobuf_VERSION@\0" + VALUE "InternalName", "protobuf\0" + VALUE "ProductName", "Protocol Buffers - Google's Data Interchange Format\0" + VALUE "CompanyName", "Google Inc.\0" + VALUE "LegalCopyright", "Copyright 2008 Google Inc. All rights reserved.\0" + VALUE "Licence", "BSD\0" + VALUE "Info", "https://developers.google.com/protocol-buffers/\0" + END + END +END diff -Nru protobuf-3.0.0/compiler_config_setting.bzl protobuf-3.6.1.3/compiler_config_setting.bzl --- protobuf-3.0.0/compiler_config_setting.bzl 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/compiler_config_setting.bzl 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,21 @@ +"""Creates config_setting that allows selecting based on 'compiler' value.""" + +def create_compiler_config_setting(name, value): + # The "do_not_use_tools_cpp_compiler_present" attribute exists to + # distinguish between older versions of Bazel that do not support + # "@bazel_tools//tools/cpp:compiler" flag_value, and newer ones that do. + # In the future, the only way to select on the compiler will be through + # flag_values{"@bazel_tools//tools/cpp:compiler"} and the else branch can + # be removed. + if hasattr(cc_common, "do_not_use_tools_cpp_compiler_present"): + native.config_setting( + name = name, + flag_values = { + "@bazel_tools//tools/cpp:compiler": value, + }, + ) + else: + native.config_setting( + name = name, + values = {"compiler": value}, + ) diff -Nru protobuf-3.0.0/composer.json protobuf-3.6.1.3/composer.json --- protobuf-3.0.0/composer.json 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/composer.json 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,23 @@ +{ + "name": "google/protobuf", + "type": "library", + "description": "proto library for PHP", + "keywords": ["proto"], + "homepage": "https://developers.google.com/protocol-buffers/", + "license": "BSD-3-Clause", + "require": { + "php": ">=5.5.0" + }, + "require-dev": { + "phpunit/phpunit": ">=4.8.0" + }, + "suggest": { + "ext-bcmath": "Need to support JSON deserialization" + }, + "autoload": { + "psr-4": { + "Google\\Protobuf\\": "php/src/Google/Protobuf", + "GPBMetadata\\Google\\Protobuf\\": "php/src/GPBMetadata/Google/Protobuf" + } + } +} diff -Nru protobuf-3.0.0/configure.ac protobuf-3.6.1.3/configure.ac --- protobuf-3.0.0/configure.ac 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/configure.ac 2018-12-08 01:32:11.000000000 +0000 @@ -17,7 +17,7 @@ # 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.0.0],[protobuf@googlegroups.com],[protobuf]) +AC_INIT([Protocol Buffers],[3.6.1],[protobuf@googlegroups.com],[protobuf]) AM_MAINTAINER_MODE([enable]) @@ -31,7 +31,7 @@ AC_ARG_VAR(DIST_LANG, [language to include in the distribution package (i.e., make dist)]) case "$DIST_LANG" in "") DIST_LANG=all ;; - all | cpp | csharp | java | python | javanano | objectivec | ruby | js) ;; + all | cpp | csharp | java | python | javanano | objectivec | ruby | js | php) ;; *) AC_MSG_FAILURE([unknown language: $DIST_LANG]) ;; esac AC_SUBST(DIST_LANG) @@ -52,6 +52,16 @@ [include classes for streaming compressed data in and out @<:@default=check@:>@])], [],[with_zlib=check]) +AC_ARG_WITH([zlib-include], + [AS_HELP_STRING([--with-zlib-include=PATH], + [zlib include directory])], + [CPPFLAGS="-I$withval $CPPFLAGS"]) + +AC_ARG_WITH([zlib-lib], + [AS_HELP_STRING([--with-zlib-lib=PATH], + [zlib lib directory])], + [LDFLAGS="-L$withval $LDFLAGS"]) + AC_ARG_WITH([protoc], [AS_HELP_STRING([--with-protoc=COMMAND], [use the given protoc command instead of building a new one when building tests (useful for cross-compiling)])], @@ -60,6 +70,7 @@ # Checks for programs. AC_PROG_CC AC_PROG_CXX +AC_PROG_CXX_FOR_BUILD AC_LANG([C++]) ACX_USE_SYSTEM_EXTENSIONS m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) @@ -77,7 +88,7 @@ # Protocol Buffers contains several checks that are intended to be used only # for debugging and which might hurt performance. Most users are probably # end users who don't want these checks, so add -DNDEBUG by default. - CXXFLAGS="$CXXFLAGS -DNDEBUG" + CXXFLAGS="$CXXFLAGS -std=c++11 -DNDEBUG" AC_MSG_RESULT([use default: $PROTOBUF_OPT_FLAG $CXXFLAGS]) ],[ @@ -92,6 +103,25 @@ # to the link AC_PROG_LIBTOOL +# Check whether the linker supports version scripts +AC_MSG_CHECKING([whether the linker supports version scripts]) +save_LDFLAGS=$LDFLAGS +LDFLAGS="$LDFLAGS -Wl,--version-script=conftest.map" +cat > conftest.map < #include "conformance.pb.h" +#include +#include +#include #include #include using conformance::ConformanceRequest; using conformance::ConformanceResponse; -using conformance::TestAllTypes; using google::protobuf::Descriptor; using google::protobuf::DescriptorPool; -using google::protobuf::internal::scoped_ptr; +using google::protobuf::Message; +using google::protobuf::MessageFactory; using google::protobuf::util::BinaryToJsonString; using google::protobuf::util::JsonToBinaryString; using google::protobuf::util::NewTypeResolverForDescriptorPool; using google::protobuf::util::Status; using google::protobuf::util::TypeResolver; +using protobuf_test_messages::proto3::TestAllTypesProto3; +using protobuf_test_messages::proto2::TestAllTypesProto2; using std::string; static const char kTypeUrlPrefix[] = "type.googleapis.com"; @@ -86,17 +91,24 @@ } void DoTest(const ConformanceRequest& request, ConformanceResponse* response) { - TestAllTypes test_message; + Message *test_message; + const Descriptor *descriptor = DescriptorPool::generated_pool()->FindMessageTypeByName( + request.message_type()); + if (!descriptor) { + GOOGLE_LOG(FATAL) << "No such message type: " << request.message_type(); + } + test_message = MessageFactory::generated_factory()->GetPrototype(descriptor)->New(); switch (request.payload_case()) { - case ConformanceRequest::kProtobufPayload: - if (!test_message.ParseFromString(request.protobuf_payload())) { + case ConformanceRequest::kProtobufPayload: { + if (!test_message->ParseFromString(request.protobuf_payload())) { // Getting parse details would involve something like: // http://stackoverflow.com/questions/22121922/how-can-i-get-more-details-about-errors-generated-during-protobuf-parsing-c response->set_parse_error("Parse error (no more details available)."); return; } break; + } case ConformanceRequest::kJsonPayload: { string proto_binary; @@ -108,7 +120,7 @@ return; } - if (!test_message.ParseFromString(proto_binary)) { + if (!test_message->ParseFromString(proto_binary)) { response->set_runtime_error( "Parsing JSON generates invalid proto output."); return; @@ -126,14 +138,14 @@ GOOGLE_LOG(FATAL) << "Unspecified output format"; break; - case conformance::PROTOBUF: - GOOGLE_CHECK( - test_message.SerializeToString(response->mutable_protobuf_payload())); + case conformance::PROTOBUF: { + GOOGLE_CHECK(test_message->SerializeToString(response->mutable_protobuf_payload())); break; + } case conformance::JSON: { string proto_binary; - GOOGLE_CHECK(test_message.SerializeToString(&proto_binary)); + GOOGLE_CHECK(test_message->SerializeToString(&proto_binary)); Status status = BinaryToJsonString(type_resolver, *type_url, proto_binary, response->mutable_json_payload()); if (!status.ok()) { @@ -196,7 +208,7 @@ int main() { type_resolver = NewTypeResolverForDescriptorPool( kTypeUrlPrefix, DescriptorPool::generated_pool()); - type_url = new string(GetTypeUrl(TestAllTypes::descriptor())); + type_url = new string(GetTypeUrl(TestAllTypesProto3::descriptor())); while (1) { if (!DoTestIo()) { fprintf(stderr, "conformance-cpp: received EOF from test runner " diff -Nru protobuf-3.0.0/conformance/ConformanceJava.java protobuf-3.6.1.3/conformance/ConformanceJava.java --- protobuf-3.0.0/conformance/ConformanceJava.java 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/conformance/ConformanceJava.java 2018-12-08 01:32:11.000000000 +0000 @@ -1,8 +1,18 @@ - +import com.google.protobuf.ByteString; +import com.google.protobuf.AbstractMessage; +import com.google.protobuf.Parser; +import com.google.protobuf.CodedInputStream; import com.google.protobuf.conformance.Conformance; +import com.google.protobuf.InvalidProtocolBufferException; +import com.google.protobuf_test_messages.proto3.TestMessagesProto3; +import com.google.protobuf_test_messages.proto3.TestMessagesProto3.TestAllTypesProto3; +import com.google.protobuf_test_messages.proto2.TestMessagesProto2; +import com.google.protobuf_test_messages.proto2.TestMessagesProto2.TestAllTypesProto2; +import com.google.protobuf.ExtensionRegistry; import com.google.protobuf.util.JsonFormat; import com.google.protobuf.util.JsonFormat.TypeRegistry; -import com.google.protobuf.InvalidProtocolBufferException; +import java.nio.ByteBuffer; +import java.util.ArrayList; class ConformanceJava { private int testCount = 0; @@ -46,22 +56,185 @@ buf[3] = (byte)(val >> 24); writeToStdout(buf); } + + private enum BinaryDecoderType { + BTYE_STRING_DECODER, + BYTE_ARRAY_DECODER, + ARRAY_BYTE_BUFFER_DECODER, + READONLY_ARRAY_BYTE_BUFFER_DECODER, + DIRECT_BYTE_BUFFER_DECODER, + READONLY_DIRECT_BYTE_BUFFER_DECODER, + INPUT_STREAM_DECODER; + } + + private static class BinaryDecoder { + public MessageType decode (ByteString bytes, BinaryDecoderType type, + Parser parser, ExtensionRegistry extensions) + throws InvalidProtocolBufferException { + switch (type) { + case BTYE_STRING_DECODER: + return parser.parseFrom(bytes, extensions); + case BYTE_ARRAY_DECODER: + return parser.parseFrom(bytes.toByteArray(), extensions); + case ARRAY_BYTE_BUFFER_DECODER: { + ByteBuffer buffer = ByteBuffer.allocate(bytes.size()); + bytes.copyTo(buffer); + buffer.flip(); + try { + return parser.parseFrom(CodedInputStream.newInstance(buffer), extensions); + } catch (InvalidProtocolBufferException e) { + throw e; + } + } + case READONLY_ARRAY_BYTE_BUFFER_DECODER: { + try { + return parser.parseFrom( + CodedInputStream.newInstance(bytes.asReadOnlyByteBuffer()), extensions); + } catch (InvalidProtocolBufferException e) { + throw e; + } + } + case DIRECT_BYTE_BUFFER_DECODER: { + ByteBuffer buffer = ByteBuffer.allocateDirect(bytes.size()); + bytes.copyTo(buffer); + buffer.flip(); + try { + return parser.parseFrom(CodedInputStream.newInstance(buffer), extensions); + } catch (InvalidProtocolBufferException e) { + throw e; + } + } + case READONLY_DIRECT_BYTE_BUFFER_DECODER: { + ByteBuffer buffer = ByteBuffer.allocateDirect(bytes.size()); + bytes.copyTo(buffer); + buffer.flip(); + try { + return parser.parseFrom( + CodedInputStream.newInstance(buffer.asReadOnlyBuffer()), extensions); + } catch (InvalidProtocolBufferException e) { + throw e; + } + } + case INPUT_STREAM_DECODER: { + try { + return parser.parseFrom(bytes.newInput(), extensions); + } catch (InvalidProtocolBufferException e) { + throw e; + } + } + default : + return null; + } + } + } + + private MessageType parseBinary( + ByteString bytes, Parser parser, ExtensionRegistry extensions) + throws InvalidProtocolBufferException { + ArrayList messages = new ArrayList (); + ArrayList exceptions = + new ArrayList (); + + for (int i = 0; i < BinaryDecoderType.values().length; i++) { + messages.add(null); + exceptions.add(null); + } + BinaryDecoder decoder = new BinaryDecoder (); + + boolean hasMessage = false; + boolean hasException = false; + for (int i = 0; i < BinaryDecoderType.values().length; ++i) { + try { + //= BinaryDecoderType.values()[i].parseProto3(bytes); + messages.set(i, decoder.decode(bytes, BinaryDecoderType.values()[i], parser, extensions)); + hasMessage = true; + } catch (InvalidProtocolBufferException e) { + exceptions.set(i, e); + hasException = true; + } + } + + if (hasMessage && hasException) { + StringBuilder sb = + new StringBuilder("Binary decoders disagreed on whether the payload was valid.\n"); + for (int i = 0; i < BinaryDecoderType.values().length; ++i) { + sb.append(BinaryDecoderType.values()[i].name()); + if (messages.get(i) != null) { + sb.append(" accepted the payload.\n"); + } else { + sb.append(" rejected the payload.\n"); + } + } + throw new RuntimeException(sb.toString()); + } + + if (hasException) { + // We do not check if exceptions are equal. Different implementations may return different + // exception messages. Throw an arbitrary one out instead. + throw exceptions.get(0); + } + + // Fast path comparing all the messages with the first message, assuming equality being + // symmetric and transitive. + boolean allEqual = true; + for (int i = 1; i < messages.size(); ++i) { + if (!messages.get(0).equals(messages.get(i))) { + allEqual = false; + break; + } + } + + // Slow path: compare and find out all unequal pairs. + if (!allEqual) { + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < messages.size() - 1; ++i) { + for (int j = i + 1; j < messages.size(); ++j) { + if (!messages.get(i).equals(messages.get(j))) { + sb.append(BinaryDecoderType.values()[i].name()) + .append(" and ") + .append(BinaryDecoderType.values()[j].name()) + .append(" parsed the payload differently.\n"); + } + } + } + throw new RuntimeException(sb.toString()); + } + + return messages.get(0); + } private Conformance.ConformanceResponse doTest(Conformance.ConformanceRequest request) { - Conformance.TestAllTypes testMessage; + com.google.protobuf.AbstractMessage testMessage; + boolean isProto3 = request.getMessageType().equals("protobuf_test_messages.proto3.TestAllTypesProto3"); + boolean isProto2 = request.getMessageType().equals("protobuf_test_messages.proto2.TestAllTypesProto2"); switch (request.getPayloadCase()) { case PROTOBUF_PAYLOAD: { - try { - testMessage = Conformance.TestAllTypes.parseFrom(request.getProtobufPayload()); - } catch (InvalidProtocolBufferException e) { - return Conformance.ConformanceResponse.newBuilder().setParseError(e.getMessage()).build(); + if (isProto3) { + try { + ExtensionRegistry extensions = ExtensionRegistry.newInstance(); + TestMessagesProto3.registerAllExtensions(extensions); + testMessage = parseBinary(request.getProtobufPayload(), TestAllTypesProto3.parser(), extensions); + } catch (InvalidProtocolBufferException e) { + return Conformance.ConformanceResponse.newBuilder().setParseError(e.getMessage()).build(); + } + } else if (isProto2) { + try { + ExtensionRegistry extensions = ExtensionRegistry.newInstance(); + TestMessagesProto2.registerAllExtensions(extensions); + testMessage = parseBinary(request.getProtobufPayload(), TestAllTypesProto2.parser(), extensions); + } catch (InvalidProtocolBufferException e) { + return Conformance.ConformanceResponse.newBuilder().setParseError(e.getMessage()).build(); + } + } else { + throw new RuntimeException("Protobuf request doesn't have specific payload type."); } break; } case JSON_PAYLOAD: { try { - Conformance.TestAllTypes.Builder builder = Conformance.TestAllTypes.newBuilder(); + TestMessagesProto3.TestAllTypesProto3.Builder builder = + TestMessagesProto3.TestAllTypesProto3.newBuilder(); JsonFormat.parser().usingTypeRegistry(typeRegistry) .merge(request.getJsonPayload(), builder); testMessage = builder.build(); @@ -83,8 +256,10 @@ case UNSPECIFIED: throw new RuntimeException("Unspecified output format."); - case PROTOBUF: - return Conformance.ConformanceResponse.newBuilder().setProtobufPayload(testMessage.toByteString()).build(); + case PROTOBUF: { + ByteString MessageString = testMessage.toByteString(); + return Conformance.ConformanceResponse.newBuilder().setProtobufPayload(MessageString).build(); + } case JSON: try { @@ -127,7 +302,7 @@ public void run() throws Exception { typeRegistry = TypeRegistry.newBuilder().add( - Conformance.TestAllTypes.getDescriptor()).build(); + TestMessagesProto3.TestAllTypesProto3.getDescriptor()).build(); while (doTestIo()) { this.testCount++; } diff -Nru protobuf-3.0.0/conformance/conformance_nodejs.js protobuf-3.6.1.3/conformance/conformance_nodejs.js --- protobuf-3.0.0/conformance/conformance_nodejs.js 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/conformance/conformance_nodejs.js 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,182 @@ +#!/usr/bin/env node + +/* + * Protocol Buffers - Google's data interchange format + * Copyright 2008 Google Inc. All rights reserved. + * https://developers.google.com/protocol-buffers/ + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +var conformance = require('conformance_pb'); +var test_messages_proto3 = require('google/protobuf/test_messages_proto3_pb'); +var test_messages_proto2 = require('google/protobuf/test_messages_proto2_pb'); +var fs = require('fs'); + +var testCount = 0; + +function doTest(request) { + var testMessage; + var response = new conformance.ConformanceResponse(); + + try { + if (request.getRequestedOutputFormat() === conformance.WireFormat.JSON) { + response.setSkipped("JSON not supported."); + return response; + } + + switch (request.getPayloadCase()) { + case conformance.ConformanceRequest.PayloadCase.PROTOBUF_PAYLOAD: { + if (request.getMessageType() == "protobuf_test_messages.proto3.TestAllTypesProto3") { + try { + testMessage = test_messages_proto3.TestAllTypesProto3.deserializeBinary( + request.getProtobufPayload()); + } catch (err) { + response.setParseError(err.toString()); + return response; + } + } else if (request.getMessageType() == "protobuf_test_messages.proto2.TestAllTypesProto2"){ + try { + testMessage = test_messages_proto2.TestAllTypesProto2.deserializeBinary( + request.getProtobufPayload()); + } catch (err) { + response.setParseError(err.toString()); + return response; + } + } else { + throw "Protobuf request doesn\'t have specific payload type"; + } + } + + case conformance.ConformanceRequest.PayloadCase.JSON_PAYLOAD: + response.setSkipped("JSON not supported."); + return response; + + case conformance.ConformanceRequest.PayloadCase.PAYLOAD_NOT_SET: + response.setRuntimeError("Request didn't have payload"); + return response; + } + + switch (request.getRequestedOutputFormat()) { + case conformance.WireFormat.UNSPECIFIED: + response.setRuntimeError("Unspecified output format"); + return response; + + case conformance.WireFormat.PROTOBUF: + response.setProtobufPayload(testMessage.serializeBinary()); + + case conformance.WireFormat.JSON: + response.setSkipped("JSON not supported."); + return response; + + default: + throw "Request didn't have requested output format"; + } + } catch (err) { + response.setRuntimeError(err.toString()); + } + + return response; +} + +function onEof(totalRead) { + if (totalRead == 0) { + return undefined; + } else { + throw "conformance_nodejs: premature EOF on stdin."; + } +} + +// Utility function to read a buffer of N bytes. +function readBuffer(bytes) { + var buf = new Buffer(bytes); + var totalRead = 0; + while (totalRead < bytes) { + var read = 0; + try { + read = fs.readSync(process.stdin.fd, buf, totalRead, bytes - totalRead); + } catch (e) { + if (e.code == 'EOF') { + return onEof(totalRead) + } else if (e.code == 'EAGAIN') { + } else { + throw "conformance_nodejs: Error reading from stdin." + e; + } + } + + totalRead += read; + } + + return buf; +} + +function writeBuffer(buffer) { + var totalWritten = 0; + while (totalWritten < buffer.length) { + totalWritten += fs.writeSync( + process.stdout.fd, buffer, totalWritten, buffer.length - totalWritten); + } +} + +// Returns true if the test ran successfully, false on legitimate EOF. +// If EOF is encountered in an unexpected place, raises IOError. +function doTestIo() { + var lengthBuf = readBuffer(4); + if (!lengthBuf) { + return false; + } + + var length = lengthBuf.readInt32LE(0); + var serializedRequest = readBuffer(length); + if (!serializedRequest) { + throw "conformance_nodejs: Failed to read request."; + } + + serializedRequest = new Uint8Array(serializedRequest); + var request = + conformance.ConformanceRequest.deserializeBinary(serializedRequest); + var response = doTest(request); + + var serializedResponse = response.serializeBinary(); + + lengthBuf = new Buffer(4); + lengthBuf.writeInt32LE(serializedResponse.length, 0); + writeBuffer(lengthBuf); + writeBuffer(new Buffer(serializedResponse)); + + testCount += 1 + + return true; +} + +while (true) { + if (!doTestIo()) { + console.error('conformance_nodejs: received EOF from test runner ' + + "after " + testCount + " tests, exiting") + break; + } +} diff -Nru protobuf-3.0.0/conformance/conformance_objc.m protobuf-3.6.1.3/conformance/conformance_objc.m --- protobuf-3.0.0/conformance/conformance_objc.m 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/conformance/conformance_objc.m 2018-12-08 01:32:11.000000000 +0000 @@ -31,6 +31,8 @@ #import #import "Conformance.pbobjc.h" +#import "google/protobuf/TestMessagesProto2.pbobjc.h" +#import "google/protobuf/TestMessagesProto3.pbobjc.h" static void Die(NSString *format, ...) __dead2; @@ -62,7 +64,7 @@ static ConformanceResponse *DoTest(ConformanceRequest *request) { ConformanceResponse *response = [ConformanceResponse message]; - TestAllTypes *testMessage = nil; + GPBMessage *testMessage = nil; switch (request.payloadOneOfCase) { case ConformanceRequest_Payload_OneOfCase_GPBUnsetOneOfCase: @@ -70,9 +72,16 @@ break; case ConformanceRequest_Payload_OneOfCase_ProtobufPayload: { + Class msgClass = nil; + if ([request.messageType isEqual:@"protobuf_test_messages.proto3.TestAllTypesProto3"]) { + msgClass = [Proto3TestAllTypesProto3 class]; + } else if ([request.messageType isEqual:@"protobuf_test_messages.proto2.TestAllTypesProto2"]) { + msgClass = [TestAllTypesProto2 class]; + } else { + Die(@"Protobuf request had an unknown message_type: %@", request.messageType); + } NSError *error = nil; - testMessage = [TestAllTypes parseFromData:request.protobufPayload - error:&error]; + testMessage = [msgClass parseFromData:request.protobufPayload error:&error]; if (!testMessage) { response.parseError = [NSString stringWithFormat:@"Parse error: %@", error]; diff -Nru protobuf-3.0.0/conformance/conformance_php.php protobuf-3.6.1.3/conformance/conformance_php.php --- protobuf-3.0.0/conformance/conformance_php.php 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/conformance/conformance_php.php 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,105 @@ +getPayload() == "protobuf_payload") { + if ($request->getMessageType() == "protobuf_test_messages.proto3.TestAllTypesProto3") { + try { + $test_message->mergeFromString($request->getProtobufPayload()); + } catch (Exception $e) { + $response->setParseError($e->getMessage()); + return $response; + } + } elseif ($request->getMessageType() == "protobuf_test_messages.proto2.TestAllTypesProto2") { + $response->setSkipped("PHP doesn't support proto2"); + return $response; + } else { + trigger_error("Protobuf request doesn't have specific payload type", E_USER_ERROR); + } + } elseif ($request->getPayload() == "json_payload") { + try { + $test_message->mergeFromJsonString($request->getJsonPayload()); + } catch (Exception $e) { + $response->setParseError($e->getMessage()); + return $response; + } + } else { + trigger_error("Request didn't have payload.", E_USER_ERROR); + } + + if ($request->getRequestedOutputFormat() == WireFormat::UNSPECIFIED) { + trigger_error("Unspecified output format.", E_USER_ERROR); + } elseif ($request->getRequestedOutputFormat() == WireFormat::PROTOBUF) { + $response->setProtobufPayload($test_message->serializeToString()); + } elseif ($request->getRequestedOutputFormat() == WireFormat::JSON) { + try { + $response->setJsonPayload($test_message->serializeToJsonString()); + } catch (Exception $e) { + $response->setSerializeError($e->getMessage()); + return $response; + } + } + + return $response; +} + +function doTestIO() +{ + $length_bytes = fread(STDIN, 4); + if (strlen($length_bytes) == 0) { + return false; # EOF + } elseif (strlen($length_bytes) != 4) { + fwrite(STDERR, "I/O error\n"); + return false; + } + + $length = unpack("V", $length_bytes)[1]; + $serialized_request = fread(STDIN, $length); + if (strlen($serialized_request) != $length) { + trigger_error("I/O error", E_USER_ERROR); + } + + $request = new \Conformance\ConformanceRequest(); + $request->mergeFromString($serialized_request); + + $response = doTest($request); + + $serialized_response = $response->serializeToString(); + fwrite(STDOUT, pack("V", strlen($serialized_response))); + fwrite(STDOUT, $serialized_response); + + $GLOBALS['test_count'] += 1; + + return true; +} + +while(true){ + if (!doTestIO()) { + fprintf(STDERR, + "conformance_php: received EOF from test runner " + + "after %d tests, exiting\n", $test_count); + exit; + } +} diff -Nru protobuf-3.0.0/conformance/conformance.proto protobuf-3.6.1.3/conformance/conformance.proto --- protobuf-3.0.0/conformance/conformance.proto 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/conformance/conformance.proto 2018-12-08 01:32:11.000000000 +0000 @@ -32,13 +32,6 @@ package conformance; option java_package = "com.google.protobuf.conformance"; -import "google/protobuf/any.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/struct.proto"; -import "google/protobuf/timestamp.proto"; -import "google/protobuf/wrappers.proto"; - // This defines the conformance testing protocol. This protocol exists between // the conformance test suite itself and the code being tested. For each test, // the suite will send a ConformanceRequest message and expect a @@ -70,8 +63,13 @@ // 2. parse the protobuf or JSON payload in "payload" (which may fail) // 3. if the parse succeeded, serialize the message in the requested format. message ConformanceRequest { - // The payload (whether protobuf of JSON) is always for a TestAllTypes proto - // (see below). + // The payload (whether protobuf of JSON) is always for a + // protobuf_test_messages.proto3.TestAllTypes proto (as defined in + // src/google/protobuf/proto3_test_messages.proto). + // + // TODO(haberman): if/when we expand the conformance tests to support proto2, + // we will want to include a field that lets the payload/response be a + // protobuf_test_messages.proto2.TestAllTypes message instead. oneof payload { bytes protobuf_payload = 1; string json_payload = 2; @@ -79,6 +77,11 @@ // Which format should the testee serialize its message to? WireFormat requested_output_format = 3; + + // The full name for the test message to use; for the moment, either: + // protobuf_test_messages.proto3.TestAllTypesProto3 or + // protobuf_test_messages.proto2.TestAllTypesProto2. + string message_type = 4; } // Represents a single test case's output. @@ -114,160 +117,3 @@ string skipped = 5; } } - -// This proto includes every type of field in both singular and repeated -// forms. -message TestAllTypes { - message NestedMessage { - int32 a = 1; - TestAllTypes corecursive = 2; - } - - enum NestedEnum { - FOO = 0; - BAR = 1; - BAZ = 2; - NEG = -1; // Intentionally negative. - } - - // Singular - int32 optional_int32 = 1; - int64 optional_int64 = 2; - uint32 optional_uint32 = 3; - uint64 optional_uint64 = 4; - sint32 optional_sint32 = 5; - sint64 optional_sint64 = 6; - fixed32 optional_fixed32 = 7; - fixed64 optional_fixed64 = 8; - sfixed32 optional_sfixed32 = 9; - sfixed64 optional_sfixed64 = 10; - float optional_float = 11; - double optional_double = 12; - bool optional_bool = 13; - string optional_string = 14; - bytes optional_bytes = 15; - - NestedMessage optional_nested_message = 18; - ForeignMessage optional_foreign_message = 19; - - NestedEnum optional_nested_enum = 21; - ForeignEnum optional_foreign_enum = 22; - - string optional_string_piece = 24 [ctype=STRING_PIECE]; - string optional_cord = 25 [ctype=CORD]; - - TestAllTypes recursive_message = 27; - - // Repeated - repeated int32 repeated_int32 = 31; - repeated int64 repeated_int64 = 32; - repeated uint32 repeated_uint32 = 33; - repeated uint64 repeated_uint64 = 34; - repeated sint32 repeated_sint32 = 35; - repeated sint64 repeated_sint64 = 36; - repeated fixed32 repeated_fixed32 = 37; - repeated fixed64 repeated_fixed64 = 38; - repeated sfixed32 repeated_sfixed32 = 39; - repeated sfixed64 repeated_sfixed64 = 40; - repeated float repeated_float = 41; - repeated double repeated_double = 42; - repeated bool repeated_bool = 43; - repeated string repeated_string = 44; - repeated bytes repeated_bytes = 45; - - repeated NestedMessage repeated_nested_message = 48; - repeated ForeignMessage repeated_foreign_message = 49; - - repeated NestedEnum repeated_nested_enum = 51; - repeated ForeignEnum repeated_foreign_enum = 52; - - repeated string repeated_string_piece = 54 [ctype=STRING_PIECE]; - repeated string repeated_cord = 55 [ctype=CORD]; - - // Map - map < int32, int32> map_int32_int32 = 56; - map < int64, int64> map_int64_int64 = 57; - map < uint32, uint32> map_uint32_uint32 = 58; - map < uint64, uint64> map_uint64_uint64 = 59; - map < sint32, sint32> map_sint32_sint32 = 60; - map < sint64, sint64> map_sint64_sint64 = 61; - map < fixed32, fixed32> map_fixed32_fixed32 = 62; - map < fixed64, fixed64> map_fixed64_fixed64 = 63; - map map_sfixed32_sfixed32 = 64; - map map_sfixed64_sfixed64 = 65; - map < int32, float> map_int32_float = 66; - map < int32, double> map_int32_double = 67; - map < bool, bool> map_bool_bool = 68; - map < string, string> map_string_string = 69; - map < string, bytes> map_string_bytes = 70; - map < string, NestedMessage> map_string_nested_message = 71; - map < string, ForeignMessage> map_string_foreign_message = 72; - map < string, NestedEnum> map_string_nested_enum = 73; - map < string, ForeignEnum> map_string_foreign_enum = 74; - - oneof oneof_field { - uint32 oneof_uint32 = 111; - NestedMessage oneof_nested_message = 112; - string oneof_string = 113; - bytes oneof_bytes = 114; - } - - // Well-known types - google.protobuf.BoolValue optional_bool_wrapper = 201; - google.protobuf.Int32Value optional_int32_wrapper = 202; - google.protobuf.Int64Value optional_int64_wrapper = 203; - google.protobuf.UInt32Value optional_uint32_wrapper = 204; - google.protobuf.UInt64Value optional_uint64_wrapper = 205; - google.protobuf.FloatValue optional_float_wrapper = 206; - google.protobuf.DoubleValue optional_double_wrapper = 207; - google.protobuf.StringValue optional_string_wrapper = 208; - google.protobuf.BytesValue optional_bytes_wrapper = 209; - - repeated google.protobuf.BoolValue repeated_bool_wrapper = 211; - repeated google.protobuf.Int32Value repeated_int32_wrapper = 212; - repeated google.protobuf.Int64Value repeated_int64_wrapper = 213; - repeated google.protobuf.UInt32Value repeated_uint32_wrapper = 214; - repeated google.protobuf.UInt64Value repeated_uint64_wrapper = 215; - repeated google.protobuf.FloatValue repeated_float_wrapper = 216; - repeated google.protobuf.DoubleValue repeated_double_wrapper = 217; - repeated google.protobuf.StringValue repeated_string_wrapper = 218; - repeated google.protobuf.BytesValue repeated_bytes_wrapper = 219; - - google.protobuf.Duration optional_duration = 301; - google.protobuf.Timestamp optional_timestamp = 302; - google.protobuf.FieldMask optional_field_mask = 303; - google.protobuf.Struct optional_struct = 304; - google.protobuf.Any optional_any = 305; - google.protobuf.Value optional_value = 306; - - repeated google.protobuf.Duration repeated_duration = 311; - repeated google.protobuf.Timestamp repeated_timestamp = 312; - repeated google.protobuf.FieldMask repeated_fieldmask = 313; - repeated google.protobuf.Struct repeated_struct = 324; - repeated google.protobuf.Any repeated_any = 315; - repeated google.protobuf.Value repeated_value = 316; - - // Test field-name-to-JSON-name convention. - int32 fieldname1 = 401; - int32 field_name2 = 402; - int32 _field_name3 = 403; - int32 field__name4_ = 404; - int32 field0name5 = 405; - int32 field_0_name6 = 406; - int32 fieldName7 = 407; - int32 FieldName8 = 408; - int32 field_Name9 = 409; - int32 Field_Name10 = 410; - int32 FIELD_NAME11 = 411; - int32 FIELD_name12 = 412; -} - -message ForeignMessage { - int32 c = 1; -} - -enum ForeignEnum { - FOREIGN_FOO = 0; - FOREIGN_BAR = 1; - FOREIGN_BAZ = 2; -} diff -Nru protobuf-3.0.0/conformance/conformance_python.py protobuf-3.6.1.3/conformance/conformance_python.py --- protobuf-3.0.0/conformance/conformance_python.py 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/conformance/conformance_python.py 2018-12-08 01:32:11.000000000 +0000 @@ -38,8 +38,12 @@ import struct import sys import os -from google.protobuf import message +from google.protobuf import descriptor +from google.protobuf import descriptor_pool from google.protobuf import json_format +from google.protobuf import message +from google.protobuf import test_messages_proto3_pb2 +from google.protobuf import test_messages_proto2_pb2 import conformance_pb2 sys.stdout = os.fdopen(sys.stdout.fileno(), 'wb', 0) @@ -52,9 +56,17 @@ pass def do_test(request): - test_message = conformance_pb2.TestAllTypes() + isProto3 = (request.message_type == "protobuf_test_messages.proto3.TestAllTypesProto3") + isJson = (request.WhichOneof('payload') == 'json_payload') + isProto2 = (request.message_type == "protobuf_test_messages.proto2.TestAllTypesProto2") + + if (not isProto3) and (not isJson) and (not isProto2): + raise ProtocolError("Protobuf request doesn't have specific payload type") + + test_message = test_messages_proto2_pb2.TestAllTypesProto2() if isProto2 else \ + test_messages_proto3_pb2.TestAllTypesProto3() + response = conformance_pb2.ConformanceResponse() - test_message = conformance_pb2.TestAllTypes() try: if request.WhichOneof('payload') == 'protobuf_payload': @@ -62,12 +74,12 @@ test_message.ParseFromString(request.protobuf_payload) except message.DecodeError as e: response.parse_error = str(e) - return response - + return response + elif request.WhichOneof('payload') == 'json_payload': try: json_format.Parse(request.json_payload, test_message) - except json_format.ParseError as e: + except Exception as e: response.parse_error = str(e) return response @@ -81,7 +93,11 @@ response.protobuf_payload = test_message.SerializeToString() elif request.requested_output_format == conformance_pb2.JSON: - response.json_payload = json_format.MessageToJson(test_message) + try: + response.json_payload = json_format.MessageToJson(test_message) + except Exception as e: + response.serialize_error = str(e) + return response except Exception as e: response.runtime_error = str(e) diff -Nru protobuf-3.0.0/conformance/conformance_ruby.rb protobuf-3.6.1.3/conformance/conformance_ruby.rb --- protobuf-3.0.0/conformance/conformance_ruby.rb 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/conformance/conformance_ruby.rb 2018-12-08 01:32:11.000000000 +0000 @@ -31,28 +31,37 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. require 'conformance_pb' +require 'google/protobuf/test_messages_proto3_pb' $test_count = 0 $verbose = false def do_test(request) - test_message = Conformance::TestAllTypes.new + test_message = ProtobufTestMessages::Proto3::TestAllTypesProto3.new response = Conformance::ConformanceResponse.new begin case request.payload when :protobuf_payload - begin - test_message = - Conformance::TestAllTypes.decode(request.protobuf_payload) - rescue Google::Protobuf::ParseError => err - response.parse_error = err.message.encode('utf-8') + if request.message_type.eql?('protobuf_test_messages.proto3.TestAllTypesProto3') + begin + test_message = ProtobufTestMessages::Proto3::TestAllTypesProto3.decode( + request.protobuf_payload) + rescue Google::Protobuf::ParseError => err + response.parse_error = err.message.encode('utf-8') + return response + end + elsif request.message_type.eql?('protobuf_test_messages.proto2.TestAllTypesProto2') + response.skipped = "Ruby doesn't support proto2" return response + else + fail "Protobuf request doesn't have specific payload type" end when :json_payload begin - test_message = Conformance::TestAllTypes.decode_json(request.json_payload) + test_message = ProtobufTestMessages::Proto3::TestAllTypesProto3.decode_json( + request.json_payload) rescue Google::Protobuf::ParseError => err response.parse_error = err.message.encode('utf-8') return response diff -Nru protobuf-3.0.0/conformance/conformance_test.cc protobuf-3.6.1.3/conformance/conformance_test.cc --- protobuf-3.0.0/conformance/conformance_test.cc 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/conformance/conformance_test.cc 2018-12-08 01:32:11.000000000 +0000 @@ -34,11 +34,14 @@ #include "conformance.pb.h" #include "conformance_test.h" +#include +#include + #include #include #include -#include #include +#include #include #include #include @@ -47,7 +50,6 @@ using conformance::ConformanceRequest; using conformance::ConformanceResponse; -using conformance::TestAllTypes; using conformance::WireFormat; using google::protobuf::Descriptor; using google::protobuf::FieldDescriptor; @@ -58,6 +60,8 @@ using google::protobuf::util::MessageDifferencer; using google::protobuf::util::NewTypeResolverForDescriptorPool; using google::protobuf::util::Status; +using protobuf_test_messages::proto3::TestAllTypesProto3; +using protobuf_test_messages::proto2::TestAllTypesProto2; using std::string; namespace { @@ -107,13 +111,18 @@ // The maximum number of bytes that it takes to encode a 64-bit varint. #define VARINT_MAX_LEN 10 -size_t vencode64(uint64_t val, char *buf) { +size_t vencode64(uint64_t val, int over_encoded_bytes, char *buf) { if (val == 0) { buf[0] = 0; return 1; } size_t i = 0; while (val) { uint8_t byte = val & 0x7fU; val >>= 7; - if (val) byte |= 0x80U; + if (val || over_encoded_bytes) byte |= 0x80U; + buf[i++] = byte; + } + while (over_encoded_bytes--) { + assert(i < 10); + uint8_t byte = over_encoded_bytes ? 0x80 : 0; buf[i++] = byte; } return i; @@ -121,7 +130,15 @@ string varint(uint64_t x) { char buf[VARINT_MAX_LEN]; - size_t len = vencode64(x, buf); + size_t len = vencode64(x, 0, buf); + return string(buf, len); +} + +// Encodes a varint that is |extra| bytes longer than it needs to be, but still +// valid. +string longvarint(uint64_t x, int extra) { + char buf[VARINT_MAX_LEN]; + size_t len = vencode64(x, extra, buf); return string(buf, len); } @@ -130,8 +147,8 @@ string fixed64(void *data) { return string(static_cast(data), 8); } string delim(const string& buf) { return cat(varint(buf.size()), buf); } -string uint32(uint32_t u32) { return fixed32(&u32); } -string uint64(uint64_t u64) { return fixed64(&u64); } +string u32(uint32_t u32) { return fixed32(&u32); } +string u64(uint64_t u64) { return fixed64(&u64); } string flt(float f) { return fixed32(&f); } string dbl(double d) { return fixed64(&d); } string zz32(int32_t x) { return varint(WireFormatLite::ZigZagEncode32(x)); } @@ -147,16 +164,19 @@ #define UNKNOWN_FIELD 666 -uint32_t GetFieldNumberForType(FieldDescriptor::Type type, bool repeated) { - const Descriptor* d = TestAllTypes().GetDescriptor(); +const FieldDescriptor* GetFieldForType(FieldDescriptor::Type type, + bool repeated, bool isProto3) { + + const Descriptor* d = isProto3 ? + TestAllTypesProto3().GetDescriptor() : TestAllTypesProto2().GetDescriptor(); for (int i = 0; i < d->field_count(); i++) { const FieldDescriptor* f = d->field(i); if (f->type() == type && f->is_repeated() == repeated) { - return f->number(); + return f; } } GOOGLE_LOG(FATAL) << "Couldn't find field with type " << (int)type; - return 0; + return nullptr; } string UpperCase(string str) { @@ -183,6 +203,7 @@ } void ConformanceTestSuite::ReportFailure(const string& test_name, + ConformanceLevel level, const ConformanceRequest& request, const ConformanceResponse& response, const char* fmt, ...) { @@ -190,6 +211,8 @@ expected_failures_++; if (!verbose_) return; + } else if (level == RECOMMENDED && !enforce_recommended_) { + StringAppendF(&output_, "WARNING, test=%s: ", test_name.c_str()); } else { StringAppendF(&output_, "ERROR, test=%s: ", test_name.c_str()); unexpected_failing_tests_.insert(test_name); @@ -214,6 +237,15 @@ skipped_.insert(test_name); } +string ConformanceTestSuite::ConformanceLevelToString(ConformanceLevel level) { + switch (level) { + case REQUIRED: return "Required"; + case RECOMMENDED: return "Recommended"; + } + GOOGLE_LOG(FATAL) << "Unknown value: " << level; + return ""; +} + void ConformanceTestSuite::RunTest(const string& test_name, const ConformanceRequest& request, ConformanceResponse* response) { @@ -241,25 +273,65 @@ } void ConformanceTestSuite::RunValidInputTest( - const string& test_name, const string& input, WireFormat input_format, - const string& equivalent_text_format, WireFormat requested_output) { - TestAllTypes reference_message; + const string& test_name, ConformanceLevel level, const string& input, + WireFormat input_format, const string& equivalent_text_format, + WireFormat requested_output, bool isProto3) { + auto newTestMessage = [&isProto3]() { + Message* newMessage; + if (isProto3) { + newMessage = new TestAllTypesProto3; + } else { + newMessage = new TestAllTypesProto2; + } + return newMessage; + }; + Message* reference_message = newTestMessage(); GOOGLE_CHECK( - TextFormat::ParseFromString(equivalent_text_format, &reference_message)) + TextFormat::ParseFromString(equivalent_text_format, reference_message)) << "Failed to parse data for test case: " << test_name << ", data: " << equivalent_text_format; + const string equivalent_wire_format = reference_message->SerializeAsString(); + RunValidBinaryInputTest(test_name, level, input, input_format, + equivalent_wire_format, requested_output, isProto3); +} + +void ConformanceTestSuite::RunValidBinaryInputTest( + const string& test_name, ConformanceLevel level, const string& input, + WireFormat input_format, const string& equivalent_wire_format, + WireFormat requested_output, bool isProto3) { + auto newTestMessage = [&isProto3]() { + Message* newMessage; + if (isProto3) { + newMessage = new TestAllTypesProto3; + } else { + newMessage = new TestAllTypesProto2; + } + return newMessage; + }; + Message* reference_message = newTestMessage(); + GOOGLE_CHECK( + reference_message->ParseFromString(equivalent_wire_format)) + << "Failed to parse wire data for test case: " << test_name; ConformanceRequest request; ConformanceResponse response; switch (input_format) { - case conformance::PROTOBUF: + case conformance::PROTOBUF: { request.set_protobuf_payload(input); + if (isProto3) { + request.set_message_type("protobuf_test_messages.proto3.TestAllTypesProto3"); + } else { + request.set_message_type("protobuf_test_messages.proto2.TestAllTypesProto2"); + } break; + } - case conformance::JSON: + case conformance::JSON: { + request.set_message_type("protobuf_test_messages.proto3.TestAllTypesProto3"); request.set_json_payload(input); break; + } default: GOOGLE_LOG(FATAL) << "Unspecified input format"; @@ -269,14 +341,19 @@ RunTest(test_name, request, &response); - TestAllTypes test_message; + Message *test_message = newTestMessage(); switch (response.result_case()) { + case ConformanceResponse::RESULT_NOT_SET: + ReportFailure(test_name, level, request, response, + "Response didn't have any field in the Response."); + return; + case ConformanceResponse::kParseError: case ConformanceResponse::kRuntimeError: case ConformanceResponse::kSerializeError: - ReportFailure(test_name, request, response, - "Failed to parse JSON input or produce JSON output."); + ReportFailure(test_name, level, request, response, + "Failed to parse input or produce output."); return; case ConformanceResponse::kSkipped: @@ -286,7 +363,7 @@ case ConformanceResponse::kJsonPayload: { if (requested_output != conformance::JSON) { ReportFailure( - test_name, request, response, + test_name, level, request, response, "Test was asked for protobuf output but provided JSON instead."); return; } @@ -295,15 +372,15 @@ JsonToBinaryString(type_resolver_.get(), type_url_, response.json_payload(), &binary_protobuf); if (!status.ok()) { - ReportFailure(test_name, request, response, + ReportFailure(test_name, level, request, response, "JSON output we received from test was unparseable."); return; } - if (!test_message.ParseFromString(binary_protobuf)) { - ReportFailure(test_name, request, response, - "INTERNAL ERROR: internal JSON->protobuf transcode " - "yielded unparseable proto."); + if (!test_message->ParseFromString(binary_protobuf)) { + ReportFailure(test_name, level, request, response, + "INTERNAL ERROR: internal JSON->protobuf transcode " + "yielded unparseable proto."); return; } @@ -313,14 +390,14 @@ case ConformanceResponse::kProtobufPayload: { if (requested_output != conformance::PROTOBUF) { ReportFailure( - test_name, request, response, + test_name, level, request, response, "Test was asked for JSON output but provided protobuf instead."); return; } - if (!test_message.ParseFromString(response.protobuf_payload())) { - ReportFailure(test_name, request, response, - "Protobuf output we received from test was unparseable."); + if (!test_message->ParseFromString(response.protobuf_payload())) { + ReportFailure(test_name, level, request, response, + "Protobuf output we received from test was unparseable."); return; } @@ -339,22 +416,30 @@ string differences; differencer.ReportDifferencesToString(&differences); - if (differencer.Compare(reference_message, test_message)) { + bool check; + check = differencer.Compare(*reference_message, *test_message); + if (check) { ReportSuccess(test_name); } else { - ReportFailure(test_name, request, response, + ReportFailure(test_name, level, request, response, "Output was not equivalent to reference message: %s.", differences.c_str()); } } - -// Expect that this precise protobuf will cause a parse error. -void ConformanceTestSuite::ExpectParseFailureForProto( - const string& proto, const string& test_name) { +void ConformanceTestSuite::ExpectParseFailureForProtoWithProtoVersion ( + const string& proto, const string& test_name, ConformanceLevel level, + bool isProto3) { ConformanceRequest request; ConformanceResponse response; request.set_protobuf_payload(proto); - string effective_test_name = "ProtobufInput." + test_name; + if (isProto3) { + request.set_message_type("protobuf_test_messages.proto3.TestAllTypesProto3"); + } else { + request.set_message_type("protobuf_test_messages.proto2.TestAllTypesProto2"); + } + string effective_test_name = ConformanceLevelToString(level) + + (isProto3 ? ".Proto3" : ".Proto2") + + ".ProtobufInput." + test_name; // We don't expect output, but if the program erroneously accepts the protobuf // we let it send its response as this. We must not leave it unspecified. @@ -366,38 +451,87 @@ } else if (response.result_case() == ConformanceResponse::kSkipped) { ReportSkip(effective_test_name, request, response); } else { - ReportFailure(effective_test_name, request, response, + ReportFailure(effective_test_name, level, request, response, "Should have failed to parse, but didn't."); } } +// Expect that this precise protobuf will cause a parse error. +void ConformanceTestSuite::ExpectParseFailureForProto( + const string& proto, const string& test_name, ConformanceLevel level) { + ExpectParseFailureForProtoWithProtoVersion(proto, test_name, level, true); + ExpectParseFailureForProtoWithProtoVersion(proto, test_name, level, false); +} + // Expect that this protobuf will cause a parse error, even if it is followed // by valid protobuf data. We can try running this twice: once with this // data verbatim and once with this data followed by some valid data. // // TODO(haberman): implement the second of these. void ConformanceTestSuite::ExpectHardParseFailureForProto( - const string& proto, const string& test_name) { - return ExpectParseFailureForProto(proto, test_name); + const string& proto, const string& test_name, ConformanceLevel level) { + return ExpectParseFailureForProto(proto, test_name, level); } void ConformanceTestSuite::RunValidJsonTest( - const string& test_name, const string& input_json, + const string& test_name, ConformanceLevel level, const string& input_json, const string& equivalent_text_format) { - RunValidInputTest("JsonInput." + test_name + ".ProtobufOutput", input_json, - conformance::JSON, equivalent_text_format, - conformance::PROTOBUF); - RunValidInputTest("JsonInput." + test_name + ".JsonOutput", input_json, - conformance::JSON, equivalent_text_format, - conformance::JSON); + RunValidInputTest( + ConformanceLevelToString(level) + ".Proto3.JsonInput." + test_name + + ".ProtobufOutput", level, input_json, conformance::JSON, + equivalent_text_format, conformance::PROTOBUF, true); + RunValidInputTest( + ConformanceLevelToString(level) + ".Proto3.JsonInput." + test_name + + ".JsonOutput", level, input_json, conformance::JSON, + equivalent_text_format, conformance::JSON, true); } void ConformanceTestSuite::RunValidJsonTestWithProtobufInput( - const string& test_name, const TestAllTypes& input, + const string& test_name, ConformanceLevel level, const TestAllTypesProto3& input, const string& equivalent_text_format) { - RunValidInputTest("ProtobufInput." + test_name + ".JsonOutput", - input.SerializeAsString(), conformance::PROTOBUF, - equivalent_text_format, conformance::JSON); + RunValidInputTest( + ConformanceLevelToString(level) + ".Proto3" + ".ProtobufInput." + test_name + + ".JsonOutput", level, input.SerializeAsString(), conformance::PROTOBUF, + equivalent_text_format, conformance::JSON, true); +} + +void ConformanceTestSuite::RunValidProtobufTest( + const string& test_name, ConformanceLevel level, + const string& input_protobuf, const string& equivalent_text_format, + bool isProto3) { + string rname = ".Proto3"; + if (!isProto3) { + rname = ".Proto2"; + } + RunValidInputTest( + ConformanceLevelToString(level) + rname + ".ProtobufInput." + test_name + + ".ProtobufOutput", level, input_protobuf, conformance::PROTOBUF, + equivalent_text_format, conformance::PROTOBUF, isProto3); + if (isProto3) { + RunValidInputTest( + ConformanceLevelToString(level) + rname + ".ProtobufInput." + test_name + + ".JsonOutput", level, input_protobuf, conformance::PROTOBUF, + equivalent_text_format, conformance::JSON, isProto3); + } +} + +void ConformanceTestSuite::RunValidBinaryProtobufTest( + const string& test_name, ConformanceLevel level, + const string& input_protobuf, bool isProto3) { + string rname = ".Proto3"; + if (!isProto3) { + rname = ".Proto2"; + } + RunValidBinaryInputTest( + ConformanceLevelToString(level) + rname + ".ProtobufInput." + test_name + + ".ProtobufOutput", level, input_protobuf, conformance::PROTOBUF, + input_protobuf, conformance::PROTOBUF, isProto3); +} + +void ConformanceTestSuite::RunValidProtobufTestWithMessage( + const string& test_name, ConformanceLevel level, const Message *input, + const string& equivalent_text_format, bool isProto3) { + RunValidProtobufTest(test_name, level, input->SerializeAsString(), equivalent_text_format, isProto3); } // According to proto3 JSON specification, JSON serializers follow more strict @@ -406,14 +540,16 @@ // method allows strict checking on a proto3 JSON serializer by inspecting // the JSON output directly. void ConformanceTestSuite::RunValidJsonTestWithValidator( - const string& test_name, const string& input_json, + const string& test_name, ConformanceLevel level, const string& input_json, const Validator& validator) { ConformanceRequest request; ConformanceResponse response; request.set_json_payload(input_json); request.set_requested_output_format(conformance::JSON); + request.set_message_type("protobuf_test_messages.proto3.TestAllTypesProto3"); - string effective_test_name = "JsonInput." + test_name + ".Validator"; + string effective_test_name = ConformanceLevelToString(level) + + ".Proto3.JsonInput." + test_name + ".Validator"; RunTest(effective_test_name, request, &response); @@ -423,7 +559,7 @@ } if (response.result_case() != ConformanceResponse::kJsonPayload) { - ReportFailure(effective_test_name, request, response, + ReportFailure(effective_test_name, level, request, response, "Expected JSON payload but got type %d.", response.result_case()); return; @@ -431,13 +567,13 @@ Json::Reader reader; Json::Value value; if (!reader.parse(response.json_payload(), value)) { - ReportFailure(effective_test_name, request, response, + ReportFailure(effective_test_name, level, request, response, "JSON payload cannot be parsed as valid JSON: %s", reader.getFormattedErrorMessages().c_str()); return; } if (!validator(value)) { - ReportFailure(effective_test_name, request, response, + ReportFailure(effective_test_name, level, request, response, "JSON payload validation failed."); return; } @@ -445,11 +581,13 @@ } void ConformanceTestSuite::ExpectParseFailureForJson( - const string& test_name, const string& input_json) { + const string& test_name, ConformanceLevel level, const string& input_json) { ConformanceRequest request; ConformanceResponse response; request.set_json_payload(input_json); - string effective_test_name = "JsonInput." + test_name; + request.set_message_type("protobuf_test_messages.proto3.TestAllTypesProto3"); + string effective_test_name = + ConformanceLevelToString(level) + ".Proto3.JsonInput." + test_name; // We don't expect output, but if the program erroneously accepts the protobuf // we let it send its response as this. We must not leave it unspecified. @@ -461,14 +599,14 @@ } else if (response.result_case() == ConformanceResponse::kSkipped) { ReportSkip(effective_test_name, request, response); } else { - ReportFailure(effective_test_name, request, response, + ReportFailure(effective_test_name, level, request, response, "Should have failed to parse, but didn't."); } } void ConformanceTestSuite::ExpectSerializeFailureForJson( - const string& test_name, const string& text_format) { - TestAllTypes payload_message; + const string& test_name, ConformanceLevel level, const string& text_format) { + TestAllTypesProto3 payload_message; GOOGLE_CHECK( TextFormat::ParseFromString(text_format, &payload_message)) << "Failed to parse: " << text_format; @@ -476,7 +614,9 @@ ConformanceRequest request; ConformanceResponse response; request.set_protobuf_payload(payload_message.SerializeAsString()); - string effective_test_name = test_name + ".JsonOutput"; + request.set_message_type("protobuf_test_messages.proto3.TestAllTypesProto3"); + string effective_test_name = + ConformanceLevelToString(level) + "." + test_name + ".JsonOutput"; request.set_requested_output_format(conformance::JSON); RunTest(effective_test_name, request, &response); @@ -485,11 +625,12 @@ } else if (response.result_case() == ConformanceResponse::kSkipped) { ReportSkip(effective_test_name, request, response); } else { - ReportFailure(effective_test_name, request, response, + ReportFailure(effective_test_name, level, request, response, "Should have failed to serialize, but didn't."); } } +//TODO: proto2? void ConformanceTestSuite::TestPrematureEOFForType(FieldDescriptor::Type type) { // Incomplete values for each wire type. static const string incompletes[6] = { @@ -501,8 +642,8 @@ string("abc") // 32BIT }; - uint32_t fieldnum = GetFieldNumberForType(type, false); - uint32_t rep_fieldnum = GetFieldNumberForType(type, true); + const FieldDescriptor* field = GetFieldForType(type, false, true); + const FieldDescriptor* rep_field = GetFieldForType(type, true, true); WireFormatLite::WireType wire_type = WireFormatLite::WireTypeForFieldType( static_cast(type)); const string& incomplete = incompletes[wire_type]; @@ -510,42 +651,44 @@ UpperCase(string(".") + FieldDescriptor::TypeName(type)); ExpectParseFailureForProto( - tag(fieldnum, wire_type), - "PrematureEofBeforeKnownNonRepeatedValue" + type_name); + tag(field->number(), wire_type), + "PrematureEofBeforeKnownNonRepeatedValue" + type_name, REQUIRED); ExpectParseFailureForProto( - tag(rep_fieldnum, wire_type), - "PrematureEofBeforeKnownRepeatedValue" + type_name); + tag(rep_field->number(), wire_type), + "PrematureEofBeforeKnownRepeatedValue" + type_name, REQUIRED); ExpectParseFailureForProto( tag(UNKNOWN_FIELD, wire_type), - "PrematureEofBeforeUnknownValue" + type_name); + "PrematureEofBeforeUnknownValue" + type_name, REQUIRED); ExpectParseFailureForProto( - cat( tag(fieldnum, wire_type), incomplete ), - "PrematureEofInsideKnownNonRepeatedValue" + type_name); + cat( tag(field->number(), wire_type), incomplete ), + "PrematureEofInsideKnownNonRepeatedValue" + type_name, REQUIRED); ExpectParseFailureForProto( - cat( tag(rep_fieldnum, wire_type), incomplete ), - "PrematureEofInsideKnownRepeatedValue" + type_name); + cat( tag(rep_field->number(), wire_type), incomplete ), + "PrematureEofInsideKnownRepeatedValue" + type_name, REQUIRED); ExpectParseFailureForProto( cat( tag(UNKNOWN_FIELD, wire_type), incomplete ), - "PrematureEofInsideUnknownValue" + type_name); + "PrematureEofInsideUnknownValue" + type_name, REQUIRED); if (wire_type == WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { ExpectParseFailureForProto( - cat( tag(fieldnum, wire_type), varint(1) ), - "PrematureEofInDelimitedDataForKnownNonRepeatedValue" + type_name); + cat( tag(field->number(), wire_type), varint(1) ), + "PrematureEofInDelimitedDataForKnownNonRepeatedValue" + type_name, + REQUIRED); ExpectParseFailureForProto( - cat( tag(rep_fieldnum, wire_type), varint(1) ), - "PrematureEofInDelimitedDataForKnownRepeatedValue" + type_name); + cat( tag(rep_field->number(), wire_type), varint(1) ), + "PrematureEofInDelimitedDataForKnownRepeatedValue" + type_name, + REQUIRED); // EOF in the middle of delimited data for unknown value. ExpectParseFailureForProto( cat( tag(UNKNOWN_FIELD, wire_type), varint(1) ), - "PrematureEofInDelimitedDataForUnknownValue" + type_name); + "PrematureEofInDelimitedDataForUnknownValue" + type_name, REQUIRED); if (type == FieldDescriptor::TYPE_MESSAGE) { // Submessage ends in the middle of a value. @@ -553,38 +696,72 @@ cat( tag(WireFormatLite::TYPE_INT32, WireFormatLite::WIRETYPE_VARINT), incompletes[WireFormatLite::WIRETYPE_VARINT] ); ExpectHardParseFailureForProto( - cat( tag(fieldnum, WireFormatLite::WIRETYPE_LENGTH_DELIMITED), + cat( tag(field->number(), WireFormatLite::WIRETYPE_LENGTH_DELIMITED), varint(incomplete_submsg.size()), incomplete_submsg ), - "PrematureEofInSubmessageValue" + type_name); + "PrematureEofInSubmessageValue" + type_name, REQUIRED); } } else if (type != FieldDescriptor::TYPE_GROUP) { // Non-delimited, non-group: eligible for packing. // Packed region ends in the middle of a value. ExpectHardParseFailureForProto( - cat( tag(rep_fieldnum, WireFormatLite::WIRETYPE_LENGTH_DELIMITED), - varint(incomplete.size()), - incomplete ), - "PrematureEofInPackedFieldValue" + type_name); + cat(tag(rep_field->number(), WireFormatLite::WIRETYPE_LENGTH_DELIMITED), + varint(incomplete.size()), incomplete), + "PrematureEofInPackedFieldValue" + type_name, REQUIRED); // EOF in the middle of packed region. ExpectParseFailureForProto( - cat( tag(rep_fieldnum, WireFormatLite::WIRETYPE_LENGTH_DELIMITED), - varint(1) ), - "PrematureEofInPackedField" + type_name); + cat(tag(rep_field->number(), WireFormatLite::WIRETYPE_LENGTH_DELIMITED), + varint(1)), + "PrematureEofInPackedField" + type_name, REQUIRED); + } +} + +void ConformanceTestSuite::TestValidDataForType( + FieldDescriptor::Type type, + std::vector> values) { + for (int isProto3 = 0; isProto3 < 2; isProto3++) { + const string type_name = + UpperCase(string(".") + FieldDescriptor::TypeName(type)); + WireFormatLite::WireType wire_type = WireFormatLite::WireTypeForFieldType( + static_cast(type)); + const FieldDescriptor* field = GetFieldForType(type, false, isProto3); + const FieldDescriptor* rep_field = GetFieldForType(type, true, isProto3); + + RunValidProtobufTest("ValidDataScalar" + type_name, REQUIRED, + cat(tag(field->number(), wire_type), values[0].first), + field->name() + ": " + values[0].second, isProto3); + + string proto; + string text = field->name() + ": " + values.back().second; + for (size_t i = 0; i < values.size(); i++) { + proto += cat(tag(field->number(), wire_type), values[i].first); + } + RunValidProtobufTest("RepeatedScalarSelectsLast" + type_name, REQUIRED, + proto, text, isProto3); + + proto.clear(); + text.clear(); + + for (size_t i = 0; i < values.size(); i++) { + proto += cat(tag(rep_field->number(), wire_type), values[i].first); + text += rep_field->name() + ": " + values[i].second + " "; + } + RunValidProtobufTest("ValidDataRepeated" + type_name, REQUIRED, + proto, text, isProto3); } } void ConformanceTestSuite::SetFailureList(const string& filename, - const vector& failure_list) { + const std::vector& failure_list) { failure_list_filename_ = filename; expected_to_fail_.clear(); std::copy(failure_list.begin(), failure_list.end(), std::inserter(expected_to_fail_, expected_to_fail_.end())); } -bool ConformanceTestSuite::CheckSetEmpty(const set& set_to_check, +bool ConformanceTestSuite::CheckSetEmpty(const std::set& set_to_check, const std::string& write_to_file, const std::string& msg) { if (set_to_check.empty()) { @@ -592,7 +769,7 @@ } else { StringAppendF(&output_, "\n"); StringAppendF(&output_, "%s\n\n", msg.c_str()); - for (set::const_iterator iter = set_to_check.begin(); + for (std::set::const_iterator iter = set_to_check.begin(); iter != set_to_check.end(); ++iter) { StringAppendF(&output_, " %s\n", iter->c_str()); } @@ -601,7 +778,7 @@ if (!write_to_file.empty()) { std::ofstream os(write_to_file); if (os) { - for (set::const_iterator iter = set_to_check.begin(); + for (std::set::const_iterator iter = set_to_check.begin(); iter != set_to_check.end(); ++iter) { os << *iter << "\n"; } @@ -615,6 +792,68 @@ } } +// TODO: proto2? +void ConformanceTestSuite::TestIllegalTags() { + // field num 0 is illegal + string nullfield[] = { + "\1DEADBEEF", + "\2\1\1", + "\3\4", + "\5DEAD" + }; + for (int i = 0; i < 4; i++) { + string name = "IllegalZeroFieldNum_Case_0"; + name.back() += i; + ExpectParseFailureForProto(nullfield[i], name, REQUIRED); + } +} +template +void ConformanceTestSuite::TestOneofMessage (MessageType &message, + bool isProto3) { + message.set_oneof_uint32(0); + RunValidProtobufTestWithMessage( + "OneofZeroUint32", RECOMMENDED, &message, "oneof_uint32: 0", isProto3); + message.mutable_oneof_nested_message()->set_a(0); + RunValidProtobufTestWithMessage( + "OneofZeroMessage", RECOMMENDED, &message, + isProto3 ? "oneof_nested_message: {}" : "oneof_nested_message: {a: 0}", + isProto3); + message.mutable_oneof_nested_message()->set_a(1); + RunValidProtobufTestWithMessage( + "OneofZeroMessageSetTwice", RECOMMENDED, &message, + "oneof_nested_message: {a: 1}", + isProto3); + message.set_oneof_string(""); + RunValidProtobufTestWithMessage( + "OneofZeroString", RECOMMENDED, &message, "oneof_string: \"\"", isProto3); + message.set_oneof_bytes(""); + RunValidProtobufTestWithMessage( + "OneofZeroBytes", RECOMMENDED, &message, "oneof_bytes: \"\"", isProto3); + message.set_oneof_bool(false); + RunValidProtobufTestWithMessage( + "OneofZeroBool", RECOMMENDED, &message, "oneof_bool: false", isProto3); + message.set_oneof_uint64(0); + RunValidProtobufTestWithMessage( + "OneofZeroUint64", RECOMMENDED, &message, "oneof_uint64: 0", isProto3); + message.set_oneof_float(0.0f); + RunValidProtobufTestWithMessage( + "OneofZeroFloat", RECOMMENDED, &message, "oneof_float: 0", isProto3); + message.set_oneof_double(0.0); + RunValidProtobufTestWithMessage( + "OneofZeroDouble", RECOMMENDED, &message, "oneof_double: 0", isProto3); + message.set_oneof_enum(MessageType::FOO); + RunValidProtobufTestWithMessage( + "OneofZeroEnum", RECOMMENDED, &message, "oneof_enum: FOO", isProto3); +} + +template +void ConformanceTestSuite::TestUnknownMessage(MessageType& message, + bool isProto3) { + message.ParseFromString("\xA8\x1F\x01"); + RunValidBinaryProtobufTest("UnknownVarint", REQUIRED, + message.SerializeAsString(), isProto3); +} + bool ConformanceTestSuite::RunSuite(ConformanceTestRunner* runner, std::string* output) { runner_ = runner; @@ -626,7 +865,7 @@ unexpected_succeeding_tests_.clear(); type_resolver_.reset(NewTypeResolverForDescriptorPool( kTypeUrlPrefix, DescriptorPool::generated_pool())); - type_url_ = GetTypeUrl(TestAllTypes::descriptor()); + type_url_ = GetTypeUrl(TestAllTypesProto3::descriptor()); output_ = "\nCONFORMANCE TEST BEGIN ====================================\n\n"; @@ -635,24 +874,122 @@ TestPrematureEOFForType(static_cast(i)); } - RunValidJsonTest("HelloWorld", "{\"optionalString\":\"Hello, World!\"}", + TestIllegalTags(); + + int64 kInt64Min = -9223372036854775808ULL; + int64 kInt64Max = 9223372036854775807ULL; + uint64 kUint64Max = 18446744073709551615ULL; + int32 kInt32Max = 2147483647; + int32 kInt32Min = -2147483648; + uint32 kUint32Max = 4294967295UL; + + TestValidDataForType(FieldDescriptor::TYPE_DOUBLE, { + {dbl(0.1), "0.1"}, + {dbl(1.7976931348623157e+308), "1.7976931348623157e+308"}, + {dbl(2.22507385850720138309e-308), "2.22507385850720138309e-308"} + }); + TestValidDataForType(FieldDescriptor::TYPE_FLOAT, { + {flt(0.1), "0.1"}, + {flt(1.00000075e-36), "1.00000075e-36"}, + {flt(3.402823e+38), "3.402823e+38"}, // 3.40282347e+38 + {flt(1.17549435e-38f), "1.17549435e-38"} + }); + TestValidDataForType(FieldDescriptor::TYPE_INT64, { + {varint(12345), "12345"}, + {varint(kInt64Max), std::to_string(kInt64Max)}, + {varint(kInt64Min), std::to_string(kInt64Min)} + }); + TestValidDataForType(FieldDescriptor::TYPE_UINT64, { + {varint(12345), "12345"}, + {varint(kUint64Max), std::to_string(kUint64Max)}, + {varint(0), "0"} + }); + TestValidDataForType(FieldDescriptor::TYPE_INT32, { + {varint(12345), "12345"}, + {longvarint(12345, 2), "12345"}, + {longvarint(12345, 7), "12345"}, + {varint(kInt32Max), std::to_string(kInt32Max)}, + {varint(kInt32Min), std::to_string(kInt32Min)}, + {varint(1LL << 33), std::to_string(static_cast(1LL << 33))}, + {varint((1LL << 33) - 1), + std::to_string(static_cast((1LL << 33) - 1))}, + }); + TestValidDataForType(FieldDescriptor::TYPE_UINT32, { + {varint(12345), "12345"}, + {longvarint(12345, 2), "12345"}, + {longvarint(12345, 7), "12345"}, + {varint(kUint32Max), std::to_string(kUint32Max)}, // UINT32_MAX + {varint(0), "0"}, + {varint(1LL << 33), std::to_string(static_cast(1LL << 33))}, + {varint((1LL << 33) - 1), + std::to_string(static_cast((1LL << 33) - 1))}, + }); + TestValidDataForType(FieldDescriptor::TYPE_FIXED64, { + {u64(12345), "12345"}, + {u64(kUint64Max), std::to_string(kUint64Max)}, + {u64(0), "0"} + }); + TestValidDataForType(FieldDescriptor::TYPE_FIXED32, { + {u32(12345), "12345"}, + {u32(kUint32Max), std::to_string(kUint32Max)}, // UINT32_MAX + {u32(0), "0"} + }); + TestValidDataForType(FieldDescriptor::TYPE_SFIXED64, { + {u64(12345), "12345"}, + {u64(kInt64Max), std::to_string(kInt64Max)}, + {u64(kInt64Min), std::to_string(kInt64Min)} + }); + TestValidDataForType(FieldDescriptor::TYPE_SFIXED32, { + {u32(12345), "12345"}, + {u32(kInt32Max), std::to_string(kInt32Max)}, + {u32(kInt32Min), std::to_string(kInt32Min)} + }); + TestValidDataForType(FieldDescriptor::TYPE_BOOL, { + {varint(1), "true"}, + {varint(0), "false"}, + {varint(12345678), "true"} + }); + TestValidDataForType(FieldDescriptor::TYPE_SINT32, { + {zz32(12345), "12345"}, + {zz32(kInt32Max), std::to_string(kInt32Max)}, + {zz32(kInt32Min), std::to_string(kInt32Min)} + }); + TestValidDataForType(FieldDescriptor::TYPE_SINT64, { + {zz64(12345), "12345"}, + {zz64(kInt64Max), std::to_string(kInt64Max)}, + {zz64(kInt64Min), std::to_string(kInt64Min)} + }); + + // TODO(haberman): + // TestValidDataForType(FieldDescriptor::TYPE_STRING + // TestValidDataForType(FieldDescriptor::TYPE_GROUP + // TestValidDataForType(FieldDescriptor::TYPE_MESSAGE + // TestValidDataForType(FieldDescriptor::TYPE_BYTES + // TestValidDataForType(FieldDescriptor::TYPE_ENUM + + RunValidJsonTest("HelloWorld", REQUIRED, + "{\"optionalString\":\"Hello, World!\"}", "optional_string: 'Hello, World!'"); + // NOTE: The spec for JSON support is still being sorted out, these may not + // all be correct. // Test field name conventions. RunValidJsonTest( - "FieldNameInSnakeCase", + "FieldNameInSnakeCase", REQUIRED, R"({ "fieldname1": 1, "fieldName2": 2, - "FieldName3": 3 + "FieldName3": 3, + "fieldName4": 4 })", R"( fieldname1: 1 field_name2: 2 _field_name3: 3 + field__name4_: 4 )"); RunValidJsonTest( - "FieldNameWithNumbers", + "FieldNameWithNumbers", REQUIRED, R"({ "field0name5": 5, "field0Name6": 6 @@ -662,14 +999,14 @@ field_0_name6: 6 )"); RunValidJsonTest( - "FieldNameWithMixedCases", + "FieldNameWithMixedCases", REQUIRED, R"({ "fieldName7": 7, - "fieldName8": 8, + "FieldName8": 8, "fieldName9": 9, - "fieldName10": 10, - "fIELDNAME11": 11, - "fIELDName12": 12 + "FieldName10": 10, + "FIELDNAME11": 11, + "FIELDName12": 12 })", R"( fieldName7: 7 @@ -679,13 +1016,32 @@ FIELD_NAME11: 11 FIELD_name12: 12 )"); + RunValidJsonTest( + "FieldNameWithDoubleUnderscores", RECOMMENDED, + R"({ + "FieldName13": 13, + "FieldName14": 14, + "fieldName15": 15, + "fieldName16": 16, + "fieldName17": 17, + "FieldName18": 18 + })", + R"( + __field_name13: 13 + __Field_name14: 14 + field__name15: 15 + field__Name16: 16 + field_name17__: 17 + Field_name18__: 18 + )"); // Using the original proto field name in JSON is also allowed. RunValidJsonTest( - "OriginalProtoFieldName", + "OriginalProtoFieldName", REQUIRED, R"({ "fieldname1": 1, "field_name2": 2, "_field_name3": 3, + "field__name4_": 4, "field0name5": 5, "field_0_name6": 6, "fieldName7": 7, @@ -693,12 +1049,19 @@ "field_Name9": 9, "Field_Name10": 10, "FIELD_NAME11": 11, - "FIELD_name12": 12 + "FIELD_name12": 12, + "__field_name13": 13, + "__Field_name14": 14, + "field__name15": 15, + "field__Name16": 16, + "field_name17__": 17, + "Field_name18__": 18 })", R"( fieldname1: 1 field_name2: 2 _field_name3: 3 + field__name4_: 4 field0name5: 5 field_0_name6: 6 fieldName7: 7 @@ -707,61 +1070,120 @@ Field_Name10: 10 FIELD_NAME11: 11 FIELD_name12: 12 + __field_name13: 13 + __Field_name14: 14 + field__name15: 15 + field__Name16: 16 + field_name17__: 17 + Field_name18__: 18 )"); // Field names can be escaped. RunValidJsonTest( - "FieldNameEscaped", + "FieldNameEscaped", REQUIRED, R"({"fieldn\u0061me1": 1})", "fieldname1: 1"); + // String ends with escape character. + ExpectParseFailureForJson( + "StringEndsWithEscapeChar", RECOMMENDED, + "{\"optionalString\": \"abc\\"); // Field names must be quoted (or it's not valid JSON). ExpectParseFailureForJson( - "FieldNameNotQuoted", + "FieldNameNotQuoted", RECOMMENDED, "{fieldname1: 1}"); // Trailing comma is not allowed (not valid JSON). ExpectParseFailureForJson( - "TrailingCommaInAnObject", + "TrailingCommaInAnObject", RECOMMENDED, R"({"fieldname1":1,})"); + ExpectParseFailureForJson( + "TrailingCommaInAnObjectWithSpace", RECOMMENDED, + R"({"fieldname1":1 ,})"); + ExpectParseFailureForJson( + "TrailingCommaInAnObjectWithSpaceCommaSpace", RECOMMENDED, + R"({"fieldname1":1 , })"); + ExpectParseFailureForJson( + "TrailingCommaInAnObjectWithNewlines", RECOMMENDED, + R"({ + "fieldname1":1, + })"); // JSON doesn't support comments. ExpectParseFailureForJson( - "JsonWithComments", + "JsonWithComments", RECOMMENDED, R"({ // This is a comment. "fieldname1": 1 })"); + // JSON spec says whitespace doesn't matter, so try a few spacings to be sure. + RunValidJsonTest( + "OneLineNoSpaces", RECOMMENDED, + "{\"optionalInt32\":1,\"optionalInt64\":2}", + R"( + optional_int32: 1 + optional_int64: 2 + )"); + RunValidJsonTest( + "OneLineWithSpaces", RECOMMENDED, + "{ \"optionalInt32\" : 1 , \"optionalInt64\" : 2 }", + R"( + optional_int32: 1 + optional_int64: 2 + )"); + RunValidJsonTest( + "MultilineNoSpaces", RECOMMENDED, + "{\n\"optionalInt32\"\n:\n1\n,\n\"optionalInt64\"\n:\n2\n}", + R"( + optional_int32: 1 + optional_int64: 2 + )"); + RunValidJsonTest( + "MultilineWithSpaces", RECOMMENDED, + "{\n \"optionalInt32\" : 1\n ,\n \"optionalInt64\" : 2\n}\n", + R"( + optional_int32: 1 + optional_int64: 2 + )"); + // Missing comma between key/value pairs. + ExpectParseFailureForJson( + "MissingCommaOneLine", RECOMMENDED, + "{ \"optionalInt32\": 1 \"optionalInt64\": 2 }"); + ExpectParseFailureForJson( + "MissingCommaMultiline", RECOMMENDED, + "{\n \"optionalInt32\": 1\n \"optionalInt64\": 2\n}"); // Duplicated field names are not allowed. ExpectParseFailureForJson( - "FieldNameDuplicate", + "FieldNameDuplicate", RECOMMENDED, R"({ "optionalNestedMessage": {a: 1}, "optionalNestedMessage": {} })"); ExpectParseFailureForJson( - "FieldNameDuplicateDifferentCasing1", + "FieldNameDuplicateDifferentCasing1", RECOMMENDED, R"({ "optional_nested_message": {a: 1}, "optionalNestedMessage": {} })"); ExpectParseFailureForJson( - "FieldNameDuplicateDifferentCasing2", + "FieldNameDuplicateDifferentCasing2", RECOMMENDED, R"({ "optionalNestedMessage": {a: 1}, "optional_nested_message": {} })"); // Serializers should use lowerCamelCase by default. RunValidJsonTestWithValidator( - "FieldNameInLowerCamelCase", + "FieldNameInLowerCamelCase", REQUIRED, R"({ "fieldname1": 1, "fieldName2": 2, - "FieldName3": 3 + "FieldName3": 3, + "fieldName4": 4 })", [](const Json::Value& value) { return value.isMember("fieldname1") && value.isMember("fieldName2") && - value.isMember("FieldName3"); + value.isMember("FieldName3") && + value.isMember("fieldName4"); }); RunValidJsonTestWithValidator( - "FieldNameWithNumbers", + "FieldNameWithNumbers", REQUIRED, R"({ "field0name5": 5, "field0Name6": 6 @@ -771,169 +1193,195 @@ value.isMember("field0Name6"); }); RunValidJsonTestWithValidator( - "FieldNameWithMixedCases", + "FieldNameWithMixedCases", REQUIRED, R"({ "fieldName7": 7, - "fieldName8": 8, + "FieldName8": 8, "fieldName9": 9, - "fieldName10": 10, - "fIELDNAME11": 11, - "fIELDName12": 12 + "FieldName10": 10, + "FIELDNAME11": 11, + "FIELDName12": 12 })", [](const Json::Value& value) { return value.isMember("fieldName7") && - value.isMember("fieldName8") && + value.isMember("FieldName8") && value.isMember("fieldName9") && - value.isMember("fieldName10") && - value.isMember("fIELDNAME11") && - value.isMember("fIELDName12"); + value.isMember("FieldName10") && + value.isMember("FIELDNAME11") && + value.isMember("FIELDName12"); + }); + RunValidJsonTestWithValidator( + "FieldNameWithDoubleUnderscores", RECOMMENDED, + R"({ + "FieldName13": 13, + "FieldName14": 14, + "fieldName15": 15, + "fieldName16": 16, + "fieldName17": 17, + "FieldName18": 18 + })", + [](const Json::Value& value) { + return value.isMember("FieldName13") && + value.isMember("FieldName14") && + value.isMember("fieldName15") && + value.isMember("fieldName16") && + value.isMember("fieldName17") && + value.isMember("FieldName18"); }); // Integer fields. RunValidJsonTest( - "Int32FieldMaxValue", + "Int32FieldMaxValue", REQUIRED, R"({"optionalInt32": 2147483647})", "optional_int32: 2147483647"); RunValidJsonTest( - "Int32FieldMinValue", + "Int32FieldMinValue", REQUIRED, R"({"optionalInt32": -2147483648})", "optional_int32: -2147483648"); RunValidJsonTest( - "Uint32FieldMaxValue", + "Uint32FieldMaxValue", REQUIRED, R"({"optionalUint32": 4294967295})", "optional_uint32: 4294967295"); RunValidJsonTest( - "Int64FieldMaxValue", + "Int64FieldMaxValue", REQUIRED, R"({"optionalInt64": "9223372036854775807"})", "optional_int64: 9223372036854775807"); RunValidJsonTest( - "Int64FieldMinValue", + "Int64FieldMinValue", REQUIRED, R"({"optionalInt64": "-9223372036854775808"})", "optional_int64: -9223372036854775808"); RunValidJsonTest( - "Uint64FieldMaxValue", + "Uint64FieldMaxValue", REQUIRED, R"({"optionalUint64": "18446744073709551615"})", "optional_uint64: 18446744073709551615"); + // While not the largest Int64, this is the largest + // Int64 which can be exactly represented within an + // IEEE-754 64-bit float, which is the expected level + // of interoperability guarantee. Larger values may + // work in some implementations, but should not be + // relied upon. + RunValidJsonTest( + "Int64FieldMaxValueNotQuoted", REQUIRED, + R"({"optionalInt64": 9223372036854774784})", + "optional_int64: 9223372036854774784"); RunValidJsonTest( - "Int64FieldMaxValueNotQuoted", - R"({"optionalInt64": 9223372036854775807})", - "optional_int64: 9223372036854775807"); - RunValidJsonTest( - "Int64FieldMinValueNotQuoted", + "Int64FieldMinValueNotQuoted", REQUIRED, R"({"optionalInt64": -9223372036854775808})", "optional_int64: -9223372036854775808"); + // Largest interoperable Uint64; see comment above + // for Int64FieldMaxValueNotQuoted. RunValidJsonTest( - "Uint64FieldMaxValueNotQuoted", - R"({"optionalUint64": 18446744073709551615})", - "optional_uint64: 18446744073709551615"); + "Uint64FieldMaxValueNotQuoted", REQUIRED, + R"({"optionalUint64": 18446744073709549568})", + "optional_uint64: 18446744073709549568"); // Values can be represented as JSON strings. RunValidJsonTest( - "Int32FieldStringValue", + "Int32FieldStringValue", REQUIRED, R"({"optionalInt32": "2147483647"})", "optional_int32: 2147483647"); RunValidJsonTest( - "Int32FieldStringValueEscaped", + "Int32FieldStringValueEscaped", REQUIRED, R"({"optionalInt32": "2\u003147483647"})", "optional_int32: 2147483647"); // Parsers reject out-of-bound integer values. ExpectParseFailureForJson( - "Int32FieldTooLarge", + "Int32FieldTooLarge", REQUIRED, R"({"optionalInt32": 2147483648})"); ExpectParseFailureForJson( - "Int32FieldTooSmall", + "Int32FieldTooSmall", REQUIRED, R"({"optionalInt32": -2147483649})"); ExpectParseFailureForJson( - "Uint32FieldTooLarge", + "Uint32FieldTooLarge", REQUIRED, R"({"optionalUint32": 4294967296})"); ExpectParseFailureForJson( - "Int64FieldTooLarge", + "Int64FieldTooLarge", REQUIRED, R"({"optionalInt64": "9223372036854775808"})"); ExpectParseFailureForJson( - "Int64FieldTooSmall", + "Int64FieldTooSmall", REQUIRED, R"({"optionalInt64": "-9223372036854775809"})"); ExpectParseFailureForJson( - "Uint64FieldTooLarge", + "Uint64FieldTooLarge", REQUIRED, R"({"optionalUint64": "18446744073709551616"})"); // Parser reject non-integer numeric values as well. ExpectParseFailureForJson( - "Int32FieldNotInteger", + "Int32FieldNotInteger", REQUIRED, R"({"optionalInt32": 0.5})"); ExpectParseFailureForJson( - "Uint32FieldNotInteger", + "Uint32FieldNotInteger", REQUIRED, R"({"optionalUint32": 0.5})"); ExpectParseFailureForJson( - "Int64FieldNotInteger", + "Int64FieldNotInteger", REQUIRED, R"({"optionalInt64": "0.5"})"); ExpectParseFailureForJson( - "Uint64FieldNotInteger", + "Uint64FieldNotInteger", REQUIRED, R"({"optionalUint64": "0.5"})"); // Integers but represented as float values are accepted. RunValidJsonTest( - "Int32FieldFloatTrailingZero", + "Int32FieldFloatTrailingZero", REQUIRED, R"({"optionalInt32": 100000.000})", "optional_int32: 100000"); RunValidJsonTest( - "Int32FieldExponentialFormat", + "Int32FieldExponentialFormat", REQUIRED, R"({"optionalInt32": 1e5})", "optional_int32: 100000"); RunValidJsonTest( - "Int32FieldMaxFloatValue", + "Int32FieldMaxFloatValue", REQUIRED, R"({"optionalInt32": 2.147483647e9})", "optional_int32: 2147483647"); RunValidJsonTest( - "Int32FieldMinFloatValue", + "Int32FieldMinFloatValue", REQUIRED, R"({"optionalInt32": -2.147483648e9})", "optional_int32: -2147483648"); RunValidJsonTest( - "Uint32FieldMaxFloatValue", + "Uint32FieldMaxFloatValue", REQUIRED, R"({"optionalUint32": 4.294967295e9})", "optional_uint32: 4294967295"); // Parser reject non-numeric values. ExpectParseFailureForJson( - "Int32FieldNotNumber", + "Int32FieldNotNumber", REQUIRED, R"({"optionalInt32": "3x3"})"); ExpectParseFailureForJson( - "Uint32FieldNotNumber", + "Uint32FieldNotNumber", REQUIRED, R"({"optionalUint32": "3x3"})"); ExpectParseFailureForJson( - "Int64FieldNotNumber", + "Int64FieldNotNumber", REQUIRED, R"({"optionalInt64": "3x3"})"); ExpectParseFailureForJson( - "Uint64FieldNotNumber", + "Uint64FieldNotNumber", REQUIRED, R"({"optionalUint64": "3x3"})"); // JSON does not allow "+" on numric values. ExpectParseFailureForJson( - "Int32FieldPlusSign", + "Int32FieldPlusSign", REQUIRED, R"({"optionalInt32": +1})"); // JSON doesn't allow leading 0s. ExpectParseFailureForJson( - "Int32FieldLeadingZero", + "Int32FieldLeadingZero", REQUIRED, R"({"optionalInt32": 01})"); ExpectParseFailureForJson( - "Int32FieldNegativeWithLeadingZero", + "Int32FieldNegativeWithLeadingZero", REQUIRED, R"({"optionalInt32": -01})"); // String values must follow the same syntax rule. Specifically leading - // or traling spaces are not allowed. + // or trailing spaces are not allowed. ExpectParseFailureForJson( - "Int32FieldLeadingSpace", + "Int32FieldLeadingSpace", REQUIRED, R"({"optionalInt32": " 1"})"); ExpectParseFailureForJson( - "Int32FieldTrailingSpace", + "Int32FieldTrailingSpace", REQUIRED, R"({"optionalInt32": "1 "})"); // 64-bit values are serialized as strings. RunValidJsonTestWithValidator( - "Int64FieldBeString", + "Int64FieldBeString", RECOMMENDED, R"({"optionalInt64": 1})", [](const Json::Value& value) { return value["optionalInt64"].type() == Json::stringValue && value["optionalInt64"].asString() == "1"; }); RunValidJsonTestWithValidator( - "Uint64FieldBeString", + "Uint64FieldBeString", RECOMMENDED, R"({"optionalUint64": 1})", [](const Json::Value& value) { return value["optionalUint64"].type() == Json::stringValue && @@ -942,202 +1390,202 @@ // Bool fields. RunValidJsonTest( - "BoolFieldTrue", + "BoolFieldTrue", REQUIRED, R"({"optionalBool":true})", "optional_bool: true"); RunValidJsonTest( - "BoolFieldFalse", + "BoolFieldFalse", REQUIRED, R"({"optionalBool":false})", "optional_bool: false"); // Other forms are not allowed. ExpectParseFailureForJson( - "BoolFieldIntegerZero", + "BoolFieldIntegerZero", RECOMMENDED, R"({"optionalBool":0})"); ExpectParseFailureForJson( - "BoolFieldIntegerOne", + "BoolFieldIntegerOne", RECOMMENDED, R"({"optionalBool":1})"); ExpectParseFailureForJson( - "BoolFieldCamelCaseTrue", + "BoolFieldCamelCaseTrue", RECOMMENDED, R"({"optionalBool":True})"); ExpectParseFailureForJson( - "BoolFieldCamelCaseFalse", + "BoolFieldCamelCaseFalse", RECOMMENDED, R"({"optionalBool":False})"); ExpectParseFailureForJson( - "BoolFieldAllCapitalTrue", + "BoolFieldAllCapitalTrue", RECOMMENDED, R"({"optionalBool":TRUE})"); ExpectParseFailureForJson( - "BoolFieldAllCapitalFalse", + "BoolFieldAllCapitalFalse", RECOMMENDED, R"({"optionalBool":FALSE})"); ExpectParseFailureForJson( - "BoolFieldDoubleQuotedTrue", + "BoolFieldDoubleQuotedTrue", RECOMMENDED, R"({"optionalBool":"true"})"); ExpectParseFailureForJson( - "BoolFieldDoubleQuotedFalse", + "BoolFieldDoubleQuotedFalse", RECOMMENDED, R"({"optionalBool":"false"})"); // Float fields. RunValidJsonTest( - "FloatFieldMinPositiveValue", + "FloatFieldMinPositiveValue", REQUIRED, R"({"optionalFloat": 1.175494e-38})", "optional_float: 1.175494e-38"); RunValidJsonTest( - "FloatFieldMaxNegativeValue", + "FloatFieldMaxNegativeValue", REQUIRED, R"({"optionalFloat": -1.175494e-38})", "optional_float: -1.175494e-38"); RunValidJsonTest( - "FloatFieldMaxPositiveValue", + "FloatFieldMaxPositiveValue", REQUIRED, R"({"optionalFloat": 3.402823e+38})", "optional_float: 3.402823e+38"); RunValidJsonTest( - "FloatFieldMinNegativeValue", + "FloatFieldMinNegativeValue", REQUIRED, R"({"optionalFloat": 3.402823e+38})", "optional_float: 3.402823e+38"); // Values can be quoted. RunValidJsonTest( - "FloatFieldQuotedValue", + "FloatFieldQuotedValue", REQUIRED, R"({"optionalFloat": "1"})", "optional_float: 1"); // Special values. RunValidJsonTest( - "FloatFieldNan", + "FloatFieldNan", REQUIRED, R"({"optionalFloat": "NaN"})", "optional_float: nan"); RunValidJsonTest( - "FloatFieldInfinity", + "FloatFieldInfinity", REQUIRED, R"({"optionalFloat": "Infinity"})", "optional_float: inf"); RunValidJsonTest( - "FloatFieldNegativeInfinity", + "FloatFieldNegativeInfinity", REQUIRED, R"({"optionalFloat": "-Infinity"})", "optional_float: -inf"); // Non-cannonical Nan will be correctly normalized. { - TestAllTypes message; + TestAllTypesProto3 message; // IEEE floating-point standard 32-bit quiet NaN: // 0111 1111 1xxx xxxx xxxx xxxx xxxx xxxx message.set_optional_float( WireFormatLite::DecodeFloat(0x7FA12345)); RunValidJsonTestWithProtobufInput( - "FloatFieldNormalizeQuietNan", message, + "FloatFieldNormalizeQuietNan", REQUIRED, message, "optional_float: nan"); // IEEE floating-point standard 64-bit signaling NaN: // 1111 1111 1xxx xxxx xxxx xxxx xxxx xxxx message.set_optional_float( WireFormatLite::DecodeFloat(0xFFB54321)); RunValidJsonTestWithProtobufInput( - "FloatFieldNormalizeSignalingNan", message, + "FloatFieldNormalizeSignalingNan", REQUIRED, message, "optional_float: nan"); } // Special values must be quoted. ExpectParseFailureForJson( - "FloatFieldNanNotQuoted", + "FloatFieldNanNotQuoted", RECOMMENDED, R"({"optionalFloat": NaN})"); ExpectParseFailureForJson( - "FloatFieldInfinityNotQuoted", + "FloatFieldInfinityNotQuoted", RECOMMENDED, R"({"optionalFloat": Infinity})"); ExpectParseFailureForJson( - "FloatFieldNegativeInfinityNotQuoted", + "FloatFieldNegativeInfinityNotQuoted", RECOMMENDED, R"({"optionalFloat": -Infinity})"); // Parsers should reject out-of-bound values. ExpectParseFailureForJson( - "FloatFieldTooSmall", + "FloatFieldTooSmall", REQUIRED, R"({"optionalFloat": -3.502823e+38})"); ExpectParseFailureForJson( - "FloatFieldTooLarge", + "FloatFieldTooLarge", REQUIRED, R"({"optionalFloat": 3.502823e+38})"); // Double fields. RunValidJsonTest( - "DoubleFieldMinPositiveValue", + "DoubleFieldMinPositiveValue", REQUIRED, R"({"optionalDouble": 2.22507e-308})", "optional_double: 2.22507e-308"); RunValidJsonTest( - "DoubleFieldMaxNegativeValue", + "DoubleFieldMaxNegativeValue", REQUIRED, R"({"optionalDouble": -2.22507e-308})", "optional_double: -2.22507e-308"); RunValidJsonTest( - "DoubleFieldMaxPositiveValue", + "DoubleFieldMaxPositiveValue", REQUIRED, R"({"optionalDouble": 1.79769e+308})", "optional_double: 1.79769e+308"); RunValidJsonTest( - "DoubleFieldMinNegativeValue", + "DoubleFieldMinNegativeValue", REQUIRED, R"({"optionalDouble": -1.79769e+308})", "optional_double: -1.79769e+308"); // Values can be quoted. RunValidJsonTest( - "DoubleFieldQuotedValue", + "DoubleFieldQuotedValue", REQUIRED, R"({"optionalDouble": "1"})", "optional_double: 1"); // Speical values. RunValidJsonTest( - "DoubleFieldNan", + "DoubleFieldNan", REQUIRED, R"({"optionalDouble": "NaN"})", "optional_double: nan"); RunValidJsonTest( - "DoubleFieldInfinity", + "DoubleFieldInfinity", REQUIRED, R"({"optionalDouble": "Infinity"})", "optional_double: inf"); RunValidJsonTest( - "DoubleFieldNegativeInfinity", + "DoubleFieldNegativeInfinity", REQUIRED, R"({"optionalDouble": "-Infinity"})", "optional_double: -inf"); // Non-cannonical Nan will be correctly normalized. { - TestAllTypes message; + TestAllTypesProto3 message; message.set_optional_double( WireFormatLite::DecodeDouble(0x7FFA123456789ABCLL)); RunValidJsonTestWithProtobufInput( - "DoubleFieldNormalizeQuietNan", message, + "DoubleFieldNormalizeQuietNan", REQUIRED, message, "optional_double: nan"); message.set_optional_double( WireFormatLite::DecodeDouble(0xFFFBCBA987654321LL)); RunValidJsonTestWithProtobufInput( - "DoubleFieldNormalizeSignalingNan", message, + "DoubleFieldNormalizeSignalingNan", REQUIRED, message, "optional_double: nan"); } // Special values must be quoted. ExpectParseFailureForJson( - "DoubleFieldNanNotQuoted", + "DoubleFieldNanNotQuoted", RECOMMENDED, R"({"optionalDouble": NaN})"); ExpectParseFailureForJson( - "DoubleFieldInfinityNotQuoted", + "DoubleFieldInfinityNotQuoted", RECOMMENDED, R"({"optionalDouble": Infinity})"); ExpectParseFailureForJson( - "DoubleFieldNegativeInfinityNotQuoted", + "DoubleFieldNegativeInfinityNotQuoted", RECOMMENDED, R"({"optionalDouble": -Infinity})"); // Parsers should reject out-of-bound values. ExpectParseFailureForJson( - "DoubleFieldTooSmall", + "DoubleFieldTooSmall", REQUIRED, R"({"optionalDouble": -1.89769e+308})"); ExpectParseFailureForJson( - "DoubleFieldTooLarge", + "DoubleFieldTooLarge", REQUIRED, R"({"optionalDouble": +1.89769e+308})"); // Enum fields. RunValidJsonTest( - "EnumField", + "EnumField", REQUIRED, R"({"optionalNestedEnum": "FOO"})", "optional_nested_enum: FOO"); // Enum values must be represented as strings. ExpectParseFailureForJson( - "EnumFieldNotQuoted", + "EnumFieldNotQuoted", REQUIRED, R"({"optionalNestedEnum": FOO})"); // Numeric values are allowed. RunValidJsonTest( - "EnumFieldNumericValueZero", + "EnumFieldNumericValueZero", REQUIRED, R"({"optionalNestedEnum": 0})", "optional_nested_enum: FOO"); RunValidJsonTest( - "EnumFieldNumericValueNonZero", + "EnumFieldNumericValueNonZero", REQUIRED, R"({"optionalNestedEnum": 1})", "optional_nested_enum: BAR"); // Unknown enum values are represented as numeric values. RunValidJsonTestWithValidator( - "EnumFieldUnknownValue", + "EnumFieldUnknownValue", REQUIRED, R"({"optionalNestedEnum": 123})", [](const Json::Value& value) { return value["optionalNestedEnum"].type() == Json::intValue && @@ -1146,177 +1594,216 @@ // String fields. RunValidJsonTest( - "StringField", + "StringField", REQUIRED, R"({"optionalString": "Hello world!"})", "optional_string: \"Hello world!\""); RunValidJsonTest( - "StringFieldUnicode", + "StringFieldUnicode", REQUIRED, // Google in Chinese. R"({"optionalString": "谷歌"})", R"(optional_string: "谷歌")"); RunValidJsonTest( - "StringFieldEscape", + "StringFieldEscape", REQUIRED, R"({"optionalString": "\"\\\/\b\f\n\r\t"})", R"(optional_string: "\"\\/\b\f\n\r\t")"); RunValidJsonTest( - "StringFieldUnicodeEscape", + "StringFieldUnicodeEscape", REQUIRED, R"({"optionalString": "\u8C37\u6B4C"})", R"(optional_string: "谷歌")"); RunValidJsonTest( - "StringFieldUnicodeEscapeWithLowercaseHexLetters", + "StringFieldUnicodeEscapeWithLowercaseHexLetters", REQUIRED, R"({"optionalString": "\u8c37\u6b4c"})", R"(optional_string: "谷歌")"); RunValidJsonTest( - "StringFieldSurrogatePair", + "StringFieldSurrogatePair", REQUIRED, // The character is an emoji: grinning face with smiling eyes. 😁 R"({"optionalString": "\uD83D\uDE01"})", R"(optional_string: "\xF0\x9F\x98\x81")"); // Unicode escapes must start with "\u" (lowercase u). ExpectParseFailureForJson( - "StringFieldUppercaseEscapeLetter", + "StringFieldUppercaseEscapeLetter", RECOMMENDED, R"({"optionalString": "\U8C37\U6b4C"})"); ExpectParseFailureForJson( - "StringFieldInvalidEscape", + "StringFieldInvalidEscape", RECOMMENDED, R"({"optionalString": "\uXXXX\u6B4C"})"); ExpectParseFailureForJson( - "StringFieldUnterminatedEscape", + "StringFieldUnterminatedEscape", RECOMMENDED, R"({"optionalString": "\u8C3"})"); ExpectParseFailureForJson( - "StringFieldUnpairedHighSurrogate", + "StringFieldUnpairedHighSurrogate", RECOMMENDED, R"({"optionalString": "\uD800"})"); ExpectParseFailureForJson( - "StringFieldUnpairedLowSurrogate", + "StringFieldUnpairedLowSurrogate", RECOMMENDED, R"({"optionalString": "\uDC00"})"); ExpectParseFailureForJson( - "StringFieldSurrogateInWrongOrder", + "StringFieldSurrogateInWrongOrder", RECOMMENDED, R"({"optionalString": "\uDE01\uD83D"})"); ExpectParseFailureForJson( - "StringFieldNotAString", + "StringFieldNotAString", REQUIRED, R"({"optionalString": 12345})"); // Bytes fields. RunValidJsonTest( - "BytesField", + "BytesField", REQUIRED, R"({"optionalBytes": "AQI="})", R"(optional_bytes: "\x01\x02")"); - ExpectParseFailureForJson( - "BytesFieldNoPadding", - R"({"optionalBytes": "AQI"})"); - ExpectParseFailureForJson( - "BytesFieldInvalidBase64Characters", - R"({"optionalBytes": "-_=="})"); + RunValidJsonTest( + "BytesFieldBase64Url", RECOMMENDED, + R"({"optionalBytes": "-_"})", + R"(optional_bytes: "\xfb")"); // Message fields. RunValidJsonTest( - "MessageField", + "MessageField", REQUIRED, R"({"optionalNestedMessage": {"a": 1234}})", "optional_nested_message: {a: 1234}"); // Oneof fields. ExpectParseFailureForJson( - "OneofFieldDuplicate", + "OneofFieldDuplicate", REQUIRED, R"({"oneofUint32": 1, "oneofString": "test"})"); + // Ensure zero values for oneof make it out/backs. + TestAllTypesProto3 messageProto3; + TestAllTypesProto2 messageProto2; + TestOneofMessage(messageProto3, true); + TestOneofMessage(messageProto2, false); + RunValidJsonTest( + "OneofZeroUint32", RECOMMENDED, + R"({"oneofUint32": 0})", "oneof_uint32: 0"); + RunValidJsonTest( + "OneofZeroMessage", RECOMMENDED, + R"({"oneofNestedMessage": {}})", "oneof_nested_message: {}"); + RunValidJsonTest( + "OneofZeroString", RECOMMENDED, + R"({"oneofString": ""})", "oneof_string: \"\""); + RunValidJsonTest( + "OneofZeroBytes", RECOMMENDED, + R"({"oneofBytes": ""})", "oneof_bytes: \"\""); + RunValidJsonTest( + "OneofZeroBool", RECOMMENDED, + R"({"oneofBool": false})", "oneof_bool: false"); + RunValidJsonTest( + "OneofZeroUint64", RECOMMENDED, + R"({"oneofUint64": 0})", "oneof_uint64: 0"); + RunValidJsonTest( + "OneofZeroFloat", RECOMMENDED, + R"({"oneofFloat": 0.0})", "oneof_float: 0"); + RunValidJsonTest( + "OneofZeroDouble", RECOMMENDED, + R"({"oneofDouble": 0.0})", "oneof_double: 0"); + RunValidJsonTest( + "OneofZeroEnum", RECOMMENDED, + R"({"oneofEnum":"FOO"})", "oneof_enum: FOO"); // Repeated fields. RunValidJsonTest( - "PrimitiveRepeatedField", + "PrimitiveRepeatedField", REQUIRED, R"({"repeatedInt32": [1, 2, 3, 4]})", "repeated_int32: [1, 2, 3, 4]"); RunValidJsonTest( - "EnumRepeatedField", + "EnumRepeatedField", REQUIRED, R"({"repeatedNestedEnum": ["FOO", "BAR", "BAZ"]})", "repeated_nested_enum: [FOO, BAR, BAZ]"); RunValidJsonTest( - "StringRepeatedField", + "StringRepeatedField", REQUIRED, R"({"repeatedString": ["Hello", "world"]})", R"(repeated_string: ["Hello", "world"])"); RunValidJsonTest( - "BytesRepeatedField", + "BytesRepeatedField", REQUIRED, R"({"repeatedBytes": ["AAEC", "AQI="]})", R"(repeated_bytes: ["\x00\x01\x02", "\x01\x02"])"); RunValidJsonTest( - "MessageRepeatedField", + "MessageRepeatedField", REQUIRED, R"({"repeatedNestedMessage": [{"a": 1234}, {"a": 5678}]})", "repeated_nested_message: {a: 1234}" "repeated_nested_message: {a: 5678}"); // Repeated field elements are of incorrect type. ExpectParseFailureForJson( - "RepeatedFieldWrongElementTypeExpectingIntegersGotBool", + "RepeatedFieldWrongElementTypeExpectingIntegersGotBool", REQUIRED, R"({"repeatedInt32": [1, false, 3, 4]})"); ExpectParseFailureForJson( - "RepeatedFieldWrongElementTypeExpectingIntegersGotString", + "RepeatedFieldWrongElementTypeExpectingIntegersGotString", REQUIRED, R"({"repeatedInt32": [1, 2, "name", 4]})"); ExpectParseFailureForJson( - "RepeatedFieldWrongElementTypeExpectingIntegersGotMessage", + "RepeatedFieldWrongElementTypeExpectingIntegersGotMessage", REQUIRED, R"({"repeatedInt32": [1, 2, 3, {"a": 4}]})"); ExpectParseFailureForJson( - "RepeatedFieldWrongElementTypeExpectingStringsGotInt", + "RepeatedFieldWrongElementTypeExpectingStringsGotInt", REQUIRED, R"({"repeatedString": ["1", 2, "3", "4"]})"); ExpectParseFailureForJson( - "RepeatedFieldWrongElementTypeExpectingStringsGotBool", + "RepeatedFieldWrongElementTypeExpectingStringsGotBool", REQUIRED, R"({"repeatedString": ["1", "2", false, "4"]})"); ExpectParseFailureForJson( - "RepeatedFieldWrongElementTypeExpectingStringsGotMessage", + "RepeatedFieldWrongElementTypeExpectingStringsGotMessage", REQUIRED, R"({"repeatedString": ["1", 2, "3", {"a": 4}]})"); ExpectParseFailureForJson( - "RepeatedFieldWrongElementTypeExpectingMessagesGotInt", + "RepeatedFieldWrongElementTypeExpectingMessagesGotInt", REQUIRED, R"({"repeatedNestedMessage": [{"a": 1}, 2]})"); ExpectParseFailureForJson( - "RepeatedFieldWrongElementTypeExpectingMessagesGotBool", + "RepeatedFieldWrongElementTypeExpectingMessagesGotBool", REQUIRED, R"({"repeatedNestedMessage": [{"a": 1}, false]})"); ExpectParseFailureForJson( - "RepeatedFieldWrongElementTypeExpectingMessagesGotString", + "RepeatedFieldWrongElementTypeExpectingMessagesGotString", REQUIRED, R"({"repeatedNestedMessage": [{"a": 1}, "2"]})"); // Trailing comma in the repeated field is not allowed. ExpectParseFailureForJson( - "RepeatedFieldTrailingComma", + "RepeatedFieldTrailingComma", RECOMMENDED, R"({"repeatedInt32": [1, 2, 3, 4,]})"); + ExpectParseFailureForJson( + "RepeatedFieldTrailingCommaWithSpace", RECOMMENDED, + "{\"repeatedInt32\": [1, 2, 3, 4 ,]}"); + ExpectParseFailureForJson( + "RepeatedFieldTrailingCommaWithSpaceCommaSpace", RECOMMENDED, + "{\"repeatedInt32\": [1, 2, 3, 4 , ]}"); + ExpectParseFailureForJson( + "RepeatedFieldTrailingCommaWithNewlines", RECOMMENDED, + "{\"repeatedInt32\": [\n 1,\n 2,\n 3,\n 4,\n]}"); // Map fields. RunValidJsonTest( - "Int32MapField", + "Int32MapField", REQUIRED, R"({"mapInt32Int32": {"1": 2, "3": 4}})", "map_int32_int32: {key: 1 value: 2}" "map_int32_int32: {key: 3 value: 4}"); ExpectParseFailureForJson( - "Int32MapFieldKeyNotQuoted", + "Int32MapFieldKeyNotQuoted", RECOMMENDED, R"({"mapInt32Int32": {1: 2, 3: 4}})"); RunValidJsonTest( - "Uint32MapField", + "Uint32MapField", REQUIRED, R"({"mapUint32Uint32": {"1": 2, "3": 4}})", "map_uint32_uint32: {key: 1 value: 2}" "map_uint32_uint32: {key: 3 value: 4}"); ExpectParseFailureForJson( - "Uint32MapFieldKeyNotQuoted", + "Uint32MapFieldKeyNotQuoted", RECOMMENDED, R"({"mapUint32Uint32": {1: 2, 3: 4}})"); RunValidJsonTest( - "Int64MapField", + "Int64MapField", REQUIRED, R"({"mapInt64Int64": {"1": 2, "3": 4}})", "map_int64_int64: {key: 1 value: 2}" "map_int64_int64: {key: 3 value: 4}"); ExpectParseFailureForJson( - "Int64MapFieldKeyNotQuoted", + "Int64MapFieldKeyNotQuoted", RECOMMENDED, R"({"mapInt64Int64": {1: 2, 3: 4}})"); RunValidJsonTest( - "Uint64MapField", + "Uint64MapField", REQUIRED, R"({"mapUint64Uint64": {"1": 2, "3": 4}})", "map_uint64_uint64: {key: 1 value: 2}" "map_uint64_uint64: {key: 3 value: 4}"); ExpectParseFailureForJson( - "Uint64MapFieldKeyNotQuoted", + "Uint64MapFieldKeyNotQuoted", RECOMMENDED, R"({"mapUint64Uint64": {1: 2, 3: 4}})"); RunValidJsonTest( - "BoolMapField", + "BoolMapField", REQUIRED, R"({"mapBoolBool": {"true": true, "false": false}})", "map_bool_bool: {key: true value: true}" "map_bool_bool: {key: false value: false}"); ExpectParseFailureForJson( - "BoolMapFieldKeyNotQuoted", + "BoolMapFieldKeyNotQuoted", RECOMMENDED, R"({"mapBoolBool": {true: true, false: false}})"); RunValidJsonTest( - "MessageMapField", + "MessageMapField", REQUIRED, R"({ "mapStringNestedMessage": { "hello": {"a": 1234}, @@ -1335,26 +1822,34 @@ )"); // Since Map keys are represented as JSON strings, escaping should be allowed. RunValidJsonTest( - "Int32MapEscapedKey", + "Int32MapEscapedKey", REQUIRED, R"({"mapInt32Int32": {"\u0031": 2}})", "map_int32_int32: {key: 1 value: 2}"); RunValidJsonTest( - "Int64MapEscapedKey", + "Int64MapEscapedKey", REQUIRED, R"({"mapInt64Int64": {"\u0031": 2}})", "map_int64_int64: {key: 1 value: 2}"); RunValidJsonTest( - "BoolMapEscapedKey", + "BoolMapEscapedKey", REQUIRED, R"({"mapBoolBool": {"tr\u0075e": true}})", "map_bool_bool: {key: true value: true}"); // "null" is accepted for all fields types. RunValidJsonTest( - "AllFieldAcceptNull", + "AllFieldAcceptNull", REQUIRED, R"({ "optionalInt32": null, "optionalInt64": null, "optionalUint32": null, "optionalUint64": null, + "optionalSint32": null, + "optionalSint64": null, + "optionalFixed32": null, + "optionalFixed64": null, + "optionalSfixed32": null, + "optionalSfixed64": null, + "optionalFloat": null, + "optionalDouble": null, "optionalBool": null, "optionalString": null, "optionalBytes": null, @@ -1364,6 +1859,14 @@ "repeatedInt64": null, "repeatedUint32": null, "repeatedUint64": null, + "repeatedSint32": null, + "repeatedSint64": null, + "repeatedFixed32": null, + "repeatedFixed64": null, + "repeatedSfixed32": null, + "repeatedSfixed64": null, + "repeatedFloat": null, + "repeatedDouble": null, "repeatedBool": null, "repeatedString": null, "repeatedBytes": null, @@ -1377,59 +1880,83 @@ // Repeated field elements cannot be null. ExpectParseFailureForJson( - "RepeatedFieldPrimitiveElementIsNull", + "RepeatedFieldPrimitiveElementIsNull", RECOMMENDED, R"({"repeatedInt32": [1, null, 2]})"); ExpectParseFailureForJson( - "RepeatedFieldMessageElementIsNull", + "RepeatedFieldMessageElementIsNull", RECOMMENDED, R"({"repeatedNestedMessage": [{"a":1}, null, {"a":2}]})"); // Map field keys cannot be null. ExpectParseFailureForJson( - "MapFieldKeyIsNull", + "MapFieldKeyIsNull", RECOMMENDED, R"({"mapInt32Int32": {null: 1}})"); // Map field values cannot be null. ExpectParseFailureForJson( - "MapFieldValueIsNull", + "MapFieldValueIsNull", RECOMMENDED, R"({"mapInt32Int32": {"0": null}})"); + // http://www.rfc-editor.org/rfc/rfc7159.txt says strings have to use double + // quotes. + ExpectParseFailureForJson( + "StringFieldSingleQuoteKey", RECOMMENDED, + R"({'optionalString': "Hello world!"})"); + ExpectParseFailureForJson( + "StringFieldSingleQuoteValue", RECOMMENDED, + R"({"optionalString": 'Hello world!'})"); + ExpectParseFailureForJson( + "StringFieldSingleQuoteBoth", RECOMMENDED, + R"({'optionalString': 'Hello world!'})"); + + // Unknown fields. + { + TestAllTypesProto3 messageProto3; + TestAllTypesProto2 messageProto2; + //TODO(yilunchong): update this behavior when unknown field's behavior + // changed in open source. Also delete + // Required.Proto3.ProtobufInput.UnknownVarint.ProtobufOutput + // from failure list of python_cpp python java + TestUnknownMessage(messageProto3, true); + TestUnknownMessage(messageProto2, false); + } + // Wrapper types. RunValidJsonTest( - "OptionalBoolWrapper", + "OptionalBoolWrapper", REQUIRED, R"({"optionalBoolWrapper": false})", "optional_bool_wrapper: {value: false}"); RunValidJsonTest( - "OptionalInt32Wrapper", + "OptionalInt32Wrapper", REQUIRED, R"({"optionalInt32Wrapper": 0})", "optional_int32_wrapper: {value: 0}"); RunValidJsonTest( - "OptionalUint32Wrapper", + "OptionalUint32Wrapper", REQUIRED, R"({"optionalUint32Wrapper": 0})", "optional_uint32_wrapper: {value: 0}"); RunValidJsonTest( - "OptionalInt64Wrapper", + "OptionalInt64Wrapper", REQUIRED, R"({"optionalInt64Wrapper": 0})", "optional_int64_wrapper: {value: 0}"); RunValidJsonTest( - "OptionalUint64Wrapper", + "OptionalUint64Wrapper", REQUIRED, R"({"optionalUint64Wrapper": 0})", "optional_uint64_wrapper: {value: 0}"); RunValidJsonTest( - "OptionalFloatWrapper", + "OptionalFloatWrapper", REQUIRED, R"({"optionalFloatWrapper": 0})", "optional_float_wrapper: {value: 0}"); RunValidJsonTest( - "OptionalDoubleWrapper", + "OptionalDoubleWrapper", REQUIRED, R"({"optionalDoubleWrapper": 0})", "optional_double_wrapper: {value: 0}"); RunValidJsonTest( - "OptionalStringWrapper", + "OptionalStringWrapper", REQUIRED, R"({"optionalStringWrapper": ""})", R"(optional_string_wrapper: {value: ""})"); RunValidJsonTest( - "OptionalBytesWrapper", + "OptionalBytesWrapper", REQUIRED, R"({"optionalBytesWrapper": ""})", R"(optional_bytes_wrapper: {value: ""})"); RunValidJsonTest( - "OptionalWrapperTypesWithNonDefaultValue", + "OptionalWrapperTypesWithNonDefaultValue", REQUIRED, R"({ "optionalBoolWrapper": true, "optionalInt32Wrapper": 1, @@ -1453,56 +1980,56 @@ optional_bytes_wrapper: {value: "\x01\x02"} )"); RunValidJsonTest( - "RepeatedBoolWrapper", + "RepeatedBoolWrapper", REQUIRED, R"({"repeatedBoolWrapper": [true, false]})", "repeated_bool_wrapper: {value: true}" "repeated_bool_wrapper: {value: false}"); RunValidJsonTest( - "RepeatedInt32Wrapper", + "RepeatedInt32Wrapper", REQUIRED, R"({"repeatedInt32Wrapper": [0, 1]})", "repeated_int32_wrapper: {value: 0}" "repeated_int32_wrapper: {value: 1}"); RunValidJsonTest( - "RepeatedUint32Wrapper", + "RepeatedUint32Wrapper", REQUIRED, R"({"repeatedUint32Wrapper": [0, 1]})", "repeated_uint32_wrapper: {value: 0}" "repeated_uint32_wrapper: {value: 1}"); RunValidJsonTest( - "RepeatedInt64Wrapper", + "RepeatedInt64Wrapper", REQUIRED, R"({"repeatedInt64Wrapper": [0, 1]})", "repeated_int64_wrapper: {value: 0}" "repeated_int64_wrapper: {value: 1}"); RunValidJsonTest( - "RepeatedUint64Wrapper", + "RepeatedUint64Wrapper", REQUIRED, R"({"repeatedUint64Wrapper": [0, 1]})", "repeated_uint64_wrapper: {value: 0}" "repeated_uint64_wrapper: {value: 1}"); RunValidJsonTest( - "RepeatedFloatWrapper", + "RepeatedFloatWrapper", REQUIRED, R"({"repeatedFloatWrapper": [0, 1]})", "repeated_float_wrapper: {value: 0}" "repeated_float_wrapper: {value: 1}"); RunValidJsonTest( - "RepeatedDoubleWrapper", + "RepeatedDoubleWrapper", REQUIRED, R"({"repeatedDoubleWrapper": [0, 1]})", "repeated_double_wrapper: {value: 0}" "repeated_double_wrapper: {value: 1}"); RunValidJsonTest( - "RepeatedStringWrapper", + "RepeatedStringWrapper", REQUIRED, R"({"repeatedStringWrapper": ["", "AQI="]})", R"( repeated_string_wrapper: {value: ""} repeated_string_wrapper: {value: "AQI="} )"); RunValidJsonTest( - "RepeatedBytesWrapper", + "RepeatedBytesWrapper", REQUIRED, R"({"repeatedBytesWrapper": ["", "AQI="]})", R"( repeated_bytes_wrapper: {value: ""} repeated_bytes_wrapper: {value: "\x01\x02"} )"); RunValidJsonTest( - "WrapperTypesWithNullValue", + "WrapperTypesWithNullValue", REQUIRED, R"({ "optionalBoolWrapper": null, "optionalInt32Wrapper": null, @@ -1527,55 +2054,59 @@ // Duration RunValidJsonTest( - "DurationMinValue", + "DurationMinValue", REQUIRED, R"({"optionalDuration": "-315576000000.999999999s"})", "optional_duration: {seconds: -315576000000 nanos: -999999999}"); RunValidJsonTest( - "DurationMaxValue", + "DurationMaxValue", REQUIRED, R"({"optionalDuration": "315576000000.999999999s"})", "optional_duration: {seconds: 315576000000 nanos: 999999999}"); RunValidJsonTest( - "DurationRepeatedValue", + "DurationRepeatedValue", REQUIRED, R"({"repeatedDuration": ["1.5s", "-1.5s"]})", "repeated_duration: {seconds: 1 nanos: 500000000}" "repeated_duration: {seconds: -1 nanos: -500000000}"); + RunValidJsonTest( + "DurationNull", REQUIRED, + R"({"optionalDuration": null})", + ""); ExpectParseFailureForJson( - "DurationMissingS", + "DurationMissingS", REQUIRED, R"({"optionalDuration": "1"})"); ExpectParseFailureForJson( - "DurationJsonInputTooSmall", + "DurationJsonInputTooSmall", REQUIRED, R"({"optionalDuration": "-315576000001.000000000s"})"); ExpectParseFailureForJson( - "DurationJsonInputTooLarge", + "DurationJsonInputTooLarge", REQUIRED, R"({"optionalDuration": "315576000001.000000000s"})"); ExpectSerializeFailureForJson( - "DurationProtoInputTooSmall", + "DurationProtoInputTooSmall", REQUIRED, "optional_duration: {seconds: -315576000001 nanos: 0}"); ExpectSerializeFailureForJson( - "DurationProtoInputTooLarge", + "DurationProtoInputTooLarge", REQUIRED, "optional_duration: {seconds: 315576000001 nanos: 0}"); RunValidJsonTestWithValidator( - "DurationHasZeroFractionalDigit", + "DurationHasZeroFractionalDigit", RECOMMENDED, R"({"optionalDuration": "1.000000000s"})", [](const Json::Value& value) { return value["optionalDuration"].asString() == "1s"; }); RunValidJsonTestWithValidator( - "DurationHas3FractionalDigits", + "DurationHas3FractionalDigits", RECOMMENDED, R"({"optionalDuration": "1.010000000s"})", [](const Json::Value& value) { return value["optionalDuration"].asString() == "1.010s"; }); RunValidJsonTestWithValidator( - "DurationHas6FractionalDigits", + "DurationHas6FractionalDigits", RECOMMENDED, R"({"optionalDuration": "1.000010000s"})", [](const Json::Value& value) { return value["optionalDuration"].asString() == "1.000010s"; }); RunValidJsonTestWithValidator( - "DurationHas9FractionalDigits", + "DurationHas9FractionalDigits", RECOMMENDED, R"({"optionalDuration": "1.000000010s"})", [](const Json::Value& value) { return value["optionalDuration"].asString() == "1.000000010s"; @@ -1583,15 +2114,15 @@ // Timestamp RunValidJsonTest( - "TimestampMinValue", + "TimestampMinValue", REQUIRED, R"({"optionalTimestamp": "0001-01-01T00:00:00Z"})", "optional_timestamp: {seconds: -62135596800}"); RunValidJsonTest( - "TimestampMaxValue", + "TimestampMaxValue", REQUIRED, R"({"optionalTimestamp": "9999-12-31T23:59:59.999999999Z"})", "optional_timestamp: {seconds: 253402300799 nanos: 999999999}"); RunValidJsonTest( - "TimestampRepeatedValue", + "TimestampRepeatedValue", REQUIRED, R"({ "repeatedTimestamp": [ "0001-01-01T00:00:00Z", @@ -1601,68 +2132,72 @@ "repeated_timestamp: {seconds: -62135596800}" "repeated_timestamp: {seconds: 253402300799 nanos: 999999999}"); RunValidJsonTest( - "TimestampWithPositiveOffset", + "TimestampWithPositiveOffset", REQUIRED, R"({"optionalTimestamp": "1970-01-01T08:00:00+08:00"})", "optional_timestamp: {seconds: 0}"); RunValidJsonTest( - "TimestampWithNegativeOffset", + "TimestampWithNegativeOffset", REQUIRED, R"({"optionalTimestamp": "1969-12-31T16:00:00-08:00"})", "optional_timestamp: {seconds: 0}"); + RunValidJsonTest( + "TimestampNull", REQUIRED, + R"({"optionalTimestamp": null})", + ""); ExpectParseFailureForJson( - "TimestampJsonInputTooSmall", + "TimestampJsonInputTooSmall", REQUIRED, R"({"optionalTimestamp": "0000-01-01T00:00:00Z"})"); ExpectParseFailureForJson( - "TimestampJsonInputTooLarge", + "TimestampJsonInputTooLarge", REQUIRED, R"({"optionalTimestamp": "10000-01-01T00:00:00Z"})"); ExpectParseFailureForJson( - "TimestampJsonInputMissingZ", + "TimestampJsonInputMissingZ", REQUIRED, R"({"optionalTimestamp": "0001-01-01T00:00:00"})"); ExpectParseFailureForJson( - "TimestampJsonInputMissingT", + "TimestampJsonInputMissingT", REQUIRED, R"({"optionalTimestamp": "0001-01-01 00:00:00Z"})"); ExpectParseFailureForJson( - "TimestampJsonInputLowercaseZ", + "TimestampJsonInputLowercaseZ", REQUIRED, R"({"optionalTimestamp": "0001-01-01T00:00:00z"})"); ExpectParseFailureForJson( - "TimestampJsonInputLowercaseT", + "TimestampJsonInputLowercaseT", REQUIRED, R"({"optionalTimestamp": "0001-01-01t00:00:00Z"})"); ExpectSerializeFailureForJson( - "TimestampProtoInputTooSmall", + "TimestampProtoInputTooSmall", REQUIRED, "optional_timestamp: {seconds: -62135596801}"); ExpectSerializeFailureForJson( - "TimestampProtoInputTooLarge", + "TimestampProtoInputTooLarge", REQUIRED, "optional_timestamp: {seconds: 253402300800}"); RunValidJsonTestWithValidator( - "TimestampZeroNormalized", + "TimestampZeroNormalized", RECOMMENDED, R"({"optionalTimestamp": "1969-12-31T16:00:00-08:00"})", [](const Json::Value& value) { return value["optionalTimestamp"].asString() == "1970-01-01T00:00:00Z"; }); RunValidJsonTestWithValidator( - "TimestampHasZeroFractionalDigit", + "TimestampHasZeroFractionalDigit", RECOMMENDED, R"({"optionalTimestamp": "1970-01-01T00:00:00.000000000Z"})", [](const Json::Value& value) { return value["optionalTimestamp"].asString() == "1970-01-01T00:00:00Z"; }); RunValidJsonTestWithValidator( - "TimestampHas3FractionalDigits", + "TimestampHas3FractionalDigits", RECOMMENDED, R"({"optionalTimestamp": "1970-01-01T00:00:00.010000000Z"})", [](const Json::Value& value) { return value["optionalTimestamp"].asString() == "1970-01-01T00:00:00.010Z"; }); RunValidJsonTestWithValidator( - "TimestampHas6FractionalDigits", + "TimestampHas6FractionalDigits", RECOMMENDED, R"({"optionalTimestamp": "1970-01-01T00:00:00.000010000Z"})", [](const Json::Value& value) { return value["optionalTimestamp"].asString() == "1970-01-01T00:00:00.000010Z"; }); RunValidJsonTestWithValidator( - "TimestampHas9FractionalDigits", + "TimestampHas9FractionalDigits", RECOMMENDED, R"({"optionalTimestamp": "1970-01-01T00:00:00.000000010Z"})", [](const Json::Value& value) { return value["optionalTimestamp"].asString() == @@ -1671,25 +2206,25 @@ // FieldMask RunValidJsonTest( - "FieldMask", + "FieldMask", REQUIRED, R"({"optionalFieldMask": "foo,barBaz"})", R"(optional_field_mask: {paths: "foo" paths: "bar_baz"})"); ExpectParseFailureForJson( - "FieldMaskInvalidCharacter", + "FieldMaskInvalidCharacter", RECOMMENDED, R"({"optionalFieldMask": "foo,bar_bar"})"); ExpectSerializeFailureForJson( - "FieldMaskPathsDontRoundTrip", + "FieldMaskPathsDontRoundTrip", RECOMMENDED, R"(optional_field_mask: {paths: "fooBar"})"); ExpectSerializeFailureForJson( - "FieldMaskNumbersDontRoundTrip", + "FieldMaskNumbersDontRoundTrip", RECOMMENDED, R"(optional_field_mask: {paths: "foo_3_bar"})"); ExpectSerializeFailureForJson( - "FieldMaskTooManyUnderscore", + "FieldMaskTooManyUnderscore", RECOMMENDED, R"(optional_field_mask: {paths: "foo__bar"})"); // Struct RunValidJsonTest( - "Struct", + "Struct", REQUIRED, R"({ "optionalStruct": { "nullValue": null, @@ -1755,27 +2290,27 @@ )"); // Value RunValidJsonTest( - "ValueAcceptInteger", + "ValueAcceptInteger", REQUIRED, R"({"optionalValue": 1})", "optional_value: { number_value: 1}"); RunValidJsonTest( - "ValueAcceptFloat", + "ValueAcceptFloat", REQUIRED, R"({"optionalValue": 1.5})", "optional_value: { number_value: 1.5}"); RunValidJsonTest( - "ValueAcceptBool", + "ValueAcceptBool", REQUIRED, R"({"optionalValue": false})", "optional_value: { bool_value: false}"); RunValidJsonTest( - "ValueAcceptNull", + "ValueAcceptNull", REQUIRED, R"({"optionalValue": null})", "optional_value: { null_value: NULL_VALUE}"); RunValidJsonTest( - "ValueAcceptString", + "ValueAcceptString", REQUIRED, R"({"optionalValue": "hello"})", R"(optional_value: { string_value: "hello"})"); RunValidJsonTest( - "ValueAcceptList", + "ValueAcceptList", REQUIRED, R"({"optionalValue": [0, "hello"]})", R"( optional_value: { @@ -1790,7 +2325,25 @@ } )"); RunValidJsonTest( - "ValueAcceptObject", + "ValueAcceptListWithNull", REQUIRED, + R"({"optionalValue": ["x", null, "y"]})", + R"( + optional_value: { + list_value: { + values: { + string_value: "x" + } + values: { + null_value: NULL_VALUE + } + values: { + string_value: "y" + } + } + } + )"); + RunValidJsonTest( + "ValueAcceptObject", REQUIRED, R"({"optionalValue": {"value": 1}})", R"( optional_value: { @@ -1807,27 +2360,27 @@ // Any RunValidJsonTest( - "Any", + "Any", REQUIRED, R"({ "optionalAny": { - "@type": "type.googleapis.com/conformance.TestAllTypes", + "@type": "type.googleapis.com/protobuf_test_messages.proto3.TestAllTypesProto3", "optionalInt32": 12345 } })", R"( optional_any: { - [type.googleapis.com/conformance.TestAllTypes] { + [type.googleapis.com/protobuf_test_messages.proto3.TestAllTypesProto3] { optional_int32: 12345 } } )"); RunValidJsonTest( - "AnyNested", + "AnyNested", REQUIRED, R"({ "optionalAny": { "@type": "type.googleapis.com/google.protobuf.Any", "value": { - "@type": "type.googleapis.com/conformance.TestAllTypes", + "@type": "type.googleapis.com/protobuf_test_messages.proto3.TestAllTypesProto3", "optionalInt32": 12345 } } @@ -1835,7 +2388,7 @@ R"( optional_any: { [type.googleapis.com/google.protobuf.Any] { - [type.googleapis.com/conformance.TestAllTypes] { + [type.googleapis.com/protobuf_test_messages.proto3.TestAllTypesProto3] { optional_int32: 12345 } } @@ -1843,23 +2396,23 @@ )"); // The special "@type" tag is not required to appear first. RunValidJsonTest( - "AnyUnorderedTypeTag", + "AnyUnorderedTypeTag", REQUIRED, R"({ "optionalAny": { "optionalInt32": 12345, - "@type": "type.googleapis.com/conformance.TestAllTypes" + "@type": "type.googleapis.com/protobuf_test_messages.proto3.TestAllTypesProto3" } })", R"( optional_any: { - [type.googleapis.com/conformance.TestAllTypes] { + [type.googleapis.com/protobuf_test_messages.proto3.TestAllTypesProto3] { optional_int32: 12345 } } )"); // Well-known types in Any. RunValidJsonTest( - "AnyWithInt32ValueWrapper", + "AnyWithInt32ValueWrapper", REQUIRED, R"({ "optionalAny": { "@type": "type.googleapis.com/google.protobuf.Int32Value", @@ -1874,7 +2427,7 @@ } )"); RunValidJsonTest( - "AnyWithDuration", + "AnyWithDuration", REQUIRED, R"({ "optionalAny": { "@type": "type.googleapis.com/google.protobuf.Duration", @@ -1890,7 +2443,7 @@ } )"); RunValidJsonTest( - "AnyWithTimestamp", + "AnyWithTimestamp", REQUIRED, R"({ "optionalAny": { "@type": "type.googleapis.com/google.protobuf.Timestamp", @@ -1906,7 +2459,7 @@ } )"); RunValidJsonTest( - "AnyWithFieldMask", + "AnyWithFieldMask", REQUIRED, R"({ "optionalAny": { "@type": "type.googleapis.com/google.protobuf.FieldMask", @@ -1921,7 +2474,7 @@ } )"); RunValidJsonTest( - "AnyWithStruct", + "AnyWithStruct", REQUIRED, R"({ "optionalAny": { "@type": "type.googleapis.com/google.protobuf.Struct", @@ -1943,7 +2496,7 @@ } )"); RunValidJsonTest( - "AnyWithValueForJsonObject", + "AnyWithValueForJsonObject", REQUIRED, R"({ "optionalAny": { "@type": "type.googleapis.com/google.protobuf.Value", @@ -1967,7 +2520,7 @@ } )"); RunValidJsonTest( - "AnyWithValueForInteger", + "AnyWithValueForInteger", REQUIRED, R"({ "optionalAny": { "@type": "type.googleapis.com/google.protobuf.Value", diff -Nru protobuf-3.0.0/conformance/conformance_test.h protobuf-3.6.1.3/conformance/conformance_test.h --- protobuf-3.0.0/conformance/conformance_test.h 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/conformance/conformance_test.h 2018-12-08 01:32:11.000000000 +0000 @@ -49,9 +49,14 @@ namespace conformance { class ConformanceRequest; class ConformanceResponse; -class TestAllTypes; } // namespace conformance +namespace protobuf_test_messages { +namespace proto3 { +class TestAllTypesProto3; +} // namespace proto3 +} // namespace protobuf_test_messages + namespace google { namespace protobuf { @@ -91,7 +96,7 @@ // class ConformanceTestSuite { public: - ConformanceTestSuite() : verbose_(false) {} + ConformanceTestSuite() : verbose_(false), enforce_recommended_(false) {} void SetVerbose(bool verbose) { verbose_ = verbose; } @@ -104,6 +109,18 @@ void SetFailureList(const std::string& filename, const std::vector& failure_list); + // Whether to require the testee to pass RECOMMENDED tests. By default failing + // a RECOMMENDED test case will not fail the entire suite but will only + // generated a warning. If this flag is set to true, RECOMMENDED tests will + // be treated the same way as REQUIRED tests and failing a RECOMMENDED test + // case will cause the entire test suite to fail as well. An implementation + // can enable this if it wants to be strictly conforming to protobuf spec. + // See the comments about ConformanceLevel below to learn more about the + // difference between REQUIRED and RECOMMENDED test cases. + void SetEnforceRecommended(bool value) { + enforce_recommended_ = value; + } + // Run all the conformance tests against the given test runner. // Test output will be stored in "output". // @@ -113,8 +130,27 @@ bool RunSuite(ConformanceTestRunner* runner, std::string* output); private: + // Test cases are classified into a few categories: + // REQUIRED: the test case must be passed for an implementation to be + // interoperable with other implementations. For example, a + // parser implementaiton must accept both packed and unpacked + // form of repeated primitive fields. + // RECOMMENDED: the test case is not required for the implementation to + // be interoperable with other implementations, but is + // recommended for best performance and compatibility. For + // example, a proto3 serializer should serialize repeated + // primitive fields in packed form, but an implementation + // failing to do so will still be able to communicate with + // other implementations. + enum ConformanceLevel { + REQUIRED = 0, + RECOMMENDED = 1, + }; + string ConformanceLevelToString(ConformanceLevel level); + void ReportSuccess(const std::string& test_name); void ReportFailure(const string& test_name, + ConformanceLevel level, const conformance::ConformanceRequest& request, const conformance::ConformanceResponse& response, const char* fmt, ...); @@ -124,35 +160,82 @@ void RunTest(const std::string& test_name, const conformance::ConformanceRequest& request, conformance::ConformanceResponse* response); - void RunValidInputTest(const string& test_name, const string& input, + void RunValidInputTest(const string& test_name, + ConformanceLevel level, + const string& input, conformance::WireFormat input_format, const string& equivalent_text_format, - conformance::WireFormat requested_output); - void RunValidJsonTest(const string& test_name, const string& input_json, + conformance::WireFormat requested_output, + bool isProto3); + void RunValidBinaryInputTest(const string& test_name, + ConformanceLevel level, + const string& input, + conformance::WireFormat input_format, + const string& equivalent_wire_format, + conformance::WireFormat requested_output, + bool isProto3); + void RunValidJsonTest(const string& test_name, + ConformanceLevel level, + const string& input_json, const string& equivalent_text_format); - void RunValidJsonTestWithProtobufInput(const string& test_name, - const conformance::TestAllTypes& input, - const string& equivalent_text_format); + void RunValidJsonTestWithProtobufInput( + const string& test_name, + ConformanceLevel level, + const protobuf_test_messages::proto3::TestAllTypesProto3& input, + const string& equivalent_text_format); + void RunValidProtobufTest(const string& test_name, ConformanceLevel level, + const string& input_protobuf, + const string& equivalent_text_format, + bool isProto3); + void RunValidBinaryProtobufTest(const string& test_name, + ConformanceLevel level, + const string& input_protobuf, + bool isProto3); + void RunValidProtobufTestWithMessage( + const string& test_name, ConformanceLevel level, + const Message *input, + const string& equivalent_text_format, + bool isProto3); typedef std::function Validator; void RunValidJsonTestWithValidator(const string& test_name, + ConformanceLevel level, const string& input_json, const Validator& validator); void ExpectParseFailureForJson(const string& test_name, + ConformanceLevel level, const string& input_json); void ExpectSerializeFailureForJson(const string& test_name, + ConformanceLevel level, const string& text_format); + void ExpectParseFailureForProtoWithProtoVersion (const string& proto, + const string& test_name, + ConformanceLevel level, + bool isProto3); void ExpectParseFailureForProto(const std::string& proto, - const std::string& test_name); + const std::string& test_name, + ConformanceLevel level); void ExpectHardParseFailureForProto(const std::string& proto, - const std::string& test_name); + const std::string& test_name, + ConformanceLevel level); void TestPrematureEOFForType(google::protobuf::FieldDescriptor::Type type); - bool CheckSetEmpty(const set& set_to_check, + void TestIllegalTags(); + template + void TestOneofMessage (MessageType &message, + bool isProto3); + template + void TestUnknownMessage (MessageType &message, + bool isProto3); + void TestValidDataForType( + google::protobuf::FieldDescriptor::Type, + std::vector> values); + bool CheckSetEmpty(const std::set& set_to_check, const std::string& write_to_file, const std::string& msg); ConformanceTestRunner* runner_; int successes_; int expected_failures_; bool verbose_; + bool enforce_recommended_; std::string output_; std::string failure_list_filename_; @@ -173,8 +256,7 @@ // The set of tests that the testee opted out of; std::set skipped_; - google::protobuf::internal::scoped_ptr - type_resolver_; + std::unique_ptr type_resolver_; std::string type_url_; }; diff -Nru protobuf-3.0.0/conformance/conformance_test_runner.cc protobuf-3.6.1.3/conformance/conformance_test_runner.cc --- protobuf-3.0.0/conformance/conformance_test_runner.cc 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/conformance/conformance_test_runner.cc 2018-12-08 01:32:11.000000000 +0000 @@ -68,7 +68,6 @@ using conformance::ConformanceRequest; using conformance::ConformanceResponse; -using google::protobuf::internal::scoped_array; using google::protobuf::StringAppendF; using std::string; using std::vector; @@ -183,7 +182,7 @@ CHECK_SYSCALL(close(toproc_pipe_fd[1])); CHECK_SYSCALL(close(fromproc_pipe_fd[0])); - scoped_array executable(new char[executable_.size() + 1]); + std::unique_ptr executable(new char[executable_.size() + 1]); memcpy(executable.get(), executable_.c_str(), executable_.size()); executable[executable_.size()] = '\0'; @@ -251,10 +250,20 @@ " should contain one test name per\n"); fprintf(stderr, " line. Use '#' for comments.\n"); + fprintf(stderr, + " --enforce_recommended Enforce that recommended test\n"); + fprintf(stderr, + " cases are also passing. Specify\n"); + fprintf(stderr, + " this flag if you want to be\n"); + fprintf(stderr, + " strictly conforming to protobuf\n"); + fprintf(stderr, + " spec.\n"); exit(1); } -void ParseFailureList(const char *filename, vector* failure_list) { +void ParseFailureList(const char *filename, std::vector* failure_list) { std::ifstream infile(filename); if (!infile.is_open()) { @@ -281,7 +290,7 @@ google::protobuf::ConformanceTestSuite suite; string failure_list_filename; - vector failure_list; + std::vector failure_list; for (int arg = 1; arg < argc; ++arg) { if (strcmp(argv[arg], "--failure_list") == 0) { @@ -290,6 +299,8 @@ ParseFailureList(argv[arg], &failure_list); } else if (strcmp(argv[arg], "--verbose") == 0) { suite.SetVerbose(true); + } else if (strcmp(argv[arg], "--enforce_recommended") == 0) { + suite.SetEnforceRecommended(true); } else if (argv[arg][0] == '-') { fprintf(stderr, "Unknown option: %s\n", argv[arg]); UsageError(); diff -Nru protobuf-3.0.0/conformance/failure_list_cpp.txt protobuf-3.6.1.3/conformance/failure_list_cpp.txt --- protobuf-3.0.0/conformance/failure_list_cpp.txt 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/conformance/failure_list_cpp.txt 2018-12-08 01:32:11.000000000 +0000 @@ -7,42 +7,50 @@ # TODO(haberman): insert links to corresponding bugs tracking the issue. # Should we use GitHub issues or the Google-internal bug tracker? -FieldMaskNumbersDontRoundTrip.JsonOutput -FieldMaskPathsDontRoundTrip.JsonOutput -FieldMaskTooManyUnderscore.JsonOutput -JsonInput.AnyUnorderedTypeTag.JsonOutput -JsonInput.AnyUnorderedTypeTag.ProtobufOutput -JsonInput.BoolFieldDoubleQuotedFalse -JsonInput.BoolFieldDoubleQuotedTrue -JsonInput.BytesFieldNoPadding -JsonInput.DoubleFieldTooSmall -JsonInput.DurationHasZeroFractionalDigit.Validator -JsonInput.EnumFieldUnknownValue.Validator -JsonInput.FieldMaskInvalidCharacter -JsonInput.FieldNameDuplicate -JsonInput.FieldNameDuplicateDifferentCasing1 -JsonInput.FieldNameDuplicateDifferentCasing2 -JsonInput.FieldNameInLowerCamelCase.Validator -JsonInput.FieldNameInSnakeCase.JsonOutput -JsonInput.FieldNameInSnakeCase.ProtobufOutput -JsonInput.FieldNameNotQuoted -JsonInput.MapFieldValueIsNull -JsonInput.RepeatedFieldMessageElementIsNull -JsonInput.RepeatedFieldPrimitiveElementIsNull -JsonInput.RepeatedFieldTrailingComma -JsonInput.StringFieldUppercaseEscapeLetter -JsonInput.TrailingCommaInAnObject -JsonInput.WrapperTypesWithNullValue.JsonOutput -JsonInput.WrapperTypesWithNullValue.ProtobufOutput -ProtobufInput.PrematureEofBeforeKnownRepeatedValue.MESSAGE -ProtobufInput.PrematureEofInDelimitedDataForKnownNonRepeatedValue.MESSAGE -ProtobufInput.PrematureEofInDelimitedDataForKnownRepeatedValue.MESSAGE -ProtobufInput.PrematureEofInPackedField.BOOL -ProtobufInput.PrematureEofInPackedField.ENUM -ProtobufInput.PrematureEofInPackedField.INT32 -ProtobufInput.PrematureEofInPackedField.INT64 -ProtobufInput.PrematureEofInPackedField.SINT32 -ProtobufInput.PrematureEofInPackedField.SINT64 -ProtobufInput.PrematureEofInPackedField.UINT32 -ProtobufInput.PrematureEofInPackedField.UINT64 -ProtobufInput.PrematureEofInsideKnownRepeatedValue.MESSAGE +Recommended.FieldMaskNumbersDontRoundTrip.JsonOutput +Recommended.FieldMaskPathsDontRoundTrip.JsonOutput +Recommended.FieldMaskTooManyUnderscore.JsonOutput +Recommended.Proto3.JsonInput.BoolFieldDoubleQuotedFalse +Recommended.Proto3.JsonInput.BoolFieldDoubleQuotedTrue +Recommended.Proto3.JsonInput.BytesFieldBase64Url.JsonOutput +Recommended.Proto3.JsonInput.BytesFieldBase64Url.ProtobufOutput +Recommended.Proto3.JsonInput.FieldMaskInvalidCharacter +Recommended.Proto3.JsonInput.FieldNameDuplicate +Recommended.Proto3.JsonInput.FieldNameDuplicateDifferentCasing1 +Recommended.Proto3.JsonInput.FieldNameDuplicateDifferentCasing2 +Recommended.Proto3.JsonInput.FieldNameNotQuoted +Recommended.Proto3.JsonInput.MapFieldValueIsNull +Recommended.Proto3.JsonInput.RepeatedFieldMessageElementIsNull +Recommended.Proto3.JsonInput.RepeatedFieldPrimitiveElementIsNull +Recommended.Proto3.JsonInput.RepeatedFieldTrailingComma +Recommended.Proto3.JsonInput.RepeatedFieldTrailingCommaWithNewlines +Recommended.Proto3.JsonInput.RepeatedFieldTrailingCommaWithSpace +Recommended.Proto3.JsonInput.RepeatedFieldTrailingCommaWithSpaceCommaSpace +Recommended.Proto3.JsonInput.StringFieldSingleQuoteBoth +Recommended.Proto3.JsonInput.StringFieldSingleQuoteKey +Recommended.Proto3.JsonInput.StringFieldSingleQuoteValue +Recommended.Proto3.JsonInput.StringFieldUppercaseEscapeLetter +Recommended.Proto3.JsonInput.TrailingCommaInAnObject +Recommended.Proto3.JsonInput.TrailingCommaInAnObjectWithNewlines +Recommended.Proto3.JsonInput.TrailingCommaInAnObjectWithSpace +Recommended.Proto3.JsonInput.TrailingCommaInAnObjectWithSpaceCommaSpace +Required.Proto3.ProtobufInput.PrematureEofInDelimitedDataForKnownNonRepeatedValue.MESSAGE +Required.Proto3.ProtobufInput.PrematureEofInDelimitedDataForKnownRepeatedValue.MESSAGE +Required.Proto3.ProtobufInput.PrematureEofInPackedField.BOOL +Required.Proto3.ProtobufInput.PrematureEofInPackedField.ENUM +Required.Proto3.ProtobufInput.PrematureEofInPackedField.INT32 +Required.Proto3.ProtobufInput.PrematureEofInPackedField.INT64 +Required.Proto3.ProtobufInput.PrematureEofInPackedField.SINT32 +Required.Proto3.ProtobufInput.PrematureEofInPackedField.SINT64 +Required.Proto3.ProtobufInput.PrematureEofInPackedField.UINT32 +Required.Proto3.ProtobufInput.PrematureEofInPackedField.UINT64 +Required.Proto2.ProtobufInput.PrematureEofInDelimitedDataForKnownNonRepeatedValue.MESSAGE +Required.Proto2.ProtobufInput.PrematureEofInDelimitedDataForKnownRepeatedValue.MESSAGE +Required.Proto2.ProtobufInput.PrematureEofInPackedField.BOOL +Required.Proto2.ProtobufInput.PrematureEofInPackedField.ENUM +Required.Proto2.ProtobufInput.PrematureEofInPackedField.INT32 +Required.Proto2.ProtobufInput.PrematureEofInPackedField.INT64 +Required.Proto2.ProtobufInput.PrematureEofInPackedField.SINT32 +Required.Proto2.ProtobufInput.PrematureEofInPackedField.SINT64 +Required.Proto2.ProtobufInput.PrematureEofInPackedField.UINT32 +Required.Proto2.ProtobufInput.PrematureEofInPackedField.UINT64 diff -Nru protobuf-3.0.0/conformance/failure_list_csharp.txt protobuf-3.6.1.3/conformance/failure_list_csharp.txt --- protobuf-3.0.0/conformance/failure_list_csharp.txt 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/conformance/failure_list_csharp.txt 2018-12-08 01:32:11.000000000 +0000 @@ -1,11 +1,2 @@ -JsonInput.FieldNameInLowerCamelCase.Validator -JsonInput.FieldNameInSnakeCase.JsonOutput -JsonInput.FieldNameInSnakeCase.ProtobufOutput -JsonInput.FieldNameWithMixedCases.JsonOutput -JsonInput.FieldNameWithMixedCases.ProtobufOutput -JsonInput.FieldNameWithMixedCases.Validator -JsonInput.Int64FieldMaxValueNotQuoted.JsonOutput -JsonInput.Int64FieldMaxValueNotQuoted.ProtobufOutput -JsonInput.OriginalProtoFieldName.JsonOutput -JsonInput.Uint64FieldMaxValueNotQuoted.JsonOutput -JsonInput.Uint64FieldMaxValueNotQuoted.ProtobufOutput +Recommended.Proto3.JsonInput.BytesFieldBase64Url.JsonOutput +Recommended.Proto3.JsonInput.BytesFieldBase64Url.ProtobufOutput diff -Nru protobuf-3.0.0/conformance/failure_list_java.txt protobuf-3.6.1.3/conformance/failure_list_java.txt --- protobuf-3.0.0/conformance/failure_list_java.txt 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/conformance/failure_list_java.txt 2018-12-08 01:32:11.000000000 +0000 @@ -4,40 +4,44 @@ # By listing them here we can keep tabs on which ones are failing and be sure # that we don't introduce regressions in other tests. -FieldMaskNumbersDontRoundTrip.JsonOutput -FieldMaskPathsDontRoundTrip.JsonOutput -FieldMaskTooManyUnderscore.JsonOutput -JsonInput.BoolFieldAllCapitalFalse -JsonInput.BoolFieldAllCapitalTrue -JsonInput.BoolFieldCamelCaseFalse -JsonInput.BoolFieldCamelCaseTrue -JsonInput.BoolFieldDoubleQuotedFalse -JsonInput.BoolFieldDoubleQuotedTrue -JsonInput.BoolMapFieldKeyNotQuoted -JsonInput.DoubleFieldInfinityNotQuoted -JsonInput.DoubleFieldNanNotQuoted -JsonInput.DoubleFieldNegativeInfinityNotQuoted -JsonInput.EnumFieldNotQuoted -JsonInput.FieldMaskInvalidCharacter -JsonInput.FieldNameDuplicate -JsonInput.FieldNameInSnakeCase.JsonOutput -JsonInput.FieldNameNotQuoted -JsonInput.FloatFieldInfinityNotQuoted -JsonInput.FloatFieldNanNotQuoted -JsonInput.FloatFieldNegativeInfinityNotQuoted -JsonInput.Int32FieldLeadingZero -JsonInput.Int32FieldNegativeWithLeadingZero -JsonInput.Int32FieldPlusSign -JsonInput.Int32MapFieldKeyNotQuoted -JsonInput.Int64MapFieldKeyNotQuoted -JsonInput.JsonWithComments -JsonInput.OriginalProtoFieldName.JsonOutput -JsonInput.RepeatedFieldWrongElementTypeExpectingStringsGotBool -JsonInput.RepeatedFieldWrongElementTypeExpectingStringsGotInt -JsonInput.StringFieldNotAString -JsonInput.StringFieldSurrogateInWrongOrder -JsonInput.StringFieldUnpairedHighSurrogate -JsonInput.StringFieldUnpairedLowSurrogate -JsonInput.StringFieldUppercaseEscapeLetter -JsonInput.Uint32MapFieldKeyNotQuoted -JsonInput.Uint64MapFieldKeyNotQuoted +Recommended.FieldMaskNumbersDontRoundTrip.JsonOutput +Recommended.FieldMaskPathsDontRoundTrip.JsonOutput +Recommended.FieldMaskTooManyUnderscore.JsonOutput +Recommended.Proto3.JsonInput.BoolFieldAllCapitalFalse +Recommended.Proto3.JsonInput.BoolFieldAllCapitalTrue +Recommended.Proto3.JsonInput.BoolFieldCamelCaseFalse +Recommended.Proto3.JsonInput.BoolFieldCamelCaseTrue +Recommended.Proto3.JsonInput.BoolFieldDoubleQuotedFalse +Recommended.Proto3.JsonInput.BoolFieldDoubleQuotedTrue +Recommended.Proto3.JsonInput.BoolMapFieldKeyNotQuoted +Recommended.Proto3.JsonInput.DoubleFieldInfinityNotQuoted +Recommended.Proto3.JsonInput.DoubleFieldNanNotQuoted +Recommended.Proto3.JsonInput.DoubleFieldNegativeInfinityNotQuoted +Recommended.Proto3.JsonInput.FieldMaskInvalidCharacter +Recommended.Proto3.JsonInput.FieldNameDuplicate +Recommended.Proto3.JsonInput.FieldNameNotQuoted +Recommended.Proto3.JsonInput.FloatFieldInfinityNotQuoted +Recommended.Proto3.JsonInput.FloatFieldNanNotQuoted +Recommended.Proto3.JsonInput.FloatFieldNegativeInfinityNotQuoted +Recommended.Proto3.JsonInput.Int32MapFieldKeyNotQuoted +Recommended.Proto3.JsonInput.Int64MapFieldKeyNotQuoted +Recommended.Proto3.JsonInput.JsonWithComments +Recommended.Proto3.JsonInput.StringFieldSingleQuoteBoth +Recommended.Proto3.JsonInput.StringFieldSingleQuoteKey +Recommended.Proto3.JsonInput.StringFieldSingleQuoteValue +Recommended.Proto3.JsonInput.StringFieldSurrogateInWrongOrder +Recommended.Proto3.JsonInput.StringFieldUnpairedHighSurrogate +Recommended.Proto3.JsonInput.StringFieldUnpairedLowSurrogate +Recommended.Proto3.JsonInput.Uint32MapFieldKeyNotQuoted +Recommended.Proto3.JsonInput.Uint64MapFieldKeyNotQuoted +Required.Proto3.JsonInput.EnumFieldNotQuoted +Required.Proto3.JsonInput.Int32FieldLeadingZero +Required.Proto3.JsonInput.Int32FieldNegativeWithLeadingZero +Required.Proto3.JsonInput.Int32FieldPlusSign +Required.Proto3.JsonInput.RepeatedFieldWrongElementTypeExpectingStringsGotBool +Required.Proto3.JsonInput.RepeatedFieldWrongElementTypeExpectingStringsGotInt +Required.Proto3.JsonInput.StringFieldNotAString +Required.Proto3.ProtobufInput.PrematureEofInDelimitedDataForKnownNonRepeatedValue.MESSAGE +Required.Proto3.ProtobufInput.PrematureEofInDelimitedDataForKnownRepeatedValue.MESSAGE +Required.Proto2.ProtobufInput.PrematureEofInDelimitedDataForKnownNonRepeatedValue.MESSAGE +Required.Proto2.ProtobufInput.PrematureEofInDelimitedDataForKnownRepeatedValue.MESSAGE diff -Nru protobuf-3.0.0/conformance/failure_list_js.txt protobuf-3.6.1.3/conformance/failure_list_js.txt --- protobuf-3.0.0/conformance/failure_list_js.txt 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/conformance/failure_list_js.txt 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,13 @@ +Required.Proto3.ProtobufInput.ValidDataRepeated.BOOL.ProtobufOutput +Required.Proto3.ProtobufInput.ValidDataRepeated.DOUBLE.ProtobufOutput +Required.Proto3.ProtobufInput.ValidDataRepeated.FIXED32.ProtobufOutput +Required.Proto3.ProtobufInput.ValidDataRepeated.FIXED64.ProtobufOutput +Required.Proto3.ProtobufInput.ValidDataRepeated.FLOAT.ProtobufOutput +Required.Proto3.ProtobufInput.ValidDataRepeated.INT32.ProtobufOutput +Required.Proto3.ProtobufInput.ValidDataRepeated.INT64.ProtobufOutput +Required.Proto3.ProtobufInput.ValidDataRepeated.SFIXED32.ProtobufOutput +Required.Proto3.ProtobufInput.ValidDataRepeated.SFIXED64.ProtobufOutput +Required.Proto3.ProtobufInput.ValidDataRepeated.SINT32.ProtobufOutput +Required.Proto3.ProtobufInput.ValidDataRepeated.SINT64.ProtobufOutput +Required.Proto3.ProtobufInput.ValidDataRepeated.UINT32.ProtobufOutput +Required.Proto3.ProtobufInput.ValidDataRepeated.UINT64.ProtobufOutput diff -Nru protobuf-3.0.0/conformance/failure_list_objc.txt protobuf-3.6.1.3/conformance/failure_list_objc.txt --- protobuf-3.0.0/conformance/failure_list_objc.txt 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/conformance/failure_list_objc.txt 2018-12-08 01:32:11.000000000 +0000 @@ -1,4 +1,2 @@ -# No tests currently failing. -# -# json input or output tests are skipped (in conformance_objc.m) as mobile -# platforms don't support json wire format to avoid code bloat. +# JSON input or output tests are skipped (in conformance_objc.m) as mobile +# platforms don't support JSON wire format to avoid code bloat. diff -Nru protobuf-3.0.0/conformance/failure_list_php_c.txt protobuf-3.6.1.3/conformance/failure_list_php_c.txt --- protobuf-3.0.0/conformance/failure_list_php_c.txt 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/conformance/failure_list_php_c.txt 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,182 @@ +Recommended.FieldMaskNumbersDontRoundTrip.JsonOutput +Recommended.FieldMaskPathsDontRoundTrip.JsonOutput +Recommended.FieldMaskTooManyUnderscore.JsonOutput +Recommended.Proto3.JsonInput.BoolFieldIntegerOne +Recommended.Proto3.JsonInput.BoolFieldIntegerZero +Recommended.Proto3.JsonInput.DurationHas3FractionalDigits.Validator +Recommended.Proto3.JsonInput.DurationHas6FractionalDigits.Validator +Recommended.Proto3.JsonInput.DurationHas9FractionalDigits.Validator +Recommended.Proto3.JsonInput.DurationHasZeroFractionalDigit.Validator +Recommended.Proto3.JsonInput.Int64FieldBeString.Validator +Recommended.Proto3.JsonInput.MapFieldValueIsNull +Recommended.Proto3.JsonInput.OneofZeroBytes.JsonOutput +Recommended.Proto3.JsonInput.OneofZeroBytes.ProtobufOutput +Recommended.Proto3.JsonInput.OneofZeroString.JsonOutput +Recommended.Proto3.JsonInput.OneofZeroString.ProtobufOutput +Recommended.Proto3.JsonInput.RepeatedFieldMessageElementIsNull +Recommended.Proto3.JsonInput.RepeatedFieldPrimitiveElementIsNull +Recommended.Proto3.JsonInput.StringEndsWithEscapeChar +Recommended.Proto3.JsonInput.StringFieldSurrogateInWrongOrder +Recommended.Proto3.JsonInput.StringFieldUnpairedHighSurrogate +Recommended.Proto3.JsonInput.StringFieldUnpairedLowSurrogate +Recommended.Proto3.JsonInput.Uint64FieldBeString.Validator +Recommended.Proto3.ProtobufInput.OneofZeroBytes.JsonOutput +Recommended.Proto3.ProtobufInput.OneofZeroBytes.ProtobufOutput +Recommended.Proto3.ProtobufInput.OneofZeroString.JsonOutput +Recommended.Proto3.ProtobufInput.OneofZeroString.ProtobufOutput +Required.DurationProtoInputTooLarge.JsonOutput +Required.DurationProtoInputTooSmall.JsonOutput +Required.Proto3.JsonInput.Any.JsonOutput +Required.Proto3.JsonInput.Any.ProtobufOutput +Required.Proto3.JsonInput.AnyNested.JsonOutput +Required.Proto3.JsonInput.AnyNested.ProtobufOutput +Required.Proto3.JsonInput.AnyUnorderedTypeTag.JsonOutput +Required.Proto3.JsonInput.AnyUnorderedTypeTag.ProtobufOutput +Required.Proto3.JsonInput.AnyWithDuration.JsonOutput +Required.Proto3.JsonInput.AnyWithDuration.ProtobufOutput +Required.Proto3.JsonInput.AnyWithFieldMask.JsonOutput +Required.Proto3.JsonInput.AnyWithFieldMask.ProtobufOutput +Required.Proto3.JsonInput.AnyWithInt32ValueWrapper.JsonOutput +Required.Proto3.JsonInput.AnyWithInt32ValueWrapper.ProtobufOutput +Required.Proto3.JsonInput.AnyWithStruct.JsonOutput +Required.Proto3.JsonInput.AnyWithStruct.ProtobufOutput +Required.Proto3.JsonInput.AnyWithTimestamp.JsonOutput +Required.Proto3.JsonInput.AnyWithTimestamp.ProtobufOutput +Required.Proto3.JsonInput.AnyWithValueForInteger.JsonOutput +Required.Proto3.JsonInput.AnyWithValueForInteger.ProtobufOutput +Required.Proto3.JsonInput.AnyWithValueForJsonObject.JsonOutput +Required.Proto3.JsonInput.AnyWithValueForJsonObject.ProtobufOutput +Required.Proto3.JsonInput.BoolMapField.JsonOutput +Required.Proto3.JsonInput.DoubleFieldInfinity.JsonOutput +Required.Proto3.JsonInput.DoubleFieldInfinity.ProtobufOutput +Required.Proto3.JsonInput.DoubleFieldMaxNegativeValue.JsonOutput +Required.Proto3.JsonInput.DoubleFieldMaxNegativeValue.ProtobufOutput +Required.Proto3.JsonInput.DoubleFieldMaxPositiveValue.JsonOutput +Required.Proto3.JsonInput.DoubleFieldMaxPositiveValue.ProtobufOutput +Required.Proto3.JsonInput.DoubleFieldMinNegativeValue.JsonOutput +Required.Proto3.JsonInput.DoubleFieldMinNegativeValue.ProtobufOutput +Required.Proto3.JsonInput.DoubleFieldMinPositiveValue.JsonOutput +Required.Proto3.JsonInput.DoubleFieldMinPositiveValue.ProtobufOutput +Required.Proto3.JsonInput.DoubleFieldNan.JsonOutput +Required.Proto3.JsonInput.DoubleFieldNan.ProtobufOutput +Required.Proto3.JsonInput.DoubleFieldNegativeInfinity.JsonOutput +Required.Proto3.JsonInput.DoubleFieldNegativeInfinity.ProtobufOutput +Required.Proto3.JsonInput.DoubleFieldQuotedValue.JsonOutput +Required.Proto3.JsonInput.DoubleFieldQuotedValue.ProtobufOutput +Required.Proto3.JsonInput.DurationMaxValue.JsonOutput +Required.Proto3.JsonInput.DurationMaxValue.ProtobufOutput +Required.Proto3.JsonInput.DurationMinValue.JsonOutput +Required.Proto3.JsonInput.DurationMinValue.ProtobufOutput +Required.Proto3.JsonInput.DurationRepeatedValue.JsonOutput +Required.Proto3.JsonInput.DurationRepeatedValue.ProtobufOutput +Required.Proto3.JsonInput.EnumFieldNumericValueNonZero.JsonOutput +Required.Proto3.JsonInput.EnumFieldNumericValueNonZero.ProtobufOutput +Required.Proto3.JsonInput.EnumFieldNumericValueZero.JsonOutput +Required.Proto3.JsonInput.EnumFieldNumericValueZero.ProtobufOutput +Required.Proto3.JsonInput.EnumFieldUnknownValue.Validator +Required.Proto3.JsonInput.FieldMask.JsonOutput +Required.Proto3.JsonInput.FieldMask.ProtobufOutput +Required.Proto3.JsonInput.FloatFieldInfinity.JsonOutput +Required.Proto3.JsonInput.FloatFieldInfinity.ProtobufOutput +Required.Proto3.JsonInput.FloatFieldNan.JsonOutput +Required.Proto3.JsonInput.FloatFieldNan.ProtobufOutput +Required.Proto3.JsonInput.FloatFieldNegativeInfinity.JsonOutput +Required.Proto3.JsonInput.FloatFieldNegativeInfinity.ProtobufOutput +Required.Proto3.JsonInput.FloatFieldQuotedValue.JsonOutput +Required.Proto3.JsonInput.FloatFieldQuotedValue.ProtobufOutput +Required.Proto3.JsonInput.FloatFieldTooLarge +Required.Proto3.JsonInput.FloatFieldTooSmall +Required.Proto3.JsonInput.Int32FieldExponentialFormat.JsonOutput +Required.Proto3.JsonInput.Int32FieldExponentialFormat.ProtobufOutput +Required.Proto3.JsonInput.Int32FieldFloatTrailingZero.JsonOutput +Required.Proto3.JsonInput.Int32FieldFloatTrailingZero.ProtobufOutput +Required.Proto3.JsonInput.Int32FieldMaxFloatValue.JsonOutput +Required.Proto3.JsonInput.Int32FieldMaxFloatValue.ProtobufOutput +Required.Proto3.JsonInput.Int32FieldMinFloatValue.JsonOutput +Required.Proto3.JsonInput.Int32FieldMinFloatValue.ProtobufOutput +Required.Proto3.JsonInput.Int32FieldStringValue.JsonOutput +Required.Proto3.JsonInput.Int32FieldStringValue.ProtobufOutput +Required.Proto3.JsonInput.Int32FieldStringValueEscaped.JsonOutput +Required.Proto3.JsonInput.Int32FieldStringValueEscaped.ProtobufOutput +Required.Proto3.JsonInput.Int64FieldMaxValue.JsonOutput +Required.Proto3.JsonInput.Int64FieldMaxValue.ProtobufOutput +Required.Proto3.JsonInput.Int64FieldMinValue.JsonOutput +Required.Proto3.JsonInput.Int64FieldMinValue.ProtobufOutput +Required.Proto3.JsonInput.MessageField.JsonOutput +Required.Proto3.JsonInput.MessageField.ProtobufOutput +Required.Proto3.JsonInput.OptionalBoolWrapper.JsonOutput +Required.Proto3.JsonInput.OptionalBoolWrapper.ProtobufOutput +Required.Proto3.JsonInput.OptionalBytesWrapper.JsonOutput +Required.Proto3.JsonInput.OptionalBytesWrapper.ProtobufOutput +Required.Proto3.JsonInput.OptionalDoubleWrapper.JsonOutput +Required.Proto3.JsonInput.OptionalDoubleWrapper.ProtobufOutput +Required.Proto3.JsonInput.OptionalFloatWrapper.JsonOutput +Required.Proto3.JsonInput.OptionalFloatWrapper.ProtobufOutput +Required.Proto3.JsonInput.OptionalInt32Wrapper.JsonOutput +Required.Proto3.JsonInput.OptionalInt32Wrapper.ProtobufOutput +Required.Proto3.JsonInput.OptionalInt64Wrapper.JsonOutput +Required.Proto3.JsonInput.OptionalInt64Wrapper.ProtobufOutput +Required.Proto3.JsonInput.OptionalStringWrapper.JsonOutput +Required.Proto3.JsonInput.OptionalStringWrapper.ProtobufOutput +Required.Proto3.JsonInput.OptionalUint32Wrapper.JsonOutput +Required.Proto3.JsonInput.OptionalUint32Wrapper.ProtobufOutput +Required.Proto3.JsonInput.OptionalUint64Wrapper.JsonOutput +Required.Proto3.JsonInput.OptionalUint64Wrapper.ProtobufOutput +Required.Proto3.JsonInput.OptionalWrapperTypesWithNonDefaultValue.JsonOutput +Required.Proto3.JsonInput.OptionalWrapperTypesWithNonDefaultValue.ProtobufOutput +Required.Proto3.JsonInput.RepeatedBoolWrapper.JsonOutput +Required.Proto3.JsonInput.RepeatedBoolWrapper.ProtobufOutput +Required.Proto3.JsonInput.RepeatedBytesWrapper.JsonOutput +Required.Proto3.JsonInput.RepeatedBytesWrapper.ProtobufOutput +Required.Proto3.JsonInput.RepeatedDoubleWrapper.JsonOutput +Required.Proto3.JsonInput.RepeatedDoubleWrapper.ProtobufOutput +Required.Proto3.JsonInput.RepeatedFieldWrongElementTypeExpectingMessagesGotInt +Required.Proto3.JsonInput.RepeatedFieldWrongElementTypeExpectingStringsGotInt +Required.Proto3.JsonInput.RepeatedFloatWrapper.JsonOutput +Required.Proto3.JsonInput.RepeatedFloatWrapper.ProtobufOutput +Required.Proto3.JsonInput.RepeatedInt32Wrapper.JsonOutput +Required.Proto3.JsonInput.RepeatedInt32Wrapper.ProtobufOutput +Required.Proto3.JsonInput.RepeatedInt64Wrapper.JsonOutput +Required.Proto3.JsonInput.RepeatedInt64Wrapper.ProtobufOutput +Required.Proto3.JsonInput.RepeatedStringWrapper.JsonOutput +Required.Proto3.JsonInput.RepeatedStringWrapper.ProtobufOutput +Required.Proto3.JsonInput.RepeatedUint32Wrapper.JsonOutput +Required.Proto3.JsonInput.RepeatedUint32Wrapper.ProtobufOutput +Required.Proto3.JsonInput.RepeatedUint64Wrapper.JsonOutput +Required.Proto3.JsonInput.RepeatedUint64Wrapper.ProtobufOutput +Required.Proto3.JsonInput.StringFieldEscape.JsonOutput +Required.Proto3.JsonInput.StringFieldEscape.ProtobufOutput +Required.Proto3.JsonInput.StringFieldNotAString +Required.Proto3.JsonInput.StringFieldSurrogatePair.JsonOutput +Required.Proto3.JsonInput.StringFieldSurrogatePair.ProtobufOutput +Required.Proto3.JsonInput.StringFieldUnicodeEscape.JsonOutput +Required.Proto3.JsonInput.StringFieldUnicodeEscape.ProtobufOutput +Required.Proto3.JsonInput.StringFieldUnicodeEscapeWithLowercaseHexLetters.JsonOutput +Required.Proto3.JsonInput.StringFieldUnicodeEscapeWithLowercaseHexLetters.ProtobufOutput +Required.Proto3.JsonInput.Struct.JsonOutput +Required.Proto3.JsonInput.Struct.ProtobufOutput +Required.Proto3.JsonInput.Uint32FieldMaxFloatValue.JsonOutput +Required.Proto3.JsonInput.Uint32FieldMaxFloatValue.ProtobufOutput +Required.Proto3.JsonInput.Uint64FieldMaxValue.JsonOutput +Required.Proto3.JsonInput.Uint64FieldMaxValue.ProtobufOutput +Required.Proto3.JsonInput.ValueAcceptBool.JsonOutput +Required.Proto3.JsonInput.ValueAcceptBool.ProtobufOutput +Required.Proto3.JsonInput.ValueAcceptFloat.JsonOutput +Required.Proto3.JsonInput.ValueAcceptFloat.ProtobufOutput +Required.Proto3.JsonInput.ValueAcceptInteger.JsonOutput +Required.Proto3.JsonInput.ValueAcceptInteger.ProtobufOutput +Required.Proto3.JsonInput.ValueAcceptList.JsonOutput +Required.Proto3.JsonInput.ValueAcceptList.ProtobufOutput +Required.Proto3.JsonInput.ValueAcceptNull.JsonOutput +Required.Proto3.JsonInput.ValueAcceptNull.ProtobufOutput +Required.Proto3.JsonInput.ValueAcceptObject.JsonOutput +Required.Proto3.JsonInput.ValueAcceptObject.ProtobufOutput +Required.Proto3.JsonInput.ValueAcceptString.JsonOutput +Required.Proto3.JsonInput.ValueAcceptString.ProtobufOutput +Required.Proto3.ProtobufInput.DoubleFieldNormalizeQuietNan.JsonOutput +Required.Proto3.ProtobufInput.DoubleFieldNormalizeSignalingNan.JsonOutput +Required.Proto3.ProtobufInput.FloatFieldNormalizeQuietNan.JsonOutput +Required.Proto3.ProtobufInput.FloatFieldNormalizeSignalingNan.JsonOutput +Required.Proto3.ProtobufInput.ValidDataRepeated.FLOAT.JsonOutput +Required.TimestampProtoInputTooLarge.JsonOutput +Required.TimestampProtoInputTooSmall.JsonOutput diff -Nru protobuf-3.0.0/conformance/failure_list_php.txt protobuf-3.6.1.3/conformance/failure_list_php.txt --- protobuf-3.0.0/conformance/failure_list_php.txt 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/conformance/failure_list_php.txt 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,20 @@ +Recommended.FieldMaskNumbersDontRoundTrip.JsonOutput +Recommended.FieldMaskPathsDontRoundTrip.JsonOutput +Recommended.FieldMaskTooManyUnderscore.JsonOutput +Recommended.Proto3.JsonInput.BytesFieldBase64Url.JsonOutput +Recommended.Proto3.JsonInput.BytesFieldBase64Url.ProtobufOutput +Recommended.Proto3.JsonInput.DurationHas3FractionalDigits.Validator +Recommended.Proto3.JsonInput.DurationHas6FractionalDigits.Validator +Recommended.Proto3.JsonInput.DurationHas9FractionalDigits.Validator +Recommended.Proto3.JsonInput.DurationHasZeroFractionalDigit.Validator +Recommended.Proto3.JsonInput.FieldMaskInvalidCharacter +Required.Proto3.JsonInput.FloatFieldTooLarge +Required.Proto3.JsonInput.FloatFieldTooSmall +Required.Proto3.JsonInput.DoubleFieldTooSmall +Required.Proto3.JsonInput.Int32FieldNotInteger +Required.Proto3.JsonInput.Int64FieldNotInteger +Required.Proto3.JsonInput.Uint32FieldNotInteger +Required.Proto3.JsonInput.Uint64FieldNotInteger +Required.Proto3.JsonInput.Int32FieldLeadingSpace +Required.Proto3.JsonInput.OneofFieldDuplicate +Required.Proto3.ProtobufInput.ValidDataRepeated.FLOAT.JsonOutput diff -Nru protobuf-3.0.0/conformance/failure_list_php_zts_c.txt protobuf-3.6.1.3/conformance/failure_list_php_zts_c.txt --- protobuf-3.0.0/conformance/failure_list_php_zts_c.txt 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/conformance/failure_list_php_zts_c.txt 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,225 @@ +Recommended.FieldMaskNumbersDontRoundTrip.JsonOutput +Recommended.FieldMaskPathsDontRoundTrip.JsonOutput +Recommended.FieldMaskTooManyUnderscore.JsonOutput +Recommended.JsonInput.BoolFieldIntegerOne +Recommended.JsonInput.BoolFieldIntegerZero +Recommended.JsonInput.DurationHas3FractionalDigits.Validator +Recommended.JsonInput.DurationHas6FractionalDigits.Validator +Recommended.JsonInput.DurationHas9FractionalDigits.Validator +Recommended.JsonInput.DurationHasZeroFractionalDigit.Validator +Recommended.JsonInput.Int64FieldBeString.Validator +Recommended.JsonInput.OneofZeroBytes.JsonOutput +Recommended.JsonInput.OneofZeroBytes.ProtobufOutput +Recommended.JsonInput.OneofZeroDouble.JsonOutput +Recommended.JsonInput.OneofZeroDouble.ProtobufOutput +Recommended.JsonInput.OneofZeroFloat.JsonOutput +Recommended.JsonInput.OneofZeroFloat.ProtobufOutput +Recommended.JsonInput.OneofZeroString.JsonOutput +Recommended.JsonInput.OneofZeroString.ProtobufOutput +Recommended.JsonInput.OneofZeroUint32.JsonOutput +Recommended.JsonInput.OneofZeroUint32.ProtobufOutput +Recommended.JsonInput.OneofZeroUint64.JsonOutput +Recommended.JsonInput.OneofZeroUint64.ProtobufOutput +Recommended.JsonInput.StringEndsWithEscapeChar +Recommended.JsonInput.StringFieldSurrogateInWrongOrder +Recommended.JsonInput.StringFieldUnpairedHighSurrogate +Recommended.JsonInput.StringFieldUnpairedLowSurrogate +Recommended.JsonInput.TimestampHas3FractionalDigits.Validator +Recommended.JsonInput.TimestampHas6FractionalDigits.Validator +Recommended.JsonInput.TimestampHas9FractionalDigits.Validator +Recommended.JsonInput.TimestampHasZeroFractionalDigit.Validator +Recommended.JsonInput.TimestampZeroNormalized.Validator +Recommended.JsonInput.Uint64FieldBeString.Validator +Recommended.ProtobufInput.OneofZeroBytes.JsonOutput +Recommended.ProtobufInput.OneofZeroBytes.ProtobufOutput +Recommended.ProtobufInput.OneofZeroString.JsonOutput +Recommended.ProtobufInput.OneofZeroString.ProtobufOutput +Required.DurationProtoInputTooLarge.JsonOutput +Required.DurationProtoInputTooSmall.JsonOutput +Required.JsonInput.AllFieldAcceptNull.ProtobufOutput +Required.JsonInput.Any.JsonOutput +Required.JsonInput.Any.ProtobufOutput +Required.JsonInput.AnyNested.JsonOutput +Required.JsonInput.AnyNested.ProtobufOutput +Required.JsonInput.AnyUnorderedTypeTag.JsonOutput +Required.JsonInput.AnyUnorderedTypeTag.ProtobufOutput +Required.JsonInput.AnyWithDuration.JsonOutput +Required.JsonInput.AnyWithDuration.ProtobufOutput +Required.JsonInput.AnyWithFieldMask.JsonOutput +Required.JsonInput.AnyWithFieldMask.ProtobufOutput +Required.JsonInput.AnyWithInt32ValueWrapper.JsonOutput +Required.JsonInput.AnyWithInt32ValueWrapper.ProtobufOutput +Required.JsonInput.AnyWithStruct.JsonOutput +Required.JsonInput.AnyWithStruct.ProtobufOutput +Required.JsonInput.AnyWithTimestamp.JsonOutput +Required.JsonInput.AnyWithTimestamp.ProtobufOutput +Required.JsonInput.AnyWithValueForInteger.JsonOutput +Required.JsonInput.AnyWithValueForInteger.ProtobufOutput +Required.JsonInput.AnyWithValueForJsonObject.JsonOutput +Required.JsonInput.AnyWithValueForJsonObject.ProtobufOutput +Required.JsonInput.BoolFieldFalse.ProtobufOutput +Required.JsonInput.BoolMapField.JsonOutput +Required.JsonInput.DoubleFieldInfinity.JsonOutput +Required.JsonInput.DoubleFieldInfinity.ProtobufOutput +Required.JsonInput.DoubleFieldMaxNegativeValue.JsonOutput +Required.JsonInput.DoubleFieldMaxNegativeValue.ProtobufOutput +Required.JsonInput.DoubleFieldMaxPositiveValue.JsonOutput +Required.JsonInput.DoubleFieldMaxPositiveValue.ProtobufOutput +Required.JsonInput.DoubleFieldMinNegativeValue.JsonOutput +Required.JsonInput.DoubleFieldMinNegativeValue.ProtobufOutput +Required.JsonInput.DoubleFieldMinPositiveValue.JsonOutput +Required.JsonInput.DoubleFieldMinPositiveValue.ProtobufOutput +Required.JsonInput.DoubleFieldNan.JsonOutput +Required.JsonInput.DoubleFieldNan.ProtobufOutput +Required.JsonInput.DoubleFieldNegativeInfinity.JsonOutput +Required.JsonInput.DoubleFieldNegativeInfinity.ProtobufOutput +Required.JsonInput.DoubleFieldQuotedValue.JsonOutput +Required.JsonInput.DoubleFieldQuotedValue.ProtobufOutput +Required.JsonInput.DurationMaxValue.JsonOutput +Required.JsonInput.DurationMaxValue.ProtobufOutput +Required.JsonInput.DurationMinValue.JsonOutput +Required.JsonInput.DurationMinValue.ProtobufOutput +Required.JsonInput.DurationRepeatedValue.JsonOutput +Required.JsonInput.DurationRepeatedValue.ProtobufOutput +Required.JsonInput.EnumField.ProtobufOutput +Required.JsonInput.EnumFieldNumericValueNonZero.JsonOutput +Required.JsonInput.EnumFieldNumericValueNonZero.ProtobufOutput +Required.JsonInput.EnumFieldNumericValueZero.JsonOutput +Required.JsonInput.EnumFieldNumericValueZero.ProtobufOutput +Required.JsonInput.EnumFieldUnknownValue.Validator +Required.JsonInput.FieldMask.JsonOutput +Required.JsonInput.FieldMask.ProtobufOutput +Required.JsonInput.FloatFieldInfinity.JsonOutput +Required.JsonInput.FloatFieldInfinity.ProtobufOutput +Required.JsonInput.FloatFieldNan.JsonOutput +Required.JsonInput.FloatFieldNan.ProtobufOutput +Required.JsonInput.FloatFieldNegativeInfinity.JsonOutput +Required.JsonInput.FloatFieldNegativeInfinity.ProtobufOutput +Required.JsonInput.FloatFieldQuotedValue.JsonOutput +Required.JsonInput.FloatFieldQuotedValue.ProtobufOutput +Required.JsonInput.FloatFieldTooLarge +Required.JsonInput.FloatFieldTooSmall +Required.JsonInput.Int32FieldExponentialFormat.JsonOutput +Required.JsonInput.Int32FieldExponentialFormat.ProtobufOutput +Required.JsonInput.Int32FieldFloatTrailingZero.JsonOutput +Required.JsonInput.Int32FieldFloatTrailingZero.ProtobufOutput +Required.JsonInput.Int32FieldMaxFloatValue.JsonOutput +Required.JsonInput.Int32FieldMaxFloatValue.ProtobufOutput +Required.JsonInput.Int32FieldMinFloatValue.JsonOutput +Required.JsonInput.Int32FieldMinFloatValue.ProtobufOutput +Required.JsonInput.Int32FieldStringValue.JsonOutput +Required.JsonInput.Int32FieldStringValue.ProtobufOutput +Required.JsonInput.Int32FieldStringValueEscaped.JsonOutput +Required.JsonInput.Int32FieldStringValueEscaped.ProtobufOutput +Required.JsonInput.Int32MapEscapedKey.JsonOutput +Required.JsonInput.Int32MapEscapedKey.ProtobufOutput +Required.JsonInput.Int32MapField.JsonOutput +Required.JsonInput.Int32MapField.ProtobufOutput +Required.JsonInput.Int64FieldMaxValue.JsonOutput +Required.JsonInput.Int64FieldMaxValue.ProtobufOutput +Required.JsonInput.Int64FieldMinValue.JsonOutput +Required.JsonInput.Int64FieldMinValue.ProtobufOutput +Required.JsonInput.Int64MapEscapedKey.JsonOutput +Required.JsonInput.Int64MapEscapedKey.ProtobufOutput +Required.JsonInput.Int64MapField.JsonOutput +Required.JsonInput.Int64MapField.ProtobufOutput +Required.JsonInput.MessageField.JsonOutput +Required.JsonInput.MessageField.ProtobufOutput +Required.JsonInput.MessageMapField.JsonOutput +Required.JsonInput.MessageMapField.ProtobufOutput +Required.JsonInput.MessageRepeatedField.JsonOutput +Required.JsonInput.MessageRepeatedField.ProtobufOutput +Required.JsonInput.OptionalBoolWrapper.JsonOutput +Required.JsonInput.OptionalBoolWrapper.ProtobufOutput +Required.JsonInput.OptionalBytesWrapper.JsonOutput +Required.JsonInput.OptionalBytesWrapper.ProtobufOutput +Required.JsonInput.OptionalDoubleWrapper.JsonOutput +Required.JsonInput.OptionalDoubleWrapper.ProtobufOutput +Required.JsonInput.OptionalFloatWrapper.JsonOutput +Required.JsonInput.OptionalFloatWrapper.ProtobufOutput +Required.JsonInput.OptionalInt32Wrapper.JsonOutput +Required.JsonInput.OptionalInt32Wrapper.ProtobufOutput +Required.JsonInput.OptionalInt64Wrapper.JsonOutput +Required.JsonInput.OptionalInt64Wrapper.ProtobufOutput +Required.JsonInput.OptionalStringWrapper.JsonOutput +Required.JsonInput.OptionalStringWrapper.ProtobufOutput +Required.JsonInput.OptionalUint32Wrapper.JsonOutput +Required.JsonInput.OptionalUint32Wrapper.ProtobufOutput +Required.JsonInput.OptionalUint64Wrapper.JsonOutput +Required.JsonInput.OptionalUint64Wrapper.ProtobufOutput +Required.JsonInput.OptionalWrapperTypesWithNonDefaultValue.JsonOutput +Required.JsonInput.OptionalWrapperTypesWithNonDefaultValue.ProtobufOutput +Required.JsonInput.PrimitiveRepeatedField.JsonOutput +Required.JsonInput.PrimitiveRepeatedField.ProtobufOutput +Required.JsonInput.RepeatedBoolWrapper.JsonOutput +Required.JsonInput.RepeatedBoolWrapper.ProtobufOutput +Required.JsonInput.RepeatedBytesWrapper.JsonOutput +Required.JsonInput.RepeatedBytesWrapper.ProtobufOutput +Required.JsonInput.RepeatedDoubleWrapper.JsonOutput +Required.JsonInput.RepeatedDoubleWrapper.ProtobufOutput +Required.JsonInput.RepeatedFieldWrongElementTypeExpectingStringsGotInt +Required.JsonInput.RepeatedFloatWrapper.JsonOutput +Required.JsonInput.RepeatedFloatWrapper.ProtobufOutput +Required.JsonInput.RepeatedInt32Wrapper.JsonOutput +Required.JsonInput.RepeatedInt32Wrapper.ProtobufOutput +Required.JsonInput.RepeatedInt64Wrapper.JsonOutput +Required.JsonInput.RepeatedInt64Wrapper.ProtobufOutput +Required.JsonInput.RepeatedStringWrapper.JsonOutput +Required.JsonInput.RepeatedStringWrapper.ProtobufOutput +Required.JsonInput.RepeatedUint32Wrapper.JsonOutput +Required.JsonInput.RepeatedUint32Wrapper.ProtobufOutput +Required.JsonInput.RepeatedUint64Wrapper.JsonOutput +Required.JsonInput.RepeatedUint64Wrapper.ProtobufOutput +Required.JsonInput.StringFieldEscape.JsonOutput +Required.JsonInput.StringFieldEscape.ProtobufOutput +Required.JsonInput.StringFieldNotAString +Required.JsonInput.StringFieldSurrogatePair.JsonOutput +Required.JsonInput.StringFieldSurrogatePair.ProtobufOutput +Required.JsonInput.StringFieldUnicodeEscape.JsonOutput +Required.JsonInput.StringFieldUnicodeEscape.ProtobufOutput +Required.JsonInput.StringFieldUnicodeEscapeWithLowercaseHexLetters.JsonOutput +Required.JsonInput.StringFieldUnicodeEscapeWithLowercaseHexLetters.ProtobufOutput +Required.JsonInput.Struct.JsonOutput +Required.JsonInput.Struct.ProtobufOutput +Required.JsonInput.TimestampMaxValue.JsonOutput +Required.JsonInput.TimestampMaxValue.ProtobufOutput +Required.JsonInput.TimestampMinValue.JsonOutput +Required.JsonInput.TimestampMinValue.ProtobufOutput +Required.JsonInput.TimestampRepeatedValue.JsonOutput +Required.JsonInput.TimestampRepeatedValue.ProtobufOutput +Required.JsonInput.TimestampWithNegativeOffset.JsonOutput +Required.JsonInput.TimestampWithNegativeOffset.ProtobufOutput +Required.JsonInput.TimestampWithPositiveOffset.JsonOutput +Required.JsonInput.TimestampWithPositiveOffset.ProtobufOutput +Required.JsonInput.Uint32FieldMaxFloatValue.JsonOutput +Required.JsonInput.Uint32FieldMaxFloatValue.ProtobufOutput +Required.JsonInput.Uint32MapField.JsonOutput +Required.JsonInput.Uint32MapField.ProtobufOutput +Required.JsonInput.Uint64FieldMaxValue.JsonOutput +Required.JsonInput.Uint64FieldMaxValue.ProtobufOutput +Required.JsonInput.Uint64MapField.JsonOutput +Required.JsonInput.Uint64MapField.ProtobufOutput +Required.JsonInput.ValueAcceptBool.JsonOutput +Required.JsonInput.ValueAcceptBool.ProtobufOutput +Required.JsonInput.ValueAcceptFloat.JsonOutput +Required.JsonInput.ValueAcceptFloat.ProtobufOutput +Required.JsonInput.ValueAcceptInteger.JsonOutput +Required.JsonInput.ValueAcceptInteger.ProtobufOutput +Required.JsonInput.ValueAcceptList.JsonOutput +Required.JsonInput.ValueAcceptList.ProtobufOutput +Required.JsonInput.ValueAcceptNull.JsonOutput +Required.JsonInput.ValueAcceptNull.ProtobufOutput +Required.JsonInput.ValueAcceptObject.JsonOutput +Required.JsonInput.ValueAcceptObject.ProtobufOutput +Required.JsonInput.ValueAcceptString.JsonOutput +Required.JsonInput.ValueAcceptString.ProtobufOutput +Required.JsonInput.WrapperTypesWithNullValue.ProtobufOutput +Required.ProtobufInput.DoubleFieldNormalizeQuietNan.JsonOutput +Required.ProtobufInput.DoubleFieldNormalizeSignalingNan.JsonOutput +Required.ProtobufInput.FloatFieldNormalizeQuietNan.JsonOutput +Required.ProtobufInput.FloatFieldNormalizeSignalingNan.JsonOutput +Required.ProtobufInput.RepeatedScalarSelectsLast.FIXED32.ProtobufOutput +Required.ProtobufInput.RepeatedScalarSelectsLast.FIXED64.ProtobufOutput +Required.ProtobufInput.RepeatedScalarSelectsLast.UINT64.ProtobufOutput +Required.TimestampProtoInputTooLarge.JsonOutput +Required.TimestampProtoInputTooSmall.JsonOutput diff -Nru protobuf-3.0.0/conformance/failure_list_python_cpp.txt protobuf-3.6.1.3/conformance/failure_list_python_cpp.txt --- protobuf-3.0.0/conformance/failure_list_python_cpp.txt 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/conformance/failure_list_python_cpp.txt 2018-12-08 01:32:11.000000000 +0000 @@ -7,66 +7,48 @@ # TODO(haberman): insert links to corresponding bugs tracking the issue. # Should we use GitHub issues or the Google-internal bug tracker? -DurationProtoInputTooLarge.JsonOutput -DurationProtoInputTooSmall.JsonOutput -FieldMaskNumbersDontRoundTrip.JsonOutput -FieldMaskPathsDontRoundTrip.JsonOutput -FieldMaskTooManyUnderscore.JsonOutput -JsonInput.AnyWithFieldMask.ProtobufOutput -JsonInput.BytesFieldInvalidBase64Characters -JsonInput.DoubleFieldInfinityNotQuoted -JsonInput.DoubleFieldNanNotQuoted -JsonInput.DoubleFieldNegativeInfinityNotQuoted -JsonInput.DoubleFieldTooSmall -JsonInput.DurationJsonInputTooLarge -JsonInput.DurationJsonInputTooSmall -JsonInput.DurationMissingS -JsonInput.EnumFieldNumericValueNonZero.JsonOutput -JsonInput.EnumFieldNumericValueNonZero.ProtobufOutput -JsonInput.EnumFieldNumericValueZero.JsonOutput -JsonInput.EnumFieldNumericValueZero.ProtobufOutput -JsonInput.EnumFieldUnknownValue.Validator -JsonInput.FieldMask.ProtobufOutput -JsonInput.FieldMaskInvalidCharacter -JsonInput.FieldNameInLowerCamelCase.Validator -JsonInput.FieldNameInSnakeCase.JsonOutput -JsonInput.FieldNameInSnakeCase.ProtobufOutput -JsonInput.FloatFieldInfinityNotQuoted -JsonInput.FloatFieldNanNotQuoted -JsonInput.FloatFieldNegativeInfinityNotQuoted -JsonInput.FloatFieldTooLarge -JsonInput.FloatFieldTooSmall -JsonInput.Int32FieldExponentialFormat.JsonOutput -JsonInput.Int32FieldExponentialFormat.ProtobufOutput -JsonInput.Int32FieldFloatTrailingZero.JsonOutput -JsonInput.Int32FieldFloatTrailingZero.ProtobufOutput -JsonInput.Int32FieldMaxFloatValue.JsonOutput -JsonInput.Int32FieldMaxFloatValue.ProtobufOutput -JsonInput.Int32FieldMinFloatValue.JsonOutput -JsonInput.Int32FieldMinFloatValue.ProtobufOutput -JsonInput.OriginalProtoFieldName.JsonOutput -JsonInput.OriginalProtoFieldName.ProtobufOutput -JsonInput.RepeatedFieldWrongElementTypeExpectingIntegersGotBool -JsonInput.TimestampJsonInputLowercaseT -JsonInput.Uint32FieldMaxFloatValue.JsonOutput -JsonInput.Uint32FieldMaxFloatValue.ProtobufOutput -JsonInput.ValueAcceptNull.JsonOutput -JsonInput.ValueAcceptNull.ProtobufOutput -ProtobufInput.PrematureEofInDelimitedDataForKnownNonRepeatedValue.MESSAGE -ProtobufInput.PrematureEofInDelimitedDataForKnownRepeatedValue.MESSAGE -ProtobufInput.PrematureEofInPackedField.BOOL -ProtobufInput.PrematureEofInPackedField.DOUBLE -ProtobufInput.PrematureEofInPackedField.ENUM -ProtobufInput.PrematureEofInPackedField.FIXED32 -ProtobufInput.PrematureEofInPackedField.FIXED64 -ProtobufInput.PrematureEofInPackedField.FLOAT -ProtobufInput.PrematureEofInPackedField.INT32 -ProtobufInput.PrematureEofInPackedField.INT64 -ProtobufInput.PrematureEofInPackedField.SFIXED32 -ProtobufInput.PrematureEofInPackedField.SFIXED64 -ProtobufInput.PrematureEofInPackedField.SINT32 -ProtobufInput.PrematureEofInPackedField.SINT64 -ProtobufInput.PrematureEofInPackedField.UINT32 -ProtobufInput.PrematureEofInPackedField.UINT64 -TimestampProtoInputTooLarge.JsonOutput -TimestampProtoInputTooSmall.JsonOutput +Recommended.Proto3.JsonInput.BytesFieldBase64Url.JsonOutput +Recommended.Proto3.JsonInput.BytesFieldBase64Url.ProtobufOutput +Recommended.Proto3.JsonInput.DoubleFieldInfinityNotQuoted +Recommended.Proto3.JsonInput.DoubleFieldNanNotQuoted +Recommended.Proto3.JsonInput.DoubleFieldNegativeInfinityNotQuoted +Recommended.Proto3.JsonInput.FloatFieldInfinityNotQuoted +Recommended.Proto3.JsonInput.FloatFieldNanNotQuoted +Recommended.Proto3.JsonInput.FloatFieldNegativeInfinityNotQuoted +Required.Proto3.JsonInput.DoubleFieldTooSmall +Required.Proto3.JsonInput.FloatFieldTooLarge +Required.Proto3.JsonInput.FloatFieldTooSmall +Required.Proto3.JsonInput.RepeatedFieldWrongElementTypeExpectingIntegersGotBool +Required.Proto3.JsonInput.TimestampJsonInputLowercaseT +Required.Proto3.ProtobufInput.PrematureEofInDelimitedDataForKnownNonRepeatedValue.MESSAGE +Required.Proto3.ProtobufInput.PrematureEofInDelimitedDataForKnownRepeatedValue.MESSAGE +Required.Proto3.ProtobufInput.PrematureEofInPackedField.BOOL +Required.Proto3.ProtobufInput.PrematureEofInPackedField.DOUBLE +Required.Proto3.ProtobufInput.PrematureEofInPackedField.ENUM +Required.Proto3.ProtobufInput.PrematureEofInPackedField.FIXED32 +Required.Proto3.ProtobufInput.PrematureEofInPackedField.FIXED64 +Required.Proto3.ProtobufInput.PrematureEofInPackedField.FLOAT +Required.Proto3.ProtobufInput.PrematureEofInPackedField.INT32 +Required.Proto3.ProtobufInput.PrematureEofInPackedField.INT64 +Required.Proto3.ProtobufInput.PrematureEofInPackedField.SFIXED32 +Required.Proto3.ProtobufInput.PrematureEofInPackedField.SFIXED64 +Required.Proto3.ProtobufInput.PrematureEofInPackedField.SINT32 +Required.Proto3.ProtobufInput.PrematureEofInPackedField.SINT64 +Required.Proto3.ProtobufInput.PrematureEofInPackedField.UINT32 +Required.Proto3.ProtobufInput.PrematureEofInPackedField.UINT64 +Required.Proto2.ProtobufInput.PrematureEofInDelimitedDataForKnownNonRepeatedValue.MESSAGE +Required.Proto2.ProtobufInput.PrematureEofInDelimitedDataForKnownRepeatedValue.MESSAGE +Required.Proto2.ProtobufInput.PrematureEofInPackedField.BOOL +Required.Proto2.ProtobufInput.PrematureEofInPackedField.DOUBLE +Required.Proto2.ProtobufInput.PrematureEofInPackedField.ENUM +Required.Proto2.ProtobufInput.PrematureEofInPackedField.FIXED32 +Required.Proto2.ProtobufInput.PrematureEofInPackedField.FIXED64 +Required.Proto2.ProtobufInput.PrematureEofInPackedField.FLOAT +Required.Proto2.ProtobufInput.PrematureEofInPackedField.INT32 +Required.Proto2.ProtobufInput.PrematureEofInPackedField.INT64 +Required.Proto2.ProtobufInput.PrematureEofInPackedField.SFIXED32 +Required.Proto2.ProtobufInput.PrematureEofInPackedField.SFIXED64 +Required.Proto2.ProtobufInput.PrematureEofInPackedField.SINT32 +Required.Proto2.ProtobufInput.PrematureEofInPackedField.SINT64 +Required.Proto2.ProtobufInput.PrematureEofInPackedField.UINT32 +Required.Proto2.ProtobufInput.PrematureEofInPackedField.UINT64 diff -Nru protobuf-3.0.0/conformance/failure_list_python.txt protobuf-3.6.1.3/conformance/failure_list_python.txt --- protobuf-3.0.0/conformance/failure_list_python.txt 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/conformance/failure_list_python.txt 2018-12-08 01:32:11.000000000 +0000 @@ -1,47 +1,21 @@ -DurationProtoInputTooLarge.JsonOutput -DurationProtoInputTooSmall.JsonOutput -FieldMaskNumbersDontRoundTrip.JsonOutput -FieldMaskPathsDontRoundTrip.JsonOutput -FieldMaskTooManyUnderscore.JsonOutput -JsonInput.AnyWithFieldMask.ProtobufOutput -JsonInput.BytesFieldInvalidBase64Characters -JsonInput.DoubleFieldInfinityNotQuoted -JsonInput.DoubleFieldNanNotQuoted -JsonInput.DoubleFieldNegativeInfinityNotQuoted -JsonInput.DoubleFieldTooSmall -JsonInput.DurationJsonInputTooLarge -JsonInput.DurationJsonInputTooSmall -JsonInput.DurationMissingS -JsonInput.EnumFieldNumericValueNonZero.JsonOutput -JsonInput.EnumFieldNumericValueNonZero.ProtobufOutput -JsonInput.EnumFieldNumericValueZero.JsonOutput -JsonInput.EnumFieldNumericValueZero.ProtobufOutput -JsonInput.EnumFieldUnknownValue.Validator -JsonInput.FieldMask.ProtobufOutput -JsonInput.FieldMaskInvalidCharacter -JsonInput.FieldNameInLowerCamelCase.Validator -JsonInput.FieldNameInSnakeCase.JsonOutput -JsonInput.FieldNameInSnakeCase.ProtobufOutput -JsonInput.FloatFieldInfinityNotQuoted -JsonInput.FloatFieldNanNotQuoted -JsonInput.FloatFieldNegativeInfinityNotQuoted -JsonInput.FloatFieldTooLarge -JsonInput.FloatFieldTooSmall -JsonInput.Int32FieldExponentialFormat.JsonOutput -JsonInput.Int32FieldExponentialFormat.ProtobufOutput -JsonInput.Int32FieldFloatTrailingZero.JsonOutput -JsonInput.Int32FieldFloatTrailingZero.ProtobufOutput -JsonInput.Int32FieldMaxFloatValue.JsonOutput -JsonInput.Int32FieldMaxFloatValue.ProtobufOutput -JsonInput.Int32FieldMinFloatValue.JsonOutput -JsonInput.Int32FieldMinFloatValue.ProtobufOutput -JsonInput.OriginalProtoFieldName.JsonOutput -JsonInput.OriginalProtoFieldName.ProtobufOutput -JsonInput.RepeatedFieldWrongElementTypeExpectingIntegersGotBool -JsonInput.TimestampJsonInputLowercaseT -JsonInput.Uint32FieldMaxFloatValue.JsonOutput -JsonInput.Uint32FieldMaxFloatValue.ProtobufOutput -JsonInput.ValueAcceptNull.JsonOutput -JsonInput.ValueAcceptNull.ProtobufOutput -TimestampProtoInputTooLarge.JsonOutput -TimestampProtoInputTooSmall.JsonOutput +Recommended.Proto3.JsonInput.BytesFieldBase64Url.JsonOutput +Recommended.Proto3.JsonInput.BytesFieldBase64Url.ProtobufOutput +Recommended.Proto3.JsonInput.DoubleFieldInfinityNotQuoted +Recommended.Proto3.JsonInput.DoubleFieldNanNotQuoted +Recommended.Proto3.JsonInput.DoubleFieldNegativeInfinityNotQuoted +Recommended.Proto3.JsonInput.FloatFieldInfinityNotQuoted +Recommended.Proto3.JsonInput.FloatFieldNanNotQuoted +Recommended.Proto3.JsonInput.FloatFieldNegativeInfinityNotQuoted +Required.Proto3.JsonInput.DoubleFieldTooSmall +Required.Proto3.JsonInput.FloatFieldTooLarge +Required.Proto3.JsonInput.FloatFieldTooSmall +Required.Proto3.JsonInput.RepeatedFieldWrongElementTypeExpectingIntegersGotBool +Required.Proto3.JsonInput.TimestampJsonInputLowercaseT +Required.Proto2.ProtobufInput.IllegalZeroFieldNum_Case_0 +Required.Proto2.ProtobufInput.IllegalZeroFieldNum_Case_1 +Required.Proto2.ProtobufInput.IllegalZeroFieldNum_Case_2 +Required.Proto2.ProtobufInput.IllegalZeroFieldNum_Case_3 +Required.Proto3.ProtobufInput.IllegalZeroFieldNum_Case_0 +Required.Proto3.ProtobufInput.IllegalZeroFieldNum_Case_1 +Required.Proto3.ProtobufInput.IllegalZeroFieldNum_Case_2 +Required.Proto3.ProtobufInput.IllegalZeroFieldNum_Case_3 diff -Nru protobuf-3.0.0/conformance/failure_list_ruby.txt protobuf-3.6.1.3/conformance/failure_list_ruby.txt --- protobuf-3.0.0/conformance/failure_list_ruby.txt 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/conformance/failure_list_ruby.txt 2018-12-08 01:32:11.000000000 +0000 @@ -1,199 +1,137 @@ -DurationProtoInputTooLarge.JsonOutput -DurationProtoInputTooSmall.JsonOutput -FieldMaskNumbersDontRoundTrip.JsonOutput -FieldMaskPathsDontRoundTrip.JsonOutput -FieldMaskTooManyUnderscore.JsonOutput -JsonInput.Any.JsonOutput -JsonInput.Any.ProtobufOutput -JsonInput.AnyNested.JsonOutput -JsonInput.AnyNested.ProtobufOutput -JsonInput.AnyUnorderedTypeTag.JsonOutput -JsonInput.AnyUnorderedTypeTag.ProtobufOutput -JsonInput.AnyWithDuration.JsonOutput -JsonInput.AnyWithDuration.ProtobufOutput -JsonInput.AnyWithFieldMask.JsonOutput -JsonInput.AnyWithFieldMask.ProtobufOutput -JsonInput.AnyWithInt32ValueWrapper.JsonOutput -JsonInput.AnyWithInt32ValueWrapper.ProtobufOutput -JsonInput.AnyWithStruct.JsonOutput -JsonInput.AnyWithStruct.ProtobufOutput -JsonInput.AnyWithTimestamp.JsonOutput -JsonInput.AnyWithTimestamp.ProtobufOutput -JsonInput.AnyWithValueForInteger.JsonOutput -JsonInput.AnyWithValueForInteger.ProtobufOutput -JsonInput.AnyWithValueForJsonObject.JsonOutput -JsonInput.AnyWithValueForJsonObject.ProtobufOutput -JsonInput.BoolFieldIntegerOne -JsonInput.BoolFieldIntegerZero -JsonInput.DoubleFieldInfinity.JsonOutput -JsonInput.DoubleFieldInfinity.ProtobufOutput -JsonInput.DoubleFieldMaxNegativeValue.JsonOutput -JsonInput.DoubleFieldMaxNegativeValue.ProtobufOutput -JsonInput.DoubleFieldMaxPositiveValue.JsonOutput -JsonInput.DoubleFieldMaxPositiveValue.ProtobufOutput -JsonInput.DoubleFieldMinNegativeValue.JsonOutput -JsonInput.DoubleFieldMinNegativeValue.ProtobufOutput -JsonInput.DoubleFieldMinPositiveValue.JsonOutput -JsonInput.DoubleFieldMinPositiveValue.ProtobufOutput -JsonInput.DoubleFieldNan.JsonOutput -JsonInput.DoubleFieldNan.ProtobufOutput -JsonInput.DoubleFieldNegativeInfinity.JsonOutput -JsonInput.DoubleFieldNegativeInfinity.ProtobufOutput -JsonInput.DoubleFieldQuotedValue.JsonOutput -JsonInput.DoubleFieldQuotedValue.ProtobufOutput -JsonInput.DurationHas3FractionalDigits.Validator -JsonInput.DurationHas6FractionalDigits.Validator -JsonInput.DurationHas9FractionalDigits.Validator -JsonInput.DurationHasZeroFractionalDigit.Validator -JsonInput.DurationMaxValue.JsonOutput -JsonInput.DurationMaxValue.ProtobufOutput -JsonInput.DurationMinValue.JsonOutput -JsonInput.DurationMinValue.ProtobufOutput -JsonInput.DurationRepeatedValue.JsonOutput -JsonInput.DurationRepeatedValue.ProtobufOutput -JsonInput.EnumFieldNumericValueNonZero.JsonOutput -JsonInput.EnumFieldNumericValueNonZero.ProtobufOutput -JsonInput.EnumFieldNumericValueZero.JsonOutput -JsonInput.EnumFieldNumericValueZero.ProtobufOutput -JsonInput.EnumFieldUnknownValue.Validator -JsonInput.FieldMask.JsonOutput -JsonInput.FieldMask.ProtobufOutput -JsonInput.FieldNameInSnakeCase.JsonOutput -JsonInput.FieldNameWithMixedCases.JsonOutput -JsonInput.FieldNameWithMixedCases.ProtobufOutput -JsonInput.FieldNameWithMixedCases.Validator -JsonInput.FloatFieldInfinity.JsonOutput -JsonInput.FloatFieldInfinity.ProtobufOutput -JsonInput.FloatFieldNan.JsonOutput -JsonInput.FloatFieldNan.ProtobufOutput -JsonInput.FloatFieldNegativeInfinity.JsonOutput -JsonInput.FloatFieldNegativeInfinity.ProtobufOutput -JsonInput.FloatFieldQuotedValue.JsonOutput -JsonInput.FloatFieldQuotedValue.ProtobufOutput -JsonInput.FloatFieldTooLarge -JsonInput.FloatFieldTooSmall -JsonInput.Int32FieldExponentialFormat.JsonOutput -JsonInput.Int32FieldExponentialFormat.ProtobufOutput -JsonInput.Int32FieldFloatTrailingZero.JsonOutput -JsonInput.Int32FieldFloatTrailingZero.ProtobufOutput -JsonInput.Int32FieldMaxFloatValue.JsonOutput -JsonInput.Int32FieldMaxFloatValue.ProtobufOutput -JsonInput.Int32FieldMinFloatValue.JsonOutput -JsonInput.Int32FieldMinFloatValue.ProtobufOutput -JsonInput.Int32FieldStringValue.JsonOutput -JsonInput.Int32FieldStringValue.ProtobufOutput -JsonInput.Int32FieldStringValueEscaped.JsonOutput -JsonInput.Int32FieldStringValueEscaped.ProtobufOutput -JsonInput.Int32MapEscapedKey.JsonOutput -JsonInput.Int32MapEscapedKey.ProtobufOutput -JsonInput.Int32MapField.JsonOutput -JsonInput.Int32MapField.ProtobufOutput -JsonInput.Int64FieldBeString.Validator -JsonInput.Int64FieldMaxValue.JsonOutput -JsonInput.Int64FieldMaxValue.ProtobufOutput -JsonInput.Int64FieldMinValue.JsonOutput -JsonInput.Int64FieldMinValue.ProtobufOutput -JsonInput.Int64MapEscapedKey.JsonOutput -JsonInput.Int64MapEscapedKey.ProtobufOutput -JsonInput.Int64MapField.JsonOutput -JsonInput.Int64MapField.ProtobufOutput -JsonInput.MessageField.JsonOutput -JsonInput.MessageField.ProtobufOutput -JsonInput.MessageMapField.JsonOutput -JsonInput.MessageMapField.ProtobufOutput -JsonInput.MessageRepeatedField.JsonOutput -JsonInput.MessageRepeatedField.ProtobufOutput -JsonInput.OptionalBoolWrapper.JsonOutput -JsonInput.OptionalBoolWrapper.ProtobufOutput -JsonInput.OptionalBytesWrapper.JsonOutput -JsonInput.OptionalBytesWrapper.ProtobufOutput -JsonInput.OptionalDoubleWrapper.JsonOutput -JsonInput.OptionalDoubleWrapper.ProtobufOutput -JsonInput.OptionalFloatWrapper.JsonOutput -JsonInput.OptionalFloatWrapper.ProtobufOutput -JsonInput.OptionalInt32Wrapper.JsonOutput -JsonInput.OptionalInt32Wrapper.ProtobufOutput -JsonInput.OptionalInt64Wrapper.JsonOutput -JsonInput.OptionalInt64Wrapper.ProtobufOutput -JsonInput.OptionalStringWrapper.JsonOutput -JsonInput.OptionalStringWrapper.ProtobufOutput -JsonInput.OptionalUint32Wrapper.JsonOutput -JsonInput.OptionalUint32Wrapper.ProtobufOutput -JsonInput.OptionalUint64Wrapper.JsonOutput -JsonInput.OptionalUint64Wrapper.ProtobufOutput -JsonInput.OptionalWrapperTypesWithNonDefaultValue.JsonOutput -JsonInput.OptionalWrapperTypesWithNonDefaultValue.ProtobufOutput -JsonInput.OriginalProtoFieldName.JsonOutput -JsonInput.PrimitiveRepeatedField.JsonOutput -JsonInput.PrimitiveRepeatedField.ProtobufOutput -JsonInput.RepeatedBoolWrapper.JsonOutput -JsonInput.RepeatedBoolWrapper.ProtobufOutput -JsonInput.RepeatedBytesWrapper.JsonOutput -JsonInput.RepeatedBytesWrapper.ProtobufOutput -JsonInput.RepeatedDoubleWrapper.JsonOutput -JsonInput.RepeatedDoubleWrapper.ProtobufOutput -JsonInput.RepeatedFieldWrongElementTypeExpectingStringsGotInt -JsonInput.RepeatedFloatWrapper.JsonOutput -JsonInput.RepeatedFloatWrapper.ProtobufOutput -JsonInput.RepeatedInt32Wrapper.JsonOutput -JsonInput.RepeatedInt32Wrapper.ProtobufOutput -JsonInput.RepeatedInt64Wrapper.JsonOutput -JsonInput.RepeatedInt64Wrapper.ProtobufOutput -JsonInput.RepeatedStringWrapper.JsonOutput -JsonInput.RepeatedStringWrapper.ProtobufOutput -JsonInput.RepeatedUint32Wrapper.JsonOutput -JsonInput.RepeatedUint32Wrapper.ProtobufOutput -JsonInput.RepeatedUint64Wrapper.JsonOutput -JsonInput.RepeatedUint64Wrapper.ProtobufOutput -JsonInput.StringFieldNotAString -JsonInput.StringFieldSurrogateInWrongOrder -JsonInput.StringFieldSurrogatePair.JsonOutput -JsonInput.StringFieldSurrogatePair.ProtobufOutput -JsonInput.StringFieldUnpairedHighSurrogate -JsonInput.StringFieldUnpairedLowSurrogate -JsonInput.Struct.JsonOutput -JsonInput.Struct.ProtobufOutput -JsonInput.TimestampHas3FractionalDigits.Validator -JsonInput.TimestampHas6FractionalDigits.Validator -JsonInput.TimestampHas9FractionalDigits.Validator -JsonInput.TimestampHasZeroFractionalDigit.Validator -JsonInput.TimestampMaxValue.JsonOutput -JsonInput.TimestampMaxValue.ProtobufOutput -JsonInput.TimestampMinValue.JsonOutput -JsonInput.TimestampMinValue.ProtobufOutput -JsonInput.TimestampRepeatedValue.JsonOutput -JsonInput.TimestampRepeatedValue.ProtobufOutput -JsonInput.TimestampWithNegativeOffset.JsonOutput -JsonInput.TimestampWithNegativeOffset.ProtobufOutput -JsonInput.TimestampWithPositiveOffset.JsonOutput -JsonInput.TimestampWithPositiveOffset.ProtobufOutput -JsonInput.TimestampZeroNormalized.Validator -JsonInput.Uint32FieldMaxFloatValue.JsonOutput -JsonInput.Uint32FieldMaxFloatValue.ProtobufOutput -JsonInput.Uint32MapField.JsonOutput -JsonInput.Uint32MapField.ProtobufOutput -JsonInput.Uint64FieldBeString.Validator -JsonInput.Uint64FieldMaxValue.JsonOutput -JsonInput.Uint64FieldMaxValue.ProtobufOutput -JsonInput.Uint64MapField.JsonOutput -JsonInput.Uint64MapField.ProtobufOutput -JsonInput.ValueAcceptBool.JsonOutput -JsonInput.ValueAcceptBool.ProtobufOutput -JsonInput.ValueAcceptFloat.JsonOutput -JsonInput.ValueAcceptFloat.ProtobufOutput -JsonInput.ValueAcceptInteger.JsonOutput -JsonInput.ValueAcceptInteger.ProtobufOutput -JsonInput.ValueAcceptList.JsonOutput -JsonInput.ValueAcceptList.ProtobufOutput -JsonInput.ValueAcceptNull.JsonOutput -JsonInput.ValueAcceptNull.ProtobufOutput -JsonInput.ValueAcceptObject.JsonOutput -JsonInput.ValueAcceptObject.ProtobufOutput -JsonInput.ValueAcceptString.JsonOutput -JsonInput.ValueAcceptString.ProtobufOutput -ProtobufInput.DoubleFieldNormalizeQuietNan.JsonOutput -ProtobufInput.DoubleFieldNormalizeSignalingNan.JsonOutput -ProtobufInput.FloatFieldNormalizeQuietNan.JsonOutput -ProtobufInput.FloatFieldNormalizeSignalingNan.JsonOutput -TimestampProtoInputTooLarge.JsonOutput -TimestampProtoInputTooSmall.JsonOutput +Recommended.FieldMaskNumbersDontRoundTrip.JsonOutput +Recommended.FieldMaskPathsDontRoundTrip.JsonOutput +Recommended.FieldMaskTooManyUnderscore.JsonOutput +Recommended.Proto3.JsonInput.BytesFieldBase64Url.JsonOutput +Recommended.Proto3.JsonInput.BytesFieldBase64Url.ProtobufOutput +Recommended.Proto3.JsonInput.DurationHas3FractionalDigits.Validator +Recommended.Proto3.JsonInput.DurationHas6FractionalDigits.Validator +Recommended.Proto3.JsonInput.DurationHas9FractionalDigits.Validator +Recommended.Proto3.JsonInput.DurationHasZeroFractionalDigit.Validator +Recommended.Proto3.JsonInput.Int64FieldBeString.Validator +Recommended.Proto3.JsonInput.MapFieldValueIsNull +Recommended.Proto3.JsonInput.RepeatedFieldMessageElementIsNull +Recommended.Proto3.JsonInput.RepeatedFieldPrimitiveElementIsNull +Recommended.Proto3.JsonInput.StringEndsWithEscapeChar +Recommended.Proto3.JsonInput.StringFieldSurrogateInWrongOrder +Recommended.Proto3.JsonInput.StringFieldUnpairedHighSurrogate +Recommended.Proto3.JsonInput.StringFieldUnpairedLowSurrogate +Recommended.Proto3.JsonInput.TimestampHas3FractionalDigits.Validator +Recommended.Proto3.JsonInput.TimestampHas6FractionalDigits.Validator +Recommended.Proto3.JsonInput.TimestampHas9FractionalDigits.Validator +Recommended.Proto3.JsonInput.TimestampHasZeroFractionalDigit.Validator +Recommended.Proto3.JsonInput.TimestampZeroNormalized.Validator +Recommended.Proto3.JsonInput.Uint64FieldBeString.Validator +Required.DurationProtoInputTooLarge.JsonOutput +Required.DurationProtoInputTooSmall.JsonOutput +Required.Proto3.JsonInput.Any.JsonOutput +Required.Proto3.JsonInput.Any.ProtobufOutput +Required.Proto3.JsonInput.AnyNested.JsonOutput +Required.Proto3.JsonInput.AnyNested.ProtobufOutput +Required.Proto3.JsonInput.AnyUnorderedTypeTag.JsonOutput +Required.Proto3.JsonInput.AnyUnorderedTypeTag.ProtobufOutput +Required.Proto3.JsonInput.AnyWithDuration.JsonOutput +Required.Proto3.JsonInput.AnyWithDuration.ProtobufOutput +Required.Proto3.JsonInput.AnyWithFieldMask.JsonOutput +Required.Proto3.JsonInput.AnyWithFieldMask.ProtobufOutput +Required.Proto3.JsonInput.AnyWithInt32ValueWrapper.JsonOutput +Required.Proto3.JsonInput.AnyWithInt32ValueWrapper.ProtobufOutput +Required.Proto3.JsonInput.AnyWithStruct.JsonOutput +Required.Proto3.JsonInput.AnyWithStruct.ProtobufOutput +Required.Proto3.JsonInput.AnyWithTimestamp.JsonOutput +Required.Proto3.JsonInput.AnyWithTimestamp.ProtobufOutput +Required.Proto3.JsonInput.AnyWithValueForInteger.JsonOutput +Required.Proto3.JsonInput.AnyWithValueForInteger.ProtobufOutput +Required.Proto3.JsonInput.AnyWithValueForJsonObject.JsonOutput +Required.Proto3.JsonInput.AnyWithValueForJsonObject.ProtobufOutput +Required.Proto3.JsonInput.DoubleFieldMaxNegativeValue.JsonOutput +Required.Proto3.JsonInput.DoubleFieldMaxNegativeValue.ProtobufOutput +Required.Proto3.JsonInput.DoubleFieldMinPositiveValue.JsonOutput +Required.Proto3.JsonInput.DoubleFieldMinPositiveValue.ProtobufOutput +Required.Proto3.JsonInput.DoubleFieldNan.JsonOutput +Required.Proto3.JsonInput.DurationMaxValue.JsonOutput +Required.Proto3.JsonInput.DurationMaxValue.ProtobufOutput +Required.Proto3.JsonInput.DurationMinValue.JsonOutput +Required.Proto3.JsonInput.DurationMinValue.ProtobufOutput +Required.Proto3.JsonInput.DurationRepeatedValue.JsonOutput +Required.Proto3.JsonInput.DurationRepeatedValue.ProtobufOutput +Required.Proto3.JsonInput.FieldMask.JsonOutput +Required.Proto3.JsonInput.FieldMask.ProtobufOutput +Required.Proto3.JsonInput.FloatFieldInfinity.JsonOutput +Required.Proto3.JsonInput.FloatFieldNan.JsonOutput +Required.Proto3.JsonInput.FloatFieldNegativeInfinity.JsonOutput +Required.Proto3.JsonInput.OneofFieldDuplicate +Required.Proto3.JsonInput.OptionalBoolWrapper.JsonOutput +Required.Proto3.JsonInput.OptionalBoolWrapper.ProtobufOutput +Required.Proto3.JsonInput.OptionalBytesWrapper.JsonOutput +Required.Proto3.JsonInput.OptionalBytesWrapper.ProtobufOutput +Required.Proto3.JsonInput.OptionalDoubleWrapper.JsonOutput +Required.Proto3.JsonInput.OptionalDoubleWrapper.ProtobufOutput +Required.Proto3.JsonInput.OptionalFloatWrapper.JsonOutput +Required.Proto3.JsonInput.OptionalFloatWrapper.ProtobufOutput +Required.Proto3.JsonInput.OptionalInt32Wrapper.JsonOutput +Required.Proto3.JsonInput.OptionalInt32Wrapper.ProtobufOutput +Required.Proto3.JsonInput.OptionalInt64Wrapper.JsonOutput +Required.Proto3.JsonInput.OptionalInt64Wrapper.ProtobufOutput +Required.Proto3.JsonInput.OptionalStringWrapper.JsonOutput +Required.Proto3.JsonInput.OptionalStringWrapper.ProtobufOutput +Required.Proto3.JsonInput.OptionalUint32Wrapper.JsonOutput +Required.Proto3.JsonInput.OptionalUint32Wrapper.ProtobufOutput +Required.Proto3.JsonInput.OptionalUint64Wrapper.JsonOutput +Required.Proto3.JsonInput.OptionalUint64Wrapper.ProtobufOutput +Required.Proto3.JsonInput.OptionalWrapperTypesWithNonDefaultValue.JsonOutput +Required.Proto3.JsonInput.OptionalWrapperTypesWithNonDefaultValue.ProtobufOutput +Required.Proto3.JsonInput.RepeatedBoolWrapper.JsonOutput +Required.Proto3.JsonInput.RepeatedBoolWrapper.ProtobufOutput +Required.Proto3.JsonInput.RepeatedBytesWrapper.JsonOutput +Required.Proto3.JsonInput.RepeatedBytesWrapper.ProtobufOutput +Required.Proto3.JsonInput.RepeatedDoubleWrapper.JsonOutput +Required.Proto3.JsonInput.RepeatedDoubleWrapper.ProtobufOutput +Required.Proto3.JsonInput.RepeatedFloatWrapper.JsonOutput +Required.Proto3.JsonInput.RepeatedFloatWrapper.ProtobufOutput +Required.Proto3.JsonInput.RepeatedInt32Wrapper.JsonOutput +Required.Proto3.JsonInput.RepeatedInt32Wrapper.ProtobufOutput +Required.Proto3.JsonInput.RepeatedInt64Wrapper.JsonOutput +Required.Proto3.JsonInput.RepeatedInt64Wrapper.ProtobufOutput +Required.Proto3.JsonInput.RepeatedStringWrapper.JsonOutput +Required.Proto3.JsonInput.RepeatedStringWrapper.ProtobufOutput +Required.Proto3.JsonInput.RepeatedUint32Wrapper.JsonOutput +Required.Proto3.JsonInput.RepeatedUint32Wrapper.ProtobufOutput +Required.Proto3.JsonInput.RepeatedUint64Wrapper.JsonOutput +Required.Proto3.JsonInput.RepeatedUint64Wrapper.ProtobufOutput +Required.Proto3.JsonInput.StringFieldSurrogatePair.JsonOutput +Required.Proto3.JsonInput.StringFieldSurrogatePair.ProtobufOutput +Required.Proto3.JsonInput.Struct.JsonOutput +Required.Proto3.JsonInput.Struct.ProtobufOutput +Required.Proto3.JsonInput.TimestampMaxValue.JsonOutput +Required.Proto3.JsonInput.TimestampMaxValue.ProtobufOutput +Required.Proto3.JsonInput.TimestampMinValue.JsonOutput +Required.Proto3.JsonInput.TimestampMinValue.ProtobufOutput +Required.Proto3.JsonInput.TimestampRepeatedValue.JsonOutput +Required.Proto3.JsonInput.TimestampRepeatedValue.ProtobufOutput +Required.Proto3.JsonInput.TimestampWithNegativeOffset.JsonOutput +Required.Proto3.JsonInput.TimestampWithNegativeOffset.ProtobufOutput +Required.Proto3.JsonInput.TimestampWithPositiveOffset.JsonOutput +Required.Proto3.JsonInput.TimestampWithPositiveOffset.ProtobufOutput +Required.Proto3.JsonInput.ValueAcceptBool.JsonOutput +Required.Proto3.JsonInput.ValueAcceptBool.ProtobufOutput +Required.Proto3.JsonInput.ValueAcceptFloat.JsonOutput +Required.Proto3.JsonInput.ValueAcceptFloat.ProtobufOutput +Required.Proto3.JsonInput.ValueAcceptInteger.JsonOutput +Required.Proto3.JsonInput.ValueAcceptInteger.ProtobufOutput +Required.Proto3.JsonInput.ValueAcceptList.JsonOutput +Required.Proto3.JsonInput.ValueAcceptList.ProtobufOutput +Required.Proto3.JsonInput.ValueAcceptListWithNull.JsonOutput +Required.Proto3.JsonInput.ValueAcceptListWithNull.ProtobufOutput +Required.Proto3.JsonInput.ValueAcceptNull.JsonOutput +Required.Proto3.JsonInput.ValueAcceptNull.ProtobufOutput +Required.Proto3.JsonInput.ValueAcceptObject.JsonOutput +Required.Proto3.JsonInput.ValueAcceptObject.ProtobufOutput +Required.Proto3.JsonInput.ValueAcceptString.JsonOutput +Required.Proto3.JsonInput.ValueAcceptString.ProtobufOutput +Required.Proto3.ProtobufInput.DoubleFieldNormalizeQuietNan.JsonOutput +Required.Proto3.ProtobufInput.DoubleFieldNormalizeSignalingNan.JsonOutput +Required.Proto3.ProtobufInput.FloatFieldNormalizeQuietNan.JsonOutput +Required.Proto3.ProtobufInput.FloatFieldNormalizeSignalingNan.JsonOutput +Required.Proto3.ProtobufInput.ValidDataRepeated.FLOAT.JsonOutput +Required.TimestampProtoInputTooLarge.JsonOutput +Required.TimestampProtoInputTooSmall.JsonOutput diff -Nru protobuf-3.0.0/conformance/Makefile.am protobuf-3.6.1.3/conformance/Makefile.am --- protobuf-3.0.0/conformance/Makefile.am 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/conformance/Makefile.am 2018-12-08 01:32:11.000000000 +0000 @@ -1,7 +1,13 @@ ## Process this file with automake to produce Makefile.in conformance_protoc_inputs = \ - conformance.proto + conformance.proto \ + $(top_srcdir)/src/google/protobuf/test_messages_proto3.proto + +# proto2 input files, should be separated with proto3, as we +# can't generate proto2 files for ruby, php and objc +conformance_proto2_protoc_inputs = \ + $(top_srcdir)/src/google/protobuf/test_messages_proto2.proto well_known_type_protoc_inputs = \ $(top_srcdir)/src/google/protobuf/any.proto \ @@ -20,7 +26,8 @@ conformance_pb2.py \ Conformance.pbobjc.h \ Conformance.pbobjc.m \ - conformance.rb \ + conformance_pb.js \ + conformance_pb.rb \ com/google/protobuf/Any.java \ com/google/protobuf/AnyOrBuilder.java \ com/google/protobuf/AnyProto.java \ @@ -61,6 +68,8 @@ com/google/protobuf/Value.java \ com/google/protobuf/ValueOrBuilder.java \ com/google/protobuf/WrappersProto.java \ + com/google/protobuf_test_messages/proto3/TestMessagesProto3.java \ + com/google/protobuf_test_messages/proto2/TestMessagesProto2.java \ google/protobuf/any.pb.cc \ google/protobuf/any.pb.h \ google/protobuf/any.rb \ @@ -77,6 +86,17 @@ google/protobuf/struct.pb.h \ google/protobuf/struct.rb \ google/protobuf/struct_pb2.py \ + google/protobuf/TestMessagesProto2.pbobjc.h \ + google/protobuf/TestMessagesProto2.pbobjc.m \ + google/protobuf/TestMessagesProto3.pbobjc.h \ + google/protobuf/TestMessagesProto3.pbobjc.m \ + google/protobuf/test_messages_proto3.pb.cc \ + google/protobuf/test_messages_proto3.pb.h \ + google/protobuf/test_messages_proto2.pb.cc \ + google/protobuf/test_messages_proto2.pb.h \ + google/protobuf/test_messages_proto3_pb.rb \ + google/protobuf/test_messages_proto3_pb2.py \ + google/protobuf/test_messages_proto2_pb2.py \ google/protobuf/timestamp.pb.cc \ google/protobuf/timestamp.pb.h \ google/protobuf/timestamp.rb \ @@ -84,7 +104,40 @@ google/protobuf/wrappers.pb.cc \ google/protobuf/wrappers.pb.h \ google/protobuf/wrappers.rb \ - google/protobuf/wrappers_pb2.py + google/protobuf/wrappers_pb2.py \ + Conformance/ConformanceRequest.php \ + Conformance/ConformanceResponse.php \ + Conformance/WireFormat.php \ + GPBMetadata/Conformance.php \ + GPBMetadata/Google/Protobuf/Any.php \ + GPBMetadata/Google/Protobuf/Duration.php \ + GPBMetadata/Google/Protobuf/FieldMask.php \ + GPBMetadata/Google/Protobuf/Struct.php \ + GPBMetadata/Google/Protobuf/TestMessagesProto3.php \ + GPBMetadata/Google/Protobuf/Timestamp.php \ + GPBMetadata/Google/Protobuf/Wrappers.php \ + Google/Protobuf/Any.php \ + Google/Protobuf/BoolValue.php \ + Google/Protobuf/BytesValue.php \ + Google/Protobuf/DoubleValue.php \ + Google/Protobuf/Duration.php \ + Google/Protobuf/FieldMask.php \ + Google/Protobuf/FloatValue.php \ + Google/Protobuf/Int32Value.php \ + Google/Protobuf/Int64Value.php \ + Google/Protobuf/ListValue.php \ + Google/Protobuf/NullValue.php \ + Google/Protobuf/StringValue.php \ + Google/Protobuf/Struct.php \ + Google/Protobuf/Timestamp.php \ + Google/Protobuf/UInt32Value.php \ + Google/Protobuf/UInt64Value.php \ + Google/Protobuf/Value.php \ + Protobuf_test_messages/Proto3/ForeignEnum.php \ + Protobuf_test_messages/Proto3/ForeignMessage.php \ + Protobuf_test_messages/Proto3/TestAllTypes_NestedEnum.php \ + Protobuf_test_messages/Proto3/TestAllTypes_NestedMessage.php \ + Protobuf_test_messages/Proto3/TestAllTypes.php # lite/com/google/protobuf/Any.java \ # lite/com/google/protobuf/AnyOrBuilder.java \ # lite/com/google/protobuf/AnyProto.java \ @@ -138,21 +191,25 @@ conformance.proto \ conformance_python.py \ conformance_ruby.rb \ + conformance_php.php \ failure_list_cpp.txt \ failure_list_csharp.txt \ failure_list_java.txt \ + failure_list_js.txt \ failure_list_objc.txt \ failure_list_python.txt \ failure_list_python_cpp.txt \ failure_list_python-post26.txt \ - failure_list_ruby.txt + failure_list_ruby.txt \ + failure_list_php.txt \ + failure_list_php_c.txt conformance_test_runner_LDADD = $(top_srcdir)/src/libprotobuf.la conformance_test_runner_SOURCES = conformance_test.h conformance_test.cc \ conformance_test_runner.cc \ third_party/jsoncpp/json.h \ third_party/jsoncpp/jsoncpp.cpp -nodist_conformance_test_runner_SOURCES = conformance.pb.cc +nodist_conformance_test_runner_SOURCES = conformance.pb.cc google/protobuf/test_messages_proto3.pb.cc google/protobuf/test_messages_proto2.pb.cc conformance_test_runner_CPPFLAGS = -I$(top_srcdir)/src -I$(srcdir) conformance_test_runner_CXXFLAGS = -std=c++11 # Explicit deps beacuse BUILT_SOURCES are only done before a "make all/check" @@ -162,7 +219,7 @@ conformance_cpp_LDADD = $(top_srcdir)/src/libprotobuf.la conformance_cpp_SOURCES = conformance_cpp.cc -nodist_conformance_cpp_SOURCES = conformance.pb.cc +nodist_conformance_cpp_SOURCES = conformance.pb.cc google/protobuf/test_messages_proto3.pb.cc google/protobuf/test_messages_proto2.pb.cc conformance_cpp_CPPFLAGS = -I$(top_srcdir)/src # Explicit dep beacuse BUILT_SOURCES are only done before a "make all/check" # so a direct "make test_cpp" could fail if parallel enough. @@ -173,7 +230,7 @@ bin_PROGRAMS += conformance-objc conformance_objc_SOURCES = conformance_objc.m ../objectivec/GPBProtocolBuffers.m -nodist_conformance_objc_SOURCES = Conformance.pbobjc.m +nodist_conformance_objc_SOURCES = Conformance.pbobjc.m google/protobuf/TestMessagesProto2.pbobjc.m google/protobuf/TestMessagesProto3.pbobjc.m # On travis, the build fails without the isysroot because whatever system # headers are being found don't include generics support for # NSArray/NSDictionary, the only guess is their image at one time had an odd @@ -182,16 +239,24 @@ conformance_objc_LDFLAGS = -framework Foundation # Explicit dep beacuse BUILT_SOURCES are only done before a "make all/check" # so a direct "make test_objc" could fail if parallel enough. -conformance_objc-conformance_objc.$(OBJEXT): Conformance.pbobjc.h +conformance_objc-conformance_objc.$(OBJEXT): Conformance.pbobjc.h google/protobuf/TestMessagesProto2.pbobjc.h google/protobuf/TestMessagesProto3.pbobjc.h endif +# JavaScript well-known types are expected to be in a directory called +# google-protobuf, because they are usually in the google-protobuf npm +# package. But we want to use the sources from our tree, so we recreate +# that directory structure here. +google-protobuf: + mkdir google-protobuf + if USE_EXTERNAL_PROTOC # Some implementations include pre-generated versions of well-known types. -protoc_middleman: $(conformance_protoc_inputs) $(well_known_type_protoc_inputs) - $(PROTOC) -I$(srcdir) -I$(top_srcdir) --cpp_out=. --java_out=. --ruby_out=. --objc_out=. --python_out=. $(conformance_protoc_inputs) - $(PROTOC) -I$(srcdir) -I$(top_srcdir) --cpp_out=. --java_out=. --ruby_out=. --python_out=. $(well_known_type_protoc_inputs) +protoc_middleman: $(conformance_protoc_inputs) $(conformance_proto2_protoc_inputs) $(well_known_type_protoc_inputs) google-protobuf + $(PROTOC) -I$(srcdir) -I$(top_srcdir) --cpp_out=. --java_out=. --ruby_out=. --objc_out=. --python_out=. --php_out=. --js_out=import_style=commonjs,binary:. $(conformance_protoc_inputs) + $(PROTOC) -I$(srcdir) -I$(top_srcdir) --cpp_out=. --java_out=. --objc_out=. --python_out=. --js_out=import_style=commonjs,binary:. $(conformance_proto2_protoc_inputs) + $(PROTOC) -I$(srcdir) -I$(top_srcdir) --cpp_out=. --java_out=. --ruby_out=. --python_out=. --js_out=import_style=commonjs,binary:google-protobuf $(well_known_type_protoc_inputs) ## $(PROTOC) -I$(srcdir) -I$(top_srcdir) --java_out=lite:lite $(conformance_protoc_inputs) $(well_known_type_protoc_inputs) touch protoc_middleman @@ -200,9 +265,10 @@ # We have to cd to $(srcdir) before executing protoc because $(protoc_inputs) is # relative to srcdir, which may not be the same as the current directory when # building out-of-tree. -protoc_middleman: $(top_srcdir)/src/protoc$(EXEEXT) $(conformance_protoc_inputs) $(well_known_type_protoc_inputs) - oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$(top_srcdir)/src --cpp_out=$$oldpwd --java_out=$$oldpwd --ruby_out=$$oldpwd --objc_out=$$oldpwd --python_out=$$oldpwd $(conformance_protoc_inputs) ) - oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$(top_srcdir)/src --cpp_out=$$oldpwd --java_out=$$oldpwd --ruby_out=$$oldpwd --python_out=$$oldpwd $(well_known_type_protoc_inputs) ) +protoc_middleman: $(top_srcdir)/src/protoc$(EXEEXT) $(conformance_protoc_inputs) $(conformance_proto2_protoc_inputs) $(well_known_type_protoc_inputs) google-protobuf + oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$(top_srcdir)/src --cpp_out=$$oldpwd --java_out=$$oldpwd --ruby_out=$$oldpwd --objc_out=$$oldpwd --python_out=$$oldpwd --php_out=$$oldpwd --js_out=import_style=commonjs,binary:$$oldpwd $(conformance_protoc_inputs) ) + oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$(top_srcdir)/src --cpp_out=$$oldpwd --java_out=$$oldpwd --objc_out=. --python_out=$$oldpwd --js_out=import_style=commonjs,binary:$$oldpwd $(conformance_proto2_protoc_inputs) ) + oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$(top_srcdir)/src --cpp_out=$$oldpwd --java_out=$$oldpwd --ruby_out=$$oldpwd --python_out=$$oldpwd --js_out=import_style=commonjs,binary:$$oldpwd/google-protobuf $(well_known_type_protoc_inputs) ) ## @mkdir -p lite ## oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$(top_srcdir)/src --java_out=lite:$$oldpwd/lite $(conformance_protoc_inputs) $(well_known_type_protoc_inputs) ) touch protoc_middleman @@ -213,15 +279,13 @@ $(other_language_protoc_outputs): protoc_middleman -BUILT_SOURCES = $(protoc_outputs) $(other_language_protoc_outputs) - -CLEANFILES = $(protoc_outputs) protoc_middleman javac_middleman conformance-java javac_middleman_lite conformance-java-lite conformance-csharp $(other_language_protoc_outputs) +CLEANFILES = $(protoc_outputs) protoc_middleman javac_middleman conformance-java javac_middleman_lite conformance-java-lite conformance-csharp conformance-php conformance-php-c $(other_language_protoc_outputs) MAINTAINERCLEANFILES = \ Makefile.in javac_middleman: ConformanceJava.java protoc_middleman $(other_language_protoc_outputs) - jar=`ls ../java/util/target/*jar-with-dependencies.jar` && javac -classpath ../java/target/classes:$$jar ConformanceJava.java com/google/protobuf/conformance/Conformance.java + jar=`ls ../java/util/target/*jar-with-dependencies.jar` && javac -classpath ../java/target/classes:$$jar ConformanceJava.java com/google/protobuf/conformance/Conformance.java com/google/protobuf_test_messages/proto3/TestMessagesProto3.java com/google/protobuf_test_messages/proto2/TestMessagesProto2.java @touch javac_middleman conformance-java: javac_middleman @@ -249,33 +313,57 @@ @echo 'dotnet ../csharp/src/Google.Protobuf.Conformance/bin/Release/netcoreapp1.0/Google.Protobuf.Conformance.dll "$$@"' >> conformance-csharp @chmod +x conformance-csharp +conformance-php: + @echo "Writing shortcut script conformance-php..." + @echo '#! /bin/sh' > conformance-php + @echo 'php -d auto_prepend_file=autoload.php ./conformance_php.php' >> conformance-php + @chmod +x conformance-php + +conformance-php-c: + @echo "Writing shortcut script conformance-php-c..." + @echo '#! /bin/sh' > conformance-php-c + @echo 'php -dextension=../php/ext/google/protobuf/modules/protobuf.so ./conformance_php.php' >> conformance-php-c + @chmod +x conformance-php-c + # Targets for actually running tests. test_cpp: protoc_middleman conformance-test-runner conformance-cpp - ./conformance-test-runner --failure_list failure_list_cpp.txt ./conformance-cpp + ./conformance-test-runner --enforce_recommended --failure_list failure_list_cpp.txt ./conformance-cpp test_java: protoc_middleman conformance-test-runner conformance-java - ./conformance-test-runner --failure_list failure_list_java.txt ./conformance-java + ./conformance-test-runner --enforce_recommended --failure_list failure_list_java.txt ./conformance-java test_java_lite: protoc_middleman conformance-test-runner conformance-java-lite - ./conformance-test-runner ./conformance-java-lite + ./conformance-test-runner --enforce_recommended ./conformance-java-lite test_csharp: protoc_middleman conformance-test-runner conformance-csharp - ./conformance-test-runner --failure_list failure_list_csharp.txt ./conformance-csharp + ./conformance-test-runner --enforce_recommended --failure_list failure_list_csharp.txt ./conformance-csharp test_ruby: protoc_middleman conformance-test-runner $(other_language_protoc_outputs) - RUBYLIB=../ruby/lib:. ./conformance-test-runner --failure_list failure_list_ruby.txt ./conformance_ruby.rb + RUBYLIB=../ruby/lib:. ./conformance-test-runner --enforce_recommended --failure_list failure_list_ruby.txt ./conformance_ruby.rb + +test_php: protoc_middleman conformance-test-runner conformance-php $(other_language_protoc_outputs) + ./conformance-test-runner --enforce_recommended --failure_list failure_list_php.txt ./conformance-php + +test_php_c: protoc_middleman conformance-test-runner conformance-php-c $(other_language_protoc_outputs) + ./conformance-test-runner --enforce_recommended --failure_list failure_list_php_c.txt ./conformance-php-c + +test_php_zts_c: protoc_middleman conformance-test-runner conformance-php-c $(other_language_protoc_outputs) + ./conformance-test-runner --enforce_recommended --failure_list failure_list_php_zts_c.txt ./conformance-php-c # These depend on library paths being properly set up. The easiest way to # run them is to just use "tox" from the python dir. test_python: protoc_middleman conformance-test-runner - ./conformance-test-runner --failure_list failure_list_python.txt ./conformance_python.py + ./conformance-test-runner --enforce_recommended --failure_list failure_list_python.txt ./conformance_python.py test_python_cpp: protoc_middleman conformance-test-runner - ./conformance-test-runner --failure_list failure_list_python_cpp.txt ./conformance_python.py + ./conformance-test-runner --enforce_recommended --failure_list failure_list_python_cpp.txt ./conformance_python.py + +test_nodejs: protoc_middleman conformance-test-runner $(other_language_protoc_outputs) + NODE_PATH=../js:. ./conformance-test-runner --enforce_recommended --failure_list failure_list_js.txt ./conformance_nodejs.js if OBJC_CONFORMANCE_TEST test_objc: protoc_middleman conformance-test-runner conformance-objc - ./conformance-test-runner --failure_list failure_list_objc.txt ./conformance-objc + ./conformance-test-runner --enforce_recommended --failure_list failure_list_objc.txt ./conformance-objc endif diff -Nru protobuf-3.0.0/conformance/README.md protobuf-3.6.1.3/conformance/README.md --- protobuf-3.0.0/conformance/README.md 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/conformance/README.md 2018-12-08 01:32:11.000000000 +0000 @@ -19,11 +19,39 @@ $ make -Then to run the tests against the C++ implementation, run: +Running the tests for C++ +------------------------- + +To run the tests against the C++ implementation, run: $ cd conformance && make test_cpp -More tests and languages will be added soon! +Running the tests for JavaScript (Node.js) +------------------------------------------ + +To run the JavaScript tests against Node.js, make sure you have "node" +on your path and then run: + + $ cd conformance && make test_nodejs + +Running the tests for Ruby (MRI) +-------------------------------- + +To run the Ruby tests against MRI, first build the C extension: + + $ cd ruby && rake + +Then run the tests like so: + + $ cd conformance && make test_ruby + +Running the tests for other languages +------------------------------------- + +Most of the languages in the Protobuf source tree are set up to run +conformance tests. However some of them are more tricky to set up +properly. See `tests.sh` in the base of the repository to see how +Travis runs the tests. Testing other Protocol Buffer implementations --------------------------------------------- diff -Nru protobuf-3.0.0/conformance/update_failure_list.py protobuf-3.6.1.3/conformance/update_failure_list.py --- protobuf-3.0.0/conformance/update_failure_list.py 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/conformance/update_failure_list.py 2018-12-08 01:32:11.000000000 +0000 @@ -35,7 +35,6 @@ """ import argparse -import fileinput parser = argparse.ArgumentParser( description='Adds/removes failures from the failure list.') @@ -57,12 +56,13 @@ with open(remove_file) as f: for line in f: if line in add_set: - raise "Asked to both add and remove test: " + line + raise Exception("Asked to both add and remove test: " + line) remove_set.add(line.strip()) add_list = sorted(add_set, reverse=True) -existing_list = file(args.filename).read() +with open(args.filename) as in_file: + existing_list = in_file.read() with open(args.filename, "w") as f: for line in existing_list.splitlines(True): diff -Nru protobuf-3.0.0/csharp/buildall.sh protobuf-3.6.1.3/csharp/buildall.sh --- protobuf-3.0.0/csharp/buildall.sh 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/csharp/buildall.sh 2018-12-08 01:32:11.000000000 +0000 @@ -6,11 +6,12 @@ set -ex echo Building relevant projects. -dotnet build -c $CONFIG $SRC/Google.Protobuf $SRC/Google.Protobuf.Test $SRC/Google.Protobuf.Conformance +dotnet restore $SRC/Google.Protobuf.sln +dotnet build -c $CONFIG $SRC/Google.Protobuf.sln echo Running tests. # Only test netcoreapp1.0, which uses the .NET Core runtime. # If we want to test the .NET 4.5 version separately, we could # run Mono explicitly. However, we don't have any differences between # the .NET 4.5 and netstandard1.0 assemblies. -dotnet test -c $CONFIG -f netcoreapp1.0 $SRC/Google.Protobuf.Test +dotnet test -c $CONFIG -f netcoreapp1.0 $SRC/Google.Protobuf.Test/Google.Protobuf.Test.csproj diff -Nru protobuf-3.0.0/csharp/build_packages.bat protobuf-3.6.1.3/csharp/build_packages.bat --- protobuf-3.0.0/csharp/build_packages.bat 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/csharp/build_packages.bat 2018-12-08 01:32:11.000000000 +0000 @@ -1,7 +1,7 @@ @rem Builds Google.Protobuf NuGet packages -dotnet restore src -dotnet pack -c Release src\Google.Protobuf || goto :error +dotnet restore src/Google.Protobuf.sln +dotnet pack -c Release src/Google.Protobuf.sln || goto :error goto :EOF diff -Nru protobuf-3.0.0/csharp/build_tools.sh protobuf-3.6.1.3/csharp/build_tools.sh --- protobuf-3.0.0/csharp/build_tools.sh 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/csharp/build_tools.sh 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,52 @@ +#!/bin/bash + +if [ $# -ne 1 ]; then + cat < + +Example: + $ $0 3.0.0 + +This script will download pre-built protoc binaries from maven repository and +create the Google.Protobuf.Tools package. Well-known type .proto files will also +be included. +EOF + exit 1 +fi + +VERSION_NUMBER=$1 +# pairs. +declare -a FILE_NAMES=( \ + windows_x86 windows-x86_32.exe \ + windows_x64 windows-x86_64.exe \ + macosx_x86 osx-x86_32.exe \ + macosx_x64 osx-x86_64.exe \ + linux_x86 linux-x86_32.exe \ + linux_x64 linux-x86_64.exe \ +) + +set -e + +mkdir -p protoc +# Create a zip file for each binary. +for((i=0;i<${#FILE_NAMES[@]};i+=2));do + DIR_NAME=${FILE_NAMES[$i]} + mkdir -p protoc/$DIR_NAME + + if [ ${DIR_NAME:0:3} = "win" ]; then + TARGET_BINARY="protoc.exe" + else + TARGET_BINARY="protoc" + fi + + BINARY_NAME=${FILE_NAMES[$(($i+1))]} + BINARY_URL=http://repo1.maven.org/maven2/com/google/protobuf/protoc/${VERSION_NUMBER}/protoc-${VERSION_NUMBER}-${BINARY_NAME} + + if ! wget ${BINARY_URL} -O protoc/$DIR_NAME/$TARGET_BINARY &> /dev/null; then + echo "[ERROR] Failed to download ${BINARY_URL}" >&2 + echo "[ERROR] Skipped $protoc-${VERSION_NAME}-${DIR_NAME}" >&2 + continue + fi +done + +nuget pack Google.Protobuf.Tools.nuspec diff -Nru protobuf-3.0.0/csharp/compatibility_tests/v3.0.0/protos/csharp/protos/unittest_issues.proto protobuf-3.6.1.3/csharp/compatibility_tests/v3.0.0/protos/csharp/protos/unittest_issues.proto --- protobuf-3.0.0/csharp/compatibility_tests/v3.0.0/protos/csharp/protos/unittest_issues.proto 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/csharp/compatibility_tests/v3.0.0/protos/csharp/protos/unittest_issues.proto 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,126 @@ +syntax = "proto3"; + +// These proto descriptors have at one time been reported as an issue or defect. +// They are kept here to replicate the issue, and continue to verify the fix. + +// Issue: Non-"Google.Protobuffers" namespace will ensure that protobuffer library types are qualified +option csharp_namespace = "UnitTest.Issues.TestProtos"; + +package unittest_issues; +option optimize_for = SPEED; + +// Issue 307: when generating doubly-nested types, any references +// should be of the form A.Types.B.Types.C. +message Issue307 { + message NestedOnce { + message NestedTwice { + } + } +} + +// Old issue 13: http://code.google.com/p/protobuf-csharp-port/issues/detail?id=13 +// New issue 309: https://github.com/google/protobuf/issues/309 + +// message A { +// optional int32 _A = 1; +// } + +// message B { +// optional int32 B_ = 1; +// } + +//message AB { +// optional int32 a_b = 1; +//} + +// Similar issue with numeric names +// Java code failed too, so probably best for this to be a restriction. +// See https://github.com/google/protobuf/issues/308 +// message NumberField { +// optional int32 _01 = 1; +// } + +// issue 19 - negative enum values + +enum NegativeEnum { + NEGATIVE_ENUM_ZERO = 0; + FiveBelow = -5; + MinusOne = -1; +} + +message NegativeEnumMessage { + NegativeEnum value = 1; + repeated NegativeEnum values = 2 [packed = false]; + repeated NegativeEnum packed_values = 3 [packed=true]; +} + +// Issue 21: http://code.google.com/p/protobuf-csharp-port/issues/detail?id=21 +// Decorate fields with [deprecated=true] as [System.Obsolete] + +message DeprecatedChild { +} + +enum DeprecatedEnum { + DEPRECATED_ZERO = 0; + one = 1; +} + +message DeprecatedFieldsMessage { + int32 PrimitiveValue = 1 [deprecated = true]; + repeated int32 PrimitiveArray = 2 [deprecated = true]; + + DeprecatedChild MessageValue = 3 [deprecated = true]; + repeated DeprecatedChild MessageArray = 4 [deprecated = true]; + + DeprecatedEnum EnumValue = 5 [deprecated = true]; + repeated DeprecatedEnum EnumArray = 6 [deprecated = true]; +} + +// Issue 45: http://code.google.com/p/protobuf-csharp-port/issues/detail?id=45 +message ItemField { + int32 item = 1; +} + +message ReservedNames { + // Force a nested type called Types + message SomeNestedType { + } + + int32 types = 1; + int32 descriptor = 2; +} + +message TestJsonFieldOrdering { + // These fields are deliberately not declared in numeric + // order, and the oneof fields aren't contiguous either. + // This allows for reasonably robust tests of JSON output + // ordering. + // TestFieldOrderings in unittest_proto3.proto is similar, + // but doesn't include oneofs. + // TODO: Consider adding oneofs to TestFieldOrderings, although + // that will require fixing other tests in multiple platforms. + // Alternatively, consider just adding this to + // unittest_proto3.proto if multiple platforms want it. + + int32 plain_int32 = 4; + + oneof o1 { + string o1_string = 2; + int32 o1_int32 = 5; + } + + string plain_string = 1; + + oneof o2 { + int32 o2_int32 = 6; + string o2_string = 3; + } + +} + +message TestJsonName { + // Message for testing the effects for of the json_name option + string name = 1; + string description = 2 [json_name = "desc"]; + string guid = 3 [json_name = "exid"]; +} diff -Nru protobuf-3.0.0/csharp/compatibility_tests/v3.0.0/protos/src/google/protobuf/map_unittest_proto3.proto protobuf-3.6.1.3/csharp/compatibility_tests/v3.0.0/protos/src/google/protobuf/map_unittest_proto3.proto --- protobuf-3.0.0/csharp/compatibility_tests/v3.0.0/protos/src/google/protobuf/map_unittest_proto3.proto 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/csharp/compatibility_tests/v3.0.0/protos/src/google/protobuf/map_unittest_proto3.proto 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,120 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// This file is mostly equivalent to map_unittest.proto, but imports +// unittest_proto3.proto instead of unittest.proto, so that it only +// uses proto3 messages. This makes it suitable for testing +// implementations which only support proto3. +// The TestRequiredMessageMap message has been removed as there are no +// required fields in proto3. +syntax = "proto3"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Protobuf.TestProtos"; + +import "google/protobuf/unittest_proto3.proto"; + +// We don't put this in a package within proto2 because we need to make sure +// that the generated code doesn't depend on being in the proto2 namespace. +// In map_test_util.h we do "using namespace unittest = protobuf_unittest". +package protobuf_unittest; + +// Tests maps. +message TestMap { + map map_int32_int32 = 1; + map map_int64_int64 = 2; + map map_uint32_uint32 = 3; + map map_uint64_uint64 = 4; + map map_sint32_sint32 = 5; + map map_sint64_sint64 = 6; + map map_fixed32_fixed32 = 7; + map map_fixed64_fixed64 = 8; + map map_sfixed32_sfixed32 = 9; + map map_sfixed64_sfixed64 = 10; + map map_int32_float = 11; + map map_int32_double = 12; + map map_bool_bool = 13; + map map_string_string = 14; + map map_int32_bytes = 15; + map map_int32_enum = 16; + map map_int32_foreign_message = 17; +} + +message TestMapSubmessage { + TestMap test_map = 1; +} + +message TestMessageMap { + map map_int32_message = 1; +} + +// Two map fields share the same entry default instance. +message TestSameTypeMap { + map map1 = 1; + map map2 = 2; +} + +enum MapEnum { + MAP_ENUM_FOO = 0; + MAP_ENUM_BAR = 1; + MAP_ENUM_BAZ = 2; +} + +message TestArenaMap { + map map_int32_int32 = 1; + map map_int64_int64 = 2; + map map_uint32_uint32 = 3; + map map_uint64_uint64 = 4; + map map_sint32_sint32 = 5; + map map_sint64_sint64 = 6; + map map_fixed32_fixed32 = 7; + map map_fixed64_fixed64 = 8; + map map_sfixed32_sfixed32 = 9; + map map_sfixed64_sfixed64 = 10; + map map_int32_float = 11; + map map_int32_double = 12; + map map_bool_bool = 13; + map map_int32_enum = 14; + map map_int32_foreign_message = 15; +} + +// Previously, message containing enum called Type cannot be used as value of +// map field. +message MessageContainingEnumCalledType { + enum Type { + TYPE_FOO = 0; + } + map type = 1; +} + +// Previously, message cannot contain map field called "entry". +message MessageContainingMapCalledEntry { + map entry = 1; +} diff -Nru protobuf-3.0.0/csharp/compatibility_tests/v3.0.0/protos/src/google/protobuf/unittest_import_proto3.proto protobuf-3.6.1.3/csharp/compatibility_tests/v3.0.0/protos/src/google/protobuf/unittest_import_proto3.proto --- protobuf-3.0.0/csharp/compatibility_tests/v3.0.0/protos/src/google/protobuf/unittest_import_proto3.proto 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/csharp/compatibility_tests/v3.0.0/protos/src/google/protobuf/unittest_import_proto3.proto 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,68 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Author: kenton@google.com (Kenton Varda) +// Based on original Protocol Buffers design by +// Sanjay Ghemawat, Jeff Dean, and others. +// +// A proto file which is imported by unittest_proto3.proto to test importing. + +syntax = "proto3"; + +// We don't put this in a package within proto2 because we need to make sure +// that the generated code doesn't depend on being in the proto2 namespace. +// In test_util.h we do +// "using namespace unittest_import = protobuf_unittest_import". +package protobuf_unittest_import; + +option optimize_for = SPEED; +option cc_enable_arenas = true; + +// Exercise the java_package option. +option java_package = "com.google.protobuf.test"; +option csharp_namespace = "Google.Protobuf.TestProtos"; + +// Do not set a java_outer_classname here to verify that Proto2 works without +// one. + +// Test public import +import public "google/protobuf/unittest_import_public_proto3.proto"; + +message ImportMessage { + int32 d = 1; +} + +enum ImportEnum { + IMPORT_ENUM_UNSPECIFIED = 0; + IMPORT_FOO = 7; + IMPORT_BAR = 8; + IMPORT_BAZ = 9; +} + diff -Nru protobuf-3.0.0/csharp/compatibility_tests/v3.0.0/protos/src/google/protobuf/unittest_import_public_proto3.proto protobuf-3.6.1.3/csharp/compatibility_tests/v3.0.0/protos/src/google/protobuf/unittest_import_public_proto3.proto --- protobuf-3.0.0/csharp/compatibility_tests/v3.0.0/protos/src/google/protobuf/unittest_import_public_proto3.proto 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/csharp/compatibility_tests/v3.0.0/protos/src/google/protobuf/unittest_import_public_proto3.proto 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,42 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Author: liujisi@google.com (Pherl Liu) + +syntax = "proto3"; + +package protobuf_unittest_import; + +option java_package = "com.google.protobuf.test"; +option csharp_namespace = "Google.Protobuf.TestProtos"; + +message PublicImportMessage { + int32 e = 1; +} diff -Nru protobuf-3.0.0/csharp/compatibility_tests/v3.0.0/protos/src/google/protobuf/unittest_proto3.proto protobuf-3.6.1.3/csharp/compatibility_tests/v3.0.0/protos/src/google/protobuf/unittest_proto3.proto --- protobuf-3.0.0/csharp/compatibility_tests/v3.0.0/protos/src/google/protobuf/unittest_proto3.proto 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/csharp/compatibility_tests/v3.0.0/protos/src/google/protobuf/unittest_proto3.proto 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,388 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Author: kenton@google.com (Kenton Varda) +// Based on original Protocol Buffers design by +// Sanjay Ghemawat, Jeff Dean, and others. +// +// A proto file we will use for unit testing. + +syntax = "proto3"; + +// Some generic_services option(s) added automatically. +// See: http://go/proto2-generic-services-default +option cc_generic_services = true; // auto-added +option java_generic_services = true; // auto-added +option py_generic_services = true; // auto-added +option cc_enable_arenas = true; +option csharp_namespace = "Google.Protobuf.TestProtos"; + +import "google/protobuf/unittest_import_proto3.proto"; + +// We don't put this in a package within proto2 because we need to make sure +// that the generated code doesn't depend on being in the proto2 namespace. +// In test_util.h we do "using namespace unittest = protobuf_unittest". +package protobuf_unittest; + +// Protos optimized for SPEED use a strict superset of the generated code +// of equivalent ones optimized for CODE_SIZE, so we should optimize all our +// tests for speed unless explicitly testing code size optimization. +option optimize_for = SPEED; + +option java_outer_classname = "UnittestProto"; + +// This proto includes every type of field in both singular and repeated +// forms. +message TestAllTypes { + message NestedMessage { + // The field name "b" fails to compile in proto1 because it conflicts with + // a local variable named "b" in one of the generated methods. Doh. + // This file needs to compile in proto1 to test backwards-compatibility. + int32 bb = 1; + } + + enum NestedEnum { + NESTED_ENUM_UNSPECIFIED = 0; + FOO = 1; + BAR = 2; + BAZ = 3; + NEG = -1; // Intentionally negative. + } + + // Singular + int32 single_int32 = 1; + int64 single_int64 = 2; + uint32 single_uint32 = 3; + uint64 single_uint64 = 4; + sint32 single_sint32 = 5; + sint64 single_sint64 = 6; + fixed32 single_fixed32 = 7; + fixed64 single_fixed64 = 8; + sfixed32 single_sfixed32 = 9; + sfixed64 single_sfixed64 = 10; + float single_float = 11; + double single_double = 12; + bool single_bool = 13; + string single_string = 14; + bytes single_bytes = 15; + + NestedMessage single_nested_message = 18; + ForeignMessage single_foreign_message = 19; + protobuf_unittest_import.ImportMessage single_import_message = 20; + + NestedEnum single_nested_enum = 21; + ForeignEnum single_foreign_enum = 22; + protobuf_unittest_import.ImportEnum single_import_enum = 23; + + // Defined in unittest_import_public.proto + protobuf_unittest_import.PublicImportMessage + single_public_import_message = 26; + + // Repeated + repeated int32 repeated_int32 = 31; + repeated int64 repeated_int64 = 32; + repeated uint32 repeated_uint32 = 33; + repeated uint64 repeated_uint64 = 34; + repeated sint32 repeated_sint32 = 35; + repeated sint64 repeated_sint64 = 36; + repeated fixed32 repeated_fixed32 = 37; + repeated fixed64 repeated_fixed64 = 38; + repeated sfixed32 repeated_sfixed32 = 39; + repeated sfixed64 repeated_sfixed64 = 40; + repeated float repeated_float = 41; + repeated double repeated_double = 42; + repeated bool repeated_bool = 43; + repeated string repeated_string = 44; + repeated bytes repeated_bytes = 45; + + repeated NestedMessage repeated_nested_message = 48; + repeated ForeignMessage repeated_foreign_message = 49; + repeated protobuf_unittest_import.ImportMessage repeated_import_message = 50; + + repeated NestedEnum repeated_nested_enum = 51; + repeated ForeignEnum repeated_foreign_enum = 52; + repeated protobuf_unittest_import.ImportEnum repeated_import_enum = 53; + // Defined in unittest_import_public.proto + repeated protobuf_unittest_import.PublicImportMessage + repeated_public_import_message = 54; + + // For oneof test + oneof oneof_field { + uint32 oneof_uint32 = 111; + NestedMessage oneof_nested_message = 112; + string oneof_string = 113; + bytes oneof_bytes = 114; + } +} + +// This proto includes a recusively nested message. +message NestedTestAllTypes { + NestedTestAllTypes child = 1; + TestAllTypes payload = 2; + repeated NestedTestAllTypes repeated_child = 3; +} + +message TestDeprecatedFields { + int32 deprecated_int32 = 1 [deprecated=true]; +} + +// Define these after TestAllTypes to make sure the compiler can handle +// that. +message ForeignMessage { + int32 c = 1; +} + +enum ForeignEnum { + FOREIGN_UNSPECIFIED = 0; + FOREIGN_FOO = 4; + FOREIGN_BAR = 5; + FOREIGN_BAZ = 6; +} + +message TestReservedFields { + reserved 2, 15, 9 to 11; + reserved "bar", "baz"; +} + + +// Test that we can use NestedMessage from outside TestAllTypes. +message TestForeignNested { + TestAllTypes.NestedMessage foreign_nested = 1; +} + +// Test that really large tag numbers don't break anything. +message TestReallyLargeTagNumber { + // The largest possible tag number is 2^28 - 1, since the wire format uses + // three bits to communicate wire type. + int32 a = 1; + int32 bb = 268435455; +} + +message TestRecursiveMessage { + TestRecursiveMessage a = 1; + int32 i = 2; +} + +// Test that mutual recursion works. +message TestMutualRecursionA { + TestMutualRecursionB bb = 1; +} + +message TestMutualRecursionB { + TestMutualRecursionA a = 1; + int32 optional_int32 = 2; +} + + +// Test an enum that has multiple values with the same number. +enum TestEnumWithDupValue { + TEST_ENUM_WITH_DUP_VALUE_UNSPECIFIED = 0; + option allow_alias = true; + + FOO1 = 1; + BAR1 = 2; + BAZ = 3; + FOO2 = 1; + BAR2 = 2; +} + +// Test an enum with large, unordered values. +enum TestSparseEnum { + TEST_SPARSE_ENUM_UNSPECIFIED = 0; + SPARSE_A = 123; + SPARSE_B = 62374; + SPARSE_C = 12589234; + SPARSE_D = -15; + SPARSE_E = -53452; + // In proto3, value 0 must be the first one specified + // SPARSE_F = 0; + SPARSE_G = 2; +} + +// Test message with CamelCase field names. This violates Protocol Buffer +// standard style. +message TestCamelCaseFieldNames { + int32 PrimitiveField = 1; + string StringField = 2; + ForeignEnum EnumField = 3; + ForeignMessage MessageField = 4; + + repeated int32 RepeatedPrimitiveField = 7; + repeated string RepeatedStringField = 8; + repeated ForeignEnum RepeatedEnumField = 9; + repeated ForeignMessage RepeatedMessageField = 10; +} + + +// We list fields out of order, to ensure that we're using field number and not +// field index to determine serialization order. +message TestFieldOrderings { + string my_string = 11; + int64 my_int = 1; + float my_float = 101; + message NestedMessage { + int64 oo = 2; + // The field name "b" fails to compile in proto1 because it conflicts with + // a local variable named "b" in one of the generated methods. Doh. + // This file needs to compile in proto1 to test backwards-compatibility. + int32 bb = 1; + } + + NestedMessage single_nested_message = 200; +} + +message SparseEnumMessage { + TestSparseEnum sparse_enum = 1; +} + +// Test String and Bytes: string is for valid UTF-8 strings +message OneString { + string data = 1; +} + +message MoreString { + repeated string data = 1; +} + +message OneBytes { + bytes data = 1; +} + +message MoreBytes { + bytes data = 1; +} + +// Test int32, uint32, int64, uint64, and bool are all compatible +message Int32Message { + int32 data = 1; +} + +message Uint32Message { + uint32 data = 1; +} + +message Int64Message { + int64 data = 1; +} + +message Uint64Message { + uint64 data = 1; +} + +message BoolMessage { + bool data = 1; +} + +// Test oneofs. +message TestOneof { + oneof foo { + int32 foo_int = 1; + string foo_string = 2; + TestAllTypes foo_message = 3; + } +} + +// Test messages for packed fields + +message TestPackedTypes { + repeated int32 packed_int32 = 90 [packed = true]; + repeated int64 packed_int64 = 91 [packed = true]; + repeated uint32 packed_uint32 = 92 [packed = true]; + repeated uint64 packed_uint64 = 93 [packed = true]; + repeated sint32 packed_sint32 = 94 [packed = true]; + repeated sint64 packed_sint64 = 95 [packed = true]; + repeated fixed32 packed_fixed32 = 96 [packed = true]; + repeated fixed64 packed_fixed64 = 97 [packed = true]; + repeated sfixed32 packed_sfixed32 = 98 [packed = true]; + repeated sfixed64 packed_sfixed64 = 99 [packed = true]; + repeated float packed_float = 100 [packed = true]; + repeated double packed_double = 101 [packed = true]; + repeated bool packed_bool = 102 [packed = true]; + repeated ForeignEnum packed_enum = 103 [packed = true]; +} + +// A message with the same fields as TestPackedTypes, but without packing. Used +// to test packed <-> unpacked wire compatibility. +message TestUnpackedTypes { + repeated int32 unpacked_int32 = 90 [packed = false]; + repeated int64 unpacked_int64 = 91 [packed = false]; + repeated uint32 unpacked_uint32 = 92 [packed = false]; + repeated uint64 unpacked_uint64 = 93 [packed = false]; + repeated sint32 unpacked_sint32 = 94 [packed = false]; + repeated sint64 unpacked_sint64 = 95 [packed = false]; + repeated fixed32 unpacked_fixed32 = 96 [packed = false]; + repeated fixed64 unpacked_fixed64 = 97 [packed = false]; + repeated sfixed32 unpacked_sfixed32 = 98 [packed = false]; + repeated sfixed64 unpacked_sfixed64 = 99 [packed = false]; + repeated float unpacked_float = 100 [packed = false]; + repeated double unpacked_double = 101 [packed = false]; + repeated bool unpacked_bool = 102 [packed = false]; + repeated ForeignEnum unpacked_enum = 103 [packed = false]; +} + +message TestRepeatedScalarDifferentTagSizes { + // Parsing repeated fixed size values used to fail. This message needs to be + // used in order to get a tag of the right size; all of the repeated fields + // in TestAllTypes didn't trigger the check. + repeated fixed32 repeated_fixed32 = 12; + // Check for a varint type, just for good measure. + repeated int32 repeated_int32 = 13; + + // These have two-byte tags. + repeated fixed64 repeated_fixed64 = 2046; + repeated int64 repeated_int64 = 2047; + + // Three byte tags. + repeated float repeated_float = 262142; + repeated uint64 repeated_uint64 = 262143; +} + +message TestCommentInjectionMessage { + // */ <- This should not close the generated doc comment + string a = 1; +} + + +// Test that RPC services work. +message FooRequest {} +message FooResponse {} + +message FooClientMessage {} +message FooServerMessage{} + +service TestService { + rpc Foo(FooRequest) returns (FooResponse); + rpc Bar(BarRequest) returns (BarResponse); +} + + +message BarRequest {} +message BarResponse {} + diff -Nru protobuf-3.0.0/csharp/compatibility_tests/v3.0.0/protos/src/google/protobuf/unittest_well_known_types.proto protobuf-3.6.1.3/csharp/compatibility_tests/v3.0.0/protos/src/google/protobuf/unittest_well_known_types.proto --- protobuf-3.0.0/csharp/compatibility_tests/v3.0.0/protos/src/google/protobuf/unittest_well_known_types.proto 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/csharp/compatibility_tests/v3.0.0/protos/src/google/protobuf/unittest_well_known_types.proto 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,114 @@ +syntax = "proto3"; + +package protobuf_unittest; + +option csharp_namespace = "Google.Protobuf.TestProtos"; +option java_multiple_files = true; +option java_package = "com.google.protobuf.test"; + +import "google/protobuf/any.proto"; +import "google/protobuf/api.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/source_context.proto"; +import "google/protobuf/struct.proto"; +import "google/protobuf/timestamp.proto"; +import "google/protobuf/type.proto"; +import "google/protobuf/wrappers.proto"; + +// Test that we can include all well-known types. +// Each wrapper type is included separately, as languages +// map handle different wrappers in different ways. +message TestWellKnownTypes { + google.protobuf.Any any_field = 1; + google.protobuf.Api api_field = 2; + google.protobuf.Duration duration_field = 3; + google.protobuf.Empty empty_field = 4; + google.protobuf.FieldMask field_mask_field = 5; + google.protobuf.SourceContext source_context_field = 6; + google.protobuf.Struct struct_field = 7; + google.protobuf.Timestamp timestamp_field = 8; + google.protobuf.Type type_field = 9; + google.protobuf.DoubleValue double_field = 10; + google.protobuf.FloatValue float_field = 11; + google.protobuf.Int64Value int64_field = 12; + google.protobuf.UInt64Value uint64_field = 13; + google.protobuf.Int32Value int32_field = 14; + google.protobuf.UInt32Value uint32_field = 15; + google.protobuf.BoolValue bool_field = 16; + google.protobuf.StringValue string_field = 17; + google.protobuf.BytesValue bytes_field = 18; + // Part of struct, but useful to be able to test separately + google.protobuf.Value value_field = 19; +} + +// A repeated field for each well-known type. +message RepeatedWellKnownTypes { + repeated google.protobuf.Any any_field = 1; + repeated google.protobuf.Api api_field = 2; + repeated google.protobuf.Duration duration_field = 3; + repeated google.protobuf.Empty empty_field = 4; + repeated google.protobuf.FieldMask field_mask_field = 5; + repeated google.protobuf.SourceContext source_context_field = 6; + repeated google.protobuf.Struct struct_field = 7; + repeated google.protobuf.Timestamp timestamp_field = 8; + repeated google.protobuf.Type type_field = 9; + // These don't actually make a lot of sense, but they're not prohibited... + repeated google.protobuf.DoubleValue double_field = 10; + repeated google.protobuf.FloatValue float_field = 11; + repeated google.protobuf.Int64Value int64_field = 12; + repeated google.protobuf.UInt64Value uint64_field = 13; + repeated google.protobuf.Int32Value int32_field = 14; + repeated google.protobuf.UInt32Value uint32_field = 15; + repeated google.protobuf.BoolValue bool_field = 16; + repeated google.protobuf.StringValue string_field = 17; + repeated google.protobuf.BytesValue bytes_field = 18; +} + +message OneofWellKnownTypes { + oneof oneof_field { + google.protobuf.Any any_field = 1; + google.protobuf.Api api_field = 2; + google.protobuf.Duration duration_field = 3; + google.protobuf.Empty empty_field = 4; + google.protobuf.FieldMask field_mask_field = 5; + google.protobuf.SourceContext source_context_field = 6; + google.protobuf.Struct struct_field = 7; + google.protobuf.Timestamp timestamp_field = 8; + google.protobuf.Type type_field = 9; + google.protobuf.DoubleValue double_field = 10; + google.protobuf.FloatValue float_field = 11; + google.protobuf.Int64Value int64_field = 12; + google.protobuf.UInt64Value uint64_field = 13; + google.protobuf.Int32Value int32_field = 14; + google.protobuf.UInt32Value uint32_field = 15; + google.protobuf.BoolValue bool_field = 16; + google.protobuf.StringValue string_field = 17; + google.protobuf.BytesValue bytes_field = 18; + } +} + +// A map field for each well-known type. We only +// need to worry about the value part of the map being the +// well-known types, as messages can't be map keys. +message MapWellKnownTypes { + map any_field = 1; + map api_field = 2; + map duration_field = 3; + map empty_field = 4; + map field_mask_field = 5; + map source_context_field = 6; + map struct_field = 7; + map timestamp_field = 8; + map type_field = 9; + map double_field = 10; + map float_field = 11; + map int64_field = 12; + map uint64_field = 13; + map int32_field = 14; + map uint32_field = 15; + map bool_field = 16; + map string_field = 17; + map bytes_field = 18; +} diff -Nru protobuf-3.0.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/ByteStringTest.cs protobuf-3.6.1.3/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/ByteStringTest.cs --- protobuf-3.0.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/ByteStringTest.cs 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/ByteStringTest.cs 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,171 @@ +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using System; +using System.Text; +using NUnit.Framework; + +namespace Google.Protobuf +{ + public class ByteStringTest + { + [Test] + public void Equality() + { + ByteString b1 = ByteString.CopyFrom(1, 2, 3); + ByteString b2 = ByteString.CopyFrom(1, 2, 3); + ByteString b3 = ByteString.CopyFrom(1, 2, 4); + ByteString b4 = ByteString.CopyFrom(1, 2, 3, 4); + EqualityTester.AssertEquality(b1, b1); + EqualityTester.AssertEquality(b1, b2); + EqualityTester.AssertInequality(b1, b3); + EqualityTester.AssertInequality(b1, b4); + EqualityTester.AssertInequality(b1, null); +#pragma warning disable 1718 // Deliberately calling ==(b1, b1) and !=(b1, b1) + Assert.IsTrue(b1 == b1); + Assert.IsTrue(b1 == b2); + Assert.IsFalse(b1 == b3); + Assert.IsFalse(b1 == b4); + Assert.IsFalse(b1 == null); + Assert.IsTrue((ByteString) null == null); + Assert.IsFalse(b1 != b1); + Assert.IsFalse(b1 != b2); +#pragma warning disable 1718 + Assert.IsTrue(b1 != b3); + Assert.IsTrue(b1 != b4); + Assert.IsTrue(b1 != null); + Assert.IsFalse((ByteString) null != null); + } + + [Test] + public void EmptyByteStringHasZeroSize() + { + Assert.AreEqual(0, ByteString.Empty.Length); + } + + [Test] + public void CopyFromStringWithExplicitEncoding() + { + ByteString bs = ByteString.CopyFrom("AB", Encoding.Unicode); + Assert.AreEqual(4, bs.Length); + Assert.AreEqual(65, bs[0]); + Assert.AreEqual(0, bs[1]); + Assert.AreEqual(66, bs[2]); + Assert.AreEqual(0, bs[3]); + } + + [Test] + public void IsEmptyWhenEmpty() + { + Assert.IsTrue(ByteString.CopyFromUtf8("").IsEmpty); + } + + [Test] + public void IsEmptyWhenNotEmpty() + { + Assert.IsFalse(ByteString.CopyFromUtf8("X").IsEmpty); + } + + [Test] + public void CopyFromByteArrayCopiesContents() + { + byte[] data = new byte[1]; + data[0] = 10; + ByteString bs = ByteString.CopyFrom(data); + Assert.AreEqual(10, bs[0]); + data[0] = 5; + Assert.AreEqual(10, bs[0]); + } + + [Test] + public void ToByteArrayCopiesContents() + { + ByteString bs = ByteString.CopyFromUtf8("Hello"); + byte[] data = bs.ToByteArray(); + Assert.AreEqual((byte)'H', data[0]); + Assert.AreEqual((byte)'H', bs[0]); + data[0] = 0; + Assert.AreEqual(0, data[0]); + Assert.AreEqual((byte)'H', bs[0]); + } + + [Test] + public void CopyFromUtf8UsesUtf8() + { + ByteString bs = ByteString.CopyFromUtf8("\u20ac"); + Assert.AreEqual(3, bs.Length); + Assert.AreEqual(0xe2, bs[0]); + Assert.AreEqual(0x82, bs[1]); + Assert.AreEqual(0xac, bs[2]); + } + + [Test] + public void CopyFromPortion() + { + byte[] data = new byte[] {0, 1, 2, 3, 4, 5, 6}; + ByteString bs = ByteString.CopyFrom(data, 2, 3); + Assert.AreEqual(3, bs.Length); + Assert.AreEqual(2, bs[0]); + Assert.AreEqual(3, bs[1]); + } + + [Test] + public void ToStringUtf8() + { + ByteString bs = ByteString.CopyFromUtf8("\u20ac"); + Assert.AreEqual("\u20ac", bs.ToStringUtf8()); + } + + [Test] + public void ToStringWithExplicitEncoding() + { + ByteString bs = ByteString.CopyFrom("\u20ac", Encoding.Unicode); + Assert.AreEqual("\u20ac", bs.ToString(Encoding.Unicode)); + } + + [Test] + public void FromBase64_WithText() + { + byte[] data = new byte[] {0, 1, 2, 3, 4, 5, 6}; + string base64 = Convert.ToBase64String(data); + ByteString bs = ByteString.FromBase64(base64); + Assert.AreEqual(data, bs.ToByteArray()); + } + + [Test] + public void FromBase64_Empty() + { + // Optimization which also fixes issue 61. + Assert.AreSame(ByteString.Empty, ByteString.FromBase64("")); + } + } +} \ No newline at end of file diff -Nru protobuf-3.0.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/CodedInputStreamExtensions.cs protobuf-3.6.1.3/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/CodedInputStreamExtensions.cs --- protobuf-3.0.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/CodedInputStreamExtensions.cs 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/CodedInputStreamExtensions.cs 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,53 @@ +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2015 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using NUnit.Framework; + +namespace Google.Protobuf +{ + internal static class CodedInputStreamExtensions + { + public static void AssertNextTag(this CodedInputStream input, uint expectedTag) + { + uint tag = input.ReadTag(); + Assert.AreEqual(expectedTag, tag); + } + + public static T ReadMessage(this CodedInputStream stream, MessageParser parser) + where T : IMessage + { + var message = parser.CreateTemplate(); + stream.ReadMessage(message); + return message; + } + } +} diff -Nru protobuf-3.0.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/CodedInputStreamTest.cs protobuf-3.6.1.3/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/CodedInputStreamTest.cs --- protobuf-3.0.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/CodedInputStreamTest.cs 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/CodedInputStreamTest.cs 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,598 @@ +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using System; +using System.IO; +using Google.Protobuf.TestProtos; +using NUnit.Framework; + +namespace Google.Protobuf +{ + public class CodedInputStreamTest + { + /// + /// Helper to construct a byte array from a bunch of bytes. The inputs are + /// actually ints so that I can use hex notation and not get stupid errors + /// about precision. + /// + private static byte[] Bytes(params int[] bytesAsInts) + { + byte[] bytes = new byte[bytesAsInts.Length]; + for (int i = 0; i < bytesAsInts.Length; i++) + { + bytes[i] = (byte) bytesAsInts[i]; + } + return bytes; + } + + /// + /// Parses the given bytes using ReadRawVarint32() and ReadRawVarint64() + /// + private static void AssertReadVarint(byte[] data, ulong value) + { + CodedInputStream input = new CodedInputStream(data); + Assert.AreEqual((uint) value, input.ReadRawVarint32()); + + input = new CodedInputStream(data); + Assert.AreEqual(value, input.ReadRawVarint64()); + Assert.IsTrue(input.IsAtEnd); + + // Try different block sizes. + for (int bufferSize = 1; bufferSize <= 16; bufferSize *= 2) + { + input = new CodedInputStream(new SmallBlockInputStream(data, bufferSize)); + Assert.AreEqual((uint) value, input.ReadRawVarint32()); + + input = new CodedInputStream(new SmallBlockInputStream(data, bufferSize)); + Assert.AreEqual(value, input.ReadRawVarint64()); + Assert.IsTrue(input.IsAtEnd); + } + + // Try reading directly from a MemoryStream. We want to verify that it + // doesn't read past the end of the input, so write an extra byte - this + // lets us test the position at the end. + MemoryStream memoryStream = new MemoryStream(); + memoryStream.Write(data, 0, data.Length); + memoryStream.WriteByte(0); + memoryStream.Position = 0; + Assert.AreEqual((uint) value, CodedInputStream.ReadRawVarint32(memoryStream)); + Assert.AreEqual(data.Length, memoryStream.Position); + } + + /// + /// Parses the given bytes using ReadRawVarint32() and ReadRawVarint64() and + /// expects them to fail with an InvalidProtocolBufferException whose + /// description matches the given one. + /// + private static void AssertReadVarintFailure(InvalidProtocolBufferException expected, byte[] data) + { + CodedInputStream input = new CodedInputStream(data); + var exception = Assert.Throws(() => input.ReadRawVarint32()); + Assert.AreEqual(expected.Message, exception.Message); + + input = new CodedInputStream(data); + exception = Assert.Throws(() => input.ReadRawVarint64()); + Assert.AreEqual(expected.Message, exception.Message); + + // Make sure we get the same error when reading directly from a Stream. + exception = Assert.Throws(() => CodedInputStream.ReadRawVarint32(new MemoryStream(data))); + Assert.AreEqual(expected.Message, exception.Message); + } + + [Test] + public void ReadVarint() + { + AssertReadVarint(Bytes(0x00), 0); + AssertReadVarint(Bytes(0x01), 1); + AssertReadVarint(Bytes(0x7f), 127); + // 14882 + AssertReadVarint(Bytes(0xa2, 0x74), (0x22 << 0) | (0x74 << 7)); + // 2961488830 + AssertReadVarint(Bytes(0xbe, 0xf7, 0x92, 0x84, 0x0b), + (0x3e << 0) | (0x77 << 7) | (0x12 << 14) | (0x04 << 21) | + (0x0bL << 28)); + + // 64-bit + // 7256456126 + AssertReadVarint(Bytes(0xbe, 0xf7, 0x92, 0x84, 0x1b), + (0x3e << 0) | (0x77 << 7) | (0x12 << 14) | (0x04 << 21) | + (0x1bL << 28)); + // 41256202580718336 + AssertReadVarint(Bytes(0x80, 0xe6, 0xeb, 0x9c, 0xc3, 0xc9, 0xa4, 0x49), + (0x00 << 0) | (0x66 << 7) | (0x6b << 14) | (0x1c << 21) | + (0x43L << 28) | (0x49L << 35) | (0x24L << 42) | (0x49L << 49)); + // 11964378330978735131 + AssertReadVarint(Bytes(0x9b, 0xa8, 0xf9, 0xc2, 0xbb, 0xd6, 0x80, 0x85, 0xa6, 0x01), + (0x1b << 0) | (0x28 << 7) | (0x79 << 14) | (0x42 << 21) | + (0x3bUL << 28) | (0x56UL << 35) | (0x00UL << 42) | + (0x05UL << 49) | (0x26UL << 56) | (0x01UL << 63)); + + // Failures + AssertReadVarintFailure( + InvalidProtocolBufferException.MalformedVarint(), + Bytes(0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, + 0x00)); + AssertReadVarintFailure( + InvalidProtocolBufferException.TruncatedMessage(), + Bytes(0x80)); + } + + /// + /// Parses the given bytes using ReadRawLittleEndian32() and checks + /// that the result matches the given value. + /// + private static void AssertReadLittleEndian32(byte[] data, uint value) + { + CodedInputStream input = new CodedInputStream(data); + Assert.AreEqual(value, input.ReadRawLittleEndian32()); + Assert.IsTrue(input.IsAtEnd); + + // Try different block sizes. + for (int blockSize = 1; blockSize <= 16; blockSize *= 2) + { + input = new CodedInputStream( + new SmallBlockInputStream(data, blockSize)); + Assert.AreEqual(value, input.ReadRawLittleEndian32()); + Assert.IsTrue(input.IsAtEnd); + } + } + + /// + /// Parses the given bytes using ReadRawLittleEndian64() and checks + /// that the result matches the given value. + /// + private static void AssertReadLittleEndian64(byte[] data, ulong value) + { + CodedInputStream input = new CodedInputStream(data); + Assert.AreEqual(value, input.ReadRawLittleEndian64()); + Assert.IsTrue(input.IsAtEnd); + + // Try different block sizes. + for (int blockSize = 1; blockSize <= 16; blockSize *= 2) + { + input = new CodedInputStream( + new SmallBlockInputStream(data, blockSize)); + Assert.AreEqual(value, input.ReadRawLittleEndian64()); + Assert.IsTrue(input.IsAtEnd); + } + } + + [Test] + public void ReadLittleEndian() + { + AssertReadLittleEndian32(Bytes(0x78, 0x56, 0x34, 0x12), 0x12345678); + AssertReadLittleEndian32(Bytes(0xf0, 0xde, 0xbc, 0x9a), 0x9abcdef0); + + AssertReadLittleEndian64(Bytes(0xf0, 0xde, 0xbc, 0x9a, 0x78, 0x56, 0x34, 0x12), + 0x123456789abcdef0L); + AssertReadLittleEndian64( + Bytes(0x78, 0x56, 0x34, 0x12, 0xf0, 0xde, 0xbc, 0x9a), 0x9abcdef012345678UL); + } + + [Test] + public void DecodeZigZag32() + { + Assert.AreEqual(0, CodedInputStream.DecodeZigZag32(0)); + Assert.AreEqual(-1, CodedInputStream.DecodeZigZag32(1)); + Assert.AreEqual(1, CodedInputStream.DecodeZigZag32(2)); + Assert.AreEqual(-2, CodedInputStream.DecodeZigZag32(3)); + Assert.AreEqual(0x3FFFFFFF, CodedInputStream.DecodeZigZag32(0x7FFFFFFE)); + Assert.AreEqual(unchecked((int) 0xC0000000), CodedInputStream.DecodeZigZag32(0x7FFFFFFF)); + Assert.AreEqual(0x7FFFFFFF, CodedInputStream.DecodeZigZag32(0xFFFFFFFE)); + Assert.AreEqual(unchecked((int) 0x80000000), CodedInputStream.DecodeZigZag32(0xFFFFFFFF)); + } + + [Test] + public void DecodeZigZag64() + { + Assert.AreEqual(0, CodedInputStream.DecodeZigZag64(0)); + Assert.AreEqual(-1, CodedInputStream.DecodeZigZag64(1)); + Assert.AreEqual(1, CodedInputStream.DecodeZigZag64(2)); + Assert.AreEqual(-2, CodedInputStream.DecodeZigZag64(3)); + Assert.AreEqual(0x000000003FFFFFFFL, CodedInputStream.DecodeZigZag64(0x000000007FFFFFFEL)); + Assert.AreEqual(unchecked((long) 0xFFFFFFFFC0000000L), CodedInputStream.DecodeZigZag64(0x000000007FFFFFFFL)); + Assert.AreEqual(0x000000007FFFFFFFL, CodedInputStream.DecodeZigZag64(0x00000000FFFFFFFEL)); + Assert.AreEqual(unchecked((long) 0xFFFFFFFF80000000L), CodedInputStream.DecodeZigZag64(0x00000000FFFFFFFFL)); + Assert.AreEqual(0x7FFFFFFFFFFFFFFFL, CodedInputStream.DecodeZigZag64(0xFFFFFFFFFFFFFFFEL)); + Assert.AreEqual(unchecked((long) 0x8000000000000000L), CodedInputStream.DecodeZigZag64(0xFFFFFFFFFFFFFFFFL)); + } + + [Test] + public void ReadWholeMessage_VaryingBlockSizes() + { + TestAllTypes message = SampleMessages.CreateFullTestAllTypes(); + + byte[] rawBytes = message.ToByteArray(); + Assert.AreEqual(rawBytes.Length, message.CalculateSize()); + TestAllTypes message2 = TestAllTypes.Parser.ParseFrom(rawBytes); + Assert.AreEqual(message, message2); + + // Try different block sizes. + for (int blockSize = 1; blockSize < 256; blockSize *= 2) + { + message2 = TestAllTypes.Parser.ParseFrom(new SmallBlockInputStream(rawBytes, blockSize)); + Assert.AreEqual(message, message2); + } + } + + [Test] + public void ReadHugeBlob() + { + // Allocate and initialize a 1MB blob. + byte[] blob = new byte[1 << 20]; + for (int i = 0; i < blob.Length; i++) + { + blob[i] = (byte) i; + } + + // Make a message containing it. + var message = new TestAllTypes { SingleBytes = ByteString.CopyFrom(blob) }; + + // Serialize and parse it. Make sure to parse from an InputStream, not + // directly from a ByteString, so that CodedInputStream uses buffered + // reading. + TestAllTypes message2 = TestAllTypes.Parser.ParseFrom(message.ToByteString()); + + Assert.AreEqual(message, message2); + } + + [Test] + public void ReadMaliciouslyLargeBlob() + { + MemoryStream ms = new MemoryStream(); + CodedOutputStream output = new CodedOutputStream(ms); + + uint tag = WireFormat.MakeTag(1, WireFormat.WireType.LengthDelimited); + output.WriteRawVarint32(tag); + output.WriteRawVarint32(0x7FFFFFFF); + output.WriteRawBytes(new byte[32]); // Pad with a few random bytes. + output.Flush(); + ms.Position = 0; + + CodedInputStream input = new CodedInputStream(ms); + Assert.AreEqual(tag, input.ReadTag()); + + Assert.Throws(() => input.ReadBytes()); + } + + internal static TestRecursiveMessage MakeRecursiveMessage(int depth) + { + if (depth == 0) + { + return new TestRecursiveMessage { I = 5 }; + } + else + { + return new TestRecursiveMessage { A = MakeRecursiveMessage(depth - 1) }; + } + } + + internal static void AssertMessageDepth(TestRecursiveMessage message, int depth) + { + if (depth == 0) + { + Assert.IsNull(message.A); + Assert.AreEqual(5, message.I); + } + else + { + Assert.IsNotNull(message.A); + AssertMessageDepth(message.A, depth - 1); + } + } + + [Test] + public void MaliciousRecursion() + { + ByteString data64 = MakeRecursiveMessage(64).ToByteString(); + ByteString data65 = MakeRecursiveMessage(65).ToByteString(); + + AssertMessageDepth(TestRecursiveMessage.Parser.ParseFrom(data64), 64); + + Assert.Throws(() => TestRecursiveMessage.Parser.ParseFrom(data65)); + + CodedInputStream input = CodedInputStream.CreateWithLimits(new MemoryStream(data64.ToByteArray()), 1000000, 63); + Assert.Throws(() => TestRecursiveMessage.Parser.ParseFrom(input)); + } + + [Test] + public void SizeLimit() + { + // Have to use a Stream rather than ByteString.CreateCodedInput as SizeLimit doesn't + // apply to the latter case. + MemoryStream ms = new MemoryStream(SampleMessages.CreateFullTestAllTypes().ToByteArray()); + CodedInputStream input = CodedInputStream.CreateWithLimits(ms, 16, 100); + Assert.Throws(() => TestAllTypes.Parser.ParseFrom(input)); + } + + /// + /// Tests that if we read an string that contains invalid UTF-8, no exception + /// is thrown. Instead, the invalid bytes are replaced with the Unicode + /// "replacement character" U+FFFD. + /// + [Test] + public void ReadInvalidUtf8() + { + MemoryStream ms = new MemoryStream(); + CodedOutputStream output = new CodedOutputStream(ms); + + uint tag = WireFormat.MakeTag(1, WireFormat.WireType.LengthDelimited); + output.WriteRawVarint32(tag); + output.WriteRawVarint32(1); + output.WriteRawBytes(new byte[] {0x80}); + output.Flush(); + ms.Position = 0; + + CodedInputStream input = new CodedInputStream(ms); + + Assert.AreEqual(tag, input.ReadTag()); + string text = input.ReadString(); + Assert.AreEqual('\ufffd', text[0]); + } + + /// + /// A stream which limits the number of bytes it reads at a time. + /// We use this to make sure that CodedInputStream doesn't screw up when + /// reading in small blocks. + /// + private sealed class SmallBlockInputStream : MemoryStream + { + private readonly int blockSize; + + public SmallBlockInputStream(byte[] data, int blockSize) + : base(data) + { + this.blockSize = blockSize; + } + + public override int Read(byte[] buffer, int offset, int count) + { + return base.Read(buffer, offset, Math.Min(count, blockSize)); + } + } + + [Test] + public void TestNegativeEnum() + { + byte[] bytes = { 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01 }; + CodedInputStream input = new CodedInputStream(bytes); + Assert.AreEqual((int)SampleEnum.NegativeValue, input.ReadEnum()); + Assert.IsTrue(input.IsAtEnd); + } + + //Issue 71: CodedInputStream.ReadBytes go to slow path unnecessarily + [Test] + public void TestSlowPathAvoidance() + { + using (var ms = new MemoryStream()) + { + CodedOutputStream output = new CodedOutputStream(ms); + output.WriteTag(1, WireFormat.WireType.LengthDelimited); + output.WriteBytes(ByteString.CopyFrom(new byte[100])); + output.WriteTag(2, WireFormat.WireType.LengthDelimited); + output.WriteBytes(ByteString.CopyFrom(new byte[100])); + output.Flush(); + + ms.Position = 0; + CodedInputStream input = new CodedInputStream(ms, new byte[ms.Length / 2], 0, 0, false); + + uint tag = input.ReadTag(); + Assert.AreEqual(1, WireFormat.GetTagFieldNumber(tag)); + Assert.AreEqual(100, input.ReadBytes().Length); + + tag = input.ReadTag(); + Assert.AreEqual(2, WireFormat.GetTagFieldNumber(tag)); + Assert.AreEqual(100, input.ReadBytes().Length); + } + } + + [Test] + public void Tag0Throws() + { + var input = new CodedInputStream(new byte[] { 0 }); + Assert.Throws(() => input.ReadTag()); + } + + [Test] + public void SkipGroup() + { + // Create an output stream with a group in: + // Field 1: string "field 1" + // Field 2: group containing: + // Field 1: fixed int32 value 100 + // Field 2: string "ignore me" + // Field 3: nested group containing + // Field 1: fixed int64 value 1000 + // Field 3: string "field 3" + var stream = new MemoryStream(); + var output = new CodedOutputStream(stream); + output.WriteTag(1, WireFormat.WireType.LengthDelimited); + output.WriteString("field 1"); + + // The outer group... + output.WriteTag(2, WireFormat.WireType.StartGroup); + output.WriteTag(1, WireFormat.WireType.Fixed32); + output.WriteFixed32(100); + output.WriteTag(2, WireFormat.WireType.LengthDelimited); + output.WriteString("ignore me"); + // The nested group... + output.WriteTag(3, WireFormat.WireType.StartGroup); + output.WriteTag(1, WireFormat.WireType.Fixed64); + output.WriteFixed64(1000); + // Note: Not sure the field number is relevant for end group... + output.WriteTag(3, WireFormat.WireType.EndGroup); + + // End the outer group + output.WriteTag(2, WireFormat.WireType.EndGroup); + + output.WriteTag(3, WireFormat.WireType.LengthDelimited); + output.WriteString("field 3"); + output.Flush(); + stream.Position = 0; + + // Now act like a generated client + var input = new CodedInputStream(stream); + Assert.AreEqual(WireFormat.MakeTag(1, WireFormat.WireType.LengthDelimited), input.ReadTag()); + Assert.AreEqual("field 1", input.ReadString()); + Assert.AreEqual(WireFormat.MakeTag(2, WireFormat.WireType.StartGroup), input.ReadTag()); + input.SkipLastField(); // Should consume the whole group, including the nested one. + Assert.AreEqual(WireFormat.MakeTag(3, WireFormat.WireType.LengthDelimited), input.ReadTag()); + Assert.AreEqual("field 3", input.ReadString()); + } + + [Test] + public void SkipGroup_WrongEndGroupTag() + { + // Create an output stream with: + // Field 1: string "field 1" + // Start group 2 + // Field 3: fixed int32 + // End group 4 (should give an error) + var stream = new MemoryStream(); + var output = new CodedOutputStream(stream); + output.WriteTag(1, WireFormat.WireType.LengthDelimited); + output.WriteString("field 1"); + + // The outer group... + output.WriteTag(2, WireFormat.WireType.StartGroup); + output.WriteTag(3, WireFormat.WireType.Fixed32); + output.WriteFixed32(100); + output.WriteTag(4, WireFormat.WireType.EndGroup); + output.Flush(); + stream.Position = 0; + + // Now act like a generated client + var input = new CodedInputStream(stream); + Assert.AreEqual(WireFormat.MakeTag(1, WireFormat.WireType.LengthDelimited), input.ReadTag()); + Assert.AreEqual("field 1", input.ReadString()); + Assert.AreEqual(WireFormat.MakeTag(2, WireFormat.WireType.StartGroup), input.ReadTag()); + Assert.Throws(input.SkipLastField); + } + + [Test] + public void RogueEndGroupTag() + { + // If we have an end-group tag without a leading start-group tag, generated + // code will just call SkipLastField... so that should fail. + + var stream = new MemoryStream(); + var output = new CodedOutputStream(stream); + output.WriteTag(1, WireFormat.WireType.EndGroup); + output.Flush(); + stream.Position = 0; + + var input = new CodedInputStream(stream); + Assert.AreEqual(WireFormat.MakeTag(1, WireFormat.WireType.EndGroup), input.ReadTag()); + Assert.Throws(input.SkipLastField); + } + + [Test] + public void EndOfStreamReachedWhileSkippingGroup() + { + var stream = new MemoryStream(); + var output = new CodedOutputStream(stream); + output.WriteTag(1, WireFormat.WireType.StartGroup); + output.WriteTag(2, WireFormat.WireType.StartGroup); + output.WriteTag(2, WireFormat.WireType.EndGroup); + + output.Flush(); + stream.Position = 0; + + // Now act like a generated client + var input = new CodedInputStream(stream); + input.ReadTag(); + Assert.Throws(input.SkipLastField); + } + + [Test] + public void RecursionLimitAppliedWhileSkippingGroup() + { + var stream = new MemoryStream(); + var output = new CodedOutputStream(stream); + for (int i = 0; i < CodedInputStream.DefaultRecursionLimit + 1; i++) + { + output.WriteTag(1, WireFormat.WireType.StartGroup); + } + for (int i = 0; i < CodedInputStream.DefaultRecursionLimit + 1; i++) + { + output.WriteTag(1, WireFormat.WireType.EndGroup); + } + output.Flush(); + stream.Position = 0; + + // Now act like a generated client + var input = new CodedInputStream(stream); + Assert.AreEqual(WireFormat.MakeTag(1, WireFormat.WireType.StartGroup), input.ReadTag()); + Assert.Throws(input.SkipLastField); + } + + [Test] + public void Construction_Invalid() + { + Assert.Throws(() => new CodedInputStream((byte[]) null)); + Assert.Throws(() => new CodedInputStream(null, 0, 0)); + Assert.Throws(() => new CodedInputStream((Stream) null)); + Assert.Throws(() => new CodedInputStream(new byte[10], 100, 0)); + Assert.Throws(() => new CodedInputStream(new byte[10], 5, 10)); + } + + [Test] + public void CreateWithLimits_InvalidLimits() + { + var stream = new MemoryStream(); + Assert.Throws(() => CodedInputStream.CreateWithLimits(stream, 0, 1)); + Assert.Throws(() => CodedInputStream.CreateWithLimits(stream, 1, 0)); + } + + [Test] + public void Dispose_DisposesUnderlyingStream() + { + var memoryStream = new MemoryStream(); + Assert.IsTrue(memoryStream.CanRead); + using (var cis = new CodedInputStream(memoryStream)) + { + } + Assert.IsFalse(memoryStream.CanRead); // Disposed + } + + [Test] + public void Dispose_WithLeaveOpen() + { + var memoryStream = new MemoryStream(); + Assert.IsTrue(memoryStream.CanRead); + using (var cis = new CodedInputStream(memoryStream, true)) + { + } + Assert.IsTrue(memoryStream.CanRead); // We left the stream open + } + } +} \ No newline at end of file diff -Nru protobuf-3.0.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/CodedOutputStreamTest.cs protobuf-3.6.1.3/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/CodedOutputStreamTest.cs --- protobuf-3.0.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/CodedOutputStreamTest.cs 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/CodedOutputStreamTest.cs 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,419 @@ +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using System; +using System.IO; +using Google.Protobuf.TestProtos; +using NUnit.Framework; + +namespace Google.Protobuf +{ + public class CodedOutputStreamTest + { + /// + /// Writes the given value using WriteRawVarint32() and WriteRawVarint64() and + /// checks that the result matches the given bytes + /// + private static void AssertWriteVarint(byte[] data, ulong value) + { + // Only do 32-bit write if the value fits in 32 bits. + if ((value >> 32) == 0) + { + MemoryStream rawOutput = new MemoryStream(); + CodedOutputStream output = new CodedOutputStream(rawOutput); + output.WriteRawVarint32((uint) value); + output.Flush(); + Assert.AreEqual(data, rawOutput.ToArray()); + // Also try computing size. + Assert.AreEqual(data.Length, CodedOutputStream.ComputeRawVarint32Size((uint) value)); + } + + { + MemoryStream rawOutput = new MemoryStream(); + CodedOutputStream output = new CodedOutputStream(rawOutput); + output.WriteRawVarint64(value); + output.Flush(); + Assert.AreEqual(data, rawOutput.ToArray()); + + // Also try computing size. + Assert.AreEqual(data.Length, CodedOutputStream.ComputeRawVarint64Size(value)); + } + + // Try different buffer sizes. + for (int bufferSize = 1; bufferSize <= 16; bufferSize *= 2) + { + // Only do 32-bit write if the value fits in 32 bits. + if ((value >> 32) == 0) + { + MemoryStream rawOutput = new MemoryStream(); + CodedOutputStream output = + new CodedOutputStream(rawOutput, bufferSize); + output.WriteRawVarint32((uint) value); + output.Flush(); + Assert.AreEqual(data, rawOutput.ToArray()); + } + + { + MemoryStream rawOutput = new MemoryStream(); + CodedOutputStream output = new CodedOutputStream(rawOutput, bufferSize); + output.WriteRawVarint64(value); + output.Flush(); + Assert.AreEqual(data, rawOutput.ToArray()); + } + } + } + + /// + /// Tests WriteRawVarint32() and WriteRawVarint64() + /// + [Test] + public void WriteVarint() + { + AssertWriteVarint(new byte[] {0x00}, 0); + AssertWriteVarint(new byte[] {0x01}, 1); + AssertWriteVarint(new byte[] {0x7f}, 127); + // 14882 + AssertWriteVarint(new byte[] {0xa2, 0x74}, (0x22 << 0) | (0x74 << 7)); + // 2961488830 + AssertWriteVarint(new byte[] {0xbe, 0xf7, 0x92, 0x84, 0x0b}, + (0x3e << 0) | (0x77 << 7) | (0x12 << 14) | (0x04 << 21) | + (0x0bL << 28)); + + // 64-bit + // 7256456126 + AssertWriteVarint(new byte[] {0xbe, 0xf7, 0x92, 0x84, 0x1b}, + (0x3e << 0) | (0x77 << 7) | (0x12 << 14) | (0x04 << 21) | + (0x1bL << 28)); + // 41256202580718336 + AssertWriteVarint( + new byte[] {0x80, 0xe6, 0xeb, 0x9c, 0xc3, 0xc9, 0xa4, 0x49}, + (0x00 << 0) | (0x66 << 7) | (0x6b << 14) | (0x1c << 21) | + (0x43UL << 28) | (0x49L << 35) | (0x24UL << 42) | (0x49UL << 49)); + // 11964378330978735131 + AssertWriteVarint( + new byte[] {0x9b, 0xa8, 0xf9, 0xc2, 0xbb, 0xd6, 0x80, 0x85, 0xa6, 0x01}, + unchecked((ulong) + ((0x1b << 0) | (0x28 << 7) | (0x79 << 14) | (0x42 << 21) | + (0x3bL << 28) | (0x56L << 35) | (0x00L << 42) | + (0x05L << 49) | (0x26L << 56) | (0x01L << 63)))); + } + + /// + /// Parses the given bytes using WriteRawLittleEndian32() and checks + /// that the result matches the given value. + /// + private static void AssertWriteLittleEndian32(byte[] data, uint value) + { + MemoryStream rawOutput = new MemoryStream(); + CodedOutputStream output = new CodedOutputStream(rawOutput); + output.WriteRawLittleEndian32(value); + output.Flush(); + Assert.AreEqual(data, rawOutput.ToArray()); + + // Try different buffer sizes. + for (int bufferSize = 1; bufferSize <= 16; bufferSize *= 2) + { + rawOutput = new MemoryStream(); + output = new CodedOutputStream(rawOutput, bufferSize); + output.WriteRawLittleEndian32(value); + output.Flush(); + Assert.AreEqual(data, rawOutput.ToArray()); + } + } + + /// + /// Parses the given bytes using WriteRawLittleEndian64() and checks + /// that the result matches the given value. + /// + private static void AssertWriteLittleEndian64(byte[] data, ulong value) + { + MemoryStream rawOutput = new MemoryStream(); + CodedOutputStream output = new CodedOutputStream(rawOutput); + output.WriteRawLittleEndian64(value); + output.Flush(); + Assert.AreEqual(data, rawOutput.ToArray()); + + // Try different block sizes. + for (int blockSize = 1; blockSize <= 16; blockSize *= 2) + { + rawOutput = new MemoryStream(); + output = new CodedOutputStream(rawOutput, blockSize); + output.WriteRawLittleEndian64(value); + output.Flush(); + Assert.AreEqual(data, rawOutput.ToArray()); + } + } + + /// + /// Tests writeRawLittleEndian32() and writeRawLittleEndian64(). + /// + [Test] + public void WriteLittleEndian() + { + AssertWriteLittleEndian32(new byte[] {0x78, 0x56, 0x34, 0x12}, 0x12345678); + AssertWriteLittleEndian32(new byte[] {0xf0, 0xde, 0xbc, 0x9a}, 0x9abcdef0); + + AssertWriteLittleEndian64( + new byte[] {0xf0, 0xde, 0xbc, 0x9a, 0x78, 0x56, 0x34, 0x12}, + 0x123456789abcdef0L); + AssertWriteLittleEndian64( + new byte[] {0x78, 0x56, 0x34, 0x12, 0xf0, 0xde, 0xbc, 0x9a}, + 0x9abcdef012345678UL); + } + + [Test] + public void WriteWholeMessage_VaryingBlockSizes() + { + TestAllTypes message = SampleMessages.CreateFullTestAllTypes(); + + byte[] rawBytes = message.ToByteArray(); + + // Try different block sizes. + for (int blockSize = 1; blockSize < 256; blockSize *= 2) + { + MemoryStream rawOutput = new MemoryStream(); + CodedOutputStream output = new CodedOutputStream(rawOutput, blockSize); + message.WriteTo(output); + output.Flush(); + Assert.AreEqual(rawBytes, rawOutput.ToArray()); + } + } + + [Test] + public void EncodeZigZag32() + { + Assert.AreEqual(0u, CodedOutputStream.EncodeZigZag32(0)); + Assert.AreEqual(1u, CodedOutputStream.EncodeZigZag32(-1)); + Assert.AreEqual(2u, CodedOutputStream.EncodeZigZag32(1)); + Assert.AreEqual(3u, CodedOutputStream.EncodeZigZag32(-2)); + Assert.AreEqual(0x7FFFFFFEu, CodedOutputStream.EncodeZigZag32(0x3FFFFFFF)); + Assert.AreEqual(0x7FFFFFFFu, CodedOutputStream.EncodeZigZag32(unchecked((int) 0xC0000000))); + Assert.AreEqual(0xFFFFFFFEu, CodedOutputStream.EncodeZigZag32(0x7FFFFFFF)); + Assert.AreEqual(0xFFFFFFFFu, CodedOutputStream.EncodeZigZag32(unchecked((int) 0x80000000))); + } + + [Test] + public void EncodeZigZag64() + { + Assert.AreEqual(0u, CodedOutputStream.EncodeZigZag64(0)); + Assert.AreEqual(1u, CodedOutputStream.EncodeZigZag64(-1)); + Assert.AreEqual(2u, CodedOutputStream.EncodeZigZag64(1)); + Assert.AreEqual(3u, CodedOutputStream.EncodeZigZag64(-2)); + Assert.AreEqual(0x000000007FFFFFFEuL, + CodedOutputStream.EncodeZigZag64(unchecked((long) 0x000000003FFFFFFFUL))); + Assert.AreEqual(0x000000007FFFFFFFuL, + CodedOutputStream.EncodeZigZag64(unchecked((long) 0xFFFFFFFFC0000000UL))); + Assert.AreEqual(0x00000000FFFFFFFEuL, + CodedOutputStream.EncodeZigZag64(unchecked((long) 0x000000007FFFFFFFUL))); + Assert.AreEqual(0x00000000FFFFFFFFuL, + CodedOutputStream.EncodeZigZag64(unchecked((long) 0xFFFFFFFF80000000UL))); + Assert.AreEqual(0xFFFFFFFFFFFFFFFEL, + CodedOutputStream.EncodeZigZag64(unchecked((long) 0x7FFFFFFFFFFFFFFFUL))); + Assert.AreEqual(0xFFFFFFFFFFFFFFFFL, + CodedOutputStream.EncodeZigZag64(unchecked((long) 0x8000000000000000UL))); + } + + [Test] + public void RoundTripZigZag32() + { + // Some easier-to-verify round-trip tests. The inputs (other than 0, 1, -1) + // were chosen semi-randomly via keyboard bashing. + Assert.AreEqual(0, CodedInputStream.DecodeZigZag32(CodedOutputStream.EncodeZigZag32(0))); + Assert.AreEqual(1, CodedInputStream.DecodeZigZag32(CodedOutputStream.EncodeZigZag32(1))); + Assert.AreEqual(-1, CodedInputStream.DecodeZigZag32(CodedOutputStream.EncodeZigZag32(-1))); + Assert.AreEqual(14927, CodedInputStream.DecodeZigZag32(CodedOutputStream.EncodeZigZag32(14927))); + Assert.AreEqual(-3612, CodedInputStream.DecodeZigZag32(CodedOutputStream.EncodeZigZag32(-3612))); + } + + [Test] + public void RoundTripZigZag64() + { + Assert.AreEqual(0, CodedInputStream.DecodeZigZag64(CodedOutputStream.EncodeZigZag64(0))); + Assert.AreEqual(1, CodedInputStream.DecodeZigZag64(CodedOutputStream.EncodeZigZag64(1))); + Assert.AreEqual(-1, CodedInputStream.DecodeZigZag64(CodedOutputStream.EncodeZigZag64(-1))); + Assert.AreEqual(14927, CodedInputStream.DecodeZigZag64(CodedOutputStream.EncodeZigZag64(14927))); + Assert.AreEqual(-3612, CodedInputStream.DecodeZigZag64(CodedOutputStream.EncodeZigZag64(-3612))); + + Assert.AreEqual(856912304801416L, + CodedInputStream.DecodeZigZag64(CodedOutputStream.EncodeZigZag64(856912304801416L))); + Assert.AreEqual(-75123905439571256L, + CodedInputStream.DecodeZigZag64(CodedOutputStream.EncodeZigZag64(-75123905439571256L))); + } + + [Test] + public void TestNegativeEnumNoTag() + { + Assert.AreEqual(10, CodedOutputStream.ComputeInt32Size(-2)); + Assert.AreEqual(10, CodedOutputStream.ComputeEnumSize((int) SampleEnum.NegativeValue)); + + byte[] bytes = new byte[10]; + CodedOutputStream output = new CodedOutputStream(bytes); + output.WriteEnum((int) SampleEnum.NegativeValue); + + Assert.AreEqual(0, output.SpaceLeft); + Assert.AreEqual("FE-FF-FF-FF-FF-FF-FF-FF-FF-01", BitConverter.ToString(bytes)); + } + + [Test] + public void TestCodedInputOutputPosition() + { + byte[] content = new byte[110]; + for (int i = 0; i < content.Length; i++) + content[i] = (byte)i; + + byte[] child = new byte[120]; + { + MemoryStream ms = new MemoryStream(child); + CodedOutputStream cout = new CodedOutputStream(ms, 20); + // Field 11: numeric value: 500 + cout.WriteTag(11, WireFormat.WireType.Varint); + Assert.AreEqual(1, cout.Position); + cout.WriteInt32(500); + Assert.AreEqual(3, cout.Position); + //Field 12: length delimited 120 bytes + cout.WriteTag(12, WireFormat.WireType.LengthDelimited); + Assert.AreEqual(4, cout.Position); + cout.WriteBytes(ByteString.CopyFrom(content)); + Assert.AreEqual(115, cout.Position); + // Field 13: fixed numeric value: 501 + cout.WriteTag(13, WireFormat.WireType.Fixed32); + Assert.AreEqual(116, cout.Position); + cout.WriteSFixed32(501); + Assert.AreEqual(120, cout.Position); + cout.Flush(); + } + + byte[] bytes = new byte[130]; + { + CodedOutputStream cout = new CodedOutputStream(bytes); + // Field 1: numeric value: 500 + cout.WriteTag(1, WireFormat.WireType.Varint); + Assert.AreEqual(1, cout.Position); + cout.WriteInt32(500); + Assert.AreEqual(3, cout.Position); + //Field 2: length delimited 120 bytes + cout.WriteTag(2, WireFormat.WireType.LengthDelimited); + Assert.AreEqual(4, cout.Position); + cout.WriteBytes(ByteString.CopyFrom(child)); + Assert.AreEqual(125, cout.Position); + // Field 3: fixed numeric value: 500 + cout.WriteTag(3, WireFormat.WireType.Fixed32); + Assert.AreEqual(126, cout.Position); + cout.WriteSFixed32(501); + Assert.AreEqual(130, cout.Position); + cout.Flush(); + } + // Now test Input stream: + { + CodedInputStream cin = new CodedInputStream(new MemoryStream(bytes), new byte[50], 0, 0, false); + Assert.AreEqual(0, cin.Position); + // Field 1: + uint tag = cin.ReadTag(); + Assert.AreEqual(1, tag >> 3); + Assert.AreEqual(1, cin.Position); + Assert.AreEqual(500, cin.ReadInt32()); + Assert.AreEqual(3, cin.Position); + //Field 2: + tag = cin.ReadTag(); + Assert.AreEqual(2, tag >> 3); + Assert.AreEqual(4, cin.Position); + int childlen = cin.ReadLength(); + Assert.AreEqual(120, childlen); + Assert.AreEqual(5, cin.Position); + int oldlimit = cin.PushLimit((int)childlen); + Assert.AreEqual(5, cin.Position); + // Now we are reading child message + { + // Field 11: numeric value: 500 + tag = cin.ReadTag(); + Assert.AreEqual(11, tag >> 3); + Assert.AreEqual(6, cin.Position); + Assert.AreEqual(500, cin.ReadInt32()); + Assert.AreEqual(8, cin.Position); + //Field 12: length delimited 120 bytes + tag = cin.ReadTag(); + Assert.AreEqual(12, tag >> 3); + Assert.AreEqual(9, cin.Position); + ByteString bstr = cin.ReadBytes(); + Assert.AreEqual(110, bstr.Length); + Assert.AreEqual((byte) 109, bstr[109]); + Assert.AreEqual(120, cin.Position); + // Field 13: fixed numeric value: 501 + tag = cin.ReadTag(); + Assert.AreEqual(13, tag >> 3); + // ROK - Previously broken here, this returned 126 failing to account for bufferSizeAfterLimit + Assert.AreEqual(121, cin.Position); + Assert.AreEqual(501, cin.ReadSFixed32()); + Assert.AreEqual(125, cin.Position); + Assert.IsTrue(cin.IsAtEnd); + } + cin.PopLimit(oldlimit); + Assert.AreEqual(125, cin.Position); + // Field 3: fixed numeric value: 501 + tag = cin.ReadTag(); + Assert.AreEqual(3, tag >> 3); + Assert.AreEqual(126, cin.Position); + Assert.AreEqual(501, cin.ReadSFixed32()); + Assert.AreEqual(130, cin.Position); + Assert.IsTrue(cin.IsAtEnd); + } + } + + [Test] + public void Dispose_DisposesUnderlyingStream() + { + var memoryStream = new MemoryStream(); + Assert.IsTrue(memoryStream.CanWrite); + using (var cos = new CodedOutputStream(memoryStream)) + { + cos.WriteRawByte(0); + Assert.AreEqual(0, memoryStream.Position); // Not flushed yet + } + Assert.AreEqual(1, memoryStream.ToArray().Length); // Flushed data from CodedOutputStream to MemoryStream + Assert.IsFalse(memoryStream.CanWrite); // Disposed + } + + [Test] + public void Dispose_WithLeaveOpen() + { + var memoryStream = new MemoryStream(); + Assert.IsTrue(memoryStream.CanWrite); + using (var cos = new CodedOutputStream(memoryStream, true)) + { + cos.WriteRawByte(0); + Assert.AreEqual(0, memoryStream.Position); // Not flushed yet + } + Assert.AreEqual(1, memoryStream.Position); // Flushed data from CodedOutputStream to MemoryStream + Assert.IsTrue(memoryStream.CanWrite); // We left the stream open + } + } +} \ No newline at end of file diff -Nru protobuf-3.0.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Collections/MapFieldTest.cs protobuf-3.6.1.3/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Collections/MapFieldTest.cs --- protobuf-3.0.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Collections/MapFieldTest.cs 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Collections/MapFieldTest.cs 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,532 @@ +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2015 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using System; +using System.Collections.Generic; +using Google.Protobuf.TestProtos; +using NUnit.Framework; +using System.Collections; +using System.Linq; + +namespace Google.Protobuf.Collections +{ + /// + /// Tests for MapField which aren't reliant on the encoded format - + /// tests for serialization/deserialization are part of GeneratedMessageTest. + /// + public class MapFieldTest + { + [Test] + public void Clone_ClonesMessages() + { + var message = new ForeignMessage { C = 20 }; + var map = new MapField { { "x", message } }; + var clone = map.Clone(); + map["x"].C = 30; + Assert.AreEqual(20, clone["x"].C); + } + + [Test] + public void NullValuesProhibited() + { + TestNullValues(0); + TestNullValues(""); + TestNullValues(new TestAllTypes()); + } + + private void TestNullValues(T nonNullValue) + { + var map = new MapField(); + var nullValue = (T) (object) null; + Assert.Throws(() => map.Add(0, nullValue)); + Assert.Throws(() => map[0] = nullValue); + map.Add(1, nonNullValue); + map[1] = nonNullValue; + } + + [Test] + public void Add_ForbidsNullKeys() + { + var map = new MapField(); + Assert.Throws(() => map.Add(null, new ForeignMessage())); + } + + [Test] + public void Indexer_ForbidsNullKeys() + { + var map = new MapField(); + Assert.Throws(() => map[null] = new ForeignMessage()); + } + + [Test] + public void AddPreservesInsertionOrder() + { + var map = new MapField(); + map.Add("a", "v1"); + map.Add("b", "v2"); + map.Add("c", "v3"); + map.Remove("b"); + map.Add("d", "v4"); + CollectionAssert.AreEqual(new[] { "a", "c", "d" }, map.Keys); + CollectionAssert.AreEqual(new[] { "v1", "v3", "v4" }, map.Values); + } + + [Test] + public void EqualityIsOrderInsensitive() + { + var map1 = new MapField(); + map1.Add("a", "v1"); + map1.Add("b", "v2"); + + var map2 = new MapField(); + map2.Add("b", "v2"); + map2.Add("a", "v1"); + + EqualityTester.AssertEquality(map1, map2); + } + + [Test] + public void EqualityIsKeySensitive() + { + var map1 = new MapField(); + map1.Add("first key", "v1"); + map1.Add("second key", "v2"); + + var map2 = new MapField(); + map2.Add("third key", "v1"); + map2.Add("fourth key", "v2"); + + EqualityTester.AssertInequality(map1, map2); + } + + [Test] + public void Equality_Simple() + { + var map = new MapField(); + EqualityTester.AssertEquality(map, map); + EqualityTester.AssertInequality(map, null); + Assert.IsFalse(map.Equals(new object())); + } + + [Test] + public void EqualityIsValueSensitive() + { + // Note: Without some care, it's a little easier than one might + // hope to see hash collisions, but only in some environments... + var map1 = new MapField(); + map1.Add("a", "first value"); + map1.Add("b", "second value"); + + var map2 = new MapField(); + map2.Add("a", "third value"); + map2.Add("b", "fourth value"); + + EqualityTester.AssertInequality(map1, map2); + } + + [Test] + public void Add_Dictionary() + { + var map1 = new MapField + { + { "x", "y" }, + { "a", "b" } + }; + var map2 = new MapField + { + { "before", "" }, + map1, + { "after", "" } + }; + var expected = new MapField + { + { "before", "" }, + { "x", "y" }, + { "a", "b" }, + { "after", "" } + }; + Assert.AreEqual(expected, map2); + CollectionAssert.AreEqual(new[] { "before", "x", "a", "after" }, map2.Keys); + } + + // General IDictionary behavior tests + [Test] + public void Add_KeyAlreadyExists() + { + var map = new MapField(); + map.Add("foo", "bar"); + Assert.Throws(() => map.Add("foo", "baz")); + } + + [Test] + public void Add_Pair() + { + var map = new MapField(); + ICollection> collection = map; + collection.Add(NewKeyValuePair("x", "y")); + Assert.AreEqual("y", map["x"]); + Assert.Throws(() => collection.Add(NewKeyValuePair("x", "z"))); + } + + [Test] + public void Contains_Pair() + { + var map = new MapField { { "x", "y" } }; + ICollection> collection = map; + Assert.IsTrue(collection.Contains(NewKeyValuePair("x", "y"))); + Assert.IsFalse(collection.Contains(NewKeyValuePair("x", "z"))); + Assert.IsFalse(collection.Contains(NewKeyValuePair("z", "y"))); + } + + [Test] + public void Remove_Key() + { + var map = new MapField(); + map.Add("foo", "bar"); + Assert.AreEqual(1, map.Count); + Assert.IsFalse(map.Remove("missing")); + Assert.AreEqual(1, map.Count); + Assert.IsTrue(map.Remove("foo")); + Assert.AreEqual(0, map.Count); + Assert.Throws(() => map.Remove(null)); + } + + [Test] + public void Remove_Pair() + { + var map = new MapField(); + map.Add("foo", "bar"); + ICollection> collection = map; + Assert.AreEqual(1, map.Count); + Assert.IsFalse(collection.Remove(NewKeyValuePair("wrong key", "bar"))); + Assert.AreEqual(1, map.Count); + Assert.IsFalse(collection.Remove(NewKeyValuePair("foo", "wrong value"))); + Assert.AreEqual(1, map.Count); + Assert.IsTrue(collection.Remove(NewKeyValuePair("foo", "bar"))); + Assert.AreEqual(0, map.Count); + Assert.Throws(() => collection.Remove(new KeyValuePair(null, ""))); + } + + [Test] + public void CopyTo_Pair() + { + var map = new MapField(); + map.Add("foo", "bar"); + ICollection> collection = map; + KeyValuePair[] array = new KeyValuePair[3]; + collection.CopyTo(array, 1); + Assert.AreEqual(NewKeyValuePair("foo", "bar"), array[1]); + } + + [Test] + public void Clear() + { + var map = new MapField { { "x", "y" } }; + Assert.AreEqual(1, map.Count); + map.Clear(); + Assert.AreEqual(0, map.Count); + map.Add("x", "y"); + Assert.AreEqual(1, map.Count); + } + + [Test] + public void Indexer_Get() + { + var map = new MapField { { "x", "y" } }; + Assert.AreEqual("y", map["x"]); + Assert.Throws(() => { var ignored = map["z"]; }); + } + + [Test] + public void Indexer_Set() + { + var map = new MapField(); + map["x"] = "y"; + Assert.AreEqual("y", map["x"]); + map["x"] = "z"; // This won't throw, unlike Add. + Assert.AreEqual("z", map["x"]); + } + + [Test] + public void GetEnumerator_NonGeneric() + { + IEnumerable map = new MapField { { "x", "y" } }; + CollectionAssert.AreEqual(new[] { new KeyValuePair("x", "y") }, + map.Cast().ToList()); + } + + // Test for the explicitly-implemented non-generic IDictionary interface + [Test] + public void IDictionary_GetEnumerator() + { + IDictionary map = new MapField { { "x", "y" } }; + var enumerator = map.GetEnumerator(); + + // Commented assertions show an ideal situation - it looks like + // the LinkedList enumerator doesn't throw when you ask for the current entry + // at an inappropriate time; fixing this would be more work than it's worth. + // Assert.Throws(() => enumerator.Current.GetHashCode()); + Assert.IsTrue(enumerator.MoveNext()); + Assert.AreEqual("x", enumerator.Key); + Assert.AreEqual("y", enumerator.Value); + Assert.AreEqual(new DictionaryEntry("x", "y"), enumerator.Current); + Assert.AreEqual(new DictionaryEntry("x", "y"), enumerator.Entry); + Assert.IsFalse(enumerator.MoveNext()); + // Assert.Throws(() => enumerator.Current.GetHashCode()); + enumerator.Reset(); + // Assert.Throws(() => enumerator.Current.GetHashCode()); + Assert.IsTrue(enumerator.MoveNext()); + Assert.AreEqual("x", enumerator.Key); // Assume the rest are okay + } + + [Test] + public void IDictionary_Add() + { + var map = new MapField { { "x", "y" } }; + IDictionary dictionary = map; + dictionary.Add("a", "b"); + Assert.AreEqual("b", map["a"]); + Assert.Throws(() => dictionary.Add("a", "duplicate")); + Assert.Throws(() => dictionary.Add(new object(), "key is bad")); + Assert.Throws(() => dictionary.Add("value is bad", new object())); + } + + [Test] + public void IDictionary_Contains() + { + var map = new MapField { { "x", "y" } }; + IDictionary dictionary = map; + + Assert.IsFalse(dictionary.Contains("a")); + Assert.IsFalse(dictionary.Contains(5)); + // Surprising, but IDictionary.Contains is only about keys. + Assert.IsFalse(dictionary.Contains(new DictionaryEntry("x", "y"))); + Assert.IsTrue(dictionary.Contains("x")); + } + + [Test] + public void IDictionary_Remove() + { + var map = new MapField { { "x", "y" } }; + IDictionary dictionary = map; + dictionary.Remove("a"); + Assert.AreEqual(1, dictionary.Count); + dictionary.Remove(5); + Assert.AreEqual(1, dictionary.Count); + dictionary.Remove(new DictionaryEntry("x", "y")); + Assert.AreEqual(1, dictionary.Count); + dictionary.Remove("x"); + Assert.AreEqual(0, dictionary.Count); + Assert.Throws(() => dictionary.Remove(null)); + } + + [Test] + public void IDictionary_CopyTo() + { + var map = new MapField { { "x", "y" } }; + IDictionary dictionary = map; + var array = new DictionaryEntry[3]; + dictionary.CopyTo(array, 1); + CollectionAssert.AreEqual(new[] { default(DictionaryEntry), new DictionaryEntry("x", "y"), default(DictionaryEntry) }, + array); + var objectArray = new object[3]; + dictionary.CopyTo(objectArray, 1); + CollectionAssert.AreEqual(new object[] { null, new DictionaryEntry("x", "y"), null }, + objectArray); + } + + [Test] + public void IDictionary_IsFixedSize() + { + var map = new MapField { { "x", "y" } }; + IDictionary dictionary = map; + Assert.IsFalse(dictionary.IsFixedSize); + } + + [Test] + public void IDictionary_Keys() + { + IDictionary dictionary = new MapField { { "x", "y" } }; + CollectionAssert.AreEqual(new[] { "x" }, dictionary.Keys); + } + + [Test] + public void IDictionary_Values() + { + IDictionary dictionary = new MapField { { "x", "y" } }; + CollectionAssert.AreEqual(new[] { "y" }, dictionary.Values); + } + + [Test] + public void IDictionary_IsSynchronized() + { + IDictionary dictionary = new MapField { { "x", "y" } }; + Assert.IsFalse(dictionary.IsSynchronized); + } + + [Test] + public void IDictionary_SyncRoot() + { + IDictionary dictionary = new MapField { { "x", "y" } }; + Assert.AreSame(dictionary, dictionary.SyncRoot); + } + + [Test] + public void IDictionary_Indexer_Get() + { + IDictionary dictionary = new MapField { { "x", "y" } }; + Assert.AreEqual("y", dictionary["x"]); + Assert.IsNull(dictionary["a"]); + Assert.IsNull(dictionary[5]); + Assert.Throws(() => dictionary[null].GetHashCode()); + } + + [Test] + public void IDictionary_Indexer_Set() + { + var map = new MapField { { "x", "y" } }; + IDictionary dictionary = map; + map["a"] = "b"; + Assert.AreEqual("b", map["a"]); + map["a"] = "c"; + Assert.AreEqual("c", map["a"]); + Assert.Throws(() => dictionary[5] = "x"); + Assert.Throws(() => dictionary["x"] = 5); + Assert.Throws(() => dictionary[null] = "z"); + Assert.Throws(() => dictionary["x"] = null); + } + + [Test] + public void KeysReturnsLiveView() + { + var map = new MapField(); + var keys = map.Keys; + CollectionAssert.AreEqual(new string[0], keys); + map["foo"] = "bar"; + map["x"] = "y"; + CollectionAssert.AreEqual(new[] { "foo", "x" }, keys); + } + + [Test] + public void ValuesReturnsLiveView() + { + var map = new MapField(); + var values = map.Values; + CollectionAssert.AreEqual(new string[0], values); + map["foo"] = "bar"; + map["x"] = "y"; + CollectionAssert.AreEqual(new[] { "bar", "y" }, values); + } + + // Just test keys - we know the implementation is the same for values + [Test] + public void ViewsAreReadOnly() + { + var map = new MapField(); + var keys = map.Keys; + Assert.IsTrue(keys.IsReadOnly); + Assert.Throws(() => keys.Clear()); + Assert.Throws(() => keys.Remove("a")); + Assert.Throws(() => keys.Add("a")); + } + + // Just test keys - we know the implementation is the same for values + [Test] + public void ViewCopyTo() + { + var map = new MapField { { "foo", "bar" }, { "x", "y" } }; + var keys = map.Keys; + var array = new string[4]; + Assert.Throws(() => keys.CopyTo(array, 3)); + Assert.Throws(() => keys.CopyTo(array, -1)); + keys.CopyTo(array, 1); + CollectionAssert.AreEqual(new[] { null, "foo", "x", null }, array); + } + + // Just test keys - we know the implementation is the same for values + [Test] + public void NonGenericViewCopyTo() + { + IDictionary map = new MapField { { "foo", "bar" }, { "x", "y" } }; + ICollection keys = map.Keys; + // Note the use of the Array type here rather than string[] + Array array = new string[4]; + Assert.Throws(() => keys.CopyTo(array, 3)); + Assert.Throws(() => keys.CopyTo(array, -1)); + keys.CopyTo(array, 1); + CollectionAssert.AreEqual(new[] { null, "foo", "x", null }, array); + } + + [Test] + public void KeysContains() + { + var map = new MapField { { "foo", "bar" }, { "x", "y" } }; + var keys = map.Keys; + Assert.IsTrue(keys.Contains("foo")); + Assert.IsFalse(keys.Contains("bar")); // It's a value! + Assert.IsFalse(keys.Contains("1")); + // Keys can't be null, so we should prevent contains check + Assert.Throws(() => keys.Contains(null)); + } + + [Test] + public void ValuesContains() + { + var map = new MapField { { "foo", "bar" }, { "x", "y" } }; + var values = map.Values; + Assert.IsTrue(values.Contains("bar")); + Assert.IsFalse(values.Contains("foo")); // It's a key! + Assert.IsFalse(values.Contains("1")); + // Values can be null, so this makes sense + Assert.IsFalse(values.Contains(null)); + } + + [Test] + public void ToString_StringToString() + { + var map = new MapField { { "foo", "bar" }, { "x", "y" } }; + Assert.AreEqual("{ \"foo\": \"bar\", \"x\": \"y\" }", map.ToString()); + } + + [Test] + public void ToString_UnsupportedKeyType() + { + var map = new MapField { { 10, "foo" } }; + Assert.Throws(() => map.ToString()); + } + + private static KeyValuePair NewKeyValuePair(TKey key, TValue value) + { + return new KeyValuePair(key, value); + } + } +} diff -Nru protobuf-3.0.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Collections/RepeatedFieldTest.cs protobuf-3.6.1.3/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Collections/RepeatedFieldTest.cs --- protobuf-3.0.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Collections/RepeatedFieldTest.cs 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Collections/RepeatedFieldTest.cs 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,746 @@ +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2015 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using System; +using System.Collections; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using Google.Protobuf.TestProtos; +using Google.Protobuf.WellKnownTypes; +using NUnit.Framework; + +namespace Google.Protobuf.Collections +{ + public class RepeatedFieldTest + { + [Test] + public void NullValuesRejected() + { + var list = new RepeatedField(); + Assert.Throws(() => list.Add((string)null)); + Assert.Throws(() => list.Add((IEnumerable)null)); + Assert.Throws(() => list.Add((RepeatedField)null)); + Assert.Throws(() => list.Contains(null)); + Assert.Throws(() => list.IndexOf(null)); + } + + [Test] + public void Add_SingleItem() + { + var list = new RepeatedField(); + list.Add("foo"); + Assert.AreEqual(1, list.Count); + Assert.AreEqual("foo", list[0]); + } + + [Test] + public void Add_Sequence() + { + var list = new RepeatedField(); + list.Add(new[] { "foo", "bar" }); + Assert.AreEqual(2, list.Count); + Assert.AreEqual("foo", list[0]); + Assert.AreEqual("bar", list[1]); + } + + [Test] + public void AddRange_SlowPath() + { + var list = new RepeatedField(); + list.AddRange(new[] { "foo", "bar" }.Select(x => x)); + Assert.AreEqual(2, list.Count); + Assert.AreEqual("foo", list[0]); + Assert.AreEqual("bar", list[1]); + } + + [Test] + public void AddRange_SlowPath_NullsProhibited_ReferenceType() + { + var list = new RepeatedField(); + // It's okay for this to throw ArgumentNullException if necessary. + // It's not ideal, but not awful. + Assert.Catch(() => list.AddRange(new[] { "foo", null }.Select(x => x))); + } + + [Test] + public void AddRange_SlowPath_NullsProhibited_NullableValueType() + { + var list = new RepeatedField(); + // It's okay for this to throw ArgumentNullException if necessary. + // It's not ideal, but not awful. + Assert.Catch(() => list.AddRange(new[] { 20, (int?)null }.Select(x => x))); + } + + [Test] + public void AddRange_Optimized_NonNullableValueType() + { + var list = new RepeatedField(); + list.AddRange(new List { 20, 30 }); + Assert.AreEqual(2, list.Count); + Assert.AreEqual(20, list[0]); + Assert.AreEqual(30, list[1]); + } + + [Test] + public void AddRange_Optimized_ReferenceType() + { + var list = new RepeatedField(); + list.AddRange(new List { "foo", "bar" }); + Assert.AreEqual(2, list.Count); + Assert.AreEqual("foo", list[0]); + Assert.AreEqual("bar", list[1]); + } + + [Test] + public void AddRange_Optimized_NullableValueType() + { + var list = new RepeatedField(); + list.AddRange(new List { 20, 30 }); + Assert.AreEqual(2, list.Count); + Assert.AreEqual((int?) 20, list[0]); + Assert.AreEqual((int?) 30, list[1]); + } + + [Test] + public void AddRange_Optimized_NullsProhibited_ReferenceType() + { + // We don't just trust that a collection with a nullable element type doesn't contain nulls + var list = new RepeatedField(); + // It's okay for this to throw ArgumentNullException if necessary. + // It's not ideal, but not awful. + Assert.Catch(() => list.AddRange(new List { "foo", null })); + } + + [Test] + public void AddRange_Optimized_NullsProhibited_NullableValueType() + { + // We don't just trust that a collection with a nullable element type doesn't contain nulls + var list = new RepeatedField(); + // It's okay for this to throw ArgumentNullException if necessary. + // It's not ideal, but not awful. + Assert.Catch(() => list.AddRange(new List { 20, null })); + } + + [Test] + public void AddRange_AlreadyNotEmpty() + { + var list = new RepeatedField { 1, 2, 3 }; + list.AddRange(new List { 4, 5, 6 }); + CollectionAssert.AreEqual(new[] { 1, 2, 3, 4, 5, 6 }, list); + } + + [Test] + public void AddRange_RepeatedField() + { + var list = new RepeatedField { "original" }; + list.AddRange(new RepeatedField { "foo", "bar" }); + Assert.AreEqual(3, list.Count); + Assert.AreEqual("original", list[0]); + Assert.AreEqual("foo", list[1]); + Assert.AreEqual("bar", list[2]); + } + + [Test] + public void RemoveAt_Valid() + { + var list = new RepeatedField { "first", "second", "third" }; + list.RemoveAt(1); + CollectionAssert.AreEqual(new[] { "first", "third" }, list); + // Just check that these don't throw... + list.RemoveAt(list.Count - 1); // Now the count will be 1... + list.RemoveAt(0); + Assert.AreEqual(0, list.Count); + } + + [Test] + public void RemoveAt_Invalid() + { + var list = new RepeatedField { "first", "second", "third" }; + Assert.Throws(() => list.RemoveAt(-1)); + Assert.Throws(() => list.RemoveAt(3)); + } + + [Test] + public void Insert_Valid() + { + var list = new RepeatedField { "first", "second" }; + list.Insert(1, "middle"); + CollectionAssert.AreEqual(new[] { "first", "middle", "second" }, list); + list.Insert(3, "end"); + CollectionAssert.AreEqual(new[] { "first", "middle", "second", "end" }, list); + list.Insert(0, "start"); + CollectionAssert.AreEqual(new[] { "start", "first", "middle", "second", "end" }, list); + } + + [Test] + public void Insert_Invalid() + { + var list = new RepeatedField { "first", "second" }; + Assert.Throws(() => list.Insert(-1, "foo")); + Assert.Throws(() => list.Insert(3, "foo")); + Assert.Throws(() => list.Insert(0, null)); + } + + [Test] + public void Equals_RepeatedField() + { + var list = new RepeatedField { "first", "second" }; + Assert.IsFalse(list.Equals((RepeatedField) null)); + Assert.IsTrue(list.Equals(list)); + Assert.IsFalse(list.Equals(new RepeatedField { "first", "third" })); + Assert.IsFalse(list.Equals(new RepeatedField { "first" })); + Assert.IsTrue(list.Equals(new RepeatedField { "first", "second" })); + } + + [Test] + public void Equals_Object() + { + var list = new RepeatedField { "first", "second" }; + Assert.IsFalse(list.Equals((object) null)); + Assert.IsTrue(list.Equals((object) list)); + Assert.IsFalse(list.Equals((object) new RepeatedField { "first", "third" })); + Assert.IsFalse(list.Equals((object) new RepeatedField { "first" })); + Assert.IsTrue(list.Equals((object) new RepeatedField { "first", "second" })); + Assert.IsFalse(list.Equals(new object())); + } + + [Test] + public void GetEnumerator_GenericInterface() + { + IEnumerable list = new RepeatedField { "first", "second" }; + // Select gets rid of the optimizations in ToList... + CollectionAssert.AreEqual(new[] { "first", "second" }, list.Select(x => x).ToList()); + } + + [Test] + public void GetEnumerator_NonGenericInterface() + { + IEnumerable list = new RepeatedField { "first", "second" }; + CollectionAssert.AreEqual(new[] { "first", "second" }, list.Cast().ToList()); + } + + [Test] + public void CopyTo() + { + var list = new RepeatedField { "first", "second" }; + string[] stringArray = new string[4]; + list.CopyTo(stringArray, 1); + CollectionAssert.AreEqual(new[] { null, "first", "second", null }, stringArray); + } + + [Test] + public void Indexer_Get() + { + var list = new RepeatedField { "first", "second" }; + Assert.AreEqual("first", list[0]); + Assert.AreEqual("second", list[1]); + Assert.Throws(() => list[-1].GetHashCode()); + Assert.Throws(() => list[2].GetHashCode()); + } + + [Test] + public void Indexer_Set() + { + var list = new RepeatedField { "first", "second" }; + list[0] = "changed"; + Assert.AreEqual("changed", list[0]); + Assert.Throws(() => list[0] = null); + Assert.Throws(() => list[-1] = "bad"); + Assert.Throws(() => list[2] = "bad"); + } + + [Test] + public void Clone_ReturnsMutable() + { + var list = new RepeatedField { 0 }; + var clone = list.Clone(); + clone[0] = 1; + } + + [Test] + public void Enumerator() + { + var list = new RepeatedField { "first", "second" }; + using (var enumerator = list.GetEnumerator()) + { + Assert.IsTrue(enumerator.MoveNext()); + Assert.AreEqual("first", enumerator.Current); + Assert.IsTrue(enumerator.MoveNext()); + Assert.AreEqual("second", enumerator.Current); + Assert.IsFalse(enumerator.MoveNext()); + Assert.IsFalse(enumerator.MoveNext()); + } + } + + [Test] + public void AddEntriesFrom_PackedInt32() + { + uint packedTag = WireFormat.MakeTag(10, WireFormat.WireType.LengthDelimited); + var stream = new MemoryStream(); + var output = new CodedOutputStream(stream); + var length = CodedOutputStream.ComputeInt32Size(10) + + CodedOutputStream.ComputeInt32Size(999) + + CodedOutputStream.ComputeInt32Size(-1000); + output.WriteTag(packedTag); + output.WriteRawVarint32((uint) length); + output.WriteInt32(10); + output.WriteInt32(999); + output.WriteInt32(-1000); + output.Flush(); + stream.Position = 0; + + // Deliberately "expecting" a non-packed tag, but we detect that the data is + // actually packed. + uint nonPackedTag = WireFormat.MakeTag(10, WireFormat.WireType.LengthDelimited); + var field = new RepeatedField(); + var input = new CodedInputStream(stream); + input.AssertNextTag(packedTag); + field.AddEntriesFrom(input, FieldCodec.ForInt32(nonPackedTag)); + CollectionAssert.AreEqual(new[] { 10, 999, -1000 }, field); + Assert.IsTrue(input.IsAtEnd); + } + + [Test] + public void AddEntriesFrom_NonPackedInt32() + { + uint nonPackedTag = WireFormat.MakeTag(10, WireFormat.WireType.Varint); + var stream = new MemoryStream(); + var output = new CodedOutputStream(stream); + output.WriteTag(nonPackedTag); + output.WriteInt32(10); + output.WriteTag(nonPackedTag); + output.WriteInt32(999); + output.WriteTag(nonPackedTag); + output.WriteInt32(-1000); // Just for variety... + output.Flush(); + stream.Position = 0; + + // Deliberately "expecting" a packed tag, but we detect that the data is + // actually not packed. + uint packedTag = WireFormat.MakeTag(10, WireFormat.WireType.LengthDelimited); + var field = new RepeatedField(); + var input = new CodedInputStream(stream); + input.AssertNextTag(nonPackedTag); + field.AddEntriesFrom(input, FieldCodec.ForInt32(packedTag)); + CollectionAssert.AreEqual(new[] { 10, 999, -1000 }, field); + Assert.IsTrue(input.IsAtEnd); + } + + [Test] + public void AddEntriesFrom_String() + { + uint tag = WireFormat.MakeTag(10, WireFormat.WireType.LengthDelimited); + var stream = new MemoryStream(); + var output = new CodedOutputStream(stream); + output.WriteTag(tag); + output.WriteString("Foo"); + output.WriteTag(tag); + output.WriteString(""); + output.WriteTag(tag); + output.WriteString("Bar"); + output.Flush(); + stream.Position = 0; + + var field = new RepeatedField(); + var input = new CodedInputStream(stream); + input.AssertNextTag(tag); + field.AddEntriesFrom(input, FieldCodec.ForString(tag)); + CollectionAssert.AreEqual(new[] { "Foo", "", "Bar" }, field); + Assert.IsTrue(input.IsAtEnd); + } + + [Test] + public void AddEntriesFrom_Message() + { + var message1 = new ForeignMessage { C = 2000 }; + var message2 = new ForeignMessage { C = -250 }; + + uint tag = WireFormat.MakeTag(10, WireFormat.WireType.LengthDelimited); + var stream = new MemoryStream(); + var output = new CodedOutputStream(stream); + output.WriteTag(tag); + output.WriteMessage(message1); + output.WriteTag(tag); + output.WriteMessage(message2); + output.Flush(); + stream.Position = 0; + + var field = new RepeatedField(); + var input = new CodedInputStream(stream); + input.AssertNextTag(tag); + field.AddEntriesFrom(input, FieldCodec.ForMessage(tag, ForeignMessage.Parser)); + CollectionAssert.AreEqual(new[] { message1, message2}, field); + Assert.IsTrue(input.IsAtEnd); + } + + [Test] + public void WriteTo_PackedInt32() + { + uint tag = WireFormat.MakeTag(10, WireFormat.WireType.LengthDelimited); + var field = new RepeatedField { 10, 1000, 1000000 }; + var stream = new MemoryStream(); + var output = new CodedOutputStream(stream); + field.WriteTo(output, FieldCodec.ForInt32(tag)); + output.Flush(); + stream.Position = 0; + + var input = new CodedInputStream(stream); + input.AssertNextTag(tag); + var length = input.ReadLength(); + Assert.AreEqual(10, input.ReadInt32()); + Assert.AreEqual(1000, input.ReadInt32()); + Assert.AreEqual(1000000, input.ReadInt32()); + Assert.IsTrue(input.IsAtEnd); + Assert.AreEqual(1 + CodedOutputStream.ComputeLengthSize(length) + length, stream.Length); + } + + [Test] + public void WriteTo_NonPackedInt32() + { + uint tag = WireFormat.MakeTag(10, WireFormat.WireType.Varint); + var field = new RepeatedField { 10, 1000, 1000000}; + var stream = new MemoryStream(); + var output = new CodedOutputStream(stream); + field.WriteTo(output, FieldCodec.ForInt32(tag)); + output.Flush(); + stream.Position = 0; + + var input = new CodedInputStream(stream); + input.AssertNextTag(tag); + Assert.AreEqual(10, input.ReadInt32()); + input.AssertNextTag(tag); + Assert.AreEqual(1000, input.ReadInt32()); + input.AssertNextTag(tag); + Assert.AreEqual(1000000, input.ReadInt32()); + Assert.IsTrue(input.IsAtEnd); + } + + [Test] + public void WriteTo_String() + { + uint tag = WireFormat.MakeTag(10, WireFormat.WireType.LengthDelimited); + var field = new RepeatedField { "Foo", "", "Bar" }; + var stream = new MemoryStream(); + var output = new CodedOutputStream(stream); + field.WriteTo(output, FieldCodec.ForString(tag)); + output.Flush(); + stream.Position = 0; + + var input = new CodedInputStream(stream); + input.AssertNextTag(tag); + Assert.AreEqual("Foo", input.ReadString()); + input.AssertNextTag(tag); + Assert.AreEqual("", input.ReadString()); + input.AssertNextTag(tag); + Assert.AreEqual("Bar", input.ReadString()); + Assert.IsTrue(input.IsAtEnd); + } + + [Test] + public void WriteTo_Message() + { + var message1 = new ForeignMessage { C = 20 }; + var message2 = new ForeignMessage { C = 25 }; + uint tag = WireFormat.MakeTag(10, WireFormat.WireType.LengthDelimited); + var field = new RepeatedField { message1, message2 }; + var stream = new MemoryStream(); + var output = new CodedOutputStream(stream); + field.WriteTo(output, FieldCodec.ForMessage(tag, ForeignMessage.Parser)); + output.Flush(); + stream.Position = 0; + + var input = new CodedInputStream(stream); + input.AssertNextTag(tag); + Assert.AreEqual(message1, input.ReadMessage(ForeignMessage.Parser)); + input.AssertNextTag(tag); + Assert.AreEqual(message2, input.ReadMessage(ForeignMessage.Parser)); + Assert.IsTrue(input.IsAtEnd); + } + + [Test] + public void CalculateSize_VariableSizeNonPacked() + { + var list = new RepeatedField { 1, 500, 1 }; + var tag = WireFormat.MakeTag(1, WireFormat.WireType.Varint); + // 2 bytes for the first entry, 3 bytes for the second, 2 bytes for the third + Assert.AreEqual(7, list.CalculateSize(FieldCodec.ForInt32(tag))); + } + + [Test] + public void CalculateSize_FixedSizeNonPacked() + { + var list = new RepeatedField { 1, 500, 1 }; + var tag = WireFormat.MakeTag(1, WireFormat.WireType.Fixed32); + // 5 bytes for the each entry + Assert.AreEqual(15, list.CalculateSize(FieldCodec.ForSFixed32(tag))); + } + + [Test] + public void CalculateSize_VariableSizePacked() + { + var list = new RepeatedField { 1, 500, 1}; + var tag = WireFormat.MakeTag(1, WireFormat.WireType.LengthDelimited); + // 1 byte for the tag, 1 byte for the length, + // 1 byte for the first entry, 2 bytes for the second, 1 byte for the third + Assert.AreEqual(6, list.CalculateSize(FieldCodec.ForInt32(tag))); + } + + [Test] + public void CalculateSize_FixedSizePacked() + { + var list = new RepeatedField { 1, 500, 1 }; + var tag = WireFormat.MakeTag(1, WireFormat.WireType.LengthDelimited); + // 1 byte for the tag, 1 byte for the length, 4 bytes per entry + Assert.AreEqual(14, list.CalculateSize(FieldCodec.ForSFixed32(tag))); + } + + [Test] + public void TestNegativeEnumArray() + { + int arraySize = 1 + 1 + (11 * 5); + int msgSize = arraySize; + byte[] bytes = new byte[msgSize]; + CodedOutputStream output = new CodedOutputStream(bytes); + uint tag = WireFormat.MakeTag(8, WireFormat.WireType.Varint); + for (int i = 0; i >= -5; i--) + { + output.WriteTag(tag); + output.WriteEnum(i); + } + + Assert.AreEqual(0, output.SpaceLeft); + + CodedInputStream input = new CodedInputStream(bytes); + tag = input.ReadTag(); + + RepeatedField values = new RepeatedField(); + values.AddEntriesFrom(input, FieldCodec.ForEnum(tag, x => (int)x, x => (SampleEnum)x)); + + Assert.AreEqual(6, values.Count); + Assert.AreEqual(SampleEnum.None, values[0]); + Assert.AreEqual(((SampleEnum)(-1)), values[1]); + Assert.AreEqual(SampleEnum.NegativeValue, values[2]); + Assert.AreEqual(((SampleEnum)(-3)), values[3]); + Assert.AreEqual(((SampleEnum)(-4)), values[4]); + Assert.AreEqual(((SampleEnum)(-5)), values[5]); + } + + + [Test] + public void TestNegativeEnumPackedArray() + { + int arraySize = 1 + (10 * 5); + int msgSize = 1 + 1 + arraySize; + byte[] bytes = new byte[msgSize]; + CodedOutputStream output = new CodedOutputStream(bytes); + // Length-delimited to show we want the packed representation + uint tag = WireFormat.MakeTag(8, WireFormat.WireType.LengthDelimited); + output.WriteTag(tag); + int size = 0; + for (int i = 0; i >= -5; i--) + { + size += CodedOutputStream.ComputeEnumSize(i); + } + output.WriteRawVarint32((uint)size); + for (int i = 0; i >= -5; i--) + { + output.WriteEnum(i); + } + Assert.AreEqual(0, output.SpaceLeft); + + CodedInputStream input = new CodedInputStream(bytes); + tag = input.ReadTag(); + + RepeatedField values = new RepeatedField(); + values.AddEntriesFrom(input, FieldCodec.ForEnum(tag, x => (int)x, x => (SampleEnum)x)); + + Assert.AreEqual(6, values.Count); + Assert.AreEqual(SampleEnum.None, values[0]); + Assert.AreEqual(((SampleEnum)(-1)), values[1]); + Assert.AreEqual(SampleEnum.NegativeValue, values[2]); + Assert.AreEqual(((SampleEnum)(-3)), values[3]); + Assert.AreEqual(((SampleEnum)(-4)), values[4]); + Assert.AreEqual(((SampleEnum)(-5)), values[5]); + } + + // Fairly perfunctory tests for the non-generic IList implementation + [Test] + public void IList_Indexer() + { + var field = new RepeatedField { "first", "second" }; + IList list = field; + Assert.AreEqual("first", list[0]); + list[1] = "changed"; + Assert.AreEqual("changed", field[1]); + } + + [Test] + public void IList_Contains() + { + IList list = new RepeatedField { "first", "second" }; + Assert.IsTrue(list.Contains("second")); + Assert.IsFalse(list.Contains("third")); + Assert.IsFalse(list.Contains(new object())); + } + + [Test] + public void IList_Add() + { + IList list = new RepeatedField { "first", "second" }; + list.Add("third"); + CollectionAssert.AreEqual(new[] { "first", "second", "third" }, list); + } + + [Test] + public void IList_Remove() + { + IList list = new RepeatedField { "first", "second" }; + list.Remove("third"); // No-op, no exception + list.Remove(new object()); // No-op, no exception + list.Remove("first"); + CollectionAssert.AreEqual(new[] { "second" }, list); + } + + [Test] + public void IList_IsFixedSize() + { + var field = new RepeatedField { "first", "second" }; + IList list = field; + Assert.IsFalse(list.IsFixedSize); + } + + [Test] + public void IList_IndexOf() + { + IList list = new RepeatedField { "first", "second" }; + Assert.AreEqual(1, list.IndexOf("second")); + Assert.AreEqual(-1, list.IndexOf("third")); + Assert.AreEqual(-1, list.IndexOf(new object())); + } + + [Test] + public void IList_SyncRoot() + { + IList list = new RepeatedField { "first", "second" }; + Assert.AreSame(list, list.SyncRoot); + } + + [Test] + public void IList_CopyTo() + { + IList list = new RepeatedField { "first", "second" }; + string[] stringArray = new string[4]; + list.CopyTo(stringArray, 1); + CollectionAssert.AreEqual(new[] { null, "first", "second", null }, stringArray); + + object[] objectArray = new object[4]; + list.CopyTo(objectArray, 1); + CollectionAssert.AreEqual(new[] { null, "first", "second", null }, objectArray); + + Assert.Throws(() => list.CopyTo(new StringBuilder[4], 1)); + Assert.Throws(() => list.CopyTo(new int[4], 1)); + } + + [Test] + public void IList_IsSynchronized() + { + IList list = new RepeatedField { "first", "second" }; + Assert.IsFalse(list.IsSynchronized); + } + + [Test] + public void IList_Insert() + { + IList list = new RepeatedField { "first", "second" }; + list.Insert(1, "middle"); + CollectionAssert.AreEqual(new[] { "first", "middle", "second" }, list); + } + + [Test] + public void ToString_Integers() + { + var list = new RepeatedField { 5, 10, 20 }; + var text = list.ToString(); + Assert.AreEqual("[ 5, 10, 20 ]", text); + } + + [Test] + public void ToString_Strings() + { + var list = new RepeatedField { "x", "y", "z" }; + var text = list.ToString(); + Assert.AreEqual("[ \"x\", \"y\", \"z\" ]", text); + } + + [Test] + public void ToString_Messages() + { + var list = new RepeatedField { new TestAllTypes { SingleDouble = 1.5 }, new TestAllTypes { SingleInt32 = 10 } }; + var text = list.ToString(); + Assert.AreEqual("[ { \"singleDouble\": 1.5 }, { \"singleInt32\": 10 } ]", text); + } + + [Test] + public void ToString_Empty() + { + var list = new RepeatedField { }; + var text = list.ToString(); + Assert.AreEqual("[ ]", text); + } + + [Test] + public void ToString_InvalidElementType() + { + var list = new RepeatedField { 15m }; + Assert.Throws(() => list.ToString()); + } + + [Test] + public void ToString_Timestamp() + { + var list = new RepeatedField { Timestamp.FromDateTime(new DateTime(2015, 10, 1, 12, 34, 56, DateTimeKind.Utc)) }; + var text = list.ToString(); + Assert.AreEqual("[ \"2015-10-01T12:34:56Z\" ]", text); + } + + [Test] + public void ToString_Struct() + { + var message = new Struct { Fields = { { "foo", new Value { NumberValue = 20 } } } }; + var list = new RepeatedField { message }; + var text = list.ToString(); + Assert.AreEqual(text, "[ { \"foo\": 20 } ]", message.ToString()); + } + } +} diff -Nru protobuf-3.0.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Compatibility/PropertyInfoExtensionsTest.cs protobuf-3.6.1.3/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Compatibility/PropertyInfoExtensionsTest.cs --- protobuf-3.0.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Compatibility/PropertyInfoExtensionsTest.cs 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Compatibility/PropertyInfoExtensionsTest.cs 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,98 @@ +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2015 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using NUnit.Framework; +using System.Reflection; + +namespace Google.Protobuf.Compatibility +{ + public class PropertyInfoExtensionsTest + { + public string PublicReadWrite { get; set; } + private string PrivateReadWrite { get; set; } + public string PublicReadPrivateWrite { get; private set; } + public string PrivateReadPublicWrite { private get; set; } + public string PublicReadOnly { get { return null; } } + private string PrivateReadOnly { get { return null; } } + public string PublicWriteOnly { set { } } + private string PrivateWriteOnly { set { } } + + [Test] + [TestCase("PublicReadWrite")] + [TestCase("PublicReadPrivateWrite")] + [TestCase("PublicReadOnly")] + public void GetGetMethod_Success(string name) + { + var propertyInfo = typeof(PropertyInfoExtensionsTest) + .GetProperty(name, BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public); + Assert.IsNotNull(PropertyInfoExtensions.GetGetMethod(propertyInfo)); + } + + [Test] + [TestCase("PrivateReadWrite")] + [TestCase("PrivateReadPublicWrite")] + [TestCase("PrivateReadOnly")] + [TestCase("PublicWriteOnly")] + [TestCase("PrivateWriteOnly")] + public void GetGetMethod_NoAccessibleGetter(string name) + { + var propertyInfo = typeof(PropertyInfoExtensionsTest) + .GetProperty(name, BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public); + Assert.IsNull(PropertyInfoExtensions.GetGetMethod(propertyInfo)); + } + + [Test] + [TestCase("PublicReadWrite")] + [TestCase("PrivateReadPublicWrite")] + [TestCase("PublicWriteOnly")] + public void GetSetMethod_Success(string name) + { + var propertyInfo = typeof(PropertyInfoExtensionsTest) + .GetProperty(name, BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public); + Assert.IsNotNull(PropertyInfoExtensions.GetSetMethod(propertyInfo)); + } + + [Test] + [TestCase("PublicReadPrivateWrite")] + [TestCase("PrivateReadWrite")] + [TestCase("PrivateReadOnly")] + [TestCase("PublicReadOnly")] + [TestCase("PrivateWriteOnly")] + public void GetSetMethod_NoAccessibleGetter(string name) + { + var propertyInfo = typeof(PropertyInfoExtensionsTest) + .GetProperty(name, BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public); + Assert.IsNull(PropertyInfoExtensions.GetSetMethod(propertyInfo)); + } + } + +} diff -Nru protobuf-3.0.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Compatibility/TypeExtensionsTest.cs protobuf-3.6.1.3/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Compatibility/TypeExtensionsTest.cs --- protobuf-3.0.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Compatibility/TypeExtensionsTest.cs 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Compatibility/TypeExtensionsTest.cs 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,117 @@ +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2015 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion +using NUnit.Framework; +using System; +using System.Collections.Generic; +using System.Reflection; + +#if !DOTNET35 +namespace Google.Protobuf.Compatibility +{ + public class TypeExtensionsTest + { + public class DerivedList : List { } + public string PublicProperty { get; set; } + private string PrivateProperty { get; set; } + + public void PublicMethod() + { + } + + private void PrivateMethod() + { + } + + [Test] + [TestCase(typeof(object), typeof(string), true)] + [TestCase(typeof(object), typeof(int), true)] + [TestCase(typeof(string), typeof(string), true)] + [TestCase(typeof(string), typeof(object), false)] + [TestCase(typeof(string), typeof(int), false)] + [TestCase(typeof(int), typeof(int), true)] + [TestCase(typeof(ValueType), typeof(int), true)] + [TestCase(typeof(long), typeof(int), false)] // + public void IsAssignableFrom(Type target, Type argument, bool expected) + { + Assert.AreEqual(expected, TypeExtensions.IsAssignableFrom(target, argument)); + } + + [Test] + [TestCase(typeof(DerivedList), "Count")] // Go up the type hierarchy + [TestCase(typeof(List), "Count")] + [TestCase(typeof(List<>), "Count")] + [TestCase(typeof(TypeExtensionsTest), "PublicProperty")] + public void GetProperty_Success(Type type, string name) + { + var property = TypeExtensions.GetProperty(type, name); + Assert.IsNotNull(property); + Assert.AreEqual(name, property.Name); + } + + [Test] + [TestCase(typeof(TypeExtensionsTest), "PrivateProperty")] + [TestCase(typeof(TypeExtensionsTest), "Garbage")] + public void GetProperty_NoSuchProperty(Type type, string name) + { + var property = TypeExtensions.GetProperty(type, name); + Assert.IsNull(property); + } + + [Test] + [TestCase(typeof(DerivedList), "RemoveAt")] // Go up the type hierarchy + [TestCase(typeof(List<>), "RemoveAt")] + [TestCase(typeof(TypeExtensionsTest), "PublicMethod")] + public void GetMethod_Success(Type type, string name) + { + var method = TypeExtensions.GetMethod(type, name); + Assert.IsNotNull(method); + Assert.AreEqual(name, method.Name); + } + + [Test] + [TestCase(typeof(TypeExtensionsTest), "PrivateMethod")] + [TestCase(typeof(TypeExtensionsTest), "GarbageMethod")] + public void GetMethod_NoSuchMethod(Type type, string name) + { + var method = TypeExtensions.GetMethod(type, name); + Assert.IsNull(method); + } + + [Test] + [TestCase(typeof(List), "IndexOf")] + public void GetMethod_Ambiguous(Type type, string name) + { + Assert.Throws(() => TypeExtensions.GetMethod(type, name)); + } + } +} +#endif diff -Nru protobuf-3.0.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/DeprecatedMemberTest.cs protobuf-3.6.1.3/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/DeprecatedMemberTest.cs --- protobuf-3.0.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/DeprecatedMemberTest.cs 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/DeprecatedMemberTest.cs 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,55 @@ +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2015 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using System; +using System.Reflection; +using Google.Protobuf.TestProtos; +using NUnit.Framework; + +namespace Google.Protobuf +{ + public class DeprecatedMemberTest + { + private static void AssertIsDeprecated(MemberInfo member) + { + Assert.NotNull(member); + Assert.IsTrue(member.IsDefined(typeof(ObsoleteAttribute), false), "Member not obsolete: " + member); + } + + [Test] + public void TestDepreatedPrimitiveValue() + { + AssertIsDeprecated(typeof(TestDeprecatedFields).GetProperty("DeprecatedInt32")); + } + + } +} diff -Nru protobuf-3.0.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/EqualityTester.cs protobuf-3.6.1.3/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/EqualityTester.cs --- protobuf-3.0.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/EqualityTester.cs 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/EqualityTester.cs 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,64 @@ +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2015 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using System; +using NUnit.Framework; + +namespace Google.Protobuf +{ + /// + /// Helper methods when testing equality. NUnit's Assert.AreEqual and + /// Assert.AreNotEqual methods try to be clever with collections, which can + /// be annoying... + /// + internal static class EqualityTester + { + public static void AssertEquality(T first, T second) where T : IEquatable + { + Assert.IsTrue(first.Equals(second)); + Assert.IsTrue(first.Equals((object) second)); + Assert.AreEqual(first.GetHashCode(), second.GetHashCode()); + } + + public static void AssertInequality(T first, T second) where T : IEquatable + { + Assert.IsFalse(first.Equals(second)); + Assert.IsFalse(first.Equals((object) second)); + // While this isn't a requirement, the chances of this test failing due to + // coincidence rather than a bug are very small. + if (first != null && second != null) + { + Assert.AreNotEqual(first.GetHashCode(), second.GetHashCode()); + } + } + } +} diff -Nru protobuf-3.0.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/FieldCodecTest.cs protobuf-3.6.1.3/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/FieldCodecTest.cs --- protobuf-3.0.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/FieldCodecTest.cs 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/FieldCodecTest.cs 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,196 @@ +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2015 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using System.Collections.Generic; +using System.IO; +using System.Reflection; +using Google.Protobuf.TestProtos; +using NUnit.Framework; + +namespace Google.Protobuf +{ + public class FieldCodecTest + { +#pragma warning disable 0414 // Used by tests via reflection - do not remove! + private static readonly List Codecs = new List + { + new FieldCodecTestData(FieldCodec.ForBool(100), true, "Bool"), + new FieldCodecTestData(FieldCodec.ForString(100), "sample", "String"), + new FieldCodecTestData(FieldCodec.ForBytes(100), ByteString.CopyFrom(1, 2, 3), "Bytes"), + new FieldCodecTestData(FieldCodec.ForInt32(100), -1000, "Int32"), + new FieldCodecTestData(FieldCodec.ForSInt32(100), -1000, "SInt32"), + new FieldCodecTestData(FieldCodec.ForSFixed32(100), -1000, "SFixed32"), + new FieldCodecTestData(FieldCodec.ForUInt32(100), 1234, "UInt32"), + new FieldCodecTestData(FieldCodec.ForFixed32(100), 1234, "Fixed32"), + new FieldCodecTestData(FieldCodec.ForInt64(100), -1000, "Int64"), + new FieldCodecTestData(FieldCodec.ForSInt64(100), -1000, "SInt64"), + new FieldCodecTestData(FieldCodec.ForSFixed64(100), -1000, "SFixed64"), + new FieldCodecTestData(FieldCodec.ForUInt64(100), 1234, "UInt64"), + new FieldCodecTestData(FieldCodec.ForFixed64(100), 1234, "Fixed64"), + new FieldCodecTestData(FieldCodec.ForFloat(100), 1234.5f, "Float"), + new FieldCodecTestData(FieldCodec.ForDouble(100), 1234567890.5d, "Double"), + new FieldCodecTestData( + FieldCodec.ForEnum(100, t => (int) t, t => (ForeignEnum) t), ForeignEnum.ForeignBaz, "Enum"), + new FieldCodecTestData( + FieldCodec.ForMessage(100, ForeignMessage.Parser), new ForeignMessage { C = 10 }, "Message"), + }; +#pragma warning restore 0414 + + [Test, TestCaseSource("Codecs")] + public void RoundTripWithTag(ICodecTestData codec) + { + codec.TestRoundTripWithTag(); + } + + [Test, TestCaseSource("Codecs")] + public void RoundTripRaw(ICodecTestData codec) + { + codec.TestRoundTripRaw(); + } + + [Test, TestCaseSource("Codecs")] + public void CalculateSize(ICodecTestData codec) + { + codec.TestCalculateSizeWithTag(); + } + + [Test, TestCaseSource("Codecs")] + public void DefaultValue(ICodecTestData codec) + { + codec.TestDefaultValue(); + } + + [Test, TestCaseSource("Codecs")] + public void FixedSize(ICodecTestData codec) + { + codec.TestFixedSize(); + } + + // This is ugly, but it means we can have a non-generic interface. + // It feels like NUnit should support this better, but I don't know + // of any better ways right now. + public interface ICodecTestData + { + void TestRoundTripRaw(); + void TestRoundTripWithTag(); + void TestCalculateSizeWithTag(); + void TestDefaultValue(); + void TestFixedSize(); + } + + public class FieldCodecTestData : ICodecTestData + { + private readonly FieldCodec codec; + private readonly T sampleValue; + private readonly string name; + + public FieldCodecTestData(FieldCodec codec, T sampleValue, string name) + { + this.codec = codec; + this.sampleValue = sampleValue; + this.name = name; + } + + public void TestRoundTripRaw() + { + var stream = new MemoryStream(); + var codedOutput = new CodedOutputStream(stream); + codec.ValueWriter(codedOutput, sampleValue); + codedOutput.Flush(); + stream.Position = 0; + var codedInput = new CodedInputStream(stream); + Assert.AreEqual(sampleValue, codec.ValueReader(codedInput)); + Assert.IsTrue(codedInput.IsAtEnd); + } + + public void TestRoundTripWithTag() + { + var stream = new MemoryStream(); + var codedOutput = new CodedOutputStream(stream); + codec.WriteTagAndValue(codedOutput, sampleValue); + codedOutput.Flush(); + stream.Position = 0; + var codedInput = new CodedInputStream(stream); + codedInput.AssertNextTag(codec.Tag); + Assert.AreEqual(sampleValue, codec.Read(codedInput)); + Assert.IsTrue(codedInput.IsAtEnd); + } + + public void TestCalculateSizeWithTag() + { + var stream = new MemoryStream(); + var codedOutput = new CodedOutputStream(stream); + codec.WriteTagAndValue(codedOutput, sampleValue); + codedOutput.Flush(); + Assert.AreEqual(stream.Position, codec.CalculateSizeWithTag(sampleValue)); + } + + public void TestDefaultValue() + { + // WriteTagAndValue ignores default values + var stream = new MemoryStream(); + var codedOutput = new CodedOutputStream(stream); + codec.WriteTagAndValue(codedOutput, codec.DefaultValue); + codedOutput.Flush(); + Assert.AreEqual(0, stream.Position); + Assert.AreEqual(0, codec.CalculateSizeWithTag(codec.DefaultValue)); + if (typeof(T).GetTypeInfo().IsValueType) + { + Assert.AreEqual(default(T), codec.DefaultValue); + } + + // The plain ValueWriter/ValueReader delegates don't. + if (codec.DefaultValue != null) // This part isn't appropriate for message types. + { + codedOutput = new CodedOutputStream(stream); + codec.ValueWriter(codedOutput, codec.DefaultValue); + codedOutput.Flush(); + Assert.AreNotEqual(0, stream.Position); + Assert.AreEqual(stream.Position, codec.ValueSizeCalculator(codec.DefaultValue)); + stream.Position = 0; + var codedInput = new CodedInputStream(stream); + Assert.AreEqual(codec.DefaultValue, codec.ValueReader(codedInput)); + } + } + + public void TestFixedSize() + { + Assert.AreEqual(name.Contains("Fixed"), codec.FixedSize != 0); + } + + public override string ToString() + { + return name; + } + } + } +} diff -Nru protobuf-3.0.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/GeneratedMessageTest.cs protobuf-3.6.1.3/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/GeneratedMessageTest.cs --- protobuf-3.0.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/GeneratedMessageTest.cs 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/GeneratedMessageTest.cs 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,725 @@ +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2015 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using System; +using System.IO; +using Google.Protobuf.TestProtos; +using NUnit.Framework; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using Google.Protobuf.WellKnownTypes; + +namespace Google.Protobuf +{ + /// + /// Tests around the generated TestAllTypes message. + /// + public class GeneratedMessageTest + { + [Test] + public void EmptyMessageFieldDistinctFromMissingMessageField() + { + // This demonstrates what we're really interested in... + var message1 = new TestAllTypes { SingleForeignMessage = new ForeignMessage() }; + var message2 = new TestAllTypes(); // SingleForeignMessage is null + EqualityTester.AssertInequality(message1, message2); + } + + [Test] + public void DefaultValues() + { + // Single fields + var message = new TestAllTypes(); + Assert.AreEqual(false, message.SingleBool); + Assert.AreEqual(ByteString.Empty, message.SingleBytes); + Assert.AreEqual(0.0, message.SingleDouble); + Assert.AreEqual(0, message.SingleFixed32); + Assert.AreEqual(0L, message.SingleFixed64); + Assert.AreEqual(0.0f, message.SingleFloat); + Assert.AreEqual(ForeignEnum.ForeignUnspecified, message.SingleForeignEnum); + Assert.IsNull(message.SingleForeignMessage); + Assert.AreEqual(ImportEnum.Unspecified, message.SingleImportEnum); + Assert.IsNull(message.SingleImportMessage); + Assert.AreEqual(0, message.SingleInt32); + Assert.AreEqual(0L, message.SingleInt64); + Assert.AreEqual(TestAllTypes.Types.NestedEnum.Unspecified, message.SingleNestedEnum); + Assert.IsNull(message.SingleNestedMessage); + Assert.IsNull(message.SinglePublicImportMessage); + Assert.AreEqual(0, message.SingleSfixed32); + Assert.AreEqual(0L, message.SingleSfixed64); + Assert.AreEqual(0, message.SingleSint32); + Assert.AreEqual(0L, message.SingleSint64); + Assert.AreEqual("", message.SingleString); + Assert.AreEqual(0U, message.SingleUint32); + Assert.AreEqual(0UL, message.SingleUint64); + + // Repeated fields + Assert.AreEqual(0, message.RepeatedBool.Count); + Assert.AreEqual(0, message.RepeatedBytes.Count); + Assert.AreEqual(0, message.RepeatedDouble.Count); + Assert.AreEqual(0, message.RepeatedFixed32.Count); + Assert.AreEqual(0, message.RepeatedFixed64.Count); + Assert.AreEqual(0, message.RepeatedFloat.Count); + Assert.AreEqual(0, message.RepeatedForeignEnum.Count); + Assert.AreEqual(0, message.RepeatedForeignMessage.Count); + Assert.AreEqual(0, message.RepeatedImportEnum.Count); + Assert.AreEqual(0, message.RepeatedImportMessage.Count); + Assert.AreEqual(0, message.RepeatedNestedEnum.Count); + Assert.AreEqual(0, message.RepeatedNestedMessage.Count); + Assert.AreEqual(0, message.RepeatedPublicImportMessage.Count); + Assert.AreEqual(0, message.RepeatedSfixed32.Count); + Assert.AreEqual(0, message.RepeatedSfixed64.Count); + Assert.AreEqual(0, message.RepeatedSint32.Count); + Assert.AreEqual(0, message.RepeatedSint64.Count); + Assert.AreEqual(0, message.RepeatedString.Count); + Assert.AreEqual(0, message.RepeatedUint32.Count); + Assert.AreEqual(0, message.RepeatedUint64.Count); + + // Oneof fields + Assert.AreEqual(TestAllTypes.OneofFieldOneofCase.None, message.OneofFieldCase); + Assert.AreEqual(0, message.OneofUint32); + Assert.AreEqual("", message.OneofString); + Assert.AreEqual(ByteString.Empty, message.OneofBytes); + Assert.IsNull(message.OneofNestedMessage); + } + + [Test] + public void NullStringAndBytesRejected() + { + var message = new TestAllTypes(); + Assert.Throws(() => message.SingleString = null); + Assert.Throws(() => message.OneofString = null); + Assert.Throws(() => message.SingleBytes = null); + Assert.Throws(() => message.OneofBytes = null); + } + + [Test] + public void RoundTrip_Empty() + { + var message = new TestAllTypes(); + // Without setting any values, there's nothing to write. + byte[] bytes = message.ToByteArray(); + Assert.AreEqual(0, bytes.Length); + TestAllTypes parsed = TestAllTypes.Parser.ParseFrom(bytes); + Assert.AreEqual(message, parsed); + } + + [Test] + public void RoundTrip_SingleValues() + { + var message = new TestAllTypes + { + SingleBool = true, + SingleBytes = ByteString.CopyFrom(1, 2, 3, 4), + SingleDouble = 23.5, + SingleFixed32 = 23, + SingleFixed64 = 1234567890123, + SingleFloat = 12.25f, + SingleForeignEnum = ForeignEnum.ForeignBar, + SingleForeignMessage = new ForeignMessage { C = 10 }, + SingleImportEnum = ImportEnum.ImportBaz, + SingleImportMessage = new ImportMessage { D = 20 }, + SingleInt32 = 100, + SingleInt64 = 3210987654321, + SingleNestedEnum = TestAllTypes.Types.NestedEnum.Foo, + SingleNestedMessage = new TestAllTypes.Types.NestedMessage { Bb = 35 }, + SinglePublicImportMessage = new PublicImportMessage { E = 54 }, + SingleSfixed32 = -123, + SingleSfixed64 = -12345678901234, + SingleSint32 = -456, + SingleSint64 = -12345678901235, + SingleString = "test", + SingleUint32 = uint.MaxValue, + SingleUint64 = ulong.MaxValue + }; + + byte[] bytes = message.ToByteArray(); + TestAllTypes parsed = TestAllTypes.Parser.ParseFrom(bytes); + Assert.AreEqual(message, parsed); + } + + [Test] + public void RoundTrip_RepeatedValues() + { + var message = new TestAllTypes + { + RepeatedBool = { true, false }, + RepeatedBytes = { ByteString.CopyFrom(1, 2, 3, 4), ByteString.CopyFrom(5, 6) }, + RepeatedDouble = { -12.25, 23.5 }, + RepeatedFixed32 = { uint.MaxValue, 23 }, + RepeatedFixed64 = { ulong.MaxValue, 1234567890123 }, + RepeatedFloat = { 100f, 12.25f }, + RepeatedForeignEnum = { ForeignEnum.ForeignFoo, ForeignEnum.ForeignBar }, + RepeatedForeignMessage = { new ForeignMessage(), new ForeignMessage { C = 10 } }, + RepeatedImportEnum = { ImportEnum.ImportBaz, ImportEnum.Unspecified }, + RepeatedImportMessage = { new ImportMessage { D = 20 }, new ImportMessage { D = 25 } }, + RepeatedInt32 = { 100, 200 }, + RepeatedInt64 = { 3210987654321, long.MaxValue }, + RepeatedNestedEnum = { TestAllTypes.Types.NestedEnum.Foo, TestAllTypes.Types.NestedEnum.Neg }, + RepeatedNestedMessage = { new TestAllTypes.Types.NestedMessage { Bb = 35 }, new TestAllTypes.Types.NestedMessage { Bb = 10 } }, + RepeatedPublicImportMessage = { new PublicImportMessage { E = 54 }, new PublicImportMessage { E = -1 } }, + RepeatedSfixed32 = { -123, 123 }, + RepeatedSfixed64 = { -12345678901234, 12345678901234 }, + RepeatedSint32 = { -456, 100 }, + RepeatedSint64 = { -12345678901235, 123 }, + RepeatedString = { "foo", "bar" }, + RepeatedUint32 = { uint.MaxValue, uint.MinValue }, + RepeatedUint64 = { ulong.MaxValue, uint.MinValue } + }; + + byte[] bytes = message.ToByteArray(); + TestAllTypes parsed = TestAllTypes.Parser.ParseFrom(bytes); + Assert.AreEqual(message, parsed); + } + + // Note that not every map within map_unittest_proto3 is used. They all go through very + // similar code paths. The fact that all maps are present is validation that we have codecs + // for every type. + [Test] + public void RoundTrip_Maps() + { + var message = new TestMap + { + MapBoolBool = { + { false, true }, + { true, false } + }, + MapInt32Bytes = { + { 5, ByteString.CopyFrom(6, 7, 8) }, + { 25, ByteString.CopyFrom(1, 2, 3, 4, 5) }, + { 10, ByteString.Empty } + }, + MapInt32ForeignMessage = { + { 0, new ForeignMessage { C = 10 } }, + { 5, new ForeignMessage() }, + }, + MapInt32Enum = { + { 1, MapEnum.Bar }, + { 2000, MapEnum.Foo } + } + }; + + byte[] bytes = message.ToByteArray(); + TestMap parsed = TestMap.Parser.ParseFrom(bytes); + Assert.AreEqual(message, parsed); + } + + [Test] + public void MapWithEmptyEntry() + { + var message = new TestMap + { + MapInt32Bytes = { { 0, ByteString.Empty } } + }; + + byte[] bytes = message.ToByteArray(); + Assert.AreEqual(2, bytes.Length); // Tag for field entry (1 byte), length of entry (0; 1 byte) + + var parsed = TestMap.Parser.ParseFrom(bytes); + Assert.AreEqual(1, parsed.MapInt32Bytes.Count); + Assert.AreEqual(ByteString.Empty, parsed.MapInt32Bytes[0]); + } + + [Test] + public void MapWithOnlyValue() + { + // Hand-craft the stream to contain a single entry with just a value. + var memoryStream = new MemoryStream(); + var output = new CodedOutputStream(memoryStream); + output.WriteTag(TestMap.MapInt32ForeignMessageFieldNumber, WireFormat.WireType.LengthDelimited); + var nestedMessage = new ForeignMessage { C = 20 }; + // Size of the entry (tag, size written by WriteMessage, data written by WriteMessage) + output.WriteLength(2 + nestedMessage.CalculateSize()); + output.WriteTag(2, WireFormat.WireType.LengthDelimited); + output.WriteMessage(nestedMessage); + output.Flush(); + + var parsed = TestMap.Parser.ParseFrom(memoryStream.ToArray()); + Assert.AreEqual(nestedMessage, parsed.MapInt32ForeignMessage[0]); + } + + [Test] + public void MapWithOnlyKey_PrimitiveValue() + { + // Hand-craft the stream to contain a single entry with just a key. + var memoryStream = new MemoryStream(); + var output = new CodedOutputStream(memoryStream); + output.WriteTag(TestMap.MapInt32DoubleFieldNumber, WireFormat.WireType.LengthDelimited); + int key = 10; + output.WriteLength(1 + CodedOutputStream.ComputeInt32Size(key)); + output.WriteTag(1, WireFormat.WireType.Varint); + output.WriteInt32(key); + output.Flush(); + + var parsed = TestMap.Parser.ParseFrom(memoryStream.ToArray()); + Assert.AreEqual(0.0, parsed.MapInt32Double[key]); + } + + [Test] + public void MapWithOnlyKey_MessageValue() + { + // Hand-craft the stream to contain a single entry with just a key. + var memoryStream = new MemoryStream(); + var output = new CodedOutputStream(memoryStream); + output.WriteTag(TestMap.MapInt32ForeignMessageFieldNumber, WireFormat.WireType.LengthDelimited); + int key = 10; + output.WriteLength(1 + CodedOutputStream.ComputeInt32Size(key)); + output.WriteTag(1, WireFormat.WireType.Varint); + output.WriteInt32(key); + output.Flush(); + + var parsed = TestMap.Parser.ParseFrom(memoryStream.ToArray()); + Assert.AreEqual(new ForeignMessage(), parsed.MapInt32ForeignMessage[key]); + } + + [Test] + public void MapIgnoresExtraFieldsWithinEntryMessages() + { + // Hand-craft the stream to contain a single entry with three fields + var memoryStream = new MemoryStream(); + var output = new CodedOutputStream(memoryStream); + + output.WriteTag(TestMap.MapInt32Int32FieldNumber, WireFormat.WireType.LengthDelimited); + + var key = 10; // Field 1 + var value = 20; // Field 2 + var extra = 30; // Field 3 + + // Each field can be represented in a single byte, with a single byte tag. + // Total message size: 6 bytes. + output.WriteLength(6); + output.WriteTag(1, WireFormat.WireType.Varint); + output.WriteInt32(key); + output.WriteTag(2, WireFormat.WireType.Varint); + output.WriteInt32(value); + output.WriteTag(3, WireFormat.WireType.Varint); + output.WriteInt32(extra); + output.Flush(); + + var parsed = TestMap.Parser.ParseFrom(memoryStream.ToArray()); + Assert.AreEqual(value, parsed.MapInt32Int32[key]); + } + + [Test] + public void MapFieldOrderIsIrrelevant() + { + var memoryStream = new MemoryStream(); + var output = new CodedOutputStream(memoryStream); + + output.WriteTag(TestMap.MapInt32Int32FieldNumber, WireFormat.WireType.LengthDelimited); + + var key = 10; + var value = 20; + + // Each field can be represented in a single byte, with a single byte tag. + // Total message size: 4 bytes. + output.WriteLength(4); + output.WriteTag(2, WireFormat.WireType.Varint); + output.WriteInt32(value); + output.WriteTag(1, WireFormat.WireType.Varint); + output.WriteInt32(key); + output.Flush(); + + var parsed = TestMap.Parser.ParseFrom(memoryStream.ToArray()); + Assert.AreEqual(value, parsed.MapInt32Int32[key]); + } + + [Test] + public void MapNonContiguousEntries() + { + var memoryStream = new MemoryStream(); + var output = new CodedOutputStream(memoryStream); + + // Message structure: + // Entry for MapInt32Int32 + // Entry for MapStringString + // Entry for MapInt32Int32 + + // First entry + var key1 = 10; + var value1 = 20; + output.WriteTag(TestMap.MapInt32Int32FieldNumber, WireFormat.WireType.LengthDelimited); + output.WriteLength(4); + output.WriteTag(1, WireFormat.WireType.Varint); + output.WriteInt32(key1); + output.WriteTag(2, WireFormat.WireType.Varint); + output.WriteInt32(value1); + + // Second entry + var key2 = "a"; + var value2 = "b"; + output.WriteTag(TestMap.MapStringStringFieldNumber, WireFormat.WireType.LengthDelimited); + output.WriteLength(6); // 3 bytes per entry: tag, size, character + output.WriteTag(1, WireFormat.WireType.LengthDelimited); + output.WriteString(key2); + output.WriteTag(2, WireFormat.WireType.LengthDelimited); + output.WriteString(value2); + + // Third entry + var key3 = 15; + var value3 = 25; + output.WriteTag(TestMap.MapInt32Int32FieldNumber, WireFormat.WireType.LengthDelimited); + output.WriteLength(4); + output.WriteTag(1, WireFormat.WireType.Varint); + output.WriteInt32(key3); + output.WriteTag(2, WireFormat.WireType.Varint); + output.WriteInt32(value3); + + output.Flush(); + var parsed = TestMap.Parser.ParseFrom(memoryStream.ToArray()); + var expected = new TestMap + { + MapInt32Int32 = { { key1, value1 }, { key3, value3 } }, + MapStringString = { { key2, value2 } } + }; + Assert.AreEqual(expected, parsed); + } + + [Test] + public void DuplicateKeys_LastEntryWins() + { + var memoryStream = new MemoryStream(); + var output = new CodedOutputStream(memoryStream); + + var key = 10; + var value1 = 20; + var value2 = 30; + + // First entry + output.WriteTag(TestMap.MapInt32Int32FieldNumber, WireFormat.WireType.LengthDelimited); + output.WriteLength(4); + output.WriteTag(1, WireFormat.WireType.Varint); + output.WriteInt32(key); + output.WriteTag(2, WireFormat.WireType.Varint); + output.WriteInt32(value1); + + // Second entry - same key, different value + output.WriteTag(TestMap.MapInt32Int32FieldNumber, WireFormat.WireType.LengthDelimited); + output.WriteLength(4); + output.WriteTag(1, WireFormat.WireType.Varint); + output.WriteInt32(key); + output.WriteTag(2, WireFormat.WireType.Varint); + output.WriteInt32(value2); + output.Flush(); + + var parsed = TestMap.Parser.ParseFrom(memoryStream.ToArray()); + Assert.AreEqual(value2, parsed.MapInt32Int32[key]); + } + + [Test] + public void CloneSingleNonMessageValues() + { + var original = new TestAllTypes + { + SingleBool = true, + SingleBytes = ByteString.CopyFrom(1, 2, 3, 4), + SingleDouble = 23.5, + SingleFixed32 = 23, + SingleFixed64 = 1234567890123, + SingleFloat = 12.25f, + SingleInt32 = 100, + SingleInt64 = 3210987654321, + SingleNestedEnum = TestAllTypes.Types.NestedEnum.Foo, + SingleSfixed32 = -123, + SingleSfixed64 = -12345678901234, + SingleSint32 = -456, + SingleSint64 = -12345678901235, + SingleString = "test", + SingleUint32 = uint.MaxValue, + SingleUint64 = ulong.MaxValue + }; + var clone = original.Clone(); + Assert.AreNotSame(original, clone); + Assert.AreEqual(original, clone); + // Just as a single example + clone.SingleInt32 = 150; + Assert.AreNotEqual(original, clone); + } + + [Test] + public void CloneRepeatedNonMessageValues() + { + var original = new TestAllTypes + { + RepeatedBool = { true, false }, + RepeatedBytes = { ByteString.CopyFrom(1, 2, 3, 4), ByteString.CopyFrom(5, 6) }, + RepeatedDouble = { -12.25, 23.5 }, + RepeatedFixed32 = { uint.MaxValue, 23 }, + RepeatedFixed64 = { ulong.MaxValue, 1234567890123 }, + RepeatedFloat = { 100f, 12.25f }, + RepeatedInt32 = { 100, 200 }, + RepeatedInt64 = { 3210987654321, long.MaxValue }, + RepeatedNestedEnum = { TestAllTypes.Types.NestedEnum.Foo, TestAllTypes.Types.NestedEnum.Neg }, + RepeatedSfixed32 = { -123, 123 }, + RepeatedSfixed64 = { -12345678901234, 12345678901234 }, + RepeatedSint32 = { -456, 100 }, + RepeatedSint64 = { -12345678901235, 123 }, + RepeatedString = { "foo", "bar" }, + RepeatedUint32 = { uint.MaxValue, uint.MinValue }, + RepeatedUint64 = { ulong.MaxValue, uint.MinValue } + }; + + var clone = original.Clone(); + Assert.AreNotSame(original, clone); + Assert.AreEqual(original, clone); + // Just as a single example + clone.RepeatedDouble.Add(25.5); + Assert.AreNotEqual(original, clone); + } + + [Test] + public void CloneSingleMessageField() + { + var original = new TestAllTypes + { + SingleNestedMessage = new TestAllTypes.Types.NestedMessage { Bb = 20 } + }; + + var clone = original.Clone(); + Assert.AreNotSame(original, clone); + Assert.AreNotSame(original.SingleNestedMessage, clone.SingleNestedMessage); + Assert.AreEqual(original, clone); + + clone.SingleNestedMessage.Bb = 30; + Assert.AreNotEqual(original, clone); + } + + [Test] + public void CloneRepeatedMessageField() + { + var original = new TestAllTypes + { + RepeatedNestedMessage = { new TestAllTypes.Types.NestedMessage { Bb = 20 } } + }; + + var clone = original.Clone(); + Assert.AreNotSame(original, clone); + Assert.AreNotSame(original.RepeatedNestedMessage, clone.RepeatedNestedMessage); + Assert.AreNotSame(original.RepeatedNestedMessage[0], clone.RepeatedNestedMessage[0]); + Assert.AreEqual(original, clone); + + clone.RepeatedNestedMessage[0].Bb = 30; + Assert.AreNotEqual(original, clone); + } + + [Test] + public void CloneOneofField() + { + var original = new TestAllTypes + { + OneofNestedMessage = new TestAllTypes.Types.NestedMessage { Bb = 20 } + }; + + var clone = original.Clone(); + Assert.AreNotSame(original, clone); + Assert.AreEqual(original, clone); + + // We should have cloned the message + original.OneofNestedMessage.Bb = 30; + Assert.AreNotEqual(original, clone); + } + + [Test] + public void OneofProperties() + { + // Switch the oneof case between each of the different options, and check everything behaves + // as expected in each case. + var message = new TestAllTypes(); + Assert.AreEqual("", message.OneofString); + Assert.AreEqual(0, message.OneofUint32); + Assert.AreEqual(ByteString.Empty, message.OneofBytes); + Assert.IsNull(message.OneofNestedMessage); + Assert.AreEqual(TestAllTypes.OneofFieldOneofCase.None, message.OneofFieldCase); + + message.OneofString = "sample"; + Assert.AreEqual("sample", message.OneofString); + Assert.AreEqual(0, message.OneofUint32); + Assert.AreEqual(ByteString.Empty, message.OneofBytes); + Assert.IsNull(message.OneofNestedMessage); + Assert.AreEqual(TestAllTypes.OneofFieldOneofCase.OneofString, message.OneofFieldCase); + + var bytes = ByteString.CopyFrom(1, 2, 3); + message.OneofBytes = bytes; + Assert.AreEqual("", message.OneofString); + Assert.AreEqual(0, message.OneofUint32); + Assert.AreEqual(bytes, message.OneofBytes); + Assert.IsNull(message.OneofNestedMessage); + Assert.AreEqual(TestAllTypes.OneofFieldOneofCase.OneofBytes, message.OneofFieldCase); + + message.OneofUint32 = 20; + Assert.AreEqual("", message.OneofString); + Assert.AreEqual(20, message.OneofUint32); + Assert.AreEqual(ByteString.Empty, message.OneofBytes); + Assert.IsNull(message.OneofNestedMessage); + Assert.AreEqual(TestAllTypes.OneofFieldOneofCase.OneofUint32, message.OneofFieldCase); + + var nestedMessage = new TestAllTypes.Types.NestedMessage { Bb = 25 }; + message.OneofNestedMessage = nestedMessage; + Assert.AreEqual("", message.OneofString); + Assert.AreEqual(0, message.OneofUint32); + Assert.AreEqual(ByteString.Empty, message.OneofBytes); + Assert.AreEqual(nestedMessage, message.OneofNestedMessage); + Assert.AreEqual(TestAllTypes.OneofFieldOneofCase.OneofNestedMessage, message.OneofFieldCase); + + message.ClearOneofField(); + Assert.AreEqual("", message.OneofString); + Assert.AreEqual(0, message.OneofUint32); + Assert.AreEqual(ByteString.Empty, message.OneofBytes); + Assert.IsNull(message.OneofNestedMessage); + Assert.AreEqual(TestAllTypes.OneofFieldOneofCase.None, message.OneofFieldCase); + } + + [Test] + public void Oneof_DefaultValuesNotEqual() + { + var message1 = new TestAllTypes { OneofString = "" }; + var message2 = new TestAllTypes { OneofUint32 = 0 }; + Assert.AreEqual(TestAllTypes.OneofFieldOneofCase.OneofString, message1.OneofFieldCase); + Assert.AreEqual(TestAllTypes.OneofFieldOneofCase.OneofUint32, message2.OneofFieldCase); + Assert.AreNotEqual(message1, message2); + } + + [Test] + public void OneofSerialization_NonDefaultValue() + { + var message = new TestAllTypes(); + message.OneofString = "this would take a bit of space"; + message.OneofUint32 = 10; + var bytes = message.ToByteArray(); + Assert.AreEqual(3, bytes.Length); // 2 bytes for the tag + 1 for the value - no string! + + var message2 = TestAllTypes.Parser.ParseFrom(bytes); + Assert.AreEqual(message, message2); + Assert.AreEqual(TestAllTypes.OneofFieldOneofCase.OneofUint32, message2.OneofFieldCase); + } + + [Test] + public void OneofSerialization_DefaultValue() + { + var message = new TestAllTypes(); + message.OneofString = "this would take a bit of space"; + message.OneofUint32 = 0; // This is the default value for UInt32; normally wouldn't be serialized + var bytes = message.ToByteArray(); + Assert.AreEqual(3, bytes.Length); // 2 bytes for the tag + 1 for the value - it's still serialized + + var message2 = TestAllTypes.Parser.ParseFrom(bytes); + Assert.AreEqual(message, message2); + Assert.AreEqual(TestAllTypes.OneofFieldOneofCase.OneofUint32, message2.OneofFieldCase); + } + + [Test] + public void DiscardUnknownFields_RealDataStillRead() + { + var message = SampleMessages.CreateFullTestAllTypes(); + var stream = new MemoryStream(); + var output = new CodedOutputStream(stream); + var unusedFieldNumber = 23456; + Assert.IsFalse(TestAllTypes.Descriptor.Fields.InDeclarationOrder().Select(x => x.FieldNumber).Contains(unusedFieldNumber)); + output.WriteTag(unusedFieldNumber, WireFormat.WireType.LengthDelimited); + output.WriteString("ignore me"); + message.WriteTo(output); + output.Flush(); + + stream.Position = 0; + var parsed = TestAllTypes.Parser.ParseFrom(stream); + // TODO(jieluo): Add test back after DiscardUnknownFields is supported + // Assert.AreEqual(message, parsed); + } + + [Test] + public void DiscardUnknownFields_AllTypes() + { + // Simple way of ensuring we can skip all kinds of fields. + var data = SampleMessages.CreateFullTestAllTypes().ToByteArray(); + var empty = Empty.Parser.ParseFrom(data); + // TODO(jieluo): Add test back after DiscardUnknownField is supported. + // Assert.AreEqual(new Empty(), empty); + } + + // This was originally seen as a conformance test failure. + [Test] + public void TruncatedMessageFieldThrows() + { + // 130, 3 is the message tag + // 1 is the data length - but there's no data. + var data = new byte[] { 130, 3, 1 }; + Assert.Throws(() => TestAllTypes.Parser.ParseFrom(data)); + } + + /// + /// Demonstrates current behaviour with an extraneous end group tag - see issue 688 + /// for details; we may want to change this. + /// + [Test] + public void ExtraEndGroupThrows() + { + var message = SampleMessages.CreateFullTestAllTypes(); + var stream = new MemoryStream(); + var output = new CodedOutputStream(stream); + + output.WriteTag(TestAllTypes.SingleFixed32FieldNumber, WireFormat.WireType.Fixed32); + output.WriteFixed32(123); + output.WriteTag(100, WireFormat.WireType.EndGroup); + + output.Flush(); + + stream.Position = 0; + Assert.Throws(() => TestAllTypes.Parser.ParseFrom(stream)); + } + + [Test] + public void CustomDiagnosticMessage_DirectToStringCall() + { + var message = new ForeignMessage { C = 31 }; + Assert.AreEqual("{ \"c\": 31, \"@cInHex\": \"1f\" }", message.ToString()); + Assert.AreEqual("{ \"c\": 31 }", JsonFormatter.Default.Format(message)); + } + + [Test] + public void CustomDiagnosticMessage_Nested() + { + var message = new TestAllTypes { SingleForeignMessage = new ForeignMessage { C = 16 } }; + Assert.AreEqual("{ \"singleForeignMessage\": { \"c\": 16, \"@cInHex\": \"10\" } }", message.ToString()); + Assert.AreEqual("{ \"singleForeignMessage\": { \"c\": 16 } }", JsonFormatter.Default.Format(message)); + } + + [Test] + public void CustomDiagnosticMessage_DirectToTextWriterCall() + { + var message = new ForeignMessage { C = 31 }; + var writer = new StringWriter(); + JsonFormatter.Default.Format(message, writer); + Assert.AreEqual("{ \"c\": 31 }", writer.ToString()); + } + } +} diff -Nru protobuf-3.0.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj protobuf-3.6.1.3/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj --- protobuf-3.0.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,30 @@ + + + + Exe + net451;netcoreapp1.0 + ../../keys/Google.Protobuf.snk + true + true + False + + + + + + + + + + + + + + netcoreapp1.0 + + + diff -Nru protobuf-3.0.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/IssuesTest.cs protobuf-3.6.1.3/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/IssuesTest.cs --- protobuf-3.0.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/IssuesTest.cs 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/IssuesTest.cs 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,82 @@ +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using Google.Protobuf.Reflection; +using UnitTest.Issues.TestProtos; +using NUnit.Framework; + + +namespace Google.Protobuf +{ + /// + /// Tests for issues which aren't easily compartmentalized into other unit tests. + /// + public class IssuesTest + { + // Issue 45 + [Test] + public void FieldCalledItem() + { + ItemField message = new ItemField { Item = 3 }; + FieldDescriptor field = ItemField.Descriptor.FindFieldByName("item"); + Assert.NotNull(field); + Assert.AreEqual(3, (int)field.Accessor.GetValue(message)); + } + + [Test] + public void ReservedNames() + { + var message = new ReservedNames { Types_ = 10, Descriptor_ = 20 }; + // Underscores aren't reflected in the JSON. + Assert.AreEqual("{ \"types\": 10, \"descriptor\": 20 }", message.ToString()); + } + + [Test] + public void JsonNameParseTest() + { + var settings = new JsonParser.Settings(10, TypeRegistry.FromFiles(UnittestIssuesReflection.Descriptor)); + var parser = new JsonParser(settings); + + // It is safe to use either original field name or explicitly specified json_name + Assert.AreEqual(new TestJsonName { Name = "test", Description = "test2", Guid = "test3" }, + parser.Parse("{ \"name\": \"test\", \"desc\": \"test2\", \"guid\": \"test3\" }")); + } + + [Test] + public void JsonNameFormatTest() + { + var message = new TestJsonName { Name = "test", Description = "test2", Guid = "test3" }; + Assert.AreEqual("{ \"name\": \"test\", \"desc\": \"test2\", \"exid\": \"test3\" }", + JsonFormatter.Default.Format(message)); + } + } +} diff -Nru protobuf-3.0.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/JsonParserTest.cs protobuf-3.6.1.3/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/JsonParserTest.cs --- protobuf-3.0.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/JsonParserTest.cs 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/JsonParserTest.cs 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,939 @@ +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using Google.Protobuf.Reflection; +using Google.Protobuf.TestProtos; +using Google.Protobuf.WellKnownTypes; +using NUnit.Framework; +using System; + +namespace Google.Protobuf +{ + /// + /// Unit tests for JSON parsing. + /// + public class JsonParserTest + { + // Sanity smoke test + [Test] + public void AllTypesRoundtrip() + { + AssertRoundtrip(SampleMessages.CreateFullTestAllTypes()); + } + + [Test] + public void Maps() + { + AssertRoundtrip(new TestMap { MapStringString = { { "with spaces", "bar" }, { "a", "b" } } }); + AssertRoundtrip(new TestMap { MapInt32Int32 = { { 0, 1 }, { 2, 3 } } }); + AssertRoundtrip(new TestMap { MapBoolBool = { { false, true }, { true, false } } }); + } + + [Test] + [TestCase(" 1 ")] + [TestCase("+1")] + [TestCase("1,000")] + [TestCase("1.5")] + public void IntegerMapKeysAreStrict(string keyText) + { + // Test that integer parsing is strict. We assume that if this is correct for int32, + // it's correct for other numeric key types. + var json = "{ \"mapInt32Int32\": { \"" + keyText + "\" : \"1\" } }"; + Assert.Throws(() => JsonParser.Default.Parse(json)); + } + + [Test] + public void OriginalFieldNameAccepted() + { + var json = "{ \"single_int32\": 10 }"; + var expected = new TestAllTypes { SingleInt32 = 10 }; + Assert.AreEqual(expected, TestAllTypes.Parser.ParseJson(json)); + } + + [Test] + public void SourceContextRoundtrip() + { + AssertRoundtrip(new SourceContext { FileName = "foo.proto" }); + } + + [Test] + public void SingularWrappers_DefaultNonNullValues() + { + var message = new TestWellKnownTypes + { + StringField = "", + BytesField = ByteString.Empty, + BoolField = false, + FloatField = 0f, + DoubleField = 0d, + Int32Field = 0, + Int64Field = 0, + Uint32Field = 0, + Uint64Field = 0 + }; + AssertRoundtrip(message); + } + + [Test] + public void SingularWrappers_NonDefaultValues() + { + var message = new TestWellKnownTypes + { + StringField = "x", + BytesField = ByteString.CopyFrom(1, 2, 3), + BoolField = true, + FloatField = 12.5f, + DoubleField = 12.25d, + Int32Field = 1, + Int64Field = 2, + Uint32Field = 3, + Uint64Field = 4 + }; + AssertRoundtrip(message); + } + + [Test] + public void SingularWrappers_ExplicitNulls() + { + // When we parse the "valueField": null part, we remember it... basically, it's one case + // where explicit default values don't fully roundtrip. + var message = new TestWellKnownTypes { ValueField = Value.ForNull() }; + var json = new JsonFormatter(new JsonFormatter.Settings(true)).Format(message); + var parsed = JsonParser.Default.Parse(json); + Assert.AreEqual(message, parsed); + } + + [Test] + [TestCase(typeof(BoolValue), "true", true)] + [TestCase(typeof(Int32Value), "32", 32)] + [TestCase(typeof(Int64Value), "32", 32L)] + [TestCase(typeof(Int64Value), "\"32\"", 32L)] + [TestCase(typeof(UInt32Value), "32", 32U)] + [TestCase(typeof(UInt64Value), "\"32\"", 32UL)] + [TestCase(typeof(UInt64Value), "32", 32UL)] + [TestCase(typeof(StringValue), "\"foo\"", "foo")] + [TestCase(typeof(FloatValue), "1.5", 1.5f)] + [TestCase(typeof(DoubleValue), "1.5", 1.5d)] + public void Wrappers_Standalone(System.Type wrapperType, string json, object expectedValue) + { + IMessage parsed = (IMessage)Activator.CreateInstance(wrapperType); + IMessage expected = (IMessage)Activator.CreateInstance(wrapperType); + JsonParser.Default.Merge(parsed, "null"); + Assert.AreEqual(expected, parsed); + + JsonParser.Default.Merge(parsed, json); + expected.Descriptor.Fields[WrappersReflection.WrapperValueFieldNumber].Accessor.SetValue(expected, expectedValue); + Assert.AreEqual(expected, parsed); + } + + [Test] + public void ExplicitNullValue() + { + string json = "{\"valueField\": null}"; + var message = JsonParser.Default.Parse(json); + Assert.AreEqual(new TestWellKnownTypes { ValueField = Value.ForNull() }, message); + } + + [Test] + public void BytesWrapper_Standalone() + { + ByteString data = ByteString.CopyFrom(1, 2, 3); + // Can't do this with attributes... + var parsed = JsonParser.Default.Parse(WrapInQuotes(data.ToBase64())); + var expected = new BytesValue { Value = data }; + Assert.AreEqual(expected, parsed); + } + + [Test] + public void RepeatedWrappers() + { + var message = new RepeatedWellKnownTypes + { + BoolField = { true, false }, + BytesField = { ByteString.CopyFrom(1, 2, 3), ByteString.CopyFrom(4, 5, 6), ByteString.Empty }, + DoubleField = { 12.5, -1.5, 0d }, + FloatField = { 123.25f, -20f, 0f }, + Int32Field = { int.MaxValue, int.MinValue, 0 }, + Int64Field = { long.MaxValue, long.MinValue, 0L }, + StringField = { "First", "Second", "" }, + Uint32Field = { uint.MaxValue, uint.MinValue, 0U }, + Uint64Field = { ulong.MaxValue, ulong.MinValue, 0UL }, + }; + AssertRoundtrip(message); + } + + [Test] + public void RepeatedField_NullElementProhibited() + { + string json = "{ \"repeated_foreign_message\": [null] }"; + Assert.Throws(() => TestAllTypes.Parser.ParseJson(json)); + } + + [Test] + public void RepeatedField_NullOverallValueAllowed() + { + string json = "{ \"repeated_foreign_message\": null }"; + Assert.AreEqual(new TestAllTypes(), TestAllTypes.Parser.ParseJson(json)); + } + + [Test] + [TestCase("{ \"mapInt32Int32\": { \"10\": null }")] + [TestCase("{ \"mapStringString\": { \"abc\": null }")] + [TestCase("{ \"mapInt32ForeignMessage\": { \"10\": null }")] + public void MapField_NullValueProhibited(string json) + { + Assert.Throws(() => TestMap.Parser.ParseJson(json)); + } + + [Test] + public void MapField_NullOverallValueAllowed() + { + string json = "{ \"mapInt32Int32\": null }"; + Assert.AreEqual(new TestMap(), TestMap.Parser.ParseJson(json)); + } + + [Test] + public void IndividualWrapperTypes() + { + Assert.AreEqual(new StringValue { Value = "foo" }, StringValue.Parser.ParseJson("\"foo\"")); + Assert.AreEqual(new Int32Value { Value = 1 }, Int32Value.Parser.ParseJson("1")); + // Can parse strings directly too + Assert.AreEqual(new Int32Value { Value = 1 }, Int32Value.Parser.ParseJson("\"1\"")); + } + + private static void AssertRoundtrip(T message) where T : IMessage, new() + { + var clone = message.Clone(); + var json = JsonFormatter.Default.Format(message); + var parsed = JsonParser.Default.Parse(json); + Assert.AreEqual(clone, parsed); + } + + [Test] + [TestCase("0", 0)] + [TestCase("-0", 0)] // Not entirely clear whether we intend to allow this... + [TestCase("1", 1)] + [TestCase("-1", -1)] + [TestCase("2147483647", 2147483647)] + [TestCase("-2147483648", -2147483648)] + public void StringToInt32_Valid(string jsonValue, int expectedParsedValue) + { + string json = "{ \"singleInt32\": \"" + jsonValue + "\"}"; + var parsed = TestAllTypes.Parser.ParseJson(json); + Assert.AreEqual(expectedParsedValue, parsed.SingleInt32); + } + + [Test] + [TestCase("+0")] + [TestCase(" 1")] + [TestCase("1 ")] + [TestCase("00")] + [TestCase("-00")] + [TestCase("--1")] + [TestCase("+1")] + [TestCase("1.5")] + [TestCase("1e10")] + [TestCase("2147483648")] + [TestCase("-2147483649")] + public void StringToInt32_Invalid(string jsonValue) + { + string json = "{ \"singleInt32\": \"" + jsonValue + "\"}"; + Assert.Throws(() => TestAllTypes.Parser.ParseJson(json)); + } + + [Test] + [TestCase("0", 0U)] + [TestCase("1", 1U)] + [TestCase("4294967295", 4294967295U)] + public void StringToUInt32_Valid(string jsonValue, uint expectedParsedValue) + { + string json = "{ \"singleUint32\": \"" + jsonValue + "\"}"; + var parsed = TestAllTypes.Parser.ParseJson(json); + Assert.AreEqual(expectedParsedValue, parsed.SingleUint32); + } + + // Assume that anything non-bounds-related is covered in the Int32 case + [Test] + [TestCase("-1")] + [TestCase("4294967296")] + public void StringToUInt32_Invalid(string jsonValue) + { + string json = "{ \"singleUint32\": \"" + jsonValue + "\"}"; + Assert.Throws(() => TestAllTypes.Parser.ParseJson(json)); + } + + [Test] + [TestCase("0", 0L)] + [TestCase("1", 1L)] + [TestCase("-1", -1L)] + [TestCase("9223372036854775807", 9223372036854775807)] + [TestCase("-9223372036854775808", -9223372036854775808)] + public void StringToInt64_Valid(string jsonValue, long expectedParsedValue) + { + string json = "{ \"singleInt64\": \"" + jsonValue + "\"}"; + var parsed = TestAllTypes.Parser.ParseJson(json); + Assert.AreEqual(expectedParsedValue, parsed.SingleInt64); + } + + // Assume that anything non-bounds-related is covered in the Int32 case + [Test] + [TestCase("-9223372036854775809")] + [TestCase("9223372036854775808")] + public void StringToInt64_Invalid(string jsonValue) + { + string json = "{ \"singleInt64\": \"" + jsonValue + "\"}"; + Assert.Throws(() => TestAllTypes.Parser.ParseJson(json)); + } + + [Test] + [TestCase("0", 0UL)] + [TestCase("1", 1UL)] + [TestCase("18446744073709551615", 18446744073709551615)] + public void StringToUInt64_Valid(string jsonValue, ulong expectedParsedValue) + { + string json = "{ \"singleUint64\": \"" + jsonValue + "\"}"; + var parsed = TestAllTypes.Parser.ParseJson(json); + Assert.AreEqual(expectedParsedValue, parsed.SingleUint64); + } + + // Assume that anything non-bounds-related is covered in the Int32 case + [Test] + [TestCase("-1")] + [TestCase("18446744073709551616")] + public void StringToUInt64_Invalid(string jsonValue) + { + string json = "{ \"singleUint64\": \"" + jsonValue + "\"}"; + Assert.Throws(() => TestAllTypes.Parser.ParseJson(json)); + } + + [Test] + [TestCase("0", 0d)] + [TestCase("1", 1d)] + [TestCase("1.000000", 1d)] + [TestCase("1.0000000000000000000000001", 1d)] // We don't notice that we haven't preserved the exact value + [TestCase("-1", -1d)] + [TestCase("1e1", 10d)] + [TestCase("1e01", 10d)] // Leading decimals are allowed in exponents + [TestCase("1E1", 10d)] // Either case is fine + [TestCase("-1e1", -10d)] + [TestCase("1.5e1", 15d)] + [TestCase("-1.5e1", -15d)] + [TestCase("15e-1", 1.5d)] + [TestCase("-15e-1", -1.5d)] + [TestCase("1.79769e308", 1.79769e308)] + [TestCase("-1.79769e308", -1.79769e308)] + [TestCase("Infinity", double.PositiveInfinity)] + [TestCase("-Infinity", double.NegativeInfinity)] + [TestCase("NaN", double.NaN)] + public void StringToDouble_Valid(string jsonValue, double expectedParsedValue) + { + string json = "{ \"singleDouble\": \"" + jsonValue + "\"}"; + var parsed = TestAllTypes.Parser.ParseJson(json); + Assert.AreEqual(expectedParsedValue, parsed.SingleDouble); + } + + [Test] + [TestCase("1.7977e308")] + [TestCase("-1.7977e308")] + [TestCase("1e309")] + [TestCase("1,0")] + [TestCase("1.0.0")] + [TestCase("+1")] + [TestCase("00")] + [TestCase("01")] + [TestCase("-00")] + [TestCase("-01")] + [TestCase("--1")] + [TestCase(" Infinity")] + [TestCase(" -Infinity")] + [TestCase("NaN ")] + [TestCase("Infinity ")] + [TestCase("-Infinity ")] + [TestCase(" NaN")] + [TestCase("INFINITY")] + [TestCase("nan")] + [TestCase("\u00BD")] // 1/2 as a single Unicode character. Just sanity checking... + public void StringToDouble_Invalid(string jsonValue) + { + string json = "{ \"singleDouble\": \"" + jsonValue + "\"}"; + Assert.Throws(() => TestAllTypes.Parser.ParseJson(json)); + } + + [Test] + [TestCase("0", 0f)] + [TestCase("1", 1f)] + [TestCase("1.000000", 1f)] + [TestCase("-1", -1f)] + [TestCase("3.402823e38", 3.402823e38f)] + [TestCase("-3.402823e38", -3.402823e38f)] + [TestCase("1.5e1", 15f)] + [TestCase("15e-1", 1.5f)] + public void StringToFloat_Valid(string jsonValue, float expectedParsedValue) + { + string json = "{ \"singleFloat\": \"" + jsonValue + "\"}"; + var parsed = TestAllTypes.Parser.ParseJson(json); + Assert.AreEqual(expectedParsedValue, parsed.SingleFloat); + } + + [Test] + [TestCase("3.402824e38")] + [TestCase("-3.402824e38")] + [TestCase("1,0")] + [TestCase("1.0.0")] + [TestCase("+1")] + [TestCase("00")] + [TestCase("--1")] + public void StringToFloat_Invalid(string jsonValue) + { + string json = "{ \"singleFloat\": \"" + jsonValue + "\"}"; + Assert.Throws(() => TestAllTypes.Parser.ParseJson(json)); + } + + [Test] + [TestCase("0", 0)] + [TestCase("-0", 0)] // Not entirely clear whether we intend to allow this... + [TestCase("1", 1)] + [TestCase("-1", -1)] + [TestCase("2147483647", 2147483647)] + [TestCase("-2147483648", -2147483648)] + [TestCase("1e1", 10)] + [TestCase("-1e1", -10)] + [TestCase("10.00", 10)] + [TestCase("-10.00", -10)] + public void NumberToInt32_Valid(string jsonValue, int expectedParsedValue) + { + string json = "{ \"singleInt32\": " + jsonValue + "}"; + var parsed = TestAllTypes.Parser.ParseJson(json); + Assert.AreEqual(expectedParsedValue, parsed.SingleInt32); + } + + [Test] + [TestCase("+0", typeof(InvalidJsonException))] + [TestCase("00", typeof(InvalidJsonException))] + [TestCase("-00", typeof(InvalidJsonException))] + [TestCase("--1", typeof(InvalidJsonException))] + [TestCase("+1", typeof(InvalidJsonException))] + [TestCase("1.5", typeof(InvalidProtocolBufferException))] + // Value is out of range + [TestCase("1e10", typeof(InvalidProtocolBufferException))] + [TestCase("2147483648", typeof(InvalidProtocolBufferException))] + [TestCase("-2147483649", typeof(InvalidProtocolBufferException))] + public void NumberToInt32_Invalid(string jsonValue, System.Type expectedExceptionType) + { + string json = "{ \"singleInt32\": " + jsonValue + "}"; + Assert.Throws(expectedExceptionType, () => TestAllTypes.Parser.ParseJson(json)); + } + + [Test] + [TestCase("0", 0U)] + [TestCase("1", 1U)] + [TestCase("4294967295", 4294967295U)] + public void NumberToUInt32_Valid(string jsonValue, uint expectedParsedValue) + { + string json = "{ \"singleUint32\": " + jsonValue + "}"; + var parsed = TestAllTypes.Parser.ParseJson(json); + Assert.AreEqual(expectedParsedValue, parsed.SingleUint32); + } + + // Assume that anything non-bounds-related is covered in the Int32 case + [Test] + [TestCase("-1")] + [TestCase("4294967296")] + public void NumberToUInt32_Invalid(string jsonValue) + { + string json = "{ \"singleUint32\": " + jsonValue + "}"; + Assert.Throws(() => TestAllTypes.Parser.ParseJson(json)); + } + + [Test] + [TestCase("0", 0L)] + [TestCase("1", 1L)] + [TestCase("-1", -1L)] + // long.MaxValue isn't actually representable as a double. This string value is the highest + // representable value which isn't greater than long.MaxValue. + [TestCase("9223372036854774784", 9223372036854774784)] + [TestCase("-9223372036854775808", -9223372036854775808)] + public void NumberToInt64_Valid(string jsonValue, long expectedParsedValue) + { + string json = "{ \"singleInt64\": " + jsonValue + "}"; + var parsed = TestAllTypes.Parser.ParseJson(json); + Assert.AreEqual(expectedParsedValue, parsed.SingleInt64); + } + + // Assume that anything non-bounds-related is covered in the Int32 case + [Test] + [TestCase("9223372036854775808")] + // Theoretical bound would be -9223372036854775809, but when that is parsed to a double + // we end up with the exact value of long.MinValue due to lack of precision. The value here + // is the "next double down". + [TestCase("-9223372036854780000")] + public void NumberToInt64_Invalid(string jsonValue) + { + string json = "{ \"singleInt64\": " + jsonValue + "}"; + Assert.Throws(() => TestAllTypes.Parser.ParseJson(json)); + } + + [Test] + [TestCase("0", 0UL)] + [TestCase("1", 1UL)] + // ulong.MaxValue isn't representable as a double. This value is the largest double within + // the range of ulong. + [TestCase("18446744073709549568", 18446744073709549568UL)] + public void NumberToUInt64_Valid(string jsonValue, ulong expectedParsedValue) + { + string json = "{ \"singleUint64\": " + jsonValue + "}"; + var parsed = TestAllTypes.Parser.ParseJson(json); + Assert.AreEqual(expectedParsedValue, parsed.SingleUint64); + } + + // Assume that anything non-bounds-related is covered in the Int32 case + [Test] + [TestCase("-1")] + [TestCase("18446744073709551616")] + public void NumberToUInt64_Invalid(string jsonValue) + { + string json = "{ \"singleUint64\": " + jsonValue + "}"; + Assert.Throws(() => TestAllTypes.Parser.ParseJson(json)); + } + + [Test] + [TestCase("0", 0d)] + [TestCase("1", 1d)] + [TestCase("1.000000", 1d)] + [TestCase("1.0000000000000000000000001", 1d)] // We don't notice that we haven't preserved the exact value + [TestCase("-1", -1d)] + [TestCase("1e1", 10d)] + [TestCase("1e01", 10d)] // Leading decimals are allowed in exponents + [TestCase("1E1", 10d)] // Either case is fine + [TestCase("-1e1", -10d)] + [TestCase("1.5e1", 15d)] + [TestCase("-1.5e1", -15d)] + [TestCase("15e-1", 1.5d)] + [TestCase("-15e-1", -1.5d)] + [TestCase("1.79769e308", 1.79769e308)] + [TestCase("-1.79769e308", -1.79769e308)] + public void NumberToDouble_Valid(string jsonValue, double expectedParsedValue) + { + string json = "{ \"singleDouble\": " + jsonValue + "}"; + var parsed = TestAllTypes.Parser.ParseJson(json); + Assert.AreEqual(expectedParsedValue, parsed.SingleDouble); + } + + [Test] + [TestCase("1.7977e308")] + [TestCase("-1.7977e308")] + [TestCase("1e309")] + [TestCase("1,0")] + [TestCase("1.0.0")] + [TestCase("+1")] + [TestCase("00")] + [TestCase("--1")] + [TestCase("\u00BD")] // 1/2 as a single Unicode character. Just sanity checking... + public void NumberToDouble_Invalid(string jsonValue) + { + string json = "{ \"singleDouble\": " + jsonValue + "}"; + Assert.Throws(() => TestAllTypes.Parser.ParseJson(json)); + } + + [Test] + [TestCase("0", 0f)] + [TestCase("1", 1f)] + [TestCase("1.000000", 1f)] + [TestCase("-1", -1f)] + [TestCase("3.402823e38", 3.402823e38f)] + [TestCase("-3.402823e38", -3.402823e38f)] + [TestCase("1.5e1", 15f)] + [TestCase("15e-1", 1.5f)] + public void NumberToFloat_Valid(string jsonValue, float expectedParsedValue) + { + string json = "{ \"singleFloat\": " + jsonValue + "}"; + var parsed = TestAllTypes.Parser.ParseJson(json); + Assert.AreEqual(expectedParsedValue, parsed.SingleFloat); + } + + [Test] + [TestCase("3.402824e38", typeof(InvalidProtocolBufferException))] + [TestCase("-3.402824e38", typeof(InvalidProtocolBufferException))] + [TestCase("1,0", typeof(InvalidJsonException))] + [TestCase("1.0.0", typeof(InvalidJsonException))] + [TestCase("+1", typeof(InvalidJsonException))] + [TestCase("00", typeof(InvalidJsonException))] + [TestCase("--1", typeof(InvalidJsonException))] + public void NumberToFloat_Invalid(string jsonValue, System.Type expectedExceptionType) + { + string json = "{ \"singleFloat\": " + jsonValue + "}"; + Assert.Throws(expectedExceptionType, () => TestAllTypes.Parser.ParseJson(json)); + } + + // The simplest way of testing that the value has parsed correctly is to reformat it, + // as we trust the formatting. In many cases that will give the same result as the input, + // so in those cases we accept an expectedFormatted value of null. Sometimes the results + // will be different though, due to a different number of digits being provided. + [Test] + // Z offset + [TestCase("2015-10-09T14:46:23.123456789Z", null)] + [TestCase("2015-10-09T14:46:23.123456Z", null)] + [TestCase("2015-10-09T14:46:23.123Z", null)] + [TestCase("2015-10-09T14:46:23Z", null)] + [TestCase("2015-10-09T14:46:23.123456000Z", "2015-10-09T14:46:23.123456Z")] + [TestCase("2015-10-09T14:46:23.1234560Z", "2015-10-09T14:46:23.123456Z")] + [TestCase("2015-10-09T14:46:23.123000000Z", "2015-10-09T14:46:23.123Z")] + [TestCase("2015-10-09T14:46:23.1230Z", "2015-10-09T14:46:23.123Z")] + [TestCase("2015-10-09T14:46:23.00Z", "2015-10-09T14:46:23Z")] + + // +00:00 offset + [TestCase("2015-10-09T14:46:23.123456789+00:00", "2015-10-09T14:46:23.123456789Z")] + [TestCase("2015-10-09T14:46:23.123456+00:00", "2015-10-09T14:46:23.123456Z")] + [TestCase("2015-10-09T14:46:23.123+00:00", "2015-10-09T14:46:23.123Z")] + [TestCase("2015-10-09T14:46:23+00:00", "2015-10-09T14:46:23Z")] + [TestCase("2015-10-09T14:46:23.123456000+00:00", "2015-10-09T14:46:23.123456Z")] + [TestCase("2015-10-09T14:46:23.1234560+00:00", "2015-10-09T14:46:23.123456Z")] + [TestCase("2015-10-09T14:46:23.123000000+00:00", "2015-10-09T14:46:23.123Z")] + [TestCase("2015-10-09T14:46:23.1230+00:00", "2015-10-09T14:46:23.123Z")] + [TestCase("2015-10-09T14:46:23.00+00:00", "2015-10-09T14:46:23Z")] + + // Other offsets (assume by now that the subsecond handling is okay) + [TestCase("2015-10-09T15:46:23.123456789+01:00", "2015-10-09T14:46:23.123456789Z")] + [TestCase("2015-10-09T13:46:23.123456789-01:00", "2015-10-09T14:46:23.123456789Z")] + [TestCase("2015-10-09T15:16:23.123456789+00:30", "2015-10-09T14:46:23.123456789Z")] + [TestCase("2015-10-09T14:16:23.123456789-00:30", "2015-10-09T14:46:23.123456789Z")] + [TestCase("2015-10-09T16:31:23.123456789+01:45", "2015-10-09T14:46:23.123456789Z")] + [TestCase("2015-10-09T13:01:23.123456789-01:45", "2015-10-09T14:46:23.123456789Z")] + [TestCase("2015-10-10T08:46:23.123456789+18:00", "2015-10-09T14:46:23.123456789Z")] + [TestCase("2015-10-08T20:46:23.123456789-18:00", "2015-10-09T14:46:23.123456789Z")] + + // Leap years and min/max + [TestCase("2016-02-29T14:46:23.123456789Z", null)] + [TestCase("2000-02-29T14:46:23.123456789Z", null)] + [TestCase("0001-01-01T00:00:00Z", null)] + [TestCase("9999-12-31T23:59:59.999999999Z", null)] + public void Timestamp_Valid(string jsonValue, string expectedFormatted) + { + expectedFormatted = expectedFormatted ?? jsonValue; + string json = WrapInQuotes(jsonValue); + var parsed = Timestamp.Parser.ParseJson(json); + Assert.AreEqual(WrapInQuotes(expectedFormatted), parsed.ToString()); + } + + [Test] + [TestCase("2015-10-09 14:46:23.123456789Z", Description = "No T between date and time")] + [TestCase("2015/10/09T14:46:23.123456789Z", Description = "Wrong date separators")] + [TestCase("2015-10-09T14.46.23.123456789Z", Description = "Wrong time separators")] + [TestCase("2015-10-09T14:46:23,123456789Z", Description = "Wrong fractional second separators (valid ISO-8601 though)")] + [TestCase(" 2015-10-09T14:46:23.123456789Z", Description = "Whitespace at start")] + [TestCase("2015-10-09T14:46:23.123456789Z ", Description = "Whitespace at end")] + [TestCase("2015-10-09T14:46:23.1234567890", Description = "Too many digits")] + [TestCase("2015-10-09T14:46:23.123456789", Description = "No offset")] + [TestCase("2015-13-09T14:46:23.123456789Z", Description = "Invalid month")] + [TestCase("2015-10-32T14:46:23.123456789Z", Description = "Invalid day")] + [TestCase("2015-10-09T24:00:00.000000000Z", Description = "Invalid hour (valid ISO-8601 though)")] + [TestCase("2015-10-09T14:60:23.123456789Z", Description = "Invalid minutes")] + [TestCase("2015-10-09T14:46:60.123456789Z", Description = "Invalid seconds")] + [TestCase("2015-10-09T14:46:23.123456789+18:01", Description = "Offset too large (positive)")] + [TestCase("2015-10-09T14:46:23.123456789-18:01", Description = "Offset too large (negative)")] + [TestCase("2015-10-09T14:46:23.123456789-00:00", Description = "Local offset (-00:00) makes no sense here")] + [TestCase("0001-01-01T00:00:00+00:01", Description = "Value before earliest when offset applied")] + [TestCase("9999-12-31T23:59:59.999999999-00:01", Description = "Value after latest when offset applied")] + [TestCase("2100-02-29T14:46:23.123456789Z", Description = "Feb 29th on a non-leap-year")] + public void Timestamp_Invalid(string jsonValue) + { + string json = WrapInQuotes(jsonValue); + Assert.Throws(() => Timestamp.Parser.ParseJson(json)); + } + + [Test] + public void StructValue_Null() + { + Assert.AreEqual(new Value { NullValue = 0 }, Value.Parser.ParseJson("null")); + } + + [Test] + public void StructValue_String() + { + Assert.AreEqual(new Value { StringValue = "hi" }, Value.Parser.ParseJson("\"hi\"")); + } + + [Test] + public void StructValue_Bool() + { + Assert.AreEqual(new Value { BoolValue = true }, Value.Parser.ParseJson("true")); + Assert.AreEqual(new Value { BoolValue = false }, Value.Parser.ParseJson("false")); + } + + [Test] + public void StructValue_List() + { + Assert.AreEqual(Value.ForList(Value.ForNumber(1), Value.ForString("x")), Value.Parser.ParseJson("[1, \"x\"]")); + } + + [Test] + public void ParseListValue() + { + Assert.AreEqual(new ListValue { Values = { Value.ForNumber(1), Value.ForString("x") } }, ListValue.Parser.ParseJson("[1, \"x\"]")); + } + + [Test] + public void StructValue_Struct() + { + Assert.AreEqual( + Value.ForStruct(new Struct { Fields = { { "x", Value.ForNumber(1) }, { "y", Value.ForString("z") } } }), + Value.Parser.ParseJson("{ \"x\": 1, \"y\": \"z\" }")); + } + + [Test] + public void ParseStruct() + { + Assert.AreEqual(new Struct { Fields = { { "x", Value.ForNumber(1) }, { "y", Value.ForString("z") } } }, + Struct.Parser.ParseJson("{ \"x\": 1, \"y\": \"z\" }")); + } + + // TODO for duration parsing: upper and lower bounds. + // +/- 315576000000 seconds + + [Test] + [TestCase("1.123456789s", null)] + [TestCase("1.123456s", null)] + [TestCase("1.123s", null)] + [TestCase("1.12300s", "1.123s")] + [TestCase("1.12345s", "1.123450s")] + [TestCase("1s", null)] + [TestCase("-1.123456789s", null)] + [TestCase("-1.123456s", null)] + [TestCase("-1.123s", null)] + [TestCase("-1s", null)] + [TestCase("0.123s", null)] + [TestCase("-0.123s", null)] + [TestCase("123456.123s", null)] + [TestCase("-123456.123s", null)] + // Upper and lower bounds + [TestCase("315576000000s", null)] + [TestCase("-315576000000s", null)] + public void Duration_Valid(string jsonValue, string expectedFormatted) + { + expectedFormatted = expectedFormatted ?? jsonValue; + string json = WrapInQuotes(jsonValue); + var parsed = Duration.Parser.ParseJson(json); + Assert.AreEqual(WrapInQuotes(expectedFormatted), parsed.ToString()); + } + + // The simplest way of testing that the value has parsed correctly is to reformat it, + // as we trust the formatting. In many cases that will give the same result as the input, + // so in those cases we accept an expectedFormatted value of null. Sometimes the results + // will be different though, due to a different number of digits being provided. + [Test] + [TestCase("1.1234567890s", Description = "Too many digits")] + [TestCase("1.123456789", Description = "No suffix")] + [TestCase("1.123456789ss", Description = "Too much suffix")] + [TestCase("1.123456789S", Description = "Upper case suffix")] + [TestCase("+1.123456789s", Description = "Leading +")] + [TestCase(".123456789s", Description = "No integer before the fraction")] + [TestCase("1,123456789s", Description = "Comma as decimal separator")] + [TestCase("1x1.123456789s", Description = "Non-digit in integer part")] + [TestCase("1.1x3456789s", Description = "Non-digit in fractional part")] + [TestCase(" 1.123456789s", Description = "Whitespace before fraction")] + [TestCase("1.123456789s ", Description = "Whitespace after value")] + [TestCase("01.123456789s", Description = "Leading zero (positive)")] + [TestCase("-01.123456789s", Description = "Leading zero (negative)")] + [TestCase("--0.123456789s", Description = "Double minus sign")] + // Violate upper/lower bounds in various ways + [TestCase("315576000001s", Description = "Integer part too large")] + [TestCase("3155760000000s", Description = "Integer part too long (positive)")] + [TestCase("-3155760000000s", Description = "Integer part too long (negative)")] + public void Duration_Invalid(string jsonValue) + { + string json = WrapInQuotes(jsonValue); + Assert.Throws(() => Duration.Parser.ParseJson(json)); + } + + // Not as many tests for field masks as I'd like; more to be added when we have more + // detailed specifications. + + [Test] + [TestCase("")] + [TestCase("foo", "foo")] + [TestCase("foo,bar", "foo", "bar")] + [TestCase("foo.bar", "foo.bar")] + [TestCase("fooBar", "foo_bar")] + [TestCase("fooBar.bazQux", "foo_bar.baz_qux")] + public void FieldMask_Valid(string jsonValue, params string[] expectedPaths) + { + string json = WrapInQuotes(jsonValue); + var parsed = FieldMask.Parser.ParseJson(json); + CollectionAssert.AreEqual(expectedPaths, parsed.Paths); + } + + [Test] + [TestCase("foo_bar")] + public void FieldMask_Invalid(string jsonValue) + { + string json = WrapInQuotes(jsonValue); + Assert.Throws(() => FieldMask.Parser.ParseJson(json)); + } + + [Test] + public void Any_RegularMessage() + { + var registry = TypeRegistry.FromMessages(TestAllTypes.Descriptor); + var formatter = new JsonFormatter(new JsonFormatter.Settings(false, TypeRegistry.FromMessages(TestAllTypes.Descriptor))); + var message = new TestAllTypes { SingleInt32 = 10, SingleNestedMessage = new TestAllTypes.Types.NestedMessage { Bb = 20 } }; + var original = Any.Pack(message); + var json = formatter.Format(original); // This is tested in JsonFormatterTest + var parser = new JsonParser(new JsonParser.Settings(10, registry)); + Assert.AreEqual(original, parser.Parse(json)); + string valueFirstJson = "{ \"singleInt32\": 10, \"singleNestedMessage\": { \"bb\": 20 }, \"@type\": \"type.googleapis.com/protobuf_unittest.TestAllTypes\" }"; + Assert.AreEqual(original, parser.Parse(valueFirstJson)); + } + + [Test] + public void Any_CustomPrefix() + { + var registry = TypeRegistry.FromMessages(TestAllTypes.Descriptor); + var message = new TestAllTypes { SingleInt32 = 10 }; + var original = Any.Pack(message, "custom.prefix/middle-part"); + var parser = new JsonParser(new JsonParser.Settings(10, registry)); + string json = "{ \"@type\": \"custom.prefix/middle-part/protobuf_unittest.TestAllTypes\", \"singleInt32\": 10 }"; + Assert.AreEqual(original, parser.Parse(json)); + } + + [Test] + public void Any_UnknownType() + { + string json = "{ \"@type\": \"type.googleapis.com/bogus\" }"; + Assert.Throws(() => Any.Parser.ParseJson(json)); + } + + [Test] + public void Any_NoTypeUrl() + { + string json = "{ \"foo\": \"bar\" }"; + Assert.Throws(() => Any.Parser.ParseJson(json)); + } + + [Test] + public void Any_WellKnownType() + { + var registry = TypeRegistry.FromMessages(Timestamp.Descriptor); + var formatter = new JsonFormatter(new JsonFormatter.Settings(false, registry)); + var timestamp = new DateTime(1673, 6, 19, 12, 34, 56, DateTimeKind.Utc).ToTimestamp(); + var original = Any.Pack(timestamp); + var json = formatter.Format(original); // This is tested in JsonFormatterTest + var parser = new JsonParser(new JsonParser.Settings(10, registry)); + Assert.AreEqual(original, parser.Parse(json)); + string valueFirstJson = "{ \"value\": \"1673-06-19T12:34:56Z\", \"@type\": \"type.googleapis.com/google.protobuf.Timestamp\" }"; + Assert.AreEqual(original, parser.Parse(valueFirstJson)); + } + + [Test] + public void Any_Nested() + { + var registry = TypeRegistry.FromMessages(TestWellKnownTypes.Descriptor, TestAllTypes.Descriptor); + var formatter = new JsonFormatter(new JsonFormatter.Settings(false, registry)); + var parser = new JsonParser(new JsonParser.Settings(10, registry)); + var doubleNestedMessage = new TestAllTypes { SingleInt32 = 20 }; + var nestedMessage = Any.Pack(doubleNestedMessage); + var message = new TestWellKnownTypes { AnyField = Any.Pack(nestedMessage) }; + var json = formatter.Format(message); + // Use the descriptor-based parser just for a change. + Assert.AreEqual(message, parser.Parse(json, TestWellKnownTypes.Descriptor)); + } + + [Test] + public void DataAfterObject() + { + string json = "{} 10"; + Assert.Throws(() => TestAllTypes.Parser.ParseJson(json)); + } + + /// + /// JSON equivalent to + /// + [Test] + public void MaliciousRecursion() + { + string data64 = CodedInputStreamTest.MakeRecursiveMessage(64).ToString(); + string data65 = CodedInputStreamTest.MakeRecursiveMessage(65).ToString(); + + var parser64 = new JsonParser(new JsonParser.Settings(64)); + CodedInputStreamTest.AssertMessageDepth(parser64.Parse(data64), 64); + Assert.Throws(() => parser64.Parse(data65)); + + var parser63 = new JsonParser(new JsonParser.Settings(63)); + Assert.Throws(() => parser63.Parse(data64)); + } + + [Test] + [TestCase("AQI")] + [TestCase("_-==")] + public void Bytes_InvalidBase64(string badBase64) + { + string json = "{ \"singleBytes\": \"" + badBase64 + "\" }"; + Assert.Throws(() => TestAllTypes.Parser.ParseJson(json)); + } + + [Test] + [TestCase("\"FOREIGN_BAR\"", ForeignEnum.ForeignBar)] + [TestCase("5", ForeignEnum.ForeignBar)] + [TestCase("100", (ForeignEnum)100)] + public void EnumValid(string value, ForeignEnum expectedValue) + { + string json = "{ \"singleForeignEnum\": " + value + " }"; + var parsed = TestAllTypes.Parser.ParseJson(json); + Assert.AreEqual(new TestAllTypes { SingleForeignEnum = expectedValue }, parsed); + } + + [Test] + [TestCase("\"NOT_A_VALID_VALUE\"")] + [TestCase("5.5")] + public void Enum_Invalid(string value) + { + string json = "{ \"singleForeignEnum\": " + value + " }"; + Assert.Throws(() => TestAllTypes.Parser.ParseJson(json)); + } + + [Test] + public void OneofDuplicate_Invalid() + { + string json = "{ \"oneofString\": \"x\", \"oneofUint32\": 10 }"; + Assert.Throws(() => TestAllTypes.Parser.ParseJson(json)); + } + + /// + /// Various tests use strings which have quotes round them for parsing or as the result + /// of formatting, but without those quotes being specified in the tests (for the sake of readability). + /// This method simply returns the input, wrapped in double quotes. + /// + internal static string WrapInQuotes(string text) + { + return '"' + text + '"'; + } + } +} \ No newline at end of file diff -Nru protobuf-3.0.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/JsonTokenizerTest.cs protobuf-3.6.1.3/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/JsonTokenizerTest.cs --- protobuf-3.0.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/JsonTokenizerTest.cs 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/JsonTokenizerTest.cs 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,408 @@ +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion +using NUnit.Framework; +using System; +using System.IO; + +namespace Google.Protobuf +{ + public class JsonTokenizerTest + { + [Test] + public void EmptyObjectValue() + { + AssertTokens("{}", JsonToken.StartObject, JsonToken.EndObject); + } + + [Test] + public void EmptyArrayValue() + { + AssertTokens("[]", JsonToken.StartArray, JsonToken.EndArray); + } + + [Test] + [TestCase("foo", "foo")] + [TestCase("tab\\t", "tab\t")] + [TestCase("line\\nfeed", "line\nfeed")] + [TestCase("carriage\\rreturn", "carriage\rreturn")] + [TestCase("back\\bspace", "back\bspace")] + [TestCase("form\\ffeed", "form\ffeed")] + [TestCase("escaped\\/slash", "escaped/slash")] + [TestCase("escaped\\\\backslash", "escaped\\backslash")] + [TestCase("escaped\\\"quote", "escaped\"quote")] + [TestCase("foo {}[] bar", "foo {}[] bar")] + [TestCase("foo\\u09aFbar", "foo\u09afbar")] // Digits, upper hex, lower hex + [TestCase("ab\ud800\udc00cd", "ab\ud800\udc00cd")] + [TestCase("ab\\ud800\\udc00cd", "ab\ud800\udc00cd")] + public void StringValue(string json, string expectedValue) + { + AssertTokensNoReplacement("\"" + json + "\"", JsonToken.Value(expectedValue)); + } + + // Valid surrogate pairs, with mixed escaping. These test cases can't be expressed + // using TestCase as they have no valid UTF-8 representation. + // It's unclear exactly how we should handle a mixture of escaped or not: that can't + // come from UTF-8 text, but could come from a .NET string. For the moment, + // treat it as valid in the obvious way. + [Test] + public void MixedSurrogatePairs() + { + string expected = "\ud800\udc00"; + AssertTokens("'\\ud800\udc00'", JsonToken.Value(expected)); + AssertTokens("'\ud800\\udc00'", JsonToken.Value(expected)); + } + + [Test] + public void ObjectDepth() + { + string json = "{ \"foo\": { \"x\": 1, \"y\": [ 0 ] } }"; + var tokenizer = JsonTokenizer.FromTextReader(new StringReader(json)); + // If we had more tests like this, I'd introduce a helper method... but for one test, it's not worth it. + Assert.AreEqual(0, tokenizer.ObjectDepth); + Assert.AreEqual(JsonToken.StartObject, tokenizer.Next()); + Assert.AreEqual(1, tokenizer.ObjectDepth); + Assert.AreEqual(JsonToken.Name("foo"), tokenizer.Next()); + Assert.AreEqual(1, tokenizer.ObjectDepth); + Assert.AreEqual(JsonToken.StartObject, tokenizer.Next()); + Assert.AreEqual(2, tokenizer.ObjectDepth); + Assert.AreEqual(JsonToken.Name("x"), tokenizer.Next()); + Assert.AreEqual(2, tokenizer.ObjectDepth); + Assert.AreEqual(JsonToken.Value(1), tokenizer.Next()); + Assert.AreEqual(2, tokenizer.ObjectDepth); + Assert.AreEqual(JsonToken.Name("y"), tokenizer.Next()); + Assert.AreEqual(2, tokenizer.ObjectDepth); + Assert.AreEqual(JsonToken.StartArray, tokenizer.Next()); + Assert.AreEqual(2, tokenizer.ObjectDepth); // Depth hasn't changed in array + Assert.AreEqual(JsonToken.Value(0), tokenizer.Next()); + Assert.AreEqual(2, tokenizer.ObjectDepth); + Assert.AreEqual(JsonToken.EndArray, tokenizer.Next()); + Assert.AreEqual(2, tokenizer.ObjectDepth); + Assert.AreEqual(JsonToken.EndObject, tokenizer.Next()); + Assert.AreEqual(1, tokenizer.ObjectDepth); + Assert.AreEqual(JsonToken.EndObject, tokenizer.Next()); + Assert.AreEqual(0, tokenizer.ObjectDepth); + Assert.AreEqual(JsonToken.EndDocument, tokenizer.Next()); + Assert.AreEqual(0, tokenizer.ObjectDepth); + } + + [Test] + public void ObjectDepth_WithPushBack() + { + string json = "{}"; + var tokenizer = JsonTokenizer.FromTextReader(new StringReader(json)); + Assert.AreEqual(0, tokenizer.ObjectDepth); + var token = tokenizer.Next(); + Assert.AreEqual(1, tokenizer.ObjectDepth); + // When we push back a "start object", we should effectively be back to the previous depth. + tokenizer.PushBack(token); + Assert.AreEqual(0, tokenizer.ObjectDepth); + // Read the same token again, and get back to depth 1 + token = tokenizer.Next(); + Assert.AreEqual(1, tokenizer.ObjectDepth); + + // Now the same in reverse, with EndObject + token = tokenizer.Next(); + Assert.AreEqual(0, tokenizer.ObjectDepth); + tokenizer.PushBack(token); + Assert.AreEqual(1, tokenizer.ObjectDepth); + tokenizer.Next(); + Assert.AreEqual(0, tokenizer.ObjectDepth); + } + + [Test] + [TestCase("embedded tab\t")] + [TestCase("embedded CR\r")] + [TestCase("embedded LF\n")] + [TestCase("embedded bell\u0007")] + [TestCase("bad escape\\a")] + [TestCase("incomplete escape\\")] + [TestCase("incomplete Unicode escape\\u000")] + [TestCase("invalid Unicode escape\\u000H")] + // Surrogate pair handling, both in raw .NET strings and escaped. We only need + // to detect this in strings, as non-ASCII characters anywhere other than in strings + // will already lead to parsing errors. + [TestCase("\\ud800")] + [TestCase("\\udc00")] + [TestCase("\\ud800x")] + [TestCase("\\udc00x")] + [TestCase("\\udc00\\ud800y")] + public void InvalidStringValue(string json) + { + AssertThrowsAfter("\"" + json + "\""); + } + + // Tests for invalid strings that can't be expressed in attributes, + // as the constants can't be expressed as UTF-8 strings. + [Test] + public void InvalidSurrogatePairs() + { + AssertThrowsAfter("\"\ud800x\""); + AssertThrowsAfter("\"\udc00y\""); + AssertThrowsAfter("\"\udc00\ud800y\""); + } + + [Test] + [TestCase("0", 0)] + [TestCase("-0", 0)] // We don't distinguish between positive and negative 0 + [TestCase("1", 1)] + [TestCase("-1", -1)] + // From here on, assume leading sign is okay... + [TestCase("1.125", 1.125)] + [TestCase("1.0", 1)] + [TestCase("1e5", 100000)] + [TestCase("1e000000", 1)] // Weird, but not prohibited by the spec + [TestCase("1E5", 100000)] + [TestCase("1e+5", 100000)] + [TestCase("1E-5", 0.00001)] + [TestCase("123E-2", 1.23)] + [TestCase("123.45E3", 123450)] + [TestCase(" 1 ", 1)] + public void NumberValue(string json, double expectedValue) + { + AssertTokens(json, JsonToken.Value(expectedValue)); + } + + [Test] + [TestCase("00")] + [TestCase(".5")] + [TestCase("1.")] + [TestCase("1e")] + [TestCase("1e-")] + [TestCase("--")] + [TestCase("--1")] + [TestCase("-1.7977e308")] + [TestCase("1.7977e308")] + public void InvalidNumberValue(string json) + { + AssertThrowsAfter(json); + } + + [Test] + [TestCase("nul")] + [TestCase("nothing")] + [TestCase("truth")] + [TestCase("fALSEhood")] + public void InvalidLiterals(string json) + { + AssertThrowsAfter(json); + } + + [Test] + public void NullValue() + { + AssertTokens("null", JsonToken.Null); + } + + [Test] + public void TrueValue() + { + AssertTokens("true", JsonToken.True); + } + + [Test] + public void FalseValue() + { + AssertTokens("false", JsonToken.False); + } + + [Test] + public void SimpleObject() + { + AssertTokens("{'x': 'y'}", + JsonToken.StartObject, JsonToken.Name("x"), JsonToken.Value("y"), JsonToken.EndObject); + } + + [Test] + [TestCase("[10, 20", 3)] + [TestCase("[10,", 2)] + [TestCase("[10:20]", 2)] + [TestCase("[", 1)] + [TestCase("[,", 1)] + [TestCase("{", 1)] + [TestCase("{,", 1)] + [TestCase("{[", 1)] + [TestCase("{{", 1)] + [TestCase("{0", 1)] + [TestCase("{null", 1)] + [TestCase("{false", 1)] + [TestCase("{true", 1)] + [TestCase("}", 0)] + [TestCase("]", 0)] + [TestCase(",", 0)] + [TestCase("'foo' 'bar'", 1)] + [TestCase(":", 0)] + [TestCase("'foo", 0)] // Incomplete string + [TestCase("{ 'foo' }", 2)] + [TestCase("{ x:1", 1)] // Property names must be quoted + [TestCase("{]", 1)] + [TestCase("[}", 1)] + [TestCase("[1,", 2)] + [TestCase("{'x':0]", 3)] + [TestCase("{ 'foo': }", 2)] + [TestCase("{ 'foo':'bar', }", 3)] + public void InvalidStructure(string json, int expectedValidTokens) + { + // Note: we don't test that the earlier tokens are exactly as expected, + // partly because that's hard to parameterize. + var reader = new StringReader(json.Replace('\'', '"')); + var tokenizer = JsonTokenizer.FromTextReader(reader); + for (int i = 0; i < expectedValidTokens; i++) + { + Assert.IsNotNull(tokenizer.Next()); + } + Assert.Throws(() => tokenizer.Next()); + } + + [Test] + public void ArrayMixedType() + { + AssertTokens("[1, 'foo', null, false, true, [2], {'x':'y' }]", + JsonToken.StartArray, + JsonToken.Value(1), + JsonToken.Value("foo"), + JsonToken.Null, + JsonToken.False, + JsonToken.True, + JsonToken.StartArray, + JsonToken.Value(2), + JsonToken.EndArray, + JsonToken.StartObject, + JsonToken.Name("x"), + JsonToken.Value("y"), + JsonToken.EndObject, + JsonToken.EndArray); + } + + [Test] + public void ObjectMixedType() + { + AssertTokens(@"{'a': 1, 'b': 'bar', 'c': null, 'd': false, 'e': true, + 'f': [2], 'g': {'x':'y' }}", + JsonToken.StartObject, + JsonToken.Name("a"), + JsonToken.Value(1), + JsonToken.Name("b"), + JsonToken.Value("bar"), + JsonToken.Name("c"), + JsonToken.Null, + JsonToken.Name("d"), + JsonToken.False, + JsonToken.Name("e"), + JsonToken.True, + JsonToken.Name("f"), + JsonToken.StartArray, + JsonToken.Value(2), + JsonToken.EndArray, + JsonToken.Name("g"), + JsonToken.StartObject, + JsonToken.Name("x"), + JsonToken.Value("y"), + JsonToken.EndObject, + JsonToken.EndObject); + } + + [Test] + public void NextAfterEndDocumentThrows() + { + var tokenizer = JsonTokenizer.FromTextReader(new StringReader("null")); + Assert.AreEqual(JsonToken.Null, tokenizer.Next()); + Assert.AreEqual(JsonToken.EndDocument, tokenizer.Next()); + Assert.Throws(() => tokenizer.Next()); + } + + [Test] + public void CanPushBackEndDocument() + { + var tokenizer = JsonTokenizer.FromTextReader(new StringReader("null")); + Assert.AreEqual(JsonToken.Null, tokenizer.Next()); + Assert.AreEqual(JsonToken.EndDocument, tokenizer.Next()); + tokenizer.PushBack(JsonToken.EndDocument); + Assert.AreEqual(JsonToken.EndDocument, tokenizer.Next()); + Assert.Throws(() => tokenizer.Next()); + } + + /// + /// Asserts that the specified JSON is tokenized into the given sequence of tokens. + /// All apostrophes are first converted to double quotes, allowing any tests + /// that don't need to check actual apostrophe handling to use apostrophes in the JSON, avoiding + /// messy string literal escaping. The "end document" token is not specified in the list of + /// expected tokens, but is implicit. + /// + private static void AssertTokens(string json, params JsonToken[] expectedTokens) + { + AssertTokensNoReplacement(json.Replace('\'', '"'), expectedTokens); + } + + /// + /// Asserts that the specified JSON is tokenized into the given sequence of tokens. + /// Unlike , this does not perform any character + /// replacement on the specified JSON, and should be used when the text contains apostrophes which + /// are expected to be used *as* apostrophes. The "end document" token is not specified in the list of + /// expected tokens, but is implicit. + /// + private static void AssertTokensNoReplacement(string json, params JsonToken[] expectedTokens) + { + var reader = new StringReader(json); + var tokenizer = JsonTokenizer.FromTextReader(reader); + for (int i = 0; i < expectedTokens.Length; i++) + { + var actualToken = tokenizer.Next(); + if (actualToken == JsonToken.EndDocument) + { + Assert.Fail("Expected {0} but reached end of token stream", expectedTokens[i]); + } + Assert.AreEqual(expectedTokens[i], actualToken); + } + var finalToken = tokenizer.Next(); + if (finalToken != JsonToken.EndDocument) + { + Assert.Fail("Expected token stream to be exhausted; received {0}", finalToken); + } + } + + private static void AssertThrowsAfter(string json, params JsonToken[] expectedTokens) + { + var reader = new StringReader(json); + var tokenizer = JsonTokenizer.FromTextReader(reader); + for (int i = 0; i < expectedTokens.Length; i++) + { + var actualToken = tokenizer.Next(); + if (actualToken == JsonToken.EndDocument) + { + Assert.Fail("Expected {0} but reached end of document", expectedTokens[i]); + } + Assert.AreEqual(expectedTokens[i], actualToken); + } + Assert.Throws(() => tokenizer.Next()); + } + } +} diff -Nru protobuf-3.0.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Program.cs protobuf-3.6.1.3/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Program.cs --- protobuf-3.0.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Program.cs 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Program.cs 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,47 @@ +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2017 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion +using NUnitLite; +using System.Reflection; + +// Note: this file wasn't in the actual 3.0, but is required due to build +// system changes + +namespace Google.Protobuf.Test +{ + class Program + { + public static int Main(string[] args) + { + return new AutoRun(typeof(Program).GetTypeInfo().Assembly).Execute(args); + } + } +} \ No newline at end of file diff -Nru protobuf-3.0.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Reflection/DescriptorsTest.cs protobuf-3.6.1.3/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Reflection/DescriptorsTest.cs --- protobuf-3.0.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Reflection/DescriptorsTest.cs 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Reflection/DescriptorsTest.cs 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,259 @@ +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using System.Linq; +using Google.Protobuf.TestProtos; +using NUnit.Framework; +using UnitTest.Issues.TestProtos; + +namespace Google.Protobuf.Reflection +{ + /// + /// Tests for descriptors. (Not in its own namespace or broken up into individual classes as the + /// size doesn't warrant it. On the other hand, this makes me feel a bit dirty...) + /// + public class DescriptorsTest + { + [Test] + public void FileDescriptor() + { + FileDescriptor file = UnittestProto3Reflection.Descriptor; + + Assert.AreEqual("google/protobuf/unittest_proto3.proto", file.Name); + Assert.AreEqual("protobuf_unittest", file.Package); + + Assert.AreEqual("UnittestProto", file.Proto.Options.JavaOuterClassname); + Assert.AreEqual("google/protobuf/unittest_proto3.proto", file.Proto.Name); + + // unittest.proto doesn't have any public imports, but unittest_import.proto does. + Assert.AreEqual(0, file.PublicDependencies.Count); + Assert.AreEqual(1, UnittestImportProto3Reflection.Descriptor.PublicDependencies.Count); + Assert.AreEqual(UnittestImportPublicProto3Reflection.Descriptor, UnittestImportProto3Reflection.Descriptor.PublicDependencies[0]); + + Assert.AreEqual(1, file.Dependencies.Count); + Assert.AreEqual(UnittestImportProto3Reflection.Descriptor, file.Dependencies[0]); + + MessageDescriptor messageType = TestAllTypes.Descriptor; + Assert.AreSame(typeof(TestAllTypes), messageType.ClrType); + Assert.AreSame(TestAllTypes.Parser, messageType.Parser); + Assert.AreEqual(messageType, file.MessageTypes[0]); + Assert.AreEqual(messageType, file.FindTypeByName("TestAllTypes")); + Assert.Null(file.FindTypeByName("NoSuchType")); + Assert.Null(file.FindTypeByName("protobuf_unittest.TestAllTypes")); + for (int i = 0; i < file.MessageTypes.Count; i++) + { + Assert.AreEqual(i, file.MessageTypes[i].Index); + } + + Assert.AreEqual(file.EnumTypes[0], file.FindTypeByName("ForeignEnum")); + Assert.Null(file.FindTypeByName("NoSuchType")); + Assert.Null(file.FindTypeByName("protobuf_unittest.ForeignEnum")); + Assert.AreEqual(1, UnittestImportProto3Reflection.Descriptor.EnumTypes.Count); + Assert.AreEqual("ImportEnum", UnittestImportProto3Reflection.Descriptor.EnumTypes[0].Name); + for (int i = 0; i < file.EnumTypes.Count; i++) + { + Assert.AreEqual(i, file.EnumTypes[i].Index); + } + + Assert.AreEqual(10, file.SerializedData[0]); + } + + [Test] + public void MessageDescriptor() + { + MessageDescriptor messageType = TestAllTypes.Descriptor; + MessageDescriptor nestedType = TestAllTypes.Types.NestedMessage.Descriptor; + + Assert.AreEqual("TestAllTypes", messageType.Name); + Assert.AreEqual("protobuf_unittest.TestAllTypes", messageType.FullName); + Assert.AreEqual(UnittestProto3Reflection.Descriptor, messageType.File); + Assert.IsNull(messageType.ContainingType); + Assert.IsNull(messageType.Proto.Options); + + Assert.AreEqual("TestAllTypes", messageType.Name); + + Assert.AreEqual("NestedMessage", nestedType.Name); + Assert.AreEqual("protobuf_unittest.TestAllTypes.NestedMessage", nestedType.FullName); + Assert.AreEqual(UnittestProto3Reflection.Descriptor, nestedType.File); + Assert.AreEqual(messageType, nestedType.ContainingType); + + FieldDescriptor field = messageType.Fields.InDeclarationOrder()[0]; + Assert.AreEqual("single_int32", field.Name); + Assert.AreEqual(field, messageType.FindDescriptor("single_int32")); + Assert.Null(messageType.FindDescriptor("no_such_field")); + Assert.AreEqual(field, messageType.FindFieldByNumber(1)); + Assert.Null(messageType.FindFieldByNumber(571283)); + var fieldsInDeclarationOrder = messageType.Fields.InDeclarationOrder(); + for (int i = 0; i < fieldsInDeclarationOrder.Count; i++) + { + Assert.AreEqual(i, fieldsInDeclarationOrder[i].Index); + } + + Assert.AreEqual(nestedType, messageType.NestedTypes[0]); + Assert.AreEqual(nestedType, messageType.FindDescriptor("NestedMessage")); + Assert.Null(messageType.FindDescriptor("NoSuchType")); + for (int i = 0; i < messageType.NestedTypes.Count; i++) + { + Assert.AreEqual(i, messageType.NestedTypes[i].Index); + } + + Assert.AreEqual(messageType.EnumTypes[0], messageType.FindDescriptor("NestedEnum")); + Assert.Null(messageType.FindDescriptor("NoSuchType")); + for (int i = 0; i < messageType.EnumTypes.Count; i++) + { + Assert.AreEqual(i, messageType.EnumTypes[i].Index); + } + } + + [Test] + public void FieldDescriptor() + { + MessageDescriptor messageType = TestAllTypes.Descriptor; + FieldDescriptor primitiveField = messageType.FindDescriptor("single_int32"); + FieldDescriptor enumField = messageType.FindDescriptor("single_nested_enum"); + FieldDescriptor messageField = messageType.FindDescriptor("single_foreign_message"); + + Assert.AreEqual("single_int32", primitiveField.Name); + Assert.AreEqual("protobuf_unittest.TestAllTypes.single_int32", + primitiveField.FullName); + Assert.AreEqual(1, primitiveField.FieldNumber); + Assert.AreEqual(messageType, primitiveField.ContainingType); + Assert.AreEqual(UnittestProto3Reflection.Descriptor, primitiveField.File); + Assert.AreEqual(FieldType.Int32, primitiveField.FieldType); + Assert.IsNull(primitiveField.Proto.Options); + + Assert.AreEqual("single_nested_enum", enumField.Name); + Assert.AreEqual(FieldType.Enum, enumField.FieldType); + // Assert.AreEqual(TestAllTypes.Types.NestedEnum.DescriptorProtoFile, enumField.EnumType); + + Assert.AreEqual("single_foreign_message", messageField.Name); + Assert.AreEqual(FieldType.Message, messageField.FieldType); + Assert.AreEqual(ForeignMessage.Descriptor, messageField.MessageType); + } + + [Test] + public void FieldDescriptorLabel() + { + FieldDescriptor singleField = + TestAllTypes.Descriptor.FindDescriptor("single_int32"); + FieldDescriptor repeatedField = + TestAllTypes.Descriptor.FindDescriptor("repeated_int32"); + + Assert.IsFalse(singleField.IsRepeated); + Assert.IsTrue(repeatedField.IsRepeated); + } + + [Test] + public void EnumDescriptor() + { + // Note: this test is a bit different to the Java version because there's no static way of getting to the descriptor + EnumDescriptor enumType = UnittestProto3Reflection.Descriptor.FindTypeByName("ForeignEnum"); + EnumDescriptor nestedType = TestAllTypes.Descriptor.FindDescriptor("NestedEnum"); + + Assert.AreEqual("ForeignEnum", enumType.Name); + Assert.AreEqual("protobuf_unittest.ForeignEnum", enumType.FullName); + Assert.AreEqual(UnittestProto3Reflection.Descriptor, enumType.File); + Assert.Null(enumType.ContainingType); + Assert.Null(enumType.Proto.Options); + + Assert.AreEqual("NestedEnum", nestedType.Name); + Assert.AreEqual("protobuf_unittest.TestAllTypes.NestedEnum", + nestedType.FullName); + Assert.AreEqual(UnittestProto3Reflection.Descriptor, nestedType.File); + Assert.AreEqual(TestAllTypes.Descriptor, nestedType.ContainingType); + + EnumValueDescriptor value = enumType.FindValueByName("FOREIGN_FOO"); + Assert.AreEqual(value, enumType.Values[1]); + Assert.AreEqual("FOREIGN_FOO", value.Name); + Assert.AreEqual(4, value.Number); + Assert.AreEqual((int) ForeignEnum.ForeignFoo, value.Number); + Assert.AreEqual(value, enumType.FindValueByNumber(4)); + Assert.Null(enumType.FindValueByName("NO_SUCH_VALUE")); + for (int i = 0; i < enumType.Values.Count; i++) + { + Assert.AreEqual(i, enumType.Values[i].Index); + } + } + + [Test] + public void OneofDescriptor() + { + OneofDescriptor descriptor = TestAllTypes.Descriptor.FindDescriptor("oneof_field"); + Assert.AreEqual("oneof_field", descriptor.Name); + Assert.AreEqual("protobuf_unittest.TestAllTypes.oneof_field", descriptor.FullName); + + var expectedFields = new[] { + TestAllTypes.OneofBytesFieldNumber, + TestAllTypes.OneofNestedMessageFieldNumber, + TestAllTypes.OneofStringFieldNumber, + TestAllTypes.OneofUint32FieldNumber } + .Select(fieldNumber => TestAllTypes.Descriptor.FindFieldByNumber(fieldNumber)) + .ToList(); + foreach (var field in expectedFields) + { + Assert.AreSame(descriptor, field.ContainingOneof); + } + + CollectionAssert.AreEquivalent(expectedFields, descriptor.Fields); + } + + [Test] + public void MapEntryMessageDescriptor() + { + var descriptor = MapWellKnownTypes.Descriptor.NestedTypes[0]; + Assert.IsNull(descriptor.Parser); + Assert.IsNull(descriptor.ClrType); + Assert.IsNull(descriptor.Fields[1].Accessor); + } + + // From TestFieldOrdering: + // string my_string = 11; + // int64 my_int = 1; + // float my_float = 101; + // NestedMessage single_nested_message = 200; + [Test] + public void FieldListOrderings() + { + var fields = TestFieldOrderings.Descriptor.Fields; + Assert.AreEqual(new[] { 11, 1, 101, 200 }, fields.InDeclarationOrder().Select(x => x.FieldNumber)); + Assert.AreEqual(new[] { 1, 11, 101, 200 }, fields.InFieldNumberOrder().Select(x => x.FieldNumber)); + } + + + [Test] + public void DescriptorProtoFileDescriptor() + { + var descriptor = Google.Protobuf.Reflection.FileDescriptor.DescriptorProtoFileDescriptor; + Assert.AreEqual("google/protobuf/descriptor.proto", descriptor.Name); + } + } +} diff -Nru protobuf-3.0.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Reflection/FieldAccessTest.cs protobuf-3.6.1.3/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Reflection/FieldAccessTest.cs --- protobuf-3.0.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Reflection/FieldAccessTest.cs 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Reflection/FieldAccessTest.cs 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,218 @@ +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2015 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using Google.Protobuf.TestProtos; +using NUnit.Framework; +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Google.Protobuf.Reflection +{ + public class FieldAccessTest + { + [Test] + public void GetValue() + { + var message = SampleMessages.CreateFullTestAllTypes(); + var fields = TestAllTypes.Descriptor.Fields; + Assert.AreEqual(message.SingleBool, fields[TestAllTypes.SingleBoolFieldNumber].Accessor.GetValue(message)); + Assert.AreEqual(message.SingleBytes, fields[TestAllTypes.SingleBytesFieldNumber].Accessor.GetValue(message)); + Assert.AreEqual(message.SingleDouble, fields[TestAllTypes.SingleDoubleFieldNumber].Accessor.GetValue(message)); + Assert.AreEqual(message.SingleFixed32, fields[TestAllTypes.SingleFixed32FieldNumber].Accessor.GetValue(message)); + Assert.AreEqual(message.SingleFixed64, fields[TestAllTypes.SingleFixed64FieldNumber].Accessor.GetValue(message)); + Assert.AreEqual(message.SingleFloat, fields[TestAllTypes.SingleFloatFieldNumber].Accessor.GetValue(message)); + Assert.AreEqual(message.SingleForeignEnum, fields[TestAllTypes.SingleForeignEnumFieldNumber].Accessor.GetValue(message)); + Assert.AreEqual(message.SingleForeignMessage, fields[TestAllTypes.SingleForeignMessageFieldNumber].Accessor.GetValue(message)); + Assert.AreEqual(message.SingleImportEnum, fields[TestAllTypes.SingleImportEnumFieldNumber].Accessor.GetValue(message)); + Assert.AreEqual(message.SingleImportMessage, fields[TestAllTypes.SingleImportMessageFieldNumber].Accessor.GetValue(message)); + Assert.AreEqual(message.SingleInt32, fields[TestAllTypes.SingleInt32FieldNumber].Accessor.GetValue(message)); + Assert.AreEqual(message.SingleInt64, fields[TestAllTypes.SingleInt64FieldNumber].Accessor.GetValue(message)); + Assert.AreEqual(message.SingleNestedEnum, fields[TestAllTypes.SingleNestedEnumFieldNumber].Accessor.GetValue(message)); + Assert.AreEqual(message.SingleNestedMessage, fields[TestAllTypes.SingleNestedMessageFieldNumber].Accessor.GetValue(message)); + Assert.AreEqual(message.SinglePublicImportMessage, fields[TestAllTypes.SinglePublicImportMessageFieldNumber].Accessor.GetValue(message)); + Assert.AreEqual(message.SingleSint32, fields[TestAllTypes.SingleSint32FieldNumber].Accessor.GetValue(message)); + Assert.AreEqual(message.SingleSint64, fields[TestAllTypes.SingleSint64FieldNumber].Accessor.GetValue(message)); + Assert.AreEqual(message.SingleString, fields[TestAllTypes.SingleStringFieldNumber].Accessor.GetValue(message)); + Assert.AreEqual(message.SingleSfixed32, fields[TestAllTypes.SingleSfixed32FieldNumber].Accessor.GetValue(message)); + Assert.AreEqual(message.SingleSfixed64, fields[TestAllTypes.SingleSfixed64FieldNumber].Accessor.GetValue(message)); + Assert.AreEqual(message.SingleUint32, fields[TestAllTypes.SingleUint32FieldNumber].Accessor.GetValue(message)); + Assert.AreEqual(message.SingleUint64, fields[TestAllTypes.SingleUint64FieldNumber].Accessor.GetValue(message)); + Assert.AreEqual(message.OneofBytes, fields[TestAllTypes.OneofBytesFieldNumber].Accessor.GetValue(message)); + Assert.AreEqual(message.OneofString, fields[TestAllTypes.OneofStringFieldNumber].Accessor.GetValue(message)); + Assert.AreEqual(message.OneofNestedMessage, fields[TestAllTypes.OneofNestedMessageFieldNumber].Accessor.GetValue(message)); + Assert.AreEqual(message.OneofUint32, fields[TestAllTypes.OneofUint32FieldNumber].Accessor.GetValue(message)); + + // Just one example for repeated fields - they're all just returning the list + var list = (IList) fields[TestAllTypes.RepeatedInt32FieldNumber].Accessor.GetValue(message); + Assert.AreEqual(message.RepeatedInt32, list); + Assert.AreEqual(message.RepeatedInt32[0], list[0]); // Just in case there was any doubt... + + // Just a single map field, for the same reason + var mapMessage = new TestMap { MapStringString = { { "key1", "value1" }, { "key2", "value2" } } }; + fields = TestMap.Descriptor.Fields; + var dictionary = (IDictionary) fields[TestMap.MapStringStringFieldNumber].Accessor.GetValue(mapMessage); + Assert.AreEqual(mapMessage.MapStringString, dictionary); + Assert.AreEqual("value1", dictionary["key1"]); + } + + [Test] + public void Clear() + { + var message = SampleMessages.CreateFullTestAllTypes(); + var fields = TestAllTypes.Descriptor.Fields; + fields[TestAllTypes.SingleBoolFieldNumber].Accessor.Clear(message); + fields[TestAllTypes.SingleInt32FieldNumber].Accessor.Clear(message); + fields[TestAllTypes.SingleStringFieldNumber].Accessor.Clear(message); + fields[TestAllTypes.SingleBytesFieldNumber].Accessor.Clear(message); + fields[TestAllTypes.SingleForeignEnumFieldNumber].Accessor.Clear(message); + fields[TestAllTypes.SingleForeignMessageFieldNumber].Accessor.Clear(message); + fields[TestAllTypes.RepeatedDoubleFieldNumber].Accessor.Clear(message); + + var expected = new TestAllTypes(SampleMessages.CreateFullTestAllTypes()) + { + SingleBool = false, + SingleInt32 = 0, + SingleString = "", + SingleBytes = ByteString.Empty, + SingleForeignEnum = 0, + SingleForeignMessage = null, + }; + expected.RepeatedDouble.Clear(); + + Assert.AreEqual(expected, message); + + // Separately, maps. + var mapMessage = new TestMap { MapStringString = { { "key1", "value1" }, { "key2", "value2" } } }; + fields = TestMap.Descriptor.Fields; + fields[TestMap.MapStringStringFieldNumber].Accessor.Clear(mapMessage); + Assert.AreEqual(0, mapMessage.MapStringString.Count); + } + + [Test] + public void SetValue_SingleFields() + { + // Just a sample (primitives, messages, enums, strings, byte strings) + var message = SampleMessages.CreateFullTestAllTypes(); + var fields = TestAllTypes.Descriptor.Fields; + fields[TestAllTypes.SingleBoolFieldNumber].Accessor.SetValue(message, false); + fields[TestAllTypes.SingleInt32FieldNumber].Accessor.SetValue(message, 500); + fields[TestAllTypes.SingleStringFieldNumber].Accessor.SetValue(message, "It's a string"); + fields[TestAllTypes.SingleBytesFieldNumber].Accessor.SetValue(message, ByteString.CopyFrom(99, 98, 97)); + fields[TestAllTypes.SingleForeignEnumFieldNumber].Accessor.SetValue(message, ForeignEnum.ForeignFoo); + fields[TestAllTypes.SingleForeignMessageFieldNumber].Accessor.SetValue(message, new ForeignMessage { C = 12345 }); + fields[TestAllTypes.SingleDoubleFieldNumber].Accessor.SetValue(message, 20150701.5); + + var expected = new TestAllTypes(SampleMessages.CreateFullTestAllTypes()) + { + SingleBool = false, + SingleInt32 = 500, + SingleString = "It's a string", + SingleBytes = ByteString.CopyFrom(99, 98, 97), + SingleForeignEnum = ForeignEnum.ForeignFoo, + SingleForeignMessage = new ForeignMessage { C = 12345 }, + SingleDouble = 20150701.5 + }; + + Assert.AreEqual(expected, message); + } + + [Test] + public void SetValue_SingleFields_WrongType() + { + IMessage message = SampleMessages.CreateFullTestAllTypes(); + var fields = message.Descriptor.Fields; + Assert.Throws(() => fields[TestAllTypes.SingleBoolFieldNumber].Accessor.SetValue(message, "This isn't a bool")); + } + + [Test] + public void SetValue_MapFields() + { + IMessage message = new TestMap(); + var fields = message.Descriptor.Fields; + Assert.Throws(() => fields[TestMap.MapStringStringFieldNumber].Accessor.SetValue(message, new Dictionary())); + } + + [Test] + public void SetValue_RepeatedFields() + { + IMessage message = SampleMessages.CreateFullTestAllTypes(); + var fields = message.Descriptor.Fields; + Assert.Throws(() => fields[TestAllTypes.RepeatedDoubleFieldNumber].Accessor.SetValue(message, new double[10])); + } + + [Test] + public void GetValue_IncorrectType() + { + IMessage message = SampleMessages.CreateFullTestAllTypes(); + var fields = message.Descriptor.Fields; + Assert.Throws(() => fields[TestAllTypes.SingleBoolFieldNumber].Accessor.GetValue(new TestMap())); + } + + [Test] + public void Oneof() + { + var message = new TestAllTypes(); + var descriptor = TestAllTypes.Descriptor; + Assert.AreEqual(1, descriptor.Oneofs.Count); + var oneof = descriptor.Oneofs[0]; + Assert.AreEqual("oneof_field", oneof.Name); + Assert.IsNull(oneof.Accessor.GetCaseFieldDescriptor(message)); + + message.OneofString = "foo"; + Assert.AreSame(descriptor.Fields[TestAllTypes.OneofStringFieldNumber], oneof.Accessor.GetCaseFieldDescriptor(message)); + + message.OneofUint32 = 10; + Assert.AreSame(descriptor.Fields[TestAllTypes.OneofUint32FieldNumber], oneof.Accessor.GetCaseFieldDescriptor(message)); + + oneof.Accessor.Clear(message); + Assert.AreEqual(TestAllTypes.OneofFieldOneofCase.None, message.OneofFieldCase); + } + + [Test] + public void FieldDescriptor_ByName() + { + var descriptor = TestAllTypes.Descriptor; + Assert.AreSame( + descriptor.Fields[TestAllTypes.SingleBoolFieldNumber], + descriptor.Fields["single_bool"]); + } + + [Test] + public void FieldDescriptor_NotFound() + { + var descriptor = TestAllTypes.Descriptor; + Assert.Throws(() => descriptor.Fields[999999].ToString()); + Assert.Throws(() => descriptor.Fields["not found"].ToString()); + } + } +} diff -Nru protobuf-3.0.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Reflection/TypeRegistryTest.cs protobuf-3.6.1.3/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Reflection/TypeRegistryTest.cs --- protobuf-3.0.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Reflection/TypeRegistryTest.cs 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Reflection/TypeRegistryTest.cs 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,94 @@ +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2015 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using Google.Protobuf.TestProtos; +using Google.Protobuf.WellKnownTypes; +using NUnit.Framework; + +namespace Google.Protobuf.Reflection +{ + public class TypeRegistryTest + { + // Most of our tests use messages. Simple test that we really can use files... + [Test] + public void CreateWithFileDescriptor() + { + var registry = TypeRegistry.FromFiles(DurationReflection.Descriptor, StructReflection.Descriptor); + AssertDescriptorPresent(registry, Duration.Descriptor); + AssertDescriptorPresent(registry, ListValue.Descriptor); + AssertDescriptorAbsent(registry, Timestamp.Descriptor); + } + + [Test] + public void TypesFromSameFile() + { + // Just for kicks, let's start with a nested type + var registry = TypeRegistry.FromMessages(TestAllTypes.Types.NestedMessage.Descriptor); + // Top-level... + AssertDescriptorPresent(registry, TestFieldOrderings.Descriptor); + // ... and nested (not the same as the original NestedMessage!) + AssertDescriptorPresent(registry, TestFieldOrderings.Types.NestedMessage.Descriptor); + } + + [Test] + public void DependenciesAreIncluded() + { + var registry = TypeRegistry.FromMessages(TestAllTypes.Descriptor); + // Direct dependencies + AssertDescriptorPresent(registry, ImportMessage.Descriptor); + // Public dependencies + AssertDescriptorPresent(registry, PublicImportMessage.Descriptor); + } + + [Test] + public void DuplicateFiles() + { + // Duplicates via dependencies and simply via repetition + var registry = TypeRegistry.FromFiles( + UnittestProto3Reflection.Descriptor, UnittestImportProto3Reflection.Descriptor, + TimestampReflection.Descriptor, TimestampReflection.Descriptor); + AssertDescriptorPresent(registry, TestAllTypes.Descriptor); + AssertDescriptorPresent(registry, ImportMessage.Descriptor); + AssertDescriptorPresent(registry, Timestamp.Descriptor); + } + + private static void AssertDescriptorPresent(TypeRegistry registry, MessageDescriptor descriptor) + { + Assert.AreSame(descriptor, registry.Find(descriptor.FullName)); + } + + private static void AssertDescriptorAbsent(TypeRegistry registry, MessageDescriptor descriptor) + { + Assert.IsNull(registry.Find(descriptor.FullName)); + } + } +} diff -Nru protobuf-3.0.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/SampleEnum.cs protobuf-3.6.1.3/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/SampleEnum.cs --- protobuf-3.0.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/SampleEnum.cs 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/SampleEnum.cs 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,42 @@ +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2015 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +namespace Google.Protobuf +{ + // Just a sample enum with positive and negative values to be used in tests. + internal enum SampleEnum + { + NegativeValue = -2, + None = 0, + PositiveValue = 3 + } +} diff -Nru protobuf-3.0.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/SampleMessages.cs protobuf-3.6.1.3/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/SampleMessages.cs --- protobuf-3.0.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/SampleMessages.cs 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/SampleMessages.cs 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,99 @@ +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2015 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using System; +using Google.Protobuf.TestProtos; + +namespace Google.Protobuf +{ + /// + /// Helper methods to create sample instances of types generated from unit test messages. + /// + public class SampleMessages + { + /// + /// Creates a new sample TestAllTypes message with all fields populated. + /// The "oneof" field is populated with the string property (OneofString). + /// + public static TestAllTypes CreateFullTestAllTypes() + { + return new TestAllTypes + { + SingleBool = true, + SingleBytes = ByteString.CopyFrom(1, 2, 3, 4), + SingleDouble = 23.5, + SingleFixed32 = 23, + SingleFixed64 = 1234567890123, + SingleFloat = 12.25f, + SingleForeignEnum = ForeignEnum.ForeignBar, + SingleForeignMessage = new ForeignMessage { C = 10 }, + SingleImportEnum = ImportEnum.ImportBaz, + SingleImportMessage = new ImportMessage { D = 20 }, + SingleInt32 = 100, + SingleInt64 = 3210987654321, + SingleNestedEnum = TestAllTypes.Types.NestedEnum.Foo, + SingleNestedMessage = new TestAllTypes.Types.NestedMessage { Bb = 35 }, + SinglePublicImportMessage = new PublicImportMessage { E = 54 }, + SingleSfixed32 = -123, + SingleSfixed64 = -12345678901234, + SingleSint32 = -456, + SingleSint64 = -12345678901235, + SingleString = "test", + SingleUint32 = UInt32.MaxValue, + SingleUint64 = UInt64.MaxValue, + RepeatedBool = { true, false }, + RepeatedBytes = { ByteString.CopyFrom(1, 2, 3, 4), ByteString.CopyFrom(5, 6), ByteString.CopyFrom(new byte[1000]) }, + RepeatedDouble = { -12.25, 23.5 }, + RepeatedFixed32 = { UInt32.MaxValue, 23 }, + RepeatedFixed64 = { UInt64.MaxValue, 1234567890123 }, + RepeatedFloat = { 100f, 12.25f }, + RepeatedForeignEnum = { ForeignEnum.ForeignFoo, ForeignEnum.ForeignBar }, + RepeatedForeignMessage = { new ForeignMessage(), new ForeignMessage { C = 10 } }, + RepeatedImportEnum = { ImportEnum.ImportBaz, ImportEnum.Unspecified }, + RepeatedImportMessage = { new ImportMessage { D = 20 }, new ImportMessage { D = 25 } }, + RepeatedInt32 = { 100, 200 }, + RepeatedInt64 = { 3210987654321, Int64.MaxValue }, + RepeatedNestedEnum = { TestAllTypes.Types.NestedEnum.Foo, TestAllTypes.Types.NestedEnum.Neg }, + RepeatedNestedMessage = { new TestAllTypes.Types.NestedMessage { Bb = 35 }, new TestAllTypes.Types.NestedMessage { Bb = 10 } }, + RepeatedPublicImportMessage = { new PublicImportMessage { E = 54 }, new PublicImportMessage { E = -1 } }, + RepeatedSfixed32 = { -123, 123 }, + RepeatedSfixed64 = { -12345678901234, 12345678901234 }, + RepeatedSint32 = { -456, 100 }, + RepeatedSint64 = { -12345678901235, 123 }, + RepeatedString = { "foo", "bar" }, + RepeatedUint32 = { UInt32.MaxValue, UInt32.MinValue }, + RepeatedUint64 = { UInt64.MaxValue, UInt32.MinValue }, + OneofString = "Oneof string" + }; + } + } +} \ No newline at end of file diff -Nru protobuf-3.0.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/TestCornerCases.cs protobuf-3.6.1.3/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/TestCornerCases.cs --- protobuf-3.0.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/TestCornerCases.cs 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/TestCornerCases.cs 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,62 @@ +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using UnitTest.Issues.TestProtos; +using NUnit.Framework; + +namespace Google.Protobuf +{ + public class TestCornerCases + { + [Test] + public void TestRoundTripNegativeEnums() + { + NegativeEnumMessage msg = new NegativeEnumMessage + { + Value = NegativeEnum.MinusOne, + Values = { NegativeEnum.Zero, NegativeEnum.MinusOne, NegativeEnum.FiveBelow }, + PackedValues = { NegativeEnum.Zero, NegativeEnum.MinusOne, NegativeEnum.FiveBelow } + }; + + Assert.AreEqual(58, msg.CalculateSize()); + + byte[] bytes = new byte[58]; + CodedOutputStream output = new CodedOutputStream(bytes); + + msg.WriteTo(output); + Assert.AreEqual(0, output.SpaceLeft); + + NegativeEnumMessage copy = NegativeEnumMessage.Parser.ParseFrom(bytes); + Assert.AreEqual(msg, copy); + } + } +} diff -Nru protobuf-3.0.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/TestProtos/ForeignMessagePartial.cs protobuf-3.6.1.3/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/TestProtos/ForeignMessagePartial.cs --- protobuf-3.0.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/TestProtos/ForeignMessagePartial.cs 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/TestProtos/ForeignMessagePartial.cs 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,45 @@ +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2016 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +namespace Google.Protobuf.TestProtos +{ + /// + /// A message with custom diagnostics (to test that they work). + /// + public partial class ForeignMessage : ICustomDiagnosticMessage + { + public string ToDiagnosticString() + { + return $"{{ \"c\": {C}, \"@cInHex\": \"{C:x}\" }}"; + } + } +} diff -Nru protobuf-3.0.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/WellKnownTypes/AnyTest.cs protobuf-3.6.1.3/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/WellKnownTypes/AnyTest.cs --- protobuf-3.0.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/WellKnownTypes/AnyTest.cs 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/WellKnownTypes/AnyTest.cs 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,116 @@ +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2015 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using Google.Protobuf.TestProtos; +using NUnit.Framework; + +namespace Google.Protobuf.WellKnownTypes +{ + public class AnyTest + { + [Test] + public void Pack() + { + var message = SampleMessages.CreateFullTestAllTypes(); + var any = Any.Pack(message); + Assert.AreEqual("type.googleapis.com/protobuf_unittest.TestAllTypes", any.TypeUrl); + Assert.AreEqual(message.CalculateSize(), any.Value.Length); + } + + [Test] + public void Pack_WithCustomPrefix() + { + var message = SampleMessages.CreateFullTestAllTypes(); + var any = Any.Pack(message, "foo.bar/baz"); + Assert.AreEqual("foo.bar/baz/protobuf_unittest.TestAllTypes", any.TypeUrl); + Assert.AreEqual(message.CalculateSize(), any.Value.Length); + } + + [Test] + public void Pack_WithCustomPrefixTrailingSlash() + { + var message = SampleMessages.CreateFullTestAllTypes(); + var any = Any.Pack(message, "foo.bar/baz/"); + Assert.AreEqual("foo.bar/baz/protobuf_unittest.TestAllTypes", any.TypeUrl); + Assert.AreEqual(message.CalculateSize(), any.Value.Length); + } + + [Test] + public void Unpack_WrongType() + { + var message = SampleMessages.CreateFullTestAllTypes(); + var any = Any.Pack(message); + Assert.Throws(() => any.Unpack()); + } + + [Test] + public void Unpack_Success() + { + var message = SampleMessages.CreateFullTestAllTypes(); + var any = Any.Pack(message); + var unpacked = any.Unpack(); + Assert.AreEqual(message, unpacked); + } + + [Test] + public void Unpack_CustomPrefix_Success() + { + var message = SampleMessages.CreateFullTestAllTypes(); + var any = Any.Pack(message, "foo.bar/baz"); + var unpacked = any.Unpack(); + Assert.AreEqual(message, unpacked); + } + + [Test] + public void ToString_WithValues() + { + var message = SampleMessages.CreateFullTestAllTypes(); + var any = Any.Pack(message); + var text = any.ToString(); + Assert.That(text, Does.Contain("\"@value\": \"" + message.ToByteString().ToBase64() + "\"")); + } + + [Test] + public void ToString_Empty() + { + var any = new Any(); + Assert.AreEqual("{ \"@type\": \"\", \"@value\": \"\" }", any.ToString()); + } + + [Test] + public void ToString_MessageContainingAny() + { + var message = new TestWellKnownTypes { AnyField = new Any() }; + Assert.AreEqual("{ \"anyField\": { \"@type\": \"\", \"@value\": \"\" } }", message.ToString()); + } + } +} diff -Nru protobuf-3.0.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/WellKnownTypes/DurationTest.cs protobuf-3.6.1.3/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/WellKnownTypes/DurationTest.cs --- protobuf-3.0.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/WellKnownTypes/DurationTest.cs 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/WellKnownTypes/DurationTest.cs 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,132 @@ +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2015 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using NUnit.Framework; +using System; + +namespace Google.Protobuf.WellKnownTypes +{ + public class DurationTest + { + [Test] + public void ToTimeSpan() + { + Assert.AreEqual(TimeSpan.FromSeconds(1), new Duration { Seconds = 1 }.ToTimeSpan()); + Assert.AreEqual(TimeSpan.FromSeconds(-1), new Duration { Seconds = -1 }.ToTimeSpan()); + Assert.AreEqual(TimeSpan.FromMilliseconds(1), new Duration { Nanos = 1000000 }.ToTimeSpan()); + Assert.AreEqual(TimeSpan.FromMilliseconds(-1), new Duration { Nanos = -1000000 }.ToTimeSpan()); + Assert.AreEqual(TimeSpan.FromTicks(1), new Duration { Nanos = 100 }.ToTimeSpan()); + Assert.AreEqual(TimeSpan.FromTicks(-1), new Duration { Nanos = -100 }.ToTimeSpan()); + + // Rounding is towards 0 + Assert.AreEqual(TimeSpan.FromTicks(2), new Duration { Nanos = 250 }.ToTimeSpan()); + Assert.AreEqual(TimeSpan.FromTicks(-2), new Duration { Nanos = -250 }.ToTimeSpan()); + } + + [Test] + public void Addition() + { + Assert.AreEqual(new Duration { Seconds = 2, Nanos = 100000000 }, + new Duration { Seconds = 1, Nanos = 600000000 } + new Duration { Nanos = 500000000 }); + Assert.AreEqual(new Duration { Seconds = -2, Nanos = -100000000 }, + new Duration { Seconds = -1, Nanos = -600000000 } + new Duration { Nanos = -500000000 }); + Assert.AreEqual(new Duration { Seconds = 1, Nanos = 100000000 }, + new Duration { Seconds = 1, Nanos = 600000000 } + new Duration { Nanos = -500000000 }); + + // Non-normalized durations, or non-normalized intermediate results + Assert.AreEqual(new Duration { Seconds = 1 }, + new Duration { Seconds = 1, Nanos = -500000000 } + new Duration { Nanos = 500000000 }); + + Assert.AreEqual(new Duration { Nanos = -900000000 }, + new Duration { Seconds = -1, Nanos = -100000000 } + new Duration { Nanos = 200000000 }); + Assert.AreEqual(new Duration { Nanos = 900000000 }, + new Duration { Seconds = 1, Nanos = 100000000 } + new Duration { Nanos = -200000000 }); + } + + [Test] + public void Subtraction() + { + Assert.AreEqual(new Duration { Seconds = 1, Nanos = 100000000 }, + new Duration { Seconds = 1, Nanos = 600000000 } - new Duration { Nanos = 500000000 }); + Assert.AreEqual(new Duration { Seconds = -1, Nanos = -100000000 }, + new Duration { Seconds = -1, Nanos = -600000000 } - new Duration { Nanos = -500000000 }); + Assert.AreEqual(new Duration { Seconds = 2, Nanos = 100000000 }, + new Duration { Seconds = 1, Nanos = 600000000 } - new Duration { Nanos = -500000000 }); + + // Non-normalized durations + Assert.AreEqual(new Duration(), + new Duration { Seconds = 1, Nanos = -500000000 } - new Duration { Nanos = 500000000 }); + Assert.AreEqual(new Duration { Seconds = 1 }, + new Duration { Nanos = 2000000000 } - new Duration { Nanos = 1000000000 }); + } + + [Test] + public void FromTimeSpan() + { + Assert.AreEqual(new Duration { Seconds = 1 }, Duration.FromTimeSpan(TimeSpan.FromSeconds(1))); + Assert.AreEqual(new Duration { Nanos = Duration.NanosecondsPerTick }, Duration.FromTimeSpan(TimeSpan.FromTicks(1))); + } + + [Test] + [TestCase(0, Duration.MaxNanoseconds + 1)] + [TestCase(0, Duration.MinNanoseconds - 1)] + [TestCase(Duration.MinSeconds - 1, 0)] + [TestCase(Duration.MaxSeconds + 1, 0)] + [TestCase(1, -1)] + [TestCase(-1, 1)] + public void ToTimeSpan_Invalid(long seconds, int nanoseconds) + { + var duration = new Duration { Seconds = seconds, Nanos = nanoseconds }; + Assert.Throws(() => duration.ToTimeSpan()); + } + + [Test] + [TestCase(0, Duration.MaxNanoseconds)] + [TestCase(0, Duration.MinNanoseconds)] + [TestCase(Duration.MinSeconds, Duration.MinNanoseconds)] + [TestCase(Duration.MaxSeconds, Duration.MaxNanoseconds)] + public void ToTimeSpan_Valid(long seconds, int nanoseconds) + { + // Only testing that these values don't throw, unlike their similar tests in ToTimeSpan_Invalid + var duration = new Duration { Seconds = seconds, Nanos = nanoseconds }; + duration.ToTimeSpan(); + } + + [Test] + public void ToString_NonNormalized() + { + // Just a single example should be sufficient... + var duration = new Duration { Seconds = 1, Nanos = -1 }; + Assert.AreEqual("{ \"@warning\": \"Invalid Duration\", \"seconds\": \"1\", \"nanos\": -1 }", duration.ToString()); + } + } +} diff -Nru protobuf-3.0.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/WellKnownTypes/FieldMaskTest.cs protobuf-3.6.1.3/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/WellKnownTypes/FieldMaskTest.cs --- protobuf-3.0.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/WellKnownTypes/FieldMaskTest.cs 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/WellKnownTypes/FieldMaskTest.cs 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,62 @@ +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2016 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + + +using NUnit.Framework; + +namespace Google.Protobuf.WellKnownTypes +{ + public class FieldMaskTest + { + [Test] + [TestCase("foo__bar")] + [TestCase("foo_3_ar")] + [TestCase("fooBar")] + public void ToString_Invalid(string input) + { + var mask = new FieldMask { Paths = { input } }; + var text = mask.ToString(); + // More specific test below + Assert.That(text, Does.Contain("@warning")); + Assert.That(text, Does.Contain(input)); + } + + [Test] + public void ToString_Invalid_Precise() + { + var mask = new FieldMask { Paths = { "x", "foo__bar", @"x\y" } }; + Assert.AreEqual( + "{ \"@warning\": \"Invalid FieldMask\", \"paths\": [ \"x\", \"foo__bar\", \"x\\\\y\" ] }", + mask.ToString()); + } + } +} diff -Nru protobuf-3.0.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/WellKnownTypes/TimestampTest.cs protobuf-3.6.1.3/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/WellKnownTypes/TimestampTest.cs --- protobuf-3.0.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/WellKnownTypes/TimestampTest.cs 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/WellKnownTypes/TimestampTest.cs 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,115 @@ +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2015 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using NUnit.Framework; +using System; + +namespace Google.Protobuf.WellKnownTypes +{ + public class TimestampTest + { + [Test] + public void FromAndToDateTime() + { + DateTime utcMin = DateTime.SpecifyKind(DateTime.MinValue, DateTimeKind.Utc); + DateTime utcMax = DateTime.SpecifyKind(DateTime.MaxValue, DateTimeKind.Utc); + AssertRoundtrip(new Timestamp { Seconds = -62135596800 }, utcMin); + AssertRoundtrip(new Timestamp { Seconds = 253402300799, Nanos = 999999900 }, utcMax); + AssertRoundtrip(new Timestamp(), new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)); + AssertRoundtrip(new Timestamp { Nanos = 1000000}, new DateTime(1970, 1, 1, 0, 0, 0, 1, DateTimeKind.Utc)); + AssertRoundtrip(new Timestamp { Seconds = -1, Nanos = 999000000 }, new DateTime(1969, 12, 31, 23, 59, 59, 999, DateTimeKind.Utc)); + AssertRoundtrip(new Timestamp { Seconds = 3600 }, new DateTime(1970, 1, 1, 1, 0, 0, DateTimeKind.Utc)); + AssertRoundtrip(new Timestamp { Seconds = -3600 }, new DateTime(1969, 12, 31, 23, 0, 0, DateTimeKind.Utc)); + } + + [Test] + public void ToDateTimeTruncation() + { + var t1 = new Timestamp { Seconds = 1, Nanos = 1000000 + Duration.NanosecondsPerTick - 1 }; + Assert.AreEqual(new DateTime(1970, 1, 1, 0, 0, 1, DateTimeKind.Utc).AddMilliseconds(1), t1.ToDateTime()); + + var t2 = new Timestamp { Seconds = -1, Nanos = 1000000 + Duration.NanosecondsPerTick - 1 }; + Assert.AreEqual(new DateTime(1969, 12, 31, 23, 59, 59).AddMilliseconds(1), t2.ToDateTime()); + } + + [Test] + [TestCase(Timestamp.UnixSecondsAtBclMinValue - 1, Timestamp.MaxNanos)] + [TestCase(Timestamp.UnixSecondsAtBclMaxValue + 1, 0)] + [TestCase(0, -1)] + [TestCase(0, Timestamp.MaxNanos + 1)] + public void ToDateTime_OutOfRange(long seconds, int nanoseconds) + { + var value = new Timestamp { Seconds = seconds, Nanos = nanoseconds }; + Assert.Throws(() => value.ToDateTime()); + } + + // 1ns larger or smaller than the above values + [Test] + [TestCase(Timestamp.UnixSecondsAtBclMinValue, 0)] + [TestCase(Timestamp.UnixSecondsAtBclMaxValue, Timestamp.MaxNanos)] + [TestCase(0, 0)] + [TestCase(0, Timestamp.MaxNanos)] + public void ToDateTime_ValidBoundaries(long seconds, int nanoseconds) + { + var value = new Timestamp { Seconds = seconds, Nanos = nanoseconds }; + value.ToDateTime(); + } + + private static void AssertRoundtrip(Timestamp timestamp, DateTime dateTime) + { + Assert.AreEqual(timestamp, Timestamp.FromDateTime(dateTime)); + Assert.AreEqual(dateTime, timestamp.ToDateTime()); + Assert.AreEqual(DateTimeKind.Utc, timestamp.ToDateTime().Kind); + } + + [Test] + public void Arithmetic() + { + Timestamp t1 = new Timestamp { Seconds = 10000, Nanos = 5000 }; + Timestamp t2 = new Timestamp { Seconds = 8000, Nanos = 10000 }; + Duration difference = new Duration { Seconds = 1999, Nanos = Duration.NanosecondsPerSecond - 5000 }; + Assert.AreEqual(difference, t1 - t2); + Assert.AreEqual(-difference, t2 - t1); + + Assert.AreEqual(t1, t2 + difference); + Assert.AreEqual(t2, t1 - difference); + } + + [Test] + public void ToString_NonNormalized() + { + // Just a single example should be sufficient... + var duration = new Timestamp { Seconds = 1, Nanos = -1 }; + Assert.AreEqual("{ \"@warning\": \"Invalid Timestamp\", \"seconds\": \"1\", \"nanos\": -1 }", duration.ToString()); + } + } +} diff -Nru protobuf-3.0.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/WellKnownTypes/WrappersTest.cs protobuf-3.6.1.3/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/WellKnownTypes/WrappersTest.cs --- protobuf-3.0.0/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/WellKnownTypes/WrappersTest.cs 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/WellKnownTypes/WrappersTest.cs 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,421 @@ +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2015 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using System; +using Google.Protobuf.TestProtos; +using NUnit.Framework; +using System.Collections; +using System.IO; + +namespace Google.Protobuf.WellKnownTypes +{ + public class WrappersTest + { + [Test] + public void NullIsDefault() + { + var message = new TestWellKnownTypes(); + Assert.IsNull(message.StringField); + Assert.IsNull(message.BytesField); + Assert.IsNull(message.BoolField); + Assert.IsNull(message.FloatField); + Assert.IsNull(message.DoubleField); + Assert.IsNull(message.Int32Field); + Assert.IsNull(message.Int64Field); + Assert.IsNull(message.Uint32Field); + Assert.IsNull(message.Uint64Field); + } + + [Test] + public void NonDefaultSingleValues() + { + var message = new TestWellKnownTypes + { + StringField = "x", + BytesField = ByteString.CopyFrom(1, 2, 3), + BoolField = true, + FloatField = 12.5f, + DoubleField = 12.25d, + Int32Field = 1, + Int64Field = 2, + Uint32Field = 3, + Uint64Field = 4 + }; + + var bytes = message.ToByteArray(); + var parsed = TestWellKnownTypes.Parser.ParseFrom(bytes); + + Assert.AreEqual("x", parsed.StringField); + Assert.AreEqual(ByteString.CopyFrom(1, 2, 3), parsed.BytesField); + Assert.AreEqual(true, parsed.BoolField); + Assert.AreEqual(12.5f, parsed.FloatField); + Assert.AreEqual(12.25d, parsed.DoubleField); + Assert.AreEqual(1, parsed.Int32Field); + Assert.AreEqual(2L, parsed.Int64Field); + Assert.AreEqual(3U, parsed.Uint32Field); + Assert.AreEqual(4UL, parsed.Uint64Field); + } + + [Test] + public void NonNullDefaultIsPreservedThroughSerialization() + { + var message = new TestWellKnownTypes + { + StringField = "", + BytesField = ByteString.Empty, + BoolField = false, + FloatField = 0f, + DoubleField = 0d, + Int32Field = 0, + Int64Field = 0, + Uint32Field = 0, + Uint64Field = 0 + }; + + var bytes = message.ToByteArray(); + var parsed = TestWellKnownTypes.Parser.ParseFrom(bytes); + + Assert.AreEqual("", parsed.StringField); + Assert.AreEqual(ByteString.Empty, parsed.BytesField); + Assert.AreEqual(false, parsed.BoolField); + Assert.AreEqual(0f, parsed.FloatField); + Assert.AreEqual(0d, parsed.DoubleField); + Assert.AreEqual(0, parsed.Int32Field); + Assert.AreEqual(0L, parsed.Int64Field); + Assert.AreEqual(0U, parsed.Uint32Field); + Assert.AreEqual(0UL, parsed.Uint64Field); + } + + [Test] + public void RepeatedWrappersProhibitNullItems() + { + var message = new RepeatedWellKnownTypes(); + Assert.Throws(() => message.BoolField.Add((bool?) null)); + Assert.Throws(() => message.Int32Field.Add((int?) null)); + Assert.Throws(() => message.StringField.Add((string) null)); + Assert.Throws(() => message.BytesField.Add((ByteString) null)); + } + + [Test] + public void RepeatedWrappersSerializeDeserialize() + { + var message = new RepeatedWellKnownTypes + { + BoolField = { true, false }, + BytesField = { ByteString.CopyFrom(1, 2, 3), ByteString.CopyFrom(4, 5, 6), ByteString.Empty }, + DoubleField = { 12.5, -1.5, 0d }, + FloatField = { 123.25f, -20f, 0f }, + Int32Field = { int.MaxValue, int.MinValue, 0 }, + Int64Field = { long.MaxValue, long.MinValue, 0L }, + StringField = { "First", "Second", "" }, + Uint32Field = { uint.MaxValue, uint.MinValue, 0U }, + Uint64Field = { ulong.MaxValue, ulong.MinValue, 0UL }, + }; + var bytes = message.ToByteArray(); + var parsed = RepeatedWellKnownTypes.Parser.ParseFrom(bytes); + + Assert.AreEqual(message, parsed); + // Just to test a single value for sanity... + Assert.AreEqual("Second", message.StringField[1]); + } + + [Test] + public void RepeatedWrappersBinaryFormat() + { + // At one point we accidentally used a packed format for repeated wrappers, which is wrong (and weird). + // This test is just to prove that we use the right format. + + var rawOutput = new MemoryStream(); + var output = new CodedOutputStream(rawOutput); + // Write a value of 5 + output.WriteTag(RepeatedWellKnownTypes.Int32FieldFieldNumber, WireFormat.WireType.LengthDelimited); + output.WriteLength(2); + output.WriteTag(WrappersReflection.WrapperValueFieldNumber, WireFormat.WireType.Varint); + output.WriteInt32(5); + // Write a value of 0 (empty message) + output.WriteTag(RepeatedWellKnownTypes.Int32FieldFieldNumber, WireFormat.WireType.LengthDelimited); + output.WriteLength(0); + output.Flush(); + var expectedBytes = rawOutput.ToArray(); + + var message = new RepeatedWellKnownTypes { Int32Field = { 5, 0 } }; + var actualBytes = message.ToByteArray(); + Assert.AreEqual(expectedBytes, actualBytes); + } + + [Test] + public void MapWrappersSerializeDeserialize() + { + // Note: no null values here, as they are prohibited in map fields + // (despite being representable). + var message = new MapWellKnownTypes + { + BoolField = { { 10, false }, { 20, true } }, + BytesField = { + { -1, ByteString.CopyFrom(1, 2, 3) }, + { 10, ByteString.CopyFrom(4, 5, 6) }, + { 1000, ByteString.Empty }, + }, + DoubleField = { { 1, 12.5 }, { 10, -1.5 }, { 20, 0d } }, + FloatField = { { 2, 123.25f }, { 3, -20f }, { 4, 0f } }, + Int32Field = { { 5, int.MaxValue }, { 6, int.MinValue }, { 7, 0 } }, + Int64Field = { { 8, long.MaxValue }, { 9, long.MinValue }, { 10, 0L } }, + StringField = { { 11, "First" }, { 12, "Second" }, { 13, "" } }, + Uint32Field = { { 15, uint.MaxValue }, { 16, uint.MinValue }, { 17, 0U } }, + Uint64Field = { { 18, ulong.MaxValue }, { 19, ulong.MinValue }, { 20, 0UL } }, + }; + + var bytes = message.ToByteArray(); + var parsed = MapWellKnownTypes.Parser.ParseFrom(bytes); + + Assert.AreEqual(message, parsed); + // Just to test a single value for sanity... + Assert.AreEqual("Second", message.StringField[12]); + } + + [Test] + public void Reflection_SingleValues() + { + var message = new TestWellKnownTypes + { + StringField = "x", + BytesField = ByteString.CopyFrom(1, 2, 3), + BoolField = true, + FloatField = 12.5f, + DoubleField = 12.25d, + Int32Field = 1, + Int64Field = 2, + Uint32Field = 3, + Uint64Field = 4 + }; + var fields = TestWellKnownTypes.Descriptor.Fields; + + Assert.AreEqual("x", fields[TestWellKnownTypes.StringFieldFieldNumber].Accessor.GetValue(message)); + Assert.AreEqual(ByteString.CopyFrom(1, 2, 3), fields[TestWellKnownTypes.BytesFieldFieldNumber].Accessor.GetValue(message)); + Assert.AreEqual(true, fields[TestWellKnownTypes.BoolFieldFieldNumber].Accessor.GetValue(message)); + Assert.AreEqual(12.5f, fields[TestWellKnownTypes.FloatFieldFieldNumber].Accessor.GetValue(message)); + Assert.AreEqual(12.25d, fields[TestWellKnownTypes.DoubleFieldFieldNumber].Accessor.GetValue(message)); + Assert.AreEqual(1, fields[TestWellKnownTypes.Int32FieldFieldNumber].Accessor.GetValue(message)); + Assert.AreEqual(2L, fields[TestWellKnownTypes.Int64FieldFieldNumber].Accessor.GetValue(message)); + Assert.AreEqual(3U, fields[TestWellKnownTypes.Uint32FieldFieldNumber].Accessor.GetValue(message)); + Assert.AreEqual(4UL, fields[TestWellKnownTypes.Uint64FieldFieldNumber].Accessor.GetValue(message)); + + // And a couple of null fields... + message.StringField = null; + message.FloatField = null; + Assert.IsNull(fields[TestWellKnownTypes.StringFieldFieldNumber].Accessor.GetValue(message)); + Assert.IsNull(fields[TestWellKnownTypes.FloatFieldFieldNumber].Accessor.GetValue(message)); + } + + [Test] + public void Reflection_RepeatedFields() + { + // Just a single example... note that we can't have a null value here + var message = new RepeatedWellKnownTypes { Int32Field = { 1, 2 } }; + var fields = RepeatedWellKnownTypes.Descriptor.Fields; + var list = (IList) fields[RepeatedWellKnownTypes.Int32FieldFieldNumber].Accessor.GetValue(message); + CollectionAssert.AreEqual(new[] { 1, 2 }, list); + } + + [Test] + public void Reflection_MapFields() + { + // Just a single example... note that we can't have a null value here despite the value type being int? + var message = new MapWellKnownTypes { Int32Field = { { 1, 2 } } }; + var fields = MapWellKnownTypes.Descriptor.Fields; + var dictionary = (IDictionary) fields[MapWellKnownTypes.Int32FieldFieldNumber].Accessor.GetValue(message); + Assert.AreEqual(2, dictionary[1]); + } + + [Test] + public void Oneof() + { + var message = new OneofWellKnownTypes { EmptyField = new Empty() }; + // Start off with a non-wrapper + Assert.AreEqual(OneofWellKnownTypes.OneofFieldOneofCase.EmptyField, message.OneofFieldCase); + AssertOneofRoundTrip(message); + + message.StringField = "foo"; + Assert.AreEqual(OneofWellKnownTypes.OneofFieldOneofCase.StringField, message.OneofFieldCase); + AssertOneofRoundTrip(message); + + message.StringField = "foo"; + Assert.AreEqual(OneofWellKnownTypes.OneofFieldOneofCase.StringField, message.OneofFieldCase); + AssertOneofRoundTrip(message); + + message.DoubleField = 0.0f; + Assert.AreEqual(OneofWellKnownTypes.OneofFieldOneofCase.DoubleField, message.OneofFieldCase); + AssertOneofRoundTrip(message); + + message.DoubleField = 1.0f; + Assert.AreEqual(OneofWellKnownTypes.OneofFieldOneofCase.DoubleField, message.OneofFieldCase); + AssertOneofRoundTrip(message); + + message.ClearOneofField(); + Assert.AreEqual(OneofWellKnownTypes.OneofFieldOneofCase.None, message.OneofFieldCase); + AssertOneofRoundTrip(message); + } + + private void AssertOneofRoundTrip(OneofWellKnownTypes message) + { + // Normal roundtrip, but explicitly checking the case... + var bytes = message.ToByteArray(); + var parsed = OneofWellKnownTypes.Parser.ParseFrom(bytes); + Assert.AreEqual(message, parsed); + Assert.AreEqual(message.OneofFieldCase, parsed.OneofFieldCase); + } + + [Test] + [TestCase("x", "y", "y")] + [TestCase("x", "", "x")] + [TestCase("x", null, "x")] + [TestCase("", "y", "y")] + [TestCase("", "", "")] + [TestCase("", null, "")] + [TestCase(null, "y", "y")] + [TestCase(null, "", "")] + [TestCase(null, null, null)] + public void Merging(string original, string merged, string expected) + { + var originalMessage = new TestWellKnownTypes { StringField = original }; + var mergingMessage = new TestWellKnownTypes { StringField = merged }; + originalMessage.MergeFrom(mergingMessage); + Assert.AreEqual(expected, originalMessage.StringField); + + // Try it using MergeFrom(CodedInputStream) too... + originalMessage = new TestWellKnownTypes { StringField = original }; + originalMessage.MergeFrom(mergingMessage.ToByteArray()); + Assert.AreEqual(expected, originalMessage.StringField); + } + + // Merging is odd with wrapper types, due to the way that default values aren't emitted in + // the binary stream. In fact we cheat a little bit - a message with an explicitly present default + // value will have that default value ignored. See issue 615. Fixing this would require significant upheaval to + // the FieldCodec side of things. + [Test] + public void MergingStreamExplicitValue() + { + var message = new TestWellKnownTypes { Int32Field = 5 }; + + // Create a byte array which has the data of an Int32Value explicitly containing a value of 0. + // This wouldn't normally happen. + byte[] bytes; + var wrapperTag = WireFormat.MakeTag(TestWellKnownTypes.Int32FieldFieldNumber, WireFormat.WireType.LengthDelimited); + var valueTag = WireFormat.MakeTag(Int32Value.ValueFieldNumber, WireFormat.WireType.Varint); + using (var stream = new MemoryStream()) + { + var coded = new CodedOutputStream(stream); + coded.WriteTag(wrapperTag); + coded.WriteLength(2); // valueTag + a value 0, each one byte + coded.WriteTag(valueTag); + coded.WriteInt32(0); + coded.Flush(); + bytes = stream.ToArray(); + } + + message.MergeFrom(bytes); + // A normal implementation would have 0 now, as the explicit default would have been overwritten the 5. + // With the FieldCodec for Nullable, we can't tell the difference between an implicit 0 and an explicit 0. + Assert.AreEqual(5, message.Int32Field); + } + + [Test] + public void MergingStreamNoValue() + { + var message = new TestWellKnownTypes { Int32Field = 5 }; + + // Create a byte array which an Int32 field, but with no value. + var bytes = new TestWellKnownTypes { Int32Field = 0 }.ToByteArray(); + Assert.AreEqual(2, bytes.Length); // The tag for Int32Field is a single byte, then a byte indicating a 0-length message. + message.MergeFrom(bytes); + + // The "implicit" 0 did *not* overwrite the value. + // (This is the correct behaviour.) + Assert.AreEqual(5, message.Int32Field); + } + + // All permutations of origin/merging value being null, zero (default) or non-default. + // As this is the in-memory version, we don't need to worry about the difference between implicit and explicit 0. + [Test] + [TestCase(null, null, null)] + [TestCase(null, 0, 0)] + [TestCase(null, 5, 5)] + [TestCase(0, null, 0)] + [TestCase(0, 0, 0)] + [TestCase(0, 5, 5)] + [TestCase(5, null, 5)] + [TestCase(5, 0, 5)] + [TestCase(5, 10, 10)] + public void MergingMessageWithZero(int? originValue, int? mergingValue, int? expectedResult) + { + // This differs from the MergingStreamCornerCase because when we merge message *objects*, + // we ignore default values from the "source". + var message1 = new TestWellKnownTypes { Int32Field = originValue }; + var message2 = new TestWellKnownTypes { Int32Field = mergingValue }; + message1.MergeFrom(message2); + Assert.AreEqual(expectedResult, message1.Int32Field); + } + + [Test] + public void UnknownFieldInWrapper() + { + var stream = new MemoryStream(); + var output = new CodedOutputStream(stream); + var wrapperTag = WireFormat.MakeTag(TestWellKnownTypes.Int32FieldFieldNumber, WireFormat.WireType.LengthDelimited); + var unknownTag = WireFormat.MakeTag(15, WireFormat.WireType.Varint); + var valueTag = WireFormat.MakeTag(Int32Value.ValueFieldNumber, WireFormat.WireType.Varint); + + output.WriteTag(wrapperTag); + output.WriteLength(4); // unknownTag + value 5 + valueType + value 6, each 1 byte + output.WriteTag(unknownTag); + output.WriteInt32((int) valueTag); // Sneakily "pretend" it's a tag when it's really a value + output.WriteTag(valueTag); + output.WriteInt32(6); + + output.Flush(); + stream.Position = 0; + + var message = TestWellKnownTypes.Parser.ParseFrom(stream); + Assert.AreEqual(6, message.Int32Field); + } + + [Test] + public void ClearWithReflection() + { + // String and Bytes are the tricky ones here, as the CLR type of the property + // is the same between the wrapper and non-wrapper types. + var message = new TestWellKnownTypes { StringField = "foo" }; + TestWellKnownTypes.Descriptor.Fields[TestWellKnownTypes.StringFieldFieldNumber].Accessor.Clear(message); + Assert.IsNull(message.StringField); + } + } +} diff -Nru protobuf-3.0.0/csharp/compatibility_tests/v3.0.0/test.sh protobuf-3.6.1.3/csharp/compatibility_tests/v3.0.0/test.sh --- protobuf-3.0.0/csharp/compatibility_tests/v3.0.0/test.sh 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/csharp/compatibility_tests/v3.0.0/test.sh 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,104 @@ +#!/bin/bash + +function run_test() { + # Generate test proto files. + ./protoc_1 -Iprotos/src -I../../../src/ --csharp_out=src/Google.Protobuf.Test \ + --csharp_opt=base_namespace=Google.Protobuf \ + protos/src/google/protobuf/unittest_import_proto3.proto \ + protos/src/google/protobuf/unittest_import_public_proto3.proto \ + protos/src/google/protobuf/unittest_well_known_types.proto + + ./protoc_1 -Iprotos/csharp --csharp_out=src/Google.Protobuf.Test \ + --csharp_opt=base_namespace=UnitTest.Issues \ + protos/csharp/protos/unittest_issues.proto + + ./protoc_2 -Iprotos/src --csharp_out=src/Google.Protobuf.Test \ + --csharp_opt=base_namespace=Google.Protobuf \ + protos/src/google/protobuf/unittest_proto3.proto \ + protos/src/google/protobuf/map_unittest_proto3.proto + + # Build and test. + dotnet restore src/Google.Protobuf/Google.Protobuf.csproj + dotnet restore src/Google.Protobuf.Test/Google.Protobuf.Test.csproj + dotnet build -c Release src/Google.Protobuf/Google.Protobuf.csproj + dotnet build -c Release src/Google.Protobuf.Test/Google.Protobuf.Test.csproj + dotnet run -c Release -f netcoreapp1.0 -p src/Google.Protobuf.Test/Google.Protobuf.Test.csproj +} + +set -ex + +# Change to the script's directory. +cd $(dirname $0) + +# Version of the tests (i.e., the version of protobuf from where we extracted +# these tests). +TEST_VERSION=3.0.0 + +# The old version of protobuf that we are testing compatibility against. This +# is usually the same as TEST_VERSION (i.e., we use the tests extracted from +# that version to test compatibility of the newest runtime against it), but it +# is also possible to use this same test set to test the compatibiilty of the +# latest version against other versions. +case "$1" in + ""|3.0.0) + OLD_VERSION=3.0.0 + OLD_VERSION_PROTOC=http://repo1.maven.org/maven2/com/google/protobuf/protoc/3.0.0/protoc-3.0.0-linux-x86_64.exe + ;; + 3.0.2) + OLD_VERSION=3.0.2 + OLD_VERSION_PROTOC=http://repo1.maven.org/maven2/com/google/protobuf/protoc/3.0.2/protoc-3.0.2-linux-x86_64.exe + ;; + 3.1.0) + OLD_VERSION=3.1.0 + OLD_VERSION_PROTOC=http://repo1.maven.org/maven2/com/google/protobuf/protoc/3.1.0/protoc-3.1.0-linux-x86_64.exe + ;; + *) + echo "[ERROR]: Unknown version number: $1" + exit 1 + ;; +esac + +echo "Running compatibility tests with $OLD_VERSION" + +# Check protoc +[ -f ../../../src/protoc ] || { + echo "[ERROR]: Please build protoc first." + exit 1 +} + +# Download old version protoc compiler (for linux). +wget $OLD_VERSION_PROTOC -O old_protoc +chmod +x old_protoc + +# Test source compatibility. In these tests we recompile everything against +# the new runtime (including old version generated code). +# Copy the new runtime and keys. +cp ../../src/Google.Protobuf src/Google.Protobuf -r +cp ../../keys . -r + +# Test A.1: +# proto set 1: use old version +# proto set 2 which may import protos in set 1: use old version +cp old_protoc protoc_1 +cp old_protoc protoc_2 +run_test + +# Test A.2: +# proto set 1: use new version +# proto set 2 which may import protos in set 1: use old version +cp ../../../src/protoc protoc_1 +cp old_protoc protoc_2 +run_test + +# Test A.3: +# proto set 1: use old version +# proto set 2 which may import protos in set 1: use new version +cp old_protoc protoc_1 +cp ../../../src/protoc protoc_2 +run_test + +rm protoc_1 +rm protoc_2 +rm old_protoc +rm keys -r +rm src/Google.Protobuf -r diff -Nru protobuf-3.0.0/csharp/generate_protos.sh protobuf-3.6.1.3/csharp/generate_protos.sh --- protobuf-3.0.0/csharp/generate_protos.sh 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/csharp/generate_protos.sh 2018-12-08 01:32:11.000000000 +0000 @@ -3,7 +3,7 @@ # You first need to make sure protoc has been built (see instructions on # building protoc in root of this repository) -set -ex +set -e # cd to repository root pushd $(dirname $0)/.. @@ -40,22 +40,20 @@ src/google/protobuf/type.proto \ src/google/protobuf/wrappers.proto -# Test protos where the namespace matches the target location -$PROTOC -Isrc --csharp_out=csharp/src/Google.Protobuf.Test \ - --csharp_opt=base_namespace=Google.Protobuf \ - src/google/protobuf/map_unittest_proto3.proto \ - src/google/protobuf/unittest_proto3.proto \ - src/google/protobuf/unittest_import_proto3.proto \ - src/google/protobuf/unittest_import_public_proto3.proto \ - src/google/protobuf/unittest_well_known_types.proto - -# Different base namespace to the protos above -$PROTOC -Icsharp/protos --csharp_out=csharp/src/Google.Protobuf.Test \ - --csharp_opt=base_namespace=UnitTest.Issues \ - csharp/protos/unittest_issues.proto +# Test protos +$PROTOC -Isrc -Icsharp/protos \ + --csharp_out=csharp/src/Google.Protobuf.Test/TestProtos \ + csharp/protos/map_unittest_proto3.proto \ + csharp/protos/unittest_issues.proto \ + csharp/protos/unittest_custom_options_proto3.proto \ + csharp/protos/unittest_proto3.proto \ + csharp/protos/unittest_import_proto3.proto \ + csharp/protos/unittest_import_public_proto3.proto \ + src/google/protobuf/unittest_well_known_types.proto \ + src/google/protobuf/test_messages_proto3.proto # AddressBook sample protos -$PROTOC -Iexamples --csharp_out=csharp/src/AddressBook \ +$PROTOC -Iexamples -Isrc --csharp_out=csharp/src/AddressBook \ examples/addressbook.proto $PROTOC -Iconformance -Isrc --csharp_out=csharp/src/Google.Protobuf.Conformance \ diff -Nru protobuf-3.0.0/csharp/global.json protobuf-3.6.1.3/csharp/global.json --- protobuf-3.0.0/csharp/global.json 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/csharp/global.json 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,5 @@ +{ + "sdk": { + "version": "2.1.3" + } +} diff -Nru protobuf-3.0.0/csharp/Google.Protobuf.Tools.nuspec protobuf-3.6.1.3/csharp/Google.Protobuf.Tools.nuspec --- protobuf-3.0.0/csharp/Google.Protobuf.Tools.nuspec 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/csharp/Google.Protobuf.Tools.nuspec 2018-12-08 01:32:11.000000000 +0000 @@ -5,7 +5,7 @@ Google Protocol Buffers tools Tools for Protocol Buffers - Google's data interchange format. See project site for more info. - 3.0.0 + 3.6.1 Google Inc. protobuf-packages https://github.com/google/protobuf/blob/master/LICENSE diff -Nru protobuf-3.0.0/csharp/protos/map_unittest_proto3.proto protobuf-3.6.1.3/csharp/protos/map_unittest_proto3.proto --- protobuf-3.0.0/csharp/protos/map_unittest_proto3.proto 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/csharp/protos/map_unittest_proto3.proto 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,116 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// This file is mostly equivalent to map_unittest.proto, but imports +// unittest_proto3.proto instead of unittest.proto, so that it only +// uses proto3 messages. This makes it suitable for testing +// implementations which only support proto3. +// The TestRequiredMessageMap message has been removed as there are no +// required fields in proto3. +syntax = "proto3"; + +option csharp_namespace = "Google.Protobuf.TestProtos"; + +import "unittest_proto3.proto"; + +package protobuf_unittest3; + +// Tests maps. +message TestMap { + map map_int32_int32 = 1; + map map_int64_int64 = 2; + map map_uint32_uint32 = 3; + map map_uint64_uint64 = 4; + map map_sint32_sint32 = 5; + map map_sint64_sint64 = 6; + map map_fixed32_fixed32 = 7; + map map_fixed64_fixed64 = 8; + map map_sfixed32_sfixed32 = 9; + map map_sfixed64_sfixed64 = 10; + map map_int32_float = 11; + map map_int32_double = 12; + map map_bool_bool = 13; + map map_string_string = 14; + map map_int32_bytes = 15; + map map_int32_enum = 16; + map map_int32_foreign_message = 17; +} + +message TestMapSubmessage { + TestMap test_map = 1; +} + +message TestMessageMap { + map map_int32_message = 1; +} + +// Two map fields share the same entry default instance. +message TestSameTypeMap { + map map1 = 1; + map map2 = 2; +} + +enum MapEnum { + MAP_ENUM_FOO = 0; + MAP_ENUM_BAR = 1; + MAP_ENUM_BAZ = 2; +} + +message TestArenaMap { + map map_int32_int32 = 1; + map map_int64_int64 = 2; + map map_uint32_uint32 = 3; + map map_uint64_uint64 = 4; + map map_sint32_sint32 = 5; + map map_sint64_sint64 = 6; + map map_fixed32_fixed32 = 7; + map map_fixed64_fixed64 = 8; + map map_sfixed32_sfixed32 = 9; + map map_sfixed64_sfixed64 = 10; + map map_int32_float = 11; + map map_int32_double = 12; + map map_bool_bool = 13; + map map_int32_enum = 14; + map map_int32_foreign_message = 15; +} + +// Previously, message containing enum called Type cannot be used as value of +// map field. +message MessageContainingEnumCalledType { + enum Type { + TYPE_FOO = 0; + } + map type = 1; +} + +// Previously, message cannot contain map field called "entry". +message MessageContainingMapCalledEntry { + map entry = 1; +} diff -Nru protobuf-3.0.0/csharp/protos/README.md protobuf-3.6.1.3/csharp/protos/README.md --- protobuf-3.0.0/csharp/protos/README.md 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/csharp/protos/README.md 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,3 @@ +This directory contains unit test protos adapted from those in +src/google/protobuf, and C#-specific test protos for regression +tests against bugs found in the C# codegen or library. diff -Nru protobuf-3.0.0/csharp/protos/unittest_custom_options_proto3.proto protobuf-3.6.1.3/csharp/protos/unittest_custom_options_proto3.proto --- protobuf-3.0.0/csharp/protos/unittest_custom_options_proto3.proto 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/csharp/protos/unittest_custom_options_proto3.proto 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,336 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Author: benjy@google.com (Benjy Weinberger) +// Based on original Protocol Buffers design by +// Sanjay Ghemawat, Jeff Dean, and others. +// +// A proto file used to test the "custom options" feature of google.protobuf. + +// This file is based on unittest_custom_options.proto in +// src/google/protobuf, but is modified for proto3. It could +// potentially be moved into src/google/protobuf, but currently C# +// is the only language that really needs it, as we don't support +// proto2 syntax. It's cut down significantly as proto3 only supports +// extensions for options. + + +syntax = "proto3"; + +// A custom file option (defined below). +option (file_opt1) = 9876543210; + +import "google/protobuf/descriptor.proto"; + +// We don't put this in a package within proto2 because we need to make sure +// that the generated code doesn't depend on being in the proto2 namespace. +package protobuf_unittest; +option csharp_namespace = "UnitTest.Issues.TestProtos"; + +// Some simple test custom options of various types. + +extend google.protobuf.FileOptions { + uint64 file_opt1 = 7736974; +} + +extend google.protobuf.MessageOptions { + int32 message_opt1 = 7739036; +} + +extend google.protobuf.FieldOptions { + fixed64 field_opt1 = 7740936; +} + +extend google.protobuf.OneofOptions { + int32 oneof_opt1 = 7740111; +} + +extend google.protobuf.EnumOptions { + sfixed32 enum_opt1 = 7753576; +} + +extend google.protobuf.EnumValueOptions { + int32 enum_value_opt1 = 1560678; +} + +extend google.protobuf.ServiceOptions { + sint64 service_opt1 = 7887650; +} + +enum MethodOpt1 { + METHODOPT1_UNSPECIFIED = 0; + METHODOPT1_VAL1 = 1; + METHODOPT1_VAL2 = 2; +} + +extend google.protobuf.MethodOptions { + MethodOpt1 method_opt1 = 7890860; +} + +// A test message with custom options at all possible locations (and also some +// regular options, to make sure they interact nicely). +message TestMessageWithCustomOptions { + option message_set_wire_format = false; + + option (message_opt1) = -56; + + string field1 = 1 [ctype=CORD, + (field_opt1)=8765432109]; + + oneof AnOneof { + option (oneof_opt1) = -99; + int32 oneof_field = 2; + } + + enum AnEnum { + option (enum_opt1) = -789; + ANENUM_UNSPECIFIED = 0; + ANENUM_VAL1 = 1; + ANENUM_VAL2 = 2 [(enum_value_opt1) = 123]; + } +} + + +// A test RPC service with custom options at all possible locations (and also +// some regular options, to make sure they interact nicely). +message CustomOptionFooRequest { +} + +message CustomOptionFooResponse { +} + +message CustomOptionFooClientMessage { +} + +message CustomOptionFooServerMessage { +} + +service TestServiceWithCustomOptions { + option (service_opt1) = -9876543210; + + rpc Foo(CustomOptionFooRequest) returns (CustomOptionFooResponse) { + option (method_opt1) = METHODOPT1_VAL2; + } +} + + + +// Options of every possible field type, so we can test them all exhaustively. + +message DummyMessageContainingEnum { + enum TestEnumType { + TEST_OPTION_ENUM_UNSPECIFIED = 0; + TEST_OPTION_ENUM_TYPE1 = 22; + TEST_OPTION_ENUM_TYPE2 = -23; + } +} + +message DummyMessageInvalidAsOptionType { +} + +extend google.protobuf.MessageOptions { + bool bool_opt = 7706090; + int32 int32_opt = 7705709; + int64 int64_opt = 7705542; + uint32 uint32_opt = 7704880; + uint64 uint64_opt = 7702367; + sint32 sint32_opt = 7701568; + sint64 sint64_opt = 7700863; + fixed32 fixed32_opt = 7700307; + fixed64 fixed64_opt = 7700194; + sfixed32 sfixed32_opt = 7698645; + sfixed64 sfixed64_opt = 7685475; + float float_opt = 7675390; + double double_opt = 7673293; + string string_opt = 7673285; + bytes bytes_opt = 7673238; + DummyMessageContainingEnum.TestEnumType enum_opt = 7673233; + DummyMessageInvalidAsOptionType message_type_opt = 7665967; +} + +message CustomOptionMinIntegerValues { + option (bool_opt) = false; + option (int32_opt) = -0x80000000; + option (int64_opt) = -0x8000000000000000; + option (uint32_opt) = 0; + option (uint64_opt) = 0; + option (sint32_opt) = -0x80000000; + option (sint64_opt) = -0x8000000000000000; + option (fixed32_opt) = 0; + option (fixed64_opt) = 0; + option (sfixed32_opt) = -0x80000000; + option (sfixed64_opt) = -0x8000000000000000; +} + +message CustomOptionMaxIntegerValues { + option (bool_opt) = true; + option (int32_opt) = 0x7FFFFFFF; + option (int64_opt) = 0x7FFFFFFFFFFFFFFF; + option (uint32_opt) = 0xFFFFFFFF; + option (uint64_opt) = 0xFFFFFFFFFFFFFFFF; + option (sint32_opt) = 0x7FFFFFFF; + option (sint64_opt) = 0x7FFFFFFFFFFFFFFF; + option (fixed32_opt) = 0xFFFFFFFF; + option (fixed64_opt) = 0xFFFFFFFFFFFFFFFF; + option (sfixed32_opt) = 0x7FFFFFFF; + option (sfixed64_opt) = 0x7FFFFFFFFFFFFFFF; +} + +message CustomOptionOtherValues { + option (int32_opt) = -100; // To test sign-extension. + option (float_opt) = 12.3456789; + option (double_opt) = 1.234567890123456789; + option (string_opt) = "Hello, \"World\""; + option (bytes_opt) = "Hello\0World"; + option (enum_opt) = TEST_OPTION_ENUM_TYPE2; +} + +message SettingRealsFromPositiveInts { + option (float_opt) = 12; + option (double_opt) = 154; +} + +message SettingRealsFromNegativeInts { + option (float_opt) = -12; + option (double_opt) = -154; +} + +// Options of complex message types, themselves combined and extended in +// various ways. + +message ComplexOptionType1 { + int32 foo = 1; + int32 foo2 = 2; + int32 foo3 = 3; + repeated int32 foo4 = 4; +} + +message ComplexOptionType2 { + ComplexOptionType1 bar = 1; + int32 baz = 2; + + message ComplexOptionType4 { + int32 waldo = 1; + + extend google.protobuf.MessageOptions { + ComplexOptionType4 complex_opt4 = 7633546; + } + } + + ComplexOptionType4 fred = 3; + repeated ComplexOptionType4 barney = 4; +} + +message ComplexOptionType3 { + int32 qux = 1; +} + +extend google.protobuf.MessageOptions { + protobuf_unittest.ComplexOptionType1 complex_opt1 = 7646756; + ComplexOptionType2 complex_opt2 = 7636949; + ComplexOptionType3 complex_opt3 = 7636463; +} + +// Note that we try various different ways of naming the same extension. +message VariousComplexOptions { + option (.protobuf_unittest.complex_opt1).foo = 42; + option (protobuf_unittest.complex_opt1).foo4 = 99; + option (protobuf_unittest.complex_opt1).foo4 = 88; + option (complex_opt2).baz = 987; + option (complex_opt2).bar.foo = 743; + option (ComplexOptionType2.ComplexOptionType4.complex_opt4).waldo = 1971; + option (complex_opt2).fred.waldo = 321; + option (complex_opt2).barney = { waldo: 101 }; + option (complex_opt2).barney = { waldo: 212 }; + option (protobuf_unittest.complex_opt3).qux = 9; +} + +// ------------------------------------------------------ +// Definitions for testing aggregate option parsing. +// See descriptor_unittest.cc. + +// A helper type used to test aggregate option parsing +message Aggregate { + int32 i = 1; + string s = 2; + + // A nested object + Aggregate sub = 3; +} + +// Allow Aggregate to be used as an option at all possible locations +// in the .proto grammer. +extend google.protobuf.FileOptions { Aggregate fileopt = 15478479; } +extend google.protobuf.MessageOptions { Aggregate msgopt = 15480088; } +extend google.protobuf.FieldOptions { Aggregate fieldopt = 15481374; } +extend google.protobuf.EnumOptions { Aggregate enumopt = 15483218; } +extend google.protobuf.EnumValueOptions { Aggregate enumvalopt = 15486921; } +extend google.protobuf.ServiceOptions { Aggregate serviceopt = 15497145; } +extend google.protobuf.MethodOptions { Aggregate methodopt = 15512713; } + +// Try using AggregateOption at different points in the proto grammar +option (fileopt) = { + s: 'FileAnnotation' + // Also test the handling of comments + /* of both types */ i: 100 + + sub { s: 'NestedFileAnnotation' } +}; + +message AggregateMessage { + option (msgopt) = { i:101 s:'MessageAnnotation' }; + int32 fieldname = 1 [(fieldopt) = { s:'FieldAnnotation' }]; +} + +service AggregateService { + option (serviceopt) = { s:'ServiceAnnotation' }; + rpc Method (AggregateMessage) returns (AggregateMessage) { + option (methodopt) = { s:'MethodAnnotation' }; + } +} + +enum AggregateEnum { + option (enumopt) = { s:'EnumAnnotation' }; + UNSPECIFIED = 0; + VALUE = 1 [(enumvalopt) = { s:'EnumValueAnnotation' }]; +} + +// Test custom options for nested type. +message NestedOptionType { + message NestedMessage { + option (message_opt1) = 1001; + int32 nested_field = 1 [(field_opt1) = 1002]; + } + enum NestedEnum { + UNSPECIFIED = 0; + option (enum_opt1) = 1003; + NESTED_ENUM_VALUE = 1 [(enum_value_opt1) = 1004]; + } +} diff -Nru protobuf-3.0.0/csharp/protos/unittest_import_proto3.proto protobuf-3.6.1.3/csharp/protos/unittest_import_proto3.proto --- protobuf-3.0.0/csharp/protos/unittest_import_proto3.proto 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/csharp/protos/unittest_import_proto3.proto 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,56 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Author: kenton@google.com (Kenton Varda) +// Based on original Protocol Buffers design by +// Sanjay Ghemawat, Jeff Dean, and others. +// +// A proto file which is imported by unittest_proto3.proto to test importing. + +syntax = "proto3"; + +package protobuf_unittest_import; + +option csharp_namespace = "Google.Protobuf.TestProtos"; + +// Test public import +import public "unittest_import_public_proto3.proto"; + +message ImportMessage { + int32 d = 1; +} + +enum ImportEnum { + IMPORT_ENUM_UNSPECIFIED = 0; + IMPORT_FOO = 7; + IMPORT_BAR = 8; + IMPORT_BAZ = 9; +} + diff -Nru protobuf-3.0.0/csharp/protos/unittest_import_public_proto3.proto protobuf-3.6.1.3/csharp/protos/unittest_import_public_proto3.proto --- protobuf-3.0.0/csharp/protos/unittest_import_public_proto3.proto 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/csharp/protos/unittest_import_public_proto3.proto 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,41 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Author: liujisi@google.com (Pherl Liu) + +syntax = "proto3"; + +package protobuf_unittest_import; + +option csharp_namespace = "Google.Protobuf.TestProtos"; + +message PublicImportMessage { + int32 e = 1; +} diff -Nru protobuf-3.0.0/csharp/protos/unittest_issues.proto protobuf-3.6.1.3/csharp/protos/unittest_issues.proto --- protobuf-3.0.0/csharp/protos/unittest_issues.proto 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/csharp/protos/unittest_issues.proto 2018-12-08 01:32:11.000000000 +0000 @@ -7,7 +7,6 @@ option csharp_namespace = "UnitTest.Issues.TestProtos"; package unittest_issues; -option optimize_for = SPEED; // Issue 307: when generating doubly-nested types, any references // should be of the form A.Types.B.Types.C. @@ -124,3 +123,18 @@ string description = 2 [json_name = "desc"]; string guid = 3 [json_name = "exid"]; } + +// Issue 3200: When merging two messages which use the same +// oneof case, which is itself a message type, the submessages should +// be merged. +message OneofMerging { + message Nested { + int32 x = 1; + int32 y = 2; + } + + oneof value { + string text = 1; + Nested nested = 2; + } +} \ No newline at end of file diff -Nru protobuf-3.0.0/csharp/protos/unittest_proto3.proto protobuf-3.6.1.3/csharp/protos/unittest_proto3.proto --- protobuf-3.0.0/csharp/protos/unittest_proto3.proto 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/csharp/protos/unittest_proto3.proto 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,380 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Author: kenton@google.com (Kenton Varda) +// Based on original Protocol Buffers design by +// Sanjay Ghemawat, Jeff Dean, and others. +// +// A proto file we will use for unit testing. + +syntax = "proto3"; + +option csharp_namespace = "Google.Protobuf.TestProtos"; + +// Only present so we can test that we can read it (as an example +// of a non-C# option) +option java_outer_classname = "UnittestProto"; + +import "unittest_import_proto3.proto"; + +package protobuf_unittest3; + +// This proto includes every type of field in both singular and repeated +// forms. +message TestAllTypes { + message NestedMessage { + // The field name "b" fails to compile in proto1 because it conflicts with + // a local variable named "b" in one of the generated methods. Doh. + // This file needs to compile in proto1 to test backwards-compatibility. + int32 bb = 1; + } + + enum NestedEnum { + NESTED_ENUM_UNSPECIFIED = 0; + FOO = 1; + BAR = 2; + BAZ = 3; + NEG = -1; // Intentionally negative. + } + + // Singular + int32 single_int32 = 1; + int64 single_int64 = 2; + uint32 single_uint32 = 3; + uint64 single_uint64 = 4; + sint32 single_sint32 = 5; + sint64 single_sint64 = 6; + fixed32 single_fixed32 = 7; + fixed64 single_fixed64 = 8; + sfixed32 single_sfixed32 = 9; + sfixed64 single_sfixed64 = 10; + float single_float = 11; + double single_double = 12; + bool single_bool = 13; + string single_string = 14; + bytes single_bytes = 15; + + NestedMessage single_nested_message = 18; + ForeignMessage single_foreign_message = 19; + protobuf_unittest_import.ImportMessage single_import_message = 20; + + NestedEnum single_nested_enum = 21; + ForeignEnum single_foreign_enum = 22; + protobuf_unittest_import.ImportEnum single_import_enum = 23; + + // Defined in unittest_import_public.proto + protobuf_unittest_import.PublicImportMessage + single_public_import_message = 26; + + // Repeated + repeated int32 repeated_int32 = 31; + repeated int64 repeated_int64 = 32; + repeated uint32 repeated_uint32 = 33; + repeated uint64 repeated_uint64 = 34; + repeated sint32 repeated_sint32 = 35; + repeated sint64 repeated_sint64 = 36; + repeated fixed32 repeated_fixed32 = 37; + repeated fixed64 repeated_fixed64 = 38; + repeated sfixed32 repeated_sfixed32 = 39; + repeated sfixed64 repeated_sfixed64 = 40; + repeated float repeated_float = 41; + repeated double repeated_double = 42; + repeated bool repeated_bool = 43; + repeated string repeated_string = 44; + repeated bytes repeated_bytes = 45; + + repeated NestedMessage repeated_nested_message = 48; + repeated ForeignMessage repeated_foreign_message = 49; + repeated protobuf_unittest_import.ImportMessage repeated_import_message = 50; + + repeated NestedEnum repeated_nested_enum = 51; + repeated ForeignEnum repeated_foreign_enum = 52; + repeated protobuf_unittest_import.ImportEnum repeated_import_enum = 53; + // Defined in unittest_import_public.proto + repeated protobuf_unittest_import.PublicImportMessage + repeated_public_import_message = 54; + + // For oneof test + oneof oneof_field { + uint32 oneof_uint32 = 111; + NestedMessage oneof_nested_message = 112; + string oneof_string = 113; + bytes oneof_bytes = 114; + } +} + +// This proto includes a recusively nested message. +message NestedTestAllTypes { + NestedTestAllTypes child = 1; + TestAllTypes payload = 2; + repeated NestedTestAllTypes repeated_child = 3; +} + +message TestDeprecatedFields { + int32 deprecated_int32 = 1 [deprecated=true]; +} + +// Define these after TestAllTypes to make sure the compiler can handle +// that. +message ForeignMessage { + int32 c = 1; +} + +enum ForeignEnum { + FOREIGN_UNSPECIFIED = 0; + FOREIGN_FOO = 4; + FOREIGN_BAR = 5; + FOREIGN_BAZ = 6; +} + +message TestReservedFields { + reserved 2, 15, 9 to 11; + reserved "bar", "baz"; +} + + +// Test that we can use NestedMessage from outside TestAllTypes. +message TestForeignNested { + TestAllTypes.NestedMessage foreign_nested = 1; +} + +// Test that really large tag numbers don't break anything. +message TestReallyLargeTagNumber { + // The largest possible tag number is 2^28 - 1, since the wire format uses + // three bits to communicate wire type. + int32 a = 1; + int32 bb = 268435455; +} + +message TestRecursiveMessage { + TestRecursiveMessage a = 1; + int32 i = 2; +} + +// Test that mutual recursion works. +message TestMutualRecursionA { + TestMutualRecursionB bb = 1; +} + +message TestMutualRecursionB { + TestMutualRecursionA a = 1; + int32 optional_int32 = 2; +} + +message TestEnumAllowAlias { + TestEnumWithDupValue value = 1; +} + +// Test an enum that has multiple values with the same number. +enum TestEnumWithDupValue { + TEST_ENUM_WITH_DUP_VALUE_UNSPECIFIED = 0; + option allow_alias = true; + + FOO1 = 1; + BAR1 = 2; + BAZ = 3; + FOO2 = 1; + BAR2 = 2; +} + +// Test an enum with large, unordered values. +enum TestSparseEnum { + TEST_SPARSE_ENUM_UNSPECIFIED = 0; + SPARSE_A = 123; + SPARSE_B = 62374; + SPARSE_C = 12589234; + SPARSE_D = -15; + SPARSE_E = -53452; + // In proto3, value 0 must be the first one specified + // SPARSE_F = 0; + SPARSE_G = 2; +} + +// Test message with CamelCase field names. This violates Protocol Buffer +// standard style. +message TestCamelCaseFieldNames { + int32 PrimitiveField = 1; + string StringField = 2; + ForeignEnum EnumField = 3; + ForeignMessage MessageField = 4; + + repeated int32 RepeatedPrimitiveField = 7; + repeated string RepeatedStringField = 8; + repeated ForeignEnum RepeatedEnumField = 9; + repeated ForeignMessage RepeatedMessageField = 10; +} + + +// We list fields out of order, to ensure that we're using field number and not +// field index to determine serialization order. +message TestFieldOrderings { + string my_string = 11; + int64 my_int = 1; + float my_float = 101; + message NestedMessage { + int64 oo = 2; + // The field name "b" fails to compile in proto1 because it conflicts with + // a local variable named "b" in one of the generated methods. Doh. + // This file needs to compile in proto1 to test backwards-compatibility. + int32 bb = 1; + } + + NestedMessage single_nested_message = 200; +} + +message SparseEnumMessage { + TestSparseEnum sparse_enum = 1; +} + +// Test String and Bytes: string is for valid UTF-8 strings +message OneString { + string data = 1; +} + +message MoreString { + repeated string data = 1; +} + +message OneBytes { + bytes data = 1; +} + +message MoreBytes { + bytes data = 1; +} + +// Test int32, uint32, int64, uint64, and bool are all compatible +message Int32Message { + int32 data = 1; +} + +message Uint32Message { + uint32 data = 1; +} + +message Int64Message { + int64 data = 1; +} + +message Uint64Message { + uint64 data = 1; +} + +message BoolMessage { + bool data = 1; +} + +// Test oneofs. +message TestOneof { + oneof foo { + int32 foo_int = 1; + string foo_string = 2; + TestAllTypes foo_message = 3; + } +} + +// Test messages for packed fields + +message TestPackedTypes { + repeated int32 packed_int32 = 90 [packed = true]; + repeated int64 packed_int64 = 91 [packed = true]; + repeated uint32 packed_uint32 = 92 [packed = true]; + repeated uint64 packed_uint64 = 93 [packed = true]; + repeated sint32 packed_sint32 = 94 [packed = true]; + repeated sint64 packed_sint64 = 95 [packed = true]; + repeated fixed32 packed_fixed32 = 96 [packed = true]; + repeated fixed64 packed_fixed64 = 97 [packed = true]; + repeated sfixed32 packed_sfixed32 = 98 [packed = true]; + repeated sfixed64 packed_sfixed64 = 99 [packed = true]; + repeated float packed_float = 100 [packed = true]; + repeated double packed_double = 101 [packed = true]; + repeated bool packed_bool = 102 [packed = true]; + repeated ForeignEnum packed_enum = 103 [packed = true]; +} + +// A message with the same fields as TestPackedTypes, but without packing. Used +// to test packed <-> unpacked wire compatibility. +message TestUnpackedTypes { + repeated int32 unpacked_int32 = 90 [packed = false]; + repeated int64 unpacked_int64 = 91 [packed = false]; + repeated uint32 unpacked_uint32 = 92 [packed = false]; + repeated uint64 unpacked_uint64 = 93 [packed = false]; + repeated sint32 unpacked_sint32 = 94 [packed = false]; + repeated sint64 unpacked_sint64 = 95 [packed = false]; + repeated fixed32 unpacked_fixed32 = 96 [packed = false]; + repeated fixed64 unpacked_fixed64 = 97 [packed = false]; + repeated sfixed32 unpacked_sfixed32 = 98 [packed = false]; + repeated sfixed64 unpacked_sfixed64 = 99 [packed = false]; + repeated float unpacked_float = 100 [packed = false]; + repeated double unpacked_double = 101 [packed = false]; + repeated bool unpacked_bool = 102 [packed = false]; + repeated ForeignEnum unpacked_enum = 103 [packed = false]; +} + +message TestRepeatedScalarDifferentTagSizes { + // Parsing repeated fixed size values used to fail. This message needs to be + // used in order to get a tag of the right size; all of the repeated fields + // in TestAllTypes didn't trigger the check. + repeated fixed32 repeated_fixed32 = 12; + // Check for a varint type, just for good measure. + repeated int32 repeated_int32 = 13; + + // These have two-byte tags. + repeated fixed64 repeated_fixed64 = 2046; + repeated int64 repeated_int64 = 2047; + + // Three byte tags. + repeated float repeated_float = 262142; + repeated uint64 repeated_uint64 = 262143; +} + +message TestCommentInjectionMessage { + // */ <- This should not close the generated doc comment + string a = 1; +} + + +// Test that RPC services work. +message FooRequest {} +message FooResponse {} + +message FooClientMessage {} +message FooServerMessage{} + +service TestService { + rpc Foo(FooRequest) returns (FooResponse); + rpc Bar(BarRequest) returns (BarResponse); +} + + +message BarRequest {} +message BarResponse {} + +message TestEmptyMessage {} diff -Nru protobuf-3.0.0/csharp/README.md protobuf-3.6.1.3/csharp/README.md --- protobuf-3.0.0/csharp/README.md 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/csharp/README.md 2018-12-08 01:32:11.000000000 +0000 @@ -1,8 +1,5 @@ This directory contains the C# Protocol Buffers runtime library. -Status: Beta - ready for external testing -========================================= - Usage ===== @@ -34,16 +31,45 @@ Building ======== -Open the `src/Google.Protobuf.sln` solution in Visual Studio 2015 or -later. You should be able to run the NUnit test from Test Explorer -(you might need to install NUnit Visual Studio add-in). +Open the `src/Google.Protobuf.sln` solution in Visual Studio 2017 or +later. Although *users* of this project are only expected to have Visual Studio 2012 or later, *developers* of the library are required to -have Visual Studio 2015 or later, as the library uses C# 6 features -in its implementation. These features have no impact when using the -compiled code - they're only relevant when building the -`Google.Protobuf` assembly. +have Visual Studio 2017 or later, as the library uses C# 6 features +in its implementation, as well as the new Visual Studio 2017 csproj +format. These features have no impact when using the compiled code - +they're only relevant when building the `Google.Protobuf` assembly. + +In order to run and debug the AddressBook example in the IDE, you must +install the optional component, ".Net Core 1.0 - 1.1 development tools +for Web" (as it's labelled in current versions of the VS2017 +installer), above and beyond the main .NET Core cross-platform +development feature. + +Testing +======= + +The unit tests use [NUnit 3](https://github.com/nunit/nunit). Tests can be +run using the Visual Studio Test Explorer or `dotnet test`. + +.NET 3.5 +======== + +We don't officially support .NET 3.5. However, there has been some effort +to make enabling .NET 3.5 support relatively painless in case you require it. +There's no guarantee that this will continue in the future, so rely on .NET +3.5 support at your peril. + +To enable .NET 3.5 support, you must edit the `TargetFrameworks` elements of +[src/Google.Protobuf/Google.Protobuf.csproj](src/Google.Protobuf/Google.Protobuf.csproj) +(and [src/Google.Protobuf.Test/Google.Protobuf.Test.csproj](src/Google.Protobuf.Test/Google.Protobuf.Test.csproj) +if you want to run the unit tests): + +Open the .csproj file in a text editor and simply add `net35` to the list of +target frameworks, noting that the `TargetFrameworks` element appears twice in +the file (once in the first `PropertyGroup` element, and again in the second +`PropertyGroup` element, i.e., the one with the conditional). History of C# protobufs ======================= diff -Nru protobuf-3.0.0/csharp/src/AddressBook/Addressbook.cs protobuf-3.6.1.3/csharp/src/AddressBook/Addressbook.cs --- protobuf-3.0.0/csharp/src/AddressBook/Addressbook.cs 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/csharp/src/AddressBook/Addressbook.cs 2018-12-08 01:32:11.000000000 +0000 @@ -1,5 +1,7 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: addressbook.proto +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: addressbook.proto +// #pragma warning disable 1591, 0612, 3021 #region Designer generated code @@ -22,19 +24,21 @@ static AddressbookReflection() { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( - "ChFhZGRyZXNzYm9vay5wcm90bxIIdHV0b3JpYWwi1QEKBlBlcnNvbhIMCgRu", - "YW1lGAEgASgJEgoKAmlkGAIgASgFEg0KBWVtYWlsGAMgASgJEiwKBnBob25l", - "cxgEIAMoCzIcLnR1dG9yaWFsLlBlcnNvbi5QaG9uZU51bWJlchpHCgtQaG9u", - "ZU51bWJlchIOCgZudW1iZXIYASABKAkSKAoEdHlwZRgCIAEoDjIaLnR1dG9y", - "aWFsLlBlcnNvbi5QaG9uZVR5cGUiKwoJUGhvbmVUeXBlEgoKBk1PQklMRRAA", - "EggKBEhPTUUQARIICgRXT1JLEAIiLwoLQWRkcmVzc0Jvb2sSIAoGcGVvcGxl", - "GAEgAygLMhAudHV0b3JpYWwuUGVyc29uQlAKFGNvbS5leGFtcGxlLnR1dG9y", - "aWFsQhFBZGRyZXNzQm9va1Byb3Rvc6oCJEdvb2dsZS5Qcm90b2J1Zi5FeGFt", - "cGxlcy5BZGRyZXNzQm9va2IGcHJvdG8z")); + "ChFhZGRyZXNzYm9vay5wcm90bxIIdHV0b3JpYWwaH2dvb2dsZS9wcm90b2J1", + "Zi90aW1lc3RhbXAucHJvdG8ihwIKBlBlcnNvbhIMCgRuYW1lGAEgASgJEgoK", + "AmlkGAIgASgFEg0KBWVtYWlsGAMgASgJEiwKBnBob25lcxgEIAMoCzIcLnR1", + "dG9yaWFsLlBlcnNvbi5QaG9uZU51bWJlchIwCgxsYXN0X3VwZGF0ZWQYBSAB", + "KAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wGkcKC1Bob25lTnVtYmVy", + "Eg4KBm51bWJlchgBIAEoCRIoCgR0eXBlGAIgASgOMhoudHV0b3JpYWwuUGVy", + "c29uLlBob25lVHlwZSIrCglQaG9uZVR5cGUSCgoGTU9CSUxFEAASCAoESE9N", + "RRABEggKBFdPUksQAiIvCgtBZGRyZXNzQm9vaxIgCgZwZW9wbGUYASADKAsy", + "EC50dXRvcmlhbC5QZXJzb25CUAoUY29tLmV4YW1wbGUudHV0b3JpYWxCEUFk", + "ZHJlc3NCb29rUHJvdG9zqgIkR29vZ2xlLlByb3RvYnVmLkV4YW1wbGVzLkFk", + "ZHJlc3NCb29rYgZwcm90bzM=")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { }, + new pbr::FileDescriptor[] { global::Google.Protobuf.WellKnownTypes.TimestampReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Examples.AddressBook.Person), global::Google.Protobuf.Examples.AddressBook.Person.Parser, new[]{ "Name", "Id", "Email", "Phones" }, null, new[]{ typeof(global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneType) }, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneNumber), global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneNumber.Parser, new[]{ "Number", "Type" }, null, null, null)}), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Examples.AddressBook.Person), global::Google.Protobuf.Examples.AddressBook.Person.Parser, new[]{ "Name", "Id", "Email", "Phones", "LastUpdated" }, null, new[]{ typeof(global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneType) }, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneNumber), global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneNumber.Parser, new[]{ "Number", "Type" }, null, null, null)}), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Examples.AddressBook.AddressBook), global::Google.Protobuf.Examples.AddressBook.AddressBook.Parser, new[]{ "People" }, null, null, null) })); } @@ -43,10 +47,11 @@ } #region Messages /// - /// [START messages] + /// [START messages] /// public sealed partial class Person : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Person()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -73,6 +78,8 @@ id_ = other.id_; email_ = other.email_; phones_ = other.phones_.Clone(); + lastUpdated_ = other.lastUpdated_ != null ? other.lastUpdated_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -95,7 +102,7 @@ public const int IdFieldNumber = 2; private int id_; /// - /// Unique ID number for this person. + /// Unique ID number for this person. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int Id { @@ -126,6 +133,17 @@ get { return phones_; } } + /// Field number for the "last_updated" field. + public const int LastUpdatedFieldNumber = 5; + private global::Google.Protobuf.WellKnownTypes.Timestamp lastUpdated_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Timestamp LastUpdated { + get { return lastUpdated_; } + set { + lastUpdated_ = value; + } + } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as Person); @@ -143,7 +161,8 @@ if (Id != other.Id) return false; if (Email != other.Email) return false; if(!phones_.Equals(other.phones_)) return false; - return true; + if (!object.Equals(LastUpdated, other.LastUpdated)) return false; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -153,6 +172,10 @@ if (Id != 0) hash ^= Id.GetHashCode(); if (Email.Length != 0) hash ^= Email.GetHashCode(); hash ^= phones_.GetHashCode(); + if (lastUpdated_ != null) hash ^= LastUpdated.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -176,6 +199,13 @@ output.WriteString(Email); } phones_.WriteTo(output, _repeated_phones_codec); + if (lastUpdated_ != null) { + output.WriteRawTag(42); + output.WriteMessage(LastUpdated); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -191,6 +221,12 @@ size += 1 + pb::CodedOutputStream.ComputeStringSize(Email); } size += phones_.CalculateSize(_repeated_phones_codec); + if (lastUpdated_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(LastUpdated); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -209,6 +245,13 @@ Email = other.Email; } phones_.Add(other.phones_); + if (other.lastUpdated_ != null) { + if (lastUpdated_ == null) { + lastUpdated_ = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + LastUpdated.MergeFrom(other.LastUpdated); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -217,7 +260,7 @@ while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { Name = input.ReadString(); @@ -235,6 +278,13 @@ phones_.AddEntriesFrom(input, _repeated_phones_codec); break; } + case 42: { + if (lastUpdated_ == null) { + lastUpdated_ = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + input.ReadMessage(lastUpdated_); + break; + } } } } @@ -251,6 +301,7 @@ public sealed partial class PhoneNumber : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new PhoneNumber()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -275,6 +326,7 @@ public PhoneNumber(PhoneNumber other) : this() { number_ = other.number_; type_ = other.type_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -319,7 +371,7 @@ } if (Number != other.Number) return false; if (Type != other.Type) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -327,6 +379,9 @@ int hash = 1; if (Number.Length != 0) hash ^= Number.GetHashCode(); if (Type != 0) hash ^= Type.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -345,6 +400,9 @@ output.WriteRawTag(16); output.WriteEnum((int) Type); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -356,6 +414,9 @@ if (Type != 0) { size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Type); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -370,6 +431,7 @@ if (other.Type != 0) { Type = other.Type; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -378,7 +440,7 @@ while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { Number = input.ReadString(); @@ -400,10 +462,11 @@ } /// - /// Our address book file is just one of these. + /// Our address book file is just one of these. /// public sealed partial class AddressBook : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new AddressBook()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -427,6 +490,7 @@ [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public AddressBook(AddressBook other) : this() { people_ = other.people_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -458,13 +522,16 @@ return true; } if(!people_.Equals(other.people_)) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; hash ^= people_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -476,12 +543,18 @@ [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { people_.WriteTo(output, _repeated_people_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; size += people_.CalculateSize(_repeated_people_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -491,6 +564,7 @@ return; } people_.Add(other.people_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -499,7 +573,7 @@ while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { people_.AddEntriesFrom(input, _repeated_people_codec); diff -Nru protobuf-3.0.0/csharp/src/AddressBook/AddressBook.csproj protobuf-3.6.1.3/csharp/src/AddressBook/AddressBook.csproj --- protobuf-3.0.0/csharp/src/AddressBook/AddressBook.csproj 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/csharp/src/AddressBook/AddressBook.csproj 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,14 @@ + + + + netcoreapp1.0 + Exe + Google.Protobuf.Examples.AddressBook.Program + False + + + + + + + diff -Nru protobuf-3.0.0/csharp/src/AddressBook/AddressBook.xproj protobuf-3.6.1.3/csharp/src/AddressBook/AddressBook.xproj --- protobuf-3.0.0/csharp/src/AddressBook/AddressBook.xproj 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/csharp/src/AddressBook/AddressBook.xproj 1970-01-01 00:00:00.000000000 +0000 @@ -1,19 +0,0 @@ - - - - 14.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - afb63919-1e05-43b4-802a-8fb8c9b2f463 - AddressBook - .\obj - .\bin\ - - - - 2.0 - - - \ No newline at end of file diff -Nru protobuf-3.0.0/csharp/src/AddressBook/project.json protobuf-3.6.1.3/csharp/src/AddressBook/project.json --- protobuf-3.0.0/csharp/src/AddressBook/project.json 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/csharp/src/AddressBook/project.json 1970-01-01 00:00:00.000000000 +0000 @@ -1,20 +0,0 @@ -{ - "buildOptions": { - "debugType": "portable", - "emitEntryPoint": true, - "additionalArguments": [ "/main:Google.Protobuf.Examples.AddressBook.Program" ] - }, - "dependencies": { - "Google.Protobuf": { "target": "project" } - }, - "frameworks": { - "netcoreapp1.0": { - "dependencies": { - "Microsoft.NETCore.App": { - "type": "platform", - "version": "1.0.0" - } - } - } - } -} diff -Nru protobuf-3.0.0/csharp/src/Google.Protobuf/ByteString.cs protobuf-3.6.1.3/csharp/src/Google.Protobuf/ByteString.cs --- protobuf-3.0.0/csharp/src/Google.Protobuf/ByteString.cs 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/csharp/src/Google.Protobuf/ByteString.cs 2018-12-08 01:32:11.000000000 +0000 @@ -35,6 +35,13 @@ using System.Collections.Generic; using System.IO; using System.Text; +#if !NET35 +using System.Threading; +using System.Threading.Tasks; +#endif +#if NET35 +using Google.Protobuf.Compatibility; +#endif namespace Google.Protobuf { @@ -142,6 +149,55 @@ } /// + /// Constructs a from data in the given stream, synchronously. + /// + /// If successful, will be read completely, from the position + /// at the start of the call. + /// The stream to copy into a ByteString. + /// A ByteString with content read from the given stream. + public static ByteString FromStream(Stream stream) + { + ProtoPreconditions.CheckNotNull(stream, nameof(stream)); + int capacity = stream.CanSeek ? checked((int) (stream.Length - stream.Position)) : 0; + var memoryStream = new MemoryStream(capacity); + stream.CopyTo(memoryStream); +#if NETSTANDARD1_0 + byte[] bytes = memoryStream.ToArray(); +#else + // Avoid an extra copy if we can. + byte[] bytes = memoryStream.Length == memoryStream.Capacity ? memoryStream.GetBuffer() : memoryStream.ToArray(); +#endif + return AttachBytes(bytes); + } + +#if !NET35 + /// + /// Constructs a from data in the given stream, asynchronously. + /// + /// If successful, will be read completely, from the position + /// at the start of the call. + /// The stream to copy into a ByteString. + /// The cancellation token to use when reading from the stream, if any. + /// A ByteString with content read from the given stream. + public async static Task FromStreamAsync(Stream stream, CancellationToken cancellationToken = default(CancellationToken)) + { + ProtoPreconditions.CheckNotNull(stream, nameof(stream)); + int capacity = stream.CanSeek ? checked((int) (stream.Length - stream.Position)) : 0; + var memoryStream = new MemoryStream(capacity); + // We have to specify the buffer size here, as there's no overload accepting the cancellation token + // alone. But it's documented to use 81920 by default if not specified. + await stream.CopyToAsync(memoryStream, 81920, cancellationToken); +#if NETSTANDARD1_0 + byte[] bytes = memoryStream.ToArray(); +#else + // Avoid an extra copy if we can. + byte[] bytes = memoryStream.Length == memoryStream.Capacity ? memoryStream.GetBuffer() : memoryStream.ToArray(); +#endif + return AttachBytes(bytes); + } +#endif + + /// /// Constructs a from the given array. The contents /// are copied, so further modifications to the array will not /// be reflected in the returned ByteString. @@ -303,7 +359,7 @@ int ret = 23; foreach (byte b in bytes) { - ret = (ret << 8) | b; + ret = (ret * 31) + b; } return ret; } diff -Nru protobuf-3.0.0/csharp/src/Google.Protobuf/CodedInputStream.cs protobuf-3.6.1.3/csharp/src/Google.Protobuf/CodedInputStream.cs --- protobuf-3.0.0/csharp/src/Google.Protobuf/CodedInputStream.cs 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/csharp/src/Google.Protobuf/CodedInputStream.cs 2018-12-08 01:32:11.000000000 +0000 @@ -94,7 +94,7 @@ private bool hasNextTag = false; internal const int DefaultRecursionLimit = 64; - internal const int DefaultSizeLimit = 64 << 20; // 64MB + internal const int DefaultSizeLimit = Int32.MaxValue; internal const int BufferSize = 4096; /// @@ -121,7 +121,7 @@ /// /// Creates a new CodedInputStream reading data from the given byte array. /// - public CodedInputStream(byte[] buffer) : this(null, ProtoPreconditions.CheckNotNull(buffer, "buffer"), 0, buffer.Length) + public CodedInputStream(byte[] buffer) : this(null, ProtoPreconditions.CheckNotNull(buffer, "buffer"), 0, buffer.Length, true) { } @@ -129,7 +129,7 @@ /// Creates a new that reads from the given byte array slice. /// public CodedInputStream(byte[] buffer, int offset, int length) - : this(null, ProtoPreconditions.CheckNotNull(buffer, "buffer"), offset, offset + length) + : this(null, ProtoPreconditions.CheckNotNull(buffer, "buffer"), offset, offset + length, true) { if (offset < 0 || offset > buffer.Length) { @@ -158,16 +158,15 @@ /// is disposed; false to dispose of the given stream when the /// returned object is disposed. public CodedInputStream(Stream input, bool leaveOpen) - : this(ProtoPreconditions.CheckNotNull(input, "input"), new byte[BufferSize], 0, 0) + : this(ProtoPreconditions.CheckNotNull(input, "input"), new byte[BufferSize], 0, 0, leaveOpen) { - this.leaveOpen = leaveOpen; } /// /// Creates a new CodedInputStream reading data from the given /// stream and buffer, using the default limits. /// - internal CodedInputStream(Stream input, byte[] buffer, int bufferPos, int bufferSize) + internal CodedInputStream(Stream input, byte[] buffer, int bufferPos, int bufferSize, bool leaveOpen) { this.input = input; this.buffer = buffer; @@ -175,6 +174,7 @@ this.bufferSize = bufferSize; this.sizeLimit = DefaultSizeLimit; this.recursionLimit = DefaultRecursionLimit; + this.leaveOpen = leaveOpen; } /// @@ -185,8 +185,8 @@ /// This chains to the version with the default limits instead of vice versa to avoid /// having to check that the default values are valid every time. /// - internal CodedInputStream(Stream input, byte[] buffer, int bufferPos, int bufferSize, int sizeLimit, int recursionLimit) - : this(input, buffer, bufferPos, bufferSize) + internal CodedInputStream(Stream input, byte[] buffer, int bufferPos, int bufferSize, int sizeLimit, int recursionLimit, bool leaveOpen) + : this(input, buffer, bufferPos, bufferSize, leaveOpen) { if (sizeLimit <= 0) { @@ -217,7 +217,8 @@ /// and recursion limits. public static CodedInputStream CreateWithLimits(Stream input, int sizeLimit, int recursionLimit) { - return new CodedInputStream(input, new byte[BufferSize], 0, 0, sizeLimit, recursionLimit); + // Note: we may want an overload accepting leaveOpen + return new CodedInputStream(input, new byte[BufferSize], 0, 0, sizeLimit, recursionLimit, false); } /// @@ -247,7 +248,7 @@ /// /// This limit is applied when reading from the underlying stream, as a sanity check. It is /// not applied when reading from a byte array data source without an underlying stream. - /// The default value is 64MB. + /// The default value is Int32.MaxValue. /// /// /// The size limit. @@ -267,6 +268,11 @@ public int RecursionLimit { get { return recursionLimit; } } /// + /// Internal-only property; when set to true, unknown fields will be discarded while parsing. + /// + internal bool DiscardUnknownFields { get; set; } + + /// /// Disposes of this instance, potentially closing any underlying stream. /// /// @@ -372,9 +378,9 @@ lastTag = ReadRawVarint32(); } - if (lastTag == 0) + if (WireFormat.GetTagFieldNumber(lastTag) == 0) { - // If we actually read zero, that's not a valid tag. + // If we actually read a tag with a field of 0, that's not a valid tag. throw InvalidProtocolBufferException.InvalidTag(); } return lastTag; @@ -423,7 +429,10 @@ } } - private void SkipGroup(uint startGroupTag) + /// + /// Skip a group. + /// + internal void SkipGroup(uint startGroupTag) { // Note: Currently we expect this to be the way that groups are read. We could put the recursion // depth changes into the ReadTag method instead, potentially... @@ -1049,7 +1058,7 @@ RecomputeBufferSizeAfterLimit(); int totalBytesRead = totalBytesRetired + bufferSize + bufferSizeAfterLimit; - if (totalBytesRead > sizeLimit || totalBytesRead < 0) + if (totalBytesRead < 0 || totalBytesRead > sizeLimit) { throw InvalidProtocolBufferException.SizeLimitExceeded(); } @@ -1269,7 +1278,6 @@ } } } - #endregion } } \ No newline at end of file diff -Nru protobuf-3.0.0/csharp/src/Google.Protobuf/Collections/Lists.cs protobuf-3.6.1.3/csharp/src/Google.Protobuf/Collections/Lists.cs --- protobuf-3.0.0/csharp/src/Google.Protobuf/Collections/Lists.cs 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/csharp/src/Google.Protobuf/Collections/Lists.cs 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,89 @@ +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2017 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using System.Collections.Generic; +using System.Collections.ObjectModel; + +namespace Google.Protobuf.Collections +{ + /// + /// Utility to compare if two Lists are the same, and the hash code + /// of a List. + /// + public static class Lists + { + /// + /// Checks if two lists are equal. + /// + public static bool Equals(List left, List right) + { + if (left == right) + { + return true; + } + if (left == null || right == null) + { + return false; + } + if (left.Count != right.Count) + { + return false; + } + IEqualityComparer comparer = EqualityComparer.Default; + for (int i = 0; i < left.Count; i++) + { + if (!comparer.Equals(left[i], right[i])) + { + return false; + } + } + return true; + } + + /// + /// Gets the list's hash code. + /// + public static int GetHashCode(List list) + { + if (list == null) + { + return 0; + } + int hash = 31; + foreach (T element in list) + { + hash = hash * 29 + element.GetHashCode(); + } + return hash; + } + } +} \ No newline at end of file diff -Nru protobuf-3.0.0/csharp/src/Google.Protobuf/Collections/MapField.cs protobuf-3.6.1.3/csharp/src/Google.Protobuf/Collections/MapField.cs --- protobuf-3.0.0/csharp/src/Google.Protobuf/Collections/MapField.cs 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/csharp/src/Google.Protobuf/Collections/MapField.cs 2018-12-08 01:32:11.000000000 +0000 @@ -67,10 +67,16 @@ /// /// public sealed class MapField : IDeepCloneable>, IDictionary, IEquatable>, IDictionary +#if !NET35 + , IReadOnlyDictionary +#endif { + private static readonly EqualityComparer ValueEqualityComparer = ProtobufEqualityComparers.GetEqualityComparer(); + private static readonly EqualityComparer KeyEqualityComparer = ProtobufEqualityComparers.GetEqualityComparer(); + // TODO: Don't create the map/list until we have an entry. (Assume many maps will be empty.) private readonly Dictionary>> map = - new Dictionary>>(); + new Dictionary>>(KeyEqualityComparer); private readonly LinkedList> list = new LinkedList>(); /// @@ -128,11 +134,8 @@ return map.ContainsKey(key); } - private bool ContainsValue(TValue value) - { - var comparer = EqualityComparer.Default; - return list.Any(pair => comparer.Equals(pair.Value, value)); - } + private bool ContainsValue(TValue value) => + list.Any(pair => ValueEqualityComparer.Equals(pair.Value, value)); /// /// Removes the entry identified by the given key from the map. @@ -290,8 +293,7 @@ bool ICollection>.Contains(KeyValuePair item) { TValue value; - return TryGetValue(item.Key, out value) - && EqualityComparer.Default.Equals(item.Value, value); + return TryGetValue(item.Key, out value) && ValueEqualityComparer.Equals(item.Value, value); } /// @@ -360,11 +362,12 @@ /// public override int GetHashCode() { - var valueComparer = EqualityComparer.Default; + var keyComparer = KeyEqualityComparer; + var valueComparer = ValueEqualityComparer; int hash = 0; foreach (var pair in list) { - hash ^= pair.Key.GetHashCode() * 31 + valueComparer.GetHashCode(pair.Value); + hash ^= keyComparer.GetHashCode(pair.Key) * 31 + valueComparer.GetHashCode(pair.Value); } return hash; } @@ -391,7 +394,7 @@ { return false; } - var valueComparer = EqualityComparer.Default; + var valueComparer = ValueEqualityComparer; foreach (var pair in this) { TValue value; @@ -548,6 +551,14 @@ } #endregion + #region IReadOnlyDictionary explicit interface implementation +#if !NET35 + IEnumerable IReadOnlyDictionary.Keys => Keys; + + IEnumerable IReadOnlyDictionary.Values => Values; +#endif + #endregion + private class DictionaryEnumerator : IDictionaryEnumerator { private readonly IEnumerator> enumerator; @@ -715,7 +726,7 @@ { throw new ArgumentOutOfRangeException(nameof(arrayIndex)); } - if (arrayIndex + Count >= array.Length) + if (arrayIndex + Count > array.Length) { throw new ArgumentException("Not enough space in the array", nameof(array)); } @@ -746,7 +757,7 @@ { throw new ArgumentOutOfRangeException(nameof(index)); } - if (index + Count >= array.Length) + if (index + Count > array.Length) { throw new ArgumentException("Not enough space in the array", nameof(array)); } diff -Nru protobuf-3.0.0/csharp/src/Google.Protobuf/Collections/ProtobufEqualityComparers.cs protobuf-3.6.1.3/csharp/src/Google.Protobuf/Collections/ProtobufEqualityComparers.cs --- protobuf-3.0.0/csharp/src/Google.Protobuf/Collections/ProtobufEqualityComparers.cs 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/csharp/src/Google.Protobuf/Collections/ProtobufEqualityComparers.cs 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,130 @@ +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2017 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using System; +using System.Collections.Generic; + +namespace Google.Protobuf.Collections +{ + /// + /// Provides a central place to implement equality comparisons, primarily for bitwise float/double equality. + /// + public static class ProtobufEqualityComparers + { + /// + /// Returns an equality comparer for suitable for Protobuf equality comparisons. + /// This is usually just the default equality comparer for the type, but floating point numbers are compared + /// bitwise. + /// + /// The type of equality comparer to return. + /// The equality comparer. + public static EqualityComparer GetEqualityComparer() + { + return typeof(T) == typeof(double) ? (EqualityComparer) (object) BitwiseDoubleEqualityComparer + : typeof(T) == typeof(float) ? (EqualityComparer) (object) BitwiseSingleEqualityComparer + : typeof(T) == typeof(double?) ? (EqualityComparer) (object) BitwiseNullableDoubleEqualityComparer + : typeof(T) == typeof(float?) ? (EqualityComparer) (object) BitwiseNullableSingleEqualityComparer + : EqualityComparer.Default; + } + + /// + /// Returns an equality comparer suitable for comparing 64-bit floating point values, by bitwise comparison. + /// (NaN values are considered equal, but only when they have the same representation.) + /// + public static EqualityComparer BitwiseDoubleEqualityComparer { get; } = new BitwiseDoubleEqualityComparerImpl(); + + /// + /// Returns an equality comparer suitable for comparing 32-bit floating point values, by bitwise comparison. + /// (NaN values are considered equal, but only when they have the same representation.) + /// + public static EqualityComparer BitwiseSingleEqualityComparer { get; } = new BitwiseSingleEqualityComparerImpl(); + + /// + /// Returns an equality comparer suitable for comparing nullable 64-bit floating point values, by bitwise comparison. + /// (NaN values are considered equal, but only when they have the same representation.) + /// + public static EqualityComparer BitwiseNullableDoubleEqualityComparer { get; } = new BitwiseNullableDoubleEqualityComparerImpl(); + + /// + /// Returns an equality comparer suitable for comparing nullable 32-bit floating point values, by bitwise comparison. + /// (NaN values are considered equal, but only when they have the same representation.) + /// + public static EqualityComparer BitwiseNullableSingleEqualityComparer { get; } = new BitwiseNullableSingleEqualityComparerImpl(); + + private class BitwiseDoubleEqualityComparerImpl : EqualityComparer + { + public override bool Equals(double x, double y) => + BitConverter.DoubleToInt64Bits(x) == BitConverter.DoubleToInt64Bits(y); + + public override int GetHashCode(double obj) => + BitConverter.DoubleToInt64Bits(obj).GetHashCode(); + } + + private class BitwiseSingleEqualityComparerImpl : EqualityComparer + { + // Just promote values to double and use BitConverter.DoubleToInt64Bits, + // as there's no BitConverter.SingleToInt32Bits, unfortunately. + + public override bool Equals(float x, float y) => + BitConverter.DoubleToInt64Bits(x) == BitConverter.DoubleToInt64Bits(y); + + public override int GetHashCode(float obj) => + BitConverter.DoubleToInt64Bits(obj).GetHashCode(); + } + + private class BitwiseNullableDoubleEqualityComparerImpl : EqualityComparer + { + public override bool Equals(double? x, double? y) => + x == null && y == null ? true + : x == null || y == null ? false + : BitwiseDoubleEqualityComparer.Equals(x.Value, y.Value); + + // The hash code for null is just a constant which is at least *unlikely* to be used + // elsewhere. (Compared with 0, say.) + public override int GetHashCode(double? obj) => + obj == null ? 293864 : BitwiseDoubleEqualityComparer.GetHashCode(obj.Value); + } + + private class BitwiseNullableSingleEqualityComparerImpl : EqualityComparer + { + public override bool Equals(float? x, float? y) => + x == null && y == null ? true + : x == null || y == null ? false + : BitwiseSingleEqualityComparer.Equals(x.Value, y.Value); + + // The hash code for null is just a constant which is at least *unlikely* to be used + // elsewhere. (Compared with 0, say.) + public override int GetHashCode(float? obj) => + obj == null ? 293864 : BitwiseSingleEqualityComparer.GetHashCode(obj.Value); + } + } +} diff -Nru protobuf-3.0.0/csharp/src/Google.Protobuf/Collections/RepeatedField.cs protobuf-3.6.1.3/csharp/src/Google.Protobuf/Collections/RepeatedField.cs --- protobuf-3.0.0/csharp/src/Google.Protobuf/Collections/RepeatedField.cs 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/csharp/src/Google.Protobuf/Collections/RepeatedField.cs 2018-12-08 01:32:11.000000000 +0000 @@ -47,7 +47,11 @@ /// /// The element type of the repeated field. public sealed class RepeatedField : IList, IList, IDeepCloneable>, IEquatable> +#if !NET35 + , IReadOnlyList +#endif { + private static readonly EqualityComparer EqualityComparer = ProtobufEqualityComparers.GetEqualityComparer(); private static readonly T[] EmptyArray = new T[0]; private const int MinArraySize = 8; @@ -431,7 +435,7 @@ { return false; } - EqualityComparer comparer = EqualityComparer.Default; + EqualityComparer comparer = EqualityComparer; for (int i = 0; i < count; i++) { if (!comparer.Equals(array[i], other.array[i])) @@ -451,7 +455,7 @@ public int IndexOf(T item) { ProtoPreconditions.CheckNotNullUnconstrained(item, nameof(item)); - EqualityComparer comparer = EqualityComparer.Default; + EqualityComparer comparer = EqualityComparer; for (int i = 0; i < count; i++) { if (comparer.Equals(array[i], item)) diff -Nru protobuf-3.0.0/csharp/src/Google.Protobuf/Compatibility/MethodInfoExtensions.cs protobuf-3.6.1.3/csharp/src/Google.Protobuf/Compatibility/MethodInfoExtensions.cs --- protobuf-3.0.0/csharp/src/Google.Protobuf/Compatibility/MethodInfoExtensions.cs 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/csharp/src/Google.Protobuf/Compatibility/MethodInfoExtensions.cs 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,47 @@ +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2017 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +#if NET35 +using System; +using System.Reflection; + +namespace Google.Protobuf.Compatibility +{ + // .NET Core (at least netstandard1.0) doesn't have Delegate.CreateDelegate, and .NET 3.5 doesn't have + // MethodInfo.CreateDelegate. Proxy from one to the other on .NET 3.5... + internal static class MethodInfoExtensions + { + internal static Delegate CreateDelegate(this MethodInfo method, Type type) => + Delegate.CreateDelegate(type, method); + } +} +#endif diff -Nru protobuf-3.0.0/csharp/src/Google.Protobuf/Compatibility/PropertyInfoExtensions.cs protobuf-3.6.1.3/csharp/src/Google.Protobuf/Compatibility/PropertyInfoExtensions.cs --- protobuf-3.0.0/csharp/src/Google.Protobuf/Compatibility/PropertyInfoExtensions.cs 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/csharp/src/Google.Protobuf/Compatibility/PropertyInfoExtensions.cs 2018-12-08 01:32:11.000000000 +0000 @@ -47,7 +47,7 @@ /// internal static MethodInfo GetGetMethod(this PropertyInfo target) { -#if DOTNET35 +#if NET35 var method = target.GetGetMethod(); #else var method = target.GetMethod; @@ -61,7 +61,7 @@ /// internal static MethodInfo GetSetMethod(this PropertyInfo target) { -#if DOTNET35 +#if NET35 var method = target.GetSetMethod(); #else var method = target.SetMethod; diff -Nru protobuf-3.0.0/csharp/src/Google.Protobuf/Compatibility/StreamExtensions.cs protobuf-3.6.1.3/csharp/src/Google.Protobuf/Compatibility/StreamExtensions.cs --- protobuf-3.0.0/csharp/src/Google.Protobuf/Compatibility/StreamExtensions.cs 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/csharp/src/Google.Protobuf/Compatibility/StreamExtensions.cs 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,66 @@ +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2015 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +#if NET35 +using System; +using System.IO; + +namespace Google.Protobuf.Compatibility +{ + /// + /// Extension methods for in order to provide + /// backwards compatibility with .NET 3.5 + /// + public static class StreamExtensions + { + // 81920 seems to be the default buffer size used in .NET 4.5.1 + private const int BUFFER_SIZE = 81920; + + /// + /// Write the contents of the current stream to the destination stream + /// + public static void CopyTo(this Stream source, Stream destination) + { + if (destination == null) + { + throw new ArgumentNullException(nameof(destination)); + } + + byte[] buffer = new byte[BUFFER_SIZE]; + int numBytesRead; + while ((numBytesRead = source.Read(buffer, 0, buffer.Length)) > 0) { + destination.Write(buffer, 0, numBytesRead); + } + } + } +} +#endif diff -Nru protobuf-3.0.0/csharp/src/Google.Protobuf/Compatibility/TypeExtensions.cs protobuf-3.6.1.3/csharp/src/Google.Protobuf/Compatibility/TypeExtensions.cs --- protobuf-3.0.0/csharp/src/Google.Protobuf/Compatibility/TypeExtensions.cs 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/csharp/src/Google.Protobuf/Compatibility/TypeExtensions.cs 2018-12-08 01:32:11.000000000 +0000 @@ -33,7 +33,7 @@ using System; using System.Reflection; -#if !DOTNET35 +#if !NET35 namespace Google.Protobuf.Compatibility { /// diff -Nru protobuf-3.0.0/csharp/src/Google.Protobuf/FieldCodec.cs protobuf-3.6.1.3/csharp/src/Google.Protobuf/FieldCodec.cs --- protobuf-3.0.0/csharp/src/Google.Protobuf/FieldCodec.cs 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/csharp/src/Google.Protobuf/FieldCodec.cs 2018-12-08 01:32:11.000000000 +0000 @@ -30,6 +30,7 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #endregion +using Google.Protobuf.Collections; using Google.Protobuf.Compatibility; using Google.Protobuf.WellKnownTypes; using System; @@ -346,6 +347,7 @@ /// public sealed class FieldCodec { + private static readonly EqualityComparer EqualityComparer = ProtobufEqualityComparers.GetEqualityComparer(); private static readonly T DefaultDefault; // Only non-nullable value types support packing. This is the simplest way of detecting that. private static readonly bool TypeSupportsPacking = default(T) != null; @@ -469,6 +471,6 @@ /// public int CalculateSizeWithTag(T value) => IsDefault(value) ? 0 : ValueSizeCalculator(value) + tagSize; - private bool IsDefault(T value) => EqualityComparer.Default.Equals(value, DefaultValue); + private bool IsDefault(T value) => EqualityComparer.Equals(value, DefaultValue); } } diff -Nru protobuf-3.0.0/csharp/src/Google.Protobuf/Google.Protobuf.csproj protobuf-3.6.1.3/csharp/src/Google.Protobuf/Google.Protobuf.csproj --- protobuf-3.0.0/csharp/src/Google.Protobuf/Google.Protobuf.csproj 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/csharp/src/Google.Protobuf/Google.Protobuf.csproj 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,33 @@ + + + + C# runtime library for Protocol Buffers - Google's data interchange format. + Copyright 2015, Google Inc. + Google Protocol Buffers + 3.6.1 + Google Inc. + netstandard1.0;net45 + true + ../../keys/Google.Protobuf.snk + true + true + Protocol;Buffers;Binary;Serialization;Format;Google;proto;proto3 + C# proto3 support + https://github.com/google/protobuf + https://github.com/google/protobuf/blob/master/LICENSE + git + https://github.com/google/protobuf.git + true + true + + + + + netstandard1.0 + + + diff -Nru protobuf-3.0.0/csharp/src/Google.Protobuf/Google.Protobuf.xproj protobuf-3.6.1.3/csharp/src/Google.Protobuf/Google.Protobuf.xproj --- protobuf-3.0.0/csharp/src/Google.Protobuf/Google.Protobuf.xproj 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/csharp/src/Google.Protobuf/Google.Protobuf.xproj 1970-01-01 00:00:00.000000000 +0000 @@ -1,19 +0,0 @@ - - - - 14.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - 9b576380-726d-4142-8238-60a43ab0e35a - Google.Protobuf - .\obj - .\bin\ - - - - 2.0 - - - \ No newline at end of file diff -Nru protobuf-3.0.0/csharp/src/Google.Protobuf/InvalidProtocolBufferException.cs protobuf-3.6.1.3/csharp/src/Google.Protobuf/InvalidProtocolBufferException.cs --- protobuf-3.0.0/csharp/src/Google.Protobuf/InvalidProtocolBufferException.cs 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/csharp/src/Google.Protobuf/InvalidProtocolBufferException.cs 2018-12-08 01:32:11.000000000 +0000 @@ -61,7 +61,7 @@ { return new InvalidProtocolBufferException( "While parsing a protocol message, the input ended unexpectedly " + - "in the middle of a field. This could mean either than the " + + "in the middle of a field. This could mean either that the " + "input has been truncated or that an embedded message " + "misreported its own length."); } diff -Nru protobuf-3.0.0/csharp/src/Google.Protobuf/JsonFormatter.cs protobuf-3.6.1.3/csharp/src/Google.Protobuf/JsonFormatter.cs --- protobuf-3.0.0/csharp/src/Google.Protobuf/JsonFormatter.cs 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/csharp/src/Google.Protobuf/JsonFormatter.cs 2018-12-08 01:32:11.000000000 +0000 @@ -248,80 +248,26 @@ return !first; } - /// - /// Camel-case converter with added strictness for field mask formatting. - /// - /// The field mask is invalid for JSON representation - private static string ToCamelCaseForFieldMask(string input) - { - for (int i = 0; i < input.Length; i++) - { - char c = input[i]; - if (c >= 'A' && c <= 'Z') - { - throw new InvalidOperationException($"Invalid field mask to be converted to JSON: {input}"); - } - if (c == '_' && i < input.Length - 1) - { - char next = input[i + 1]; - if (next < 'a' || next > 'z') - { - throw new InvalidOperationException($"Invalid field mask to be converted to JSON: {input}"); - } - } - } - return ToCamelCase(input); - } - - // Converted from src/google/protobuf/util/internal/utility.cc ToCamelCase - // TODO: Use the new field in FieldDescriptor. - internal static string ToCamelCase(string input) + // Converted from java/core/src/main/java/com/google/protobuf/Descriptors.java + internal static string ToJsonName(string name) { - bool capitalizeNext = false; - bool wasCap = true; - bool isCap = false; - bool firstWord = true; - StringBuilder result = new StringBuilder(input.Length); - - for (int i = 0; i < input.Length; i++, wasCap = isCap) + StringBuilder result = new StringBuilder(name.Length); + bool isNextUpperCase = false; + foreach (char ch in name) { - isCap = char.IsUpper(input[i]); - if (input[i] == '_') + if (ch == '_') { - capitalizeNext = true; - if (result.Length != 0) - { - firstWord = false; - } - continue; + isNextUpperCase = true; } - else if (firstWord) + else if (isNextUpperCase) { - // Consider when the current character B is capitalized, - // first word ends when: - // 1) following a lowercase: "...aB..." - // 2) followed by a lowercase: "...ABc..." - if (result.Length != 0 && isCap && - (!wasCap || (i + 1 < input.Length && char.IsLower(input[i + 1])))) - { - firstWord = false; - } - else - { - result.Append(char.ToLowerInvariant(input[i])); - continue; - } + result.Append(char.ToUpperInvariant(ch)); + isNextUpperCase = false; } - else if (capitalizeNext) + else { - capitalizeNext = false; - if (char.IsLower(input[i])) - { - result.Append(char.ToUpperInvariant(input[i])); - continue; - } + result.Append(ch); } - result.Append(input[i]); } return result.ToString(); } @@ -429,14 +375,21 @@ } else if (value is System.Enum) { - string name = OriginalEnumValueHelper.GetOriginalName(value); - if (name != null) + if (settings.FormatEnumsAsIntegers) { - WriteString(writer, name); + WriteValue(writer, (int)value); } else { - WriteValue(writer, (int)value); + string name = OriginalEnumValueHelper.GetOriginalName(value); + if (name != null) + { + WriteString(writer, name); + } + else + { + WriteValue(writer, (int)value); + } } } else if (value is float || value is double) @@ -832,7 +785,11 @@ /// public TypeRegistry TypeRegistry { get; } - // TODO: Work out how we're going to scale this to multiple settings. "WithXyz" methods? + /// + /// Whether to format enums as ints. Defaults to false. + /// + public bool FormatEnumsAsIntegers { get; } + /// /// Creates a new object with the specified formatting of default values @@ -849,11 +806,42 @@ /// /// true if default values (0, empty strings etc) should be formatted; false otherwise. /// The to use when formatting messages. - public Settings(bool formatDefaultValues, TypeRegistry typeRegistry) + public Settings(bool formatDefaultValues, TypeRegistry typeRegistry) : this(formatDefaultValues, typeRegistry, false) + { + } + + /// + /// Creates a new object with the specified parameters. + /// + /// true if default values (0, empty strings etc) should be formatted; false otherwise. + /// The to use when formatting messages. TypeRegistry.Empty will be used if it is null. + /// true to format the enums as integers; false to format enums as enum names. + private Settings(bool formatDefaultValues, + TypeRegistry typeRegistry, + bool formatEnumsAsIntegers) { FormatDefaultValues = formatDefaultValues; - TypeRegistry = ProtoPreconditions.CheckNotNull(typeRegistry, nameof(typeRegistry)); + TypeRegistry = typeRegistry ?? TypeRegistry.Empty; + FormatEnumsAsIntegers = formatEnumsAsIntegers; } + + /// + /// Creates a new object with the specified formatting of default values and the current settings. + /// + /// true if default values (0, empty strings etc) should be formatted; false otherwise. + public Settings WithFormatDefaultValues(bool formatDefaultValues) => new Settings(formatDefaultValues, TypeRegistry, FormatEnumsAsIntegers); + + /// + /// Creates a new object with the specified type registry and the current settings. + /// + /// The to use when formatting messages. + public Settings WithTypeRegistry(TypeRegistry typeRegistry) => new Settings(FormatDefaultValues, typeRegistry, FormatEnumsAsIntegers); + + /// + /// Creates a new object with the specified enums formatting option and the current settings. + /// + /// true to format the enums as integers; false to format enums as enum names. + public Settings WithFormatEnumsAsIntegers(bool formatEnumsAsIntegers) => new Settings(FormatDefaultValues, TypeRegistry, formatEnumsAsIntegers); } // Effectively a cache of mapping from enum values to the original name as specified in the proto file, @@ -885,10 +873,13 @@ return originalName; } -#if DOTNET35 +#if NET35 // TODO: Consider adding functionality to TypeExtensions to avoid this difference. private static Dictionary GetNameMapping(System.Type enumType) => enumType.GetFields(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static) + .Where(f => (f.GetCustomAttributes(typeof(OriginalNameAttribute), false) + .FirstOrDefault() as OriginalNameAttribute) + ?.PreferredAlias ?? true) .ToDictionary(f => f.GetValue(null), f => (f.GetCustomAttributes(typeof(OriginalNameAttribute), false) .FirstOrDefault() as OriginalNameAttribute) @@ -898,6 +889,8 @@ private static Dictionary GetNameMapping(System.Type enumType) => enumType.GetTypeInfo().DeclaredFields .Where(f => f.IsStatic) + .Where(f => f.GetCustomAttributes() + .FirstOrDefault()?.PreferredAlias ?? true) .ToDictionary(f => f.GetValue(null), f => f.GetCustomAttributes() .FirstOrDefault() diff -Nru protobuf-3.0.0/csharp/src/Google.Protobuf/JsonParser.cs protobuf-3.6.1.3/csharp/src/Google.Protobuf/JsonParser.cs --- protobuf-3.0.0/csharp/src/Google.Protobuf/JsonParser.cs 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/csharp/src/Google.Protobuf/JsonParser.cs 2018-12-08 01:32:11.000000000 +0000 @@ -203,10 +203,14 @@ } else { - // TODO: Is this what we want to do? If not, we'll need to skip the value, - // which may be an object or array. (We might want to put code in the tokenizer - // to do that.) - throw new InvalidProtocolBufferException("Unknown field: " + name); + if (settings.IgnoreUnknownFields) + { + tokenizer.SkipValue(); + } + else + { + throw new InvalidProtocolBufferException("Unknown field: " + name); + } } } } @@ -260,11 +264,12 @@ return; } tokenizer.PushBack(token); - if (token.Type == JsonToken.TokenType.Null) + object value = ParseSingleValue(field, tokenizer); + if (value == null) { throw new InvalidProtocolBufferException("Repeated field elements cannot be null"); } - list.Add(ParseSingleValue(field, tokenizer)); + list.Add(value); } } @@ -997,6 +1002,19 @@ public TypeRegistry TypeRegistry { get; } /// + /// Whether the parser should ignore unknown fields (true) or throw an exception when + /// they are encountered (false). + /// + public bool IgnoreUnknownFields { get; } + + private Settings(int recursionLimit, TypeRegistry typeRegistry, bool ignoreUnknownFields) + { + RecursionLimit = recursionLimit; + TypeRegistry = ProtoPreconditions.CheckNotNull(typeRegistry, nameof(typeRegistry)); + IgnoreUnknownFields = ignoreUnknownFields; + } + + /// /// Creates a new object with the specified recursion limit. /// /// The maximum depth of messages to parse @@ -1009,11 +1027,34 @@ /// /// The maximum depth of messages to parse /// The type registry used to parse messages - public Settings(int recursionLimit, TypeRegistry typeRegistry) + public Settings(int recursionLimit, TypeRegistry typeRegistry) : this(recursionLimit, typeRegistry, false) { - RecursionLimit = recursionLimit; - TypeRegistry = ProtoPreconditions.CheckNotNull(typeRegistry, nameof(typeRegistry)); } + + /// + /// Creates a new object set to either ignore unknown fields, or throw an exception + /// when unknown fields are encountered. + /// + /// true if unknown fields should be ignored when parsing; false to throw an exception. + public Settings WithIgnoreUnknownFields(bool ignoreUnknownFields) => + new Settings(RecursionLimit, TypeRegistry, ignoreUnknownFields); + + /// + /// Creates a new object based on this one, but with the specified recursion limit. + /// + /// The new recursion limit. + public Settings WithRecursionLimit(int recursionLimit) => + new Settings(recursionLimit, TypeRegistry, IgnoreUnknownFields); + + /// + /// Creates a new object based on this one, but with the specified type registry. + /// + /// The new type registry. Must not be null. + public Settings WithTypeRegistry(TypeRegistry typeRegistry) => + new Settings( + RecursionLimit, + ProtoPreconditions.CheckNotNull(typeRegistry, nameof(typeRegistry)), + IgnoreUnknownFields); } } } diff -Nru protobuf-3.0.0/csharp/src/Google.Protobuf/JsonTokenizer.cs protobuf-3.6.1.3/csharp/src/Google.Protobuf/JsonTokenizer.cs --- protobuf-3.0.0/csharp/src/Google.Protobuf/JsonTokenizer.cs 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/csharp/src/Google.Protobuf/JsonTokenizer.cs 2018-12-08 01:32:11.000000000 +0000 @@ -138,6 +138,34 @@ protected abstract JsonToken NextImpl(); /// + /// Skips the value we're about to read. This must only be called immediately after reading a property name. + /// If the value is an object or an array, the complete object/array is skipped. + /// + internal void SkipValue() + { + // We'll assume that Next() makes sure that the end objects and end arrays are all valid. + // All we care about is the total nesting depth we need to close. + int depth = 0; + + // do/while rather than while loop so that we read at least one token. + do + { + var token = Next(); + switch (token.Type) + { + case JsonToken.TokenType.EndArray: + case JsonToken.TokenType.EndObject: + depth--; + break; + case JsonToken.TokenType.StartArray: + case JsonToken.TokenType.StartObject: + depth++; + break; + } + } while (depth != 0); + } + + /// /// Tokenizer which first exhausts a list of tokens, then consults another tokenizer. /// private class JsonReplayTokenizer : JsonTokenizer @@ -217,7 +245,7 @@ state = State.ObjectAfterColon; break; case ',': - ValidateState(State.ObjectAfterProperty | State.ArrayAfterValue, "Invalid state to read a colon: "); + ValidateState(State.ObjectAfterProperty | State.ArrayAfterValue, "Invalid state to read a comma: "); state = state == State.ObjectAfterProperty ? State.ObjectAfterComma : State.ArrayAfterComma; break; case '"': diff -Nru protobuf-3.0.0/csharp/src/Google.Protobuf/MessageExtensions.cs protobuf-3.6.1.3/csharp/src/Google.Protobuf/MessageExtensions.cs --- protobuf-3.0.0/csharp/src/Google.Protobuf/MessageExtensions.cs 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/csharp/src/Google.Protobuf/MessageExtensions.cs 2018-12-08 01:32:11.000000000 +0000 @@ -44,42 +44,34 @@ /// /// The message to merge the data into. /// The data to merge, which must be protobuf-encoded binary data. - public static void MergeFrom(this IMessage message, byte[] data) - { - ProtoPreconditions.CheckNotNull(message, "message"); - ProtoPreconditions.CheckNotNull(data, "data"); - CodedInputStream input = new CodedInputStream(data); - message.MergeFrom(input); - input.CheckReadEndOfStreamTag(); - } + public static void MergeFrom(this IMessage message, byte[] data) => + MergeFrom(message, data, false); + + /// + /// Merges data from the given byte array slice into an existing message. + /// + /// The message to merge the data into. + /// The data containing the slice to merge, which must be protobuf-encoded binary data. + /// The offset of the slice to merge. + /// The length of the slice to merge. + public static void MergeFrom(this IMessage message, byte[] data, int offset, int length) => + MergeFrom(message, data, offset, length, false); /// /// Merges data from the given byte string into an existing message. /// /// The message to merge the data into. /// The data to merge, which must be protobuf-encoded binary data. - public static void MergeFrom(this IMessage message, ByteString data) - { - ProtoPreconditions.CheckNotNull(message, "message"); - ProtoPreconditions.CheckNotNull(data, "data"); - CodedInputStream input = data.CreateCodedInput(); - message.MergeFrom(input); - input.CheckReadEndOfStreamTag(); - } + public static void MergeFrom(this IMessage message, ByteString data) => + MergeFrom(message, data, false); /// /// Merges data from the given stream into an existing message. /// /// The message to merge the data into. /// Stream containing the data to merge, which must be protobuf-encoded binary data. - public static void MergeFrom(this IMessage message, Stream input) - { - ProtoPreconditions.CheckNotNull(message, "message"); - ProtoPreconditions.CheckNotNull(input, "input"); - CodedInputStream codedInput = new CodedInputStream(input); - message.MergeFrom(codedInput); - codedInput.CheckReadEndOfStreamTag(); - } + public static void MergeFrom(this IMessage message, Stream input) => + MergeFrom(message, input, false); /// /// Merges length-delimited data from the given stream into an existing message. @@ -90,14 +82,8 @@ /// /// The message to merge the data into. /// Stream containing the data to merge, which must be protobuf-encoded binary data. - public static void MergeDelimitedFrom(this IMessage message, Stream input) - { - ProtoPreconditions.CheckNotNull(message, "message"); - ProtoPreconditions.CheckNotNull(input, "input"); - int size = (int) CodedInputStream.ReadRawVarint32(input); - Stream limitedStream = new LimitedInputStream(input, size); - message.MergeFrom(limitedStream); - } + public static void MergeDelimitedFrom(this IMessage message, Stream input) => + MergeDelimitedFrom(message, input, false); /// /// Converts the given message into a byte array in protobuf encoding. @@ -152,6 +138,56 @@ { ProtoPreconditions.CheckNotNull(message, "message"); return ByteString.AttachBytes(message.ToByteArray()); - } + } + + // Implementations allowing unknown fields to be discarded. + internal static void MergeFrom(this IMessage message, byte[] data, bool discardUnknownFields) + { + ProtoPreconditions.CheckNotNull(message, "message"); + ProtoPreconditions.CheckNotNull(data, "data"); + CodedInputStream input = new CodedInputStream(data); + input.DiscardUnknownFields = discardUnknownFields; + message.MergeFrom(input); + input.CheckReadEndOfStreamTag(); + } + + internal static void MergeFrom(this IMessage message, byte[] data, int offset, int length, bool discardUnknownFields) + { + ProtoPreconditions.CheckNotNull(message, "message"); + ProtoPreconditions.CheckNotNull(data, "data"); + CodedInputStream input = new CodedInputStream(data, offset, length); + input.DiscardUnknownFields = discardUnknownFields; + message.MergeFrom(input); + input.CheckReadEndOfStreamTag(); + } + + internal static void MergeFrom(this IMessage message, ByteString data, bool discardUnknownFields) + { + ProtoPreconditions.CheckNotNull(message, "message"); + ProtoPreconditions.CheckNotNull(data, "data"); + CodedInputStream input = data.CreateCodedInput(); + input.DiscardUnknownFields = discardUnknownFields; + message.MergeFrom(input); + input.CheckReadEndOfStreamTag(); + } + + internal static void MergeFrom(this IMessage message, Stream input, bool discardUnknownFields) + { + ProtoPreconditions.CheckNotNull(message, "message"); + ProtoPreconditions.CheckNotNull(input, "input"); + CodedInputStream codedInput = new CodedInputStream(input); + codedInput.DiscardUnknownFields = discardUnknownFields; + message.MergeFrom(codedInput); + codedInput.CheckReadEndOfStreamTag(); + } + + internal static void MergeDelimitedFrom(this IMessage message, Stream input, bool discardUnknownFields) + { + ProtoPreconditions.CheckNotNull(message, "message"); + ProtoPreconditions.CheckNotNull(input, "input"); + int size = (int) CodedInputStream.ReadRawVarint32(input); + Stream limitedStream = new LimitedInputStream(input, size); + MergeFrom(message, limitedStream, discardUnknownFields); + } } } diff -Nru protobuf-3.0.0/csharp/src/Google.Protobuf/MessageParser.cs protobuf-3.6.1.3/csharp/src/Google.Protobuf/MessageParser.cs --- protobuf-3.0.0/csharp/src/Google.Protobuf/MessageParser.cs 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/csharp/src/Google.Protobuf/MessageParser.cs 2018-12-08 01:32:11.000000000 +0000 @@ -42,10 +42,13 @@ public class MessageParser { private Func factory; + // TODO: When we use a C# 7.1 compiler, make this private protected. + internal bool DiscardUnknownFields { get; } - internal MessageParser(Func factory) + internal MessageParser(Func factory, bool discardUnknownFields) { this.factory = factory; + DiscardUnknownFields = discardUnknownFields; } /// @@ -64,9 +67,22 @@ /// The newly parsed message. public IMessage ParseFrom(byte[] data) { - ProtoPreconditions.CheckNotNull(data, "data"); IMessage message = factory(); - message.MergeFrom(data); + message.MergeFrom(data, DiscardUnknownFields); + return message; + } + + /// + /// Parses a message from a byte array slice. + /// + /// The byte array containing the message. Must not be null. + /// The offset of the slice to parse. + /// The length of the slice to parse. + /// The newly parsed message. + public IMessage ParseFrom(byte[] data, int offset, int length) + { + IMessage message = factory(); + message.MergeFrom(data, offset, length, DiscardUnknownFields); return message; } @@ -77,9 +93,8 @@ /// The parsed message. public IMessage ParseFrom(ByteString data) { - ProtoPreconditions.CheckNotNull(data, "data"); IMessage message = factory(); - message.MergeFrom(data); + message.MergeFrom(data, DiscardUnknownFields); return message; } @@ -91,7 +106,7 @@ public IMessage ParseFrom(Stream input) { IMessage message = factory(); - message.MergeFrom(input); + message.MergeFrom(input, DiscardUnknownFields); return message; } @@ -107,7 +122,7 @@ public IMessage ParseDelimitedFrom(Stream input) { IMessage message = factory(); - message.MergeDelimitedFrom(input); + message.MergeDelimitedFrom(input, DiscardUnknownFields); return message; } @@ -119,7 +134,7 @@ public IMessage ParseFrom(CodedInputStream input) { IMessage message = factory(); - message.MergeFrom(input); + MergeFrom(message, input); return message; } @@ -136,6 +151,29 @@ JsonParser.Default.Merge(message, json); return message; } + + // TODO: When we're using a C# 7.1 compiler, make this private protected. + internal void MergeFrom(IMessage message, CodedInputStream codedInput) + { + bool originalDiscard = codedInput.DiscardUnknownFields; + try + { + codedInput.DiscardUnknownFields = DiscardUnknownFields; + message.MergeFrom(codedInput); + } + finally + { + codedInput.DiscardUnknownFields = originalDiscard; + } + } + + /// + /// Creates a new message parser which optionally discards unknown fields when parsing. + /// + /// Whether or not to discard unknown fields when parsing. + /// A newly configured message parser. + public MessageParser WithDiscardUnknownFields(bool discardUnknownFields) => + new MessageParser(factory, discardUnknownFields); } /// @@ -170,7 +208,11 @@ /// to require a parameterless constructor: delegates are significantly faster to execute. /// /// Function to invoke when a new, empty message is required. - public MessageParser(Func factory) : base(() => factory()) + public MessageParser(Func factory) : this(factory, false) + { + } + + internal MessageParser(Func factory, bool discardUnknownFields) : base(() => factory(), discardUnknownFields) { this.factory = factory; } @@ -191,9 +233,22 @@ /// The newly parsed message. public new T ParseFrom(byte[] data) { - ProtoPreconditions.CheckNotNull(data, "data"); T message = factory(); - message.MergeFrom(data); + message.MergeFrom(data, DiscardUnknownFields); + return message; + } + + /// + /// Parses a message from a byte array slice. + /// + /// The byte array containing the message. Must not be null. + /// The offset of the slice to parse. + /// The length of the slice to parse. + /// The newly parsed message. + public new T ParseFrom(byte[] data, int offset, int length) + { + T message = factory(); + message.MergeFrom(data, offset, length, DiscardUnknownFields); return message; } @@ -204,9 +259,8 @@ /// The parsed message. public new T ParseFrom(ByteString data) { - ProtoPreconditions.CheckNotNull(data, "data"); T message = factory(); - message.MergeFrom(data); + message.MergeFrom(data, DiscardUnknownFields); return message; } @@ -218,7 +272,7 @@ public new T ParseFrom(Stream input) { T message = factory(); - message.MergeFrom(input); + message.MergeFrom(input, DiscardUnknownFields); return message; } @@ -234,7 +288,7 @@ public new T ParseDelimitedFrom(Stream input) { T message = factory(); - message.MergeDelimitedFrom(input); + message.MergeDelimitedFrom(input, DiscardUnknownFields); return message; } @@ -246,7 +300,7 @@ public new T ParseFrom(CodedInputStream input) { T message = factory(); - message.MergeFrom(input); + MergeFrom(message, input); return message; } @@ -263,5 +317,13 @@ JsonParser.Default.Merge(message, json); return message; } + + /// + /// Creates a new message parser which optionally discards unknown fields when parsing. + /// + /// Whether or not to discard unknown fields when parsing. + /// A newly configured message parser. + public new MessageParser WithDiscardUnknownFields(bool discardUnknownFields) => + new MessageParser(factory, discardUnknownFields); } } diff -Nru protobuf-3.0.0/csharp/src/Google.Protobuf/project.json protobuf-3.6.1.3/csharp/src/Google.Protobuf/project.json --- protobuf-3.0.0/csharp/src/Google.Protobuf/project.json 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/csharp/src/Google.Protobuf/project.json 1970-01-01 00:00:00.000000000 +0000 @@ -1,65 +0,0 @@ -{ - "version": "3.0.0", - "title": "Google Protocol Buffers", - "description": "See project site for more info.", - "authors": [ "Google Inc." ], - "copyright": "Copyright 2015, Google Inc.", - - "packOptions": { - "summary": "C# runtime library for Protocol Buffers - Google's data interchange format.", - "tags": [ "Protocol", "Buffers", "Binary", "Serialization", "Format", "Google", "proto", "proto3" ], - "owners": [ "protobuf-packages" ], - "licenseUrl": "https://github.com/google/protobuf/blob/master/LICENSE", - "projectUrl": "https://github.com/google/protobuf", - "releaseNotes": "C# proto3 support", - "requireLicenseAcceptance": false, - "repository": { - "url": "https://github.com/nodatime/nodatime.git" - } - }, - - "buildOptions": { - "debugType": "portable", - "keyFile": "../../keys/Google.Protobuf.snk", - "xmlDoc": true - }, - - "configurations": { - "Debug": { - "buildOptions": { - "define": [ "DEBUG", "TRACE" ] - } - }, - "Release": { - "buildOptions": { - "define": [ "RELEASE", "TRACE" ], - "optimize": true - } - } - }, - - "frameworks": { - // This target allows the package to be installed in a .NET 4.5+ - // project without asking for myriad other dependencies. - "net45": { - }, - "netstandard1.0": { - "dependencies": { - "System.Collections": "4.0.11", - "System.Diagnostics.Debug": "4.0.11", - "System.Globalization": "4.0.11", - "System.IO": "4.1.0", - "System.Linq": "4.1.0", - "System.Linq.Expressions": "4.1.0", - "System.ObjectModel": "4.0.12", - "System.Reflection": "4.1.0", - "System.Reflection.Extensions": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Text.Encoding": "4.0.11", - "System.Text.RegularExpressions": "4.1.0", - "System.Threading": "4.0.11" - } - } - } -} diff -Nru protobuf-3.0.0/csharp/src/Google.Protobuf/Reflection/CustomOptions.cs protobuf-3.6.1.3/csharp/src/Google.Protobuf/Reflection/CustomOptions.cs --- protobuf-3.0.0/csharp/src/Google.Protobuf/Reflection/CustomOptions.cs 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/csharp/src/Google.Protobuf/Reflection/CustomOptions.cs 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,390 @@ +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2017 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using System; +using System.Collections.Generic; + +namespace Google.Protobuf.Reflection +{ + /// + /// Container for a set of custom options specified within a message, field etc. + /// + /// + /// + /// This type is publicly immutable, but internally mutable. It is only populated + /// by the descriptor parsing code - by the time any user code is able to see an instance, + /// it will be fully initialized. + /// + /// + /// If an option is requested using the incorrect method, an answer may still be returned: all + /// of the numeric types are represented internally using 64-bit integers, for example. It is up to + /// the caller to ensure that they make the appropriate method call for the option they're interested in. + /// Note that enum options are simply stored as integers, so the value should be fetched using + /// and then cast appropriately. + /// + /// + /// Repeated options are currently not supported. Asking for a single value of an option + /// which was actually repeated will return the last value, except for message types where + /// all the set values are merged together. + /// + /// + public sealed class CustomOptions + { + /// + /// Singleton for all descriptors with an empty set of options. + /// + internal static readonly CustomOptions Empty = new CustomOptions(); + + /// + /// A sequence of values per field. This needs to be per field rather than per tag to allow correct deserialization + /// of repeated fields which could be "int, ByteString, int" - unlikely as that is. The fact that values are boxed + /// is unfortunate; we might be able to use a struct instead, and we could combine uint and ulong values. + /// + private readonly Dictionary> valuesByField = new Dictionary>(); + + private CustomOptions() { } + + /// + /// Retrieves a Boolean value for the specified option field. + /// + /// The field to fetch the value for. + /// The output variable to populate. + /// true if a suitable value for the field was found; false otherwise. + public bool TryGetBool(int field, out bool value) + { + ulong? tmp = GetLastNumericValue(field); + value = tmp == 1UL; + return tmp != null; + } + + /// + /// Retrieves a signed 32-bit integer value for the specified option field. + /// + /// The field to fetch the value for. + /// The output variable to populate. + /// true if a suitable value for the field was found; false otherwise. + public bool TryGetInt32(int field, out int value) + { + ulong? tmp = GetLastNumericValue(field); + value = (int) tmp.GetValueOrDefault(); + return tmp != null; + } + + /// + /// Retrieves a signed 64-bit integer value for the specified option field. + /// + /// The field to fetch the value for. + /// The output variable to populate. + /// true if a suitable value for the field was found; false otherwise. + public bool TryGetInt64(int field, out long value) + { + ulong? tmp = GetLastNumericValue(field); + value = (long) tmp.GetValueOrDefault(); + return tmp != null; + } + + /// + /// Retrieves an unsigned 32-bit integer value for the specified option field, + /// assuming a fixed-length representation. + /// + /// The field to fetch the value for. + /// The output variable to populate. + /// true if a suitable value for the field was found; false otherwise. + public bool TryGetFixed32(int field, out uint value) => TryGetUInt32(field, out value); + + /// + /// Retrieves an unsigned 64-bit integer value for the specified option field, + /// assuming a fixed-length representation. + /// + /// The field to fetch the value for. + /// The output variable to populate. + /// true if a suitable value for the field was found; false otherwise. + public bool TryGetFixed64(int field, out ulong value) => TryGetUInt64(field, out value); + + /// + /// Retrieves a signed 32-bit integer value for the specified option field, + /// assuming a fixed-length representation. + /// + /// The field to fetch the value for. + /// The output variable to populate. + /// true if a suitable value for the field was found; false otherwise. + public bool TryGetSFixed32(int field, out int value) => TryGetInt32(field, out value); + + /// + /// Retrieves a signed 64-bit integer value for the specified option field, + /// assuming a fixed-length representation. + /// + /// The field to fetch the value for. + /// The output variable to populate. + /// true if a suitable value for the field was found; false otherwise. + public bool TryGetSFixed64(int field, out long value) => TryGetInt64(field, out value); + + /// + /// Retrieves a signed 32-bit integer value for the specified option field, + /// assuming a zigzag encoding. + /// + /// The field to fetch the value for. + /// The output variable to populate. + /// true if a suitable value for the field was found; false otherwise. + public bool TryGetSInt32(int field, out int value) + { + ulong? tmp = GetLastNumericValue(field); + value = CodedInputStream.DecodeZigZag32((uint) tmp.GetValueOrDefault()); + return tmp != null; + } + + /// + /// Retrieves a signed 64-bit integer value for the specified option field, + /// assuming a zigzag encoding. + /// + /// The field to fetch the value for. + /// The output variable to populate. + /// true if a suitable value for the field was found; false otherwise. + public bool TryGetSInt64(int field, out long value) + { + ulong? tmp = GetLastNumericValue(field); + value = CodedInputStream.DecodeZigZag64(tmp.GetValueOrDefault()); + return tmp != null; + } + + /// + /// Retrieves an unsigned 32-bit integer value for the specified option field. + /// + /// The field to fetch the value for. + /// The output variable to populate. + /// true if a suitable value for the field was found; false otherwise. + public bool TryGetUInt32(int field, out uint value) + { + ulong? tmp = GetLastNumericValue(field); + value = (uint) tmp.GetValueOrDefault(); + return tmp != null; + } + + /// + /// Retrieves an unsigned 64-bit integer value for the specified option field. + /// + /// The field to fetch the value for. + /// The output variable to populate. + /// true if a suitable value for the field was found; false otherwise. + public bool TryGetUInt64(int field, out ulong value) + { + ulong? tmp = GetLastNumericValue(field); + value = tmp.GetValueOrDefault(); + return tmp != null; + } + + /// + /// Retrieves a 32-bit floating point value for the specified option field. + /// + /// The field to fetch the value for. + /// The output variable to populate. + /// true if a suitable value for the field was found; false otherwise. + public bool TryGetFloat(int field, out float value) + { + ulong? tmp = GetLastNumericValue(field); + int int32 = (int) tmp.GetValueOrDefault(); + byte[] bytes = BitConverter.GetBytes(int32); + value = BitConverter.ToSingle(bytes, 0); + return tmp != null; + } + + /// + /// Retrieves a 64-bit floating point value for the specified option field. + /// + /// The field to fetch the value for. + /// The output variable to populate. + /// true if a suitable value for the field was found; false otherwise. + public bool TryGetDouble(int field, out double value) + { + ulong? tmp = GetLastNumericValue(field); + value = BitConverter.Int64BitsToDouble((long) tmp.GetValueOrDefault()); + return tmp != null; + } + + /// + /// Retrieves a string value for the specified option field. + /// + /// The field to fetch the value for. + /// The output variable to populate. + /// true if a suitable value for the field was found; false otherwise. + public bool TryGetString(int field, out string value) + { + ByteString bytes = GetLastByteStringValue(field); + value = bytes?.ToStringUtf8(); + return bytes != null; + } + + /// + /// Retrieves a bytes value for the specified option field. + /// + /// The field to fetch the value for. + /// The output variable to populate. + /// true if a suitable value for the field was found; false otherwise. + public bool TryGetBytes(int field, out ByteString value) + { + ByteString bytes = GetLastByteStringValue(field); + value = bytes; + return bytes != null; + } + + /// + /// Retrieves a message value for the specified option field. + /// + /// The field to fetch the value for. + /// The output variable to populate. + /// true if a suitable value for the field was found; false otherwise. + public bool TryGetMessage(int field, out T value) where T : class, IMessage, new() + { + value = null; + List values; + if (!valuesByField.TryGetValue(field, out values)) + { + return false; + } + foreach (FieldValue fieldValue in values) + { + if (fieldValue.ByteString != null) + { + if (value == null) + { + value = new T(); + } + value.MergeFrom(fieldValue.ByteString); + } + } + return value != null; + } + + private ulong? GetLastNumericValue(int field) + { + List values; + if (!valuesByField.TryGetValue(field, out values)) + { + return null; + } + for (int i = values.Count - 1; i >= 0; i--) + { + // A non-bytestring value is a numeric value + if (values[i].ByteString == null) + { + return values[i].Number; + } + } + return null; + } + + private ByteString GetLastByteStringValue(int field) + { + List values; + if (!valuesByField.TryGetValue(field, out values)) + { + return null; + } + for (int i = values.Count - 1; i >= 0; i--) + { + if (values[i].ByteString != null) + { + return values[i].ByteString; + } + } + return null; + } + + /// + /// Reads an unknown field, either parsing it and storing it or skipping it. + /// + /// + /// If the current set of options is empty and we manage to read a field, a new set of options + /// will be created and returned. Otherwise, the return value is this. This allows + /// us to start with a singleton empty set of options and just create new ones where necessary. + /// + /// Input stream to read from. + /// The resulting set of custom options, either this or a new set. + internal CustomOptions ReadOrSkipUnknownField(CodedInputStream input) + { + var tag = input.LastTag; + var field = WireFormat.GetTagFieldNumber(tag); + switch (WireFormat.GetTagWireType(tag)) + { + case WireFormat.WireType.LengthDelimited: + return AddValue(field, new FieldValue(input.ReadBytes())); + case WireFormat.WireType.Fixed32: + return AddValue(field, new FieldValue(input.ReadFixed32())); + case WireFormat.WireType.Fixed64: + return AddValue(field, new FieldValue(input.ReadFixed64())); + case WireFormat.WireType.Varint: + return AddValue(field, new FieldValue(input.ReadRawVarint64())); + // For StartGroup, EndGroup or any wire format we don't understand, + // just use the normal behavior (call SkipLastField). + default: + input.SkipLastField(); + return this; + } + } + + private CustomOptions AddValue(int field, FieldValue value) + { + var ret = valuesByField.Count == 0 ? new CustomOptions() : this; + List valuesForField; + if (!ret.valuesByField.TryGetValue(field, out valuesForField)) + { + // Expect almost all + valuesForField = new List(1); + ret.valuesByField[field] = valuesForField; + } + valuesForField.Add(value); + return ret; + } + + /// + /// All field values can be stored as a byte string or a 64-bit integer. + /// This struct avoids unnecessary boxing. + /// + private struct FieldValue + { + internal ulong Number { get; } + internal ByteString ByteString { get; } + + internal FieldValue(ulong number) + { + Number = number; + ByteString = null; + } + + internal FieldValue(ByteString byteString) + { + Number = 0; + ByteString = byteString; + } + } + } +} diff -Nru protobuf-3.0.0/csharp/src/Google.Protobuf/Reflection/Descriptor.cs protobuf-3.6.1.3/csharp/src/Google.Protobuf/Reflection/Descriptor.cs --- protobuf-3.0.0/csharp/src/Google.Protobuf/Reflection/Descriptor.cs 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/csharp/src/Google.Protobuf/Reflection/Descriptor.cs 2018-12-08 01:32:11.000000000 +0000 @@ -1,5 +1,7 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/protobuf/descriptor.proto +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/protobuf/descriptor.proto +// #pragma warning disable 1591, 0612, 3021 #region Designer generated code @@ -35,7 +37,7 @@ "LnByb3RvYnVmLkZpZWxkRGVzY3JpcHRvclByb3RvEi0KB29wdGlvbnMYCCAB", "KAsyHC5nb29nbGUucHJvdG9idWYuRmlsZU9wdGlvbnMSOQoQc291cmNlX2Nv", "ZGVfaW5mbxgJIAEoCzIfLmdvb2dsZS5wcm90b2J1Zi5Tb3VyY2VDb2RlSW5m", - "bxIOCgZzeW50YXgYDCABKAki8AQKD0Rlc2NyaXB0b3JQcm90bxIMCgRuYW1l", + "bxIOCgZzeW50YXgYDCABKAkiqQUKD0Rlc2NyaXB0b3JQcm90bxIMCgRuYW1l", "GAEgASgJEjQKBWZpZWxkGAIgAygLMiUuZ29vZ2xlLnByb3RvYnVmLkZpZWxk", "RGVzY3JpcHRvclByb3RvEjgKCWV4dGVuc2lvbhgGIAMoCzIlLmdvb2dsZS5w", "cm90b2J1Zi5GaWVsZERlc2NyaXB0b3JQcm90bxI1CgtuZXN0ZWRfdHlwZRgD", @@ -47,120 +49,137 @@ "b3RvEjAKB29wdGlvbnMYByABKAsyHy5nb29nbGUucHJvdG9idWYuTWVzc2Fn", "ZU9wdGlvbnMSRgoOcmVzZXJ2ZWRfcmFuZ2UYCSADKAsyLi5nb29nbGUucHJv", "dG9idWYuRGVzY3JpcHRvclByb3RvLlJlc2VydmVkUmFuZ2USFQoNcmVzZXJ2", - "ZWRfbmFtZRgKIAMoCRosCg5FeHRlbnNpb25SYW5nZRINCgVzdGFydBgBIAEo", - "BRILCgNlbmQYAiABKAUaKwoNUmVzZXJ2ZWRSYW5nZRINCgVzdGFydBgBIAEo", - "BRILCgNlbmQYAiABKAUivAUKFEZpZWxkRGVzY3JpcHRvclByb3RvEgwKBG5h", - "bWUYASABKAkSDgoGbnVtYmVyGAMgASgFEjoKBWxhYmVsGAQgASgOMisuZ29v", - "Z2xlLnByb3RvYnVmLkZpZWxkRGVzY3JpcHRvclByb3RvLkxhYmVsEjgKBHR5", - "cGUYBSABKA4yKi5nb29nbGUucHJvdG9idWYuRmllbGREZXNjcmlwdG9yUHJv", - "dG8uVHlwZRIRCgl0eXBlX25hbWUYBiABKAkSEAoIZXh0ZW5kZWUYAiABKAkS", - "FQoNZGVmYXVsdF92YWx1ZRgHIAEoCRITCgtvbmVvZl9pbmRleBgJIAEoBRIR", - "Cglqc29uX25hbWUYCiABKAkSLgoHb3B0aW9ucxgIIAEoCzIdLmdvb2dsZS5w", - "cm90b2J1Zi5GaWVsZE9wdGlvbnMitgIKBFR5cGUSDwoLVFlQRV9ET1VCTEUQ", - "ARIOCgpUWVBFX0ZMT0FUEAISDgoKVFlQRV9JTlQ2NBADEg8KC1RZUEVfVUlO", - "VDY0EAQSDgoKVFlQRV9JTlQzMhAFEhAKDFRZUEVfRklYRUQ2NBAGEhAKDFRZ", - "UEVfRklYRUQzMhAHEg0KCVRZUEVfQk9PTBAIEg8KC1RZUEVfU1RSSU5HEAkS", - "DgoKVFlQRV9HUk9VUBAKEhAKDFRZUEVfTUVTU0FHRRALEg4KClRZUEVfQllU", - "RVMQDBIPCgtUWVBFX1VJTlQzMhANEg0KCVRZUEVfRU5VTRAOEhEKDVRZUEVf", - "U0ZJWEVEMzIQDxIRCg1UWVBFX1NGSVhFRDY0EBASDwoLVFlQRV9TSU5UMzIQ", - "ERIPCgtUWVBFX1NJTlQ2NBASIkMKBUxhYmVsEhIKDkxBQkVMX09QVElPTkFM", - "EAESEgoOTEFCRUxfUkVRVUlSRUQQAhISCg5MQUJFTF9SRVBFQVRFRBADIlQK", - "FE9uZW9mRGVzY3JpcHRvclByb3RvEgwKBG5hbWUYASABKAkSLgoHb3B0aW9u", - "cxgCIAEoCzIdLmdvb2dsZS5wcm90b2J1Zi5PbmVvZk9wdGlvbnMijAEKE0Vu", - "dW1EZXNjcmlwdG9yUHJvdG8SDAoEbmFtZRgBIAEoCRI4CgV2YWx1ZRgCIAMo", - "CzIpLmdvb2dsZS5wcm90b2J1Zi5FbnVtVmFsdWVEZXNjcmlwdG9yUHJvdG8S", - "LQoHb3B0aW9ucxgDIAEoCzIcLmdvb2dsZS5wcm90b2J1Zi5FbnVtT3B0aW9u", - "cyJsChhFbnVtVmFsdWVEZXNjcmlwdG9yUHJvdG8SDAoEbmFtZRgBIAEoCRIO", - "CgZudW1iZXIYAiABKAUSMgoHb3B0aW9ucxgDIAEoCzIhLmdvb2dsZS5wcm90", - "b2J1Zi5FbnVtVmFsdWVPcHRpb25zIpABChZTZXJ2aWNlRGVzY3JpcHRvclBy", - "b3RvEgwKBG5hbWUYASABKAkSNgoGbWV0aG9kGAIgAygLMiYuZ29vZ2xlLnBy", - "b3RvYnVmLk1ldGhvZERlc2NyaXB0b3JQcm90bxIwCgdvcHRpb25zGAMgASgL", - "Mh8uZ29vZ2xlLnByb3RvYnVmLlNlcnZpY2VPcHRpb25zIsEBChVNZXRob2RE", - "ZXNjcmlwdG9yUHJvdG8SDAoEbmFtZRgBIAEoCRISCgppbnB1dF90eXBlGAIg", - "ASgJEhMKC291dHB1dF90eXBlGAMgASgJEi8KB29wdGlvbnMYBCABKAsyHi5n", - "b29nbGUucHJvdG9idWYuTWV0aG9kT3B0aW9ucxIfChBjbGllbnRfc3RyZWFt", - "aW5nGAUgASgIOgVmYWxzZRIfChBzZXJ2ZXJfc3RyZWFtaW5nGAYgASgIOgVm", - "YWxzZSKHBQoLRmlsZU9wdGlvbnMSFAoMamF2YV9wYWNrYWdlGAEgASgJEhwK", - "FGphdmFfb3V0ZXJfY2xhc3NuYW1lGAggASgJEiIKE2phdmFfbXVsdGlwbGVf", - "ZmlsZXMYCiABKAg6BWZhbHNlEiwKHWphdmFfZ2VuZXJhdGVfZXF1YWxzX2Fu", - "ZF9oYXNoGBQgASgIOgVmYWxzZRIlChZqYXZhX3N0cmluZ19jaGVja191dGY4", - "GBsgASgIOgVmYWxzZRJGCgxvcHRpbWl6ZV9mb3IYCSABKA4yKS5nb29nbGUu", - "cHJvdG9idWYuRmlsZU9wdGlvbnMuT3B0aW1pemVNb2RlOgVTUEVFRBISCgpn", - "b19wYWNrYWdlGAsgASgJEiIKE2NjX2dlbmVyaWNfc2VydmljZXMYECABKAg6", - "BWZhbHNlEiQKFWphdmFfZ2VuZXJpY19zZXJ2aWNlcxgRIAEoCDoFZmFsc2US", - "IgoTcHlfZ2VuZXJpY19zZXJ2aWNlcxgSIAEoCDoFZmFsc2USGQoKZGVwcmVj", - "YXRlZBgXIAEoCDoFZmFsc2USHwoQY2NfZW5hYmxlX2FyZW5hcxgfIAEoCDoF", - "ZmFsc2USGQoRb2JqY19jbGFzc19wcmVmaXgYJCABKAkSGAoQY3NoYXJwX25h", - "bWVzcGFjZRglIAEoCRJDChR1bmludGVycHJldGVkX29wdGlvbhjnByADKAsy", - "JC5nb29nbGUucHJvdG9idWYuVW5pbnRlcnByZXRlZE9wdGlvbiI6CgxPcHRp", - "bWl6ZU1vZGUSCQoFU1BFRUQQARINCglDT0RFX1NJWkUQAhIQCgxMSVRFX1JV", - "TlRJTUUQAyoJCOgHEICAgIACSgQIJhAnIuYBCg5NZXNzYWdlT3B0aW9ucxIm", - "ChdtZXNzYWdlX3NldF93aXJlX2Zvcm1hdBgBIAEoCDoFZmFsc2USLgofbm9f", - "c3RhbmRhcmRfZGVzY3JpcHRvcl9hY2Nlc3NvchgCIAEoCDoFZmFsc2USGQoK", - "ZGVwcmVjYXRlZBgDIAEoCDoFZmFsc2USEQoJbWFwX2VudHJ5GAcgASgIEkMK", - "FHVuaW50ZXJwcmV0ZWRfb3B0aW9uGOcHIAMoCzIkLmdvb2dsZS5wcm90b2J1", - "Zi5VbmludGVycHJldGVkT3B0aW9uKgkI6AcQgICAgAIimAMKDEZpZWxkT3B0", - "aW9ucxI6CgVjdHlwZRgBIAEoDjIjLmdvb2dsZS5wcm90b2J1Zi5GaWVsZE9w", - "dGlvbnMuQ1R5cGU6BlNUUklORxIOCgZwYWNrZWQYAiABKAgSPwoGanN0eXBl", - "GAYgASgOMiQuZ29vZ2xlLnByb3RvYnVmLkZpZWxkT3B0aW9ucy5KU1R5cGU6", - "CUpTX05PUk1BTBITCgRsYXp5GAUgASgIOgVmYWxzZRIZCgpkZXByZWNhdGVk", - "GAMgASgIOgVmYWxzZRITCgR3ZWFrGAogASgIOgVmYWxzZRJDChR1bmludGVy", - "cHJldGVkX29wdGlvbhjnByADKAsyJC5nb29nbGUucHJvdG9idWYuVW5pbnRl", - "cnByZXRlZE9wdGlvbiIvCgVDVHlwZRIKCgZTVFJJTkcQABIICgRDT1JEEAES", - "EAoMU1RSSU5HX1BJRUNFEAIiNQoGSlNUeXBlEg0KCUpTX05PUk1BTBAAEg0K", - "CUpTX1NUUklORxABEg0KCUpTX05VTUJFUhACKgkI6AcQgICAgAIiXgoMT25l", - "b2ZPcHRpb25zEkMKFHVuaW50ZXJwcmV0ZWRfb3B0aW9uGOcHIAMoCzIkLmdv", - "b2dsZS5wcm90b2J1Zi5VbmludGVycHJldGVkT3B0aW9uKgkI6AcQgICAgAIi", - "jQEKC0VudW1PcHRpb25zEhMKC2FsbG93X2FsaWFzGAIgASgIEhkKCmRlcHJl", - "Y2F0ZWQYAyABKAg6BWZhbHNlEkMKFHVuaW50ZXJwcmV0ZWRfb3B0aW9uGOcH", - "IAMoCzIkLmdvb2dsZS5wcm90b2J1Zi5VbmludGVycHJldGVkT3B0aW9uKgkI", - "6AcQgICAgAIifQoQRW51bVZhbHVlT3B0aW9ucxIZCgpkZXByZWNhdGVkGAEg", - "ASgIOgVmYWxzZRJDChR1bmludGVycHJldGVkX29wdGlvbhjnByADKAsyJC5n", - "b29nbGUucHJvdG9idWYuVW5pbnRlcnByZXRlZE9wdGlvbioJCOgHEICAgIAC", - "InsKDlNlcnZpY2VPcHRpb25zEhkKCmRlcHJlY2F0ZWQYISABKAg6BWZhbHNl", - "EkMKFHVuaW50ZXJwcmV0ZWRfb3B0aW9uGOcHIAMoCzIkLmdvb2dsZS5wcm90", - "b2J1Zi5VbmludGVycHJldGVkT3B0aW9uKgkI6AcQgICAgAIiegoNTWV0aG9k", - "T3B0aW9ucxIZCgpkZXByZWNhdGVkGCEgASgIOgVmYWxzZRJDChR1bmludGVy", - "cHJldGVkX29wdGlvbhjnByADKAsyJC5nb29nbGUucHJvdG9idWYuVW5pbnRl", - "cnByZXRlZE9wdGlvbioJCOgHEICAgIACIp4CChNVbmludGVycHJldGVkT3B0", - "aW9uEjsKBG5hbWUYAiADKAsyLS5nb29nbGUucHJvdG9idWYuVW5pbnRlcnBy", - "ZXRlZE9wdGlvbi5OYW1lUGFydBIYChBpZGVudGlmaWVyX3ZhbHVlGAMgASgJ", - "EhoKEnBvc2l0aXZlX2ludF92YWx1ZRgEIAEoBBIaChJuZWdhdGl2ZV9pbnRf", - "dmFsdWUYBSABKAMSFAoMZG91YmxlX3ZhbHVlGAYgASgBEhQKDHN0cmluZ192", - "YWx1ZRgHIAEoDBIXCg9hZ2dyZWdhdGVfdmFsdWUYCCABKAkaMwoITmFtZVBh", - "cnQSEQoJbmFtZV9wYXJ0GAEgAigJEhQKDGlzX2V4dGVuc2lvbhgCIAIoCCLV", - "AQoOU291cmNlQ29kZUluZm8SOgoIbG9jYXRpb24YASADKAsyKC5nb29nbGUu", - "cHJvdG9idWYuU291cmNlQ29kZUluZm8uTG9jYXRpb24ahgEKCExvY2F0aW9u", - "EhAKBHBhdGgYASADKAVCAhABEhAKBHNwYW4YAiADKAVCAhABEhgKEGxlYWRp", - "bmdfY29tbWVudHMYAyABKAkSGQoRdHJhaWxpbmdfY29tbWVudHMYBCABKAkS", - "IQoZbGVhZGluZ19kZXRhY2hlZF9jb21tZW50cxgGIAMoCSKnAQoRR2VuZXJh", - "dGVkQ29kZUluZm8SQQoKYW5ub3RhdGlvbhgBIAMoCzItLmdvb2dsZS5wcm90", - "b2J1Zi5HZW5lcmF0ZWRDb2RlSW5mby5Bbm5vdGF0aW9uGk8KCkFubm90YXRp", - "b24SEAoEcGF0aBgBIAMoBUICEAESEwoLc291cmNlX2ZpbGUYAiABKAkSDQoF", - "YmVnaW4YAyABKAUSCwoDZW5kGAQgASgFQlsKE2NvbS5nb29nbGUucHJvdG9i", - "dWZCEERlc2NyaXB0b3JQcm90b3NIAVoKZGVzY3JpcHRvcqABAaICA0dQQqoC", - "Gkdvb2dsZS5Qcm90b2J1Zi5SZWZsZWN0aW9u")); + "ZWRfbmFtZRgKIAMoCRplCg5FeHRlbnNpb25SYW5nZRINCgVzdGFydBgBIAEo", + "BRILCgNlbmQYAiABKAUSNwoHb3B0aW9ucxgDIAEoCzImLmdvb2dsZS5wcm90", + "b2J1Zi5FeHRlbnNpb25SYW5nZU9wdGlvbnMaKwoNUmVzZXJ2ZWRSYW5nZRIN", + "CgVzdGFydBgBIAEoBRILCgNlbmQYAiABKAUiZwoVRXh0ZW5zaW9uUmFuZ2VP", + "cHRpb25zEkMKFHVuaW50ZXJwcmV0ZWRfb3B0aW9uGOcHIAMoCzIkLmdvb2ds", + "ZS5wcm90b2J1Zi5VbmludGVycHJldGVkT3B0aW9uKgkI6AcQgICAgAIivAUK", + "FEZpZWxkRGVzY3JpcHRvclByb3RvEgwKBG5hbWUYASABKAkSDgoGbnVtYmVy", + "GAMgASgFEjoKBWxhYmVsGAQgASgOMisuZ29vZ2xlLnByb3RvYnVmLkZpZWxk", + "RGVzY3JpcHRvclByb3RvLkxhYmVsEjgKBHR5cGUYBSABKA4yKi5nb29nbGUu", + "cHJvdG9idWYuRmllbGREZXNjcmlwdG9yUHJvdG8uVHlwZRIRCgl0eXBlX25h", + "bWUYBiABKAkSEAoIZXh0ZW5kZWUYAiABKAkSFQoNZGVmYXVsdF92YWx1ZRgH", + "IAEoCRITCgtvbmVvZl9pbmRleBgJIAEoBRIRCglqc29uX25hbWUYCiABKAkS", + "LgoHb3B0aW9ucxgIIAEoCzIdLmdvb2dsZS5wcm90b2J1Zi5GaWVsZE9wdGlv", + "bnMitgIKBFR5cGUSDwoLVFlQRV9ET1VCTEUQARIOCgpUWVBFX0ZMT0FUEAIS", + "DgoKVFlQRV9JTlQ2NBADEg8KC1RZUEVfVUlOVDY0EAQSDgoKVFlQRV9JTlQz", + "MhAFEhAKDFRZUEVfRklYRUQ2NBAGEhAKDFRZUEVfRklYRUQzMhAHEg0KCVRZ", + "UEVfQk9PTBAIEg8KC1RZUEVfU1RSSU5HEAkSDgoKVFlQRV9HUk9VUBAKEhAK", + "DFRZUEVfTUVTU0FHRRALEg4KClRZUEVfQllURVMQDBIPCgtUWVBFX1VJTlQz", + "MhANEg0KCVRZUEVfRU5VTRAOEhEKDVRZUEVfU0ZJWEVEMzIQDxIRCg1UWVBF", + "X1NGSVhFRDY0EBASDwoLVFlQRV9TSU5UMzIQERIPCgtUWVBFX1NJTlQ2NBAS", + "IkMKBUxhYmVsEhIKDkxBQkVMX09QVElPTkFMEAESEgoOTEFCRUxfUkVRVUlS", + "RUQQAhISCg5MQUJFTF9SRVBFQVRFRBADIlQKFE9uZW9mRGVzY3JpcHRvclBy", + "b3RvEgwKBG5hbWUYASABKAkSLgoHb3B0aW9ucxgCIAEoCzIdLmdvb2dsZS5w", + "cm90b2J1Zi5PbmVvZk9wdGlvbnMipAIKE0VudW1EZXNjcmlwdG9yUHJvdG8S", + "DAoEbmFtZRgBIAEoCRI4CgV2YWx1ZRgCIAMoCzIpLmdvb2dsZS5wcm90b2J1", + "Zi5FbnVtVmFsdWVEZXNjcmlwdG9yUHJvdG8SLQoHb3B0aW9ucxgDIAEoCzIc", + "Lmdvb2dsZS5wcm90b2J1Zi5FbnVtT3B0aW9ucxJOCg5yZXNlcnZlZF9yYW5n", + "ZRgEIAMoCzI2Lmdvb2dsZS5wcm90b2J1Zi5FbnVtRGVzY3JpcHRvclByb3Rv", + "LkVudW1SZXNlcnZlZFJhbmdlEhUKDXJlc2VydmVkX25hbWUYBSADKAkaLwoR", + "RW51bVJlc2VydmVkUmFuZ2USDQoFc3RhcnQYASABKAUSCwoDZW5kGAIgASgF", + "ImwKGEVudW1WYWx1ZURlc2NyaXB0b3JQcm90bxIMCgRuYW1lGAEgASgJEg4K", + "Bm51bWJlchgCIAEoBRIyCgdvcHRpb25zGAMgASgLMiEuZ29vZ2xlLnByb3Rv", + "YnVmLkVudW1WYWx1ZU9wdGlvbnMikAEKFlNlcnZpY2VEZXNjcmlwdG9yUHJv", + "dG8SDAoEbmFtZRgBIAEoCRI2CgZtZXRob2QYAiADKAsyJi5nb29nbGUucHJv", + "dG9idWYuTWV0aG9kRGVzY3JpcHRvclByb3RvEjAKB29wdGlvbnMYAyABKAsy", + "Hy5nb29nbGUucHJvdG9idWYuU2VydmljZU9wdGlvbnMiwQEKFU1ldGhvZERl", + "c2NyaXB0b3JQcm90bxIMCgRuYW1lGAEgASgJEhIKCmlucHV0X3R5cGUYAiAB", + "KAkSEwoLb3V0cHV0X3R5cGUYAyABKAkSLwoHb3B0aW9ucxgEIAEoCzIeLmdv", + "b2dsZS5wcm90b2J1Zi5NZXRob2RPcHRpb25zEh8KEGNsaWVudF9zdHJlYW1p", + "bmcYBSABKAg6BWZhbHNlEh8KEHNlcnZlcl9zdHJlYW1pbmcYBiABKAg6BWZh", + "bHNlIqYGCgtGaWxlT3B0aW9ucxIUCgxqYXZhX3BhY2thZ2UYASABKAkSHAoU", + "amF2YV9vdXRlcl9jbGFzc25hbWUYCCABKAkSIgoTamF2YV9tdWx0aXBsZV9m", + "aWxlcxgKIAEoCDoFZmFsc2USKQodamF2YV9nZW5lcmF0ZV9lcXVhbHNfYW5k", + "X2hhc2gYFCABKAhCAhgBEiUKFmphdmFfc3RyaW5nX2NoZWNrX3V0ZjgYGyAB", + "KAg6BWZhbHNlEkYKDG9wdGltaXplX2ZvchgJIAEoDjIpLmdvb2dsZS5wcm90", + "b2J1Zi5GaWxlT3B0aW9ucy5PcHRpbWl6ZU1vZGU6BVNQRUVEEhIKCmdvX3Bh", + "Y2thZ2UYCyABKAkSIgoTY2NfZ2VuZXJpY19zZXJ2aWNlcxgQIAEoCDoFZmFs", + "c2USJAoVamF2YV9nZW5lcmljX3NlcnZpY2VzGBEgASgIOgVmYWxzZRIiChNw", + "eV9nZW5lcmljX3NlcnZpY2VzGBIgASgIOgVmYWxzZRIjChRwaHBfZ2VuZXJp", + "Y19zZXJ2aWNlcxgqIAEoCDoFZmFsc2USGQoKZGVwcmVjYXRlZBgXIAEoCDoF", + "ZmFsc2USHwoQY2NfZW5hYmxlX2FyZW5hcxgfIAEoCDoFZmFsc2USGQoRb2Jq", + "Y19jbGFzc19wcmVmaXgYJCABKAkSGAoQY3NoYXJwX25hbWVzcGFjZRglIAEo", + "CRIUCgxzd2lmdF9wcmVmaXgYJyABKAkSGAoQcGhwX2NsYXNzX3ByZWZpeBgo", + "IAEoCRIVCg1waHBfbmFtZXNwYWNlGCkgASgJEh4KFnBocF9tZXRhZGF0YV9u", + "YW1lc3BhY2UYLCABKAkSFAoMcnVieV9wYWNrYWdlGC0gASgJEkMKFHVuaW50", + "ZXJwcmV0ZWRfb3B0aW9uGOcHIAMoCzIkLmdvb2dsZS5wcm90b2J1Zi5Vbmlu", + "dGVycHJldGVkT3B0aW9uIjoKDE9wdGltaXplTW9kZRIJCgVTUEVFRBABEg0K", + "CUNPREVfU0laRRACEhAKDExJVEVfUlVOVElNRRADKgkI6AcQgICAgAJKBAgm", + "ECci8gEKDk1lc3NhZ2VPcHRpb25zEiYKF21lc3NhZ2Vfc2V0X3dpcmVfZm9y", + "bWF0GAEgASgIOgVmYWxzZRIuCh9ub19zdGFuZGFyZF9kZXNjcmlwdG9yX2Fj", + "Y2Vzc29yGAIgASgIOgVmYWxzZRIZCgpkZXByZWNhdGVkGAMgASgIOgVmYWxz", + "ZRIRCgltYXBfZW50cnkYByABKAgSQwoUdW5pbnRlcnByZXRlZF9vcHRpb24Y", + "5wcgAygLMiQuZ29vZ2xlLnByb3RvYnVmLlVuaW50ZXJwcmV0ZWRPcHRpb24q", + "CQjoBxCAgICAAkoECAgQCUoECAkQCiKeAwoMRmllbGRPcHRpb25zEjoKBWN0", + "eXBlGAEgASgOMiMuZ29vZ2xlLnByb3RvYnVmLkZpZWxkT3B0aW9ucy5DVHlw", + "ZToGU1RSSU5HEg4KBnBhY2tlZBgCIAEoCBI/CgZqc3R5cGUYBiABKA4yJC5n", + "b29nbGUucHJvdG9idWYuRmllbGRPcHRpb25zLkpTVHlwZToJSlNfTk9STUFM", + "EhMKBGxhenkYBSABKAg6BWZhbHNlEhkKCmRlcHJlY2F0ZWQYAyABKAg6BWZh", + "bHNlEhMKBHdlYWsYCiABKAg6BWZhbHNlEkMKFHVuaW50ZXJwcmV0ZWRfb3B0", + "aW9uGOcHIAMoCzIkLmdvb2dsZS5wcm90b2J1Zi5VbmludGVycHJldGVkT3B0", + "aW9uIi8KBUNUeXBlEgoKBlNUUklORxAAEggKBENPUkQQARIQCgxTVFJJTkdf", + "UElFQ0UQAiI1CgZKU1R5cGUSDQoJSlNfTk9STUFMEAASDQoJSlNfU1RSSU5H", + "EAESDQoJSlNfTlVNQkVSEAIqCQjoBxCAgICAAkoECAQQBSJeCgxPbmVvZk9w", + "dGlvbnMSQwoUdW5pbnRlcnByZXRlZF9vcHRpb24Y5wcgAygLMiQuZ29vZ2xl", + "LnByb3RvYnVmLlVuaW50ZXJwcmV0ZWRPcHRpb24qCQjoBxCAgICAAiKTAQoL", + "RW51bU9wdGlvbnMSEwoLYWxsb3dfYWxpYXMYAiABKAgSGQoKZGVwcmVjYXRl", + "ZBgDIAEoCDoFZmFsc2USQwoUdW5pbnRlcnByZXRlZF9vcHRpb24Y5wcgAygL", + "MiQuZ29vZ2xlLnByb3RvYnVmLlVuaW50ZXJwcmV0ZWRPcHRpb24qCQjoBxCA", + "gICAAkoECAUQBiJ9ChBFbnVtVmFsdWVPcHRpb25zEhkKCmRlcHJlY2F0ZWQY", + "ASABKAg6BWZhbHNlEkMKFHVuaW50ZXJwcmV0ZWRfb3B0aW9uGOcHIAMoCzIk", + "Lmdvb2dsZS5wcm90b2J1Zi5VbmludGVycHJldGVkT3B0aW9uKgkI6AcQgICA", + "gAIiewoOU2VydmljZU9wdGlvbnMSGQoKZGVwcmVjYXRlZBghIAEoCDoFZmFs", + "c2USQwoUdW5pbnRlcnByZXRlZF9vcHRpb24Y5wcgAygLMiQuZ29vZ2xlLnBy", + "b3RvYnVmLlVuaW50ZXJwcmV0ZWRPcHRpb24qCQjoBxCAgICAAiKtAgoNTWV0", + "aG9kT3B0aW9ucxIZCgpkZXByZWNhdGVkGCEgASgIOgVmYWxzZRJfChFpZGVt", + "cG90ZW5jeV9sZXZlbBgiIAEoDjIvLmdvb2dsZS5wcm90b2J1Zi5NZXRob2RP", + "cHRpb25zLklkZW1wb3RlbmN5TGV2ZWw6E0lERU1QT1RFTkNZX1VOS05PV04S", + "QwoUdW5pbnRlcnByZXRlZF9vcHRpb24Y5wcgAygLMiQuZ29vZ2xlLnByb3Rv", + "YnVmLlVuaW50ZXJwcmV0ZWRPcHRpb24iUAoQSWRlbXBvdGVuY3lMZXZlbBIX", + "ChNJREVNUE9URU5DWV9VTktOT1dOEAASEwoPTk9fU0lERV9FRkZFQ1RTEAES", + "DgoKSURFTVBPVEVOVBACKgkI6AcQgICAgAIingIKE1VuaW50ZXJwcmV0ZWRP", + "cHRpb24SOwoEbmFtZRgCIAMoCzItLmdvb2dsZS5wcm90b2J1Zi5VbmludGVy", + "cHJldGVkT3B0aW9uLk5hbWVQYXJ0EhgKEGlkZW50aWZpZXJfdmFsdWUYAyAB", + "KAkSGgoScG9zaXRpdmVfaW50X3ZhbHVlGAQgASgEEhoKEm5lZ2F0aXZlX2lu", + "dF92YWx1ZRgFIAEoAxIUCgxkb3VibGVfdmFsdWUYBiABKAESFAoMc3RyaW5n", + "X3ZhbHVlGAcgASgMEhcKD2FnZ3JlZ2F0ZV92YWx1ZRgIIAEoCRozCghOYW1l", + "UGFydBIRCgluYW1lX3BhcnQYASACKAkSFAoMaXNfZXh0ZW5zaW9uGAIgAigI", + "ItUBCg5Tb3VyY2VDb2RlSW5mbxI6Cghsb2NhdGlvbhgBIAMoCzIoLmdvb2ds", + "ZS5wcm90b2J1Zi5Tb3VyY2VDb2RlSW5mby5Mb2NhdGlvbhqGAQoITG9jYXRp", + "b24SEAoEcGF0aBgBIAMoBUICEAESEAoEc3BhbhgCIAMoBUICEAESGAoQbGVh", + "ZGluZ19jb21tZW50cxgDIAEoCRIZChF0cmFpbGluZ19jb21tZW50cxgEIAEo", + "CRIhChlsZWFkaW5nX2RldGFjaGVkX2NvbW1lbnRzGAYgAygJIqcBChFHZW5l", + "cmF0ZWRDb2RlSW5mbxJBCgphbm5vdGF0aW9uGAEgAygLMi0uZ29vZ2xlLnBy", + "b3RvYnVmLkdlbmVyYXRlZENvZGVJbmZvLkFubm90YXRpb24aTwoKQW5ub3Rh", + "dGlvbhIQCgRwYXRoGAEgAygFQgIQARITCgtzb3VyY2VfZmlsZRgCIAEoCRIN", + "CgViZWdpbhgDIAEoBRILCgNlbmQYBCABKAVCjwEKE2NvbS5nb29nbGUucHJv", + "dG9idWZCEERlc2NyaXB0b3JQcm90b3NIAVo+Z2l0aHViLmNvbS9nb2xhbmcv", + "cHJvdG9idWYvcHJvdG9jLWdlbi1nby9kZXNjcmlwdG9yO2Rlc2NyaXB0b3L4", + "AQGiAgNHUEKqAhpHb29nbGUuUHJvdG9idWYuUmVmbGVjdGlvbg==")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.FileDescriptorSet), global::Google.Protobuf.Reflection.FileDescriptorSet.Parser, new[]{ "File" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.FileDescriptorProto), global::Google.Protobuf.Reflection.FileDescriptorProto.Parser, new[]{ "Name", "Package", "Dependency", "PublicDependency", "WeakDependency", "MessageType", "EnumType", "Service", "Extension", "Options", "SourceCodeInfo", "Syntax" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.DescriptorProto), global::Google.Protobuf.Reflection.DescriptorProto.Parser, new[]{ "Name", "Field", "Extension", "NestedType", "EnumType", "ExtensionRange", "OneofDecl", "Options", "ReservedRange", "ReservedName" }, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.DescriptorProto.Types.ExtensionRange), global::Google.Protobuf.Reflection.DescriptorProto.Types.ExtensionRange.Parser, new[]{ "Start", "End" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.DescriptorProto), global::Google.Protobuf.Reflection.DescriptorProto.Parser, new[]{ "Name", "Field", "Extension", "NestedType", "EnumType", "ExtensionRange", "OneofDecl", "Options", "ReservedRange", "ReservedName" }, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.DescriptorProto.Types.ExtensionRange), global::Google.Protobuf.Reflection.DescriptorProto.Types.ExtensionRange.Parser, new[]{ "Start", "End", "Options" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.DescriptorProto.Types.ReservedRange), global::Google.Protobuf.Reflection.DescriptorProto.Types.ReservedRange.Parser, new[]{ "Start", "End" }, null, null, null)}), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.ExtensionRangeOptions), global::Google.Protobuf.Reflection.ExtensionRangeOptions.Parser, new[]{ "UninterpretedOption" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.FieldDescriptorProto), global::Google.Protobuf.Reflection.FieldDescriptorProto.Parser, new[]{ "Name", "Number", "Label", "Type", "TypeName", "Extendee", "DefaultValue", "OneofIndex", "JsonName", "Options" }, null, new[]{ typeof(global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Type), typeof(global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Label) }, null), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.OneofDescriptorProto), global::Google.Protobuf.Reflection.OneofDescriptorProto.Parser, new[]{ "Name", "Options" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.EnumDescriptorProto), global::Google.Protobuf.Reflection.EnumDescriptorProto.Parser, new[]{ "Name", "Value", "Options" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.EnumDescriptorProto), global::Google.Protobuf.Reflection.EnumDescriptorProto.Parser, new[]{ "Name", "Value", "Options", "ReservedRange", "ReservedName" }, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.EnumDescriptorProto.Types.EnumReservedRange), global::Google.Protobuf.Reflection.EnumDescriptorProto.Types.EnumReservedRange.Parser, new[]{ "Start", "End" }, null, null, null)}), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.EnumValueDescriptorProto), global::Google.Protobuf.Reflection.EnumValueDescriptorProto.Parser, new[]{ "Name", "Number", "Options" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.ServiceDescriptorProto), global::Google.Protobuf.Reflection.ServiceDescriptorProto.Parser, new[]{ "Name", "Method", "Options" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.MethodDescriptorProto), global::Google.Protobuf.Reflection.MethodDescriptorProto.Parser, new[]{ "Name", "InputType", "OutputType", "Options", "ClientStreaming", "ServerStreaming" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.FileOptions), global::Google.Protobuf.Reflection.FileOptions.Parser, new[]{ "JavaPackage", "JavaOuterClassname", "JavaMultipleFiles", "JavaGenerateEqualsAndHash", "JavaStringCheckUtf8", "OptimizeFor", "GoPackage", "CcGenericServices", "JavaGenericServices", "PyGenericServices", "Deprecated", "CcEnableArenas", "ObjcClassPrefix", "CsharpNamespace", "UninterpretedOption" }, null, new[]{ typeof(global::Google.Protobuf.Reflection.FileOptions.Types.OptimizeMode) }, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.FileOptions), global::Google.Protobuf.Reflection.FileOptions.Parser, new[]{ "JavaPackage", "JavaOuterClassname", "JavaMultipleFiles", "JavaGenerateEqualsAndHash", "JavaStringCheckUtf8", "OptimizeFor", "GoPackage", "CcGenericServices", "JavaGenericServices", "PyGenericServices", "PhpGenericServices", "Deprecated", "CcEnableArenas", "ObjcClassPrefix", "CsharpNamespace", "SwiftPrefix", "PhpClassPrefix", "PhpNamespace", "PhpMetadataNamespace", "RubyPackage", "UninterpretedOption" }, null, new[]{ typeof(global::Google.Protobuf.Reflection.FileOptions.Types.OptimizeMode) }, null), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.MessageOptions), global::Google.Protobuf.Reflection.MessageOptions.Parser, new[]{ "MessageSetWireFormat", "NoStandardDescriptorAccessor", "Deprecated", "MapEntry", "UninterpretedOption" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.FieldOptions), global::Google.Protobuf.Reflection.FieldOptions.Parser, new[]{ "Ctype", "Packed", "Jstype", "Lazy", "Deprecated", "Weak", "UninterpretedOption" }, null, new[]{ typeof(global::Google.Protobuf.Reflection.FieldOptions.Types.CType), typeof(global::Google.Protobuf.Reflection.FieldOptions.Types.JSType) }, null), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.OneofOptions), global::Google.Protobuf.Reflection.OneofOptions.Parser, new[]{ "UninterpretedOption" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.EnumOptions), global::Google.Protobuf.Reflection.EnumOptions.Parser, new[]{ "AllowAlias", "Deprecated", "UninterpretedOption" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.EnumValueOptions), global::Google.Protobuf.Reflection.EnumValueOptions.Parser, new[]{ "Deprecated", "UninterpretedOption" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.ServiceOptions), global::Google.Protobuf.Reflection.ServiceOptions.Parser, new[]{ "Deprecated", "UninterpretedOption" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.MethodOptions), global::Google.Protobuf.Reflection.MethodOptions.Parser, new[]{ "Deprecated", "UninterpretedOption" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.MethodOptions), global::Google.Protobuf.Reflection.MethodOptions.Parser, new[]{ "Deprecated", "IdempotencyLevel", "UninterpretedOption" }, null, new[]{ typeof(global::Google.Protobuf.Reflection.MethodOptions.Types.IdempotencyLevel) }, null), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.UninterpretedOption), global::Google.Protobuf.Reflection.UninterpretedOption.Parser, new[]{ "Name", "IdentifierValue", "PositiveIntValue", "NegativeIntValue", "DoubleValue", "StringValue", "AggregateValue" }, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.UninterpretedOption.Types.NamePart), global::Google.Protobuf.Reflection.UninterpretedOption.Types.NamePart.Parser, new[]{ "NamePart_", "IsExtension" }, null, null, null)}), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.SourceCodeInfo), global::Google.Protobuf.Reflection.SourceCodeInfo.Parser, new[]{ "Location" }, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.SourceCodeInfo.Types.Location), global::Google.Protobuf.Reflection.SourceCodeInfo.Types.Location.Parser, new[]{ "Path", "Span", "LeadingComments", "TrailingComments", "LeadingDetachedComments" }, null, null, null)}), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.GeneratedCodeInfo), global::Google.Protobuf.Reflection.GeneratedCodeInfo.Parser, new[]{ "Annotation" }, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.GeneratedCodeInfo.Types.Annotation), global::Google.Protobuf.Reflection.GeneratedCodeInfo.Types.Annotation.Parser, new[]{ "Path", "SourceFile", "Begin", "End" }, null, null, null)}) @@ -171,11 +190,12 @@ } #region Messages /// - /// The protocol compiler can output a FileDescriptorSet containing the .proto - /// files it parses. + /// The protocol compiler can output a FileDescriptorSet containing the .proto + /// files it parses. /// internal sealed partial class FileDescriptorSet : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new FileDescriptorSet()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -199,6 +219,7 @@ [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public FileDescriptorSet(FileDescriptorSet other) : this() { file_ = other.file_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -230,13 +251,16 @@ return true; } if(!file_.Equals(other.file_)) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; hash ^= file_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -248,12 +272,18 @@ [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { file_.WriteTo(output, _repeated_file_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; size += file_.CalculateSize(_repeated_file_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -263,6 +293,7 @@ return; } file_.Add(other.file_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -271,7 +302,7 @@ while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { file_.AddEntriesFrom(input, _repeated_file_codec); @@ -284,10 +315,11 @@ } /// - /// Describes a complete .proto file. + /// Describes a complete .proto file. /// internal sealed partial class FileDescriptorProto : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new FileDescriptorProto()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -319,9 +351,10 @@ enumType_ = other.enumType_.Clone(); service_ = other.service_.Clone(); extension_ = other.extension_.Clone(); - Options = other.options_ != null ? other.Options.Clone() : null; - SourceCodeInfo = other.sourceCodeInfo_ != null ? other.SourceCodeInfo.Clone() : null; + options_ = other.options_ != null ? other.options_.Clone() : null; + sourceCodeInfo_ = other.sourceCodeInfo_ != null ? other.sourceCodeInfo_.Clone() : null; syntax_ = other.syntax_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -333,7 +366,7 @@ public const int NameFieldNumber = 1; private string name_ = ""; /// - /// file name, relative to root of source tree + /// file name, relative to root of source tree /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string Name { @@ -347,7 +380,7 @@ public const int PackageFieldNumber = 2; private string package_ = ""; /// - /// e.g. "foo", "foo.bar", etc. + /// e.g. "foo", "foo.bar", etc. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string Package { @@ -363,7 +396,7 @@ = pb::FieldCodec.ForString(26); private readonly pbc::RepeatedField dependency_ = new pbc::RepeatedField(); /// - /// Names of files imported by this file. + /// Names of files imported by this file. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField Dependency { @@ -376,7 +409,7 @@ = pb::FieldCodec.ForInt32(80); private readonly pbc::RepeatedField publicDependency_ = new pbc::RepeatedField(); /// - /// Indexes of the public imported files in the dependency list above. + /// Indexes of the public imported files in the dependency list above. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField PublicDependency { @@ -389,8 +422,8 @@ = pb::FieldCodec.ForInt32(88); private readonly pbc::RepeatedField weakDependency_ = new pbc::RepeatedField(); /// - /// Indexes of the weak imported files in the dependency list. - /// For Google-internal migration only. Do not use. + /// Indexes of the weak imported files in the dependency list. + /// For Google-internal migration only. Do not use. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField WeakDependency { @@ -403,7 +436,7 @@ = pb::FieldCodec.ForMessage(34, global::Google.Protobuf.Reflection.DescriptorProto.Parser); private readonly pbc::RepeatedField messageType_ = new pbc::RepeatedField(); /// - /// All top-level definitions in this file. + /// All top-level definitions in this file. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField MessageType { @@ -455,10 +488,10 @@ public const int SourceCodeInfoFieldNumber = 9; private global::Google.Protobuf.Reflection.SourceCodeInfo sourceCodeInfo_; /// - /// This field contains optional information about the original source code. - /// You may safely remove this entire field without harming runtime - /// functionality of the descriptors -- the information is needed only by - /// development tools. + /// This field contains optional information about the original source code. + /// You may safely remove this entire field without harming runtime + /// functionality of the descriptors -- the information is needed only by + /// development tools. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.Reflection.SourceCodeInfo SourceCodeInfo { @@ -472,8 +505,8 @@ public const int SyntaxFieldNumber = 12; private string syntax_ = ""; /// - /// The syntax of the proto file. - /// The supported values are "proto2" and "proto3". + /// The syntax of the proto file. + /// The supported values are "proto2" and "proto3". /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string Syntax { @@ -508,7 +541,7 @@ if (!object.Equals(Options, other.Options)) return false; if (!object.Equals(SourceCodeInfo, other.SourceCodeInfo)) return false; if (Syntax != other.Syntax) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -526,6 +559,9 @@ if (options_ != null) hash ^= Options.GetHashCode(); if (sourceCodeInfo_ != null) hash ^= SourceCodeInfo.GetHashCode(); if (Syntax.Length != 0) hash ^= Syntax.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -563,6 +599,9 @@ output.WriteRawTag(98); output.WriteString(Syntax); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -590,6 +629,9 @@ if (Syntax.Length != 0) { size += 1 + pb::CodedOutputStream.ComputeStringSize(Syntax); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -626,6 +668,7 @@ if (other.Syntax.Length != 0) { Syntax = other.Syntax; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -634,7 +677,7 @@ while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { Name = input.ReadString(); @@ -699,10 +742,11 @@ } /// - /// Describes a message type. + /// Describes a message type. /// internal sealed partial class DescriptorProto : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DescriptorProto()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -732,9 +776,10 @@ enumType_ = other.enumType_.Clone(); extensionRange_ = other.extensionRange_.Clone(); oneofDecl_ = other.oneofDecl_.Clone(); - Options = other.options_ != null ? other.Options.Clone() : null; + options_ = other.options_ != null ? other.options_.Clone() : null; reservedRange_ = other.reservedRange_.Clone(); reservedName_ = other.reservedName_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -840,8 +885,8 @@ = pb::FieldCodec.ForString(82); private readonly pbc::RepeatedField reservedName_ = new pbc::RepeatedField(); /// - /// Reserved field names, which may not be used by fields in the same message. - /// A given name may only be reserved once. + /// Reserved field names, which may not be used by fields in the same message. + /// A given name may only be reserved once. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField ReservedName { @@ -871,7 +916,7 @@ if (!object.Equals(Options, other.Options)) return false; if(!reservedRange_.Equals(other.reservedRange_)) return false; if(!reservedName_.Equals(other.reservedName_)) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -887,6 +932,9 @@ if (options_ != null) hash ^= Options.GetHashCode(); hash ^= reservedRange_.GetHashCode(); hash ^= reservedName_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -913,6 +961,9 @@ oneofDecl_.WriteTo(output, _repeated_oneofDecl_codec); reservedRange_.WriteTo(output, _repeated_reservedRange_codec); reservedName_.WriteTo(output, _repeated_reservedName_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -932,6 +983,9 @@ } size += reservedRange_.CalculateSize(_repeated_reservedRange_codec); size += reservedName_.CalculateSize(_repeated_reservedName_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -957,6 +1011,7 @@ } reservedRange_.Add(other.reservedRange_); reservedName_.Add(other.reservedName_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -965,7 +1020,7 @@ while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { Name = input.ReadString(); @@ -1020,6 +1075,7 @@ public static partial class Types { internal sealed partial class ExtensionRange : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ExtensionRange()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -1044,6 +1100,8 @@ public ExtensionRange(ExtensionRange other) : this() { start_ = other.start_; end_ = other.end_; + options_ = other.options_ != null ? other.options_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1073,6 +1131,17 @@ } } + /// Field number for the "options" field. + public const int OptionsFieldNumber = 3; + private global::Google.Protobuf.Reflection.ExtensionRangeOptions options_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.Reflection.ExtensionRangeOptions Options { + get { return options_; } + set { + options_ = value; + } + } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as ExtensionRange); @@ -1088,7 +1157,8 @@ } if (Start != other.Start) return false; if (End != other.End) return false; - return true; + if (!object.Equals(Options, other.Options)) return false; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1096,6 +1166,10 @@ int hash = 1; if (Start != 0) hash ^= Start.GetHashCode(); if (End != 0) hash ^= End.GetHashCode(); + if (options_ != null) hash ^= Options.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -1114,6 +1188,13 @@ output.WriteRawTag(16); output.WriteInt32(End); } + if (options_ != null) { + output.WriteRawTag(26); + output.WriteMessage(Options); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1125,6 +1206,12 @@ if (End != 0) { size += 1 + pb::CodedOutputStream.ComputeInt32Size(End); } + if (options_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Options); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -1139,6 +1226,13 @@ if (other.End != 0) { End = other.End; } + if (other.options_ != null) { + if (options_ == null) { + options_ = new global::Google.Protobuf.Reflection.ExtensionRangeOptions(); + } + Options.MergeFrom(other.Options); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1147,7 +1241,7 @@ while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 8: { Start = input.ReadInt32(); @@ -1157,6 +1251,13 @@ End = input.ReadInt32(); break; } + case 26: { + if (options_ == null) { + options_ = new global::Google.Protobuf.Reflection.ExtensionRangeOptions(); + } + input.ReadMessage(options_); + break; + } } } } @@ -1164,12 +1265,13 @@ } /// - /// Range of reserved tag numbers. Reserved tag numbers may not be used by - /// fields or extension ranges in the same message. Reserved ranges may - /// not overlap. + /// Range of reserved tag numbers. Reserved tag numbers may not be used by + /// fields or extension ranges in the same message. Reserved ranges may + /// not overlap. /// internal sealed partial class ReservedRange : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ReservedRange()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -1194,6 +1296,7 @@ public ReservedRange(ReservedRange other) : this() { start_ = other.start_; end_ = other.end_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1205,7 +1308,7 @@ public const int StartFieldNumber = 1; private int start_; /// - /// Inclusive. + /// Inclusive. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int Start { @@ -1219,7 +1322,7 @@ public const int EndFieldNumber = 2; private int end_; /// - /// Exclusive. + /// Exclusive. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int End { @@ -1244,7 +1347,7 @@ } if (Start != other.Start) return false; if (End != other.End) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1252,6 +1355,9 @@ int hash = 1; if (Start != 0) hash ^= Start.GetHashCode(); if (End != 0) hash ^= End.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -1270,6 +1376,9 @@ output.WriteRawTag(16); output.WriteInt32(End); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1281,6 +1390,9 @@ if (End != 0) { size += 1 + pb::CodedOutputStream.ComputeInt32Size(End); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -1295,6 +1407,7 @@ if (other.End != 0) { End = other.End; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1303,7 +1416,7 @@ while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 8: { Start = input.ReadInt32(); @@ -1324,17 +1437,142 @@ } + internal sealed partial class ExtensionRangeOptions : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ExtensionRangeOptions()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[3]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ExtensionRangeOptions() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ExtensionRangeOptions(ExtensionRangeOptions other) : this() { + uninterpretedOption_ = other.uninterpretedOption_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ExtensionRangeOptions Clone() { + return new ExtensionRangeOptions(this); + } + + /// Field number for the "uninterpreted_option" field. + public const int UninterpretedOptionFieldNumber = 999; + private static readonly pb::FieldCodec _repeated_uninterpretedOption_codec + = pb::FieldCodec.ForMessage(7994, global::Google.Protobuf.Reflection.UninterpretedOption.Parser); + private readonly pbc::RepeatedField uninterpretedOption_ = new pbc::RepeatedField(); + /// + /// The parser stores options it doesn't recognize here. See above. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField UninterpretedOption { + get { return uninterpretedOption_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as ExtensionRangeOptions); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(ExtensionRangeOptions other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if(!uninterpretedOption_.Equals(other.uninterpretedOption_)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + hash ^= uninterpretedOption_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + uninterpretedOption_.WriteTo(output, _repeated_uninterpretedOption_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + size += uninterpretedOption_.CalculateSize(_repeated_uninterpretedOption_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(ExtensionRangeOptions other) { + if (other == null) { + return; + } + uninterpretedOption_.Add(other.uninterpretedOption_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 7994: { + uninterpretedOption_.AddEntriesFrom(input, _repeated_uninterpretedOption_codec); + break; + } + } + } + } + + } + /// - /// Describes a field within a message. + /// Describes a field within a message. /// internal sealed partial class FieldDescriptorProto : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new FieldDescriptorProto()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[3]; } + get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[4]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1360,7 +1598,8 @@ defaultValue_ = other.defaultValue_; oneofIndex_ = other.oneofIndex_; jsonName_ = other.jsonName_; - Options = other.options_ != null ? other.Options.Clone() : null; + options_ = other.options_ != null ? other.options_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1405,8 +1644,8 @@ public const int TypeFieldNumber = 5; private global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Type type_ = 0; /// - /// If type_name is set, this need not be set. If both this and type_name - /// are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP. + /// If type_name is set, this need not be set. If both this and type_name + /// are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Type Type { @@ -1420,11 +1659,11 @@ public const int TypeNameFieldNumber = 6; private string typeName_ = ""; /// - /// For message and enum types, this is the name of the type. If the name - /// starts with a '.', it is fully-qualified. Otherwise, C++-like scoping - /// rules are used to find the type (i.e. first the nested types within this - /// message are searched, then within the parent, on up to the root - /// namespace). + /// For message and enum types, this is the name of the type. If the name + /// starts with a '.', it is fully-qualified. Otherwise, C++-like scoping + /// rules are used to find the type (i.e. first the nested types within this + /// message are searched, then within the parent, on up to the root + /// namespace). /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string TypeName { @@ -1438,8 +1677,8 @@ public const int ExtendeeFieldNumber = 2; private string extendee_ = ""; /// - /// For extensions, this is the name of the type being extended. It is - /// resolved in the same manner as type_name. + /// For extensions, this is the name of the type being extended. It is + /// resolved in the same manner as type_name. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string Extendee { @@ -1453,11 +1692,11 @@ public const int DefaultValueFieldNumber = 7; private string defaultValue_ = ""; /// - /// For numeric types, contains the original text representation of the value. - /// For booleans, "true" or "false". - /// For strings, contains the default text contents (not escaped in any way). - /// For bytes, contains the C escaped value. All bytes >= 128 are escaped. - /// TODO(kenton): Base-64 encode? + /// For numeric types, contains the original text representation of the value. + /// For booleans, "true" or "false". + /// For strings, contains the default text contents (not escaped in any way). + /// For bytes, contains the C escaped value. All bytes >= 128 are escaped. + /// TODO(kenton): Base-64 encode? /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string DefaultValue { @@ -1471,8 +1710,8 @@ public const int OneofIndexFieldNumber = 9; private int oneofIndex_; /// - /// If set, gives the index of a oneof in the containing type's oneof_decl - /// list. This field is a member of that oneof. + /// If set, gives the index of a oneof in the containing type's oneof_decl + /// list. This field is a member of that oneof. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int OneofIndex { @@ -1486,10 +1725,10 @@ public const int JsonNameFieldNumber = 10; private string jsonName_ = ""; /// - /// JSON name of this field. The value is set by protocol compiler. If the - /// user has set a "json_name" option on this field, that option's value - /// will be used. Otherwise, it's deduced from the field's name by converting - /// it to camelCase. + /// JSON name of this field. The value is set by protocol compiler. If the + /// user has set a "json_name" option on this field, that option's value + /// will be used. Otherwise, it's deduced from the field's name by converting + /// it to camelCase. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string JsonName { @@ -1533,7 +1772,7 @@ if (OneofIndex != other.OneofIndex) return false; if (JsonName != other.JsonName) return false; if (!object.Equals(Options, other.Options)) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1549,6 +1788,9 @@ if (OneofIndex != 0) hash ^= OneofIndex.GetHashCode(); if (JsonName.Length != 0) hash ^= JsonName.GetHashCode(); if (options_ != null) hash ^= Options.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -1599,6 +1841,9 @@ output.WriteRawTag(82); output.WriteString(JsonName); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1634,6 +1879,9 @@ if (options_ != null) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(Options); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -1675,6 +1923,7 @@ } Options.MergeFrom(other.Options); } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1683,7 +1932,7 @@ while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { Name = input.ReadString(); @@ -1738,20 +1987,20 @@ public static partial class Types { internal enum Type { /// - /// 0 is reserved for errors. - /// Order is weird for historical reasons. + /// 0 is reserved for errors. + /// Order is weird for historical reasons. /// [pbr::OriginalName("TYPE_DOUBLE")] Double = 1, [pbr::OriginalName("TYPE_FLOAT")] Float = 2, /// - /// Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if - /// negative values are likely. + /// Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if + /// negative values are likely. /// [pbr::OriginalName("TYPE_INT64")] Int64 = 3, [pbr::OriginalName("TYPE_UINT64")] Uint64 = 4, /// - /// Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if - /// negative values are likely. + /// Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if + /// negative values are likely. /// [pbr::OriginalName("TYPE_INT32")] Int32 = 5, [pbr::OriginalName("TYPE_FIXED64")] Fixed64 = 6, @@ -1759,15 +2008,18 @@ [pbr::OriginalName("TYPE_BOOL")] Bool = 8, [pbr::OriginalName("TYPE_STRING")] String = 9, /// - /// Tag-delimited aggregate. + /// Tag-delimited aggregate. + /// Group type is deprecated and not supported in proto3. However, Proto3 + /// implementations should still be able to parse the group wire format and + /// treat group fields as unknown fields. /// [pbr::OriginalName("TYPE_GROUP")] Group = 10, /// - /// Length-delimited aggregate. + /// Length-delimited aggregate. /// [pbr::OriginalName("TYPE_MESSAGE")] Message = 11, /// - /// New in version 2. + /// New in version 2. /// [pbr::OriginalName("TYPE_BYTES")] Bytes = 12, [pbr::OriginalName("TYPE_UINT32")] Uint32 = 13, @@ -1775,24 +2027,21 @@ [pbr::OriginalName("TYPE_SFIXED32")] Sfixed32 = 15, [pbr::OriginalName("TYPE_SFIXED64")] Sfixed64 = 16, /// - /// Uses ZigZag encoding. + /// Uses ZigZag encoding. /// [pbr::OriginalName("TYPE_SINT32")] Sint32 = 17, /// - /// Uses ZigZag encoding. + /// Uses ZigZag encoding. /// [pbr::OriginalName("TYPE_SINT64")] Sint64 = 18, } internal enum Label { /// - /// 0 is reserved for errors + /// 0 is reserved for errors /// [pbr::OriginalName("LABEL_OPTIONAL")] Optional = 1, [pbr::OriginalName("LABEL_REQUIRED")] Required = 2, - /// - /// TODO(sanjay): Should we add LABEL_MAP? - /// [pbr::OriginalName("LABEL_REPEATED")] Repeated = 3, } @@ -1802,16 +2051,17 @@ } /// - /// Describes a oneof. + /// Describes a oneof. /// internal sealed partial class OneofDescriptorProto : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new OneofDescriptorProto()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[4]; } + get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[5]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1829,7 +2079,8 @@ [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public OneofDescriptorProto(OneofDescriptorProto other) : this() { name_ = other.name_; - Options = other.options_ != null ? other.Options.Clone() : null; + options_ = other.options_ != null ? other.options_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1874,7 +2125,7 @@ } if (Name != other.Name) return false; if (!object.Equals(Options, other.Options)) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1882,6 +2133,9 @@ int hash = 1; if (Name.Length != 0) hash ^= Name.GetHashCode(); if (options_ != null) hash ^= Options.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -1900,6 +2154,9 @@ output.WriteRawTag(18); output.WriteMessage(Options); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1911,6 +2168,9 @@ if (options_ != null) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(Options); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -1928,6 +2188,7 @@ } Options.MergeFrom(other.Options); } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1936,7 +2197,7 @@ while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { Name = input.ReadString(); @@ -1956,16 +2217,17 @@ } /// - /// Describes an enum type. + /// Describes an enum type. /// internal sealed partial class EnumDescriptorProto : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new EnumDescriptorProto()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[5]; } + get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[6]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1984,7 +2246,10 @@ public EnumDescriptorProto(EnumDescriptorProto other) : this() { name_ = other.name_; value_ = other.value_.Clone(); - Options = other.options_ != null ? other.Options.Clone() : null; + options_ = other.options_ != null ? other.options_.Clone() : null; + reservedRange_ = other.reservedRange_.Clone(); + reservedName_ = other.reservedName_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2024,6 +2289,35 @@ } } + /// Field number for the "reserved_range" field. + public const int ReservedRangeFieldNumber = 4; + private static readonly pb::FieldCodec _repeated_reservedRange_codec + = pb::FieldCodec.ForMessage(34, global::Google.Protobuf.Reflection.EnumDescriptorProto.Types.EnumReservedRange.Parser); + private readonly pbc::RepeatedField reservedRange_ = new pbc::RepeatedField(); + /// + /// Range of reserved numeric values. Reserved numeric values may not be used + /// by enum values in the same enum declaration. Reserved ranges may not + /// overlap. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField ReservedRange { + get { return reservedRange_; } + } + + /// Field number for the "reserved_name" field. + public const int ReservedNameFieldNumber = 5; + private static readonly pb::FieldCodec _repeated_reservedName_codec + = pb::FieldCodec.ForString(42); + private readonly pbc::RepeatedField reservedName_ = new pbc::RepeatedField(); + /// + /// Reserved enum value names, which may not be reused. A given name may only + /// be reserved once. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField ReservedName { + get { return reservedName_; } + } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as EnumDescriptorProto); @@ -2040,7 +2334,9 @@ if (Name != other.Name) return false; if(!value_.Equals(other.value_)) return false; if (!object.Equals(Options, other.Options)) return false; - return true; + if(!reservedRange_.Equals(other.reservedRange_)) return false; + if(!reservedName_.Equals(other.reservedName_)) return false; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2049,6 +2345,11 @@ if (Name.Length != 0) hash ^= Name.GetHashCode(); hash ^= value_.GetHashCode(); if (options_ != null) hash ^= Options.GetHashCode(); + hash ^= reservedRange_.GetHashCode(); + hash ^= reservedName_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -2068,6 +2369,11 @@ output.WriteRawTag(26); output.WriteMessage(Options); } + reservedRange_.WriteTo(output, _repeated_reservedRange_codec); + reservedName_.WriteTo(output, _repeated_reservedName_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2080,6 +2386,11 @@ if (options_ != null) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(Options); } + size += reservedRange_.CalculateSize(_repeated_reservedRange_codec); + size += reservedName_.CalculateSize(_repeated_reservedName_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -2098,6 +2409,9 @@ } Options.MergeFrom(other.Options); } + reservedRange_.Add(other.reservedRange_); + reservedName_.Add(other.reservedName_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2106,7 +2420,7 @@ while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { Name = input.ReadString(); @@ -2123,23 +2437,210 @@ input.ReadMessage(options_); break; } + case 34: { + reservedRange_.AddEntriesFrom(input, _repeated_reservedRange_codec); + break; + } + case 42: { + reservedName_.AddEntriesFrom(input, _repeated_reservedName_codec); + break; + } } } } + #region Nested types + /// Container for nested types declared in the EnumDescriptorProto message type. + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static partial class Types { + /// + /// Range of reserved numeric values. Reserved values may not be used by + /// entries in the same enum. Reserved ranges may not overlap. + /// + /// Note that this is distinct from DescriptorProto.ReservedRange in that it + /// is inclusive such that it can appropriately represent the entire int32 + /// domain. + /// + internal sealed partial class EnumReservedRange : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new EnumReservedRange()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Google.Protobuf.Reflection.EnumDescriptorProto.Descriptor.NestedTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public EnumReservedRange() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public EnumReservedRange(EnumReservedRange other) : this() { + start_ = other.start_; + end_ = other.end_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public EnumReservedRange Clone() { + return new EnumReservedRange(this); + } + + /// Field number for the "start" field. + public const int StartFieldNumber = 1; + private int start_; + /// + /// Inclusive. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Start { + get { return start_; } + set { + start_ = value; + } + } + + /// Field number for the "end" field. + public const int EndFieldNumber = 2; + private int end_; + /// + /// Inclusive. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int End { + get { return end_; } + set { + end_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as EnumReservedRange); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(EnumReservedRange other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Start != other.Start) return false; + if (End != other.End) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Start != 0) hash ^= Start.GetHashCode(); + if (End != 0) hash ^= End.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Start != 0) { + output.WriteRawTag(8); + output.WriteInt32(Start); + } + if (End != 0) { + output.WriteRawTag(16); + output.WriteInt32(End); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Start != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Start); + } + if (End != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(End); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(EnumReservedRange other) { + if (other == null) { + return; + } + if (other.Start != 0) { + Start = other.Start; + } + if (other.End != 0) { + End = other.End; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Start = input.ReadInt32(); + break; + } + case 16: { + End = input.ReadInt32(); + break; + } + } + } + } + + } + + } + #endregion + } /// - /// Describes a value within an enum. + /// Describes a value within an enum. /// internal sealed partial class EnumValueDescriptorProto : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new EnumValueDescriptorProto()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[6]; } + get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[7]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2158,7 +2659,8 @@ public EnumValueDescriptorProto(EnumValueDescriptorProto other) : this() { name_ = other.name_; number_ = other.number_; - Options = other.options_ != null ? other.Options.Clone() : null; + options_ = other.options_ != null ? other.options_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2215,7 +2717,7 @@ if (Name != other.Name) return false; if (Number != other.Number) return false; if (!object.Equals(Options, other.Options)) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2224,6 +2726,9 @@ if (Name.Length != 0) hash ^= Name.GetHashCode(); if (Number != 0) hash ^= Number.GetHashCode(); if (options_ != null) hash ^= Options.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -2246,6 +2751,9 @@ output.WriteRawTag(26); output.WriteMessage(Options); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2260,6 +2768,9 @@ if (options_ != null) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(Options); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -2280,6 +2791,7 @@ } Options.MergeFrom(other.Options); } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2288,7 +2800,7 @@ while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { Name = input.ReadString(); @@ -2312,16 +2824,17 @@ } /// - /// Describes a service. + /// Describes a service. /// internal sealed partial class ServiceDescriptorProto : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ServiceDescriptorProto()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[7]; } + get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[8]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2340,7 +2853,8 @@ public ServiceDescriptorProto(ServiceDescriptorProto other) : this() { name_ = other.name_; method_ = other.method_.Clone(); - Options = other.options_ != null ? other.Options.Clone() : null; + options_ = other.options_ != null ? other.options_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2396,7 +2910,7 @@ if (Name != other.Name) return false; if(!method_.Equals(other.method_)) return false; if (!object.Equals(Options, other.Options)) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2405,6 +2919,9 @@ if (Name.Length != 0) hash ^= Name.GetHashCode(); hash ^= method_.GetHashCode(); if (options_ != null) hash ^= Options.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -2424,6 +2941,9 @@ output.WriteRawTag(26); output.WriteMessage(Options); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2436,6 +2956,9 @@ if (options_ != null) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(Options); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -2454,6 +2977,7 @@ } Options.MergeFrom(other.Options); } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2462,7 +2986,7 @@ while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { Name = input.ReadString(); @@ -2486,16 +3010,17 @@ } /// - /// Describes a method of a service. + /// Describes a method of a service. /// internal sealed partial class MethodDescriptorProto : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new MethodDescriptorProto()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[8]; } + get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[9]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2515,9 +3040,10 @@ name_ = other.name_; inputType_ = other.inputType_; outputType_ = other.outputType_; - Options = other.options_ != null ? other.Options.Clone() : null; + options_ = other.options_ != null ? other.options_.Clone() : null; clientStreaming_ = other.clientStreaming_; serverStreaming_ = other.serverStreaming_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2540,8 +3066,8 @@ public const int InputTypeFieldNumber = 2; private string inputType_ = ""; /// - /// Input and output type names. These are resolved in the same way as - /// FieldDescriptorProto.type_name, but must refer to a message type. + /// Input and output type names. These are resolved in the same way as + /// FieldDescriptorProto.type_name, but must refer to a message type. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string InputType { @@ -2577,7 +3103,7 @@ public const int ClientStreamingFieldNumber = 5; private bool clientStreaming_; /// - /// Identifies if client streams multiple client messages + /// Identifies if client streams multiple client messages /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool ClientStreaming { @@ -2591,7 +3117,7 @@ public const int ServerStreamingFieldNumber = 6; private bool serverStreaming_; /// - /// Identifies if server streams multiple server messages + /// Identifies if server streams multiple server messages /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool ServerStreaming { @@ -2620,7 +3146,7 @@ if (!object.Equals(Options, other.Options)) return false; if (ClientStreaming != other.ClientStreaming) return false; if (ServerStreaming != other.ServerStreaming) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2632,6 +3158,9 @@ if (options_ != null) hash ^= Options.GetHashCode(); if (ClientStreaming != false) hash ^= ClientStreaming.GetHashCode(); if (ServerStreaming != false) hash ^= ServerStreaming.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -2666,6 +3195,9 @@ output.WriteRawTag(48); output.WriteBool(ServerStreaming); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2689,6 +3221,9 @@ if (ServerStreaming != false) { size += 1 + 1; } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -2718,6 +3253,7 @@ if (other.ServerStreaming != false) { ServerStreaming = other.ServerStreaming; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2726,7 +3262,7 @@ while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { Name = input.ReadString(); @@ -2763,12 +3299,13 @@ internal sealed partial class FileOptions : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new FileOptions()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[9]; } + get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[10]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2776,6 +3313,8 @@ get { return Descriptor; } } + internal CustomOptions CustomOptions{ get; private set; } = CustomOptions.Empty; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public FileOptions() { OnConstruction(); @@ -2795,11 +3334,18 @@ ccGenericServices_ = other.ccGenericServices_; javaGenericServices_ = other.javaGenericServices_; pyGenericServices_ = other.pyGenericServices_; + phpGenericServices_ = other.phpGenericServices_; deprecated_ = other.deprecated_; ccEnableArenas_ = other.ccEnableArenas_; objcClassPrefix_ = other.objcClassPrefix_; csharpNamespace_ = other.csharpNamespace_; + swiftPrefix_ = other.swiftPrefix_; + phpClassPrefix_ = other.phpClassPrefix_; + phpNamespace_ = other.phpNamespace_; + phpMetadataNamespace_ = other.phpMetadataNamespace_; + rubyPackage_ = other.rubyPackage_; uninterpretedOption_ = other.uninterpretedOption_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2811,10 +3357,10 @@ public const int JavaPackageFieldNumber = 1; private string javaPackage_ = ""; /// - /// Sets the Java package where classes generated from this .proto will be - /// placed. By default, the proto package is used, but this is often - /// inappropriate because proto packages do not normally start with backwards - /// domain names. + /// Sets the Java package where classes generated from this .proto will be + /// placed. By default, the proto package is used, but this is often + /// inappropriate because proto packages do not normally start with backwards + /// domain names. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string JavaPackage { @@ -2828,11 +3374,11 @@ public const int JavaOuterClassnameFieldNumber = 8; private string javaOuterClassname_ = ""; /// - /// If set, all the classes from the .proto file are wrapped in a single - /// outer class with the given name. This applies to both Proto1 - /// (equivalent to the old "--one_java_file" option) and Proto2 (where - /// a .proto always translates to a single class, but you may want to - /// explicitly choose the class name). + /// If set, all the classes from the .proto file are wrapped in a single + /// outer class with the given name. This applies to both Proto1 + /// (equivalent to the old "--one_java_file" option) and Proto2 (where + /// a .proto always translates to a single class, but you may want to + /// explicitly choose the class name). /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string JavaOuterClassname { @@ -2846,12 +3392,12 @@ public const int JavaMultipleFilesFieldNumber = 10; private bool javaMultipleFiles_; /// - /// If set true, then the Java code generator will generate a separate .java - /// file for each top-level message, enum, and service defined in the .proto - /// file. Thus, these types will *not* be nested inside the outer class - /// named by java_outer_classname. However, the outer class will still be - /// generated to contain the file's getDescriptor() method as well as any - /// top-level extensions defined in the file. + /// If set true, then the Java code generator will generate a separate .java + /// file for each top-level message, enum, and service defined in the .proto + /// file. Thus, these types will *not* be nested inside the outer class + /// named by java_outer_classname. However, the outer class will still be + /// generated to contain the file's getDescriptor() method as well as any + /// top-level extensions defined in the file. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool JavaMultipleFiles { @@ -2865,19 +3411,9 @@ public const int JavaGenerateEqualsAndHashFieldNumber = 20; private bool javaGenerateEqualsAndHash_; /// - /// If set true, then the Java code generator will generate equals() and - /// hashCode() methods for all messages defined in the .proto file. - /// This increases generated code size, potentially substantially for large - /// protos, which may harm a memory-constrained application. - /// - In the full runtime this is a speed optimization, as the - /// AbstractMessage base class includes reflection-based implementations of - /// these methods. - /// - In the lite runtime, setting this option changes the semantics of - /// equals() and hashCode() to more closely match those of the full runtime; - /// the generated methods compute their results based on field values rather - /// than object identity. (Implementations should not assume that hashcodes - /// will be consistent across runtimes or versions of the protocol compiler.) + /// This option does nothing. /// + [global::System.ObsoleteAttribute] [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool JavaGenerateEqualsAndHash { get { return javaGenerateEqualsAndHash_; } @@ -2890,12 +3426,12 @@ public const int JavaStringCheckUtf8FieldNumber = 27; private bool javaStringCheckUtf8_; /// - /// If set true, then the Java2 code generator will generate code that - /// throws an exception whenever an attempt is made to assign a non-UTF-8 - /// byte sequence to a string field. - /// Message reflection will do the same. - /// However, an extension field still accepts non-UTF-8 byte sequences. - /// This option has no effect on when used with the lite runtime. + /// If set true, then the Java2 code generator will generate code that + /// throws an exception whenever an attempt is made to assign a non-UTF-8 + /// byte sequence to a string field. + /// Message reflection will do the same. + /// However, an extension field still accepts non-UTF-8 byte sequences. + /// This option has no effect on when used with the lite runtime. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool JavaStringCheckUtf8 { @@ -2920,11 +3456,11 @@ public const int GoPackageFieldNumber = 11; private string goPackage_ = ""; /// - /// Sets the Go package where structs generated from this .proto will be - /// placed. If omitted, the Go package will be derived from the following: - /// - The basename of the package import path, if provided. - /// - Otherwise, the package statement in the .proto file, if present. - /// - Otherwise, the basename of the .proto file, without extension. + /// Sets the Go package where structs generated from this .proto will be + /// placed. If omitted, the Go package will be derived from the following: + /// - The basename of the package import path, if provided. + /// - Otherwise, the package statement in the .proto file, if present. + /// - Otherwise, the basename of the .proto file, without extension. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string GoPackage { @@ -2938,16 +3474,16 @@ public const int CcGenericServicesFieldNumber = 16; private bool ccGenericServices_; /// - /// Should generic services be generated in each language? "Generic" services - /// are not specific to any particular RPC system. They are generated by the - /// main code generators in each language (without additional plugins). - /// Generic services were the only kind of service generation supported by - /// early versions of google.protobuf. + /// Should generic services be generated in each language? "Generic" services + /// are not specific to any particular RPC system. They are generated by the + /// main code generators in each language (without additional plugins). + /// Generic services were the only kind of service generation supported by + /// early versions of google.protobuf. /// - /// Generic services are now considered deprecated in favor of using plugins - /// that generate code specific to your particular RPC system. Therefore, - /// these default to false. Old code which depends on generic services should - /// explicitly set them to true. + /// Generic services are now considered deprecated in favor of using plugins + /// that generate code specific to your particular RPC system. Therefore, + /// these default to false. Old code which depends on generic services should + /// explicitly set them to true. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool CcGenericServices { @@ -2979,14 +3515,25 @@ } } + /// Field number for the "php_generic_services" field. + public const int PhpGenericServicesFieldNumber = 42; + private bool phpGenericServices_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool PhpGenericServices { + get { return phpGenericServices_; } + set { + phpGenericServices_ = value; + } + } + /// Field number for the "deprecated" field. public const int DeprecatedFieldNumber = 23; private bool deprecated_; /// - /// Is this file deprecated? - /// Depending on the target platform, this can emit Deprecated annotations - /// for everything in the file, or it will be completely ignored; in the very - /// least, this is a formalization for deprecating files. + /// Is this file deprecated? + /// Depending on the target platform, this can emit Deprecated annotations + /// for everything in the file, or it will be completely ignored; in the very + /// least, this is a formalization for deprecating files. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Deprecated { @@ -3000,8 +3547,8 @@ public const int CcEnableArenasFieldNumber = 31; private bool ccEnableArenas_; /// - /// Enables the use of arenas for the proto messages in this file. This applies - /// only to generated classes for C++. + /// Enables the use of arenas for the proto messages in this file. This applies + /// only to generated classes for C++. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool CcEnableArenas { @@ -3015,8 +3562,8 @@ public const int ObjcClassPrefixFieldNumber = 36; private string objcClassPrefix_ = ""; /// - /// Sets the objective c class prefix which is prepended to all objective c - /// generated classes from this .proto. There is no default. + /// Sets the objective c class prefix which is prepended to all objective c + /// generated classes from this .proto. There is no default. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string ObjcClassPrefix { @@ -3030,7 +3577,7 @@ public const int CsharpNamespaceFieldNumber = 37; private string csharpNamespace_ = ""; /// - /// Namespace for generated classes; defaults to the package. + /// Namespace for generated classes; defaults to the package. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string CsharpNamespace { @@ -3040,13 +3587,94 @@ } } + /// Field number for the "swift_prefix" field. + public const int SwiftPrefixFieldNumber = 39; + private string swiftPrefix_ = ""; + /// + /// By default Swift generators will take the proto package and CamelCase it + /// replacing '.' with underscore and use that to prefix the types/symbols + /// defined. When this options is provided, they will use this value instead + /// to prefix the types/symbols defined. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string SwiftPrefix { + get { return swiftPrefix_; } + set { + swiftPrefix_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "php_class_prefix" field. + public const int PhpClassPrefixFieldNumber = 40; + private string phpClassPrefix_ = ""; + /// + /// Sets the php class prefix which is prepended to all php generated classes + /// from this .proto. Default is empty. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string PhpClassPrefix { + get { return phpClassPrefix_; } + set { + phpClassPrefix_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "php_namespace" field. + public const int PhpNamespaceFieldNumber = 41; + private string phpNamespace_ = ""; + /// + /// Use this option to change the namespace of php generated classes. Default + /// is empty. When this option is empty, the package name will be used for + /// determining the namespace. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string PhpNamespace { + get { return phpNamespace_; } + set { + phpNamespace_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "php_metadata_namespace" field. + public const int PhpMetadataNamespaceFieldNumber = 44; + private string phpMetadataNamespace_ = ""; + /// + /// Use this option to change the namespace of php generated metadata classes. + /// Default is empty. When this option is empty, the proto file name will be used + /// for determining the namespace. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string PhpMetadataNamespace { + get { return phpMetadataNamespace_; } + set { + phpMetadataNamespace_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "ruby_package" field. + public const int RubyPackageFieldNumber = 45; + private string rubyPackage_ = ""; + /// + /// Use this option to change the package of ruby generated classes. Default + /// is empty. When this option is not set, the package name will be used for + /// determining the ruby package. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string RubyPackage { + get { return rubyPackage_; } + set { + rubyPackage_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + /// Field number for the "uninterpreted_option" field. public const int UninterpretedOptionFieldNumber = 999; private static readonly pb::FieldCodec _repeated_uninterpretedOption_codec = pb::FieldCodec.ForMessage(7994, global::Google.Protobuf.Reflection.UninterpretedOption.Parser); private readonly pbc::RepeatedField uninterpretedOption_ = new pbc::RepeatedField(); /// - /// The parser stores options it doesn't recognize here. See above. + /// The parser stores options it doesn't recognize here. + /// See the documentation for the "Options" section above. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField UninterpretedOption { @@ -3076,12 +3704,18 @@ if (CcGenericServices != other.CcGenericServices) return false; if (JavaGenericServices != other.JavaGenericServices) return false; if (PyGenericServices != other.PyGenericServices) return false; + if (PhpGenericServices != other.PhpGenericServices) return false; if (Deprecated != other.Deprecated) return false; if (CcEnableArenas != other.CcEnableArenas) return false; if (ObjcClassPrefix != other.ObjcClassPrefix) return false; if (CsharpNamespace != other.CsharpNamespace) return false; + if (SwiftPrefix != other.SwiftPrefix) return false; + if (PhpClassPrefix != other.PhpClassPrefix) return false; + if (PhpNamespace != other.PhpNamespace) return false; + if (PhpMetadataNamespace != other.PhpMetadataNamespace) return false; + if (RubyPackage != other.RubyPackage) return false; if(!uninterpretedOption_.Equals(other.uninterpretedOption_)) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3097,11 +3731,20 @@ if (CcGenericServices != false) hash ^= CcGenericServices.GetHashCode(); if (JavaGenericServices != false) hash ^= JavaGenericServices.GetHashCode(); if (PyGenericServices != false) hash ^= PyGenericServices.GetHashCode(); + if (PhpGenericServices != false) hash ^= PhpGenericServices.GetHashCode(); if (Deprecated != false) hash ^= Deprecated.GetHashCode(); if (CcEnableArenas != false) hash ^= CcEnableArenas.GetHashCode(); if (ObjcClassPrefix.Length != 0) hash ^= ObjcClassPrefix.GetHashCode(); if (CsharpNamespace.Length != 0) hash ^= CsharpNamespace.GetHashCode(); + if (SwiftPrefix.Length != 0) hash ^= SwiftPrefix.GetHashCode(); + if (PhpClassPrefix.Length != 0) hash ^= PhpClassPrefix.GetHashCode(); + if (PhpNamespace.Length != 0) hash ^= PhpNamespace.GetHashCode(); + if (PhpMetadataNamespace.Length != 0) hash ^= PhpMetadataNamespace.GetHashCode(); + if (RubyPackage.Length != 0) hash ^= RubyPackage.GetHashCode(); hash ^= uninterpretedOption_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -3168,7 +3811,34 @@ output.WriteRawTag(170, 2); output.WriteString(CsharpNamespace); } + if (SwiftPrefix.Length != 0) { + output.WriteRawTag(186, 2); + output.WriteString(SwiftPrefix); + } + if (PhpClassPrefix.Length != 0) { + output.WriteRawTag(194, 2); + output.WriteString(PhpClassPrefix); + } + if (PhpNamespace.Length != 0) { + output.WriteRawTag(202, 2); + output.WriteString(PhpNamespace); + } + if (PhpGenericServices != false) { + output.WriteRawTag(208, 2); + output.WriteBool(PhpGenericServices); + } + if (PhpMetadataNamespace.Length != 0) { + output.WriteRawTag(226, 2); + output.WriteString(PhpMetadataNamespace); + } + if (RubyPackage.Length != 0) { + output.WriteRawTag(234, 2); + output.WriteString(RubyPackage); + } uninterpretedOption_.WriteTo(output, _repeated_uninterpretedOption_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3204,6 +3874,9 @@ if (PyGenericServices != false) { size += 2 + 1; } + if (PhpGenericServices != false) { + size += 2 + 1; + } if (Deprecated != false) { size += 2 + 1; } @@ -3216,7 +3889,25 @@ if (CsharpNamespace.Length != 0) { size += 2 + pb::CodedOutputStream.ComputeStringSize(CsharpNamespace); } + if (SwiftPrefix.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(SwiftPrefix); + } + if (PhpClassPrefix.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(PhpClassPrefix); + } + if (PhpNamespace.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(PhpNamespace); + } + if (PhpMetadataNamespace.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(PhpMetadataNamespace); + } + if (RubyPackage.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(RubyPackage); + } size += uninterpretedOption_.CalculateSize(_repeated_uninterpretedOption_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -3255,6 +3946,9 @@ if (other.PyGenericServices != false) { PyGenericServices = other.PyGenericServices; } + if (other.PhpGenericServices != false) { + PhpGenericServices = other.PhpGenericServices; + } if (other.Deprecated != false) { Deprecated = other.Deprecated; } @@ -3267,7 +3961,23 @@ if (other.CsharpNamespace.Length != 0) { CsharpNamespace = other.CsharpNamespace; } + if (other.SwiftPrefix.Length != 0) { + SwiftPrefix = other.SwiftPrefix; + } + if (other.PhpClassPrefix.Length != 0) { + PhpClassPrefix = other.PhpClassPrefix; + } + if (other.PhpNamespace.Length != 0) { + PhpNamespace = other.PhpNamespace; + } + if (other.PhpMetadataNamespace.Length != 0) { + PhpMetadataNamespace = other.PhpMetadataNamespace; + } + if (other.RubyPackage.Length != 0) { + RubyPackage = other.RubyPackage; + } uninterpretedOption_.Add(other.uninterpretedOption_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3276,7 +3986,7 @@ while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + CustomOptions = CustomOptions.ReadOrSkipUnknownField(input); break; case 10: { JavaPackage = input.ReadString(); @@ -3334,6 +4044,30 @@ CsharpNamespace = input.ReadString(); break; } + case 314: { + SwiftPrefix = input.ReadString(); + break; + } + case 322: { + PhpClassPrefix = input.ReadString(); + break; + } + case 330: { + PhpNamespace = input.ReadString(); + break; + } + case 336: { + PhpGenericServices = input.ReadBool(); + break; + } + case 354: { + PhpMetadataNamespace = input.ReadString(); + break; + } + case 362: { + RubyPackage = input.ReadString(); + break; + } case 7994: { uninterpretedOption_.AddEntriesFrom(input, _repeated_uninterpretedOption_codec); break; @@ -3347,19 +4081,19 @@ [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static partial class Types { /// - /// Generated classes can be optimized for speed or code size. + /// Generated classes can be optimized for speed or code size. /// internal enum OptimizeMode { /// - /// Generate complete code for parsing, serialization, + /// Generate complete code for parsing, serialization, /// [pbr::OriginalName("SPEED")] Speed = 1, /// - /// etc. + /// etc. /// [pbr::OriginalName("CODE_SIZE")] CodeSize = 2, /// - /// Generate code using MessageLite and the lite runtime. + /// Generate code using MessageLite and the lite runtime. /// [pbr::OriginalName("LITE_RUNTIME")] LiteRuntime = 3, } @@ -3371,12 +4105,13 @@ internal sealed partial class MessageOptions : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new MessageOptions()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[10]; } + get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[11]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3384,6 +4119,8 @@ get { return Descriptor; } } + internal CustomOptions CustomOptions{ get; private set; } = CustomOptions.Empty; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public MessageOptions() { OnConstruction(); @@ -3398,6 +4135,7 @@ deprecated_ = other.deprecated_; mapEntry_ = other.mapEntry_; uninterpretedOption_ = other.uninterpretedOption_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3409,24 +4147,24 @@ public const int MessageSetWireFormatFieldNumber = 1; private bool messageSetWireFormat_; /// - /// Set true to use the old proto1 MessageSet wire format for extensions. - /// This is provided for backwards-compatibility with the MessageSet wire - /// format. You should not use this for any other reason: It's less - /// efficient, has fewer features, and is more complicated. + /// Set true to use the old proto1 MessageSet wire format for extensions. + /// This is provided for backwards-compatibility with the MessageSet wire + /// format. You should not use this for any other reason: It's less + /// efficient, has fewer features, and is more complicated. /// - /// The message must be defined exactly as follows: - /// message Foo { - /// option message_set_wire_format = true; - /// extensions 4 to max; - /// } - /// Note that the message cannot have any defined fields; MessageSets only - /// have extensions. + /// The message must be defined exactly as follows: + /// message Foo { + /// option message_set_wire_format = true; + /// extensions 4 to max; + /// } + /// Note that the message cannot have any defined fields; MessageSets only + /// have extensions. /// - /// All extensions of your type must be singular messages; e.g. they cannot - /// be int32s, enums, or repeated messages. + /// All extensions of your type must be singular messages; e.g. they cannot + /// be int32s, enums, or repeated messages. /// - /// Because this is an option, the above two restrictions are not enforced by - /// the protocol compiler. + /// Because this is an option, the above two restrictions are not enforced by + /// the protocol compiler. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool MessageSetWireFormat { @@ -3440,9 +4178,9 @@ public const int NoStandardDescriptorAccessorFieldNumber = 2; private bool noStandardDescriptorAccessor_; /// - /// Disables the generation of the standard "descriptor()" accessor, which can - /// conflict with a field of the same name. This is meant to make migration - /// from proto1 easier; new code should avoid fields named "descriptor". + /// Disables the generation of the standard "descriptor()" accessor, which can + /// conflict with a field of the same name. This is meant to make migration + /// from proto1 easier; new code should avoid fields named "descriptor". /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool NoStandardDescriptorAccessor { @@ -3456,10 +4194,10 @@ public const int DeprecatedFieldNumber = 3; private bool deprecated_; /// - /// Is this message deprecated? - /// Depending on the target platform, this can emit Deprecated annotations - /// for the message, or it will be completely ignored; in the very least, - /// this is a formalization for deprecating messages. + /// Is this message deprecated? + /// Depending on the target platform, this can emit Deprecated annotations + /// for the message, or it will be completely ignored; in the very least, + /// this is a formalization for deprecating messages. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Deprecated { @@ -3473,27 +4211,27 @@ public const int MapEntryFieldNumber = 7; private bool mapEntry_; /// - /// Whether the message is an automatically generated map entry type for the - /// maps field. + /// Whether the message is an automatically generated map entry type for the + /// maps field. /// - /// For maps fields: - /// map<KeyType, ValueType> map_field = 1; - /// The parsed descriptor looks like: - /// message MapFieldEntry { - /// option map_entry = true; - /// optional KeyType key = 1; - /// optional ValueType value = 2; - /// } - /// repeated MapFieldEntry map_field = 1; + /// For maps fields: + /// map<KeyType, ValueType> map_field = 1; + /// The parsed descriptor looks like: + /// message MapFieldEntry { + /// option map_entry = true; + /// optional KeyType key = 1; + /// optional ValueType value = 2; + /// } + /// repeated MapFieldEntry map_field = 1; /// - /// Implementations may choose not to generate the map_entry=true message, but - /// use a native map in the target language to hold the keys and values. - /// The reflection APIs in such implementions still need to work as - /// if the field is a repeated message field. + /// Implementations may choose not to generate the map_entry=true message, but + /// use a native map in the target language to hold the keys and values. + /// The reflection APIs in such implementions still need to work as + /// if the field is a repeated message field. /// - /// NOTE: Do not set the option in .proto files. Always use the maps syntax - /// instead. The option should only be implicitly set by the proto compiler - /// parser. + /// NOTE: Do not set the option in .proto files. Always use the maps syntax + /// instead. The option should only be implicitly set by the proto compiler + /// parser. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool MapEntry { @@ -3509,7 +4247,7 @@ = pb::FieldCodec.ForMessage(7994, global::Google.Protobuf.Reflection.UninterpretedOption.Parser); private readonly pbc::RepeatedField uninterpretedOption_ = new pbc::RepeatedField(); /// - /// The parser stores options it doesn't recognize here. See above. + /// The parser stores options it doesn't recognize here. See above. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField UninterpretedOption { @@ -3534,7 +4272,7 @@ if (Deprecated != other.Deprecated) return false; if (MapEntry != other.MapEntry) return false; if(!uninterpretedOption_.Equals(other.uninterpretedOption_)) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3545,6 +4283,9 @@ if (Deprecated != false) hash ^= Deprecated.GetHashCode(); if (MapEntry != false) hash ^= MapEntry.GetHashCode(); hash ^= uninterpretedOption_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -3572,6 +4313,9 @@ output.WriteBool(MapEntry); } uninterpretedOption_.WriteTo(output, _repeated_uninterpretedOption_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3590,6 +4334,9 @@ size += 1 + 1; } size += uninterpretedOption_.CalculateSize(_repeated_uninterpretedOption_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -3611,6 +4358,7 @@ MapEntry = other.MapEntry; } uninterpretedOption_.Add(other.uninterpretedOption_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3619,7 +4367,7 @@ while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + CustomOptions = CustomOptions.ReadOrSkipUnknownField(input); break; case 8: { MessageSetWireFormat = input.ReadBool(); @@ -3649,12 +4397,13 @@ internal sealed partial class FieldOptions : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new FieldOptions()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[11]; } + get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[12]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3662,6 +4411,8 @@ get { return Descriptor; } } + internal CustomOptions CustomOptions{ get; private set; } = CustomOptions.Empty; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public FieldOptions() { OnConstruction(); @@ -3678,6 +4429,7 @@ deprecated_ = other.deprecated_; weak_ = other.weak_; uninterpretedOption_ = other.uninterpretedOption_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3689,10 +4441,10 @@ public const int CtypeFieldNumber = 1; private global::Google.Protobuf.Reflection.FieldOptions.Types.CType ctype_ = 0; /// - /// The ctype option instructs the C++ code generator to use a different - /// representation of the field than it normally would. See the specific - /// options below. This option is not yet implemented in the open source - /// release -- sorry, we'll try to include it in a future version! + /// The ctype option instructs the C++ code generator to use a different + /// representation of the field than it normally would. See the specific + /// options below. This option is not yet implemented in the open source + /// release -- sorry, we'll try to include it in a future version! /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.Reflection.FieldOptions.Types.CType Ctype { @@ -3706,11 +4458,11 @@ public const int PackedFieldNumber = 2; private bool packed_; /// - /// The packed option can be enabled for repeated primitive fields to enable - /// a more efficient representation on the wire. Rather than repeatedly - /// writing the tag and type for each element, the entire array is encoded as - /// a single length-delimited blob. In proto3, only explicit setting it to - /// false will avoid using packed encoding. + /// The packed option can be enabled for repeated primitive fields to enable + /// a more efficient representation on the wire. Rather than repeatedly + /// writing the tag and type for each element, the entire array is encoded as + /// a single length-delimited blob. In proto3, only explicit setting it to + /// false will avoid using packed encoding. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Packed { @@ -3724,15 +4476,17 @@ public const int JstypeFieldNumber = 6; private global::Google.Protobuf.Reflection.FieldOptions.Types.JSType jstype_ = 0; /// - /// The jstype option determines the JavaScript type used for values of the - /// field. The option is permitted only for 64 bit integral and fixed types - /// (int64, uint64, sint64, fixed64, sfixed64). By default these types are - /// represented as JavaScript strings. This avoids loss of precision that can - /// happen when a large value is converted to a floating point JavaScript - /// numbers. Specifying JS_NUMBER for the jstype causes the generated - /// JavaScript code to use the JavaScript "number" type instead of strings. - /// This option is an enum to permit additional types to be added, - /// e.g. goog.math.Integer. + /// The jstype option determines the JavaScript type used for values of the + /// field. The option is permitted only for 64 bit integral and fixed types + /// (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING + /// is represented as JavaScript string, which avoids loss of precision that + /// can happen when a large value is converted to a floating point JavaScript. + /// Specifying JS_NUMBER for the jstype causes the generated JavaScript code to + /// use the JavaScript "number" type. The behavior of the default option + /// JS_NORMAL is implementation dependent. + /// + /// This option is an enum to permit additional types to be added, e.g. + /// goog.math.Integer. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.Reflection.FieldOptions.Types.JSType Jstype { @@ -3746,33 +4500,33 @@ public const int LazyFieldNumber = 5; private bool lazy_; /// - /// Should this field be parsed lazily? Lazy applies only to message-type - /// fields. It means that when the outer message is initially parsed, the - /// inner message's contents will not be parsed but instead stored in encoded - /// form. The inner message will actually be parsed when it is first accessed. + /// Should this field be parsed lazily? Lazy applies only to message-type + /// fields. It means that when the outer message is initially parsed, the + /// inner message's contents will not be parsed but instead stored in encoded + /// form. The inner message will actually be parsed when it is first accessed. /// - /// This is only a hint. Implementations are free to choose whether to use - /// eager or lazy parsing regardless of the value of this option. However, - /// setting this option true suggests that the protocol author believes that - /// using lazy parsing on this field is worth the additional bookkeeping - /// overhead typically needed to implement it. + /// This is only a hint. Implementations are free to choose whether to use + /// eager or lazy parsing regardless of the value of this option. However, + /// setting this option true suggests that the protocol author believes that + /// using lazy parsing on this field is worth the additional bookkeeping + /// overhead typically needed to implement it. /// - /// This option does not affect the public interface of any generated code; - /// all method signatures remain the same. Furthermore, thread-safety of the - /// interface is not affected by this option; const methods remain safe to - /// call from multiple threads concurrently, while non-const methods continue - /// to require exclusive access. + /// This option does not affect the public interface of any generated code; + /// all method signatures remain the same. Furthermore, thread-safety of the + /// interface is not affected by this option; const methods remain safe to + /// call from multiple threads concurrently, while non-const methods continue + /// to require exclusive access. /// - /// Note that implementations may choose not to check required fields within - /// a lazy sub-message. That is, calling IsInitialized() on the outher message - /// may return true even if the inner message has missing required fields. - /// This is necessary because otherwise the inner message would have to be - /// parsed in order to perform the check, defeating the purpose of lazy - /// parsing. An implementation which chooses not to check required fields - /// must be consistent about it. That is, for any particular sub-message, the - /// implementation must either *always* check its required fields, or *never* - /// check its required fields, regardless of whether or not the message has - /// been parsed. + /// Note that implementations may choose not to check required fields within + /// a lazy sub-message. That is, calling IsInitialized() on the outer message + /// may return true even if the inner message has missing required fields. + /// This is necessary because otherwise the inner message would have to be + /// parsed in order to perform the check, defeating the purpose of lazy + /// parsing. An implementation which chooses not to check required fields + /// must be consistent about it. That is, for any particular sub-message, the + /// implementation must either *always* check its required fields, or *never* + /// check its required fields, regardless of whether or not the message has + /// been parsed. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Lazy { @@ -3786,10 +4540,10 @@ public const int DeprecatedFieldNumber = 3; private bool deprecated_; /// - /// Is this field deprecated? - /// Depending on the target platform, this can emit Deprecated annotations - /// for accessors, or it will be completely ignored; in the very least, this - /// is a formalization for deprecating fields. + /// Is this field deprecated? + /// Depending on the target platform, this can emit Deprecated annotations + /// for accessors, or it will be completely ignored; in the very least, this + /// is a formalization for deprecating fields. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Deprecated { @@ -3803,7 +4557,7 @@ public const int WeakFieldNumber = 10; private bool weak_; /// - /// For Google-internal migration only. Do not use. + /// For Google-internal migration only. Do not use. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Weak { @@ -3819,7 +4573,7 @@ = pb::FieldCodec.ForMessage(7994, global::Google.Protobuf.Reflection.UninterpretedOption.Parser); private readonly pbc::RepeatedField uninterpretedOption_ = new pbc::RepeatedField(); /// - /// The parser stores options it doesn't recognize here. See above. + /// The parser stores options it doesn't recognize here. See above. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField UninterpretedOption { @@ -3846,7 +4600,7 @@ if (Deprecated != other.Deprecated) return false; if (Weak != other.Weak) return false; if(!uninterpretedOption_.Equals(other.uninterpretedOption_)) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3859,6 +4613,9 @@ if (Deprecated != false) hash ^= Deprecated.GetHashCode(); if (Weak != false) hash ^= Weak.GetHashCode(); hash ^= uninterpretedOption_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -3894,6 +4651,9 @@ output.WriteBool(Weak); } uninterpretedOption_.WriteTo(output, _repeated_uninterpretedOption_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3918,6 +4678,9 @@ size += 1 + 1; } size += uninterpretedOption_.CalculateSize(_repeated_uninterpretedOption_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -3945,6 +4708,7 @@ Weak = other.Weak; } uninterpretedOption_.Add(other.uninterpretedOption_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3953,7 +4717,7 @@ while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + CustomOptions = CustomOptions.ReadOrSkipUnknownField(input); break; case 8: { ctype_ = (global::Google.Protobuf.Reflection.FieldOptions.Types.CType) input.ReadEnum(); @@ -3993,7 +4757,7 @@ public static partial class Types { internal enum CType { /// - /// Default mode. + /// Default mode. /// [pbr::OriginalName("STRING")] String = 0, [pbr::OriginalName("CORD")] Cord = 1, @@ -4002,15 +4766,15 @@ internal enum JSType { /// - /// Use the default type. + /// Use the default type. /// [pbr::OriginalName("JS_NORMAL")] JsNormal = 0, /// - /// Use JavaScript strings. + /// Use JavaScript strings. /// [pbr::OriginalName("JS_STRING")] JsString = 1, /// - /// Use JavaScript numbers. + /// Use JavaScript numbers. /// [pbr::OriginalName("JS_NUMBER")] JsNumber = 2, } @@ -4022,12 +4786,13 @@ internal sealed partial class OneofOptions : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new OneofOptions()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[12]; } + get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[13]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4035,6 +4800,8 @@ get { return Descriptor; } } + internal CustomOptions CustomOptions{ get; private set; } = CustomOptions.Empty; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public OneofOptions() { OnConstruction(); @@ -4045,6 +4812,7 @@ [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public OneofOptions(OneofOptions other) : this() { uninterpretedOption_ = other.uninterpretedOption_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4058,7 +4826,7 @@ = pb::FieldCodec.ForMessage(7994, global::Google.Protobuf.Reflection.UninterpretedOption.Parser); private readonly pbc::RepeatedField uninterpretedOption_ = new pbc::RepeatedField(); /// - /// The parser stores options it doesn't recognize here. See above. + /// The parser stores options it doesn't recognize here. See above. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField UninterpretedOption { @@ -4079,13 +4847,16 @@ return true; } if(!uninterpretedOption_.Equals(other.uninterpretedOption_)) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; hash ^= uninterpretedOption_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -4097,12 +4868,18 @@ [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { uninterpretedOption_.WriteTo(output, _repeated_uninterpretedOption_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; size += uninterpretedOption_.CalculateSize(_repeated_uninterpretedOption_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -4112,6 +4889,7 @@ return; } uninterpretedOption_.Add(other.uninterpretedOption_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4120,7 +4898,7 @@ while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + CustomOptions = CustomOptions.ReadOrSkipUnknownField(input); break; case 7994: { uninterpretedOption_.AddEntriesFrom(input, _repeated_uninterpretedOption_codec); @@ -4134,12 +4912,13 @@ internal sealed partial class EnumOptions : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new EnumOptions()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[13]; } + get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[14]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4147,6 +4926,8 @@ get { return Descriptor; } } + internal CustomOptions CustomOptions{ get; private set; } = CustomOptions.Empty; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public EnumOptions() { OnConstruction(); @@ -4159,6 +4940,7 @@ allowAlias_ = other.allowAlias_; deprecated_ = other.deprecated_; uninterpretedOption_ = other.uninterpretedOption_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4170,8 +4952,8 @@ public const int AllowAliasFieldNumber = 2; private bool allowAlias_; /// - /// Set this option to true to allow mapping different tag names to the same - /// value. + /// Set this option to true to allow mapping different tag names to the same + /// value. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool AllowAlias { @@ -4185,10 +4967,10 @@ public const int DeprecatedFieldNumber = 3; private bool deprecated_; /// - /// Is this enum deprecated? - /// Depending on the target platform, this can emit Deprecated annotations - /// for the enum, or it will be completely ignored; in the very least, this - /// is a formalization for deprecating enums. + /// Is this enum deprecated? + /// Depending on the target platform, this can emit Deprecated annotations + /// for the enum, or it will be completely ignored; in the very least, this + /// is a formalization for deprecating enums. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Deprecated { @@ -4204,7 +4986,7 @@ = pb::FieldCodec.ForMessage(7994, global::Google.Protobuf.Reflection.UninterpretedOption.Parser); private readonly pbc::RepeatedField uninterpretedOption_ = new pbc::RepeatedField(); /// - /// The parser stores options it doesn't recognize here. See above. + /// The parser stores options it doesn't recognize here. See above. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField UninterpretedOption { @@ -4227,7 +5009,7 @@ if (AllowAlias != other.AllowAlias) return false; if (Deprecated != other.Deprecated) return false; if(!uninterpretedOption_.Equals(other.uninterpretedOption_)) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4236,6 +5018,9 @@ if (AllowAlias != false) hash ^= AllowAlias.GetHashCode(); if (Deprecated != false) hash ^= Deprecated.GetHashCode(); hash ^= uninterpretedOption_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -4255,6 +5040,9 @@ output.WriteBool(Deprecated); } uninterpretedOption_.WriteTo(output, _repeated_uninterpretedOption_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4267,6 +5055,9 @@ size += 1 + 1; } size += uninterpretedOption_.CalculateSize(_repeated_uninterpretedOption_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -4282,6 +5073,7 @@ Deprecated = other.Deprecated; } uninterpretedOption_.Add(other.uninterpretedOption_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4290,7 +5082,7 @@ while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + CustomOptions = CustomOptions.ReadOrSkipUnknownField(input); break; case 16: { AllowAlias = input.ReadBool(); @@ -4312,12 +5104,13 @@ internal sealed partial class EnumValueOptions : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new EnumValueOptions()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[14]; } + get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[15]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4325,6 +5118,8 @@ get { return Descriptor; } } + internal CustomOptions CustomOptions{ get; private set; } = CustomOptions.Empty; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public EnumValueOptions() { OnConstruction(); @@ -4336,6 +5131,7 @@ public EnumValueOptions(EnumValueOptions other) : this() { deprecated_ = other.deprecated_; uninterpretedOption_ = other.uninterpretedOption_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4347,10 +5143,10 @@ public const int DeprecatedFieldNumber = 1; private bool deprecated_; /// - /// Is this enum value deprecated? - /// Depending on the target platform, this can emit Deprecated annotations - /// for the enum value, or it will be completely ignored; in the very least, - /// this is a formalization for deprecating enum values. + /// Is this enum value deprecated? + /// Depending on the target platform, this can emit Deprecated annotations + /// for the enum value, or it will be completely ignored; in the very least, + /// this is a formalization for deprecating enum values. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Deprecated { @@ -4366,7 +5162,7 @@ = pb::FieldCodec.ForMessage(7994, global::Google.Protobuf.Reflection.UninterpretedOption.Parser); private readonly pbc::RepeatedField uninterpretedOption_ = new pbc::RepeatedField(); /// - /// The parser stores options it doesn't recognize here. See above. + /// The parser stores options it doesn't recognize here. See above. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField UninterpretedOption { @@ -4388,7 +5184,7 @@ } if (Deprecated != other.Deprecated) return false; if(!uninterpretedOption_.Equals(other.uninterpretedOption_)) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4396,6 +5192,9 @@ int hash = 1; if (Deprecated != false) hash ^= Deprecated.GetHashCode(); hash ^= uninterpretedOption_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -4411,6 +5210,9 @@ output.WriteBool(Deprecated); } uninterpretedOption_.WriteTo(output, _repeated_uninterpretedOption_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4420,6 +5222,9 @@ size += 1 + 1; } size += uninterpretedOption_.CalculateSize(_repeated_uninterpretedOption_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -4432,6 +5237,7 @@ Deprecated = other.Deprecated; } uninterpretedOption_.Add(other.uninterpretedOption_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4440,7 +5246,7 @@ while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + CustomOptions = CustomOptions.ReadOrSkipUnknownField(input); break; case 8: { Deprecated = input.ReadBool(); @@ -4458,12 +5264,13 @@ internal sealed partial class ServiceOptions : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ServiceOptions()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[15]; } + get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[16]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4471,6 +5278,8 @@ get { return Descriptor; } } + internal CustomOptions CustomOptions{ get; private set; } = CustomOptions.Empty; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public ServiceOptions() { OnConstruction(); @@ -4482,6 +5291,7 @@ public ServiceOptions(ServiceOptions other) : this() { deprecated_ = other.deprecated_; uninterpretedOption_ = other.uninterpretedOption_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4493,10 +5303,10 @@ public const int DeprecatedFieldNumber = 33; private bool deprecated_; /// - /// Is this service deprecated? - /// Depending on the target platform, this can emit Deprecated annotations - /// for the service, or it will be completely ignored; in the very least, - /// this is a formalization for deprecating services. + /// Is this service deprecated? + /// Depending on the target platform, this can emit Deprecated annotations + /// for the service, or it will be completely ignored; in the very least, + /// this is a formalization for deprecating services. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Deprecated { @@ -4512,7 +5322,7 @@ = pb::FieldCodec.ForMessage(7994, global::Google.Protobuf.Reflection.UninterpretedOption.Parser); private readonly pbc::RepeatedField uninterpretedOption_ = new pbc::RepeatedField(); /// - /// The parser stores options it doesn't recognize here. See above. + /// The parser stores options it doesn't recognize here. See above. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField UninterpretedOption { @@ -4534,7 +5344,7 @@ } if (Deprecated != other.Deprecated) return false; if(!uninterpretedOption_.Equals(other.uninterpretedOption_)) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4542,6 +5352,9 @@ int hash = 1; if (Deprecated != false) hash ^= Deprecated.GetHashCode(); hash ^= uninterpretedOption_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -4557,6 +5370,9 @@ output.WriteBool(Deprecated); } uninterpretedOption_.WriteTo(output, _repeated_uninterpretedOption_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4566,6 +5382,9 @@ size += 2 + 1; } size += uninterpretedOption_.CalculateSize(_repeated_uninterpretedOption_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -4578,6 +5397,7 @@ Deprecated = other.Deprecated; } uninterpretedOption_.Add(other.uninterpretedOption_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4586,7 +5406,7 @@ while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + CustomOptions = CustomOptions.ReadOrSkipUnknownField(input); break; case 264: { Deprecated = input.ReadBool(); @@ -4604,12 +5424,13 @@ internal sealed partial class MethodOptions : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new MethodOptions()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[16]; } + get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[17]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4617,6 +5438,8 @@ get { return Descriptor; } } + internal CustomOptions CustomOptions{ get; private set; } = CustomOptions.Empty; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public MethodOptions() { OnConstruction(); @@ -4627,7 +5450,9 @@ [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public MethodOptions(MethodOptions other) : this() { deprecated_ = other.deprecated_; + idempotencyLevel_ = other.idempotencyLevel_; uninterpretedOption_ = other.uninterpretedOption_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4639,10 +5464,10 @@ public const int DeprecatedFieldNumber = 33; private bool deprecated_; /// - /// Is this method deprecated? - /// Depending on the target platform, this can emit Deprecated annotations - /// for the method, or it will be completely ignored; in the very least, - /// this is a formalization for deprecating methods. + /// Is this method deprecated? + /// Depending on the target platform, this can emit Deprecated annotations + /// for the method, or it will be completely ignored; in the very least, + /// this is a formalization for deprecating methods. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Deprecated { @@ -4652,13 +5477,24 @@ } } + /// Field number for the "idempotency_level" field. + public const int IdempotencyLevelFieldNumber = 34; + private global::Google.Protobuf.Reflection.MethodOptions.Types.IdempotencyLevel idempotencyLevel_ = 0; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.Reflection.MethodOptions.Types.IdempotencyLevel IdempotencyLevel { + get { return idempotencyLevel_; } + set { + idempotencyLevel_ = value; + } + } + /// Field number for the "uninterpreted_option" field. public const int UninterpretedOptionFieldNumber = 999; private static readonly pb::FieldCodec _repeated_uninterpretedOption_codec = pb::FieldCodec.ForMessage(7994, global::Google.Protobuf.Reflection.UninterpretedOption.Parser); private readonly pbc::RepeatedField uninterpretedOption_ = new pbc::RepeatedField(); /// - /// The parser stores options it doesn't recognize here. See above. + /// The parser stores options it doesn't recognize here. See above. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField UninterpretedOption { @@ -4679,15 +5515,20 @@ return true; } if (Deprecated != other.Deprecated) return false; + if (IdempotencyLevel != other.IdempotencyLevel) return false; if(!uninterpretedOption_.Equals(other.uninterpretedOption_)) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (Deprecated != false) hash ^= Deprecated.GetHashCode(); + if (IdempotencyLevel != 0) hash ^= IdempotencyLevel.GetHashCode(); hash ^= uninterpretedOption_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -4702,7 +5543,14 @@ output.WriteRawTag(136, 2); output.WriteBool(Deprecated); } + if (IdempotencyLevel != 0) { + output.WriteRawTag(144, 2); + output.WriteEnum((int) IdempotencyLevel); + } uninterpretedOption_.WriteTo(output, _repeated_uninterpretedOption_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4711,7 +5559,13 @@ if (Deprecated != false) { size += 2 + 1; } + if (IdempotencyLevel != 0) { + size += 2 + pb::CodedOutputStream.ComputeEnumSize((int) IdempotencyLevel); + } size += uninterpretedOption_.CalculateSize(_repeated_uninterpretedOption_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -4723,7 +5577,11 @@ if (other.Deprecated != false) { Deprecated = other.Deprecated; } + if (other.IdempotencyLevel != 0) { + IdempotencyLevel = other.IdempotencyLevel; + } uninterpretedOption_.Add(other.uninterpretedOption_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4732,12 +5590,16 @@ while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + CustomOptions = CustomOptions.ReadOrSkipUnknownField(input); break; case 264: { Deprecated = input.ReadBool(); break; } + case 272: { + idempotencyLevel_ = (global::Google.Protobuf.Reflection.MethodOptions.Types.IdempotencyLevel) input.ReadEnum(); + break; + } case 7994: { uninterpretedOption_.AddEntriesFrom(input, _repeated_uninterpretedOption_codec); break; @@ -4746,24 +5608,49 @@ } } + #region Nested types + /// Container for nested types declared in the MethodOptions message type. + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static partial class Types { + /// + /// Is this method side-effect-free (or safe in HTTP parlance), or idempotent, + /// or neither? HTTP based RPC implementation may choose GET verb for safe + /// methods, and PUT verb for idempotent methods instead of the default POST. + /// + internal enum IdempotencyLevel { + [pbr::OriginalName("IDEMPOTENCY_UNKNOWN")] IdempotencyUnknown = 0, + /// + /// implies idempotent + /// + [pbr::OriginalName("NO_SIDE_EFFECTS")] NoSideEffects = 1, + /// + /// idempotent, but may have side effects + /// + [pbr::OriginalName("IDEMPOTENT")] Idempotent = 2, + } + + } + #endregion + } /// - /// A message representing a option the parser does not recognize. This only - /// appears in options protos created by the compiler::Parser class. - /// DescriptorPool resolves these when building Descriptor objects. Therefore, - /// options protos in descriptor objects (e.g. returned by Descriptor::options(), - /// or produced by Descriptor::CopyTo()) will never have UninterpretedOptions - /// in them. + /// A message representing a option the parser does not recognize. This only + /// appears in options protos created by the compiler::Parser class. + /// DescriptorPool resolves these when building Descriptor objects. Therefore, + /// options protos in descriptor objects (e.g. returned by Descriptor::options(), + /// or produced by Descriptor::CopyTo()) will never have UninterpretedOptions + /// in them. /// internal sealed partial class UninterpretedOption : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new UninterpretedOption()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[17]; } + get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[18]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4787,6 +5674,7 @@ doubleValue_ = other.doubleValue_; stringValue_ = other.stringValue_; aggregateValue_ = other.aggregateValue_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4808,8 +5696,8 @@ public const int IdentifierValueFieldNumber = 3; private string identifierValue_ = ""; /// - /// The value of the uninterpreted option, in whatever type the tokenizer - /// identified it as during parsing. Exactly one of these should be set. + /// The value of the uninterpreted option, in whatever type the tokenizer + /// identified it as during parsing. Exactly one of these should be set. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string IdentifierValue { @@ -4891,10 +5779,10 @@ if (IdentifierValue != other.IdentifierValue) return false; if (PositiveIntValue != other.PositiveIntValue) return false; if (NegativeIntValue != other.NegativeIntValue) return false; - if (DoubleValue != other.DoubleValue) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(DoubleValue, other.DoubleValue)) return false; if (StringValue != other.StringValue) return false; if (AggregateValue != other.AggregateValue) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4904,9 +5792,12 @@ if (IdentifierValue.Length != 0) hash ^= IdentifierValue.GetHashCode(); if (PositiveIntValue != 0UL) hash ^= PositiveIntValue.GetHashCode(); if (NegativeIntValue != 0L) hash ^= NegativeIntValue.GetHashCode(); - if (DoubleValue != 0D) hash ^= DoubleValue.GetHashCode(); + if (DoubleValue != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(DoubleValue); if (StringValue.Length != 0) hash ^= StringValue.GetHashCode(); if (AggregateValue.Length != 0) hash ^= AggregateValue.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -4942,6 +5833,9 @@ output.WriteRawTag(66); output.WriteString(AggregateValue); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4966,6 +5860,9 @@ if (AggregateValue.Length != 0) { size += 1 + pb::CodedOutputStream.ComputeStringSize(AggregateValue); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -4993,6 +5890,7 @@ if (other.AggregateValue.Length != 0) { AggregateValue = other.AggregateValue; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -5001,7 +5899,7 @@ while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 18: { name_.AddEntriesFrom(input, _repeated_name_codec); @@ -5040,14 +5938,15 @@ [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static partial class Types { /// - /// The name of the uninterpreted option. Each string represents a segment in - /// a dot-separated name. is_extension is true iff a segment represents an - /// extension (denoted with parentheses in options specs in .proto files). - /// E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents - /// "foo.(bar.baz).qux". + /// The name of the uninterpreted option. Each string represents a segment in + /// a dot-separated name. is_extension is true iff a segment represents an + /// extension (denoted with parentheses in options specs in .proto files). + /// E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents + /// "foo.(bar.baz).qux". /// internal sealed partial class NamePart : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new NamePart()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -5072,6 +5971,7 @@ public NamePart(NamePart other) : this() { namePart_ = other.namePart_; isExtension_ = other.isExtension_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -5116,7 +6016,7 @@ } if (NamePart_ != other.NamePart_) return false; if (IsExtension != other.IsExtension) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -5124,6 +6024,9 @@ int hash = 1; if (NamePart_.Length != 0) hash ^= NamePart_.GetHashCode(); if (IsExtension != false) hash ^= IsExtension.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -5142,6 +6045,9 @@ output.WriteRawTag(16); output.WriteBool(IsExtension); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -5153,6 +6059,9 @@ if (IsExtension != false) { size += 1 + 1; } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -5167,6 +6076,7 @@ if (other.IsExtension != false) { IsExtension = other.IsExtension; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -5175,7 +6085,7 @@ while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { NamePart_ = input.ReadString(); @@ -5197,17 +6107,18 @@ } /// - /// Encapsulates information about the original source file from which a - /// FileDescriptorProto was generated. + /// Encapsulates information about the original source file from which a + /// FileDescriptorProto was generated. /// internal sealed partial class SourceCodeInfo : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SourceCodeInfo()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[18]; } + get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[19]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -5225,6 +6136,7 @@ [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public SourceCodeInfo(SourceCodeInfo other) : this() { location_ = other.location_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -5238,49 +6150,49 @@ = pb::FieldCodec.ForMessage(10, global::Google.Protobuf.Reflection.SourceCodeInfo.Types.Location.Parser); private readonly pbc::RepeatedField location_ = new pbc::RepeatedField(); /// - /// A Location identifies a piece of source code in a .proto file which - /// corresponds to a particular definition. This information is intended - /// to be useful to IDEs, code indexers, documentation generators, and similar - /// tools. + /// A Location identifies a piece of source code in a .proto file which + /// corresponds to a particular definition. This information is intended + /// to be useful to IDEs, code indexers, documentation generators, and similar + /// tools. /// - /// For example, say we have a file like: - /// message Foo { - /// optional string foo = 1; - /// } - /// Let's look at just the field definition: - /// optional string foo = 1; - /// ^ ^^ ^^ ^ ^^^ - /// a bc de f ghi - /// We have the following locations: - /// span path represents - /// [a,i) [ 4, 0, 2, 0 ] The whole field definition. - /// [a,b) [ 4, 0, 2, 0, 4 ] The label (optional). - /// [c,d) [ 4, 0, 2, 0, 5 ] The type (string). - /// [e,f) [ 4, 0, 2, 0, 1 ] The name (foo). - /// [g,h) [ 4, 0, 2, 0, 3 ] The number (1). + /// For example, say we have a file like: + /// message Foo { + /// optional string foo = 1; + /// } + /// Let's look at just the field definition: + /// optional string foo = 1; + /// ^ ^^ ^^ ^ ^^^ + /// a bc de f ghi + /// We have the following locations: + /// span path represents + /// [a,i) [ 4, 0, 2, 0 ] The whole field definition. + /// [a,b) [ 4, 0, 2, 0, 4 ] The label (optional). + /// [c,d) [ 4, 0, 2, 0, 5 ] The type (string). + /// [e,f) [ 4, 0, 2, 0, 1 ] The name (foo). + /// [g,h) [ 4, 0, 2, 0, 3 ] The number (1). /// - /// Notes: - /// - A location may refer to a repeated field itself (i.e. not to any - /// particular index within it). This is used whenever a set of elements are - /// logically enclosed in a single code segment. For example, an entire - /// extend block (possibly containing multiple extension definitions) will - /// have an outer location whose path refers to the "extensions" repeated - /// field without an index. - /// - Multiple locations may have the same path. This happens when a single - /// logical declaration is spread out across multiple places. The most - /// obvious example is the "extend" block again -- there may be multiple - /// extend blocks in the same scope, each of which will have the same path. - /// - A location's span is not always a subset of its parent's span. For - /// example, the "extendee" of an extension declaration appears at the - /// beginning of the "extend" block and is shared by all extensions within - /// the block. - /// - Just because a location's span is a subset of some other location's span - /// does not mean that it is a descendent. For example, a "group" defines - /// both a type and a field in a single declaration. Thus, the locations - /// corresponding to the type and field and their components will overlap. - /// - Code which tries to interpret locations should probably be designed to - /// ignore those that it doesn't understand, as more types of locations could - /// be recorded in the future. + /// Notes: + /// - A location may refer to a repeated field itself (i.e. not to any + /// particular index within it). This is used whenever a set of elements are + /// logically enclosed in a single code segment. For example, an entire + /// extend block (possibly containing multiple extension definitions) will + /// have an outer location whose path refers to the "extensions" repeated + /// field without an index. + /// - Multiple locations may have the same path. This happens when a single + /// logical declaration is spread out across multiple places. The most + /// obvious example is the "extend" block again -- there may be multiple + /// extend blocks in the same scope, each of which will have the same path. + /// - A location's span is not always a subset of its parent's span. For + /// example, the "extendee" of an extension declaration appears at the + /// beginning of the "extend" block and is shared by all extensions within + /// the block. + /// - Just because a location's span is a subset of some other location's span + /// does not mean that it is a descendent. For example, a "group" defines + /// both a type and a field in a single declaration. Thus, the locations + /// corresponding to the type and field and their components will overlap. + /// - Code which tries to interpret locations should probably be designed to + /// ignore those that it doesn't understand, as more types of locations could + /// be recorded in the future. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField Location { @@ -5301,13 +6213,16 @@ return true; } if(!location_.Equals(other.location_)) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; hash ^= location_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -5319,12 +6234,18 @@ [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { location_.WriteTo(output, _repeated_location_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; size += location_.CalculateSize(_repeated_location_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -5334,6 +6255,7 @@ return; } location_.Add(other.location_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -5342,7 +6264,7 @@ while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { location_.AddEntriesFrom(input, _repeated_location_codec); @@ -5358,6 +6280,7 @@ public static partial class Types { internal sealed partial class Location : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Location()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -5385,6 +6308,7 @@ leadingComments_ = other.leadingComments_; trailingComments_ = other.trailingComments_; leadingDetachedComments_ = other.leadingDetachedComments_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -5398,29 +6322,29 @@ = pb::FieldCodec.ForInt32(10); private readonly pbc::RepeatedField path_ = new pbc::RepeatedField(); /// - /// Identifies which part of the FileDescriptorProto was defined at this - /// location. + /// Identifies which part of the FileDescriptorProto was defined at this + /// location. /// - /// Each element is a field number or an index. They form a path from - /// the root FileDescriptorProto to the place where the definition. For - /// example, this path: - /// [ 4, 3, 2, 7, 1 ] - /// refers to: - /// file.message_type(3) // 4, 3 - /// .field(7) // 2, 7 - /// .name() // 1 - /// This is because FileDescriptorProto.message_type has field number 4: - /// repeated DescriptorProto message_type = 4; - /// and DescriptorProto.field has field number 2: - /// repeated FieldDescriptorProto field = 2; - /// and FieldDescriptorProto.name has field number 1: - /// optional string name = 1; + /// Each element is a field number or an index. They form a path from + /// the root FileDescriptorProto to the place where the definition. For + /// example, this path: + /// [ 4, 3, 2, 7, 1 ] + /// refers to: + /// file.message_type(3) // 4, 3 + /// .field(7) // 2, 7 + /// .name() // 1 + /// This is because FileDescriptorProto.message_type has field number 4: + /// repeated DescriptorProto message_type = 4; + /// and DescriptorProto.field has field number 2: + /// repeated FieldDescriptorProto field = 2; + /// and FieldDescriptorProto.name has field number 1: + /// optional string name = 1; /// - /// Thus, the above path gives the location of a field name. If we removed - /// the last element: - /// [ 4, 3, 2, 7 ] - /// this path refers to the whole field declaration (from the beginning - /// of the label to the terminating semicolon). + /// Thus, the above path gives the location of a field name. If we removed + /// the last element: + /// [ 4, 3, 2, 7 ] + /// this path refers to the whole field declaration (from the beginning + /// of the label to the terminating semicolon). /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField Path { @@ -5433,11 +6357,11 @@ = pb::FieldCodec.ForInt32(18); private readonly pbc::RepeatedField span_ = new pbc::RepeatedField(); /// - /// Always has exactly three or four elements: start line, start column, - /// end line (optional, otherwise assumed same as start line), end column. - /// These are packed into a single field for efficiency. Note that line - /// and column numbers are zero-based -- typically you will want to add - /// 1 to each before displaying to a user. + /// Always has exactly three or four elements: start line, start column, + /// end line (optional, otherwise assumed same as start line), end column. + /// These are packed into a single field for efficiency. Note that line + /// and column numbers are zero-based -- typically you will want to add + /// 1 to each before displaying to a user. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField Span { @@ -5448,53 +6372,53 @@ public const int LeadingCommentsFieldNumber = 3; private string leadingComments_ = ""; /// - /// If this SourceCodeInfo represents a complete declaration, these are any - /// comments appearing before and after the declaration which appear to be - /// attached to the declaration. + /// If this SourceCodeInfo represents a complete declaration, these are any + /// comments appearing before and after the declaration which appear to be + /// attached to the declaration. /// - /// A series of line comments appearing on consecutive lines, with no other - /// tokens appearing on those lines, will be treated as a single comment. + /// A series of line comments appearing on consecutive lines, with no other + /// tokens appearing on those lines, will be treated as a single comment. /// - /// leading_detached_comments will keep paragraphs of comments that appear - /// before (but not connected to) the current element. Each paragraph, - /// separated by empty lines, will be one comment element in the repeated - /// field. + /// leading_detached_comments will keep paragraphs of comments that appear + /// before (but not connected to) the current element. Each paragraph, + /// separated by empty lines, will be one comment element in the repeated + /// field. /// - /// Only the comment content is provided; comment markers (e.g. //) are - /// stripped out. For block comments, leading whitespace and an asterisk - /// will be stripped from the beginning of each line other than the first. - /// Newlines are included in the output. + /// Only the comment content is provided; comment markers (e.g. //) are + /// stripped out. For block comments, leading whitespace and an asterisk + /// will be stripped from the beginning of each line other than the first. + /// Newlines are included in the output. /// - /// Examples: + /// Examples: /// - /// optional int32 foo = 1; // Comment attached to foo. - /// // Comment attached to bar. - /// optional int32 bar = 2; + /// optional int32 foo = 1; // Comment attached to foo. + /// // Comment attached to bar. + /// optional int32 bar = 2; /// - /// optional string baz = 3; - /// // Comment attached to baz. - /// // Another line attached to baz. + /// optional string baz = 3; + /// // Comment attached to baz. + /// // Another line attached to baz. /// - /// // Comment attached to qux. - /// // - /// // Another line attached to qux. - /// optional double qux = 4; + /// // Comment attached to qux. + /// // + /// // Another line attached to qux. + /// optional double qux = 4; /// - /// // Detached comment for corge. This is not leading or trailing comments - /// // to qux or corge because there are blank lines separating it from - /// // both. + /// // Detached comment for corge. This is not leading or trailing comments + /// // to qux or corge because there are blank lines separating it from + /// // both. /// - /// // Detached comment for corge paragraph 2. + /// // Detached comment for corge paragraph 2. /// - /// optional string corge = 5; - /// /* Block comment attached - /// * to corge. Leading asterisks - /// * will be removed. */ - /// /* Block comment attached to - /// * grault. */ - /// optional int32 grault = 6; + /// optional string corge = 5; + /// /* Block comment attached + /// * to corge. Leading asterisks + /// * will be removed. */ + /// /* Block comment attached to + /// * grault. */ + /// optional int32 grault = 6; /// - /// // ignored detached comments. + /// // ignored detached comments. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string LeadingComments { @@ -5543,7 +6467,7 @@ if (LeadingComments != other.LeadingComments) return false; if (TrailingComments != other.TrailingComments) return false; if(!leadingDetachedComments_.Equals(other.leadingDetachedComments_)) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -5554,6 +6478,9 @@ if (LeadingComments.Length != 0) hash ^= LeadingComments.GetHashCode(); if (TrailingComments.Length != 0) hash ^= TrailingComments.GetHashCode(); hash ^= leadingDetachedComments_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -5575,6 +6502,9 @@ output.WriteString(TrailingComments); } leadingDetachedComments_.WriteTo(output, _repeated_leadingDetachedComments_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -5589,6 +6519,9 @@ size += 1 + pb::CodedOutputStream.ComputeStringSize(TrailingComments); } size += leadingDetachedComments_.CalculateSize(_repeated_leadingDetachedComments_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -5606,6 +6539,7 @@ TrailingComments = other.TrailingComments; } leadingDetachedComments_.Add(other.leadingDetachedComments_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -5614,7 +6548,7 @@ while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: case 8: { @@ -5650,18 +6584,19 @@ } /// - /// Describes the relationship between generated code and its original source - /// file. A GeneratedCodeInfo message is associated with only one generated - /// source file, but may contain references to different source .proto files. + /// Describes the relationship between generated code and its original source + /// file. A GeneratedCodeInfo message is associated with only one generated + /// source file, but may contain references to different source .proto files. /// internal sealed partial class GeneratedCodeInfo : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new GeneratedCodeInfo()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[19]; } + get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[20]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -5679,6 +6614,7 @@ [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public GeneratedCodeInfo(GeneratedCodeInfo other) : this() { annotation_ = other.annotation_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -5692,8 +6628,8 @@ = pb::FieldCodec.ForMessage(10, global::Google.Protobuf.Reflection.GeneratedCodeInfo.Types.Annotation.Parser); private readonly pbc::RepeatedField annotation_ = new pbc::RepeatedField(); /// - /// An Annotation connects some span of text in generated code to an element - /// of its generating .proto file. + /// An Annotation connects some span of text in generated code to an element + /// of its generating .proto file. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField Annotation { @@ -5714,13 +6650,16 @@ return true; } if(!annotation_.Equals(other.annotation_)) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; hash ^= annotation_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -5732,12 +6671,18 @@ [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { annotation_.WriteTo(output, _repeated_annotation_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; size += annotation_.CalculateSize(_repeated_annotation_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -5747,6 +6692,7 @@ return; } annotation_.Add(other.annotation_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -5755,7 +6701,7 @@ while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { annotation_.AddEntriesFrom(input, _repeated_annotation_codec); @@ -5771,6 +6717,7 @@ public static partial class Types { internal sealed partial class Annotation : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Annotation()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -5797,6 +6744,7 @@ sourceFile_ = other.sourceFile_; begin_ = other.begin_; end_ = other.end_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -5810,8 +6758,8 @@ = pb::FieldCodec.ForInt32(10); private readonly pbc::RepeatedField path_ = new pbc::RepeatedField(); /// - /// Identifies the element in the original source .proto file. This field - /// is formatted the same as SourceCodeInfo.Location.path. + /// Identifies the element in the original source .proto file. This field + /// is formatted the same as SourceCodeInfo.Location.path. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField Path { @@ -5822,7 +6770,7 @@ public const int SourceFileFieldNumber = 2; private string sourceFile_ = ""; /// - /// Identifies the filesystem path to the original source .proto. + /// Identifies the filesystem path to the original source .proto. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string SourceFile { @@ -5836,8 +6784,8 @@ public const int BeginFieldNumber = 3; private int begin_; /// - /// Identifies the starting offset in bytes in the generated code - /// that relates to the identified object. + /// Identifies the starting offset in bytes in the generated code + /// that relates to the identified object. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int Begin { @@ -5851,9 +6799,9 @@ public const int EndFieldNumber = 4; private int end_; /// - /// Identifies the ending offset in bytes in the generated code that - /// relates to the identified offset. The end offset should be one past - /// the last relevant byte (so the length of the text = end - begin). + /// Identifies the ending offset in bytes in the generated code that + /// relates to the identified offset. The end offset should be one past + /// the last relevant byte (so the length of the text = end - begin). /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int End { @@ -5880,7 +6828,7 @@ if (SourceFile != other.SourceFile) return false; if (Begin != other.Begin) return false; if (End != other.End) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -5890,6 +6838,9 @@ if (SourceFile.Length != 0) hash ^= SourceFile.GetHashCode(); if (Begin != 0) hash ^= Begin.GetHashCode(); if (End != 0) hash ^= End.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -5913,6 +6864,9 @@ output.WriteRawTag(32); output.WriteInt32(End); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -5928,6 +6882,9 @@ if (End != 0) { size += 1 + pb::CodedOutputStream.ComputeInt32Size(End); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -5946,6 +6903,7 @@ if (other.End != 0) { End = other.End; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -5954,7 +6912,7 @@ while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: case 8: { diff -Nru protobuf-3.0.0/csharp/src/Google.Protobuf/Reflection/EnumDescriptor.cs protobuf-3.6.1.3/csharp/src/Google.Protobuf/Reflection/EnumDescriptor.cs --- protobuf-3.0.0/csharp/src/Google.Protobuf/Reflection/EnumDescriptor.cs 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/csharp/src/Google.Protobuf/Reflection/EnumDescriptor.cs 2018-12-08 01:32:11.000000000 +0000 @@ -112,5 +112,10 @@ { return File.DescriptorPool.FindSymbol(FullName + "." + name); } + + /// + /// The (possibly empty) set of custom options for this enum. + /// + public CustomOptions CustomOptions => Proto.Options?.CustomOptions ?? CustomOptions.Empty; } } \ No newline at end of file diff -Nru protobuf-3.0.0/csharp/src/Google.Protobuf/Reflection/EnumValueDescriptor.cs protobuf-3.6.1.3/csharp/src/Google.Protobuf/Reflection/EnumValueDescriptor.cs --- protobuf-3.0.0/csharp/src/Google.Protobuf/Reflection/EnumValueDescriptor.cs 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/csharp/src/Google.Protobuf/Reflection/EnumValueDescriptor.cs 2018-12-08 01:32:11.000000000 +0000 @@ -66,5 +66,10 @@ /// Returns the enum descriptor that this value is part of. /// public EnumDescriptor EnumDescriptor { get { return enumDescriptor; } } + + /// + /// The (possibly empty) set of custom options for this enum value. + /// + public CustomOptions CustomOptions => Proto.Options?.CustomOptions ?? CustomOptions.Empty; } } \ No newline at end of file diff -Nru protobuf-3.0.0/csharp/src/Google.Protobuf/Reflection/FieldDescriptor.cs protobuf-3.6.1.3/csharp/src/Google.Protobuf/Reflection/FieldDescriptor.cs --- protobuf-3.0.0/csharp/src/Google.Protobuf/Reflection/FieldDescriptor.cs 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/csharp/src/Google.Protobuf/Reflection/FieldDescriptor.cs 2018-12-08 01:32:11.000000000 +0000 @@ -97,7 +97,7 @@ // We could trust the generated code and check whether the type of the property is // a MapField, but that feels a tad nasty. this.propertyName = propertyName; - JsonName = Proto.JsonName == "" ? JsonFormatter.ToCamelCase(Proto.Name) : Proto.JsonName; + JsonName = Proto.JsonName == "" ? JsonFormatter.ToJsonName(Proto.Name) : Proto.JsonName; } @@ -251,6 +251,11 @@ } /// + /// The (possibly empty) set of custom options for this field. + /// + public CustomOptions CustomOptions => Proto.Options?.CustomOptions ?? CustomOptions.Empty; + + /// /// Look up and cross-link all field types etc. /// internal void CrossLink() diff -Nru protobuf-3.0.0/csharp/src/Google.Protobuf/Reflection/FileDescriptor.cs protobuf-3.6.1.3/csharp/src/Google.Protobuf/Reflection/FileDescriptor.cs --- protobuf-3.0.0/csharp/src/Google.Protobuf/Reflection/FileDescriptor.cs 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/csharp/src/Google.Protobuf/Reflection/FileDescriptor.cs 2018-12-08 01:32:11.000000000 +0000 @@ -30,6 +30,7 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #endregion +using Google.Protobuf.WellKnownTypes; using System; using System.Collections.Generic; using System.Collections.ObjectModel; @@ -43,6 +44,16 @@ /// public sealed class FileDescriptor : IDescriptor { + // Prevent linker failures when using IL2CPP with the well-known types. + static FileDescriptor() + { + ForceReflectionInitialization(); + ForceReflectionInitialization(); + ForceReflectionInitialization(); + ForceReflectionInitialization(); + ForceReflectionInitialization(); + } + private FileDescriptor(ByteString descriptorData, FileDescriptorProto proto, FileDescriptor[] dependencies, DescriptorPool pool, bool allowUnknownDependencies, GeneratedClrTypeInfo generatedCodeInfo) { SerializedData = descriptorData; @@ -251,17 +262,6 @@ "Dependencies passed to FileDescriptor.BuildFrom() don't match " + "those listed in the FileDescriptorProto."); } - for (int i = 0; i < proto.Dependency.Count; i++) - { - if (dependencies[i].Name != proto.Dependency[i]) - { - throw new DescriptorValidationException( - result, - "Dependencies passed to FileDescriptor.BuildFrom() don't match " + - "those listed in the FileDescriptorProto. Expected: " + - proto.Dependency[i] + " but was: " + dependencies[i].Name); - } - } result.CrossLink(); return result; @@ -340,5 +340,23 @@ /// The file descriptor for descriptor.proto. /// public static FileDescriptor DescriptorProtoFileDescriptor { get { return DescriptorReflection.Descriptor; } } + + /// + /// The (possibly empty) set of custom options for this file. + /// + public CustomOptions CustomOptions => Proto.Options?.CustomOptions ?? CustomOptions.Empty; + + /// + /// Performs initialization for the given generic type argument. + /// + /// + /// This method is present for the sake of AOT compilers. It allows code (whether handwritten or generated) + /// to make calls into the reflection machinery of this library to express an intention to use that type + /// reflectively (e.g. for JSON parsing and formatting). The call itself does almost nothing, but AOT compilers + /// attempting to determine which generic type arguments need to be handled will spot the code path and act + /// accordingly. + /// + /// The type to force initialization for. + public static void ForceReflectionInitialization() => ReflectionUtil.ForceInitialize(); } -} \ No newline at end of file +} diff -Nru protobuf-3.0.0/csharp/src/Google.Protobuf/Reflection/MessageDescriptor.cs protobuf-3.6.1.3/csharp/src/Google.Protobuf/Reflection/MessageDescriptor.cs --- protobuf-3.0.0/csharp/src/Google.Protobuf/Reflection/MessageDescriptor.cs 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/csharp/src/Google.Protobuf/Reflection/MessageDescriptor.cs 2018-12-08 01:32:11.000000000 +0000 @@ -34,7 +34,7 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; -#if DOTNET35 +#if NET35 // Needed for ReadOnlyDictionary, which does not exist in .NET 3.5 using Google.Protobuf.Collections; #endif @@ -221,6 +221,11 @@ File.DescriptorPool.FindSymbol(FullName + "." + name); /// + /// The (possibly empty) set of custom options for this message. + /// + public CustomOptions CustomOptions => Proto.Options?.CustomOptions ?? CustomOptions.Empty; + + /// /// Looks up and cross-links all fields and nested types. /// internal void CrossLink() diff -Nru protobuf-3.0.0/csharp/src/Google.Protobuf/Reflection/MethodDescriptor.cs protobuf-3.6.1.3/csharp/src/Google.Protobuf/Reflection/MethodDescriptor.cs --- protobuf-3.0.0/csharp/src/Google.Protobuf/Reflection/MethodDescriptor.cs 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/csharp/src/Google.Protobuf/Reflection/MethodDescriptor.cs 2018-12-08 01:32:11.000000000 +0000 @@ -67,6 +67,11 @@ /// public bool IsServerStreaming { get { return proto.ServerStreaming; } } + /// + /// The (possibly empty) set of custom options for this method. + /// + public CustomOptions CustomOptions => Proto.Options?.CustomOptions ?? CustomOptions.Empty; + internal MethodDescriptor(MethodDescriptorProto proto, FileDescriptor file, ServiceDescriptor parent, int index) : base(file, parent.FullName + "." + proto.Name, index) diff -Nru protobuf-3.0.0/csharp/src/Google.Protobuf/Reflection/OneofAccessor.cs protobuf-3.6.1.3/csharp/src/Google.Protobuf/Reflection/OneofAccessor.cs --- protobuf-3.0.0/csharp/src/Google.Protobuf/Reflection/OneofAccessor.cs 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/csharp/src/Google.Protobuf/Reflection/OneofAccessor.cs 2018-12-08 01:32:11.000000000 +0000 @@ -52,7 +52,7 @@ throw new ArgumentException("Cannot read from property"); } this.descriptor = descriptor; - caseDelegate = ReflectionUtil.CreateFuncIMessageT(caseProperty.GetGetMethod()); + caseDelegate = ReflectionUtil.CreateFuncIMessageInt32(caseProperty.GetGetMethod()); this.descriptor = descriptor; clearDelegate = ReflectionUtil.CreateActionIMessage(clearMethod); diff -Nru protobuf-3.0.0/csharp/src/Google.Protobuf/Reflection/OneofDescriptor.cs protobuf-3.6.1.3/csharp/src/Google.Protobuf/Reflection/OneofDescriptor.cs --- protobuf-3.0.0/csharp/src/Google.Protobuf/Reflection/OneofDescriptor.cs 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/csharp/src/Google.Protobuf/Reflection/OneofDescriptor.cs 2018-12-08 01:32:11.000000000 +0000 @@ -90,6 +90,11 @@ /// public OneofAccessor Accessor { get { return accessor; } } + /// + /// The (possibly empty) set of custom options for this oneof. + /// + public CustomOptions CustomOptions => proto.Options?.CustomOptions ?? CustomOptions.Empty; + internal void CrossLink() { List fieldCollection = new List(); diff -Nru protobuf-3.0.0/csharp/src/Google.Protobuf/Reflection/OriginalNameAttribute.cs protobuf-3.6.1.3/csharp/src/Google.Protobuf/Reflection/OriginalNameAttribute.cs --- protobuf-3.0.0/csharp/src/Google.Protobuf/Reflection/OriginalNameAttribute.cs 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/csharp/src/Google.Protobuf/Reflection/OriginalNameAttribute.cs 2018-12-08 01:32:11.000000000 +0000 @@ -47,12 +47,19 @@ public string Name { get; set; } /// + /// If the name is preferred in the .proto file. + /// + public bool PreferredAlias { get; set; } + + /// /// Constructs a new attribute instance for the given name. /// /// The name of the element in the .proto file. public OriginalNameAttribute(string name) { Name = ProtoPreconditions.CheckNotNull(name, nameof(name)); + PreferredAlias = true; } + } -} \ No newline at end of file +} diff -Nru protobuf-3.0.0/csharp/src/Google.Protobuf/Reflection/ReflectionUtil.cs protobuf-3.6.1.3/csharp/src/Google.Protobuf/Reflection/ReflectionUtil.cs --- protobuf-3.0.0/csharp/src/Google.Protobuf/Reflection/ReflectionUtil.cs 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/csharp/src/Google.Protobuf/Reflection/ReflectionUtil.cs 2018-12-08 01:32:11.000000000 +0000 @@ -30,9 +30,8 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #endregion +using Google.Protobuf.Compatibility; using System; -using System.Collections.Generic; -using System.Linq.Expressions; using System.Reflection; namespace Google.Protobuf.Reflection @@ -47,61 +46,160 @@ /// internal static class ReflectionUtil { + static ReflectionUtil() + { + ForceInitialize(); // Handles all reference types + ForceInitialize(); + ForceInitialize(); + ForceInitialize(); + ForceInitialize(); + ForceInitialize(); + ForceInitialize(); + ForceInitialize(); + ForceInitialize(); + ForceInitialize(); + ForceInitialize(); + ForceInitialize(); + ForceInitialize(); + ForceInitialize(); + ForceInitialize(); + ForceInitialize(); + SampleEnumMethod(); + } + + internal static void ForceInitialize() => new ReflectionHelper(); + /// /// Empty Type[] used when calling GetProperty to force property instead of indexer fetching. /// internal static readonly Type[] EmptyTypes = new Type[0]; /// - /// Creates a delegate which will cast the argument to the appropriate method target type, + /// Creates a delegate which will cast the argument to the type that declares the method, /// call the method on it, then convert the result to object. /// - internal static Func CreateFuncIMessageObject(MethodInfo method) - { - ParameterExpression parameter = Expression.Parameter(typeof(IMessage), "p"); - Expression downcast = Expression.Convert(parameter, method.DeclaringType); - Expression call = Expression.Call(downcast, method); - Expression upcast = Expression.Convert(call, typeof(object)); - return Expression.Lambda>(upcast, parameter).Compile(); - } + /// The method to create a delegate for, which must be declared in an IMessage + /// implementation. + internal static Func CreateFuncIMessageObject(MethodInfo method) => + GetReflectionHelper(method.DeclaringType, method.ReturnType).CreateFuncIMessageObject(method); /// - /// Creates a delegate which will cast the argument to the appropriate method target type, - /// call the method on it, then convert the result to the specified type. + /// Creates a delegate which will cast the argument to the type that declares the method, + /// call the method on it, then convert the result to the specified type. The method is expected + /// to actually return an enum (because of where we're calling it - for oneof cases). Sometimes that + /// means we need some extra work to perform conversions. /// - internal static Func CreateFuncIMessageT(MethodInfo method) - { - ParameterExpression parameter = Expression.Parameter(typeof(IMessage), "p"); - Expression downcast = Expression.Convert(parameter, method.DeclaringType); - Expression call = Expression.Call(downcast, method); - Expression upcast = Expression.Convert(call, typeof(T)); - return Expression.Lambda>(upcast, parameter).Compile(); - } + /// The method to create a delegate for, which must be declared in an IMessage + /// implementation. + internal static Func CreateFuncIMessageInt32(MethodInfo method) => + GetReflectionHelper(method.DeclaringType, method.ReturnType).CreateFuncIMessageInt32(method); /// /// Creates a delegate which will execute the given method after casting the first argument to - /// the target type of the method, and the second argument to the first parameter type of the method. + /// the type that declares the method, and the second argument to the first parameter type of the method. /// - internal static Action CreateActionIMessageObject(MethodInfo method) - { - ParameterExpression targetParameter = Expression.Parameter(typeof(IMessage), "target"); - ParameterExpression argParameter = Expression.Parameter(typeof(object), "arg"); - Expression castTarget = Expression.Convert(targetParameter, method.DeclaringType); - Expression castArgument = Expression.Convert(argParameter, method.GetParameters()[0].ParameterType); - Expression call = Expression.Call(castTarget, method, castArgument); - return Expression.Lambda>(call, targetParameter, argParameter).Compile(); - } + /// The method to create a delegate for, which must be declared in an IMessage + /// implementation. + internal static Action CreateActionIMessageObject(MethodInfo method) => + GetReflectionHelper(method.DeclaringType, method.GetParameters()[0].ParameterType).CreateActionIMessageObject(method); /// /// Creates a delegate which will execute the given method after casting the first argument to - /// the target type of the method. + /// type that declares the method. /// - internal static Action CreateActionIMessage(MethodInfo method) + /// The method to create a delegate for, which must be declared in an IMessage + /// implementation. + internal static Action CreateActionIMessage(MethodInfo method) => + GetReflectionHelper(method.DeclaringType, typeof(object)).CreateActionIMessage(method); + + /// + /// Creates a reflection helper for the given type arguments. Currently these are created on demand + /// rather than cached; this will be "busy" when initially loading a message's descriptor, but after that + /// they can be garbage collected. We could cache them by type if that proves to be important, but creating + /// an object is pretty cheap. + /// + private static IReflectionHelper GetReflectionHelper(Type t1, Type t2) => + (IReflectionHelper) Activator.CreateInstance(typeof(ReflectionHelper<,>).MakeGenericType(t1, t2)); + + // Non-generic interface allowing us to use an instance of ReflectionHelper without statically + // knowing the types involved. + private interface IReflectionHelper { - ParameterExpression targetParameter = Expression.Parameter(typeof(IMessage), "target"); - Expression castTarget = Expression.Convert(targetParameter, method.DeclaringType); - Expression call = Expression.Call(castTarget, method); - return Expression.Lambda>(call, targetParameter).Compile(); - } + Func CreateFuncIMessageInt32(MethodInfo method); + Action CreateActionIMessage(MethodInfo method); + Func CreateFuncIMessageObject(MethodInfo method); + Action CreateActionIMessageObject(MethodInfo method); + } + + private class ReflectionHelper : IReflectionHelper + { + + public Func CreateFuncIMessageInt32(MethodInfo method) + { + // On pleasant runtimes, we can create a Func from a method returning + // an enum based on an int. That's the fast path. + if (CanConvertEnumFuncToInt32Func) + { + var del = (Func) method.CreateDelegate(typeof(Func)); + return message => del((T1) message); + } + else + { + // On some runtimes (e.g. old Mono) the return type has to be exactly correct, + // so we go via boxing. Reflection is already fairly inefficient, and this is + // only used for one-of case checking, fortunately. + var del = (Func) method.CreateDelegate(typeof(Func)); + return message => (int) (object) del((T1) message); + } + } + + public Action CreateActionIMessage(MethodInfo method) + { + var del = (Action) method.CreateDelegate(typeof(Action)); + return message => del((T1) message); + } + + public Func CreateFuncIMessageObject(MethodInfo method) + { + var del = (Func) method.CreateDelegate(typeof(Func)); + return message => del((T1) message); + } + + public Action CreateActionIMessageObject(MethodInfo method) + { + var del = (Action) method.CreateDelegate(typeof(Action)); + return (message, arg) => del((T1) message, (T2) arg); + } + } + + // Runtime compatibility checking code - see ReflectionHelper.CreateFuncIMessageInt32 for + // details about why we're doing this. + + // Deliberately not inside the generic type. We only want to check this once. + private static bool CanConvertEnumFuncToInt32Func { get; } = CheckCanConvertEnumFuncToInt32Func(); + + private static bool CheckCanConvertEnumFuncToInt32Func() + { + try + { + // Try to do the conversion using reflection, so we can see whether it's supported. + MethodInfo method = typeof(ReflectionUtil).GetMethod(nameof(SampleEnumMethod)); + // If this passes, we're in a reasonable runtime. + method.CreateDelegate(typeof(Func)); + return true; + } + catch (ArgumentException) + { + return false; + } + } + + public enum SampleEnum + { + X + } + + // Public to make the reflection simpler. + public static SampleEnum SampleEnumMethod() => SampleEnum.X; } -} \ No newline at end of file +} diff -Nru protobuf-3.0.0/csharp/src/Google.Protobuf/Reflection/ServiceDescriptor.cs protobuf-3.6.1.3/csharp/src/Google.Protobuf/Reflection/ServiceDescriptor.cs --- protobuf-3.0.0/csharp/src/Google.Protobuf/Reflection/ServiceDescriptor.cs 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/csharp/src/Google.Protobuf/Reflection/ServiceDescriptor.cs 2018-12-08 01:32:11.000000000 +0000 @@ -78,6 +78,11 @@ return File.DescriptorPool.FindSymbol(FullName + "." + name); } + /// + /// The (possibly empty) set of custom options for this service. + /// + public CustomOptions CustomOptions => Proto.Options?.CustomOptions ?? CustomOptions.Empty; + internal void CrossLink() { foreach (MethodDescriptor method in methods) diff -Nru protobuf-3.0.0/csharp/src/Google.Protobuf/UnknownField.cs protobuf-3.6.1.3/csharp/src/Google.Protobuf/UnknownField.cs --- protobuf-3.0.0/csharp/src/Google.Protobuf/UnknownField.cs 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/csharp/src/Google.Protobuf/UnknownField.cs 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,263 @@ +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2017 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using Google.Protobuf.Collections; + +namespace Google.Protobuf +{ + /// + /// Represents a single field in an UnknownFieldSet. + /// + /// An UnknownField consists of four lists of values. The lists correspond + /// to the four "wire types" used in the protocol buffer binary format. + /// Normally, only one of the four lists will contain any values, since it + /// is impossible to define a valid message type that declares two different + /// types for the same field number. However, the code is designed to allow + /// for the case where the same unknown field number is encountered using + /// multiple different wire types. + /// + /// + internal sealed class UnknownField + { + private List varintList; + private List fixed32List; + private List fixed64List; + private List lengthDelimitedList; + + /// + /// Creates a new UnknownField. + /// + public UnknownField() + { + } + + /// + /// Checks if two unknown field are equal. + /// + public override bool Equals(object other) + { + if (ReferenceEquals(this, other)) + { + return true; + } + UnknownField otherField = other as UnknownField; + return otherField != null + && Lists.Equals(varintList, otherField.varintList) + && Lists.Equals(fixed32List, otherField.fixed32List) + && Lists.Equals(fixed64List, otherField.fixed64List) + && Lists.Equals(lengthDelimitedList, otherField.lengthDelimitedList); + } + + /// + /// Get the hash code of the unknown field. + /// + public override int GetHashCode() + { + int hash = 43; + hash = hash * 47 + Lists.GetHashCode(varintList); + hash = hash * 47 + Lists.GetHashCode(fixed32List); + hash = hash * 47 + Lists.GetHashCode(fixed64List); + hash = hash * 47 + Lists.GetHashCode(lengthDelimitedList); + return hash; + } + + /// + /// Serializes the field, including the field number, and writes it to + /// + /// + /// The unknown field number. + /// The CodedOutputStream to write to. + internal void WriteTo(int fieldNumber, CodedOutputStream output) + { + if (varintList != null) + { + foreach (ulong value in varintList) + { + output.WriteTag(fieldNumber, WireFormat.WireType.Varint); + output.WriteUInt64(value); + } + } + if (fixed32List != null) + { + foreach (uint value in fixed32List) + { + output.WriteTag(fieldNumber, WireFormat.WireType.Fixed32); + output.WriteFixed32(value); + } + } + if (fixed64List != null) + { + foreach (ulong value in fixed64List) + { + output.WriteTag(fieldNumber, WireFormat.WireType.Fixed64); + output.WriteFixed64(value); + } + } + if (lengthDelimitedList != null) + { + foreach (ByteString value in lengthDelimitedList) + { + output.WriteTag(fieldNumber, WireFormat.WireType.LengthDelimited); + output.WriteBytes(value); + } + } + } + + /// + /// Computes the number of bytes required to encode this field, including field + /// number. + /// + internal int GetSerializedSize(int fieldNumber) + { + int result = 0; + if (varintList != null) + { + result += CodedOutputStream.ComputeTagSize(fieldNumber) * varintList.Count; + foreach (ulong value in varintList) + { + result += CodedOutputStream.ComputeUInt64Size(value); + } + } + if (fixed32List != null) + { + result += CodedOutputStream.ComputeTagSize(fieldNumber) * fixed32List.Count; + result += CodedOutputStream.ComputeFixed32Size(1) * fixed32List.Count; + } + if (fixed64List != null) + { + result += CodedOutputStream.ComputeTagSize(fieldNumber) * fixed64List.Count; + result += CodedOutputStream.ComputeFixed64Size(1) * fixed64List.Count; + } + if (lengthDelimitedList != null) + { + result += CodedOutputStream.ComputeTagSize(fieldNumber) * lengthDelimitedList.Count; + foreach (ByteString value in lengthDelimitedList) + { + result += CodedOutputStream.ComputeBytesSize(value); + } + } + return result; + } + + /// + /// Merge the values in into this field. For each list + /// of values, 's values are append to the ones in this + /// field. + /// + internal UnknownField MergeFrom(UnknownField other) + { + varintList = AddAll(varintList, other.varintList); + fixed32List = AddAll(fixed32List, other.fixed32List); + fixed64List = AddAll(fixed64List, other.fixed64List); + lengthDelimitedList = AddAll(lengthDelimitedList, other.lengthDelimitedList); + return this; + } + + /// + /// Returns a new list containing all of the given specified values from + /// both the and lists. + /// If is null and is empty, + /// null is returned. Otherwise, either a new list is created (if + /// is null) or the elements of are added to . + /// + private static List AddAll(List current, IList extras) + { + if (extras.Count == 0) + { + return current; + } + if (current == null) + { + current = new List(extras); + } + else + { + current.AddRange(extras); + } + return current; + } + + /// + /// Adds a varint value. + /// + internal UnknownField AddVarint(ulong value) + { + varintList = Add(varintList, value); + return this; + } + + /// + /// Adds a fixed32 value. + /// + internal UnknownField AddFixed32(uint value) + { + fixed32List = Add(fixed32List, value); + return this; + } + + /// + /// Adds a fixed64 value. + /// + internal UnknownField AddFixed64(ulong value) + { + fixed64List = Add(fixed64List, value); + return this; + } + + /// + /// Adds a length-delimited value. + /// + internal UnknownField AddLengthDelimited(ByteString value) + { + lengthDelimitedList = Add(lengthDelimitedList, value); + return this; + } + + /// + /// Adds to the , creating + /// a new list if is null. The list is returned - either + /// the original reference or the new list. + /// + private static List Add(List list, T value) + { + if (list == null) + { + list = new List(); + } + list.Add(value); + return list; + } + } +} diff -Nru protobuf-3.0.0/csharp/src/Google.Protobuf/UnknownFieldSet.cs protobuf-3.6.1.3/csharp/src/Google.Protobuf/UnknownFieldSet.cs --- protobuf-3.0.0/csharp/src/Google.Protobuf/UnknownFieldSet.cs 1970-01-01 00:00:00.000000000 +0000 +++ protobuf-3.6.1.3/csharp/src/Google.Protobuf/UnknownFieldSet.cs 2018-12-08 01:32:11.000000000 +0000 @@ -0,0 +1,330 @@ +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2015 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using System; +using System.Collections.Generic; +using System.IO; +using Google.Protobuf.Reflection; + +namespace Google.Protobuf +{ + /// + /// Used to keep track of fields which were seen when parsing a protocol message + /// but whose field numbers or types are unrecognized. This most frequently + /// occurs when new fields are added to a message type and then messages containing + /// those fields are read by old software that was built before the new types were + /// added. + /// + /// Most users will never need to use this class directly. + /// + public sealed partial class UnknownFieldSet + { + private readonly IDictionary fields; + + /// + /// Creates a new UnknownFieldSet. + /// + internal UnknownFieldSet() + { + this.fields = new Dictionary(); + } + + /// + /// Checks whether or not the given field number is present in the set. + /// + internal bool HasField(int field) + { + return fields.ContainsKey(field); + } + + /// + /// Serializes the set and writes it to . + /// + public void WriteTo(CodedOutputStream output) + { + foreach (KeyValuePair entry in fields) + { + entry.Value.WriteTo(entry.Key, output); + } + } + + /// + /// Gets the number of bytes required to encode this set. + /// + public int CalculateSize() + { + int result = 0; + foreach (KeyValuePair entry in fields) + { + result += entry.Value.GetSerializedSize(entry.Key); + } + return result; + } + + /// + /// Checks if two unknown field sets are equal. + /// + public override bool Equals(object other) + { + if (ReferenceEquals(this, other)) + { + return true; + } + UnknownFieldSet otherSet = other as UnknownFieldSet; + IDictionary otherFields = otherSet.fields; + if (fields.Count != otherFields.Count) + { + return false; + } + foreach (KeyValuePair leftEntry in fields) + { + UnknownField rightValue; + if (!otherFields.TryGetValue(leftEntry.Key, out rightValue)) + { + return false; + } + if (!leftEntry.Value.Equals(rightValue)) + { + return false; + } + } + return true; + } + + /// + /// Gets the unknown field set's hash code. + /// + public override int GetHashCode() + { + int ret = 1; + foreach (KeyValuePair field in fields) + { + // Use ^ here to make the field order irrelevant. + int hash = field.Key.GetHashCode() ^ field.Value.GetHashCode(); + ret ^= hash; + } + return ret; + } + + // Optimization: We keep around the last field that was + // modified so that we can efficiently add to it multiple times in a + // row (important when parsing an unknown repeated field). + private int lastFieldNumber; + private UnknownField lastField; + + private UnknownField GetOrAddField(int number) + { + if (lastField != null && number == lastFieldNumber) + { + return lastField; + } + if (number == 0) + { + return null; + } + + UnknownField existing; + if (fields.TryGetValue(number, out existing)) + { + return existing; + } + lastField = new UnknownField(); + AddOrReplaceField(number, lastField); + lastFieldNumber = number; + return lastField; + } + + /// + /// Adds a field to the set. If a field with the same number already exists, it + /// is replaced. + /// + internal UnknownFieldSet AddOrReplaceField(int number, UnknownField field) + { + if (number == 0) + { + throw new ArgumentOutOfRangeException("number", "Zero is not a valid field number."); + } + fields[number] = field; + return this; + } + + /// + /// Parse a single field from and merge it + /// into this set. + /// + /// The coded input stream containing the field + /// false if the tag is an "end group" tag, true otherwise + private void MergeFieldFrom(CodedInputStream input) + { + uint tag = input.LastTag; + int number = WireFormat.GetTagFieldNumber(tag); + switch (WireFormat.GetTagWireType(tag)) + { + case WireFormat.WireType.Varint: + { + ulong uint64 = input.ReadUInt64(); + GetOrAddField(number).AddVarint(uint64); + return; + } + case WireFormat.WireType.Fixed32: + { + uint uint32 = input.ReadFixed32(); + GetOrAddField(number).AddFixed32(uint32); + return; + } + case WireFormat.WireType.Fixed64: + { + ulong uint64 = input.ReadFixed64(); + GetOrAddField(number).AddFixed64(uint64); + return; + } + case WireFormat.WireType.LengthDelimited: + { + ByteString bytes = input.ReadBytes(); + GetOrAddField(number).AddLengthDelimited(bytes); + return; + } + case WireFormat.WireType.StartGroup: + { + input.SkipGroup(tag); + return; + } + case WireFormat.WireType.EndGroup: + { + throw new InvalidProtocolBufferException("Merge an unknown field of end-group tag, indicating that the corresponding start-group was missing."); + } + default: + throw new InvalidOperationException("Wire Type is invalid."); + } + } + + /// + /// Create a new UnknownFieldSet if unknownFields is null. + /// Parse a single field from and merge it + /// into unknownFields. If is configured to discard unknown fields, + /// will be returned as-is and the field will be skipped. + /// + /// The UnknownFieldSet which need to be merged + /// The coded input stream containing the field + /// The merged UnknownFieldSet + public static UnknownFieldSet MergeFieldFrom(UnknownFieldSet unknownFields, + CodedInputStream input) + { + if (input.DiscardUnknownFields) + { + input.SkipLastField(); + return unknownFields; + } + if (unknownFields == null) + { + unknownFields = new UnknownFieldSet(); + } + unknownFields.MergeFieldFrom(input); + return unknownFields; + } + + /// + /// Merges the fields from into this set. + /// If a field number exists in both sets, the values in + /// will be appended to the values in this set. + /// + private UnknownFieldSet MergeFrom(UnknownFieldSet other) + { + if (other != null) + { + foreach (KeyValuePair entry in other.fields) + { + MergeField(entry.Key, entry.Value); + } + } + return this; + } + + /// + /// Created a new UnknownFieldSet to if + /// needed and merges the fields from into the first set. + /// If a field number exists in both sets, the values in + /// will be appended to the values in this set. + /// + public static UnknownFieldSet MergeFrom(UnknownFieldSet unknownFields, + UnknownFieldSet other) + { + if (other == null) + { + return unknownFields; + } + if (unknownFields == null) + { + unknownFields = new UnknownFieldSet(); + } + unknownFields.MergeFrom(other); + return unknownFields; + } + + + /// + /// Adds a field to the unknown field set. If a field with the same + /// number already exists, the two are merged. + /// + private UnknownFieldSet MergeField(int number, UnknownField field) + { + if (number == 0) + { + throw new ArgumentOutOfRangeException("number", "Zero is not a valid field number."); + } + if (HasField(number)) + { + GetOrAddField(number).MergeFrom(field); + } + else + { + AddOrReplaceField(number, field); + } + return this; + } + + /// + /// Clone an unknown field set from . + /// + public static UnknownFieldSet Clone(UnknownFieldSet other) + { + if (other == null) + { + return null; + } + UnknownFieldSet unknownFields = new UnknownFieldSet(); + unknownFields.MergeFrom(other); + return unknownFields; + } + } +} + diff -Nru protobuf-3.0.0/csharp/src/Google.Protobuf/WellKnownTypes/Any.cs protobuf-3.6.1.3/csharp/src/Google.Protobuf/WellKnownTypes/Any.cs --- protobuf-3.0.0/csharp/src/Google.Protobuf/WellKnownTypes/Any.cs 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/csharp/src/Google.Protobuf/WellKnownTypes/Any.cs 2018-12-08 01:32:11.000000000 +0000 @@ -1,5 +1,7 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/protobuf/any.proto +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/protobuf/any.proto +// #pragma warning disable 1591, 0612, 3021 #region Designer generated code @@ -23,10 +25,10 @@ byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( "Chlnb29nbGUvcHJvdG9idWYvYW55LnByb3RvEg9nb29nbGUucHJvdG9idWYi", - "JgoDQW55EhAKCHR5cGVfdXJsGAEgASgJEg0KBXZhbHVlGAIgASgMQnIKE2Nv", + "JgoDQW55EhAKCHR5cGVfdXJsGAEgASgJEg0KBXZhbHVlGAIgASgMQm8KE2Nv", "bS5nb29nbGUucHJvdG9idWZCCEFueVByb3RvUAFaJWdpdGh1Yi5jb20vZ29s", - "YW5nL3Byb3RvYnVmL3B0eXBlcy9hbnmgAQGiAgNHUEKqAh5Hb29nbGUuUHJv", - "dG9idWYuV2VsbEtub3duVHlwZXNiBnByb3RvMw==")); + "YW5nL3Byb3RvYnVmL3B0eXBlcy9hbnmiAgNHUEKqAh5Hb29nbGUuUHJvdG9i", + "dWYuV2VsbEtub3duVHlwZXNiBnByb3RvMw==")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { @@ -38,77 +40,88 @@ } #region Messages /// - /// `Any` contains an arbitrary serialized protocol buffer message along with a - /// URL that describes the type of the serialized message. + /// `Any` contains an arbitrary serialized protocol buffer message along with a + /// URL that describes the type of the serialized message. /// - /// Protobuf library provides support to pack/unpack Any values in the form - /// of utility functions or additional generated methods of the Any type. + /// Protobuf library provides support to pack/unpack Any values in the form + /// of utility functions or additional generated methods of the Any type. /// - /// Example 1: Pack and unpack a message in C++. + /// Example 1: Pack and unpack a message in C++. /// - /// Foo foo = ...; - /// Any any; - /// any.PackFrom(foo); - /// ... - /// if (any.UnpackTo(&foo)) { - /// ... - /// } - /// - /// Example 2: Pack and unpack a message in Java. + /// Foo foo = ...; + /// Any any; + /// any.PackFrom(foo); + /// ... + /// if (any.UnpackTo(&foo)) { + /// ... + /// } + /// + /// Example 2: Pack and unpack a message in Java. + /// + /// Foo foo = ...; + /// Any any = Any.pack(foo); + /// ... + /// if (any.is(Foo.class)) { + /// foo = any.unpack(Foo.class); + /// } + /// + /// Example 3: Pack and unpack a message in Python. + /// + /// foo = Foo(...) + /// any = Any() + /// any.Pack(foo) + /// ... + /// if any.Is(Foo.DESCRIPTOR): + /// any.Unpack(foo) + /// ... /// - /// Foo foo = ...; - /// Any any = Any.pack(foo); - /// ... - /// if (any.is(Foo.class)) { - /// foo = any.unpack(Foo.class); - /// } + /// Example 4: Pack and unpack a message in Go /// - /// Example 3: Pack and unpack a message in Python. - /// - /// foo = Foo(...) - /// any = Any() - /// any.Pack(foo) + /// foo := &pb.Foo{...} + /// any, err := ptypes.MarshalAny(foo) /// ... - /// if any.Is(Foo.DESCRIPTOR): - /// any.Unpack(foo) + /// foo := &pb.Foo{} + /// if err := ptypes.UnmarshalAny(any, foo); err != nil { /// ... - /// - /// The pack methods provided by protobuf library will by default use - /// 'type.googleapis.com/full.type.name' as the type URL and the unpack - /// methods only use the fully qualified type name after the last '/' - /// in the type URL, for example "foo.bar.com/x/y.z" will yield type - /// name "y.z". - /// - /// JSON - /// ==== - /// The JSON representation of an `Any` value uses the regular - /// representation of the deserialized, embedded message, with an - /// additional field `@type` which contains the type URL. Example: - /// - /// package google.profile; - /// message Person { - /// string first_name = 1; - /// string last_name = 2; /// } /// - /// { - /// "@type": "type.googleapis.com/google.profile.Person", - /// "firstName": <string>, - /// "lastName": <string> - /// } - /// - /// If the embedded message type is well-known and has a custom JSON - /// representation, that representation will be embedded adding a field - /// `value` which holds the custom JSON in addition to the `@type` - /// field. Example (for message [google.protobuf.Duration][]): - /// - /// { - /// "@type": "type.googleapis.com/google.protobuf.Duration", - /// "value": "1.212s" - /// } + /// The pack methods provided by protobuf library will by default use + /// 'type.googleapis.com/full.type.name' as the type URL and the unpack + /// methods only use the fully qualified type name after the last '/' + /// in the type URL, for example "foo.bar.com/x/y.z" will yield type + /// name "y.z". + /// + /// JSON + /// ==== + /// The JSON representation of an `Any` value uses the regular + /// representation of the deserialized, embedded message, with an + /// additional field `@type` which contains the type URL. Example: + /// + /// package google.profile; + /// message Person { + /// string first_name = 1; + /// string last_name = 2; + /// } + /// + /// { + /// "@type": "type.googleapis.com/google.profile.Person", + /// "firstName": <string>, + /// "lastName": <string> + /// } + /// + /// If the embedded message type is well-known and has a custom JSON + /// representation, that representation will be embedded adding a field + /// `value` which holds the custom JSON in addition to the `@type` + /// field. Example (for message [google.protobuf.Duration][]): + /// + /// { + /// "@type": "type.googleapis.com/google.protobuf.Duration", + /// "value": "1.212s" + /// } /// public sealed partial class Any : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Any()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -133,6 +146,7 @@ public Any(Any other) : this() { typeUrl_ = other.typeUrl_; value_ = other.value_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -144,27 +158,32 @@ public const int TypeUrlFieldNumber = 1; private string typeUrl_ = ""; /// - /// A URL/resource name whose content describes the type of the - /// serialized protocol buffer message. + /// A URL/resource name that uniquely identifies the type of the serialized + /// protocol buffer message. The last segment of the URL's path must represent + /// the fully qualified name of the type (as in + /// `path/google.protobuf.Duration`). The name should be in a canonical form + /// (e.g., leading "." is not accepted). + /// + /// In practice, teams usually precompile into the binary all types that they + /// expect it to use in the context of Any. However, for URLs which use the + /// scheme `http`, `https`, or no scheme, one can optionally set up a type + /// server that maps type URLs to message definitions as follows: /// - /// For URLs which use the scheme `http`, `https`, or no scheme, the - /// following restrictions and interpretations apply: + /// * If no scheme is provided, `https` is assumed. + /// * An HTTP GET on the URL must yield a [google.protobuf.Type][] + /// value in binary format, or produce an error. + /// * Applications are allowed to cache lookup results based on the + /// URL, or have them precompiled into a binary to avoid any + /// lookup. Therefore, binary compatibility needs to be preserved + /// on changes to types. (Use versioned type names to manage + /// breaking changes.) /// - /// * If no scheme is provided, `https` is assumed. - /// * The last segment of the URL's path must represent the fully - /// qualified name of the type (as in `path/google.protobuf.Duration`). - /// The name should be in a canonical form (e.g., leading "." is - /// not accepted). - /// * An HTTP GET on the URL must yield a [google.protobuf.Type][] - /// value in binary format, or produce an error. - /// * Applications are allowed to cache lookup results based on the - /// URL, or have them precompiled into a binary to avoid any - /// lookup. Therefore, binary compatibility needs to be preserved - /// on changes to types. (Use versioned type names to manage - /// breaking changes.) + /// Note: this functionality is not currently available in the official + /// protobuf release, and it is not used for type URLs beginning with + /// type.googleapis.com. /// - /// Schemes other than `http`, `https` (or the empty scheme) might be - /// used with implementation specific semantics. + /// Schemes other than `http`, `https` (or the empty scheme) might be + /// used with implementation specific semantics. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string TypeUrl { @@ -178,7 +197,7 @@ public const int ValueFieldNumber = 2; private pb::ByteString value_ = pb::ByteString.Empty; /// - /// Must be a valid serialized protocol buffer of the above specified type. + /// Must be a valid serialized protocol buffer of the above specified type. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pb::ByteString Value { @@ -203,7 +222,7 @@ } if (TypeUrl != other.TypeUrl) return false; if (Value != other.Value) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -211,6 +230,9 @@ int hash = 1; if (TypeUrl.Length != 0) hash ^= TypeUrl.GetHashCode(); if (Value.Length != 0) hash ^= Value.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -229,6 +251,9 @@ output.WriteRawTag(18); output.WriteBytes(Value); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -240,6 +265,9 @@ if (Value.Length != 0) { size += 1 + pb::CodedOutputStream.ComputeBytesSize(Value); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -254,6 +282,7 @@ if (other.Value.Length != 0) { Value = other.Value; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -262,7 +291,7 @@ while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { TypeUrl = input.ReadString(); diff -Nru protobuf-3.0.0/csharp/src/Google.Protobuf/WellKnownTypes/AnyPartial.cs protobuf-3.6.1.3/csharp/src/Google.Protobuf/WellKnownTypes/AnyPartial.cs --- protobuf-3.0.0/csharp/src/Google.Protobuf/WellKnownTypes/AnyPartial.cs 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/csharp/src/Google.Protobuf/WellKnownTypes/AnyPartial.cs 2018-12-08 01:32:11.000000000 +0000 @@ -44,17 +44,25 @@ prefix.EndsWith("/") ? prefix + descriptor.FullName : prefix + "/" + descriptor.FullName; /// - /// Retrieves the type name for a type URL. This is always just the last part of the URL, - /// after the trailing slash. No validation of anything before the trailing slash is performed. - /// If the type URL does not include a slash, an empty string is returned rather than an exception - /// being thrown; this won't match any types, and the calling code is probably in a better position - /// to give a meaningful error. - /// There is no handling of fragments or queries at the moment. + /// Retrieves the type name for a type URL, matching the + /// of the packed message type. /// + /// + /// + /// This is always just the last part of the URL, after the final slash. No validation of + /// anything before the trailing slash is performed. If the type URL does not include a slash, + /// an empty string is returned rather than an exception being thrown; this won't match any types, + /// and the calling code is probably in a better position to give a meaningful error. + /// + /// + /// There is no handling of fragments or queries at the moment. + /// + /// /// The URL to extract the type name from /// The type name - internal static string GetTypeName(string typeUrl) + public static string GetTypeName(string typeUrl) { + ProtoPreconditions.CheckNotNull(typeUrl, nameof(typeUrl)); int lastSlash = typeUrl.LastIndexOf('/'); return lastSlash == -1 ? "" : typeUrl.Substring(lastSlash + 1); } @@ -81,6 +89,27 @@ } /// + /// Attempts to unpack the content of this Any message into the target message type, + /// if it matches the type URL within this Any message. + /// + /// The type of message to attempt to unpack the content into. + /// true if the message was successfully unpacked; false if the type name didn't match + public bool TryUnpack(out T result) where T : IMessage, new() + { + // Note: deliberately avoid writing anything to result until the end, in case it's being + // monitored by other threads. (That would be a bug in the calling code, but let's not make it worse.) + T target = new T(); + if (GetTypeName(TypeUrl) != target.Descriptor.FullName) + { + result = default(T); // Can't use null as there's no class constraint, but this always *will* be null in real usage. + return false; + } + target.MergeFrom(Value); + result = target; + return true; + } + + /// /// Packs the specified message into an Any message using a type URL prefix of "type.googleapis.com". /// /// The message to pack. diff -Nru protobuf-3.0.0/csharp/src/Google.Protobuf/WellKnownTypes/Api.cs protobuf-3.6.1.3/csharp/src/Google.Protobuf/WellKnownTypes/Api.cs --- protobuf-3.0.0/csharp/src/Google.Protobuf/WellKnownTypes/Api.cs 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/csharp/src/Google.Protobuf/WellKnownTypes/Api.cs 2018-12-08 01:32:11.000000000 +0000 @@ -1,5 +1,7 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/protobuf/api.proto +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/protobuf/api.proto +// #pragma warning disable 1591, 0612, 3021 #region Designer generated code @@ -35,9 +37,10 @@ "ChFyZXNwb25zZV90eXBlX3VybBgEIAEoCRIaChJyZXNwb25zZV9zdHJlYW1p", "bmcYBSABKAgSKAoHb3B0aW9ucxgGIAMoCzIXLmdvb2dsZS5wcm90b2J1Zi5P", "cHRpb24SJwoGc3ludGF4GAcgASgOMhcuZ29vZ2xlLnByb3RvYnVmLlN5bnRh", - "eCIjCgVNaXhpbhIMCgRuYW1lGAEgASgJEgwKBHJvb3QYAiABKAlCSwoTY29t", - "Lmdvb2dsZS5wcm90b2J1ZkIIQXBpUHJvdG9QAaABAaICA0dQQqoCHkdvb2ds", - "ZS5Qcm90b2J1Zi5XZWxsS25vd25UeXBlc2IGcHJvdG8z")); + "eCIjCgVNaXhpbhIMCgRuYW1lGAEgASgJEgwKBHJvb3QYAiABKAlCdQoTY29t", + "Lmdvb2dsZS5wcm90b2J1ZkIIQXBpUHJvdG9QAVorZ29vZ2xlLmdvbGFuZy5v", + "cmcvZ2VucHJvdG8vcHJvdG9idWYvYXBpO2FwaaICA0dQQqoCHkdvb2dsZS5Q", + "cm90b2J1Zi5XZWxsS25vd25UeXBlc2IGcHJvdG8z")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { global::Google.Protobuf.WellKnownTypes.SourceContextReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.TypeReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { @@ -51,10 +54,19 @@ } #region Messages /// - /// Api is a light-weight descriptor for a protocol buffer service. + /// Api is a light-weight descriptor for an API Interface. + /// + /// Interfaces are also described as "protocol buffer services" in some contexts, + /// such as by the "service" keyword in a .proto file, but they are different + /// from API Services, which represent a concrete implementation of an interface + /// as opposed to simply a description of methods and bindings. They are also + /// sometimes simply referred to as "APIs" in other contexts, such as the name of + /// this message itself. See https://cloud.google.com/apis/design/glossary for + /// detailed terminology. /// public sealed partial class Api : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Api()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -81,9 +93,10 @@ methods_ = other.methods_.Clone(); options_ = other.options_.Clone(); version_ = other.version_; - SourceContext = other.sourceContext_ != null ? other.SourceContext.Clone() : null; + sourceContext_ = other.sourceContext_ != null ? other.sourceContext_.Clone() : null; mixins_ = other.mixins_.Clone(); syntax_ = other.syntax_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -95,8 +108,8 @@ public const int NameFieldNumber = 1; private string name_ = ""; /// - /// The fully qualified name of this api, including package name - /// followed by the api's simple name. + /// The fully qualified name of this interface, including package name + /// followed by the interface's simple name. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string Name { @@ -112,7 +125,7 @@ = pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.Method.Parser); private readonly pbc::RepeatedField methods_ = new pbc::RepeatedField(); /// - /// The methods of this api, in unspecified order. + /// The methods of this interface, in unspecified order. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField Methods { @@ -125,7 +138,7 @@ = pb::FieldCodec.ForMessage(26, global::Google.Protobuf.WellKnownTypes.Option.Parser); private readonly pbc::RepeatedField options_ = new pbc::RepeatedField(); /// - /// Any metadata attached to the API. + /// Any metadata attached to the interface. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField Options { @@ -136,26 +149,25 @@ public const int VersionFieldNumber = 4; private string version_ = ""; /// - /// A version string for this api. If specified, must have the form - /// `major-version.minor-version`, as in `1.10`. If the minor version - /// is omitted, it defaults to zero. If the entire version field is - /// empty, the major version is derived from the package name, as - /// outlined below. If the field is not empty, the version in the - /// package name will be verified to be consistent with what is - /// provided here. + /// A version string for this interface. If specified, must have the form + /// `major-version.minor-version`, as in `1.10`. If the minor version is + /// omitted, it defaults to zero. If the entire version field is empty, the + /// major version is derived from the package name, as outlined below. If the + /// field is not empty, the version in the package name will be verified to be + /// consistent with what is provided here. /// - /// The versioning schema uses [semantic - /// versioning](http://semver.org) where the major version number - /// indicates a breaking change and the minor version an additive, - /// non-breaking change. Both version numbers are signals to users - /// what to expect from different versions, and should be carefully - /// chosen based on the product plan. + /// The versioning schema uses [semantic + /// versioning](http://semver.org) where the major version number + /// indicates a breaking change and the minor version an additive, + /// non-breaking change. Both version numbers are signals to users + /// what to expect from different versions, and should be carefully + /// chosen based on the product plan. /// - /// The major version is also reflected in the package name of the - /// API, which must end in `v<major-version>`, as in - /// `google.feature.v1`. For major versions 0 and 1, the suffix can - /// be omitted. Zero major versions must only be used for - /// experimental, none-GA apis. + /// The major version is also reflected in the package name of the + /// interface, which must end in `v<major-version>`, as in + /// `google.feature.v1`. For major versions 0 and 1, the suffix can + /// be omitted. Zero major versions must only be used for + /// experimental, non-GA interfaces. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string Version { @@ -169,8 +181,8 @@ public const int SourceContextFieldNumber = 5; private global::Google.Protobuf.WellKnownTypes.SourceContext sourceContext_; /// - /// Source context for the protocol buffer service represented by this - /// message. + /// Source context for the protocol buffer service represented by this + /// message. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.WellKnownTypes.SourceContext SourceContext { @@ -186,7 +198,7 @@ = pb::FieldCodec.ForMessage(50, global::Google.Protobuf.WellKnownTypes.Mixin.Parser); private readonly pbc::RepeatedField mixins_ = new pbc::RepeatedField(); /// - /// Included APIs. See [Mixin][]. + /// Included interfaces. See [Mixin][]. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField Mixins { @@ -197,7 +209,7 @@ public const int SyntaxFieldNumber = 7; private global::Google.Protobuf.WellKnownTypes.Syntax syntax_ = 0; /// - /// The source syntax of the service. + /// The source syntax of the service. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.WellKnownTypes.Syntax Syntax { @@ -227,7 +239,7 @@ if (!object.Equals(SourceContext, other.SourceContext)) return false; if(!mixins_.Equals(other.mixins_)) return false; if (Syntax != other.Syntax) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -240,6 +252,9 @@ if (sourceContext_ != null) hash ^= SourceContext.GetHashCode(); hash ^= mixins_.GetHashCode(); if (Syntax != 0) hash ^= Syntax.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -269,6 +284,9 @@ output.WriteRawTag(56); output.WriteEnum((int) Syntax); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -289,6 +307,9 @@ if (Syntax != 0) { size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Syntax); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -315,6 +336,7 @@ if (other.Syntax != 0) { Syntax = other.Syntax; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -323,7 +345,7 @@ while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { Name = input.ReadString(); @@ -363,10 +385,11 @@ } /// - /// Method represents a method of an api. + /// Method represents a method of an API interface. /// public sealed partial class Method : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Method()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -396,6 +419,7 @@ responseStreaming_ = other.responseStreaming_; options_ = other.options_.Clone(); syntax_ = other.syntax_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -407,7 +431,7 @@ public const int NameFieldNumber = 1; private string name_ = ""; /// - /// The simple name of this method. + /// The simple name of this method. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string Name { @@ -421,7 +445,7 @@ public const int RequestTypeUrlFieldNumber = 2; private string requestTypeUrl_ = ""; /// - /// A URL of the input message type. + /// A URL of the input message type. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string RequestTypeUrl { @@ -435,7 +459,7 @@ public const int RequestStreamingFieldNumber = 3; private bool requestStreaming_; /// - /// If true, the request is streamed. + /// If true, the request is streamed. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool RequestStreaming { @@ -449,7 +473,7 @@ public const int ResponseTypeUrlFieldNumber = 4; private string responseTypeUrl_ = ""; /// - /// The URL of the output message type. + /// The URL of the output message type. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string ResponseTypeUrl { @@ -463,7 +487,7 @@ public const int ResponseStreamingFieldNumber = 5; private bool responseStreaming_; /// - /// If true, the response is streamed. + /// If true, the response is streamed. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool ResponseStreaming { @@ -479,7 +503,7 @@ = pb::FieldCodec.ForMessage(50, global::Google.Protobuf.WellKnownTypes.Option.Parser); private readonly pbc::RepeatedField options_ = new pbc::RepeatedField(); /// - /// Any metadata attached to the method. + /// Any metadata attached to the method. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField Options { @@ -490,7 +514,7 @@ public const int SyntaxFieldNumber = 7; private global::Google.Protobuf.WellKnownTypes.Syntax syntax_ = 0; /// - /// The source syntax of this method. + /// The source syntax of this method. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.WellKnownTypes.Syntax Syntax { @@ -520,7 +544,7 @@ if (ResponseStreaming != other.ResponseStreaming) return false; if(!options_.Equals(other.options_)) return false; if (Syntax != other.Syntax) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -533,6 +557,9 @@ if (ResponseStreaming != false) hash ^= ResponseStreaming.GetHashCode(); hash ^= options_.GetHashCode(); if (Syntax != 0) hash ^= Syntax.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -568,6 +595,9 @@ output.WriteRawTag(56); output.WriteEnum((int) Syntax); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -592,6 +622,9 @@ if (Syntax != 0) { size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Syntax); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -619,6 +652,7 @@ if (other.Syntax != 0) { Syntax = other.Syntax; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -627,7 +661,7 @@ while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { Name = input.ReadString(); @@ -664,86 +698,88 @@ } /// - /// Declares an API to be included in this API. The including API must - /// redeclare all the methods from the included API, but documentation - /// and options are inherited as follows: - /// - /// - If after comment and whitespace stripping, the documentation - /// string of the redeclared method is empty, it will be inherited - /// from the original method. - /// - /// - Each annotation belonging to the service config (http, - /// visibility) which is not set in the redeclared method will be - /// inherited. - /// - /// - If an http annotation is inherited, the path pattern will be - /// modified as follows. Any version prefix will be replaced by the - /// version of the including API plus the [root][] path if specified. - /// - /// Example of a simple mixin: - /// - /// package google.acl.v1; - /// service AccessControl { - /// // Get the underlying ACL object. - /// rpc GetAcl(GetAclRequest) returns (Acl) { - /// option (google.api.http).get = "/v1/{resource=**}:getAcl"; - /// } - /// } - /// - /// package google.storage.v2; - /// service Storage { - /// rpc GetAcl(GetAclRequest) returns (Acl); - /// - /// // Get a data record. - /// rpc GetData(GetDataRequest) returns (Data) { - /// option (google.api.http).get = "/v2/{resource=**}"; - /// } - /// } - /// - /// Example of a mixin configuration: - /// - /// apis: - /// - name: google.storage.v2.Storage - /// mixins: - /// - name: google.acl.v1.AccessControl - /// - /// The mixin construct implies that all methods in `AccessControl` are - /// also declared with same name and request/response types in - /// `Storage`. A documentation generator or annotation processor will - /// see the effective `Storage.GetAcl` method after inherting - /// documentation and annotations as follows: - /// - /// service Storage { - /// // Get the underlying ACL object. - /// rpc GetAcl(GetAclRequest) returns (Acl) { - /// option (google.api.http).get = "/v2/{resource=**}:getAcl"; - /// } - /// ... - /// } - /// - /// Note how the version in the path pattern changed from `v1` to `v2`. - /// - /// If the `root` field in the mixin is specified, it should be a - /// relative path under which inherited HTTP paths are placed. Example: - /// - /// apis: - /// - name: google.storage.v2.Storage - /// mixins: - /// - name: google.acl.v1.AccessControl - /// root: acls - /// - /// This implies the following inherited HTTP annotation: - /// - /// service Storage { - /// // Get the underlying ACL object. - /// rpc GetAcl(GetAclRequest) returns (Acl) { - /// option (google.api.http).get = "/v2/acls/{resource=**}:getAcl"; - /// } - /// ... - /// } + /// Declares an API Interface to be included in this interface. The including + /// interface must redeclare all the methods from the included interface, but + /// documentation and options are inherited as follows: + /// + /// - If after comment and whitespace stripping, the documentation + /// string of the redeclared method is empty, it will be inherited + /// from the original method. + /// + /// - Each annotation belonging to the service config (http, + /// visibility) which is not set in the redeclared method will be + /// inherited. + /// + /// - If an http annotation is inherited, the path pattern will be + /// modified as follows. Any version prefix will be replaced by the + /// version of the including interface plus the [root][] path if + /// specified. + /// + /// Example of a simple mixin: + /// + /// package google.acl.v1; + /// service AccessControl { + /// // Get the underlying ACL object. + /// rpc GetAcl(GetAclRequest) returns (Acl) { + /// option (google.api.http).get = "/v1/{resource=**}:getAcl"; + /// } + /// } + /// + /// package google.storage.v2; + /// service Storage { + /// rpc GetAcl(GetAclRequest) returns (Acl); + /// + /// // Get a data record. + /// rpc GetData(GetDataRequest) returns (Data) { + /// option (google.api.http).get = "/v2/{resource=**}"; + /// } + /// } + /// + /// Example of a mixin configuration: + /// + /// apis: + /// - name: google.storage.v2.Storage + /// mixins: + /// - name: google.acl.v1.AccessControl + /// + /// The mixin construct implies that all methods in `AccessControl` are + /// also declared with same name and request/response types in + /// `Storage`. A documentation generator or annotation processor will + /// see the effective `Storage.GetAcl` method after inherting + /// documentation and annotations as follows: + /// + /// service Storage { + /// // Get the underlying ACL object. + /// rpc GetAcl(GetAclRequest) returns (Acl) { + /// option (google.api.http).get = "/v2/{resource=**}:getAcl"; + /// } + /// ... + /// } + /// + /// Note how the version in the path pattern changed from `v1` to `v2`. + /// + /// If the `root` field in the mixin is specified, it should be a + /// relative path under which inherited HTTP paths are placed. Example: + /// + /// apis: + /// - name: google.storage.v2.Storage + /// mixins: + /// - name: google.acl.v1.AccessControl + /// root: acls + /// + /// This implies the following inherited HTTP annotation: + /// + /// service Storage { + /// // Get the underlying ACL object. + /// rpc GetAcl(GetAclRequest) returns (Acl) { + /// option (google.api.http).get = "/v2/acls/{resource=**}:getAcl"; + /// } + /// ... + /// } /// public sealed partial class Mixin : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Mixin()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -768,6 +804,7 @@ public Mixin(Mixin other) : this() { name_ = other.name_; root_ = other.root_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -779,7 +816,7 @@ public const int NameFieldNumber = 1; private string name_ = ""; /// - /// The fully qualified name of the API which is included. + /// The fully qualified name of the interface which is included. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string Name { @@ -793,8 +830,8 @@ public const int RootFieldNumber = 2; private string root_ = ""; /// - /// If non-empty specifies a path under which inherited HTTP paths - /// are rooted. + /// If non-empty specifies a path under which inherited HTTP paths + /// are rooted. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string Root { @@ -819,7 +856,7 @@ } if (Name != other.Name) return false; if (Root != other.Root) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -827,6 +864,9 @@ int hash = 1; if (Name.Length != 0) hash ^= Name.GetHashCode(); if (Root.Length != 0) hash ^= Root.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -845,6 +885,9 @@ output.WriteRawTag(18); output.WriteString(Root); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -856,6 +899,9 @@ if (Root.Length != 0) { size += 1 + pb::CodedOutputStream.ComputeStringSize(Root); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -870,6 +916,7 @@ if (other.Root.Length != 0) { Root = other.Root; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -878,7 +925,7 @@ while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { Name = input.ReadString(); diff -Nru protobuf-3.0.0/csharp/src/Google.Protobuf/WellKnownTypes/Duration.cs protobuf-3.6.1.3/csharp/src/Google.Protobuf/WellKnownTypes/Duration.cs --- protobuf-3.0.0/csharp/src/Google.Protobuf/WellKnownTypes/Duration.cs 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/csharp/src/Google.Protobuf/WellKnownTypes/Duration.cs 2018-12-08 01:32:11.000000000 +0000 @@ -1,5 +1,7 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/protobuf/duration.proto +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/protobuf/duration.proto +// #pragma warning disable 1591, 0612, 3021 #region Designer generated code @@ -25,7 +27,7 @@ "Ch5nb29nbGUvcHJvdG9idWYvZHVyYXRpb24ucHJvdG8SD2dvb2dsZS5wcm90", "b2J1ZiIqCghEdXJhdGlvbhIPCgdzZWNvbmRzGAEgASgDEg0KBW5hbm9zGAIg", "ASgFQnwKE2NvbS5nb29nbGUucHJvdG9idWZCDUR1cmF0aW9uUHJvdG9QAVoq", - "Z2l0aHViLmNvbS9nb2xhbmcvcHJvdG9idWYvcHR5cGVzL2R1cmF0aW9uoAEB", + "Z2l0aHViLmNvbS9nb2xhbmcvcHJvdG9idWYvcHR5cGVzL2R1cmF0aW9u+AEB", "ogIDR1BCqgIeR29vZ2xlLlByb3RvYnVmLldlbGxLbm93blR5cGVzYgZwcm90", "bzM=")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, @@ -39,49 +41,68 @@ } #region Messages /// - /// A Duration represents a signed, fixed-length span of time represented - /// as a count of seconds and fractions of seconds at nanosecond - /// resolution. It is independent of any calendar and concepts like "day" - /// or "month". It is related to Timestamp in that the difference between - /// two Timestamp values is a Duration and it can be added or subtracted - /// from a Timestamp. Range is approximately +-10,000 years. - /// - /// Example 1: Compute Duration from two Timestamps in pseudo code. - /// - /// Timestamp start = ...; - /// Timestamp end = ...; - /// Duration duration = ...; - /// - /// duration.seconds = end.seconds - start.seconds; - /// duration.nanos = end.nanos - start.nanos; - /// - /// if (duration.seconds < 0 && duration.nanos > 0) { - /// duration.seconds += 1; - /// duration.nanos -= 1000000000; - /// } else if (durations.seconds > 0 && duration.nanos < 0) { - /// duration.seconds -= 1; - /// duration.nanos += 1000000000; - /// } - /// - /// Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. - /// - /// Timestamp start = ...; - /// Duration duration = ...; - /// Timestamp end = ...; - /// - /// end.seconds = start.seconds + duration.seconds; - /// end.nanos = start.nanos + duration.nanos; - /// - /// if (end.nanos < 0) { - /// end.seconds -= 1; - /// end.nanos += 1000000000; - /// } else if (end.nanos >= 1000000000) { - /// end.seconds += 1; - /// end.nanos -= 1000000000; - /// } + /// A Duration represents a signed, fixed-length span of time represented + /// as a count of seconds and fractions of seconds at nanosecond + /// resolution. It is independent of any calendar and concepts like "day" + /// or "month". It is related to Timestamp in that the difference between + /// two Timestamp values is a Duration and it can be added or subtracted + /// from a Timestamp. Range is approximately +-10,000 years. + /// + /// # Examples + /// + /// Example 1: Compute Duration from two Timestamps in pseudo code. + /// + /// Timestamp start = ...; + /// Timestamp end = ...; + /// Duration duration = ...; + /// + /// duration.seconds = end.seconds - start.seconds; + /// duration.nanos = end.nanos - start.nanos; + /// + /// if (duration.seconds < 0 && duration.nanos > 0) { + /// duration.seconds += 1; + /// duration.nanos -= 1000000000; + /// } else if (durations.seconds > 0 && duration.nanos < 0) { + /// duration.seconds -= 1; + /// duration.nanos += 1000000000; + /// } + /// + /// Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. + /// + /// Timestamp start = ...; + /// Duration duration = ...; + /// Timestamp end = ...; + /// + /// end.seconds = start.seconds + duration.seconds; + /// end.nanos = start.nanos + duration.nanos; + /// + /// if (end.nanos < 0) { + /// end.seconds -= 1; + /// end.nanos += 1000000000; + /// } else if (end.nanos >= 1000000000) { + /// end.seconds += 1; + /// end.nanos -= 1000000000; + /// } + /// + /// Example 3: Compute Duration from datetime.timedelta in Python. + /// + /// td = datetime.timedelta(days=3, minutes=10) + /// duration = Duration() + /// duration.FromTimedelta(td) + /// + /// # JSON Mapping + /// + /// In JSON format, the Duration type is encoded as a string rather than an + /// object, where the string ends in the suffix "s" (indicating seconds) and + /// is preceded by the number of seconds, with nanoseconds expressed as + /// fractional seconds. For example, 3 seconds with 0 nanoseconds should be + /// encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should + /// be expressed in JSON format as "3.000000001s", and 3 seconds and 1 + /// microsecond should be expressed in JSON format as "3.000001s". /// public sealed partial class Duration : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Duration()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -106,6 +127,7 @@ public Duration(Duration other) : this() { seconds_ = other.seconds_; nanos_ = other.nanos_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -117,8 +139,9 @@ public const int SecondsFieldNumber = 1; private long seconds_; /// - /// Signed seconds of the span of time. Must be from -315,576,000,000 - /// to +315,576,000,000 inclusive. + /// Signed seconds of the span of time. Must be from -315,576,000,000 + /// to +315,576,000,000 inclusive. Note: these bounds are computed from: + /// 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public long Seconds { @@ -132,12 +155,12 @@ public const int NanosFieldNumber = 2; private int nanos_; /// - /// Signed fractions of a second at nanosecond resolution of the span - /// of time. Durations less than one second are represented with a 0 - /// `seconds` field and a positive or negative `nanos` field. For durations - /// of one second or more, a non-zero value for the `nanos` field must be - /// of the same sign as the `seconds` field. Must be from -999,999,999 - /// to +999,999,999 inclusive. + /// Signed fractions of a second at nanosecond resolution of the span + /// of time. Durations less than one second are represented with a 0 + /// `seconds` field and a positive or negative `nanos` field. For durations + /// of one second or more, a non-zero value for the `nanos` field must be + /// of the same sign as the `seconds` field. Must be from -999,999,999 + /// to +999,999,999 inclusive. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int Nanos { @@ -162,7 +185,7 @@ } if (Seconds != other.Seconds) return false; if (Nanos != other.Nanos) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -170,6 +193,9 @@ int hash = 1; if (Seconds != 0L) hash ^= Seconds.GetHashCode(); if (Nanos != 0) hash ^= Nanos.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -188,6 +214,9 @@ output.WriteRawTag(16); output.WriteInt32(Nanos); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -199,6 +228,9 @@ if (Nanos != 0) { size += 1 + pb::CodedOutputStream.ComputeInt32Size(Nanos); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -213,6 +245,7 @@ if (other.Nanos != 0) { Nanos = other.Nanos; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -221,7 +254,7 @@ while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 8: { Seconds = input.ReadInt64(); diff -Nru protobuf-3.0.0/csharp/src/Google.Protobuf/WellKnownTypes/Empty.cs protobuf-3.6.1.3/csharp/src/Google.Protobuf/WellKnownTypes/Empty.cs --- protobuf-3.0.0/csharp/src/Google.Protobuf/WellKnownTypes/Empty.cs 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/csharp/src/Google.Protobuf/WellKnownTypes/Empty.cs 2018-12-08 01:32:11.000000000 +0000 @@ -1,5 +1,7 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/protobuf/empty.proto +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/protobuf/empty.proto +// #pragma warning disable 1591, 0612, 3021 #region Designer generated code @@ -23,10 +25,10 @@ byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( "Chtnb29nbGUvcHJvdG9idWYvZW1wdHkucHJvdG8SD2dvb2dsZS5wcm90b2J1", - "ZiIHCgVFbXB0eUJ5ChNjb20uZ29vZ2xlLnByb3RvYnVmQgpFbXB0eVByb3Rv", - "UAFaJ2dpdGh1Yi5jb20vZ29sYW5nL3Byb3RvYnVmL3B0eXBlcy9lbXB0eaAB", - "AfgBAaICA0dQQqoCHkdvb2dsZS5Qcm90b2J1Zi5XZWxsS25vd25UeXBlc2IG", - "cHJvdG8z")); + "ZiIHCgVFbXB0eUJ2ChNjb20uZ29vZ2xlLnByb3RvYnVmQgpFbXB0eVByb3Rv", + "UAFaJ2dpdGh1Yi5jb20vZ29sYW5nL3Byb3RvYnVmL3B0eXBlcy9lbXB0efgB", + "AaICA0dQQqoCHkdvb2dsZS5Qcm90b2J1Zi5XZWxsS25vd25UeXBlc2IGcHJv", + "dG8z")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { @@ -38,18 +40,19 @@ } #region Messages /// - /// A generic empty message that you can re-use to avoid defining duplicated - /// empty messages in your APIs. A typical example is to use it as the request - /// or the response type of an API method. For instance: + /// A generic empty message that you can re-use to avoid defining duplicated + /// empty messages in your APIs. A typical example is to use it as the request + /// or the response type of an API method. For instance: /// - /// service Foo { - /// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); - /// } + /// service Foo { + /// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); + /// } /// - /// The JSON representation for `Empty` is empty JSON object `{}`. + /// The JSON representation for `Empty` is empty JSON object `{}`. /// public sealed partial class Empty : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Empty()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -72,6 +75,7 @@ [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Empty(Empty other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -92,12 +96,15 @@ if (ReferenceEquals(other, this)) { return true; } - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -108,11 +115,17 @@ [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -121,6 +134,7 @@ if (other == null) { return; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -129,7 +143,7 @@ while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; } } diff -Nru protobuf-3.0.0/csharp/src/Google.Protobuf/WellKnownTypes/FieldMask.cs protobuf-3.6.1.3/csharp/src/Google.Protobuf/WellKnownTypes/FieldMask.cs --- protobuf-3.0.0/csharp/src/Google.Protobuf/WellKnownTypes/FieldMask.cs 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/csharp/src/Google.Protobuf/WellKnownTypes/FieldMask.cs 2018-12-08 01:32:11.000000000 +0000 @@ -1,5 +1,7 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/protobuf/field_mask.proto +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/protobuf/field_mask.proto +// #pragma warning disable 1591, 0612, 3021 #region Designer generated code @@ -23,9 +25,11 @@ byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( "CiBnb29nbGUvcHJvdG9idWYvZmllbGRfbWFzay5wcm90bxIPZ29vZ2xlLnBy", - "b3RvYnVmIhoKCUZpZWxkTWFzaxINCgVwYXRocxgBIAMoCUJRChNjb20uZ29v", - "Z2xlLnByb3RvYnVmQg5GaWVsZE1hc2tQcm90b1ABoAEBogIDR1BCqgIeR29v", - "Z2xlLlByb3RvYnVmLldlbGxLbm93blR5cGVzYgZwcm90bzM=")); + "b3RvYnVmIhoKCUZpZWxkTWFzaxINCgVwYXRocxgBIAMoCUKJAQoTY29tLmdv", + "b2dsZS5wcm90b2J1ZkIORmllbGRNYXNrUHJvdG9QAVo5Z29vZ2xlLmdvbGFu", + "Zy5vcmcvZ2VucHJvdG8vcHJvdG9idWYvZmllbGRfbWFzaztmaWVsZF9tYXNr", + "ogIDR1BCqgIeR29vZ2xlLlByb3RvYnVmLldlbGxLbm93blR5cGVzYgZwcm90", + "bzM=")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { @@ -37,209 +41,216 @@ } #region Messages /// - /// `FieldMask` represents a set of symbolic field paths, for example: + /// `FieldMask` represents a set of symbolic field paths, for example: /// - /// paths: "f.a" - /// paths: "f.b.d" + /// paths: "f.a" + /// paths: "f.b.d" /// - /// Here `f` represents a field in some root message, `a` and `b` - /// fields in the message found in `f`, and `d` a field found in the - /// message in `f.b`. - /// - /// Field masks are used to specify a subset of fields that should be - /// returned by a get operation or modified by an update operation. - /// Field masks also have a custom JSON encoding (see below). - /// - /// # Field Masks in Projections - /// - /// When used in the context of a projection, a response message or - /// sub-message is filtered by the API to only contain those fields as - /// specified in the mask. For example, if the mask in the previous - /// example is applied to a response message as follows: - /// - /// f { - /// a : 22 - /// b { - /// d : 1 - /// x : 2 - /// } - /// y : 13 - /// } - /// z: 8 - /// - /// The result will not contain specific values for fields x,y and z - /// (their value will be set to the default, and omitted in proto text - /// output): - /// - /// f { - /// a : 22 - /// b { - /// d : 1 - /// } - /// } - /// - /// A repeated field is not allowed except at the last position of a - /// field mask. - /// - /// If a FieldMask object is not present in a get operation, the - /// operation applies to all fields (as if a FieldMask of all fields - /// had been specified). - /// - /// Note that a field mask does not necessarily apply to the - /// top-level response message. In case of a REST get operation, the - /// field mask applies directly to the response, but in case of a REST - /// list operation, the mask instead applies to each individual message - /// in the returned resource list. In case of a REST custom method, - /// other definitions may be used. Where the mask applies will be - /// clearly documented together with its declaration in the API. In - /// any case, the effect on the returned resource/resources is required - /// behavior for APIs. - /// - /// # Field Masks in Update Operations - /// - /// A field mask in update operations specifies which fields of the - /// targeted resource are going to be updated. The API is required - /// to only change the values of the fields as specified in the mask - /// and leave the others untouched. If a resource is passed in to - /// describe the updated values, the API ignores the values of all - /// fields not covered by the mask. - /// - /// If a repeated field is specified for an update operation, the existing - /// repeated values in the target resource will be overwritten by the new values. - /// Note that a repeated field is only allowed in the last position of a field - /// mask. - /// - /// If a sub-message is specified in the last position of the field mask for an - /// update operation, then the existing sub-message in the target resource is - /// overwritten. Given the target message: - /// - /// f { - /// b { - /// d : 1 - /// x : 2 - /// } - /// c : 1 - /// } - /// - /// And an update message: - /// - /// f { - /// b { - /// d : 10 - /// } - /// } - /// - /// then if the field mask is: - /// - /// paths: "f.b" - /// - /// then the result will be: - /// - /// f { - /// b { - /// d : 10 - /// } - /// c : 1 - /// } - /// - /// However, if the update mask was: - /// - /// paths: "f.b.d" - /// - /// then the result would be: - /// - /// f { - /// b { - /// d : 10 - /// x : 2 - /// } - /// c : 1 - /// } - /// - /// In order to reset a field's value to the default, the field must - /// be in the mask and set to the default value in the provided resource. - /// Hence, in order to reset all fields of a resource, provide a default - /// instance of the resource and set all fields in the mask, or do - /// not provide a mask as described below. - /// - /// If a field mask is not present on update, the operation applies to - /// all fields (as if a field mask of all fields has been specified). - /// Note that in the presence of schema evolution, this may mean that - /// fields the client does not know and has therefore not filled into - /// the request will be reset to their default. If this is unwanted - /// behavior, a specific service may require a client to always specify - /// a field mask, producing an error if not. - /// - /// As with get operations, the location of the resource which - /// describes the updated values in the request message depends on the - /// operation kind. In any case, the effect of the field mask is - /// required to be honored by the API. - /// - /// ## Considerations for HTTP REST - /// - /// The HTTP kind of an update operation which uses a field mask must - /// be set to PATCH instead of PUT in order to satisfy HTTP semantics - /// (PUT must only be used for full updates). - /// - /// # JSON Encoding of Field Masks - /// - /// In JSON, a field mask is encoded as a single string where paths are - /// separated by a comma. Fields name in each path are converted - /// to/from lower-camel naming conventions. - /// - /// As an example, consider the following message declarations: - /// - /// message Profile { - /// User user = 1; - /// Photo photo = 2; - /// } - /// message User { - /// string display_name = 1; - /// string address = 2; - /// } - /// - /// In proto a field mask for `Profile` may look as such: - /// - /// mask { - /// paths: "user.display_name" - /// paths: "photo" - /// } - /// - /// In JSON, the same mask is represented as below: - /// - /// { - /// mask: "user.displayName,photo" - /// } - /// - /// # Field Masks and Oneof Fields - /// - /// Field masks treat fields in oneofs just as regular fields. Consider the - /// following message: - /// - /// message SampleMessage { - /// oneof test_oneof { - /// string name = 4; - /// SubMessage sub_message = 9; - /// } - /// } - /// - /// The field mask can be: - /// - /// mask { - /// paths: "name" - /// } - /// - /// Or: - /// - /// mask { - /// paths: "sub_message" - /// } - /// - /// Note that oneof type names ("test_oneof" in this case) cannot be used in - /// paths. + /// Here `f` represents a field in some root message, `a` and `b` + /// fields in the message found in `f`, and `d` a field found in the + /// message in `f.b`. + /// + /// Field masks are used to specify a subset of fields that should be + /// returned by a get operation or modified by an update operation. + /// Field masks also have a custom JSON encoding (see below). + /// + /// # Field Masks in Projections + /// + /// When used in the context of a projection, a response message or + /// sub-message is filtered by the API to only contain those fields as + /// specified in the mask. For example, if the mask in the previous + /// example is applied to a response message as follows: + /// + /// f { + /// a : 22 + /// b { + /// d : 1 + /// x : 2 + /// } + /// y : 13 + /// } + /// z: 8 + /// + /// The result will not contain specific values for fields x,y and z + /// (their value will be set to the default, and omitted in proto text + /// output): + /// + /// f { + /// a : 22 + /// b { + /// d : 1 + /// } + /// } + /// + /// A repeated field is not allowed except at the last position of a + /// paths string. + /// + /// If a FieldMask object is not present in a get operation, the + /// operation applies to all fields (as if a FieldMask of all fields + /// had been specified). + /// + /// Note that a field mask does not necessarily apply to the + /// top-level response message. In case of a REST get operation, the + /// field mask applies directly to the response, but in case of a REST + /// list operation, the mask instead applies to each individual message + /// in the returned resource list. In case of a REST custom method, + /// other definitions may be used. Where the mask applies will be + /// clearly documented together with its declaration in the API. In + /// any case, the effect on the returned resource/resources is required + /// behavior for APIs. + /// + /// # Field Masks in Update Operations + /// + /// A field mask in update operations specifies which fields of the + /// targeted resource are going to be updated. The API is required + /// to only change the values of the fields as specified in the mask + /// and leave the others untouched. If a resource is passed in to + /// describe the updated values, the API ignores the values of all + /// fields not covered by the mask. + /// + /// If a repeated field is specified for an update operation, the existing + /// repeated values in the target resource will be overwritten by the new values. + /// Note that a repeated field is only allowed in the last position of a `paths` + /// string. + /// + /// If a sub-message is specified in the last position of the field mask for an + /// update operation, then the existing sub-message in the target resource is + /// overwritten. Given the target message: + /// + /// f { + /// b { + /// d : 1 + /// x : 2 + /// } + /// c : 1 + /// } + /// + /// And an update message: + /// + /// f { + /// b { + /// d : 10 + /// } + /// } + /// + /// then if the field mask is: + /// + /// paths: "f.b" + /// + /// then the result will be: + /// + /// f { + /// b { + /// d : 10 + /// } + /// c : 1 + /// } + /// + /// However, if the update mask was: + /// + /// paths: "f.b.d" + /// + /// then the result would be: + /// + /// f { + /// b { + /// d : 10 + /// x : 2 + /// } + /// c : 1 + /// } + /// + /// In order to reset a field's value to the default, the field must + /// be in the mask and set to the default value in the provided resource. + /// Hence, in order to reset all fields of a resource, provide a default + /// instance of the resource and set all fields in the mask, or do + /// not provide a mask as described below. + /// + /// If a field mask is not present on update, the operation applies to + /// all fields (as if a field mask of all fields has been specified). + /// Note that in the presence of schema evolution, this may mean that + /// fields the client does not know and has therefore not filled into + /// the request will be reset to their default. If this is unwanted + /// behavior, a specific service may require a client to always specify + /// a field mask, producing an error if not. + /// + /// As with get operations, the location of the resource which + /// describes the updated values in the request message depends on the + /// operation kind. In any case, the effect of the field mask is + /// required to be honored by the API. + /// + /// ## Considerations for HTTP REST + /// + /// The HTTP kind of an update operation which uses a field mask must + /// be set to PATCH instead of PUT in order to satisfy HTTP semantics + /// (PUT must only be used for full updates). + /// + /// # JSON Encoding of Field Masks + /// + /// In JSON, a field mask is encoded as a single string where paths are + /// separated by a comma. Fields name in each path are converted + /// to/from lower-camel naming conventions. + /// + /// As an example, consider the following message declarations: + /// + /// message Profile { + /// User user = 1; + /// Photo photo = 2; + /// } + /// message User { + /// string display_name = 1; + /// string address = 2; + /// } + /// + /// In proto a field mask for `Profile` may look as such: + /// + /// mask { + /// paths: "user.display_name" + /// paths: "photo" + /// } + /// + /// In JSON, the same mask is represented as below: + /// + /// { + /// mask: "user.displayName,photo" + /// } + /// + /// # Field Masks and Oneof Fields + /// + /// Field masks treat fields in oneofs just as regular fields. Consider the + /// following message: + /// + /// message SampleMessage { + /// oneof test_oneof { + /// string name = 4; + /// SubMessage sub_message = 9; + /// } + /// } + /// + /// The field mask can be: + /// + /// mask { + /// paths: "name" + /// } + /// + /// Or: + /// + /// mask { + /// paths: "sub_message" + /// } + /// + /// Note that oneof type names ("test_oneof" in this case) cannot be used in + /// paths. + /// + /// ## Field Mask Verification + /// + /// The implementation of any API method which has a FieldMask type field in the + /// request should verify the included field paths, and return an + /// `INVALID_ARGUMENT` error if any path is duplicated or unmappable. /// public sealed partial class FieldMask : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new FieldMask()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -263,6 +274,7 @@ [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public FieldMask(FieldMask other) : this() { paths_ = other.paths_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -276,7 +288,7 @@ = pb::FieldCodec.ForString(10); private readonly pbc::RepeatedField paths_ = new pbc::RepeatedField(); /// - /// The set of field mask paths. + /// The set of field mask paths. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField Paths { @@ -297,13 +309,16 @@ return true; } if(!paths_.Equals(other.paths_)) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; hash ^= paths_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -315,12 +330,18 @@ [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { paths_.WriteTo(output, _repeated_paths_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; size += paths_.CalculateSize(_repeated_paths_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -330,6 +351,7 @@ return; } paths_.Add(other.paths_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -338,7 +360,7 @@ while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { paths_.AddEntriesFrom(input, _repeated_paths_codec); diff -Nru protobuf-3.0.0/csharp/src/Google.Protobuf/WellKnownTypes/FieldMaskPartial.cs protobuf-3.6.1.3/csharp/src/Google.Protobuf/WellKnownTypes/FieldMaskPartial.cs --- protobuf-3.0.0/csharp/src/Google.Protobuf/WellKnownTypes/FieldMaskPartial.cs 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/csharp/src/Google.Protobuf/WellKnownTypes/FieldMaskPartial.cs 2018-12-08 01:32:11.000000000 +0000 @@ -52,18 +52,18 @@ /// /// Paths in the field mask /// Determines the handling of non-normalized values - /// The represented duration is invalid, and is false. + /// The represented field mask is invalid, and is false. internal static string ToJson(IList paths, bool diagnosticOnly) { var firstInvalid = paths.FirstOrDefault(p => !ValidatePath(p)); if (firstInvalid == null) { var writer = new StringWriter(); -#if DOTNET35 - var query = paths.Select(JsonFormatter.ToCamelCase); +#if NET35 + var query = paths.Select(JsonFormatter.ToJsonName); JsonFormatter.WriteString(writer, string.Join(",", query.ToArray())); #else - JsonFormatter.WriteString(writer, string.Join(",", paths.Select(JsonFormatter.ToCamelCase))); + JsonFormatter.WriteString(writer, string.Join(",", paths.Select(JsonFormatter.ToJsonName))); #endif return writer.ToString(); } @@ -85,9 +85,9 @@ } /// - /// Camel-case converter with added strictness for field mask formatting. + /// Checks whether the given path is valid for a field mask. /// - /// The field mask is invalid for JSON representation + /// true if the path is valid; false otherwise private static bool ValidatePath(string input) { for (int i = 0; i < input.Length; i++) diff -Nru protobuf-3.0.0/csharp/src/Google.Protobuf/WellKnownTypes/SourceContext.cs protobuf-3.6.1.3/csharp/src/Google.Protobuf/WellKnownTypes/SourceContext.cs --- protobuf-3.0.0/csharp/src/Google.Protobuf/WellKnownTypes/SourceContext.cs 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/csharp/src/Google.Protobuf/WellKnownTypes/SourceContext.cs 2018-12-08 01:32:11.000000000 +0000 @@ -1,5 +1,7 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/protobuf/source_context.proto +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/protobuf/source_context.proto +// #pragma warning disable 1591, 0612, 3021 #region Designer generated code @@ -24,9 +26,10 @@ string.Concat( "CiRnb29nbGUvcHJvdG9idWYvc291cmNlX2NvbnRleHQucHJvdG8SD2dvb2ds", "ZS5wcm90b2J1ZiIiCg1Tb3VyY2VDb250ZXh0EhEKCWZpbGVfbmFtZRgBIAEo", - "CUJVChNjb20uZ29vZ2xlLnByb3RvYnVmQhJTb3VyY2VDb250ZXh0UHJvdG9Q", - "AaABAaICA0dQQqoCHkdvb2dsZS5Qcm90b2J1Zi5XZWxsS25vd25UeXBlc2IG", - "cHJvdG8z")); + "CUKVAQoTY29tLmdvb2dsZS5wcm90b2J1ZkISU291cmNlQ29udGV4dFByb3Rv", + "UAFaQWdvb2dsZS5nb2xhbmcub3JnL2dlbnByb3RvL3Byb3RvYnVmL3NvdXJj", + "ZV9jb250ZXh0O3NvdXJjZV9jb250ZXh0ogIDR1BCqgIeR29vZ2xlLlByb3Rv", + "YnVmLldlbGxLbm93blR5cGVzYgZwcm90bzM=")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { @@ -38,11 +41,12 @@ } #region Messages /// - /// `SourceContext` represents information about the source of a - /// protobuf element, like the file in which it is defined. + /// `SourceContext` represents information about the source of a + /// protobuf element, like the file in which it is defined. /// public sealed partial class SourceContext : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SourceContext()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -66,6 +70,7 @@ [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public SourceContext(SourceContext other) : this() { fileName_ = other.fileName_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -77,8 +82,8 @@ public const int FileNameFieldNumber = 1; private string fileName_ = ""; /// - /// The path-qualified name of the .proto file that contained the associated - /// protobuf element. For example: `"google/protobuf/source_context.proto"`. + /// The path-qualified name of the .proto file that contained the associated + /// protobuf element. For example: `"google/protobuf/source_context.proto"`. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string FileName { @@ -102,13 +107,16 @@ return true; } if (FileName != other.FileName) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (FileName.Length != 0) hash ^= FileName.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -123,6 +131,9 @@ output.WriteRawTag(10); output.WriteString(FileName); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -131,6 +142,9 @@ if (FileName.Length != 0) { size += 1 + pb::CodedOutputStream.ComputeStringSize(FileName); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -142,6 +156,7 @@ if (other.FileName.Length != 0) { FileName = other.FileName; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -150,7 +165,7 @@ while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { FileName = input.ReadString(); diff -Nru protobuf-3.0.0/csharp/src/Google.Protobuf/WellKnownTypes/Struct.cs protobuf-3.6.1.3/csharp/src/Google.Protobuf/WellKnownTypes/Struct.cs --- protobuf-3.0.0/csharp/src/Google.Protobuf/WellKnownTypes/Struct.cs 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/csharp/src/Google.Protobuf/WellKnownTypes/Struct.cs 2018-12-08 01:32:11.000000000 +0000 @@ -1,5 +1,7 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/protobuf/struct.proto +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/protobuf/struct.proto +// #pragma warning disable 1591, 0612, 3021 #region Designer generated code @@ -35,7 +37,7 @@ "Lmdvb2dsZS5wcm90b2J1Zi5WYWx1ZSobCglOdWxsVmFsdWUSDgoKTlVMTF9W", "QUxVRRAAQoEBChNjb20uZ29vZ2xlLnByb3RvYnVmQgtTdHJ1Y3RQcm90b1AB", "WjFnaXRodWIuY29tL2dvbGFuZy9wcm90b2J1Zi9wdHlwZXMvc3RydWN0O3N0", - "cnVjdHBioAEBogIDR1BCqgIeR29vZ2xlLlByb3RvYnVmLldlbGxLbm93blR5", + "cnVjdHBi+AEBogIDR1BCqgIeR29vZ2xlLlByb3RvYnVmLldlbGxLbm93blR5", "cGVzYgZwcm90bzM=")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, @@ -50,14 +52,14 @@ } #region Enums /// - /// `NullValue` is a singleton enumeration to represent the null value for the - /// `Value` type union. + /// `NullValue` is a singleton enumeration to represent the null value for the + /// `Value` type union. /// - /// The JSON representation for `NullValue` is JSON `null`. + /// The JSON representation for `NullValue` is JSON `null`. /// public enum NullValue { /// - /// Null value. + /// Null value. /// [pbr::OriginalName("NULL_VALUE")] NullValue = 0, } @@ -66,17 +68,18 @@ #region Messages /// - /// `Struct` represents a structured data value, consisting of fields - /// which map to dynamically typed values. In some languages, `Struct` - /// might be supported by a native representation. For example, in - /// scripting languages like JS a struct is represented as an - /// object. The details of that representation are described together - /// with the proto support for the language. + /// `Struct` represents a structured data value, consisting of fields + /// which map to dynamically typed values. In some languages, `Struct` + /// might be supported by a native representation. For example, in + /// scripting languages like JS a struct is represented as an + /// object. The details of that representation are described together + /// with the proto support for the language. /// - /// The JSON representation for `Struct` is JSON object. + /// The JSON representation for `Struct` is JSON object. /// public sealed partial class Struct : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Struct()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -100,6 +103,7 @@ [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Struct(Struct other) : this() { fields_ = other.fields_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -113,7 +117,7 @@ = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.Value.Parser), 10); private readonly pbc::MapField fields_ = new pbc::MapField(); /// - /// Unordered map of dynamically typed values. + /// Unordered map of dynamically typed values. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField Fields { @@ -134,13 +138,16 @@ return true; } if (!Fields.Equals(other.Fields)) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; hash ^= Fields.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -152,12 +159,18 @@ [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { fields_.WriteTo(output, _map_fields_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; size += fields_.CalculateSize(_map_fields_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -167,6 +180,7 @@ return; } fields_.Add(other.fields_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -175,7 +189,7 @@ while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { fields_.AddEntriesFrom(input, _map_fields_codec); @@ -188,15 +202,16 @@ } /// - /// `Value` represents a dynamically typed value which can be either - /// null, a number, a string, a boolean, a recursive struct value, or a - /// list of values. A producer of value is expected to set one of that - /// variants, absence of any variant indicates an error. + /// `Value` represents a dynamically typed value which can be either + /// null, a number, a string, a boolean, a recursive struct value, or a + /// list of values. A producer of value is expected to set one of that + /// variants, absence of any variant indicates an error. /// - /// The JSON representation for `Value` is JSON value. + /// The JSON representation for `Value` is JSON value. /// public sealed partial class Value : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Value()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -240,6 +255,7 @@ break; } + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -250,7 +266,7 @@ /// Field number for the "null_value" field. public const int NullValueFieldNumber = 1; /// - /// Represents a null value. + /// Represents a null value. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.WellKnownTypes.NullValue NullValue { @@ -264,7 +280,7 @@ /// Field number for the "number_value" field. public const int NumberValueFieldNumber = 2; /// - /// Represents a double value. + /// Represents a double value. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public double NumberValue { @@ -278,7 +294,7 @@ /// Field number for the "string_value" field. public const int StringValueFieldNumber = 3; /// - /// Represents a string value. + /// Represents a string value. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string StringValue { @@ -292,7 +308,7 @@ /// Field number for the "bool_value" field. public const int BoolValueFieldNumber = 4; /// - /// Represents a boolean value. + /// Represents a boolean value. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool BoolValue { @@ -306,7 +322,7 @@ /// Field number for the "struct_value" field. public const int StructValueFieldNumber = 5; /// - /// Represents a structured value. + /// Represents a structured value. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.WellKnownTypes.Struct StructValue { @@ -320,7 +336,7 @@ /// Field number for the "list_value" field. public const int ListValueFieldNumber = 6; /// - /// Represents a repeated `Value`. + /// Represents a repeated `Value`. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.WellKnownTypes.ListValue ListValue { @@ -368,25 +384,28 @@ return true; } if (NullValue != other.NullValue) return false; - if (NumberValue != other.NumberValue) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(NumberValue, other.NumberValue)) return false; if (StringValue != other.StringValue) return false; if (BoolValue != other.BoolValue) return false; if (!object.Equals(StructValue, other.StructValue)) return false; if (!object.Equals(ListValue, other.ListValue)) return false; if (KindCase != other.KindCase) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (kindCase_ == KindOneofCase.NullValue) hash ^= NullValue.GetHashCode(); - if (kindCase_ == KindOneofCase.NumberValue) hash ^= NumberValue.GetHashCode(); + if (kindCase_ == KindOneofCase.NumberValue) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(NumberValue); if (kindCase_ == KindOneofCase.StringValue) hash ^= StringValue.GetHashCode(); if (kindCase_ == KindOneofCase.BoolValue) hash ^= BoolValue.GetHashCode(); if (kindCase_ == KindOneofCase.StructValue) hash ^= StructValue.GetHashCode(); if (kindCase_ == KindOneofCase.ListValue) hash ^= ListValue.GetHashCode(); hash ^= (int) kindCase_; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -421,6 +440,9 @@ output.WriteRawTag(50); output.WriteMessage(ListValue); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -444,6 +466,9 @@ if (kindCase_ == KindOneofCase.ListValue) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(ListValue); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -466,13 +491,20 @@ BoolValue = other.BoolValue; break; case KindOneofCase.StructValue: - StructValue = other.StructValue; + if (StructValue == null) { + StructValue = new global::Google.Protobuf.WellKnownTypes.Struct(); + } + StructValue.MergeFrom(other.StructValue); break; case KindOneofCase.ListValue: - ListValue = other.ListValue; + if (ListValue == null) { + ListValue = new global::Google.Protobuf.WellKnownTypes.ListValue(); + } + ListValue.MergeFrom(other.ListValue); break; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -481,7 +513,7 @@ while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 8: { kind_ = input.ReadEnum(); @@ -525,12 +557,13 @@ } /// - /// `ListValue` is a wrapper around a repeated field of values. + /// `ListValue` is a wrapper around a repeated field of values. /// - /// The JSON representation for `ListValue` is JSON array. + /// The JSON representation for `ListValue` is JSON array. /// public sealed partial class ListValue : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ListValue()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -554,6 +587,7 @@ [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public ListValue(ListValue other) : this() { values_ = other.values_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -567,7 +601,7 @@ = pb::FieldCodec.ForMessage(10, global::Google.Protobuf.WellKnownTypes.Value.Parser); private readonly pbc::RepeatedField values_ = new pbc::RepeatedField(); /// - /// Repeated field of dynamically typed values. + /// Repeated field of dynamically typed values. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField Values { @@ -588,13 +622,16 @@ return true; } if(!values_.Equals(other.values_)) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; hash ^= values_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -606,12 +643,18 @@ [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { values_.WriteTo(output, _repeated_values_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; size += values_.CalculateSize(_repeated_values_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -621,6 +664,7 @@ return; } values_.Add(other.values_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -629,7 +673,7 @@ while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { values_.AddEntriesFrom(input, _repeated_values_codec); diff -Nru protobuf-3.0.0/csharp/src/Google.Protobuf/WellKnownTypes/Timestamp.cs protobuf-3.6.1.3/csharp/src/Google.Protobuf/WellKnownTypes/Timestamp.cs --- protobuf-3.0.0/csharp/src/Google.Protobuf/WellKnownTypes/Timestamp.cs 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/csharp/src/Google.Protobuf/WellKnownTypes/Timestamp.cs 2018-12-08 01:32:11.000000000 +0000 @@ -1,5 +1,7 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/protobuf/timestamp.proto +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/protobuf/timestamp.proto +// #pragma warning disable 1591, 0612, 3021 #region Designer generated code @@ -24,10 +26,10 @@ string.Concat( "Ch9nb29nbGUvcHJvdG9idWYvdGltZXN0YW1wLnByb3RvEg9nb29nbGUucHJv", "dG9idWYiKwoJVGltZXN0YW1wEg8KB3NlY29uZHMYASABKAMSDQoFbmFub3MY", - "AiABKAVCgQEKE2NvbS5nb29nbGUucHJvdG9idWZCDlRpbWVzdGFtcFByb3Rv", - "UAFaK2dpdGh1Yi5jb20vZ29sYW5nL3Byb3RvYnVmL3B0eXBlcy90aW1lc3Rh", - "bXCgAQH4AQGiAgNHUEKqAh5Hb29nbGUuUHJvdG9idWYuV2VsbEtub3duVHlw", - "ZXNiBnByb3RvMw==")); + "AiABKAVCfgoTY29tLmdvb2dsZS5wcm90b2J1ZkIOVGltZXN0YW1wUHJvdG9Q", + "AVorZ2l0aHViLmNvbS9nb2xhbmcvcHJvdG9idWYvcHR5cGVzL3RpbWVzdGFt", + "cPgBAaICA0dQQqoCHkdvb2dsZS5Qcm90b2J1Zi5XZWxsS25vd25UeXBlc2IG", + "cHJvdG8z")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { @@ -39,61 +41,87 @@ } #region Messages /// - /// A Timestamp represents a point in time independent of any time zone - /// or calendar, represented as seconds and fractions of seconds at - /// nanosecond resolution in UTC Epoch time. It is encoded using the - /// Proleptic Gregorian Calendar which extends the Gregorian calendar - /// backwards to year one. It is encoded assuming all minutes are 60 - /// seconds long, i.e. leap seconds are "smeared" so that no leap second - /// table is needed for interpretation. Range is from - /// 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. - /// By restricting to that range, we ensure that we can convert to - /// and from RFC 3339 date strings. - /// See [https://www.ietf.org/rfc/rfc3339.txt](https://www.ietf.org/rfc/rfc3339.txt). - /// - /// Example 1: Compute Timestamp from POSIX `time()`. - /// - /// Timestamp timestamp; - /// timestamp.set_seconds(time(NULL)); - /// timestamp.set_nanos(0); - /// - /// Example 2: Compute Timestamp from POSIX `gettimeofday()`. - /// - /// struct timeval tv; - /// gettimeofday(&tv, NULL); - /// - /// Timestamp timestamp; - /// timestamp.set_seconds(tv.tv_sec); - /// timestamp.set_nanos(tv.tv_usec * 1000); - /// - /// Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. - /// - /// FILETIME ft; - /// GetSystemTimeAsFileTime(&ft); - /// UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; - /// - /// // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z - /// // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. - /// Timestamp timestamp; - /// timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); - /// timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); - /// - /// Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. - /// - /// long millis = System.currentTimeMillis(); - /// - /// Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) - /// .setNanos((int) ((millis % 1000) * 1000000)).build(); - /// - /// Example 5: Compute Timestamp from current time in Python. - /// - /// now = time.time() - /// seconds = int(now) - /// nanos = int((now - seconds) * 10**9) - /// timestamp = Timestamp(seconds=seconds, nanos=nanos) + /// A Timestamp represents a point in time independent of any time zone + /// or calendar, represented as seconds and fractions of seconds at + /// nanosecond resolution in UTC Epoch time. It is encoded using the + /// Proleptic Gregorian Calendar which extends the Gregorian calendar + /// backwards to year one. It is encoded assuming all minutes are 60 + /// seconds long, i.e. leap seconds are "smeared" so that no leap second + /// table is needed for interpretation. Range is from + /// 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. + /// By restricting to that range, we ensure that we can convert to + /// and from RFC 3339 date strings. + /// See [https://www.ietf.org/rfc/rfc3339.txt](https://www.ietf.org/rfc/rfc3339.txt). + /// + /// # Examples + /// + /// Example 1: Compute Timestamp from POSIX `time()`. + /// + /// Timestamp timestamp; + /// timestamp.set_seconds(time(NULL)); + /// timestamp.set_nanos(0); + /// + /// Example 2: Compute Timestamp from POSIX `gettimeofday()`. + /// + /// struct timeval tv; + /// gettimeofday(&tv, NULL); + /// + /// Timestamp timestamp; + /// timestamp.set_seconds(tv.tv_sec); + /// timestamp.set_nanos(tv.tv_usec * 1000); + /// + /// Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. + /// + /// FILETIME ft; + /// GetSystemTimeAsFileTime(&ft); + /// UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; + /// + /// // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z + /// // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. + /// Timestamp timestamp; + /// timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); + /// timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); + /// + /// Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. + /// + /// long millis = System.currentTimeMillis(); + /// + /// Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) + /// .setNanos((int) ((millis % 1000) * 1000000)).build(); + /// + /// Example 5: Compute Timestamp from current time in Python. + /// + /// timestamp = Timestamp() + /// timestamp.GetCurrentTime() + /// + /// # JSON Mapping + /// + /// In JSON format, the Timestamp type is encoded as a string in the + /// [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the + /// format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" + /// where {year} is always expressed using four digits while {month}, {day}, + /// {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional + /// seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), + /// are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone + /// is required. A proto3 JSON serializer should always use UTC (as indicated by + /// "Z") when printing the Timestamp type and a proto3 JSON parser should be + /// able to accept both UTC and other timezones (as indicated by an offset). + /// + /// For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past + /// 01:30 UTC on January 15, 2017. + /// + /// In JavaScript, one can convert a Date object to this format using the + /// standard [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString] + /// method. In Python, a standard `datetime.datetime` object can be converted + /// to this format using [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) + /// with the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one + /// can use the Joda Time's [`ISODateTimeFormat.dateTime()`]( + /// http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime-- + /// ) to obtain a formatter capable of generating timestamps in this format. /// public sealed partial class Timestamp : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Timestamp()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -118,6 +146,7 @@ public Timestamp(Timestamp other) : this() { seconds_ = other.seconds_; nanos_ = other.nanos_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -129,9 +158,9 @@ public const int SecondsFieldNumber = 1; private long seconds_; /// - /// Represents seconds of UTC time since Unix epoch - /// 1970-01-01T00:00:00Z. Must be from from 0001-01-01T00:00:00Z to - /// 9999-12-31T23:59:59Z inclusive. + /// Represents seconds of UTC time since Unix epoch + /// 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to + /// 9999-12-31T23:59:59Z inclusive. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public long Seconds { @@ -145,10 +174,10 @@ public const int NanosFieldNumber = 2; private int nanos_; /// - /// Non-negative fractions of a second at nanosecond resolution. Negative - /// second values with fractions must still have non-negative nanos values - /// that count forward in time. Must be from 0 to 999,999,999 - /// inclusive. + /// Non-negative fractions of a second at nanosecond resolution. Negative + /// second values with fractions must still have non-negative nanos values + /// that count forward in time. Must be from 0 to 999,999,999 + /// inclusive. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int Nanos { @@ -173,7 +202,7 @@ } if (Seconds != other.Seconds) return false; if (Nanos != other.Nanos) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -181,6 +210,9 @@ int hash = 1; if (Seconds != 0L) hash ^= Seconds.GetHashCode(); if (Nanos != 0) hash ^= Nanos.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -199,6 +231,9 @@ output.WriteRawTag(16); output.WriteInt32(Nanos); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -210,6 +245,9 @@ if (Nanos != 0) { size += 1 + pb::CodedOutputStream.ComputeInt32Size(Nanos); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -224,6 +262,7 @@ if (other.Nanos != 0) { Nanos = other.Nanos; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -232,7 +271,7 @@ while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 8: { Seconds = input.ReadInt64(); diff -Nru protobuf-3.0.0/csharp/src/Google.Protobuf/WellKnownTypes/Type.cs protobuf-3.6.1.3/csharp/src/Google.Protobuf/WellKnownTypes/Type.cs --- protobuf-3.0.0/csharp/src/Google.Protobuf/WellKnownTypes/Type.cs 2016-07-27 21:40:30.000000000 +0000 +++ protobuf-3.6.1.3/csharp/src/Google.Protobuf/WellKnownTypes/Type.cs 2018-12-08 01:32:11.000000000 +0000 @@ -1,5 +1,7 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/protobuf/type.proto +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/protobuf/type.proto +// #pragma warning disable 1591, 0612, 3021 #region Designer generated code @@ -54,9 +56,10 @@ "ASgFEigKB29wdGlvbnMYAyADKAsyFy5nb29nbGUucHJvdG9idWYuT3B0aW9u", "IjsKBk9wdGlvbhIMCgRuYW1lGAEgASgJEiMKBXZhbHVlGAIgASgLMhQuZ29v", "Z2xlLnByb3RvYnVmLkFueSouCgZTeW50YXgSEQoNU1lOVEFYX1BST1RPMhAA", - "EhEKDVNZTlRBWF9QUk9UTzMQAUJMChNjb20uZ29vZ2xlLnByb3RvYnVmQglU", - "eXBlUHJvdG9QAaABAaICA0dQQqoCHkdvb2dsZS5Qcm90b2J1Zi5XZWxsS25v", - "d25UeXBlc2IGcHJvdG8z")); + "EhEKDVNZTlRBWF9QUk9UTzMQAUJ9ChNjb20uZ29vZ2xlLnByb3RvYnVmQglU", + "eXBlUHJvdG9QAVovZ29vZ2xlLmdvbGFuZy5vcmcvZ2VucHJvdG8vcHJvdG9i", + "dWYvcHR5cGU7cHR5cGX4AQGiAgNHUEKqAh5Hb29nbGUuUHJvdG9idWYuV2Vs", + "bEtub3duVHlwZXNiBnByb3RvMw==")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { global::Google.Protobuf.WellKnownTypes.AnyReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.SourceContextReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Google.Protobuf.WellKnownTypes.Syntax), }, new pbr::GeneratedClrTypeInfo[] { @@ -72,15 +75,15 @@ } #region Enums /// - /// The syntax in which a protocol buffer element is defined. + /// The syntax in which a protocol buffer element is defined. /// public enum Syntax { /// - /// Syntax `proto2`. + /// Syntax `proto2`. /// [pbr::OriginalName("SYNTAX_PROTO2")] Proto2 = 0, /// - /// Syntax `proto3`. + /// Syntax `proto3`. /// [pbr::OriginalName("SYNTAX_PROTO3")] Proto3 = 1, } @@ -89,10 +92,11 @@ #region Messages /// - /// A protocol buffer message type. + /// A protocol buffer message type. /// public sealed partial class Type : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Type()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -119,8 +123,9 @@ fields_ = other.fields_.Clone(); oneofs_ = other.oneofs_.Clone(); options_ = other.options_.Clone(); - SourceContext = other.sourceContext_ != null ? other.SourceContext.Clone() : null; + sourceContext_ = other.sourceContext_ != null ? other.sourceContext_.Clone() : null; syntax_ = other.syntax_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -132,7 +137,7 @@ public const int NameFieldNumber = 1; private string name_ = ""; /// - /// The fully qualified message name. + /// The fully qualified message name. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string Name { @@ -148,7 +153,7 @@ = pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.Field.Parser); private readonly pbc::RepeatedField fields_ = new pbc::RepeatedField(); /// - /// The list of fields. + /// The list of fields. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField Fields { @@ -161,7 +166,7 @@ = pb::FieldCodec.ForString(26); private readonly pbc::RepeatedField oneofs_ = new pbc::RepeatedField(); /// - /// The list of types appearing in `oneof` definitions in this type. + /// The list of types appearing in `oneof` definitions in this type. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField Oneofs { @@ -174,7 +179,7 @@ = pb::FieldCodec.ForMessage(34, global::Google.Protobuf.WellKnownTypes.Option.Parser); private readonly pbc::RepeatedField options_ = new pbc::RepeatedField(); /// - /// The protocol buffer options. + /// The protocol buffer options. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField Options { @@ -185,7 +190,7 @@ public const int SourceContextFieldNumber = 5; private global::Google.Protobuf.WellKnownTypes.SourceContext sourceContext_; /// - /// The source context. + /// The source context. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.WellKnownTypes.SourceContext SourceContext { @@ -199,7 +204,7 @@ public const int SyntaxFieldNumber = 6; private global::Google.Protobuf.WellKnownTypes.Syntax syntax_ = 0; /// - /// The source syntax. + /// The source syntax. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.WellKnownTypes.Syntax Syntax { @@ -228,7 +233,7 @@ if(!options_.Equals(other.options_)) return false; if (!object.Equals(SourceContext, other.SourceContext)) return false; if (Syntax != other.Syntax) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -240,6 +245,9 @@ hash ^= options_.GetHashCode(); if (sourceContext_ != null) hash ^= SourceContext.GetHashCode(); if (Syntax != 0) hash ^= Syntax.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -265,6 +273,9 @@ output.WriteRawTag(48); output.WriteEnum((int) Syntax); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -282,6 +293,9 @@ if (Syntax != 0) { size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Syntax); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -305,6 +319,7 @@ if (other.Syntax != 0) { Syntax = other.Syntax; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -313,7 +328,7 @@ while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { Name = input.ReadString(); @@ -349,10 +364,11 @@ } /// - /// A single field of a message type. + /// A single field of a message type. /// public sealed partial class Field : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Field()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -385,6 +401,7 @@ options_ = other.options_.Clone(); jsonName_ = other.jsonName_; defaultValue_ = other.defaultValue_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -396,7 +413,7 @@ public const int KindFieldNumber = 1; private global::Google.Protobuf.WellKnownTypes.Field.Types.Kind kind_ = 0; /// - /// The field type. + /// The field type. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.WellKnownTypes.Field.Types.Kind Kind { @@ -410,7 +427,7 @@ public const int CardinalityFieldNumber = 2; private global::Google.Protobuf.WellKnownTypes.Field.Types.Cardinality cardinality_ = 0; /// - /// The field cardinality. + /// The field cardinality. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.WellKnownTypes.Field.Types.Cardinality Cardinality { @@ -424,7 +441,7 @@ public const int NumberFieldNumber = 3; private int number_; /// - /// The field number. + /// The field number. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int Number { @@ -438,7 +455,7 @@ public const int NameFieldNumber = 4; private string name_ = ""; /// - /// The field name. + /// The field name. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string Name { @@ -452,8 +469,8 @@ public const int TypeUrlFieldNumber = 6; private string typeUrl_ = ""; /// - /// The field type URL, without the scheme, for message or enumeration - /// types. Example: `"type.googleapis.com/google.protobuf.Timestamp"`. + /// The field type URL, without the scheme, for message or enumeration + /// types. Example: `"type.googleapis.com/google.protobuf.Timestamp"`. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string TypeUrl { @@ -467,8 +484,8 @@ public const int OneofIndexFieldNumber = 7; private int oneofIndex_; /// - /// The index of the field type in `Type.oneofs`, for message or enumeration - /// types. The first type has index 1; zero means the type is not in the list. + /// The index of the field type in `Type.oneofs`, for message or enumeration + /// types. The first type has index 1; zero means the type is not in the list. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int OneofIndex { @@ -482,7 +499,7 @@ public const int PackedFieldNumber = 8; private bool packed_; /// - /// Whether to use alternative packed wire representation. + /// Whether to use alternative packed wire representation. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Packed { @@ -498,7 +515,7 @@ = pb::FieldCodec.ForMessage(74, global::Google.Protobuf.WellKnownTypes.Option.Parser); private readonly pbc::RepeatedField options_ = new pbc::RepeatedField(); /// - /// The protocol buffer options. + /// The protocol buffer options. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField Options { @@ -509,7 +526,7 @@ public const int JsonNameFieldNumber = 10; private string jsonName_ = ""; /// - /// The field JSON name. + /// The field JSON name. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string JsonName { @@ -523,7 +540,7 @@ public const int DefaultValueFieldNumber = 11; private string defaultValue_ = ""; /// - /// The string value of the default value of this field. Proto2 syntax only. + /// The string value of the default value of this field. Proto2 syntax only. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string DefaultValue { @@ -556,7 +573,7 @@ if(!options_.Equals(other.options_)) return false; if (JsonName != other.JsonName) return false; if (DefaultValue != other.DefaultValue) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -572,6 +589,9 @@ hash ^= options_.GetHashCode(); if (JsonName.Length != 0) hash ^= JsonName.GetHashCode(); if (DefaultValue.Length != 0) hash ^= DefaultValue.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -619,6 +639,9 @@ output.WriteRawTag(90); output.WriteString(DefaultValue); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -652,6 +675,9 @@ if (DefaultValue.Length != 0) { size += 1 + pb::CodedOutputStream.ComputeStringSize(DefaultValue); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -688,6 +714,7 @@ if (other.DefaultValue.Length != 0) { DefaultValue = other.DefaultValue; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -696,7 +723,7 @@ while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 8: { kind_ = (global::Google.Protobuf.WellKnownTypes.Field.Types.Kind) input.ReadEnum(); @@ -747,105 +774,105 @@ [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static partial class Types { /// - /// Basic field types. + /// Basic field types. /// public enum Kind { /// - /// Field type unknown. + /// Field type unknown. /// [pbr::OriginalName("TYPE_UNKNOWN")] TypeUnknown = 0, /// - /// Field type double. + /// Field type double. /// [pbr::OriginalName("TYPE_DOUBLE")] TypeDouble = 1, /// - /// Field type float. + /// Field type float. /// [pbr::OriginalName("TYPE_FLOAT")] TypeFloat = 2, /// - /// Field type int64. + /// Field type int64. /// [pbr::OriginalName("TYPE_INT64")] TypeInt64 = 3, /// - /// Field type uint64. + /// Field type uint64. /// [pbr::OriginalName("TYPE_UINT64")] TypeUint64 = 4, /// - /// Field type int32. + /// Field type int32. /// [pbr::OriginalName("TYPE_INT32")] TypeInt32 = 5, /// - /// Field type fixed64. + /// Field type fixed64. /// [pbr::OriginalName("TYPE_FIXED64")] TypeFixed64 = 6, /// - /// Field type fixed32. + /// Field type fixed32. /// [pbr::OriginalName("TYPE_FIXED32")] TypeFixed32 = 7, /// - /// Field type bool. + /// Field type bool. /// [pbr::OriginalName("TYPE_BOOL")] TypeBool = 8, /// - /// Field type string. + /// Field type string. /// [pbr::OriginalName("TYPE_STRING")] TypeString = 9, /// - /// Field type group. Proto2 syntax only, and deprecated. + /// Field type group. Proto2 syntax only, and deprecated. /// [pbr::OriginalName("TYPE_GROUP")] TypeGroup = 10, /// - /// Field type message. + /// Field type message. /// [pbr::OriginalName("TYPE_MESSAGE")] TypeMessage = 11, /// - /// Field type bytes. + /// Field type bytes. /// [pbr::OriginalName("TYPE_BYTES")] TypeBytes = 12, /// - /// Field type uint32. + /// Field type uint32. /// [pbr::OriginalName("TYPE_UINT32")] TypeUint32 = 13, /// - /// Field type enum. + /// Field type enum. /// [pbr::OriginalName("TYPE_ENUM")] TypeEnum = 14, /// - /// Field type sfixed32. + /// Field type sfixed32. /// [pbr::OriginalName("TYPE_SFIXED32")] TypeSfixed32 = 15, /// - /// Field type sfixed64. + /// Field type sfixed64. /// [pbr::OriginalName("TYPE_SFIXED64")] TypeSfixed64 = 16, /// - /// Field type sint32. + /// Field type sint32. /// [pbr::OriginalName("TYPE_SINT32")] TypeSint32 = 17, /// - /// Field type sint64. + /// Field type sint64. /// [pbr::OriginalName("TYPE_SINT64")] TypeSint64 = 18, } /// - /// Whether a field is optional, required, or repeated. + /// Whether a field is optional, required, or repeated. /// public enum Cardinality { /// - /// For fields with unknown cardinality. + /// For fields with unknown cardinality. /// [pbr::OriginalName("CARDINALITY_UNKNOWN")] Unknown = 0, /// - /// For optional fields. + /// For optional fields. /// [pbr::OriginalName("CARDINALITY_OPTIONAL")] Optional = 1, /// - /// For required fields. Proto2 syntax only. + /// For required fields. Proto2 syntax only. /// [pbr::OriginalName("CARDINALITY_REQUIRED")] Required = 2, /// - /// For repeated fields. + /// For repeated fields. /// [pbr::OriginalName("CARDINALITY_REPEATED")] Repeated = 3, } @@ -856,10 +883,11 @@ } /// - /// Enum type definition. + /// Enum type definition. /// public sealed partial class Enum : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Enum()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -885,8 +913,9 @@ name_ = other.name_; enumvalue_ = other.enumvalue_.Clone(); options_ = other.options_.Clone(); - SourceContext = other.sourceContext_ != null ? other.SourceContext.Clone() : null; + sourceContext_ = other.sourceContext_ != null ? other.sourceContext_.Clone() : null; syntax_ = other.syntax_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -898,7 +927,7 @@ public const int NameFieldNumber = 1; private string name_ = ""; /// - /// Enum type name. + /// Enum type name. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string Name { @@ -914,7 +943,7 @@ = pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.EnumValue.Parser); private readonly pbc::RepeatedField enumvalue_ = new pbc::RepeatedField(); /// - /// Enum value definitions. + /// Enum value definitions. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField Enumvalue { @@ -927,7 +956,7 @@ = pb::FieldCodec.ForMessage(26, global::Google.Protobuf.WellKnownTypes.Option.Parser); private readonly pbc::RepeatedField options_ = new pbc::RepeatedField(); /// - /// Protocol buffer options. + /// Protocol buffer options. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField Options { @@ -938,7 +967,7 @@ public const int SourceContextFieldNumber = 4; private global::Google.Protobuf.WellKnownTypes.SourceContext sourceContext_; /// - /// The source context. + /// The source context. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.WellKnownTypes.SourceContext SourceContext { @@ -952,7 +981,7 @@ public const int SyntaxFieldNumber = 5; private global::Google.Protobuf.WellKnownTypes.Syntax syntax_ = 0; /// - /// The source syntax. + /// The source syntax. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.WellKnownTypes.Syntax Syntax { @@ -980,7 +1009,7 @@ if(!options_.Equals(other.options_)) return false; if (!object.Equals(SourceContext, other.SourceContext)) return false; if (Syntax != other.Syntax) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -991,6 +1020,9 @@ hash ^= options_.GetHashCode(); if (sourceContext_ != null) hash ^= SourceContext.GetHashCode(); if (Syntax != 0) hash ^= Syntax.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -1015,6 +1047,9 @@ output.WriteRawTag(40); output.WriteEnum((int) Syntax); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1031,6 +1066,9 @@ if (Syntax != 0) { size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Syntax); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -1053,6 +1091,7 @@ if (other.Syntax != 0) { Syntax = other.Syntax; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1061,7 +1100,7 @@ while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { Name = input.ReadString(); @@ -1093,10 +1132,11 @@ } /// - /// Enum value definition. + /// Enum value definition. /// public sealed partial class EnumValue : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new EnumValue()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -1122,6 +1162,7 @@ name_ = other.name_; number_ = other.number_; options_ = other.options_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1133,7 +1174,7 @@ public const int NameFieldNumber = 1; private string name_ = ""; /// - /// Enum value name. + /// Enum value name. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string Name { @@ -1147,7 +1188,7 @@ public const int NumberFieldNumber = 2; private int number_; /// - /// Enum value number. + /// Enum value number. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int Number { @@ -1163,7 +1204,7 @@ = pb::FieldCodec.ForMessage(26, global::Google.Protobuf.WellKnownTypes.Option.Parser); private readonly pbc::RepeatedField options_ = new pbc::RepeatedField(); /// - /// Protocol buffer options. + /// Protocol buffer options. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField Options { @@ -1186,7 +1227,7 @@ if (Name != other.Name) return false; if (Number != other.Number) return false; if(!options_.Equals(other.options_)) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1195,6 +1236,9 @@ if (Name.Length != 0) hash ^= Name.GetHashCode(); if (Number != 0) hash ^= Number.GetHashCode(); hash ^= options_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -1214,6 +1258,9 @@ output.WriteInt32(Number); } options_.WriteTo(output, _repeated_options_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1226,6 +1273,9 @@ size += 1 + pb::CodedOutputStream.ComputeInt32Size(Number); } size += options_.CalculateSize(_repeated_options_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -1241,6 +1291,7 @@ Number = other.Number; } options_.Add(other.options_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1249,7 +1300,7 @@ while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { Name = input.ReadString(); @@ -1270,11 +1321,12 @@ } /// - /// A protocol buffer option, which can be attached to a message, field, - /// enumeration, etc. + /// A protocol buffer option, which can be attached to a message, field, + /// enumeration, etc. /// public sealed partial class Option : pb::IMessage