PROTOBUF_SYNC_PIPER
pull/7630/head
Joshua Haberman 5 years ago
parent 183cdec7cd
commit f77065d4eb
  1. 32
      CHANGES.txt
  2. 2
      Protobuf.podspec
  3. 1
      conformance/failure_list_csharp.txt
  4. 30
      conformance/failure_list_python.txt
  5. 13
      conformance/failure_list_python_cpp.txt
  6. 2
      csharp/Google.Protobuf.Tools.nuspec
  7. 92
      csharp/src/AddressBook/Addressbook.cs
  8. 286
      csharp/src/Google.Protobuf.Benchmarks/BenchmarkMessage1Proto3.cs
  9. 31
      csharp/src/Google.Protobuf.Benchmarks/Benchmarks.cs
  10. 39
      csharp/src/Google.Protobuf.Benchmarks/ParseMessagesBenchmark.cs
  11. 1773
      csharp/src/Google.Protobuf.Benchmarks/WrapperBenchmarkMessages.cs
  12. 155
      csharp/src/Google.Protobuf.Conformance/Conformance.cs
  13. 52
      csharp/src/Google.Protobuf.Conformance/Program.cs
  14. 288
      csharp/src/Google.Protobuf.Test.TestProtos/MapUnittestProto3.cs
  15. 778
      csharp/src/Google.Protobuf.Test.TestProtos/TestMessagesProto2.cs
  16. 771
      csharp/src/Google.Protobuf.Test.TestProtos/TestMessagesProto3.cs
  17. 3539
      csharp/src/Google.Protobuf.Test.TestProtos/Unittest.cs
  18. 477
      csharp/src/Google.Protobuf.Test.TestProtos/UnittestCustomOptionsProto3.cs
  19. 23
      csharp/src/Google.Protobuf.Test.TestProtos/UnittestImport.cs
  20. 23
      csharp/src/Google.Protobuf.Test.TestProtos/UnittestImportProto3.cs
  21. 23
      csharp/src/Google.Protobuf.Test.TestProtos/UnittestImportPublic.cs
  22. 23
      csharp/src/Google.Protobuf.Test.TestProtos/UnittestImportPublicProto3.cs
  23. 19
      csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssue6936B.cs
  24. 26
      csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssue6936C.cs
  25. 359
      csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssues.cs
  26. 1379
      csharp/src/Google.Protobuf.Test.TestProtos/UnittestProto3.cs
  27. 132
      csharp/src/Google.Protobuf.Test.TestProtos/UnittestProto3Optional.cs
  28. 29
      csharp/src/Google.Protobuf.Test.TestProtos/UnittestSelfreferentialOptions.cs
  29. 470
      csharp/src/Google.Protobuf.Test.TestProtos/UnittestWellKnownTypes.cs
  30. 16
      csharp/src/Google.Protobuf.Test/ByteStringTest.cs
  31. 89
      csharp/src/Google.Protobuf.Test/Collections/RepeatedFieldTest.cs
  32. 58
      csharp/src/Google.Protobuf.Test/JsonFormatterTest.cs
  33. 11
      csharp/src/Google.Protobuf.Test/JsonParserTest.cs
  34. 4
      csharp/src/Google.Protobuf.Test/ReadOnlySequenceFactory.cs
  35. 119
      csharp/src/Google.Protobuf.Test/RefStructCompatibilityTest.cs
  36. 19
      csharp/src/Google.Protobuf/ByteString.cs
  37. 45
      csharp/src/Google.Protobuf/Collections/RepeatedField.cs
  38. 1
      csharp/src/Google.Protobuf/Google.Protobuf.csproj
  39. 37
      csharp/src/Google.Protobuf/JsonFormatter.cs
  40. 1082
      csharp/src/Google.Protobuf/Reflection/Descriptor.cs
  41. 27
      csharp/src/Google.Protobuf/WellKnownTypes/Any.cs
  42. 124
      csharp/src/Google.Protobuf/WellKnownTypes/Api.cs
  43. 27
      csharp/src/Google.Protobuf/WellKnownTypes/Duration.cs
  44. 19
      csharp/src/Google.Protobuf/WellKnownTypes/Empty.cs
  45. 23
      csharp/src/Google.Protobuf/WellKnownTypes/FieldMask.cs
  46. 23
      csharp/src/Google.Protobuf/WellKnownTypes/SourceContext.cs
  47. 100
      csharp/src/Google.Protobuf/WellKnownTypes/Struct.cs
  48. 27
      csharp/src/Google.Protobuf/WellKnownTypes/Timestamp.cs
  49. 208
      csharp/src/Google.Protobuf/WellKnownTypes/Type.cs
  50. 207
      csharp/src/Google.Protobuf/WellKnownTypes/Wrappers.cs
  51. 1
      docs/third_party.md
  52. 2
      java/bom/pom.xml
  53. 2
      java/core/pom.xml
  54. 2
      java/lite/pom.xml
  55. 2
      java/pom.xml
  56. 2
      java/util/pom.xml
  57. 47
      java/util/src/main/java/com/google/protobuf/util/FieldMaskTree.java
  58. 10
      java/util/src/main/java/com/google/protobuf/util/FieldMaskUtil.java
  59. 40
      java/util/src/test/java/com/google/protobuf/util/FieldMaskTreeTest.java
  60. 18
      java/util/src/test/java/com/google/protobuf/util/FieldMaskUtilTest.java
  61. 1
      kokoro/macos/objectivec_cocoapods_integration/build.sh
  62. 63
      kokoro/macos/prepare_build_macos_rc
  63. 1
      kokoro/macos/python/build.sh
  64. 1
      kokoro/macos/python_cpp/build.sh
  65. 2
      kokoro/macos/ruby23/build.sh
  66. 2
      kokoro/macos/ruby24/build.sh
  67. 2
      kokoro/macos/ruby25/build.sh
  68. 2
      kokoro/macos/ruby26/build.sh
  69. 2
      kokoro/macos/ruby27/build.sh
  70. 21
      objectivec/GPBDescriptor_PackagePrivate.h
  71. 6
      objectivec/README.md
  72. 4
      php/composer.json
  73. 2
      php/ext/google/protobuf/message.c
  74. 22
      php/ext/google/protobuf/package.xml
  75. 4
      php/ext/google/protobuf/protobuf.h
  76. 5
      php/tests/compile_extension.sh
  77. 16
      php/tests/generate_protos.sh
  78. 17
      php/tests/generated_class_test.php
  79. 20
      php/tests/test.sh
  80. 2
      protoc-artifacts/pom.xml
  81. 32
      python/google/protobuf/internal/decoder.py
  82. 10
      python/google/protobuf/internal/encoder.py
  83. 54
      python/google/protobuf/internal/json_format_test.py
  84. 11
      python/google/protobuf/internal/message_test.py
  85. 15
      python/google/protobuf/internal/python_message.py
  86. 34
      python/google/protobuf/json_format.py
  87. 2
      python/google/protobuf/pyext/descriptor.cc
  88. 3
      python/google/protobuf/pyext/descriptor.h
  89. 34
      python/google/protobuf/pyext/descriptor_containers.cc
  90. 18
      python/google/protobuf/pyext/descriptor_pool.cc
  91. 4
      python/google/protobuf/pyext/extension_dict.cc
  92. 17
      python/google/protobuf/pyext/message.cc
  93. 12
      python/release.sh
  94. 2
      ruby/google-protobuf.gemspec
  95. 2
      src/google/protobuf/any.pb.h
  96. 6
      src/google/protobuf/api.pb.h
  97. 1
      src/google/protobuf/compiler/command_line_interface.cc
  98. 26
      src/google/protobuf/compiler/command_line_interface_unittest.cc
  99. 2
      src/google/protobuf/compiler/cpp/cpp_message.cc
  100. 6
      src/google/protobuf/compiler/csharp/csharp_field_base.cc
  101. Some files were not shown because too many files have changed in this diff Show More

@ -1,12 +1,42 @@
Unreleased Changes
C++:
* Removed deprecated unsafe arena string accessors
* Enabled heterogeneous lookup for std::string keys in maps.
* Improved the randomness of map ordering.
* Removed implicit conversion from StringPiece to std::string
* Fix use-after-destroy bug when the Map is allocated in the arena.
* Improved the randomness of map ordering
* Added stack overflow protection for text format with unknown fields
* Use std::hash for proto maps to help with portability.
* Added more Windows macros to proto whitelist.
* Arena constructors for map entry messages are now marked "explicit"
(for regular messages they were already explicit).
Python:
* Reject lowercase t for Timestamp json format. Fixes a conformance test.
* Improved the error message when AttributeError is returned from __getattr__
in EnumTypeWrapper.
* Json format will print full_name directly for extensions.
Java:
* Fixed a bug where setting optional proto3 enums with setFooValue() would
not mark the value as present.
C#:
* Dropped support for netstandard1.0 (replaced by support for netstandard1.1).
This was required to modernize the parsing stack to use the `Span<byte>`
type internally. (#7351)
* Add `ParseFrom(ReadOnlySequence<byte>)` method to enable GC friendly
parsing with reduced allocations and buffer copies. (#7351)
* Add `GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE` define to make
generated code compatible with old C# compilers (pre-roslyn compilers
from .NET framework and old versions of mono) that do not support
ref structs. (#7490)
2020-06-01 version 3.12.3 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)
Objective-C
* Tweak the union used for Extensions to support old generated code. #7573
2020-05-26 version 3.12.2 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)

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

@ -1,4 +1,3 @@
Recommended.Proto3.JsonInput.BytesFieldBase64Url.JsonOutput
Recommended.Proto3.JsonInput.BytesFieldBase64Url.ProtobufOutput
Required.Proto2.JsonInput.StoresDefaultPrimitive.Validator
Recommended.Proto2.JsonInput.FieldNameExtension.Validator

@ -1,30 +0,0 @@
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
Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.BOOL[0].ProtobufOutput
Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.BYTES[0].ProtobufOutput
Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.DOUBLE[0].ProtobufOutput
Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.ENUM[0].ProtobufOutput
Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.FIXED32[0].ProtobufOutput
Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.FIXED64[0].ProtobufOutput
Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.FLOAT[0].ProtobufOutput
Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.INT32[0].ProtobufOutput
Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.INT32[6].ProtobufOutput
Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.INT64[0].ProtobufOutput
Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.SFIXED32[0].ProtobufOutput
Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.SFIXED64[0].ProtobufOutput
Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.SINT32[0].ProtobufOutput
Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.SINT64[0].ProtobufOutput
Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.STRING[0].ProtobufOutput
Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.UINT32[0].ProtobufOutput
Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.UINT32[5].ProtobufOutput
Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.UINT64[0].ProtobufOutput
Required.Proto3.JsonInput.DoubleFieldTooSmall
Required.Proto3.JsonInput.FloatFieldTooLarge
Required.Proto3.JsonInput.FloatFieldTooSmall
Required.Proto3.JsonInput.RepeatedFieldWrongElementTypeExpectingIntegersGotBool

@ -6,16 +6,3 @@
#
# TODO(haberman): insert links to corresponding bugs tracking the issue.
# Should we use GitHub issues or the Google-internal bug tracker?
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

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

@ -49,7 +49,11 @@ namespace Google.Protobuf.Examples.AddressBook {
/// <summary>
/// [START messages]
/// </summary>
public sealed partial class Person : pb::IMessage<Person>, pb::IBufferMessage {
public sealed partial class Person : pb::IMessage<Person>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<Person> _parser = new pb::MessageParser<Person>(() => new Person());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -256,9 +260,44 @@ namespace Google.Protobuf.Examples.AddressBook {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
Name = input.ReadString();
break;
}
case 16: {
Id = input.ReadInt32();
break;
}
case 26: {
Email = input.ReadString();
break;
}
case 34: {
phones_.AddEntriesFrom(input, _repeated_phones_codec);
break;
}
case 42: {
if (lastUpdated_ == null) {
LastUpdated = new global::Google.Protobuf.WellKnownTypes.Timestamp();
}
input.ReadMessage(LastUpdated);
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -293,6 +332,7 @@ namespace Google.Protobuf.Examples.AddressBook {
}
}
}
#endif
#region Nested types
/// <summary>Container for nested types declared in the Person message type.</summary>
@ -304,7 +344,11 @@ namespace Google.Protobuf.Examples.AddressBook {
[pbr::OriginalName("WORK")] Work = 2,
}
public sealed partial class PhoneNumber : pb::IMessage<PhoneNumber>, pb::IBufferMessage {
public sealed partial class PhoneNumber : pb::IMessage<PhoneNumber>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<PhoneNumber> _parser = new pb::MessageParser<PhoneNumber>(() => new PhoneNumber());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -441,9 +485,29 @@ namespace Google.Protobuf.Examples.AddressBook {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
Number = input.ReadString();
break;
}
case 16: {
Type = (global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneType) input.ReadEnum();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -463,6 +527,7 @@ namespace Google.Protobuf.Examples.AddressBook {
}
}
}
#endif
}
@ -474,7 +539,11 @@ namespace Google.Protobuf.Examples.AddressBook {
/// <summary>
/// Our address book file is just one of these.
/// </summary>
public sealed partial class AddressBook : pb::IMessage<AddressBook>, pb::IBufferMessage {
public sealed partial class AddressBook : pb::IMessage<AddressBook>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<AddressBook> _parser = new pb::MessageParser<AddressBook>(() => new AddressBook());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -579,9 +648,25 @@ namespace Google.Protobuf.Examples.AddressBook {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
people_.AddEntriesFrom(input, _repeated_people_codec);
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -597,6 +682,7 @@ namespace Google.Protobuf.Examples.AddressBook {
}
}
}
#endif
}

@ -64,7 +64,11 @@ namespace Benchmarks.Proto3 {
}
#region Messages
public sealed partial class GoogleMessage1 : pb::IMessage<GoogleMessage1>, pb::IBufferMessage {
public sealed partial class GoogleMessage1 : pb::IMessage<GoogleMessage1>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<GoogleMessage1> _parser = new pb::MessageParser<GoogleMessage1>(() => new GoogleMessage1());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -1132,9 +1136,189 @@ namespace Benchmarks.Proto3 {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
Field1 = input.ReadString();
break;
}
case 16: {
Field2 = input.ReadInt32();
break;
}
case 24: {
Field3 = input.ReadInt32();
break;
}
case 34: {
Field4 = input.ReadString();
break;
}
case 42:
case 41: {
field5_.AddEntriesFrom(input, _repeated_field5_codec);
break;
}
case 48: {
Field6 = input.ReadInt32();
break;
}
case 58: {
Field7 = input.ReadString();
break;
}
case 74: {
Field9 = input.ReadString();
break;
}
case 96: {
Field12 = input.ReadBool();
break;
}
case 104: {
Field13 = input.ReadBool();
break;
}
case 112: {
Field14 = input.ReadBool();
break;
}
case 122: {
if (field15_ == null) {
Field15 = new global::Benchmarks.Proto3.GoogleMessage1SubMessage();
}
input.ReadMessage(Field15);
break;
}
case 128: {
Field16 = input.ReadInt32();
break;
}
case 136: {
Field17 = input.ReadBool();
break;
}
case 146: {
Field18 = input.ReadString();
break;
}
case 176: {
Field22 = input.ReadInt64();
break;
}
case 184: {
Field23 = input.ReadInt32();
break;
}
case 192: {
Field24 = input.ReadBool();
break;
}
case 200: {
Field25 = input.ReadInt32();
break;
}
case 232: {
Field29 = input.ReadInt32();
break;
}
case 240: {
Field30 = input.ReadBool();
break;
}
case 472: {
Field59 = input.ReadBool();
break;
}
case 480: {
Field60 = input.ReadInt32();
break;
}
case 536: {
Field67 = input.ReadInt32();
break;
}
case 544: {
Field68 = input.ReadInt32();
break;
}
case 624: {
Field78 = input.ReadBool();
break;
}
case 640: {
Field80 = input.ReadBool();
break;
}
case 648: {
Field81 = input.ReadBool();
break;
}
case 800: {
Field100 = input.ReadInt32();
break;
}
case 808: {
Field101 = input.ReadInt32();
break;
}
case 818: {
Field102 = input.ReadString();
break;
}
case 826: {
Field103 = input.ReadString();
break;
}
case 832: {
Field104 = input.ReadInt32();
break;
}
case 1024: {
Field128 = input.ReadInt32();
break;
}
case 1034: {
Field129 = input.ReadString();
break;
}
case 1040: {
Field130 = input.ReadInt32();
break;
}
case 1048: {
Field131 = input.ReadInt32();
break;
}
case 1200: {
Field150 = input.ReadInt32();
break;
}
case 2168: {
Field271 = input.ReadInt32();
break;
}
case 2176: {
Field272 = input.ReadInt32();
break;
}
case 2240: {
Field280 = input.ReadInt32();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -1314,10 +1498,15 @@ namespace Benchmarks.Proto3 {
}
}
}
#endif
}
public sealed partial class GoogleMessage1SubMessage : pb::IMessage<GoogleMessage1SubMessage>, pb::IBufferMessage {
public sealed partial class GoogleMessage1SubMessage : pb::IMessage<GoogleMessage1SubMessage>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<GoogleMessage1SubMessage> _parser = new pb::MessageParser<GoogleMessage1SubMessage>(() => new GoogleMessage1SubMessage());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -1886,9 +2075,101 @@ namespace Benchmarks.Proto3 {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
Field1 = input.ReadInt32();
break;
}
case 16: {
Field2 = input.ReadInt32();
break;
}
case 24: {
Field3 = input.ReadInt32();
break;
}
case 96: {
Field12 = input.ReadBool();
break;
}
case 104: {
Field13 = input.ReadInt64();
break;
}
case 112: {
Field14 = input.ReadInt64();
break;
}
case 122: {
Field15 = input.ReadString();
break;
}
case 128: {
Field16 = input.ReadInt32();
break;
}
case 152: {
Field19 = input.ReadInt32();
break;
}
case 160: {
Field20 = input.ReadBool();
break;
}
case 169: {
Field21 = input.ReadFixed64();
break;
}
case 176: {
Field22 = input.ReadInt32();
break;
}
case 184: {
Field23 = input.ReadBool();
break;
}
case 224: {
Field28 = input.ReadBool();
break;
}
case 1629: {
Field203 = input.ReadFixed32();
break;
}
case 1632: {
Field204 = input.ReadInt32();
break;
}
case 1642: {
Field205 = input.ReadString();
break;
}
case 1648: {
Field206 = input.ReadBool();
break;
}
case 1656: {
Field207 = input.ReadUInt64();
break;
}
case 2400: {
Field300 = input.ReadUInt64();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -1980,6 +2261,7 @@ namespace Benchmarks.Proto3 {
}
}
}
#endif
}

@ -38,7 +38,11 @@ namespace Benchmarks {
}
#region Messages
public sealed partial class BenchmarkDataset : pb::IMessage<BenchmarkDataset>, pb::IBufferMessage {
public sealed partial class BenchmarkDataset : pb::IMessage<BenchmarkDataset>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<BenchmarkDataset> _parser = new pb::MessageParser<BenchmarkDataset>(() => new BenchmarkDataset());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -219,9 +223,33 @@ namespace Benchmarks {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
Name = input.ReadString();
break;
}
case 18: {
MessageName = input.ReadString();
break;
}
case 26: {
payload_.AddEntriesFrom(input, _repeated_payload_codec);
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -245,6 +273,7 @@ namespace Benchmarks {
}
}
}
#endif
}

@ -37,6 +37,7 @@ using System.IO;
using System.Linq;
using System.Buffers;
using Google.Protobuf.WellKnownTypes;
using Benchmarks.Proto3;
namespace Google.Protobuf.Benchmarks
{
@ -50,6 +51,7 @@ namespace Google.Protobuf.Benchmarks
SubTest manyWrapperFieldsTest = new SubTest(CreateManyWrapperFieldsMessage(), ManyWrapperFieldsMessage.Parser, () => new ManyWrapperFieldsMessage(), MaxMessages);
SubTest manyPrimitiveFieldsTest = new SubTest(CreateManyPrimitiveFieldsMessage(), ManyPrimitiveFieldsMessage.Parser, () => new ManyPrimitiveFieldsMessage(), MaxMessages);
SubTest repeatedFieldTest = new SubTest(CreateRepeatedFieldMessage(), GoogleMessage1.Parser, () => new GoogleMessage1(), MaxMessages);
SubTest emptyMessageTest = new SubTest(new Empty(), Empty.Parser, () => new Empty(), MaxMessages);
public IEnumerable<int> MessageCountValues => new[] { 10, 100 };
@ -83,6 +85,18 @@ namespace Google.Protobuf.Benchmarks
return manyPrimitiveFieldsTest.ParseFromReadOnlySequence();
}
[Benchmark]
public IMessage RepeatedFieldMessage_ParseFromByteArray()
{
return repeatedFieldTest.ParseFromByteArray();
}
[Benchmark]
public IMessage RepeatedFieldMessage_ParseFromReadOnlySequence()
{
return repeatedFieldTest.ParseFromReadOnlySequence();
}
[Benchmark]
public IMessage EmptyMessage_ParseFromByteArray()
{
@ -123,6 +137,20 @@ namespace Google.Protobuf.Benchmarks
manyPrimitiveFieldsTest.ParseDelimitedMessagesFromReadOnlySequence(messageCount);
}
[Benchmark]
[ArgumentsSource(nameof(MessageCountValues))]
public void RepeatedFieldMessage_ParseDelimitedMessagesFromByteArray(int messageCount)
{
repeatedFieldTest.ParseDelimitedMessagesFromByteArray(messageCount);
}
[Benchmark]
[ArgumentsSource(nameof(MessageCountValues))]
public void RepeatedFieldMessage_ParseDelimitedMessagesFromReadOnlySequence(int messageCount)
{
repeatedFieldTest.ParseDelimitedMessagesFromReadOnlySequence(messageCount);
}
private static ManyWrapperFieldsMessage CreateManyWrapperFieldsMessage()
{
// Example data match data of an internal benchmarks
@ -157,6 +185,17 @@ namespace Google.Protobuf.Benchmarks
};
}
private static GoogleMessage1 CreateRepeatedFieldMessage()
{
// Message with a repeated fixed length item collection
var message = new GoogleMessage1();
for (ulong i = 0; i < 1000; i++)
{
message.Field5.Add(i);
}
return message;
}
private class SubTest
{
private readonly IMessage message;

@ -107,7 +107,11 @@ namespace Conformance {
/// This will be known by message_type == "conformance.FailureSet", a conformance
/// test should return a serialized FailureSet in protobuf_payload.
/// </summary>
public sealed partial class FailureSet : pb::IMessage<FailureSet>, pb::IBufferMessage {
public sealed partial class FailureSet : pb::IMessage<FailureSet>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<FailureSet> _parser = new pb::MessageParser<FailureSet>(() => new FailureSet());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -212,9 +216,25 @@ namespace Conformance {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
failure_.AddEntriesFrom(input, _repeated_failure_codec);
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -230,6 +250,7 @@ namespace Conformance {
}
}
}
#endif
}
@ -240,7 +261,11 @@ namespace Conformance {
/// 2. parse the protobuf or JSON payload in "payload" (which may fail)
/// 3. if the parse succeeded, serialize the message in the requested format.
/// </summary>
public sealed partial class ConformanceRequest : pb::IMessage<ConformanceRequest>, pb::IBufferMessage {
public sealed partial class ConformanceRequest : pb::IMessage<ConformanceRequest>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<ConformanceRequest> _parser = new pb::MessageParser<ConformanceRequest>(() => new ConformanceRequest());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -608,9 +633,60 @@ namespace Conformance {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
ProtobufPayload = input.ReadBytes();
break;
}
case 18: {
JsonPayload = input.ReadString();
break;
}
case 24: {
RequestedOutputFormat = (global::Conformance.WireFormat) input.ReadEnum();
break;
}
case 34: {
MessageType = input.ReadString();
break;
}
case 40: {
TestCategory = (global::Conformance.TestCategory) input.ReadEnum();
break;
}
case 50: {
if (jspbEncodingOptions_ == null) {
JspbEncodingOptions = new global::Conformance.JspbEncodingConfig();
}
input.ReadMessage(JspbEncodingOptions);
break;
}
case 58: {
JspbPayload = input.ReadString();
break;
}
case 66: {
TextPayload = input.ReadString();
break;
}
case 72: {
PrintUnknownFields = input.ReadBool();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -661,13 +737,18 @@ namespace Conformance {
}
}
}
#endif
}
/// <summary>
/// Represents a single test case's output.
/// </summary>
public sealed partial class ConformanceResponse : pb::IMessage<ConformanceResponse>, pb::IBufferMessage {
public sealed partial class ConformanceResponse : pb::IMessage<ConformanceResponse>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<ConformanceResponse> _parser = new pb::MessageParser<ConformanceResponse>(() => new ConformanceResponse());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -1035,9 +1116,53 @@ namespace Conformance {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
ParseError = input.ReadString();
break;
}
case 18: {
RuntimeError = input.ReadString();
break;
}
case 26: {
ProtobufPayload = input.ReadBytes();
break;
}
case 34: {
JsonPayload = input.ReadString();
break;
}
case 42: {
Skipped = input.ReadString();
break;
}
case 50: {
SerializeError = input.ReadString();
break;
}
case 58: {
JspbPayload = input.ReadString();
break;
}
case 66: {
TextPayload = input.ReadString();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -1081,13 +1206,18 @@ namespace Conformance {
}
}
}
#endif
}
/// <summary>
/// Encoding options for jspb format.
/// </summary>
public sealed partial class JspbEncodingConfig : pb::IMessage<JspbEncodingConfig>, pb::IBufferMessage {
public sealed partial class JspbEncodingConfig : pb::IMessage<JspbEncodingConfig>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<JspbEncodingConfig> _parser = new pb::MessageParser<JspbEncodingConfig>(() => new JspbEncodingConfig());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -1203,9 +1333,25 @@ namespace Conformance {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
UseJspbArrayAnyFormat = input.ReadBool();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -1221,6 +1367,7 @@ namespace Conformance {
}
}
}
#endif
}

@ -83,44 +83,52 @@ namespace Google.Protobuf.Conformance
private static ConformanceResponse PerformRequest(ConformanceRequest request, TypeRegistry typeRegistry)
{
ExtensionRegistry proto2ExtensionRegistry = new ExtensionRegistry
{
ProtobufTestMessages.Proto2.TestMessagesProto2Extensions.ExtensionInt32,
ProtobufTestMessages.Proto2.TestAllTypesProto2.Types.MessageSetCorrectExtension1.Extensions.MessageSetExtension,
ProtobufTestMessages.Proto2.TestAllTypesProto2.Types.MessageSetCorrectExtension2.Extensions.MessageSetExtension
};
IMessage message;
try
{
switch (request.PayloadCase)
{
case ConformanceRequest.PayloadOneofCase.JsonPayload:
if (request.TestCategory == global::Conformance.TestCategory.JsonIgnoreUnknownParsingTest) {
if (request.TestCategory == global::Conformance.TestCategory.JsonIgnoreUnknownParsingTest)
{
return new ConformanceResponse { Skipped = "CSharp doesn't support skipping unknown fields in json parsing." };
}
var parser = new JsonParser(new JsonParser.Settings(20, typeRegistry));
message = parser.Parse<ProtobufTestMessages.Proto3.TestAllTypesProto3>(request.JsonPayload);
break;
case ConformanceRequest.PayloadOneofCase.ProtobufPayload:
{
if (request.MessageType.Equals("protobuf_test_messages.proto3.TestAllTypesProto3"))
switch (request.MessageType)
{
message = ProtobufTestMessages.Proto3.TestAllTypesProto3.Parser.ParseFrom(request.ProtobufPayload);
case "protobuf_test_messages.proto3.TestAllTypesProto3":
message = parser.Parse<ProtobufTestMessages.Proto3.TestAllTypesProto3>(request.JsonPayload);
break;
case "protobuf_test_messages.proto2.TestAllTypesProto2":
message = parser.Parse<ProtobufTestMessages.Proto2.TestAllTypesProto2>(request.JsonPayload);
break;
default:
throw new Exception($" Protobuf request doesn't have specific payload type ({request.MessageType})");
}
else if (request.MessageType.Equals("protobuf_test_messages.proto2.TestAllTypesProto2"))
{
ExtensionRegistry registry = new ExtensionRegistry()
{
ProtobufTestMessages.Proto2.TestMessagesProto2Extensions.ExtensionInt32,
ProtobufTestMessages.Proto2.TestAllTypesProto2.Types.MessageSetCorrectExtension1.Extensions.MessageSetExtension,
ProtobufTestMessages.Proto2.TestAllTypesProto2.Types.MessageSetCorrectExtension2.Extensions.MessageSetExtension
};
message = ProtobufTestMessages.Proto2.TestAllTypesProto2.Parser.WithExtensionRegistry(registry).ParseFrom(request.ProtobufPayload);
}
else
break;
case ConformanceRequest.PayloadOneofCase.ProtobufPayload:
switch (request.MessageType)
{
throw new Exception(" Protobuf request doesn't have specific payload type");
case "protobuf_test_messages.proto3.TestAllTypesProto3":
message = ProtobufTestMessages.Proto3.TestAllTypesProto3.Parser.ParseFrom(request.ProtobufPayload);
break;
case "protobuf_test_messages.proto2.TestAllTypesProto2":
message = ProtobufTestMessages.Proto2.TestAllTypesProto2.Parser
.WithExtensionRegistry(proto2ExtensionRegistry)
.ParseFrom(request.ProtobufPayload);
break;
default:
throw new Exception($" Protobuf request doesn't have specific payload type ({request.MessageType})");
}
break;
}
case ConformanceRequest.PayloadOneofCase.TextPayload:
{
return new ConformanceResponse { Skipped = "CSharp doesn't support text format" };
}
default:
throw new Exception("Unsupported request payload: " + request.PayloadCase);
}

@ -176,7 +176,11 @@ namespace Google.Protobuf.TestProtos {
/// <summary>
/// Tests maps.
/// </summary>
public sealed partial class TestMap : pb::IMessage<TestMap>, pb::IBufferMessage {
public sealed partial class TestMap : pb::IMessage<TestMap>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<TestMap> _parser = new pb::MessageParser<TestMap>(() => new TestMap());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -537,9 +541,89 @@ namespace Google.Protobuf.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
mapInt32Int32_.AddEntriesFrom(input, _map_mapInt32Int32_codec);
break;
}
case 18: {
mapInt64Int64_.AddEntriesFrom(input, _map_mapInt64Int64_codec);
break;
}
case 26: {
mapUint32Uint32_.AddEntriesFrom(input, _map_mapUint32Uint32_codec);
break;
}
case 34: {
mapUint64Uint64_.AddEntriesFrom(input, _map_mapUint64Uint64_codec);
break;
}
case 42: {
mapSint32Sint32_.AddEntriesFrom(input, _map_mapSint32Sint32_codec);
break;
}
case 50: {
mapSint64Sint64_.AddEntriesFrom(input, _map_mapSint64Sint64_codec);
break;
}
case 58: {
mapFixed32Fixed32_.AddEntriesFrom(input, _map_mapFixed32Fixed32_codec);
break;
}
case 66: {
mapFixed64Fixed64_.AddEntriesFrom(input, _map_mapFixed64Fixed64_codec);
break;
}
case 74: {
mapSfixed32Sfixed32_.AddEntriesFrom(input, _map_mapSfixed32Sfixed32_codec);
break;
}
case 82: {
mapSfixed64Sfixed64_.AddEntriesFrom(input, _map_mapSfixed64Sfixed64_codec);
break;
}
case 90: {
mapInt32Float_.AddEntriesFrom(input, _map_mapInt32Float_codec);
break;
}
case 98: {
mapInt32Double_.AddEntriesFrom(input, _map_mapInt32Double_codec);
break;
}
case 106: {
mapBoolBool_.AddEntriesFrom(input, _map_mapBoolBool_codec);
break;
}
case 114: {
mapStringString_.AddEntriesFrom(input, _map_mapStringString_codec);
break;
}
case 122: {
mapInt32Bytes_.AddEntriesFrom(input, _map_mapInt32Bytes_codec);
break;
}
case 130: {
mapInt32Enum_.AddEntriesFrom(input, _map_mapInt32Enum_codec);
break;
}
case 138: {
mapInt32ForeignMessage_.AddEntriesFrom(input, _map_mapInt32ForeignMessage_codec);
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -619,10 +703,15 @@ namespace Google.Protobuf.TestProtos {
}
}
}
#endif
}
public sealed partial class TestMapSubmessage : pb::IMessage<TestMapSubmessage>, pb::IBufferMessage {
public sealed partial class TestMapSubmessage : pb::IMessage<TestMapSubmessage>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<TestMapSubmessage> _parser = new pb::MessageParser<TestMapSubmessage>(() => new TestMapSubmessage());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -738,9 +827,28 @@ namespace Google.Protobuf.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
if (testMap_ == null) {
TestMap = new global::Google.Protobuf.TestProtos.TestMap();
}
input.ReadMessage(TestMap);
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -759,10 +867,15 @@ namespace Google.Protobuf.TestProtos {
}
}
}
#endif
}
public sealed partial class TestMessageMap : pb::IMessage<TestMessageMap>, pb::IBufferMessage {
public sealed partial class TestMessageMap : pb::IMessage<TestMessageMap>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<TestMessageMap> _parser = new pb::MessageParser<TestMessageMap>(() => new TestMessageMap());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -867,9 +980,25 @@ namespace Google.Protobuf.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
mapInt32Message_.AddEntriesFrom(input, _map_mapInt32Message_codec);
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -885,13 +1014,18 @@ namespace Google.Protobuf.TestProtos {
}
}
}
#endif
}
/// <summary>
/// Two map fields share the same entry default instance.
/// </summary>
public sealed partial class TestSameTypeMap : pb::IMessage<TestSameTypeMap>, pb::IBufferMessage {
public sealed partial class TestSameTypeMap : pb::IMessage<TestSameTypeMap>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<TestSameTypeMap> _parser = new pb::MessageParser<TestSameTypeMap>(() => new TestSameTypeMap());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -1012,9 +1146,29 @@ namespace Google.Protobuf.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
map1_.AddEntriesFrom(input, _map_map1_codec);
break;
}
case 18: {
map2_.AddEntriesFrom(input, _map_map2_codec);
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -1034,10 +1188,15 @@ namespace Google.Protobuf.TestProtos {
}
}
}
#endif
}
public sealed partial class TestArenaMap : pb::IMessage<TestArenaMap>, pb::IBufferMessage {
public sealed partial class TestArenaMap : pb::IMessage<TestArenaMap>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<TestArenaMap> _parser = new pb::MessageParser<TestArenaMap>(() => new TestArenaMap());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -1366,9 +1525,81 @@ namespace Google.Protobuf.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
mapInt32Int32_.AddEntriesFrom(input, _map_mapInt32Int32_codec);
break;
}
case 18: {
mapInt64Int64_.AddEntriesFrom(input, _map_mapInt64Int64_codec);
break;
}
case 26: {
mapUint32Uint32_.AddEntriesFrom(input, _map_mapUint32Uint32_codec);
break;
}
case 34: {
mapUint64Uint64_.AddEntriesFrom(input, _map_mapUint64Uint64_codec);
break;
}
case 42: {
mapSint32Sint32_.AddEntriesFrom(input, _map_mapSint32Sint32_codec);
break;
}
case 50: {
mapSint64Sint64_.AddEntriesFrom(input, _map_mapSint64Sint64_codec);
break;
}
case 58: {
mapFixed32Fixed32_.AddEntriesFrom(input, _map_mapFixed32Fixed32_codec);
break;
}
case 66: {
mapFixed64Fixed64_.AddEntriesFrom(input, _map_mapFixed64Fixed64_codec);
break;
}
case 74: {
mapSfixed32Sfixed32_.AddEntriesFrom(input, _map_mapSfixed32Sfixed32_codec);
break;
}
case 82: {
mapSfixed64Sfixed64_.AddEntriesFrom(input, _map_mapSfixed64Sfixed64_codec);
break;
}
case 90: {
mapInt32Float_.AddEntriesFrom(input, _map_mapInt32Float_codec);
break;
}
case 98: {
mapInt32Double_.AddEntriesFrom(input, _map_mapInt32Double_codec);
break;
}
case 106: {
mapBoolBool_.AddEntriesFrom(input, _map_mapBoolBool_codec);
break;
}
case 114: {
mapInt32Enum_.AddEntriesFrom(input, _map_mapInt32Enum_codec);
break;
}
case 122: {
mapInt32ForeignMessage_.AddEntriesFrom(input, _map_mapInt32ForeignMessage_codec);
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -1440,6 +1671,7 @@ namespace Google.Protobuf.TestProtos {
}
}
}
#endif
}
@ -1447,7 +1679,11 @@ namespace Google.Protobuf.TestProtos {
/// Previously, message containing enum called Type cannot be used as value of
/// map field.
/// </summary>
public sealed partial class MessageContainingEnumCalledType : pb::IMessage<MessageContainingEnumCalledType>, pb::IBufferMessage {
public sealed partial class MessageContainingEnumCalledType : pb::IMessage<MessageContainingEnumCalledType>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<MessageContainingEnumCalledType> _parser = new pb::MessageParser<MessageContainingEnumCalledType>(() => new MessageContainingEnumCalledType());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -1552,9 +1788,25 @@ namespace Google.Protobuf.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
type_.AddEntriesFrom(input, _map_type_codec);
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -1570,6 +1822,7 @@ namespace Google.Protobuf.TestProtos {
}
}
}
#endif
#region Nested types
/// <summary>Container for nested types declared in the MessageContainingEnumCalledType message type.</summary>
@ -1587,7 +1840,11 @@ namespace Google.Protobuf.TestProtos {
/// <summary>
/// Previously, message cannot contain map field called "entry".
/// </summary>
public sealed partial class MessageContainingMapCalledEntry : pb::IMessage<MessageContainingMapCalledEntry>, pb::IBufferMessage {
public sealed partial class MessageContainingMapCalledEntry : pb::IMessage<MessageContainingMapCalledEntry>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<MessageContainingMapCalledEntry> _parser = new pb::MessageParser<MessageContainingMapCalledEntry>(() => new MessageContainingMapCalledEntry());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -1692,9 +1949,25 @@ namespace Google.Protobuf.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
entry_.AddEntriesFrom(input, _map_entry_codec);
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -1710,6 +1983,7 @@ namespace Google.Protobuf.TestProtos {
}
}
}
#endif
}

@ -244,7 +244,11 @@ namespace ProtobufTestMessages.Proto2 {
/// could trigger bugs that occur in any message type in this file. We verify
/// this stays true in a unit test.
/// </summary>
public sealed partial class TestAllTypesProto2 : pb::IExtendableMessage<TestAllTypesProto2>, pb::IBufferMessage {
public sealed partial class TestAllTypesProto2 : pb::IExtendableMessage<TestAllTypesProto2>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<TestAllTypesProto2> _parser = new pb::MessageParser<TestAllTypesProto2>(() => new TestAllTypesProto2());
private pb::UnknownFieldSet _unknownFields;
private pb::ExtensionSet<TestAllTypesProto2> _extensions;
@ -3311,9 +3315,556 @@ namespace ProtobufTestMessages.Proto2 {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::ExtensionSet.TryMergeFieldFrom(ref _extensions, input)) {
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
}
break;
case 8: {
OptionalInt32 = input.ReadInt32();
break;
}
case 16: {
OptionalInt64 = input.ReadInt64();
break;
}
case 24: {
OptionalUint32 = input.ReadUInt32();
break;
}
case 32: {
OptionalUint64 = input.ReadUInt64();
break;
}
case 40: {
OptionalSint32 = input.ReadSInt32();
break;
}
case 48: {
OptionalSint64 = input.ReadSInt64();
break;
}
case 61: {
OptionalFixed32 = input.ReadFixed32();
break;
}
case 65: {
OptionalFixed64 = input.ReadFixed64();
break;
}
case 77: {
OptionalSfixed32 = input.ReadSFixed32();
break;
}
case 81: {
OptionalSfixed64 = input.ReadSFixed64();
break;
}
case 93: {
OptionalFloat = input.ReadFloat();
break;
}
case 97: {
OptionalDouble = input.ReadDouble();
break;
}
case 104: {
OptionalBool = input.ReadBool();
break;
}
case 114: {
OptionalString = input.ReadString();
break;
}
case 122: {
OptionalBytes = input.ReadBytes();
break;
}
case 146: {
if (optionalNestedMessage_ == null) {
OptionalNestedMessage = new global::ProtobufTestMessages.Proto2.TestAllTypesProto2.Types.NestedMessage();
}
input.ReadMessage(OptionalNestedMessage);
break;
}
case 154: {
if (optionalForeignMessage_ == null) {
OptionalForeignMessage = new global::ProtobufTestMessages.Proto2.ForeignMessageProto2();
}
input.ReadMessage(OptionalForeignMessage);
break;
}
case 168: {
OptionalNestedEnum = (global::ProtobufTestMessages.Proto2.TestAllTypesProto2.Types.NestedEnum) input.ReadEnum();
break;
}
case 176: {
OptionalForeignEnum = (global::ProtobufTestMessages.Proto2.ForeignEnumProto2) input.ReadEnum();
break;
}
case 194: {
OptionalStringPiece = input.ReadString();
break;
}
case 202: {
OptionalCord = input.ReadString();
break;
}
case 218: {
if (recursiveMessage_ == null) {
RecursiveMessage = new global::ProtobufTestMessages.Proto2.TestAllTypesProto2();
}
input.ReadMessage(RecursiveMessage);
break;
}
case 250:
case 248: {
repeatedInt32_.AddEntriesFrom(input, _repeated_repeatedInt32_codec);
break;
}
case 258:
case 256: {
repeatedInt64_.AddEntriesFrom(input, _repeated_repeatedInt64_codec);
break;
}
case 266:
case 264: {
repeatedUint32_.AddEntriesFrom(input, _repeated_repeatedUint32_codec);
break;
}
case 274:
case 272: {
repeatedUint64_.AddEntriesFrom(input, _repeated_repeatedUint64_codec);
break;
}
case 282:
case 280: {
repeatedSint32_.AddEntriesFrom(input, _repeated_repeatedSint32_codec);
break;
}
case 290:
case 288: {
repeatedSint64_.AddEntriesFrom(input, _repeated_repeatedSint64_codec);
break;
}
case 298:
case 301: {
repeatedFixed32_.AddEntriesFrom(input, _repeated_repeatedFixed32_codec);
break;
}
case 306:
case 305: {
repeatedFixed64_.AddEntriesFrom(input, _repeated_repeatedFixed64_codec);
break;
}
case 314:
case 317: {
repeatedSfixed32_.AddEntriesFrom(input, _repeated_repeatedSfixed32_codec);
break;
}
case 322:
case 321: {
repeatedSfixed64_.AddEntriesFrom(input, _repeated_repeatedSfixed64_codec);
break;
}
case 330:
case 333: {
repeatedFloat_.AddEntriesFrom(input, _repeated_repeatedFloat_codec);
break;
}
case 338:
case 337: {
repeatedDouble_.AddEntriesFrom(input, _repeated_repeatedDouble_codec);
break;
}
case 346:
case 344: {
repeatedBool_.AddEntriesFrom(input, _repeated_repeatedBool_codec);
break;
}
case 354: {
repeatedString_.AddEntriesFrom(input, _repeated_repeatedString_codec);
break;
}
case 362: {
repeatedBytes_.AddEntriesFrom(input, _repeated_repeatedBytes_codec);
break;
}
case 386: {
repeatedNestedMessage_.AddEntriesFrom(input, _repeated_repeatedNestedMessage_codec);
break;
}
case 394: {
repeatedForeignMessage_.AddEntriesFrom(input, _repeated_repeatedForeignMessage_codec);
break;
}
case 410:
case 408: {
repeatedNestedEnum_.AddEntriesFrom(input, _repeated_repeatedNestedEnum_codec);
break;
}
case 418:
case 416: {
repeatedForeignEnum_.AddEntriesFrom(input, _repeated_repeatedForeignEnum_codec);
break;
}
case 434: {
repeatedStringPiece_.AddEntriesFrom(input, _repeated_repeatedStringPiece_codec);
break;
}
case 442: {
repeatedCord_.AddEntriesFrom(input, _repeated_repeatedCord_codec);
break;
}
case 450: {
mapInt32Int32_.AddEntriesFrom(input, _map_mapInt32Int32_codec);
break;
}
case 458: {
mapInt64Int64_.AddEntriesFrom(input, _map_mapInt64Int64_codec);
break;
}
case 466: {
mapUint32Uint32_.AddEntriesFrom(input, _map_mapUint32Uint32_codec);
break;
}
case 474: {
mapUint64Uint64_.AddEntriesFrom(input, _map_mapUint64Uint64_codec);
break;
}
case 482: {
mapSint32Sint32_.AddEntriesFrom(input, _map_mapSint32Sint32_codec);
break;
}
case 490: {
mapSint64Sint64_.AddEntriesFrom(input, _map_mapSint64Sint64_codec);
break;
}
case 498: {
mapFixed32Fixed32_.AddEntriesFrom(input, _map_mapFixed32Fixed32_codec);
break;
}
case 506: {
mapFixed64Fixed64_.AddEntriesFrom(input, _map_mapFixed64Fixed64_codec);
break;
}
case 514: {
mapSfixed32Sfixed32_.AddEntriesFrom(input, _map_mapSfixed32Sfixed32_codec);
break;
}
case 522: {
mapSfixed64Sfixed64_.AddEntriesFrom(input, _map_mapSfixed64Sfixed64_codec);
break;
}
case 530: {
mapInt32Float_.AddEntriesFrom(input, _map_mapInt32Float_codec);
break;
}
case 538: {
mapInt32Double_.AddEntriesFrom(input, _map_mapInt32Double_codec);
break;
}
case 546: {
mapBoolBool_.AddEntriesFrom(input, _map_mapBoolBool_codec);
break;
}
case 554: {
mapStringString_.AddEntriesFrom(input, _map_mapStringString_codec);
break;
}
case 562: {
mapStringBytes_.AddEntriesFrom(input, _map_mapStringBytes_codec);
break;
}
case 570: {
mapStringNestedMessage_.AddEntriesFrom(input, _map_mapStringNestedMessage_codec);
break;
}
case 578: {
mapStringForeignMessage_.AddEntriesFrom(input, _map_mapStringForeignMessage_codec);
break;
}
case 586: {
mapStringNestedEnum_.AddEntriesFrom(input, _map_mapStringNestedEnum_codec);
break;
}
case 594: {
mapStringForeignEnum_.AddEntriesFrom(input, _map_mapStringForeignEnum_codec);
break;
}
case 602:
case 600: {
packedInt32_.AddEntriesFrom(input, _repeated_packedInt32_codec);
break;
}
case 610:
case 608: {
packedInt64_.AddEntriesFrom(input, _repeated_packedInt64_codec);
break;
}
case 618:
case 616: {
packedUint32_.AddEntriesFrom(input, _repeated_packedUint32_codec);
break;
}
case 626:
case 624: {
packedUint64_.AddEntriesFrom(input, _repeated_packedUint64_codec);
break;
}
case 634:
case 632: {
packedSint32_.AddEntriesFrom(input, _repeated_packedSint32_codec);
break;
}
case 642:
case 640: {
packedSint64_.AddEntriesFrom(input, _repeated_packedSint64_codec);
break;
}
case 650:
case 653: {
packedFixed32_.AddEntriesFrom(input, _repeated_packedFixed32_codec);
break;
}
case 658:
case 657: {
packedFixed64_.AddEntriesFrom(input, _repeated_packedFixed64_codec);
break;
}
case 666:
case 669: {
packedSfixed32_.AddEntriesFrom(input, _repeated_packedSfixed32_codec);
break;
}
case 674:
case 673: {
packedSfixed64_.AddEntriesFrom(input, _repeated_packedSfixed64_codec);
break;
}
case 682:
case 685: {
packedFloat_.AddEntriesFrom(input, _repeated_packedFloat_codec);
break;
}
case 690:
case 689: {
packedDouble_.AddEntriesFrom(input, _repeated_packedDouble_codec);
break;
}
case 698:
case 696: {
packedBool_.AddEntriesFrom(input, _repeated_packedBool_codec);
break;
}
case 706:
case 704: {
packedNestedEnum_.AddEntriesFrom(input, _repeated_packedNestedEnum_codec);
break;
}
case 714:
case 712: {
unpackedInt32_.AddEntriesFrom(input, _repeated_unpackedInt32_codec);
break;
}
case 722:
case 720: {
unpackedInt64_.AddEntriesFrom(input, _repeated_unpackedInt64_codec);
break;
}
case 730:
case 728: {
unpackedUint32_.AddEntriesFrom(input, _repeated_unpackedUint32_codec);
break;
}
case 738:
case 736: {
unpackedUint64_.AddEntriesFrom(input, _repeated_unpackedUint64_codec);
break;
}
case 746:
case 744: {
unpackedSint32_.AddEntriesFrom(input, _repeated_unpackedSint32_codec);
break;
}
case 754:
case 752: {
unpackedSint64_.AddEntriesFrom(input, _repeated_unpackedSint64_codec);
break;
}
case 762:
case 765: {
unpackedFixed32_.AddEntriesFrom(input, _repeated_unpackedFixed32_codec);
break;
}
case 770:
case 769: {
unpackedFixed64_.AddEntriesFrom(input, _repeated_unpackedFixed64_codec);
break;
}
case 778:
case 781: {
unpackedSfixed32_.AddEntriesFrom(input, _repeated_unpackedSfixed32_codec);
break;
}
case 786:
case 785: {
unpackedSfixed64_.AddEntriesFrom(input, _repeated_unpackedSfixed64_codec);
break;
}
case 794:
case 797: {
unpackedFloat_.AddEntriesFrom(input, _repeated_unpackedFloat_codec);
break;
}
case 802:
case 801: {
unpackedDouble_.AddEntriesFrom(input, _repeated_unpackedDouble_codec);
break;
}
case 810:
case 808: {
unpackedBool_.AddEntriesFrom(input, _repeated_unpackedBool_codec);
break;
}
case 818:
case 816: {
unpackedNestedEnum_.AddEntriesFrom(input, _repeated_unpackedNestedEnum_codec);
break;
}
case 888: {
OneofUint32 = input.ReadUInt32();
break;
}
case 898: {
global::ProtobufTestMessages.Proto2.TestAllTypesProto2.Types.NestedMessage subBuilder = new global::ProtobufTestMessages.Proto2.TestAllTypesProto2.Types.NestedMessage();
if (oneofFieldCase_ == OneofFieldOneofCase.OneofNestedMessage) {
subBuilder.MergeFrom(OneofNestedMessage);
}
input.ReadMessage(subBuilder);
OneofNestedMessage = subBuilder;
break;
}
case 906: {
OneofString = input.ReadString();
break;
}
case 914: {
OneofBytes = input.ReadBytes();
break;
}
case 920: {
OneofBool = input.ReadBool();
break;
}
case 928: {
OneofUint64 = input.ReadUInt64();
break;
}
case 941: {
OneofFloat = input.ReadFloat();
break;
}
case 945: {
OneofDouble = input.ReadDouble();
break;
}
case 952: {
oneofField_ = input.ReadEnum();
oneofFieldCase_ = OneofFieldOneofCase.OneofEnum;
break;
}
case 1611: {
if (!HasData) {
Data = new global::ProtobufTestMessages.Proto2.TestAllTypesProto2.Types.Data();
}
input.ReadGroup(Data);
break;
}
case 3208: {
Fieldname1 = input.ReadInt32();
break;
}
case 3216: {
FieldName2 = input.ReadInt32();
break;
}
case 3224: {
FieldName3 = input.ReadInt32();
break;
}
case 3232: {
FieldName4 = input.ReadInt32();
break;
}
case 3240: {
Field0Name5 = input.ReadInt32();
break;
}
case 3248: {
Field0Name6 = input.ReadInt32();
break;
}
case 3256: {
FieldName7 = input.ReadInt32();
break;
}
case 3264: {
FieldName8 = input.ReadInt32();
break;
}
case 3272: {
FieldName9 = input.ReadInt32();
break;
}
case 3280: {
FieldName10 = input.ReadInt32();
break;
}
case 3288: {
FIELDNAME11 = input.ReadInt32();
break;
}
case 3296: {
FIELDName12 = input.ReadInt32();
break;
}
case 3304: {
FieldName13 = input.ReadInt32();
break;
}
case 3312: {
FieldName14 = input.ReadInt32();
break;
}
case 3320: {
FieldName15 = input.ReadInt32();
break;
}
case 3328: {
FieldName16 = input.ReadInt32();
break;
}
case 3336: {
FieldName17 = input.ReadInt32();
break;
}
case 3344: {
FieldName18 = input.ReadInt32();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -3860,6 +4411,7 @@ namespace ProtobufTestMessages.Proto2 {
}
}
}
#endif
public TValue GetExtension<TValue>(pb::Extension<TestAllTypesProto2, TValue> extension) {
return pb::ExtensionSet.Get(ref _extensions, extension);
@ -3897,7 +4449,11 @@ namespace ProtobufTestMessages.Proto2 {
[pbr::OriginalName("NEG")] Neg = -1,
}
public sealed partial class NestedMessage : pb::IMessage<NestedMessage>, pb::IBufferMessage {
public sealed partial class NestedMessage : pb::IMessage<NestedMessage>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<NestedMessage> _parser = new pb::MessageParser<NestedMessage>(() => new NestedMessage());
private pb::UnknownFieldSet _unknownFields;
private int _hasBits0;
@ -4052,9 +4608,32 @@ namespace ProtobufTestMessages.Proto2 {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
A = input.ReadInt32();
break;
}
case 18: {
if (corecursive_ == null) {
Corecursive = new global::ProtobufTestMessages.Proto2.TestAllTypesProto2();
}
input.ReadMessage(Corecursive);
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -4077,13 +4656,18 @@ namespace ProtobufTestMessages.Proto2 {
}
}
}
#endif
}
/// <summary>
/// groups
/// </summary>
public sealed partial class Data : pb::IMessage<Data>, pb::IBufferMessage {
public sealed partial class Data : pb::IMessage<Data>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<Data> _parser = new pb::MessageParser<Data>(() => new Data());
private pb::UnknownFieldSet _unknownFields;
private int _hasBits0;
@ -4248,9 +4832,31 @@ namespace ProtobufTestMessages.Proto2 {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
case 1612:
return;
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 1616: {
GroupInt32 = input.ReadInt32();
break;
}
case 1624: {
GroupUint32 = input.ReadUInt32();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -4272,13 +4878,18 @@ namespace ProtobufTestMessages.Proto2 {
}
}
}
#endif
}
/// <summary>
/// message_set test case.
/// </summary>
public sealed partial class MessageSetCorrect : pb::IExtendableMessage<MessageSetCorrect>, pb::IBufferMessage {
public sealed partial class MessageSetCorrect : pb::IExtendableMessage<MessageSetCorrect>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<MessageSetCorrect> _parser = new pb::MessageParser<MessageSetCorrect>(() => new MessageSetCorrect());
private pb::UnknownFieldSet _unknownFields;
private pb::ExtensionSet<MessageSetCorrect> _extensions;
@ -4383,9 +4994,23 @@ namespace ProtobufTestMessages.Proto2 {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::ExtensionSet.TryMergeFieldFrom(ref _extensions, input)) {
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
}
break;
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -4399,6 +5024,7 @@ namespace ProtobufTestMessages.Proto2 {
}
}
}
#endif
public TValue GetExtension<TValue>(pb::Extension<MessageSetCorrect, TValue> extension) {
return pb::ExtensionSet.Get(ref _extensions, extension);
@ -4424,7 +5050,11 @@ namespace ProtobufTestMessages.Proto2 {
}
public sealed partial class MessageSetCorrectExtension1 : pb::IMessage<MessageSetCorrectExtension1>, pb::IBufferMessage {
public sealed partial class MessageSetCorrectExtension1 : pb::IMessage<MessageSetCorrectExtension1>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<MessageSetCorrectExtension1> _parser = new pb::MessageParser<MessageSetCorrectExtension1>(() => new MessageSetCorrectExtension1());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -4549,9 +5179,25 @@ namespace ProtobufTestMessages.Proto2 {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 202: {
Str = input.ReadString();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -4567,6 +5213,7 @@ namespace ProtobufTestMessages.Proto2 {
}
}
}
#endif
#region Extensions
/// <summary>Container for extensions for other messages declared in the MessageSetCorrectExtension1 message type.</summary>
@ -4579,7 +5226,11 @@ namespace ProtobufTestMessages.Proto2 {
}
public sealed partial class MessageSetCorrectExtension2 : pb::IMessage<MessageSetCorrectExtension2>, pb::IBufferMessage {
public sealed partial class MessageSetCorrectExtension2 : pb::IMessage<MessageSetCorrectExtension2>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<MessageSetCorrectExtension2> _parser = new pb::MessageParser<MessageSetCorrectExtension2>(() => new MessageSetCorrectExtension2());
private pb::UnknownFieldSet _unknownFields;
private int _hasBits0;
@ -4707,9 +5358,25 @@ namespace ProtobufTestMessages.Proto2 {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 72: {
I = input.ReadInt32();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -4725,6 +5392,7 @@ namespace ProtobufTestMessages.Proto2 {
}
}
}
#endif
#region Extensions
/// <summary>Container for extensions for other messages declared in the MessageSetCorrectExtension2 message type.</summary>
@ -4742,7 +5410,11 @@ namespace ProtobufTestMessages.Proto2 {
}
public sealed partial class ForeignMessageProto2 : pb::IMessage<ForeignMessageProto2>, pb::IBufferMessage {
public sealed partial class ForeignMessageProto2 : pb::IMessage<ForeignMessageProto2>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<ForeignMessageProto2> _parser = new pb::MessageParser<ForeignMessageProto2>(() => new ForeignMessageProto2());
private pb::UnknownFieldSet _unknownFields;
private int _hasBits0;
@ -4870,9 +5542,25 @@ namespace ProtobufTestMessages.Proto2 {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
C = input.ReadInt32();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -4888,10 +5576,15 @@ namespace ProtobufTestMessages.Proto2 {
}
}
}
#endif
}
public sealed partial class UnknownToTestAllTypes : pb::IMessage<UnknownToTestAllTypes>, pb::IBufferMessage {
public sealed partial class UnknownToTestAllTypes : pb::IMessage<UnknownToTestAllTypes>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<UnknownToTestAllTypes> _parser = new pb::MessageParser<UnknownToTestAllTypes>(() => new UnknownToTestAllTypes());
private pb::UnknownFieldSet _unknownFields;
private int _hasBits0;
@ -5173,9 +5866,52 @@ namespace ProtobufTestMessages.Proto2 {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8008: {
OptionalInt32 = input.ReadInt32();
break;
}
case 8018: {
OptionalString = input.ReadString();
break;
}
case 8026: {
if (nestedMessage_ == null) {
NestedMessage = new global::ProtobufTestMessages.Proto2.ForeignMessageProto2();
}
input.ReadMessage(NestedMessage);
break;
}
case 8035: {
if (!HasOptionalGroup) {
OptionalGroup = new global::ProtobufTestMessages.Proto2.UnknownToTestAllTypes.Types.OptionalGroup();
}
input.ReadGroup(OptionalGroup);
break;
}
case 8048: {
OptionalBool = input.ReadBool();
break;
}
case 8090:
case 8088: {
repeatedInt32_.AddEntriesFrom(input, _repeated_repeatedInt32_codec);
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -5218,12 +5954,17 @@ namespace ProtobufTestMessages.Proto2 {
}
}
}
#endif
#region Nested types
/// <summary>Container for nested types declared in the UnknownToTestAllTypes message type.</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static partial class Types {
public sealed partial class OptionalGroup : pb::IMessage<OptionalGroup>, pb::IBufferMessage {
public sealed partial class OptionalGroup : pb::IMessage<OptionalGroup>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<OptionalGroup> _parser = new pb::MessageParser<OptionalGroup>(() => new OptionalGroup());
private pb::UnknownFieldSet _unknownFields;
private int _hasBits0;
@ -5351,9 +6092,27 @@ namespace ProtobufTestMessages.Proto2 {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
case 8036:
return;
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
A = input.ReadInt32();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -5371,6 +6130,7 @@ namespace ProtobufTestMessages.Proto2 {
}
}
}
#endif
}

@ -259,7 +259,11 @@ namespace ProtobufTestMessages.Proto3 {
/// could trigger bugs that occur in any message type in this file. We verify
/// this stays true in a unit test.
/// </summary>
public sealed partial class TestAllTypesProto3 : pb::IMessage<TestAllTypesProto3>, pb::IBufferMessage {
public sealed partial class TestAllTypesProto3 : pb::IMessage<TestAllTypesProto3>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<TestAllTypesProto3> _parser = new pb::MessageParser<TestAllTypesProto3>(() => new TestAllTypesProto3());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -3383,9 +3387,720 @@ namespace ProtobufTestMessages.Proto3 {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
OptionalInt32 = input.ReadInt32();
break;
}
case 16: {
OptionalInt64 = input.ReadInt64();
break;
}
case 24: {
OptionalUint32 = input.ReadUInt32();
break;
}
case 32: {
OptionalUint64 = input.ReadUInt64();
break;
}
case 40: {
OptionalSint32 = input.ReadSInt32();
break;
}
case 48: {
OptionalSint64 = input.ReadSInt64();
break;
}
case 61: {
OptionalFixed32 = input.ReadFixed32();
break;
}
case 65: {
OptionalFixed64 = input.ReadFixed64();
break;
}
case 77: {
OptionalSfixed32 = input.ReadSFixed32();
break;
}
case 81: {
OptionalSfixed64 = input.ReadSFixed64();
break;
}
case 93: {
OptionalFloat = input.ReadFloat();
break;
}
case 97: {
OptionalDouble = input.ReadDouble();
break;
}
case 104: {
OptionalBool = input.ReadBool();
break;
}
case 114: {
OptionalString = input.ReadString();
break;
}
case 122: {
OptionalBytes = input.ReadBytes();
break;
}
case 146: {
if (optionalNestedMessage_ == null) {
OptionalNestedMessage = new global::ProtobufTestMessages.Proto3.TestAllTypesProto3.Types.NestedMessage();
}
input.ReadMessage(OptionalNestedMessage);
break;
}
case 154: {
if (optionalForeignMessage_ == null) {
OptionalForeignMessage = new global::ProtobufTestMessages.Proto3.ForeignMessage();
}
input.ReadMessage(OptionalForeignMessage);
break;
}
case 168: {
OptionalNestedEnum = (global::ProtobufTestMessages.Proto3.TestAllTypesProto3.Types.NestedEnum) input.ReadEnum();
break;
}
case 176: {
OptionalForeignEnum = (global::ProtobufTestMessages.Proto3.ForeignEnum) input.ReadEnum();
break;
}
case 184: {
OptionalAliasedEnum = (global::ProtobufTestMessages.Proto3.TestAllTypesProto3.Types.AliasedEnum) input.ReadEnum();
break;
}
case 194: {
OptionalStringPiece = input.ReadString();
break;
}
case 202: {
OptionalCord = input.ReadString();
break;
}
case 218: {
if (recursiveMessage_ == null) {
RecursiveMessage = new global::ProtobufTestMessages.Proto3.TestAllTypesProto3();
}
input.ReadMessage(RecursiveMessage);
break;
}
case 250:
case 248: {
repeatedInt32_.AddEntriesFrom(input, _repeated_repeatedInt32_codec);
break;
}
case 258:
case 256: {
repeatedInt64_.AddEntriesFrom(input, _repeated_repeatedInt64_codec);
break;
}
case 266:
case 264: {
repeatedUint32_.AddEntriesFrom(input, _repeated_repeatedUint32_codec);
break;
}
case 274:
case 272: {
repeatedUint64_.AddEntriesFrom(input, _repeated_repeatedUint64_codec);
break;
}
case 282:
case 280: {
repeatedSint32_.AddEntriesFrom(input, _repeated_repeatedSint32_codec);
break;
}
case 290:
case 288: {
repeatedSint64_.AddEntriesFrom(input, _repeated_repeatedSint64_codec);
break;
}
case 298:
case 301: {
repeatedFixed32_.AddEntriesFrom(input, _repeated_repeatedFixed32_codec);
break;
}
case 306:
case 305: {
repeatedFixed64_.AddEntriesFrom(input, _repeated_repeatedFixed64_codec);
break;
}
case 314:
case 317: {
repeatedSfixed32_.AddEntriesFrom(input, _repeated_repeatedSfixed32_codec);
break;
}
case 322:
case 321: {
repeatedSfixed64_.AddEntriesFrom(input, _repeated_repeatedSfixed64_codec);
break;
}
case 330:
case 333: {
repeatedFloat_.AddEntriesFrom(input, _repeated_repeatedFloat_codec);
break;
}
case 338:
case 337: {
repeatedDouble_.AddEntriesFrom(input, _repeated_repeatedDouble_codec);
break;
}
case 346:
case 344: {
repeatedBool_.AddEntriesFrom(input, _repeated_repeatedBool_codec);
break;
}
case 354: {
repeatedString_.AddEntriesFrom(input, _repeated_repeatedString_codec);
break;
}
case 362: {
repeatedBytes_.AddEntriesFrom(input, _repeated_repeatedBytes_codec);
break;
}
case 386: {
repeatedNestedMessage_.AddEntriesFrom(input, _repeated_repeatedNestedMessage_codec);
break;
}
case 394: {
repeatedForeignMessage_.AddEntriesFrom(input, _repeated_repeatedForeignMessage_codec);
break;
}
case 410:
case 408: {
repeatedNestedEnum_.AddEntriesFrom(input, _repeated_repeatedNestedEnum_codec);
break;
}
case 418:
case 416: {
repeatedForeignEnum_.AddEntriesFrom(input, _repeated_repeatedForeignEnum_codec);
break;
}
case 434: {
repeatedStringPiece_.AddEntriesFrom(input, _repeated_repeatedStringPiece_codec);
break;
}
case 442: {
repeatedCord_.AddEntriesFrom(input, _repeated_repeatedCord_codec);
break;
}
case 450: {
mapInt32Int32_.AddEntriesFrom(input, _map_mapInt32Int32_codec);
break;
}
case 458: {
mapInt64Int64_.AddEntriesFrom(input, _map_mapInt64Int64_codec);
break;
}
case 466: {
mapUint32Uint32_.AddEntriesFrom(input, _map_mapUint32Uint32_codec);
break;
}
case 474: {
mapUint64Uint64_.AddEntriesFrom(input, _map_mapUint64Uint64_codec);
break;
}
case 482: {
mapSint32Sint32_.AddEntriesFrom(input, _map_mapSint32Sint32_codec);
break;
}
case 490: {
mapSint64Sint64_.AddEntriesFrom(input, _map_mapSint64Sint64_codec);
break;
}
case 498: {
mapFixed32Fixed32_.AddEntriesFrom(input, _map_mapFixed32Fixed32_codec);
break;
}
case 506: {
mapFixed64Fixed64_.AddEntriesFrom(input, _map_mapFixed64Fixed64_codec);
break;
}
case 514: {
mapSfixed32Sfixed32_.AddEntriesFrom(input, _map_mapSfixed32Sfixed32_codec);
break;
}
case 522: {
mapSfixed64Sfixed64_.AddEntriesFrom(input, _map_mapSfixed64Sfixed64_codec);
break;
}
case 530: {
mapInt32Float_.AddEntriesFrom(input, _map_mapInt32Float_codec);
break;
}
case 538: {
mapInt32Double_.AddEntriesFrom(input, _map_mapInt32Double_codec);
break;
}
case 546: {
mapBoolBool_.AddEntriesFrom(input, _map_mapBoolBool_codec);
break;
}
case 554: {
mapStringString_.AddEntriesFrom(input, _map_mapStringString_codec);
break;
}
case 562: {
mapStringBytes_.AddEntriesFrom(input, _map_mapStringBytes_codec);
break;
}
case 570: {
mapStringNestedMessage_.AddEntriesFrom(input, _map_mapStringNestedMessage_codec);
break;
}
case 578: {
mapStringForeignMessage_.AddEntriesFrom(input, _map_mapStringForeignMessage_codec);
break;
}
case 586: {
mapStringNestedEnum_.AddEntriesFrom(input, _map_mapStringNestedEnum_codec);
break;
}
case 594: {
mapStringForeignEnum_.AddEntriesFrom(input, _map_mapStringForeignEnum_codec);
break;
}
case 602:
case 600: {
packedInt32_.AddEntriesFrom(input, _repeated_packedInt32_codec);
break;
}
case 610:
case 608: {
packedInt64_.AddEntriesFrom(input, _repeated_packedInt64_codec);
break;
}
case 618:
case 616: {
packedUint32_.AddEntriesFrom(input, _repeated_packedUint32_codec);
break;
}
case 626:
case 624: {
packedUint64_.AddEntriesFrom(input, _repeated_packedUint64_codec);
break;
}
case 634:
case 632: {
packedSint32_.AddEntriesFrom(input, _repeated_packedSint32_codec);
break;
}
case 642:
case 640: {
packedSint64_.AddEntriesFrom(input, _repeated_packedSint64_codec);
break;
}
case 650:
case 653: {
packedFixed32_.AddEntriesFrom(input, _repeated_packedFixed32_codec);
break;
}
case 658:
case 657: {
packedFixed64_.AddEntriesFrom(input, _repeated_packedFixed64_codec);
break;
}
case 666:
case 669: {
packedSfixed32_.AddEntriesFrom(input, _repeated_packedSfixed32_codec);
break;
}
case 674:
case 673: {
packedSfixed64_.AddEntriesFrom(input, _repeated_packedSfixed64_codec);
break;
}
case 682:
case 685: {
packedFloat_.AddEntriesFrom(input, _repeated_packedFloat_codec);
break;
}
case 690:
case 689: {
packedDouble_.AddEntriesFrom(input, _repeated_packedDouble_codec);
break;
}
case 698:
case 696: {
packedBool_.AddEntriesFrom(input, _repeated_packedBool_codec);
break;
}
case 706:
case 704: {
packedNestedEnum_.AddEntriesFrom(input, _repeated_packedNestedEnum_codec);
break;
}
case 714:
case 712: {
unpackedInt32_.AddEntriesFrom(input, _repeated_unpackedInt32_codec);
break;
}
case 722:
case 720: {
unpackedInt64_.AddEntriesFrom(input, _repeated_unpackedInt64_codec);
break;
}
case 730:
case 728: {
unpackedUint32_.AddEntriesFrom(input, _repeated_unpackedUint32_codec);
break;
}
case 738:
case 736: {
unpackedUint64_.AddEntriesFrom(input, _repeated_unpackedUint64_codec);
break;
}
case 746:
case 744: {
unpackedSint32_.AddEntriesFrom(input, _repeated_unpackedSint32_codec);
break;
}
case 754:
case 752: {
unpackedSint64_.AddEntriesFrom(input, _repeated_unpackedSint64_codec);
break;
}
case 762:
case 765: {
unpackedFixed32_.AddEntriesFrom(input, _repeated_unpackedFixed32_codec);
break;
}
case 770:
case 769: {
unpackedFixed64_.AddEntriesFrom(input, _repeated_unpackedFixed64_codec);
break;
}
case 778:
case 781: {
unpackedSfixed32_.AddEntriesFrom(input, _repeated_unpackedSfixed32_codec);
break;
}
case 786:
case 785: {
unpackedSfixed64_.AddEntriesFrom(input, _repeated_unpackedSfixed64_codec);
break;
}
case 794:
case 797: {
unpackedFloat_.AddEntriesFrom(input, _repeated_unpackedFloat_codec);
break;
}
case 802:
case 801: {
unpackedDouble_.AddEntriesFrom(input, _repeated_unpackedDouble_codec);
break;
}
case 810:
case 808: {
unpackedBool_.AddEntriesFrom(input, _repeated_unpackedBool_codec);
break;
}
case 818:
case 816: {
unpackedNestedEnum_.AddEntriesFrom(input, _repeated_unpackedNestedEnum_codec);
break;
}
case 888: {
OneofUint32 = input.ReadUInt32();
break;
}
case 898: {
global::ProtobufTestMessages.Proto3.TestAllTypesProto3.Types.NestedMessage subBuilder = new global::ProtobufTestMessages.Proto3.TestAllTypesProto3.Types.NestedMessage();
if (oneofFieldCase_ == OneofFieldOneofCase.OneofNestedMessage) {
subBuilder.MergeFrom(OneofNestedMessage);
}
input.ReadMessage(subBuilder);
OneofNestedMessage = subBuilder;
break;
}
case 906: {
OneofString = input.ReadString();
break;
}
case 914: {
OneofBytes = input.ReadBytes();
break;
}
case 920: {
OneofBool = input.ReadBool();
break;
}
case 928: {
OneofUint64 = input.ReadUInt64();
break;
}
case 941: {
OneofFloat = input.ReadFloat();
break;
}
case 945: {
OneofDouble = input.ReadDouble();
break;
}
case 952: {
oneofField_ = input.ReadEnum();
oneofFieldCase_ = OneofFieldOneofCase.OneofEnum;
break;
}
case 1610: {
bool? value = _single_optionalBoolWrapper_codec.Read(input);
if (optionalBoolWrapper_ == null || value != false) {
OptionalBoolWrapper = value;
}
break;
}
case 1618: {
int? value = _single_optionalInt32Wrapper_codec.Read(input);
if (optionalInt32Wrapper_ == null || value != 0) {
OptionalInt32Wrapper = value;
}
break;
}
case 1626: {
long? value = _single_optionalInt64Wrapper_codec.Read(input);
if (optionalInt64Wrapper_ == null || value != 0L) {
OptionalInt64Wrapper = value;
}
break;
}
case 1634: {
uint? value = _single_optionalUint32Wrapper_codec.Read(input);
if (optionalUint32Wrapper_ == null || value != 0) {
OptionalUint32Wrapper = value;
}
break;
}
case 1642: {
ulong? value = _single_optionalUint64Wrapper_codec.Read(input);
if (optionalUint64Wrapper_ == null || value != 0UL) {
OptionalUint64Wrapper = value;
}
break;
}
case 1650: {
float? value = _single_optionalFloatWrapper_codec.Read(input);
if (optionalFloatWrapper_ == null || value != 0F) {
OptionalFloatWrapper = value;
}
break;
}
case 1658: {
double? value = _single_optionalDoubleWrapper_codec.Read(input);
if (optionalDoubleWrapper_ == null || value != 0D) {
OptionalDoubleWrapper = value;
}
break;
}
case 1666: {
string value = _single_optionalStringWrapper_codec.Read(input);
if (optionalStringWrapper_ == null || value != "") {
OptionalStringWrapper = value;
}
break;
}
case 1674: {
pb::ByteString value = _single_optionalBytesWrapper_codec.Read(input);
if (optionalBytesWrapper_ == null || value != pb::ByteString.Empty) {
OptionalBytesWrapper = value;
}
break;
}
case 1690: {
repeatedBoolWrapper_.AddEntriesFrom(input, _repeated_repeatedBoolWrapper_codec);
break;
}
case 1698: {
repeatedInt32Wrapper_.AddEntriesFrom(input, _repeated_repeatedInt32Wrapper_codec);
break;
}
case 1706: {
repeatedInt64Wrapper_.AddEntriesFrom(input, _repeated_repeatedInt64Wrapper_codec);
break;
}
case 1714: {
repeatedUint32Wrapper_.AddEntriesFrom(input, _repeated_repeatedUint32Wrapper_codec);
break;
}
case 1722: {
repeatedUint64Wrapper_.AddEntriesFrom(input, _repeated_repeatedUint64Wrapper_codec);
break;
}
case 1730: {
repeatedFloatWrapper_.AddEntriesFrom(input, _repeated_repeatedFloatWrapper_codec);
break;
}
case 1738: {
repeatedDoubleWrapper_.AddEntriesFrom(input, _repeated_repeatedDoubleWrapper_codec);
break;
}
case 1746: {
repeatedStringWrapper_.AddEntriesFrom(input, _repeated_repeatedStringWrapper_codec);
break;
}
case 1754: {
repeatedBytesWrapper_.AddEntriesFrom(input, _repeated_repeatedBytesWrapper_codec);
break;
}
case 2410: {
if (optionalDuration_ == null) {
OptionalDuration = new global::Google.Protobuf.WellKnownTypes.Duration();
}
input.ReadMessage(OptionalDuration);
break;
}
case 2418: {
if (optionalTimestamp_ == null) {
OptionalTimestamp = new global::Google.Protobuf.WellKnownTypes.Timestamp();
}
input.ReadMessage(OptionalTimestamp);
break;
}
case 2426: {
if (optionalFieldMask_ == null) {
OptionalFieldMask = new global::Google.Protobuf.WellKnownTypes.FieldMask();
}
input.ReadMessage(OptionalFieldMask);
break;
}
case 2434: {
if (optionalStruct_ == null) {
OptionalStruct = new global::Google.Protobuf.WellKnownTypes.Struct();
}
input.ReadMessage(OptionalStruct);
break;
}
case 2442: {
if (optionalAny_ == null) {
OptionalAny = new global::Google.Protobuf.WellKnownTypes.Any();
}
input.ReadMessage(OptionalAny);
break;
}
case 2450: {
if (optionalValue_ == null) {
OptionalValue = new global::Google.Protobuf.WellKnownTypes.Value();
}
input.ReadMessage(OptionalValue);
break;
}
case 2490: {
repeatedDuration_.AddEntriesFrom(input, _repeated_repeatedDuration_codec);
break;
}
case 2498: {
repeatedTimestamp_.AddEntriesFrom(input, _repeated_repeatedTimestamp_codec);
break;
}
case 2506: {
repeatedFieldmask_.AddEntriesFrom(input, _repeated_repeatedFieldmask_codec);
break;
}
case 2522: {
repeatedAny_.AddEntriesFrom(input, _repeated_repeatedAny_codec);
break;
}
case 2530: {
repeatedValue_.AddEntriesFrom(input, _repeated_repeatedValue_codec);
break;
}
case 2538: {
repeatedListValue_.AddEntriesFrom(input, _repeated_repeatedListValue_codec);
break;
}
case 2594: {
repeatedStruct_.AddEntriesFrom(input, _repeated_repeatedStruct_codec);
break;
}
case 3208: {
Fieldname1 = input.ReadInt32();
break;
}
case 3216: {
FieldName2 = input.ReadInt32();
break;
}
case 3224: {
FieldName3 = input.ReadInt32();
break;
}
case 3232: {
FieldName4 = input.ReadInt32();
break;
}
case 3240: {
Field0Name5 = input.ReadInt32();
break;
}
case 3248: {
Field0Name6 = input.ReadInt32();
break;
}
case 3256: {
FieldName7 = input.ReadInt32();
break;
}
case 3264: {
FieldName8 = input.ReadInt32();
break;
}
case 3272: {
FieldName9 = input.ReadInt32();
break;
}
case 3280: {
FieldName10 = input.ReadInt32();
break;
}
case 3288: {
FIELDNAME11 = input.ReadInt32();
break;
}
case 3296: {
FIELDName12 = input.ReadInt32();
break;
}
case 3304: {
FieldName13 = input.ReadInt32();
break;
}
case 3312: {
FieldName14 = input.ReadInt32();
break;
}
case 3320: {
FieldName15 = input.ReadInt32();
break;
}
case 3328: {
FieldName16 = input.ReadInt32();
break;
}
case 3336: {
FieldName17 = input.ReadInt32();
break;
}
case 3344: {
FieldName18 = input.ReadInt32();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -4096,6 +4811,7 @@ namespace ProtobufTestMessages.Proto3 {
}
}
}
#endif
#region Nested types
/// <summary>Container for nested types declared in the TestAllTypesProto3 message type.</summary>
@ -4120,7 +4836,11 @@ namespace ProtobufTestMessages.Proto3 {
[pbr::OriginalName("bAz", PreferredAlias = false)] BAz = 2,
}
public sealed partial class NestedMessage : pb::IMessage<NestedMessage>, pb::IBufferMessage {
public sealed partial class NestedMessage : pb::IMessage<NestedMessage>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<NestedMessage> _parser = new pb::MessageParser<NestedMessage>(() => new NestedMessage());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -4260,9 +4980,32 @@ namespace ProtobufTestMessages.Proto3 {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
A = input.ReadInt32();
break;
}
case 18: {
if (corecursive_ == null) {
Corecursive = new global::ProtobufTestMessages.Proto3.TestAllTypesProto3();
}
input.ReadMessage(Corecursive);
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -4285,6 +5028,7 @@ namespace ProtobufTestMessages.Proto3 {
}
}
}
#endif
}
@ -4293,7 +5037,11 @@ namespace ProtobufTestMessages.Proto3 {
}
public sealed partial class ForeignMessage : pb::IMessage<ForeignMessage>, pb::IBufferMessage {
public sealed partial class ForeignMessage : pb::IMessage<ForeignMessage>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<ForeignMessage> _parser = new pb::MessageParser<ForeignMessage>(() => new ForeignMessage());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -4406,9 +5154,25 @@ namespace ProtobufTestMessages.Proto3 {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
C = input.ReadInt32();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -4424,6 +5188,7 @@ namespace ProtobufTestMessages.Proto3 {
}
}
}
#endif
}

File diff suppressed because it is too large Load Diff

@ -257,7 +257,11 @@ namespace UnitTest.Issues.TestProtos {
/// A test message with custom options at all possible locations (and also some
/// regular options, to make sure they interact nicely).
/// </summary>
public sealed partial class TestMessageWithCustomOptions : pb::IMessage<TestMessageWithCustomOptions>, pb::IBufferMessage {
public sealed partial class TestMessageWithCustomOptions : pb::IMessage<TestMessageWithCustomOptions>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<TestMessageWithCustomOptions> _parser = new pb::MessageParser<TestMessageWithCustomOptions>(() => new TestMessageWithCustomOptions());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -422,9 +426,29 @@ namespace UnitTest.Issues.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
Field1 = input.ReadString();
break;
}
case 16: {
OneofField = input.ReadInt32();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -444,6 +468,7 @@ namespace UnitTest.Issues.TestProtos {
}
}
}
#endif
#region Nested types
/// <summary>Container for nested types declared in the TestMessageWithCustomOptions message type.</summary>
@ -464,7 +489,11 @@ namespace UnitTest.Issues.TestProtos {
/// A test RPC service with custom options at all possible locations (and also
/// some regular options, to make sure they interact nicely).
/// </summary>
public sealed partial class CustomOptionFooRequest : pb::IMessage<CustomOptionFooRequest>, pb::IBufferMessage {
public sealed partial class CustomOptionFooRequest : pb::IMessage<CustomOptionFooRequest>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<CustomOptionFooRequest> _parser = new pb::MessageParser<CustomOptionFooRequest>(() => new CustomOptionFooRequest());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -553,9 +582,21 @@ namespace UnitTest.Issues.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -567,10 +608,15 @@ namespace UnitTest.Issues.TestProtos {
}
}
}
#endif
}
public sealed partial class CustomOptionFooResponse : pb::IMessage<CustomOptionFooResponse>, pb::IBufferMessage {
public sealed partial class CustomOptionFooResponse : pb::IMessage<CustomOptionFooResponse>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<CustomOptionFooResponse> _parser = new pb::MessageParser<CustomOptionFooResponse>(() => new CustomOptionFooResponse());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -659,9 +705,21 @@ namespace UnitTest.Issues.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -673,10 +731,15 @@ namespace UnitTest.Issues.TestProtos {
}
}
}
#endif
}
public sealed partial class CustomOptionFooClientMessage : pb::IMessage<CustomOptionFooClientMessage>, pb::IBufferMessage {
public sealed partial class CustomOptionFooClientMessage : pb::IMessage<CustomOptionFooClientMessage>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<CustomOptionFooClientMessage> _parser = new pb::MessageParser<CustomOptionFooClientMessage>(() => new CustomOptionFooClientMessage());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -765,9 +828,21 @@ namespace UnitTest.Issues.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -779,10 +854,15 @@ namespace UnitTest.Issues.TestProtos {
}
}
}
#endif
}
public sealed partial class CustomOptionFooServerMessage : pb::IMessage<CustomOptionFooServerMessage>, pb::IBufferMessage {
public sealed partial class CustomOptionFooServerMessage : pb::IMessage<CustomOptionFooServerMessage>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<CustomOptionFooServerMessage> _parser = new pb::MessageParser<CustomOptionFooServerMessage>(() => new CustomOptionFooServerMessage());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -871,9 +951,21 @@ namespace UnitTest.Issues.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -885,10 +977,15 @@ namespace UnitTest.Issues.TestProtos {
}
}
}
#endif
}
public sealed partial class DummyMessageContainingEnum : pb::IMessage<DummyMessageContainingEnum>, pb::IBufferMessage {
public sealed partial class DummyMessageContainingEnum : pb::IMessage<DummyMessageContainingEnum>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<DummyMessageContainingEnum> _parser = new pb::MessageParser<DummyMessageContainingEnum>(() => new DummyMessageContainingEnum());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -977,9 +1074,21 @@ namespace UnitTest.Issues.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -991,6 +1100,7 @@ namespace UnitTest.Issues.TestProtos {
}
}
}
#endif
#region Nested types
/// <summary>Container for nested types declared in the DummyMessageContainingEnum message type.</summary>
@ -1007,7 +1117,11 @@ namespace UnitTest.Issues.TestProtos {
}
public sealed partial class DummyMessageInvalidAsOptionType : pb::IMessage<DummyMessageInvalidAsOptionType>, pb::IBufferMessage {
public sealed partial class DummyMessageInvalidAsOptionType : pb::IMessage<DummyMessageInvalidAsOptionType>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<DummyMessageInvalidAsOptionType> _parser = new pb::MessageParser<DummyMessageInvalidAsOptionType>(() => new DummyMessageInvalidAsOptionType());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -1096,9 +1210,21 @@ namespace UnitTest.Issues.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -1110,10 +1236,15 @@ namespace UnitTest.Issues.TestProtos {
}
}
}
#endif
}
public sealed partial class CustomOptionMinIntegerValues : pb::IMessage<CustomOptionMinIntegerValues>, pb::IBufferMessage {
public sealed partial class CustomOptionMinIntegerValues : pb::IMessage<CustomOptionMinIntegerValues>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<CustomOptionMinIntegerValues> _parser = new pb::MessageParser<CustomOptionMinIntegerValues>(() => new CustomOptionMinIntegerValues());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -1202,9 +1333,21 @@ namespace UnitTest.Issues.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -1216,10 +1359,15 @@ namespace UnitTest.Issues.TestProtos {
}
}
}
#endif
}
public sealed partial class CustomOptionMaxIntegerValues : pb::IMessage<CustomOptionMaxIntegerValues>, pb::IBufferMessage {
public sealed partial class CustomOptionMaxIntegerValues : pb::IMessage<CustomOptionMaxIntegerValues>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<CustomOptionMaxIntegerValues> _parser = new pb::MessageParser<CustomOptionMaxIntegerValues>(() => new CustomOptionMaxIntegerValues());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -1308,9 +1456,21 @@ namespace UnitTest.Issues.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -1322,10 +1482,15 @@ namespace UnitTest.Issues.TestProtos {
}
}
}
#endif
}
public sealed partial class CustomOptionOtherValues : pb::IMessage<CustomOptionOtherValues>, pb::IBufferMessage {
public sealed partial class CustomOptionOtherValues : pb::IMessage<CustomOptionOtherValues>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<CustomOptionOtherValues> _parser = new pb::MessageParser<CustomOptionOtherValues>(() => new CustomOptionOtherValues());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -1414,9 +1579,21 @@ namespace UnitTest.Issues.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -1428,10 +1605,15 @@ namespace UnitTest.Issues.TestProtos {
}
}
}
#endif
}
public sealed partial class SettingRealsFromPositiveInts : pb::IMessage<SettingRealsFromPositiveInts>, pb::IBufferMessage {
public sealed partial class SettingRealsFromPositiveInts : pb::IMessage<SettingRealsFromPositiveInts>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<SettingRealsFromPositiveInts> _parser = new pb::MessageParser<SettingRealsFromPositiveInts>(() => new SettingRealsFromPositiveInts());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -1520,9 +1702,21 @@ namespace UnitTest.Issues.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -1534,10 +1728,15 @@ namespace UnitTest.Issues.TestProtos {
}
}
}
#endif
}
public sealed partial class SettingRealsFromNegativeInts : pb::IMessage<SettingRealsFromNegativeInts>, pb::IBufferMessage {
public sealed partial class SettingRealsFromNegativeInts : pb::IMessage<SettingRealsFromNegativeInts>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<SettingRealsFromNegativeInts> _parser = new pb::MessageParser<SettingRealsFromNegativeInts>(() => new SettingRealsFromNegativeInts());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -1626,9 +1825,21 @@ namespace UnitTest.Issues.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -1640,10 +1851,15 @@ namespace UnitTest.Issues.TestProtos {
}
}
}
#endif
}
public sealed partial class ComplexOptionType1 : pb::IMessage<ComplexOptionType1>, pb::IBufferMessage {
public sealed partial class ComplexOptionType1 : pb::IMessage<ComplexOptionType1>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<ComplexOptionType1> _parser = new pb::MessageParser<ComplexOptionType1>(() => new ComplexOptionType1());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -1820,9 +2036,38 @@ namespace UnitTest.Issues.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
Foo = input.ReadInt32();
break;
}
case 16: {
Foo2 = input.ReadInt32();
break;
}
case 24: {
Foo3 = input.ReadInt32();
break;
}
case 34:
case 32: {
foo4_.AddEntriesFrom(input, _repeated_foo4_codec);
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -1851,10 +2096,15 @@ namespace UnitTest.Issues.TestProtos {
}
}
}
#endif
}
public sealed partial class ComplexOptionType2 : pb::IMessage<ComplexOptionType2>, pb::IBufferMessage {
public sealed partial class ComplexOptionType2 : pb::IMessage<ComplexOptionType2>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<ComplexOptionType2> _parser = new pb::MessageParser<ComplexOptionType2>(() => new ComplexOptionType2());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -2037,9 +2287,43 @@ namespace UnitTest.Issues.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
if (bar_ == null) {
Bar = new global::UnitTest.Issues.TestProtos.ComplexOptionType1();
}
input.ReadMessage(Bar);
break;
}
case 16: {
Baz = input.ReadInt32();
break;
}
case 26: {
if (fred_ == null) {
Fred = new global::UnitTest.Issues.TestProtos.ComplexOptionType2.Types.ComplexOptionType4();
}
input.ReadMessage(Fred);
break;
}
case 34: {
barney_.AddEntriesFrom(input, _repeated_barney_codec);
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -2073,12 +2357,17 @@ namespace UnitTest.Issues.TestProtos {
}
}
}
#endif
#region Nested types
/// <summary>Container for nested types declared in the ComplexOptionType2 message type.</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static partial class Types {
public sealed partial class ComplexOptionType4 : pb::IMessage<ComplexOptionType4>, pb::IBufferMessage {
public sealed partial class ComplexOptionType4 : pb::IMessage<ComplexOptionType4>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<ComplexOptionType4> _parser = new pb::MessageParser<ComplexOptionType4>(() => new ComplexOptionType4());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -2191,9 +2480,25 @@ namespace UnitTest.Issues.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
Waldo = input.ReadInt32();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -2209,6 +2514,7 @@ namespace UnitTest.Issues.TestProtos {
}
}
}
#endif
#region Extensions
/// <summary>Container for extensions for other messages declared in the ComplexOptionType4 message type.</summary>
@ -2226,7 +2532,11 @@ namespace UnitTest.Issues.TestProtos {
}
public sealed partial class ComplexOptionType3 : pb::IMessage<ComplexOptionType3>, pb::IBufferMessage {
public sealed partial class ComplexOptionType3 : pb::IMessage<ComplexOptionType3>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<ComplexOptionType3> _parser = new pb::MessageParser<ComplexOptionType3>(() => new ComplexOptionType3());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -2339,9 +2649,25 @@ namespace UnitTest.Issues.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
Qux = input.ReadInt32();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -2357,13 +2683,18 @@ namespace UnitTest.Issues.TestProtos {
}
}
}
#endif
}
/// <summary>
/// Note that we try various different ways of naming the same extension.
/// </summary>
public sealed partial class VariousComplexOptions : pb::IMessage<VariousComplexOptions>, pb::IBufferMessage {
public sealed partial class VariousComplexOptions : pb::IMessage<VariousComplexOptions>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<VariousComplexOptions> _parser = new pb::MessageParser<VariousComplexOptions>(() => new VariousComplexOptions());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -2452,9 +2783,21 @@ namespace UnitTest.Issues.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -2466,13 +2809,18 @@ namespace UnitTest.Issues.TestProtos {
}
}
}
#endif
}
/// <summary>
/// A helper type used to test aggregate option parsing
/// </summary>
public sealed partial class Aggregate : pb::IMessage<Aggregate>, pb::IBufferMessage {
public sealed partial class Aggregate : pb::IMessage<Aggregate>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<Aggregate> _parser = new pb::MessageParser<Aggregate>(() => new Aggregate());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -2639,9 +2987,36 @@ namespace UnitTest.Issues.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
I = input.ReadInt32();
break;
}
case 18: {
S = input.ReadString();
break;
}
case 26: {
if (sub_ == null) {
Sub = new global::UnitTest.Issues.TestProtos.Aggregate();
}
input.ReadMessage(Sub);
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -2668,10 +3043,15 @@ namespace UnitTest.Issues.TestProtos {
}
}
}
#endif
}
public sealed partial class AggregateMessage : pb::IMessage<AggregateMessage>, pb::IBufferMessage {
public sealed partial class AggregateMessage : pb::IMessage<AggregateMessage>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<AggregateMessage> _parser = new pb::MessageParser<AggregateMessage>(() => new AggregateMessage());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -2784,9 +3164,25 @@ namespace UnitTest.Issues.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
Fieldname = input.ReadInt32();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -2802,13 +3198,18 @@ namespace UnitTest.Issues.TestProtos {
}
}
}
#endif
}
/// <summary>
/// Test custom options for nested type.
/// </summary>
public sealed partial class NestedOptionType : pb::IMessage<NestedOptionType>, pb::IBufferMessage {
public sealed partial class NestedOptionType : pb::IMessage<NestedOptionType>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<NestedOptionType> _parser = new pb::MessageParser<NestedOptionType>(() => new NestedOptionType());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -2897,9 +3298,21 @@ namespace UnitTest.Issues.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -2911,6 +3324,7 @@ namespace UnitTest.Issues.TestProtos {
}
}
}
#endif
#region Nested types
/// <summary>Container for nested types declared in the NestedOptionType message type.</summary>
@ -2921,7 +3335,11 @@ namespace UnitTest.Issues.TestProtos {
[pbr::OriginalName("NESTED_ENUM_VALUE")] Value = 1,
}
public sealed partial class NestedMessage : pb::IMessage<NestedMessage>, pb::IBufferMessage {
public sealed partial class NestedMessage : pb::IMessage<NestedMessage>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<NestedMessage> _parser = new pb::MessageParser<NestedMessage>(() => new NestedMessage());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -3034,9 +3452,25 @@ namespace UnitTest.Issues.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
NestedField = input.ReadInt32();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -3052,6 +3486,7 @@ namespace UnitTest.Issues.TestProtos {
}
}
}
#endif
}

@ -59,7 +59,11 @@ namespace Google.Protobuf.TestProtos.Proto2 {
#endregion
#region Messages
public sealed partial class ImportMessage : pb::IMessage<ImportMessage>, pb::IBufferMessage {
public sealed partial class ImportMessage : pb::IMessage<ImportMessage>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<ImportMessage> _parser = new pb::MessageParser<ImportMessage>(() => new ImportMessage());
private pb::UnknownFieldSet _unknownFields;
private int _hasBits0;
@ -187,9 +191,25 @@ namespace Google.Protobuf.TestProtos.Proto2 {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
D = input.ReadInt32();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -205,6 +225,7 @@ namespace Google.Protobuf.TestProtos.Proto2 {
}
}
}
#endif
}

@ -50,7 +50,11 @@ namespace Google.Protobuf.TestProtos {
#endregion
#region Messages
public sealed partial class ImportMessage : pb::IMessage<ImportMessage>, pb::IBufferMessage {
public sealed partial class ImportMessage : pb::IMessage<ImportMessage>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<ImportMessage> _parser = new pb::MessageParser<ImportMessage>(() => new ImportMessage());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -163,9 +167,25 @@ namespace Google.Protobuf.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
D = input.ReadInt32();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -181,6 +201,7 @@ namespace Google.Protobuf.TestProtos {
}
}
}
#endif
}

@ -37,7 +37,11 @@ namespace Google.Protobuf.TestProtos.Proto2 {
}
#region Messages
public sealed partial class PublicImportMessage : pb::IMessage<PublicImportMessage>, pb::IBufferMessage {
public sealed partial class PublicImportMessage : pb::IMessage<PublicImportMessage>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<PublicImportMessage> _parser = new pb::MessageParser<PublicImportMessage>(() => new PublicImportMessage());
private pb::UnknownFieldSet _unknownFields;
private int _hasBits0;
@ -165,9 +169,25 @@ namespace Google.Protobuf.TestProtos.Proto2 {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
E = input.ReadInt32();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -183,6 +203,7 @@ namespace Google.Protobuf.TestProtos.Proto2 {
}
}
}
#endif
}

@ -38,7 +38,11 @@ namespace Google.Protobuf.TestProtos {
}
#region Messages
public sealed partial class PublicImportMessage : pb::IMessage<PublicImportMessage>, pb::IBufferMessage {
public sealed partial class PublicImportMessage : pb::IMessage<PublicImportMessage>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<PublicImportMessage> _parser = new pb::MessageParser<PublicImportMessage>(() => new PublicImportMessage());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -151,9 +155,25 @@ namespace Google.Protobuf.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
E = input.ReadInt32();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -169,6 +189,7 @@ namespace Google.Protobuf.TestProtos {
}
}
}
#endif
}

@ -37,7 +37,11 @@ namespace UnitTest.Issues.TestProtos {
}
#region Messages
public sealed partial class Foo : pb::IMessage<Foo>, pb::IBufferMessage {
public sealed partial class Foo : pb::IMessage<Foo>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<Foo> _parser = new pb::MessageParser<Foo>(() => new Foo());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -126,9 +130,21 @@ namespace UnitTest.Issues.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -140,6 +156,7 @@ namespace UnitTest.Issues.TestProtos {
}
}
}
#endif
}

@ -39,7 +39,11 @@ namespace UnitTest.Issues.TestProtos {
}
#region Messages
public sealed partial class Bar : pb::IMessage<Bar>, pb::IBufferMessage {
public sealed partial class Bar : pb::IMessage<Bar>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<Bar> _parser = new pb::MessageParser<Bar>(() => new Bar());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -155,9 +159,28 @@ namespace UnitTest.Issues.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
if (foo_ == null) {
Foo = new global::UnitTest.Issues.TestProtos.Foo();
}
input.ReadMessage(Foo);
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -176,6 +199,7 @@ namespace UnitTest.Issues.TestProtos {
}
}
}
#endif
}

@ -88,7 +88,11 @@ namespace UnitTest.Issues.TestProtos {
/// Issue 307: when generating doubly-nested types, any references
/// should be of the form A.Types.B.Types.C.
/// </summary>
public sealed partial class Issue307 : pb::IMessage<Issue307>, pb::IBufferMessage {
public sealed partial class Issue307 : pb::IMessage<Issue307>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<Issue307> _parser = new pb::MessageParser<Issue307>(() => new Issue307());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -177,9 +181,21 @@ namespace UnitTest.Issues.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -191,12 +207,17 @@ namespace UnitTest.Issues.TestProtos {
}
}
}
#endif
#region Nested types
/// <summary>Container for nested types declared in the Issue307 message type.</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static partial class Types {
public sealed partial class NestedOnce : pb::IMessage<NestedOnce>, pb::IBufferMessage {
public sealed partial class NestedOnce : pb::IMessage<NestedOnce>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<NestedOnce> _parser = new pb::MessageParser<NestedOnce>(() => new NestedOnce());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -285,9 +306,21 @@ namespace UnitTest.Issues.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -299,12 +332,17 @@ namespace UnitTest.Issues.TestProtos {
}
}
}
#endif
#region Nested types
/// <summary>Container for nested types declared in the NestedOnce message type.</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static partial class Types {
public sealed partial class NestedTwice : pb::IMessage<NestedTwice>, pb::IBufferMessage {
public sealed partial class NestedTwice : pb::IMessage<NestedTwice>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<NestedTwice> _parser = new pb::MessageParser<NestedTwice>(() => new NestedTwice());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -393,9 +431,21 @@ namespace UnitTest.Issues.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -407,6 +457,7 @@ namespace UnitTest.Issues.TestProtos {
}
}
}
#endif
}
@ -420,7 +471,11 @@ namespace UnitTest.Issues.TestProtos {
}
public sealed partial class NegativeEnumMessage : pb::IMessage<NegativeEnumMessage>, pb::IBufferMessage {
public sealed partial class NegativeEnumMessage : pb::IMessage<NegativeEnumMessage>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<NegativeEnumMessage> _parser = new pb::MessageParser<NegativeEnumMessage>(() => new NegativeEnumMessage());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -565,9 +620,35 @@ namespace UnitTest.Issues.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
Value = (global::UnitTest.Issues.TestProtos.NegativeEnum) input.ReadEnum();
break;
}
case 18:
case 16: {
values_.AddEntriesFrom(input, _repeated_values_codec);
break;
}
case 26:
case 24: {
packedValues_.AddEntriesFrom(input, _repeated_packedValues_codec);
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -593,10 +674,15 @@ namespace UnitTest.Issues.TestProtos {
}
}
}
#endif
}
public sealed partial class DeprecatedChild : pb::IMessage<DeprecatedChild>, pb::IBufferMessage {
public sealed partial class DeprecatedChild : pb::IMessage<DeprecatedChild>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<DeprecatedChild> _parser = new pb::MessageParser<DeprecatedChild>(() => new DeprecatedChild());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -685,9 +771,21 @@ namespace UnitTest.Issues.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -699,10 +797,15 @@ namespace UnitTest.Issues.TestProtos {
}
}
}
#endif
}
public sealed partial class DeprecatedFieldsMessage : pb::IMessage<DeprecatedFieldsMessage>, pb::IBufferMessage {
public sealed partial class DeprecatedFieldsMessage : pb::IMessage<DeprecatedFieldsMessage>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<DeprecatedFieldsMessage> _parser = new pb::MessageParser<DeprecatedFieldsMessage>(() => new DeprecatedFieldsMessage());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -920,9 +1023,50 @@ namespace UnitTest.Issues.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
PrimitiveValue = input.ReadInt32();
break;
}
case 18:
case 16: {
primitiveArray_.AddEntriesFrom(input, _repeated_primitiveArray_codec);
break;
}
case 26: {
if (messageValue_ == null) {
MessageValue = new global::UnitTest.Issues.TestProtos.DeprecatedChild();
}
input.ReadMessage(MessageValue);
break;
}
case 34: {
messageArray_.AddEntriesFrom(input, _repeated_messageArray_codec);
break;
}
case 40: {
EnumValue = (global::UnitTest.Issues.TestProtos.DeprecatedEnum) input.ReadEnum();
break;
}
case 50:
case 48: {
enumArray_.AddEntriesFrom(input, _repeated_enumArray_codec);
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -963,13 +1107,18 @@ namespace UnitTest.Issues.TestProtos {
}
}
}
#endif
}
/// <summary>
/// Issue 45: http://code.google.com/p/protobuf-csharp-port/issues/detail?id=45
/// </summary>
public sealed partial class ItemField : pb::IMessage<ItemField>, pb::IBufferMessage {
public sealed partial class ItemField : pb::IMessage<ItemField>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<ItemField> _parser = new pb::MessageParser<ItemField>(() => new ItemField());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -1082,9 +1231,25 @@ namespace UnitTest.Issues.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
Item = input.ReadInt32();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -1100,10 +1265,15 @@ namespace UnitTest.Issues.TestProtos {
}
}
}
#endif
}
public sealed partial class ReservedNames : pb::IMessage<ReservedNames>, pb::IBufferMessage {
public sealed partial class ReservedNames : pb::IMessage<ReservedNames>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<ReservedNames> _parser = new pb::MessageParser<ReservedNames>(() => new ReservedNames());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -1240,9 +1410,29 @@ namespace UnitTest.Issues.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
Types_ = input.ReadInt32();
break;
}
case 16: {
Descriptor_ = input.ReadInt32();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -1262,6 +1452,7 @@ namespace UnitTest.Issues.TestProtos {
}
}
}
#endif
#region Nested types
/// <summary>Container for nested types declared in the ReservedNames message type.</summary>
@ -1270,7 +1461,11 @@ namespace UnitTest.Issues.TestProtos {
/// <summary>
/// Force a nested type called Types
/// </summary>
public sealed partial class SomeNestedType : pb::IMessage<SomeNestedType>, pb::IBufferMessage {
public sealed partial class SomeNestedType : pb::IMessage<SomeNestedType>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<SomeNestedType> _parser = new pb::MessageParser<SomeNestedType>(() => new SomeNestedType());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -1359,9 +1554,21 @@ namespace UnitTest.Issues.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -1373,6 +1580,7 @@ namespace UnitTest.Issues.TestProtos {
}
}
}
#endif
}
@ -1393,7 +1601,11 @@ namespace UnitTest.Issues.TestProtos {
/// Alternatively, consider just adding this to
/// unittest_proto3.proto if multiple platforms want it.
/// </summary>
public sealed partial class TestJsonFieldOrdering : pb::IMessage<TestJsonFieldOrdering>, pb::IBufferMessage {
public sealed partial class TestJsonFieldOrdering : pb::IMessage<TestJsonFieldOrdering>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<TestJsonFieldOrdering> _parser = new pb::MessageParser<TestJsonFieldOrdering>(() => new TestJsonFieldOrdering());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -1688,9 +1900,45 @@ namespace UnitTest.Issues.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
PlainString = input.ReadString();
break;
}
case 18: {
O1String = input.ReadString();
break;
}
case 26: {
O2String = input.ReadString();
break;
}
case 32: {
PlainInt32 = input.ReadInt32();
break;
}
case 40: {
O1Int32 = input.ReadInt32();
break;
}
case 48: {
O2Int32 = input.ReadInt32();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -1726,10 +1974,15 @@ namespace UnitTest.Issues.TestProtos {
}
}
}
#endif
}
public sealed partial class TestJsonName : pb::IMessage<TestJsonName>, pb::IBufferMessage {
public sealed partial class TestJsonName : pb::IMessage<TestJsonName>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<TestJsonName> _parser = new pb::MessageParser<TestJsonName>(() => new TestJsonName());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -1893,9 +2146,33 @@ namespace UnitTest.Issues.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
Name = input.ReadString();
break;
}
case 18: {
Description = input.ReadString();
break;
}
case 26: {
Guid = input.ReadString();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -1919,6 +2196,7 @@ namespace UnitTest.Issues.TestProtos {
}
}
}
#endif
}
@ -1927,7 +2205,11 @@ namespace UnitTest.Issues.TestProtos {
/// oneof case, which is itself a message type, the submessages should
/// be merged.
/// </summary>
public sealed partial class OneofMerging : pb::IMessage<OneofMerging>, pb::IBufferMessage {
public sealed partial class OneofMerging : pb::IMessage<OneofMerging>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<OneofMerging> _parser = new pb::MessageParser<OneofMerging>(() => new OneofMerging());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -2098,9 +2380,34 @@ namespace UnitTest.Issues.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
Text = input.ReadString();
break;
}
case 18: {
global::UnitTest.Issues.TestProtos.OneofMerging.Types.Nested subBuilder = new global::UnitTest.Issues.TestProtos.OneofMerging.Types.Nested();
if (valueCase_ == ValueOneofCase.Nested) {
subBuilder.MergeFrom(Nested);
}
input.ReadMessage(subBuilder);
Nested = subBuilder;
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -2125,12 +2432,17 @@ namespace UnitTest.Issues.TestProtos {
}
}
}
#endif
#region Nested types
/// <summary>Container for nested types declared in the OneofMerging message type.</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static partial class Types {
public sealed partial class Nested : pb::IMessage<Nested>, pb::IBufferMessage {
public sealed partial class Nested : pb::IMessage<Nested>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<Nested> _parser = new pb::MessageParser<Nested>(() => new Nested());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -2267,9 +2579,29 @@ namespace UnitTest.Issues.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
X = input.ReadInt32();
break;
}
case 16: {
Y = input.ReadInt32();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -2289,6 +2621,7 @@ namespace UnitTest.Issues.TestProtos {
}
}
}
#endif
}

File diff suppressed because it is too large Load Diff

@ -67,7 +67,11 @@ namespace ProtobufUnittest {
}
#region Messages
public sealed partial class TestProto3Optional : pb::IMessage<TestProto3Optional>, pb::IBufferMessage {
public sealed partial class TestProto3Optional : pb::IMessage<TestProto3Optional>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<TestProto3Optional> _parser = new pb::MessageParser<TestProto3Optional>(() => new TestProto3Optional());
private pb::UnknownFieldSet _unknownFields;
private int _hasBits0;
@ -858,9 +862,111 @@ namespace ProtobufUnittest {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
OptionalInt32 = input.ReadInt32();
break;
}
case 16: {
OptionalInt64 = input.ReadInt64();
break;
}
case 24: {
OptionalUint32 = input.ReadUInt32();
break;
}
case 32: {
OptionalUint64 = input.ReadUInt64();
break;
}
case 40: {
OptionalSint32 = input.ReadSInt32();
break;
}
case 48: {
OptionalSint64 = input.ReadSInt64();
break;
}
case 61: {
OptionalFixed32 = input.ReadFixed32();
break;
}
case 65: {
OptionalFixed64 = input.ReadFixed64();
break;
}
case 77: {
OptionalSfixed32 = input.ReadSFixed32();
break;
}
case 81: {
OptionalSfixed64 = input.ReadSFixed64();
break;
}
case 93: {
OptionalFloat = input.ReadFloat();
break;
}
case 97: {
OptionalDouble = input.ReadDouble();
break;
}
case 104: {
OptionalBool = input.ReadBool();
break;
}
case 114: {
OptionalString = input.ReadString();
break;
}
case 122: {
OptionalBytes = input.ReadBytes();
break;
}
case 130: {
OptionalCord = input.ReadString();
break;
}
case 146: {
if (optionalNestedMessage_ == null) {
OptionalNestedMessage = new global::ProtobufUnittest.TestProto3Optional.Types.NestedMessage();
}
input.ReadMessage(OptionalNestedMessage);
break;
}
case 154: {
if (lazyNestedMessage_ == null) {
LazyNestedMessage = new global::ProtobufUnittest.TestProto3Optional.Types.NestedMessage();
}
input.ReadMessage(LazyNestedMessage);
break;
}
case 168: {
OptionalNestedEnum = (global::ProtobufUnittest.TestProto3Optional.Types.NestedEnum) input.ReadEnum();
break;
}
case 176: {
SingularInt32 = input.ReadInt32();
break;
}
case 184: {
SingularInt64 = input.ReadInt64();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -962,6 +1068,7 @@ namespace ProtobufUnittest {
}
}
}
#endif
#region Nested types
/// <summary>Container for nested types declared in the TestProto3Optional message type.</summary>
@ -978,7 +1085,11 @@ namespace ProtobufUnittest {
[pbr::OriginalName("NEG")] Neg = -1,
}
public sealed partial class NestedMessage : pb::IMessage<NestedMessage>, pb::IBufferMessage {
public sealed partial class NestedMessage : pb::IMessage<NestedMessage>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<NestedMessage> _parser = new pb::MessageParser<NestedMessage>(() => new NestedMessage());
private pb::UnknownFieldSet _unknownFields;
private int _hasBits0;
@ -1109,9 +1220,25 @@ namespace ProtobufUnittest {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
Bb = input.ReadInt32();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -1127,6 +1254,7 @@ namespace ProtobufUnittest {
}
}
}
#endif
}

@ -63,7 +63,11 @@ namespace UnitTest.Issues.TestProtos.SelfreferentialOptions {
}
#region Messages
public sealed partial class FooOptions : pb::IExtendableMessage<FooOptions>, pb::IBufferMessage {
public sealed partial class FooOptions : pb::IExtendableMessage<FooOptions>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<FooOptions> _parser = new pb::MessageParser<FooOptions>(() => new FooOptions());
private pb::UnknownFieldSet _unknownFields;
private pb::ExtensionSet<FooOptions> _extensions;
@ -250,9 +254,31 @@ namespace UnitTest.Issues.TestProtos.SelfreferentialOptions {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::ExtensionSet.TryMergeFieldFrom(ref _extensions, input)) {
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
}
break;
case 8: {
IntOpt = input.ReadInt32();
break;
}
case 16: {
Foo = input.ReadInt32();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -274,6 +300,7 @@ namespace UnitTest.Issues.TestProtos.SelfreferentialOptions {
}
}
}
#endif
public TValue GetExtension<TValue>(pb::Extension<FooOptions, TValue> extension) {
return pb::ExtensionSet.Get(ref _extensions, extension);

@ -179,7 +179,11 @@ namespace Google.Protobuf.TestProtos {
/// Each wrapper type is included separately, as languages
/// map handle different wrappers in different ways.
/// </summary>
public sealed partial class TestWellKnownTypes : pb::IMessage<TestWellKnownTypes>, pb::IBufferMessage {
public sealed partial class TestWellKnownTypes : pb::IMessage<TestWellKnownTypes>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<TestWellKnownTypes> _parser = new pb::MessageParser<TestWellKnownTypes>(() => new TestWellKnownTypes());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -784,9 +788,154 @@ namespace Google.Protobuf.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
if (anyField_ == null) {
AnyField = new global::Google.Protobuf.WellKnownTypes.Any();
}
input.ReadMessage(AnyField);
break;
}
case 18: {
if (apiField_ == null) {
ApiField = new global::Google.Protobuf.WellKnownTypes.Api();
}
input.ReadMessage(ApiField);
break;
}
case 26: {
if (durationField_ == null) {
DurationField = new global::Google.Protobuf.WellKnownTypes.Duration();
}
input.ReadMessage(DurationField);
break;
}
case 34: {
if (emptyField_ == null) {
EmptyField = new global::Google.Protobuf.WellKnownTypes.Empty();
}
input.ReadMessage(EmptyField);
break;
}
case 42: {
if (fieldMaskField_ == null) {
FieldMaskField = new global::Google.Protobuf.WellKnownTypes.FieldMask();
}
input.ReadMessage(FieldMaskField);
break;
}
case 50: {
if (sourceContextField_ == null) {
SourceContextField = new global::Google.Protobuf.WellKnownTypes.SourceContext();
}
input.ReadMessage(SourceContextField);
break;
}
case 58: {
if (structField_ == null) {
StructField = new global::Google.Protobuf.WellKnownTypes.Struct();
}
input.ReadMessage(StructField);
break;
}
case 66: {
if (timestampField_ == null) {
TimestampField = new global::Google.Protobuf.WellKnownTypes.Timestamp();
}
input.ReadMessage(TimestampField);
break;
}
case 74: {
if (typeField_ == null) {
TypeField = new global::Google.Protobuf.WellKnownTypes.Type();
}
input.ReadMessage(TypeField);
break;
}
case 82: {
double? value = _single_doubleField_codec.Read(input);
if (doubleField_ == null || value != 0D) {
DoubleField = value;
}
break;
}
case 90: {
float? value = _single_floatField_codec.Read(input);
if (floatField_ == null || value != 0F) {
FloatField = value;
}
break;
}
case 98: {
long? value = _single_int64Field_codec.Read(input);
if (int64Field_ == null || value != 0L) {
Int64Field = value;
}
break;
}
case 106: {
ulong? value = _single_uint64Field_codec.Read(input);
if (uint64Field_ == null || value != 0UL) {
Uint64Field = value;
}
break;
}
case 114: {
int? value = _single_int32Field_codec.Read(input);
if (int32Field_ == null || value != 0) {
Int32Field = value;
}
break;
}
case 122: {
uint? value = _single_uint32Field_codec.Read(input);
if (uint32Field_ == null || value != 0) {
Uint32Field = value;
}
break;
}
case 130: {
bool? value = _single_boolField_codec.Read(input);
if (boolField_ == null || value != false) {
BoolField = value;
}
break;
}
case 138: {
string value = _single_stringField_codec.Read(input);
if (stringField_ == null || value != "") {
StringField = value;
}
break;
}
case 146: {
pb::ByteString value = _single_bytesField_codec.Read(input);
if (bytesField_ == null || value != pb::ByteString.Empty) {
BytesField = value;
}
break;
}
case 154: {
if (valueField_ == null) {
ValueField = new global::Google.Protobuf.WellKnownTypes.Value();
}
input.ReadMessage(ValueField);
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -931,13 +1080,18 @@ namespace Google.Protobuf.TestProtos {
}
}
}
#endif
}
/// <summary>
/// A repeated field for each well-known type.
/// </summary>
public sealed partial class RepeatedWellKnownTypes : pb::IMessage<RepeatedWellKnownTypes>, pb::IBufferMessage {
public sealed partial class RepeatedWellKnownTypes : pb::IMessage<RepeatedWellKnownTypes>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<RepeatedWellKnownTypes> _parser = new pb::MessageParser<RepeatedWellKnownTypes>(() => new RepeatedWellKnownTypes());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -1317,9 +1471,93 @@ namespace Google.Protobuf.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
anyField_.AddEntriesFrom(input, _repeated_anyField_codec);
break;
}
case 18: {
apiField_.AddEntriesFrom(input, _repeated_apiField_codec);
break;
}
case 26: {
durationField_.AddEntriesFrom(input, _repeated_durationField_codec);
break;
}
case 34: {
emptyField_.AddEntriesFrom(input, _repeated_emptyField_codec);
break;
}
case 42: {
fieldMaskField_.AddEntriesFrom(input, _repeated_fieldMaskField_codec);
break;
}
case 50: {
sourceContextField_.AddEntriesFrom(input, _repeated_sourceContextField_codec);
break;
}
case 58: {
structField_.AddEntriesFrom(input, _repeated_structField_codec);
break;
}
case 66: {
timestampField_.AddEntriesFrom(input, _repeated_timestampField_codec);
break;
}
case 74: {
typeField_.AddEntriesFrom(input, _repeated_typeField_codec);
break;
}
case 82: {
doubleField_.AddEntriesFrom(input, _repeated_doubleField_codec);
break;
}
case 90: {
floatField_.AddEntriesFrom(input, _repeated_floatField_codec);
break;
}
case 98: {
int64Field_.AddEntriesFrom(input, _repeated_int64Field_codec);
break;
}
case 106: {
uint64Field_.AddEntriesFrom(input, _repeated_uint64Field_codec);
break;
}
case 114: {
int32Field_.AddEntriesFrom(input, _repeated_int32Field_codec);
break;
}
case 122: {
uint32Field_.AddEntriesFrom(input, _repeated_uint32Field_codec);
break;
}
case 130: {
boolField_.AddEntriesFrom(input, _repeated_boolField_codec);
break;
}
case 138: {
stringField_.AddEntriesFrom(input, _repeated_stringField_codec);
break;
}
case 146: {
bytesField_.AddEntriesFrom(input, _repeated_bytesField_codec);
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -1403,10 +1641,15 @@ namespace Google.Protobuf.TestProtos {
}
}
}
#endif
}
public sealed partial class OneofWellKnownTypes : pb::IMessage<OneofWellKnownTypes>, pb::IBufferMessage {
public sealed partial class OneofWellKnownTypes : pb::IMessage<OneofWellKnownTypes>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<OneofWellKnownTypes> _parser = new pb::MessageParser<OneofWellKnownTypes>(() => new OneofWellKnownTypes());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -2033,9 +2276,138 @@ namespace Google.Protobuf.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
global::Google.Protobuf.WellKnownTypes.Any subBuilder = new global::Google.Protobuf.WellKnownTypes.Any();
if (oneofFieldCase_ == OneofFieldOneofCase.AnyField) {
subBuilder.MergeFrom(AnyField);
}
input.ReadMessage(subBuilder);
AnyField = subBuilder;
break;
}
case 18: {
global::Google.Protobuf.WellKnownTypes.Api subBuilder = new global::Google.Protobuf.WellKnownTypes.Api();
if (oneofFieldCase_ == OneofFieldOneofCase.ApiField) {
subBuilder.MergeFrom(ApiField);
}
input.ReadMessage(subBuilder);
ApiField = subBuilder;
break;
}
case 26: {
global::Google.Protobuf.WellKnownTypes.Duration subBuilder = new global::Google.Protobuf.WellKnownTypes.Duration();
if (oneofFieldCase_ == OneofFieldOneofCase.DurationField) {
subBuilder.MergeFrom(DurationField);
}
input.ReadMessage(subBuilder);
DurationField = subBuilder;
break;
}
case 34: {
global::Google.Protobuf.WellKnownTypes.Empty subBuilder = new global::Google.Protobuf.WellKnownTypes.Empty();
if (oneofFieldCase_ == OneofFieldOneofCase.EmptyField) {
subBuilder.MergeFrom(EmptyField);
}
input.ReadMessage(subBuilder);
EmptyField = subBuilder;
break;
}
case 42: {
global::Google.Protobuf.WellKnownTypes.FieldMask subBuilder = new global::Google.Protobuf.WellKnownTypes.FieldMask();
if (oneofFieldCase_ == OneofFieldOneofCase.FieldMaskField) {
subBuilder.MergeFrom(FieldMaskField);
}
input.ReadMessage(subBuilder);
FieldMaskField = subBuilder;
break;
}
case 50: {
global::Google.Protobuf.WellKnownTypes.SourceContext subBuilder = new global::Google.Protobuf.WellKnownTypes.SourceContext();
if (oneofFieldCase_ == OneofFieldOneofCase.SourceContextField) {
subBuilder.MergeFrom(SourceContextField);
}
input.ReadMessage(subBuilder);
SourceContextField = subBuilder;
break;
}
case 58: {
global::Google.Protobuf.WellKnownTypes.Struct subBuilder = new global::Google.Protobuf.WellKnownTypes.Struct();
if (oneofFieldCase_ == OneofFieldOneofCase.StructField) {
subBuilder.MergeFrom(StructField);
}
input.ReadMessage(subBuilder);
StructField = subBuilder;
break;
}
case 66: {
global::Google.Protobuf.WellKnownTypes.Timestamp subBuilder = new global::Google.Protobuf.WellKnownTypes.Timestamp();
if (oneofFieldCase_ == OneofFieldOneofCase.TimestampField) {
subBuilder.MergeFrom(TimestampField);
}
input.ReadMessage(subBuilder);
TimestampField = subBuilder;
break;
}
case 74: {
global::Google.Protobuf.WellKnownTypes.Type subBuilder = new global::Google.Protobuf.WellKnownTypes.Type();
if (oneofFieldCase_ == OneofFieldOneofCase.TypeField) {
subBuilder.MergeFrom(TypeField);
}
input.ReadMessage(subBuilder);
TypeField = subBuilder;
break;
}
case 82: {
DoubleField = _oneof_doubleField_codec.Read(input);
break;
}
case 90: {
FloatField = _oneof_floatField_codec.Read(input);
break;
}
case 98: {
Int64Field = _oneof_int64Field_codec.Read(input);
break;
}
case 106: {
Uint64Field = _oneof_uint64Field_codec.Read(input);
break;
}
case 114: {
Int32Field = _oneof_int32Field_codec.Read(input);
break;
}
case 122: {
Uint32Field = _oneof_uint32Field_codec.Read(input);
break;
}
case 130: {
BoolField = _oneof_boolField_codec.Read(input);
break;
}
case 138: {
StringField = _oneof_stringField_codec.Read(input);
break;
}
case 146: {
BytesField = _oneof_bytesField_codec.Read(input);
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -2164,6 +2536,7 @@ namespace Google.Protobuf.TestProtos {
}
}
}
#endif
}
@ -2172,7 +2545,11 @@ namespace Google.Protobuf.TestProtos {
/// need to worry about the value part of the map being the
/// well-known types, as messages can't be map keys.
/// </summary>
public sealed partial class MapWellKnownTypes : pb::IMessage<MapWellKnownTypes>, pb::IBufferMessage {
public sealed partial class MapWellKnownTypes : pb::IMessage<MapWellKnownTypes>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<MapWellKnownTypes> _parser = new pb::MessageParser<MapWellKnownTypes>(() => new MapWellKnownTypes());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -2549,9 +2926,93 @@ namespace Google.Protobuf.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
anyField_.AddEntriesFrom(input, _map_anyField_codec);
break;
}
case 18: {
apiField_.AddEntriesFrom(input, _map_apiField_codec);
break;
}
case 26: {
durationField_.AddEntriesFrom(input, _map_durationField_codec);
break;
}
case 34: {
emptyField_.AddEntriesFrom(input, _map_emptyField_codec);
break;
}
case 42: {
fieldMaskField_.AddEntriesFrom(input, _map_fieldMaskField_codec);
break;
}
case 50: {
sourceContextField_.AddEntriesFrom(input, _map_sourceContextField_codec);
break;
}
case 58: {
structField_.AddEntriesFrom(input, _map_structField_codec);
break;
}
case 66: {
timestampField_.AddEntriesFrom(input, _map_timestampField_codec);
break;
}
case 74: {
typeField_.AddEntriesFrom(input, _map_typeField_codec);
break;
}
case 82: {
doubleField_.AddEntriesFrom(input, _map_doubleField_codec);
break;
}
case 90: {
floatField_.AddEntriesFrom(input, _map_floatField_codec);
break;
}
case 98: {
int64Field_.AddEntriesFrom(input, _map_int64Field_codec);
break;
}
case 106: {
uint64Field_.AddEntriesFrom(input, _map_uint64Field_codec);
break;
}
case 114: {
int32Field_.AddEntriesFrom(input, _map_int32Field_codec);
break;
}
case 122: {
uint32Field_.AddEntriesFrom(input, _map_uint32Field_codec);
break;
}
case 130: {
boolField_.AddEntriesFrom(input, _map_boolField_codec);
break;
}
case 138: {
stringField_.AddEntriesFrom(input, _map_stringField_codec);
break;
}
case 146: {
bytesField_.AddEntriesFrom(input, _map_bytesField_codec);
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -2635,6 +3096,7 @@ namespace Google.Protobuf.TestProtos {
}
}
}
#endif
}

@ -233,5 +233,21 @@ namespace Google.Protobuf
ByteString b2 = ByteString.CopyFrom(200, 1, 2, 3, 4);
Assert.AreNotEqual(b1.GetHashCode(), b2.GetHashCode());
}
[Test]
public void GetContentsAsReadOnlySpan()
{
var byteString = ByteString.CopyFrom(1, 2, 3, 4, 5);
var copied = byteString.Span.ToArray();
CollectionAssert.AreEqual(byteString, copied);
}
[Test]
public void GetContentsAsReadOnlyMemory()
{
var byteString = ByteString.CopyFrom(1, 2, 3, 4, 5);
var copied = byteString.Memory.ToArray();
CollectionAssert.AreEqual(byteString, copied);
}
}
}

@ -595,6 +595,95 @@ namespace Google.Protobuf.Collections
Assert.AreEqual(((SampleEnum)(-5)), values[5]);
}
[Test]
public void TestPackedRepeatedFieldCollectionNonDivisibleLength()
{
uint tag = WireFormat.MakeTag(10, WireFormat.WireType.LengthDelimited);
var codec = FieldCodec.ForFixed32(tag);
var stream = new MemoryStream();
var output = new CodedOutputStream(stream);
output.WriteTag(tag);
output.WriteString("A long string");
output.WriteTag(codec.Tag);
output.WriteRawVarint32((uint)codec.FixedSize - 1); // Length not divisible by FixedSize
output.WriteFixed32(uint.MaxValue);
output.Flush();
stream.Position = 0;
var input = new CodedInputStream(stream);
input.ReadTag();
input.ReadString();
input.ReadTag();
var field = new RepeatedField<uint>();
Assert.Throws<InvalidProtocolBufferException>(() => field.AddEntriesFrom(input, codec));
// Collection was not pre-initialized
Assert.AreEqual(0, field.Count);
}
[Test]
public void TestPackedRepeatedFieldCollectionNotAllocatedWhenLengthExceedsBuffer()
{
uint tag = WireFormat.MakeTag(10, WireFormat.WireType.LengthDelimited);
var codec = FieldCodec.ForFixed32(tag);
var stream = new MemoryStream();
var output = new CodedOutputStream(stream);
output.WriteTag(tag);
output.WriteString("A long string");
output.WriteTag(codec.Tag);
output.WriteRawVarint32((uint)codec.FixedSize);
// Note that there is no content for the packed field.
// The field length exceeds the remaining length of content.
output.Flush();
stream.Position = 0;
var input = new CodedInputStream(stream);
input.ReadTag();
input.ReadString();
input.ReadTag();
var field = new RepeatedField<uint>();
Assert.Throws<InvalidProtocolBufferException>(() => field.AddEntriesFrom(input, codec));
// Collection was not pre-initialized
Assert.AreEqual(0, field.Count);
}
[Test]
public void TestPackedRepeatedFieldCollectionNotAllocatedWhenLengthExceedsRemainingData()
{
uint tag = WireFormat.MakeTag(10, WireFormat.WireType.LengthDelimited);
var codec = FieldCodec.ForFixed32(tag);
var stream = new MemoryStream();
var output = new CodedOutputStream(stream);
output.WriteTag(tag);
output.WriteString("A long string");
output.WriteTag(codec.Tag);
output.WriteRawVarint32((uint)codec.FixedSize);
// Note that there is no content for the packed field.
// The field length exceeds the remaining length of the buffer.
output.Flush();
stream.Position = 0;
var sequence = ReadOnlySequenceFactory.CreateWithContent(stream.ToArray());
ParseContext.Initialize(sequence, out ParseContext ctx);
ctx.ReadTag();
ctx.ReadString();
ctx.ReadTag();
var field = new RepeatedField<uint>();
try
{
field.AddEntriesFrom(ref ctx, codec);
Assert.Fail();
}
catch (InvalidProtocolBufferException)
{
}
// Collection was not pre-initialized
Assert.AreEqual(0, field.Count);
}
// Fairly perfunctory tests for the non-generic IList implementation
[Test]
public void IList_Indexer()

@ -40,6 +40,7 @@ using Google.Protobuf.Reflection;
using static Google.Protobuf.JsonParserTest; // For WrapInQuotes
using System.IO;
using Google.Protobuf.Collections;
using ProtobufUnittest;
namespace Google.Protobuf
{
@ -153,6 +154,48 @@ namespace Google.Protobuf
AssertJson(expectedText, actualText);
}
[Test]
public void WithFormatDefaultValues_DoesNotAffectMessageFields()
{
var message = new TestAllTypes();
var formatter = new JsonFormatter(JsonFormatter.Settings.Default.WithFormatDefaultValues(true));
var json = formatter.Format(message);
Assert.IsFalse(json.Contains("\"singleNestedMessage\""));
Assert.IsFalse(json.Contains("\"singleForeignMessage\""));
Assert.IsFalse(json.Contains("\"singleImportMessage\""));
}
[Test]
public void WithFormatDefaultValues_DoesNotAffectProto3OptionalFields()
{
var message = new TestProto3Optional();
message.OptionalInt32 = 0;
var formatter = new JsonFormatter(JsonFormatter.Settings.Default.WithFormatDefaultValues(true));
var json = formatter.Format(message);
// The non-optional proto3 fields are formatted, as is the optional-but-specified field.
AssertJson("{ 'optionalInt32': 0, 'singularInt32': 0, 'singularInt64': '0' }", json);
}
[Test]
public void WithFormatDefaultValues_DoesNotAffectProto2Fields()
{
var message = new TestProtos.Proto2.ForeignMessage();
message.C = 0;
var formatter = new JsonFormatter(JsonFormatter.Settings.Default.WithFormatDefaultValues(true));
var json = formatter.Format(message);
// The specified field is formatted, but the non-specified field (d) is not.
AssertJson("{ 'c': 0 }", json);
}
[Test]
public void WithFormatDefaultValues_DoesNotAffectOneofFields()
{
var message = new TestOneof();
var formatter = new JsonFormatter(JsonFormatter.Settings.Default.WithFormatDefaultValues(true));
var json = formatter.Format(message);
AssertJson("{ }", json);
}
[Test]
public void RepeatedField()
{
@ -313,14 +356,16 @@ namespace Google.Protobuf
}
[Test]
public void WrapperFormatting_IncludeNull()
public void WrapperFormatting_FormatDefaultValuesDoesNotFormatNull()
{
// The actual JSON here is very large because there are lots of fields. Just test a couple of them.
var message = new TestWellKnownTypes { Int32Field = 10 };
var formatter = new JsonFormatter(JsonFormatter.Settings.Default.WithFormatDefaultValues(true));
var actualJson = formatter.Format(message);
Assert.IsTrue(actualJson.Contains("\"int64Field\": null"));
Assert.IsFalse(actualJson.Contains("\"int32Field\": null"));
// This *used* to include "int64Field": null, but that was a bug.
// WithDefaultValues should not affect message fields, including wrapper types.
Assert.IsFalse(actualJson.Contains("\"int64Field\": null"));
Assert.IsTrue(actualJson.Contains("\"int32Field\": 10"));
}
[Test]
@ -602,6 +647,13 @@ namespace Google.Protobuf
AssertWriteValue(value, "[ 1, 2, 3 ]");
}
[Test]
public void Proto2_DefaultValuesWritten()
{
var value = new ProtobufTestMessages.Proto2.TestAllTypesProto2() { FieldName13 = 0 };
AssertWriteValue(value, "{ 'FieldName13': 0 }");
}
private static void AssertWriteValue(object value, string expectedJson)
{
var writer = new StringWriter();

@ -34,6 +34,7 @@ using Google.Protobuf.Reflection;
using Google.Protobuf.TestProtos;
using Google.Protobuf.WellKnownTypes;
using NUnit.Framework;
using ProtobufTestMessages.Proto2;
using System;
namespace Google.Protobuf
@ -949,6 +950,16 @@ namespace Google.Protobuf
Assert.Throws<InvalidProtocolBufferException>(() => TestAllTypes.Parser.ParseJson(json));
}
[Test]
public void Proto2_DefaultValuesPreserved()
{
string json = "{ \"FieldName13\": 0 }";
var parsed = TestAllTypesProto2.Parser.ParseJson(json);
Assert.False(parsed.HasFieldName10);
Assert.True(parsed.HasFieldName13);
Assert.AreEqual(0, parsed.FieldName13);
}
[Test]
[TestCase("5")]
[TestCase("\"text\"")]

@ -50,9 +50,9 @@ namespace Google.Protobuf
while (currentIndex < data.Length)
{
var segment = new List<byte>();
for (; currentIndex < Math.Min(currentIndex + segmentSize, data.Length); currentIndex++)
while (segment.Count < segmentSize && currentIndex < data.Length)
{
segment.Add(data[currentIndex]);
segment.Add(data[currentIndex++]);
}
segments.Add(segment.ToArray());
segments.Add(new byte[0]);

@ -0,0 +1,119 @@
#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.Diagnostics;
using System;
using System.Reflection;
using System.IO;
namespace Google.Protobuf
{
public class RefStructCompatibilityTest
{
/// <summary>
/// Checks that the generated code can be compiler with an old C# compiler.
/// The reason why this test is needed is that even though dotnet SDK projects allow to set LangVersion,
/// this setting doesn't accurately simulate compilation with an actual old pre-roslyn C# compiler.
/// For instance, the "ref struct" types are only supported by C# 7.2 and higher, but even if
/// LangVersion is set low, the roslyn compiler still understands the concept of ref struct
/// and silently accepts them. Therefore we try to build the generated code with an actual old C# compiler
/// to be able to catch these sort of compatibility problems.
/// </summary>
[Test]
public void GeneratedCodeCompilesWithOldCsharpCompiler()
{
if (Environment.OSVersion.Platform != PlatformID.Win32NT)
{
// This tests needs old C# compiler which is only available on Windows. Skipping it on all other platforms.
return;
}
var currentAssemblyDir = Path.GetDirectoryName(typeof(RefStructCompatibilityTest).GetTypeInfo().Assembly.Location);
var testProtosProjectDir = Path.GetFullPath(Path.Combine(currentAssemblyDir, "..", "..", "..", "..", "Google.Protobuf.Test.TestProtos"));
var testProtosOutputDir = (currentAssemblyDir.Contains("bin/Debug/") || currentAssemblyDir.Contains("bin\\Debug\\")) ? "bin\\Debug\\net45" : "bin\\Release\\net45";
// If "ref struct" types are used in the generated code, compilation with an old compiler will fail with the following error:
// "XYZ is obsolete: 'Types with embedded references are not supported in this version of your compiler.'"
// We build the code with GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE to avoid the use of ref struct in the generated code.
var compatibilityFlag = "-define:GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE";
var sources = "*.cs"; // the generated sources from the TestProtos project
var args = $"-langversion:3 -target:library {compatibilityFlag} -reference:{testProtosOutputDir}\\Google.Protobuf.dll -out:{testProtosOutputDir}\\TestProtos.RefStructCompatibilityTest.OldCompiler.dll {sources}";
RunOldCsharpCompilerAndCheckSuccess(args, testProtosProjectDir);
}
/// <summary>
/// Invoke an old C# compiler in a subprocess and check it finished successful.
/// </summary>
/// <param name="args"></param>
/// <param name="workingDirectory"></param>
private void RunOldCsharpCompilerAndCheckSuccess(string args, string workingDirectory)
{
using (var process = new Process())
{
// Get the path to the old C# 5 compiler from .NET framework. This approach is not 100% reliable, but works on most machines.
// Alternative way of getting the framework path is System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory()
// but it only works with the net45 target.
var oldCsharpCompilerPath = Path.Combine(Environment.GetEnvironmentVariable("WINDIR"), "Microsoft.NET", "Framework", "v4.0.30319", "csc.exe");
process.StartInfo.FileName = oldCsharpCompilerPath;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.RedirectStandardError = true;
process.StartInfo.UseShellExecute = false;
process.StartInfo.Arguments = args;
process.StartInfo.WorkingDirectory = workingDirectory;
process.OutputDataReceived += (sender, e) =>
{
if (e.Data != null)
{
Console.WriteLine(e.Data);
}
};
process.ErrorDataReceived += (sender, e) =>
{
if (e.Data != null)
{
Console.WriteLine(e.Data);
}
};
process.Start();
process.BeginErrorReadLine();
process.BeginOutputReadLine();
process.WaitForExit();
Assert.AreEqual(0, process.ExitCode);
}
}
}
}

@ -34,6 +34,7 @@ using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Security;
using System.Text;
#if !NET35
using System.Threading;
@ -115,13 +116,27 @@ namespace Google.Protobuf
/// Provides read-only access to the data of this <see cref="ByteString"/>.
/// No data is copied so this is the most efficient way of accessing.
/// </summary>
public ReadOnlySpan<byte> Span => new ReadOnlySpan<byte>(bytes);
public ReadOnlySpan<byte> Span
{
[SecuritySafeCritical]
get
{
return new ReadOnlySpan<byte>(bytes);
}
}
/// <summary>
/// Provides read-only access to the data of this <see cref="ByteString"/>.
/// No data is copied so this is the most efficient way of accessing.
/// </summary>
public ReadOnlyMemory<byte> Memory => new ReadOnlyMemory<byte>(bytes);
public ReadOnlyMemory<byte> Memory
{
[SecuritySafeCritical]
get
{
return new ReadOnlyMemory<byte>(bytes);
}
}
#endif
/// <summary>

@ -35,6 +35,7 @@ using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Security;
using System.Threading;
namespace Google.Protobuf.Collections
{
@ -126,9 +127,31 @@ namespace Google.Protobuf.Collections
if (length > 0)
{
int oldLimit = SegmentedBufferHelper.PushLimit(ref ctx.state, length);
while (!SegmentedBufferHelper.IsReachedLimit(ref ctx.state))
// If the content is fixed size then we can calculate the length
// of the repeated field and pre-initialize the underlying collection.
//
// Check that the supplied length doesn't exceed the underlying buffer.
// That prevents a malicious length from initializing a very large collection.
if (codec.FixedSize > 0 && length % codec.FixedSize == 0 && IsDataAvailable(ref ctx, length))
{
EnsureSize(count + (length / codec.FixedSize));
while (!SegmentedBufferHelper.IsReachedLimit(ref ctx.state))
{
// Only FieldCodecs with a fixed size can reach here, and they are all known
// types that don't allow the user to specify a custom reader action.
// reader action will never return null.
array[count++] = reader(ref ctx);
}
}
else
{
Add(reader(ref ctx));
// Content is variable size so add until we reach the limit.
while (!SegmentedBufferHelper.IsReachedLimit(ref ctx.state))
{
Add(reader(ref ctx));
}
}
SegmentedBufferHelper.PopLimit(ref ctx.state, oldLimit);
}
@ -144,6 +167,24 @@ namespace Google.Protobuf.Collections
}
}
private bool IsDataAvailable(ref ParseContext ctx, int size)
{
// Data fits in remaining buffer
if (size <= ctx.state.bufferSize - ctx.state.bufferPos)
{
return true;
}
// Data fits in remaining source data.
// Note that this will never be true when reading from a stream as the total length is unknown.
if (size < ctx.state.segmentedBufferHelper.TotalLength - ctx.state.totalBytesRetired - ctx.state.bufferPos)
{
return true;
}
return false;
}
/// <summary>
/// Calculates the size of this collection based on the given codec.
/// </summary>

@ -5,6 +5,7 @@
<Copyright>Copyright 2015, Google Inc.</Copyright>
<AssemblyTitle>Google Protocol Buffers</AssemblyTitle>
<VersionPrefix>3.12.2</VersionPrefix>
<VersionPrefix>3.12.3</VersionPrefix>
<!-- C# 7.2 is required for Span/BufferWriter/ReadOnlySequence -->
<LangVersion>7.2</LangVersion>
<Authors>Google Inc.</Authors>

@ -221,19 +221,12 @@ namespace Google.Protobuf
foreach (var field in fields.InFieldNumberOrder())
{
var accessor = field.Accessor;
if (field.ContainingOneof != null && field.ContainingOneof.Accessor.GetCaseFieldDescriptor(message) != field)
{
continue;
}
// Omit default values unless we're asked to format them, or they're oneofs (where the default
// value is still formatted regardless, because that's how we preserve the oneof case).
object value = accessor.GetValue(message);
if (field.ContainingOneof == null && !settings.FormatDefaultValues && IsDefaultValue(accessor, value))
var value = accessor.GetValue(message);
if (!ShouldFormatFieldValue(message, field, value))
{
continue;
}
// Okay, all tests complete: let's write the field value...
if (!first)
{
writer.Write(PropertySeparator);
@ -248,6 +241,18 @@ namespace Google.Protobuf
return !first;
}
/// <summary>
/// Determines whether or not a field value should be serialized according to the field,
/// its value in the message, and the settings of this formatter.
/// </summary>
private bool ShouldFormatFieldValue(IMessage message, FieldDescriptor field, object value) =>
field.HasPresence
// Fields that support presence *just* use that
? field.Accessor.HasValue(message)
// Otherwise, format if either we've been asked to format default values, or if it's
// not a default value anyway.
: settings.FormatDefaultValues || !IsDefaultValue(field, value);
// Converted from java/core/src/main/java/com/google/protobuf/Descriptors.java
internal static string ToJsonName(string name)
{
@ -295,19 +300,19 @@ namespace Google.Protobuf
writer.Write("null");
}
private static bool IsDefaultValue(IFieldAccessor accessor, object value)
private static bool IsDefaultValue(FieldDescriptor descriptor, object value)
{
if (accessor.Descriptor.IsMap)
if (descriptor.IsMap)
{
IDictionary dictionary = (IDictionary) value;
return dictionary.Count == 0;
}
if (accessor.Descriptor.IsRepeated)
if (descriptor.IsRepeated)
{
IList list = (IList) value;
return list.Count == 0;
}
switch (accessor.Descriptor.FieldType)
switch (descriptor.FieldType)
{
case FieldType.Bool:
return (bool) value == false;
@ -793,8 +798,10 @@ namespace Google.Protobuf
}
/// <summary>
/// Whether fields whose values are the default for the field type (e.g. 0 for integers)
/// should be formatted (true) or omitted (false).
/// Whether fields which would otherwise not be included in the formatted data
/// should be formatted even when the value is not present, or has the default value.
/// This option only affects fields which don't support "presence" (e.g.
/// singular non-optional proto3 primitive fields).
/// </summary>
public bool FormatDefaultValues { get; }

File diff suppressed because it is too large Load Diff

@ -119,7 +119,11 @@ namespace Google.Protobuf.WellKnownTypes {
/// "value": "1.212s"
/// }
/// </summary>
public sealed partial class Any : pb::IMessage<Any>, pb::IBufferMessage {
public sealed partial class Any : pb::IMessage<Any>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<Any> _parser = new pb::MessageParser<Any>(() => new Any());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -288,9 +292,29 @@ namespace Google.Protobuf.WellKnownTypes {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
TypeUrl = input.ReadString();
break;
}
case 18: {
Value = input.ReadBytes();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -310,6 +334,7 @@ namespace Google.Protobuf.WellKnownTypes {
}
}
}
#endif
}

@ -64,7 +64,11 @@ namespace Google.Protobuf.WellKnownTypes {
/// this message itself. See https://cloud.google.com/apis/design/glossary for
/// detailed terminology.
/// </summary>
public sealed partial class Api : pb::IMessage<Api>, pb::IBufferMessage {
public sealed partial class Api : pb::IMessage<Api>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<Api> _parser = new pb::MessageParser<Api>(() => new Api());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -341,9 +345,52 @@ namespace Google.Protobuf.WellKnownTypes {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
Name = input.ReadString();
break;
}
case 18: {
methods_.AddEntriesFrom(input, _repeated_methods_codec);
break;
}
case 26: {
options_.AddEntriesFrom(input, _repeated_options_codec);
break;
}
case 34: {
Version = input.ReadString();
break;
}
case 42: {
if (sourceContext_ == null) {
SourceContext = new global::Google.Protobuf.WellKnownTypes.SourceContext();
}
input.ReadMessage(SourceContext);
break;
}
case 50: {
mixins_.AddEntriesFrom(input, _repeated_mixins_codec);
break;
}
case 56: {
Syntax = (global::Google.Protobuf.WellKnownTypes.Syntax) input.ReadEnum();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -386,13 +433,18 @@ namespace Google.Protobuf.WellKnownTypes {
}
}
}
#endif
}
/// <summary>
/// Method represents a method of an API interface.
/// </summary>
public sealed partial class Method : pb::IMessage<Method>, pb::IBufferMessage {
public sealed partial class Method : pb::IMessage<Method>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<Method> _parser = new pb::MessageParser<Method>(() => new Method());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -662,9 +714,49 @@ namespace Google.Protobuf.WellKnownTypes {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
Name = input.ReadString();
break;
}
case 18: {
RequestTypeUrl = input.ReadString();
break;
}
case 24: {
RequestStreaming = input.ReadBool();
break;
}
case 34: {
ResponseTypeUrl = input.ReadString();
break;
}
case 40: {
ResponseStreaming = input.ReadBool();
break;
}
case 50: {
options_.AddEntriesFrom(input, _repeated_options_codec);
break;
}
case 56: {
Syntax = (global::Google.Protobuf.WellKnownTypes.Syntax) input.ReadEnum();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -704,6 +796,7 @@ namespace Google.Protobuf.WellKnownTypes {
}
}
}
#endif
}
@ -787,7 +880,11 @@ namespace Google.Protobuf.WellKnownTypes {
/// ...
/// }
/// </summary>
public sealed partial class Mixin : pb::IMessage<Mixin>, pb::IBufferMessage {
public sealed partial class Mixin : pb::IMessage<Mixin>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<Mixin> _parser = new pb::MessageParser<Mixin>(() => new Mixin());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -931,9 +1028,29 @@ namespace Google.Protobuf.WellKnownTypes {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
Name = input.ReadString();
break;
}
case 18: {
Root = input.ReadString();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -953,6 +1070,7 @@ namespace Google.Protobuf.WellKnownTypes {
}
}
}
#endif
}

@ -100,7 +100,11 @@ namespace Google.Protobuf.WellKnownTypes {
/// be expressed in JSON format as "3.000000001s", and 3 seconds and 1
/// microsecond should be expressed in JSON format as "3.000001s".
/// </summary>
public sealed partial class Duration : pb::IMessage<Duration>, pb::IBufferMessage {
public sealed partial class Duration : pb::IMessage<Duration>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<Duration> _parser = new pb::MessageParser<Duration>(() => new Duration());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -250,9 +254,29 @@ namespace Google.Protobuf.WellKnownTypes {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
Seconds = input.ReadInt64();
break;
}
case 16: {
Nanos = input.ReadInt32();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -272,6 +296,7 @@ namespace Google.Protobuf.WellKnownTypes {
}
}
}
#endif
}

@ -50,7 +50,11 @@ namespace Google.Protobuf.WellKnownTypes {
///
/// The JSON representation for `Empty` is empty JSON object `{}`.
/// </summary>
public sealed partial class Empty : pb::IMessage<Empty>, pb::IBufferMessage {
public sealed partial class Empty : pb::IMessage<Empty>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<Empty> _parser = new pb::MessageParser<Empty>(() => new Empty());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -139,9 +143,21 @@ namespace Google.Protobuf.WellKnownTypes {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -153,6 +169,7 @@ namespace Google.Protobuf.WellKnownTypes {
}
}
}
#endif
}

@ -240,7 +240,11 @@ namespace Google.Protobuf.WellKnownTypes {
/// request should verify the included field paths, and return an
/// `INVALID_ARGUMENT` error if any path is unmappable.
/// </summary>
public sealed partial class FieldMask : pb::IMessage<FieldMask>, pb::IBufferMessage {
public sealed partial class FieldMask : pb::IMessage<FieldMask>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<FieldMask> _parser = new pb::MessageParser<FieldMask>(() => new FieldMask());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -348,9 +352,25 @@ namespace Google.Protobuf.WellKnownTypes {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
paths_.AddEntriesFrom(input, _repeated_paths_codec);
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -366,6 +386,7 @@ namespace Google.Protobuf.WellKnownTypes {
}
}
}
#endif
}

@ -44,7 +44,11 @@ namespace Google.Protobuf.WellKnownTypes {
/// `SourceContext` represents information about the source of a
/// protobuf element, like the file in which it is defined.
/// </summary>
public sealed partial class SourceContext : pb::IMessage<SourceContext>, pb::IBufferMessage {
public sealed partial class SourceContext : pb::IMessage<SourceContext>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<SourceContext> _parser = new pb::MessageParser<SourceContext>(() => new SourceContext());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -161,9 +165,25 @@ namespace Google.Protobuf.WellKnownTypes {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
FileName = input.ReadString();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -179,6 +199,7 @@ namespace Google.Protobuf.WellKnownTypes {
}
}
}
#endif
}

@ -77,7 +77,11 @@ namespace Google.Protobuf.WellKnownTypes {
///
/// The JSON representation for `Struct` is JSON object.
/// </summary>
public sealed partial class Struct : pb::IMessage<Struct>, pb::IBufferMessage {
public sealed partial class Struct : pb::IMessage<Struct>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<Struct> _parser = new pb::MessageParser<Struct>(() => new Struct());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -185,9 +189,25 @@ namespace Google.Protobuf.WellKnownTypes {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
fields_.AddEntriesFrom(input, _map_fields_codec);
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -203,6 +223,7 @@ namespace Google.Protobuf.WellKnownTypes {
}
}
}
#endif
}
@ -214,7 +235,11 @@ namespace Google.Protobuf.WellKnownTypes {
///
/// The JSON representation for `Value` is JSON value.
/// </summary>
public sealed partial class Value : pb::IMessage<Value>, pb::IBufferMessage {
public sealed partial class Value : pb::IMessage<Value>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<Value> _parser = new pb::MessageParser<Value>(() => new Value());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -514,9 +539,56 @@ namespace Google.Protobuf.WellKnownTypes {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
kind_ = input.ReadEnum();
kindCase_ = KindOneofCase.NullValue;
break;
}
case 17: {
NumberValue = input.ReadDouble();
break;
}
case 26: {
StringValue = input.ReadString();
break;
}
case 32: {
BoolValue = input.ReadBool();
break;
}
case 42: {
global::Google.Protobuf.WellKnownTypes.Struct subBuilder = new global::Google.Protobuf.WellKnownTypes.Struct();
if (kindCase_ == KindOneofCase.StructValue) {
subBuilder.MergeFrom(StructValue);
}
input.ReadMessage(subBuilder);
StructValue = subBuilder;
break;
}
case 50: {
global::Google.Protobuf.WellKnownTypes.ListValue subBuilder = new global::Google.Protobuf.WellKnownTypes.ListValue();
if (kindCase_ == KindOneofCase.ListValue) {
subBuilder.MergeFrom(ListValue);
}
input.ReadMessage(subBuilder);
ListValue = subBuilder;
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -563,6 +635,7 @@ namespace Google.Protobuf.WellKnownTypes {
}
}
}
#endif
}
@ -571,7 +644,11 @@ namespace Google.Protobuf.WellKnownTypes {
///
/// The JSON representation for `ListValue` is JSON array.
/// </summary>
public sealed partial class ListValue : pb::IMessage<ListValue>, pb::IBufferMessage {
public sealed partial class ListValue : pb::IMessage<ListValue>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<ListValue> _parser = new pb::MessageParser<ListValue>(() => new ListValue());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -679,9 +756,25 @@ namespace Google.Protobuf.WellKnownTypes {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
values_.AddEntriesFrom(input, _repeated_values_codec);
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -697,6 +790,7 @@ namespace Google.Protobuf.WellKnownTypes {
}
}
}
#endif
}

@ -123,7 +123,11 @@ namespace Google.Protobuf.WellKnownTypes {
/// http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D
/// ) to obtain a formatter capable of generating timestamps in this format.
/// </summary>
public sealed partial class Timestamp : pb::IMessage<Timestamp>, pb::IBufferMessage {
public sealed partial class Timestamp : pb::IMessage<Timestamp>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<Timestamp> _parser = new pb::MessageParser<Timestamp>(() => new Timestamp());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -271,9 +275,29 @@ namespace Google.Protobuf.WellKnownTypes {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
Seconds = input.ReadInt64();
break;
}
case 16: {
Nanos = input.ReadInt32();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -293,6 +317,7 @@ namespace Google.Protobuf.WellKnownTypes {
}
}
}
#endif
}

@ -94,7 +94,11 @@ namespace Google.Protobuf.WellKnownTypes {
/// <summary>
/// A protocol buffer message type.
/// </summary>
public sealed partial class Type : pb::IMessage<Type>, pb::IBufferMessage {
public sealed partial class Type : pb::IMessage<Type>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<Type> _parser = new pb::MessageParser<Type>(() => new Type());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -324,9 +328,48 @@ namespace Google.Protobuf.WellKnownTypes {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
Name = input.ReadString();
break;
}
case 18: {
fields_.AddEntriesFrom(input, _repeated_fields_codec);
break;
}
case 26: {
oneofs_.AddEntriesFrom(input, _repeated_oneofs_codec);
break;
}
case 34: {
options_.AddEntriesFrom(input, _repeated_options_codec);
break;
}
case 42: {
if (sourceContext_ == null) {
SourceContext = new global::Google.Protobuf.WellKnownTypes.SourceContext();
}
input.ReadMessage(SourceContext);
break;
}
case 48: {
Syntax = (global::Google.Protobuf.WellKnownTypes.Syntax) input.ReadEnum();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -365,13 +408,18 @@ namespace Google.Protobuf.WellKnownTypes {
}
}
}
#endif
}
/// <summary>
/// A single field of a message type.
/// </summary>
public sealed partial class Field : pb::IMessage<Field>, pb::IBufferMessage {
public sealed partial class Field : pb::IMessage<Field>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<Field> _parser = new pb::MessageParser<Field>(() => new Field());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -724,9 +772,61 @@ namespace Google.Protobuf.WellKnownTypes {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
Kind = (global::Google.Protobuf.WellKnownTypes.Field.Types.Kind) input.ReadEnum();
break;
}
case 16: {
Cardinality = (global::Google.Protobuf.WellKnownTypes.Field.Types.Cardinality) input.ReadEnum();
break;
}
case 24: {
Number = input.ReadInt32();
break;
}
case 34: {
Name = input.ReadString();
break;
}
case 50: {
TypeUrl = input.ReadString();
break;
}
case 56: {
OneofIndex = input.ReadInt32();
break;
}
case 64: {
Packed = input.ReadBool();
break;
}
case 74: {
options_.AddEntriesFrom(input, _repeated_options_codec);
break;
}
case 82: {
JsonName = input.ReadString();
break;
}
case 90: {
DefaultValue = input.ReadString();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -778,6 +878,7 @@ namespace Google.Protobuf.WellKnownTypes {
}
}
}
#endif
#region Nested types
/// <summary>Container for nested types declared in the Field message type.</summary>
@ -895,7 +996,11 @@ namespace Google.Protobuf.WellKnownTypes {
/// <summary>
/// Enum type definition.
/// </summary>
public sealed partial class Enum : pb::IMessage<Enum>, pb::IBufferMessage {
public sealed partial class Enum : pb::IMessage<Enum>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<Enum> _parser = new pb::MessageParser<Enum>(() => new Enum());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -1106,9 +1211,44 @@ namespace Google.Protobuf.WellKnownTypes {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
Name = input.ReadString();
break;
}
case 18: {
enumvalue_.AddEntriesFrom(input, _repeated_enumvalue_codec);
break;
}
case 26: {
options_.AddEntriesFrom(input, _repeated_options_codec);
break;
}
case 34: {
if (sourceContext_ == null) {
SourceContext = new global::Google.Protobuf.WellKnownTypes.SourceContext();
}
input.ReadMessage(SourceContext);
break;
}
case 40: {
Syntax = (global::Google.Protobuf.WellKnownTypes.Syntax) input.ReadEnum();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -1143,13 +1283,18 @@ namespace Google.Protobuf.WellKnownTypes {
}
}
}
#endif
}
/// <summary>
/// Enum value definition.
/// </summary>
public sealed partial class EnumValue : pb::IMessage<EnumValue>, pb::IBufferMessage {
public sealed partial class EnumValue : pb::IMessage<EnumValue>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<EnumValue> _parser = new pb::MessageParser<EnumValue>(() => new EnumValue());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -1311,9 +1456,33 @@ namespace Google.Protobuf.WellKnownTypes {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
Name = input.ReadString();
break;
}
case 16: {
Number = input.ReadInt32();
break;
}
case 26: {
options_.AddEntriesFrom(input, _repeated_options_codec);
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -1337,6 +1506,7 @@ namespace Google.Protobuf.WellKnownTypes {
}
}
}
#endif
}
@ -1344,7 +1514,11 @@ namespace Google.Protobuf.WellKnownTypes {
/// A protocol buffer option, which can be attached to a message, field,
/// enumeration, etc.
/// </summary>
public sealed partial class Option : pb::IMessage<Option>, pb::IBufferMessage {
public sealed partial class Option : pb::IMessage<Option>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<Option> _parser = new pb::MessageParser<Option>(() => new Option());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -1496,9 +1670,32 @@ namespace Google.Protobuf.WellKnownTypes {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
Name = input.ReadString();
break;
}
case 18: {
if (value_ == null) {
Value = new global::Google.Protobuf.WellKnownTypes.Any();
}
input.ReadMessage(Value);
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -1521,6 +1718,7 @@ namespace Google.Protobuf.WellKnownTypes {
}
}
}
#endif
}

@ -57,7 +57,11 @@ namespace Google.Protobuf.WellKnownTypes {
///
/// The JSON representation for `DoubleValue` is JSON number.
/// </summary>
public sealed partial class DoubleValue : pb::IMessage<DoubleValue>, pb::IBufferMessage {
public sealed partial class DoubleValue : pb::IMessage<DoubleValue>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<DoubleValue> _parser = new pb::MessageParser<DoubleValue>(() => new DoubleValue());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -173,9 +177,25 @@ namespace Google.Protobuf.WellKnownTypes {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 9: {
Value = input.ReadDouble();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -191,6 +211,7 @@ namespace Google.Protobuf.WellKnownTypes {
}
}
}
#endif
}
@ -199,7 +220,11 @@ namespace Google.Protobuf.WellKnownTypes {
///
/// The JSON representation for `FloatValue` is JSON number.
/// </summary>
public sealed partial class FloatValue : pb::IMessage<FloatValue>, pb::IBufferMessage {
public sealed partial class FloatValue : pb::IMessage<FloatValue>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<FloatValue> _parser = new pb::MessageParser<FloatValue>(() => new FloatValue());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -315,9 +340,25 @@ namespace Google.Protobuf.WellKnownTypes {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 13: {
Value = input.ReadFloat();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -333,6 +374,7 @@ namespace Google.Protobuf.WellKnownTypes {
}
}
}
#endif
}
@ -341,7 +383,11 @@ namespace Google.Protobuf.WellKnownTypes {
///
/// The JSON representation for `Int64Value` is JSON string.
/// </summary>
public sealed partial class Int64Value : pb::IMessage<Int64Value>, pb::IBufferMessage {
public sealed partial class Int64Value : pb::IMessage<Int64Value>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<Int64Value> _parser = new pb::MessageParser<Int64Value>(() => new Int64Value());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -457,9 +503,25 @@ namespace Google.Protobuf.WellKnownTypes {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
Value = input.ReadInt64();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -475,6 +537,7 @@ namespace Google.Protobuf.WellKnownTypes {
}
}
}
#endif
}
@ -483,7 +546,11 @@ namespace Google.Protobuf.WellKnownTypes {
///
/// The JSON representation for `UInt64Value` is JSON string.
/// </summary>
public sealed partial class UInt64Value : pb::IMessage<UInt64Value>, pb::IBufferMessage {
public sealed partial class UInt64Value : pb::IMessage<UInt64Value>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<UInt64Value> _parser = new pb::MessageParser<UInt64Value>(() => new UInt64Value());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -599,9 +666,25 @@ namespace Google.Protobuf.WellKnownTypes {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
Value = input.ReadUInt64();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -617,6 +700,7 @@ namespace Google.Protobuf.WellKnownTypes {
}
}
}
#endif
}
@ -625,7 +709,11 @@ namespace Google.Protobuf.WellKnownTypes {
///
/// The JSON representation for `Int32Value` is JSON number.
/// </summary>
public sealed partial class Int32Value : pb::IMessage<Int32Value>, pb::IBufferMessage {
public sealed partial class Int32Value : pb::IMessage<Int32Value>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<Int32Value> _parser = new pb::MessageParser<Int32Value>(() => new Int32Value());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -741,9 +829,25 @@ namespace Google.Protobuf.WellKnownTypes {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
Value = input.ReadInt32();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -759,6 +863,7 @@ namespace Google.Protobuf.WellKnownTypes {
}
}
}
#endif
}
@ -767,7 +872,11 @@ namespace Google.Protobuf.WellKnownTypes {
///
/// The JSON representation for `UInt32Value` is JSON number.
/// </summary>
public sealed partial class UInt32Value : pb::IMessage<UInt32Value>, pb::IBufferMessage {
public sealed partial class UInt32Value : pb::IMessage<UInt32Value>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<UInt32Value> _parser = new pb::MessageParser<UInt32Value>(() => new UInt32Value());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -883,9 +992,25 @@ namespace Google.Protobuf.WellKnownTypes {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
Value = input.ReadUInt32();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -901,6 +1026,7 @@ namespace Google.Protobuf.WellKnownTypes {
}
}
}
#endif
}
@ -909,7 +1035,11 @@ namespace Google.Protobuf.WellKnownTypes {
///
/// The JSON representation for `BoolValue` is JSON `true` and `false`.
/// </summary>
public sealed partial class BoolValue : pb::IMessage<BoolValue>, pb::IBufferMessage {
public sealed partial class BoolValue : pb::IMessage<BoolValue>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<BoolValue> _parser = new pb::MessageParser<BoolValue>(() => new BoolValue());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -1025,9 +1155,25 @@ namespace Google.Protobuf.WellKnownTypes {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
Value = input.ReadBool();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -1043,6 +1189,7 @@ namespace Google.Protobuf.WellKnownTypes {
}
}
}
#endif
}
@ -1051,7 +1198,11 @@ namespace Google.Protobuf.WellKnownTypes {
///
/// The JSON representation for `StringValue` is JSON string.
/// </summary>
public sealed partial class StringValue : pb::IMessage<StringValue>, pb::IBufferMessage {
public sealed partial class StringValue : pb::IMessage<StringValue>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<StringValue> _parser = new pb::MessageParser<StringValue>(() => new StringValue());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -1167,9 +1318,25 @@ namespace Google.Protobuf.WellKnownTypes {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
Value = input.ReadString();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -1185,6 +1352,7 @@ namespace Google.Protobuf.WellKnownTypes {
}
}
}
#endif
}
@ -1193,7 +1361,11 @@ namespace Google.Protobuf.WellKnownTypes {
///
/// The JSON representation for `BytesValue` is JSON string.
/// </summary>
public sealed partial class BytesValue : pb::IMessage<BytesValue>, pb::IBufferMessage {
public sealed partial class BytesValue : pb::IMessage<BytesValue>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<BytesValue> _parser = new pb::MessageParser<BytesValue>(() => new BytesValue());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -1309,9 +1481,25 @@ namespace Google.Protobuf.WellKnownTypes {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
Value = input.ReadBytes();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@ -1327,6 +1515,7 @@ namespace Google.Protobuf.WellKnownTypes {
}
}
}
#endif
}

@ -18,6 +18,7 @@ These are projects we know about implementing Protocol Buffers for other program
* C: https://github.com/squidfunk/protobluff
* C: https://github.com/eerimoq/pbtools
* C++: https://github.com/google/protobuf (Google-official implementation)
* C++: https://EmbeddedProto.com
* C/C++: http://spbc.sf.net/
* C#: http://code.google.com/p/protobuf-csharp-port
* C#: https://silentorbit.com/protobuf/

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

@ -4,7 +4,7 @@
<parent>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-parent</artifactId>
<version>3.12.2</version>
<version>3.12.3</version>
</parent>
<artifactId>protobuf-java</artifactId>

@ -4,7 +4,7 @@
<parent>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-parent</artifactId>
<version>3.12.2</version>
<version>3.12.3</version>
</parent>
<artifactId>protobuf-javalite</artifactId>

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

@ -4,7 +4,7 @@
<parent>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-parent</artifactId>
<version>3.12.2</version>
<version>3.12.3</version>
</parent>
<artifactId>protobuf-java-util</artifactId>

@ -30,6 +30,7 @@
package com.google.protobuf.util;
import com.google.common.base.Splitter;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import com.google.protobuf.Descriptors.Descriptor;
import com.google.protobuf.Descriptors.FieldDescriptor;
@ -66,7 +67,7 @@ final class FieldMaskTree {
private static final String FIELD_PATH_SEPARATOR_REGEX = "\\.";
private static final class Node {
final SortedMap<String, Node> children = new TreeMap<String, Node>();
final SortedMap<String, Node> children = new TreeMap<>();
}
private final Node root = new Node();
@ -97,6 +98,7 @@ final class FieldMaskTree {
* to add is a sub-path of an existing leaf node, nothing will be changed in the tree.
*/
@CanIgnoreReturnValue
@SuppressWarnings("StringSplitter")
FieldMaskTree addFieldPath(String path) {
String[] parts = path.split(FIELD_PATH_SEPARATOR_REGEX);
if (parts.length == 0) {
@ -134,6 +136,45 @@ final class FieldMaskTree {
return this;
}
/**
* Remove {@code path} from the tree.
*
* <p>When removing a field path from the tree, all sub-paths will be removed. That is, after
* removing "foo.bar" from the tree, "foo.bar.baz" will be removed. Likewise, if the field path to
* remove is a non-exist sub-path, nothing will be changed.
*/
@CanIgnoreReturnValue
FieldMaskTree removeFieldPath(String path) {
List<String> parts = Splitter.onPattern(FIELD_PATH_SEPARATOR_REGEX).splitToList(path);
if (parts.isEmpty()) {
return this;
}
Node node = root;
for (int i = 0; i < parts.size(); i++) {
String key = parts.get(i);
if (!node.children.containsKey(key)) {
// Path does not exist.
return this;
}
if (i == parts.size() - 1) {
// Remove path.
node.children.remove(key);
return this;
}
node = node.children.get(key);
}
return this;
}
/** Removes all field paths in {@code mask} from this tree. */
@CanIgnoreReturnValue
FieldMaskTree removeFromFieldMask(FieldMask mask) {
for (String path : mask.getPathsList()) {
removeFieldPath(path);
}
return this;
}
/**
* Converts this tree to a FieldMask.
*/
@ -141,7 +182,7 @@ final class FieldMaskTree {
if (root.children.isEmpty()) {
return FieldMask.getDefaultInstance();
}
List<String> paths = new ArrayList<String>();
List<String> paths = new ArrayList<>();
getFieldPaths(root, "", paths);
return FieldMask.newBuilder().addAllPaths(paths).build();
}
@ -186,7 +227,7 @@ final class FieldMaskTree {
}
// We found a matching node for the path. All leaf children of this matching
// node is in the intersection.
List<String> paths = new ArrayList<String>();
List<String> paths = new ArrayList<>();
getFieldPaths(node, path, paths);
for (String value : paths) {
output.addFieldPath(value);

@ -276,6 +276,16 @@ public final class FieldMaskUtil {
return maskTree.toFieldMask();
}
/** Subtracts {@code secondMask} and {@code otherMasks} from {@code firstMask}. */
public static FieldMask subtract(
FieldMask firstMask, FieldMask secondMask, FieldMask... otherMasks) {
FieldMaskTree maskTree = new FieldMaskTree(firstMask).removeFromFieldMask(secondMask);
for (FieldMask mask : otherMasks) {
maskTree.removeFromFieldMask(mask);
}
return maskTree.toFieldMask();
}
/**
* Calculates the intersection of two FieldMasks.
*/

@ -30,6 +30,8 @@
package com.google.protobuf.util;
import static com.google.common.truth.Truth.assertThat;
import com.google.protobuf.DynamicMessage;
import com.google.protobuf.Message;
import com.google.protobuf.UninitializedMessageException;
@ -43,9 +45,9 @@ import junit.framework.TestCase;
public class FieldMaskTreeTest extends TestCase {
public void testAddFieldPath() throws Exception {
FieldMaskTree tree = new FieldMaskTree();
assertEquals("", tree.toString());
assertThat(tree.toString()).isEmpty();
tree.addFieldPath("");
assertEquals("", tree.toString());
assertThat(tree.toString()).isEmpty();
// New branch.
tree.addFieldPath("foo");
assertEquals("foo", tree.toString());
@ -73,15 +75,45 @@ public class FieldMaskTreeTest extends TestCase {
assertEquals("bar,foo", tree.toString());
}
public void testRemoveFieldPath() throws Exception {
String initialTreeString = "bar.baz,bar.quz.bar,foo";
FieldMaskTree tree = new FieldMaskTree(FieldMaskUtil.fromString(initialTreeString));
// Empty path.
tree.removeFieldPath("");
assertEquals(initialTreeString, tree.toString());
// Non-exist sub-path of an existing leaf.
tree.removeFieldPath("foo.bar");
assertEquals(initialTreeString, tree.toString());
// Non-exist path.
tree.removeFieldPath("bar.foo");
assertEquals(initialTreeString, tree.toString());
// Match an existing leaf node.
tree.removeFieldPath("foo");
assertEquals("bar.baz,bar.quz.bar", tree.toString());
// Match sub-path of an existing leaf node.
tree.removeFieldPath("bar.quz.bar");
assertEquals("bar.baz,bar.quz", tree.toString());
// Match a non-leaf node.
tree.removeFieldPath("bar");
assertThat(tree.toString()).isEmpty();
}
public void testRemoveFromFieldMask() throws Exception {
FieldMaskTree tree = new FieldMaskTree(FieldMaskUtil.fromString("foo,bar.baz,bar.quz"));
assertEquals("bar.baz,bar.quz,foo", tree.toString());
tree.removeFromFieldMask(FieldMaskUtil.fromString("foo.bar,bar"));
assertEquals("foo", tree.toString());
}
public void testIntersectFieldPath() throws Exception {
FieldMaskTree tree = new FieldMaskTree(FieldMaskUtil.fromString("foo,bar.baz,bar.quz"));
FieldMaskTree result = new FieldMaskTree();
// Empty path.
tree.intersectFieldPath("", result);
assertEquals("", result.toString());
assertThat(result.toString()).isEmpty();
// Non-exist path.
tree.intersectFieldPath("quz", result);
assertEquals("", result.toString());
assertThat(result.toString()).isEmpty();
// Sub-path of an existing leaf.
tree.intersectFieldPath("foo.bar", result);
assertEquals("foo.bar", result.toString());

@ -224,6 +224,24 @@ public class FieldMaskUtilTest extends TestCase {
assertEquals("bar,foo", FieldMaskUtil.toString(result));
}
public void testSubstract() throws Exception {
// Only test a simple case here and expect
// {@link FieldMaskTreeTest#testRemoveFieldPath} to cover all scenarios.
FieldMask mask1 = FieldMaskUtil.fromString("foo,bar.baz,bar.quz");
FieldMask mask2 = FieldMaskUtil.fromString("foo.bar,bar");
FieldMask result = FieldMaskUtil.subtract(mask1, mask2);
assertEquals("foo", FieldMaskUtil.toString(result));
}
public void testSubstract_usingVarArgs() throws Exception {
FieldMask mask1 = FieldMaskUtil.fromString("foo,bar.baz,bar.quz.bar");
FieldMask mask2 = FieldMaskUtil.fromString("foo.bar,bar.baz.quz");
FieldMask mask3 = FieldMaskUtil.fromString("bar.quz");
FieldMask mask4 = FieldMaskUtil.fromString("foo,bar.baz");
FieldMask result = FieldMaskUtil.subtract(mask1, mask2, mask3, mask4);
assertEquals("bar", FieldMaskUtil.toString(result));
}
public void testIntersection() throws Exception {
// Only test a simple case here and expect
// {@link FieldMaskTreeTest#testIntersectFieldPath} to cover all scenarios.

@ -6,6 +6,7 @@
cd $(dirname $0)/../../..
# Prepare worker environment to run tests
KOKORO_INSTALL_COCOAPODS=yes
source kokoro/macos/prepare_build_macos_rc
./tests.sh objectivec_cocoapods_integration

@ -2,6 +2,8 @@
#
# This script sets up a Kokoro MacOS worker for running Protobuf tests
set -eux
##
# Select Xcode version
@ -18,24 +20,61 @@ export CC=gcc
export CXX=g++
##
# Install Brew and core softwares
# Brew: update, then upgrade the installed tools to current version and install
# some needed ones not in the Kokoro base image. This ensure current versions
# of CMake, autotools, etc.
# But first...
#
# The transitive deps of the installed tools need protobuf, but Kokoro manually
# installed it outside of brew so it needs to be removed so brew can install the
# tools (and a newer version of protobuf). g/kokoro-users/7FRvQMUdN40 about why
# it is a manual install vs. a brew install in the first place.
sudo rm -rf \
/usr/local/include/google/protobuf \
/usr/local/bin/protoc
# Likewise, updating python can have issues because of some existing binaries.
sudo rm -rf \
/usr/local/bin/2to3* \
/usr/local/bin/idle3* \
/usr/local/bin/pydoc3* \
/usr/local/bin/python3* \
/usr/local/bin/pyvenv*
brew update
brew upgrade
##
# Install Ruby
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
source $HOME/.rvm/scripts/rvm
brew uninstall node icu4c cmake wget
brew prune
brew install gflags gpg gpg2 node openssl pcre ruby cmake wget
sudo chown -R $(whoami) /usr/local
brew postinstall node
if [[ "${KOKORO_INSTALL_RUBY:-}" == "yes" ]] ; then
brew install ruby
fi
##
# Install Cocoapods
if [[ "${KOKORO_INSTALL_COCOAPODS:-}" == "yes" ]] ; then
# The existing cocoapods was installed via gem, but that doesn't work well
# with the overlap in deps with things managed by brew (errors around ruby
# versions, etc.); so remove it and install in via brew instead.
gem uninstall -a "$(gem list | grep cocoapods | cut -d ' ' -f 1)"
brew install cocoapods
fi
##
# Install Tox
sudo pip install tox==2.4.1
if [[ "${KOKORO_INSTALL_TOX:-}" == "yes" ]] ; then
sudo pip install tox==2.4.1
fi
##
# Install RVM
gpg2 --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
command curl -sSL https://rvm.io/mpapis.asc | gpg2 --import -
curl -sSL https://get.rvm.io | bash -s stable --ruby
if [[ "${KOKORO_INSTALL_RVM:-}" == "yes" ]] ; then
curl -sSL https://rvm.io/mpapis.asc | gpg --import -
curl -sSL https://rvm.io/pkuczynski.asc | gpg --import -
curl -sSL https://get.rvm.io | bash -s stable --ruby
fi

@ -6,6 +6,7 @@
cd $(dirname $0)/../../..
# Prepare worker environment to run tests
KOKORO_INSTALL_TOX=yes
source kokoro/macos/prepare_build_macos_rc
./tests.sh python

@ -6,6 +6,7 @@
cd $(dirname $0)/../../..
# Prepare worker environment to run tests
KOKORO_INSTALL_TOX=yes
source kokoro/macos/prepare_build_macos_rc
g++ --version

@ -6,6 +6,8 @@
cd $(dirname $0)/../../..
# Prepare worker environment to run tests
KOKORO_INSTALL_RUBY=yes
KOKORO_INSTALL_RVM=yes
source kokoro/macos/prepare_build_macos_rc
./tests.sh ruby23

@ -6,6 +6,8 @@
cd $(dirname $0)/../../..
# Prepare worker environment to run tests
KOKORO_INSTALL_RUBY=yes
KOKORO_INSTALL_RVM=yes
source kokoro/macos/prepare_build_macos_rc
./tests.sh ruby24

@ -6,6 +6,8 @@
cd $(dirname $0)/../../..
# Prepare worker environment to run tests
KOKORO_INSTALL_RUBY=yes
KOKORO_INSTALL_RVM=yes
source kokoro/macos/prepare_build_macos_rc
./tests.sh ruby25

@ -6,6 +6,8 @@
cd $(dirname $0)/../../..
# Prepare worker environment to run tests
KOKORO_INSTALL_RUBY=yes
KOKORO_INSTALL_RVM=yes
source kokoro/macos/prepare_build_macos_rc
./tests.sh ruby26

@ -6,6 +6,8 @@
cd $(dirname $0)/../../..
# Prepare worker environment to run tests
KOKORO_INSTALL_RUBY=yes
KOKORO_INSTALL_RVM=yes
source kokoro/macos/prepare_build_macos_rc
./tests.sh ruby27

@ -131,14 +131,29 @@ typedef NS_OPTIONS(uint8_t, GPBExtensionOptions) {
typedef struct GPBExtensionDescription {
GPBGenericValue defaultValue;
const char *singletonName;
// Before 3.12, `extendedClass` was just a `const char *`. Thanks to nested
// initialization (https://en.cppreference.com/w/c/language/struct_initialization#Nested_initialization)
// old generated code with `.extendedClass = GPBStringifySymbol(Something)`
// still works; and the current generator can use `extendedClass.clazz`, to
// pass a Class reference.
union {
const char *name;
Class clazz;
} extendedClass;
// Before 3.12, this was `const char *messageOrGroupClassName`. In the
// initial 3.12 release, we moved the `union messageOrGroupClass`, and failed
// to realize that would break existing source code for extensions. So to
// keep existing source code working, we added an unnamed union (C11) to
// provide both the old field name and the new union. This keeps both older
// and newer code working.
// Background: https://github.com/protocolbuffers/protobuf/issues/7555
union {
const char *name;
Class clazz;
} messageOrGroupClass;
const char *messageOrGroupClassName;
union {
const char *name;
Class clazz;
} messageOrGroupClass;
};
GPBEnumDescriptorFunc enumDescriptorFunc;
int32_t fieldNumber;
GPBDataType dataType;

@ -172,6 +172,12 @@ supported keys are:
lot of proto files included in it; and having multiple lines makes things
easier to read.
* `runtime_import_prefix`: The `value` used for this key to be used as a
prefix on `#import`s of runtime provided headers in the generated files.
When integrating ObjC protos into a build system, this can be used to avoid
having to add the runtime directory to the header search path since the
generate `#import` will be more complete.
Contributing
------------

@ -23,7 +23,7 @@
}
},
"scripts": {
"test": "(cd tests && rm -rf generated && mkdir -p generated && ../../src/protoc --php_out=generated -I../../src -I. proto/empty/echo.proto proto/test.proto proto/test_include.proto proto/test_no_namespace.proto proto/test_prefix.proto proto/test_php_namespace.proto proto/test_empty_php_namespace.proto proto/test_reserved_enum_lower.proto proto/test_reserved_enum_upper.proto proto/test_reserved_enum_value_lower.proto proto/test_reserved_enum_value_upper.proto proto/test_reserved_message_lower.proto proto/test_reserved_message_upper.proto proto/test_service.proto proto/test_service_namespace.proto proto/test_wrapper_type_setters.proto proto/test_descriptors.proto) && (cd ../src && ./protoc --php_out=../php/tests/generated -I../php/tests -I. ../php/tests/proto/test_import_descriptor_proto.proto) && vendor/bin/phpunit",
"aggregate_metadata_test": "(cd tests && rm -rf generated && mkdir -p generated && ../../src/protoc --php_out=aggregate_metadata=foo#bar:generated -I../../src -I. proto/test.proto proto/test_include.proto && ../../src/protoc --php_out=generated -I../../src -I. proto/empty/echo.proto proto/test_no_namespace.proto proto/test_empty_php_namespace.proto proto/test_prefix.proto proto/test_php_namespace.proto proto/test_reserved_enum_lower.proto proto/test_reserved_enum_upper.proto proto/test_reserved_enum_value_lower.proto proto/test_reserved_enum_value_upper.proto proto/test_reserved_message_lower.proto proto/test_reserved_message_upper.proto proto/test_service.proto proto/test_service_namespace.proto proto/test_wrapper_type_setters.proto proto/test_descriptors.proto) && (cd ../src && ./protoc --php_out=aggregate_metadata=foo:../php/tests/generated -I../php/tests -I. ../php/tests/proto/test_import_descriptor_proto.proto) && vendor/bin/phpunit"
"test": "tests/generate_protos.sh && vendor/bin/phpunit",
"aggregate_metadata_test": "tests/generate_protos.sh --aggregate_metadata && vendor/bin/phpunit"
}
}

@ -1726,7 +1726,7 @@ PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\Timestamp",
0 ,ZEND_ACC_PRIVATE TSRMLS_CC);
PHP_PROTO_INIT_SUBMSGCLASS_END
PHP_METHOD(Timestamp, __construct) {
static PHP_METHOD(Timestamp, __construct) {
init_file_timestamp(TSRMLS_C);
INIT_MESSAGE_WITH_ARRAY;
}

@ -10,11 +10,11 @@
<email>protobuf-opensource@google.com</email>
<active>yes</active>
</lead>
<date>2020-05-26</date>
<time>13:57:10</time>
<date>2020-06-01</date>
<time>01:14:10</time>
<version>
<release>3.12.2</release>
<api>3.12.2</api>
<release>3.12.3</release>
<api>3.12.3</api>
</version>
<stability>
<release>stable</release>
@ -599,5 +599,19 @@ G A release.
<license uri="https://opensource.org/licenses/BSD-3-Clause">3-Clause BSD License</license>
<notes>GA release.</notes>
</release>
<release>
<version>
<release>3.12.3</release>
<api>3.12.3</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<date>2020-06-01</date>
<time>01:09:39</time>
<license uri="https://opensource.org/licenses/BSD-3-Clause">3-Clause BSD License</license>
<notes>GA release.</notes>
</release>
</changelog>
</package>

@ -37,7 +37,7 @@
#include "upb.h"
#define PHP_PROTOBUF_EXTNAME "protobuf"
#define PHP_PROTOBUF_VERSION "3.12.2"
#define PHP_PROTOBUF_VERSION "3.12.3"
#define MAX_LENGTH_OF_INT64 20
#define SIZEOF_INT64 8
@ -1292,7 +1292,7 @@ PHP_METHOD(Duration, setSeconds);
PHP_METHOD(Duration, getNanos);
PHP_METHOD(Duration, setNanos);
PHP_METHOD(Timestamp, __construct);
static PHP_METHOD(Timestamp, __construct);
PHP_METHOD(Timestamp, fromDateTime);
PHP_METHOD(Timestamp, toDateTime);
PHP_METHOD(Timestamp, getSeconds);

@ -1,8 +1,10 @@
#!/bin/bash
set -ex
cd $(dirname $0)
if [ "$1" = "--release"]; then
if [ "$1" = "--release" ]; then
CFLAGS="-Wall"
else
# To get debugging symbols in PHP itself, build PHP with:
@ -12,6 +14,5 @@ fi
pushd ../ext/google/protobuf
make clean || true
set -e
phpize && ./configure --with-php-config=$(which php-config) CFLAGS="$CFLAGS" && make
popd

@ -0,0 +1,16 @@
#!/bin/bash
set -ex
cd `dirname $0`
rm -rf generated
mkdir -p generated
find proto -type f -name "*.proto"| xargs ../../src/protoc --php_out=generated -I../../src -I.
if [ "$1" = "--aggregate_metadata" ]; then
# Overwrite some of the files to use aggregation.
AGGREGATED_FILES="proto/test.proto proto/test_include.proto proto/test_import_descriptor_proto.proto"
../../src/protoc --php_out=aggregate_metadata=foo#bar:generated -I../../src -I. $AGGREGATED_FILES
fi

@ -1527,6 +1527,21 @@ class GeneratedClassTest extends TestBase
public function testNoExceptionWithVarDump()
{
$m = new Sub(['a' => 1]);
var_dump($m);
/*
* This line currently segfaults on macOS with:
*
* frame #0: 0x00000001029936cc xdebug.so`xdebug_zend_hash_is_recursive + 4
* frame #1: 0x00000001029a6736 xdebug.so`xdebug_var_export_text_ansi + 1006
* frame #2: 0x00000001029a715d xdebug.so`xdebug_get_zval_value_text_ansi + 273
* frame #3: 0x000000010298a441 xdebug.so`zif_xdebug_var_dump + 297
* frame #4: 0x000000010298d558 xdebug.so`xdebug_execute_internal + 640
* frame #5: 0x000000010046d47f php`ZEND_DO_FCALL_SPEC_RETVAL_UNUSED_HANDLER + 364
* frame #6: 0x000000010043cabc php`execute_ex + 44
* frame #7: 0x000000010298d151 xdebug.so`xdebug_execute_ex + 1662
* frame #8: 0x000000010046d865 php`ZEND_DO_FCALL_SPEC_RETVAL_USED_HANDLER + 426
*
* The value we are passing to var_dump() appears to be corrupt somehow.
*/
/* var_dump($m); */
}
}

@ -1,9 +1,23 @@
#!/bin/bash
set -ex
cd $(dirname $0)
./generate_protos.sh
./compile_extension.sh
PHP_VERSION=$(php -r "echo PHP_VERSION;")
# Each version of PHPUnit supports a fairly narrow range of PHP versions.
case "$PHP_VERSION" in
5.6.*) PHPUNIT=phpunit-5.6.8.phar;;
7.0.*) PHPUNIT=phpunit-5.6.0.phar;; # Oddly older than for 5.6. Not sure the reason.
7.3.*) PHPUNIT=phpunit-8.phar;;
esac
[ -f $PHPUNIT ] || wget https://phar.phpunit.de/$PHPUNIT
tests=( array_test.php encode_decode_test.php generated_class_test.php map_field_test.php well_known_test.php descriptors_test.php wrapper_type_setters_test.php)
for t in "${tests[@]}"
@ -11,7 +25,7 @@ do
echo "****************************"
echo "* $t"
echo "****************************"
php -dextension=../ext/google/protobuf/modules/protobuf.so `which phpunit` --bootstrap autoload.php $t
php -dextension=../ext/google/protobuf/modules/protobuf.so $PHPUNIT --bootstrap autoload.php $t
echo ""
done
@ -20,7 +34,7 @@ do
echo "****************************"
echo "* $t persistent"
echo "****************************"
php -d protobuf.keep_descriptor_pool_after_request=1 -dextension=../ext/google/protobuf/modules/protobuf.so `which phpunit` --bootstrap autoload.php $t
php -d protobuf.keep_descriptor_pool_after_request=1 -dextension=../ext/google/protobuf/modules/protobuf.so $PHPUNIT --bootstrap autoload.php $t
echo ""
done
@ -40,6 +54,6 @@ valgrind --leak-check=yes php -d protobuf.keep_descriptor_pool_after_request=1 -
# echo "****************************"
# echo "* $t (memory leak)"
# echo "****************************"
# valgrind --leak-check=yes php -dextension=../ext/google/protobuf/modules/protobuf.so `which phpunit` --bootstrap autoload.php $t
# valgrind --leak-check=yes php -dextension=../ext/google/protobuf/modules/protobuf.so $PHPUNIT --bootstrap autoload.php $t
# echo ""
# done

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

@ -209,7 +209,8 @@ def _SimpleDecoder(wire_type, decode_value):
_DecodeVarint()
"""
def SpecificDecoder(field_number, is_repeated, is_packed, key, new_default):
def SpecificDecoder(field_number, is_repeated, is_packed, key, new_default,
clear_if_default=False):
if is_packed:
local_DecodeVarint = _DecodeVarint
def DecodePackedField(buffer, pos, end, message, field_dict):
@ -249,10 +250,13 @@ def _SimpleDecoder(wire_type, decode_value):
return DecodeRepeatedField
else:
def DecodeField(buffer, pos, end, message, field_dict):
(field_dict[key], pos) = decode_value(buffer, pos)
(new_value, pos) = decode_value(buffer, pos)
if pos > end:
del field_dict[key] # Discard corrupt value.
raise _DecodeError('Truncated message.')
if clear_if_default and not new_value:
field_dict.pop(key, None)
else:
field_dict[key] = new_value
return pos
return DecodeField
@ -383,7 +387,9 @@ def _DoubleDecoder():
return _SimpleDecoder(wire_format.WIRETYPE_FIXED64, InnerDecode)
def EnumDecoder(field_number, is_repeated, is_packed, key, new_default):
def EnumDecoder(field_number, is_repeated, is_packed, key, new_default,
clear_if_default=False):
"""Returns a decoder for enum field."""
enum_type = key.enum_type
if is_packed:
local_DecodeVarint = _DecodeVarint
@ -498,6 +504,9 @@ def EnumDecoder(field_number, is_repeated, is_packed, key, new_default):
(enum_value, pos) = _DecodeSignedVarint32(buffer, pos)
if pos > end:
raise _DecodeError('Truncated message.')
if clear_if_default and not enum_value:
field_dict.pop(key, None)
return pos
# pylint: disable=protected-access
if enum_value in enum_type.values_by_number:
field_dict[key] = enum_value
@ -550,7 +559,7 @@ BoolDecoder = _ModifiedDecoder(
def StringDecoder(field_number, is_repeated, is_packed, key, new_default,
is_strict_utf8=False):
is_strict_utf8=False, clear_if_default=False):
"""Returns a decoder for a string field."""
local_DecodeVarint = _DecodeVarint
@ -604,12 +613,16 @@ def StringDecoder(field_number, is_repeated, is_packed, key, new_default,
new_pos = pos + size
if new_pos > end:
raise _DecodeError('Truncated string.')
field_dict[key] = _ConvertToUnicode(buffer[pos:new_pos])
if clear_if_default and not size:
field_dict.pop(key, None)
else:
field_dict[key] = _ConvertToUnicode(buffer[pos:new_pos])
return new_pos
return DecodeField
def BytesDecoder(field_number, is_repeated, is_packed, key, new_default):
def BytesDecoder(field_number, is_repeated, is_packed, key, new_default,
clear_if_default=False):
"""Returns a decoder for a bytes field."""
local_DecodeVarint = _DecodeVarint
@ -641,7 +654,10 @@ def BytesDecoder(field_number, is_repeated, is_packed, key, new_default):
new_pos = pos + size
if new_pos > end:
raise _DecodeError('Truncated string.')
field_dict[key] = buffer[pos:new_pos].tobytes()
if clear_if_default and not size:
field_dict.pop(key, None)
else:
field_dict[key] = buffer[pos:new_pos].tobytes()
return new_pos
return DecodeField

@ -372,14 +372,15 @@ def MapSizer(field_descriptor, is_message_map):
def _VarintEncoder():
"""Return an encoder for a basic varint value (does not include tag)."""
local_int2byte = six.int2byte
def EncodeVarint(write, value, unused_deterministic=None):
bits = value & 0x7f
value >>= 7
while value:
write(six.int2byte(0x80|bits))
write(local_int2byte(0x80|bits))
bits = value & 0x7f
value >>= 7
return write(six.int2byte(bits))
return write(local_int2byte(bits))
return EncodeVarint
@ -388,16 +389,17 @@ def _SignedVarintEncoder():
"""Return an encoder for a basic signed varint value (does not include
tag)."""
local_int2byte = six.int2byte
def EncodeSignedVarint(write, value, unused_deterministic=None):
if value < 0:
value += (1 << 64)
bits = value & 0x7f
value >>= 7
while value:
write(six.int2byte(0x80|bits))
write(local_int2byte(0x80|bits))
bits = value & 0x7f
value >>= 7
return write(six.int2byte(bits))
return write(local_int2byte(bits))
return EncodeSignedVarint

@ -830,10 +830,14 @@ class JsonFormatTest(JsonFormatBase):
def testParseDoubleToFloat(self):
message = json_format_proto3_pb2.TestMessage()
text = ('{"repeatedFloatValue": [3.4028235e+39, 1.4028235e-39]\n}')
text = ('{"repeatedDoubleValue": [3.4028235e+39, 1.4028235e-39]\n}')
json_format.Parse(text, message)
self.assertEqual(message.repeated_float_value[0], float('inf'))
self.assertAlmostEqual(message.repeated_float_value[1], 1.4028235e-39)
self.assertEqual(message.repeated_double_value[0], 3.4028235e+39)
self.assertEqual(message.repeated_double_value[1], 1.4028235e-39)
text = ('{"repeatedFloatValue": [3.4028235e+39, 1.4028235e-39]\n}')
self.CheckError(text,
'Failed to parse repeatedFloatValue field: '
'Float value too large.')
def testFloatPrecision(self):
message = json_format_proto3_pb2.TestMessage()
@ -898,6 +902,23 @@ class JsonFormatTest(JsonFormatBase):
'for enum type protobuf_unittest.TestAllTypes.NestedEnum.',
json_format.Parse, '{"optionalNestedEnum": 12345}', message)
def testBytes(self):
message = json_format_proto3_pb2.TestMessage()
# Test url base64
text = '{"bytesValue": "-_"}'
json_format.Parse(text, message)
self.assertEqual(message.bytes_value, b'\xfb')
# Test padding
text = '{"bytesValue": "AQI="}'
json_format.Parse(text, message)
self.assertEqual(message.bytes_value, b'\x01\x02')
text = '{"bytesValue": "AQI"}'
json_format.Parse(text, message)
self.assertEqual(message.bytes_value, b'\x01\x02')
text = '{"bytesValue": "AQI*"}'
json_format.Parse(text, message)
self.assertEqual(message.bytes_value, b'\x01\x02')
def testParseBadIdentifer(self):
self.CheckError('{int32Value: 1}',
(r'Failed to load JSON: Expecting property name'
@ -948,6 +969,9 @@ class JsonFormatTest(JsonFormatBase):
self.CheckError('{"int32Value": "1 "}',
'Failed to parse int32Value field: '
'Couldn\'t parse integer: "1 ".')
self.CheckError('{"int32Value": false}',
'Failed to parse int32Value field: Bool value False '
'is not acceptable for integer field.')
self.CheckError('{"int32Value": 12345678901234567890}',
'Failed to parse int32Value field: Value out of range: '
'12345678901234567890.')
@ -959,12 +983,24 @@ class JsonFormatTest(JsonFormatBase):
self.CheckError('{"floatValue": "nan"}',
'Failed to parse floatValue field: Couldn\'t '
'parse float "nan", use "NaN" instead.')
def testInvalidBytesValue(self):
self.CheckError('{"bytesValue": "AQI"}',
'Failed to parse bytesValue field: Incorrect padding.')
self.CheckError('{"bytesValue": "AQI*"}',
'Failed to parse bytesValue field: Incorrect padding.')
self.CheckError('{"floatValue": NaN}',
'Failed to parse floatValue field: Couldn\'t '
'parse NaN, use quoted "NaN" instead.')
self.CheckError('{"floatValue": Infinity}',
'Failed to parse floatValue field: Couldn\'t parse Infinity'
' or value too large, use quoted "Infinity" instead.')
self.CheckError('{"floatValue": -Infinity}',
'Failed to parse floatValue field: Couldn\'t parse '
'-Infinity or value too small, '
'use quoted "-Infinity" instead.')
self.CheckError('{"doubleValue": -1.89769e+308}',
'Failed to parse doubleValue field: Couldn\'t parse '
'-Infinity or value too small, '
'use quoted "-Infinity" instead.')
self.CheckError('{"floatValue": 3.4028235e+39}',
'Failed to parse floatValue field: Float value too large.')
self.CheckError('{"floatValue": -3.502823e+38}',
'Failed to parse floatValue field: Float value too small.')
def testInvalidRepeated(self):
self.CheckError('{"repeatedInt32Value": 12345}',

@ -1675,6 +1675,17 @@ class Proto3Test(unittest.TestCase):
self.assertEqual(False, message.optional_bool)
self.assertEqual(0, message.optional_nested_message.bb)
def testProto3ParserDropDefaultScalar(self):
message_proto2 = unittest_pb2.TestAllTypes()
message_proto2.optional_int32 = 0
message_proto2.optional_string = ''
message_proto2.optional_bytes = b''
self.assertEqual(len(message_proto2.ListFields()), 3)
message_proto3 = unittest_proto3_arena_pb2.TestAllTypes()
message_proto3.ParseFromString(message_proto2.SerializeToString())
self.assertEqual(len(message_proto3.ListFields()), 0)
def testProto3Optional(self):
msg = test_proto3_optional_pb2.TestProto3Optional()
self.assertFalse(msg.HasField('optional_int32'))

@ -295,6 +295,7 @@ def _AttachFieldHelpers(cls, field_descriptor):
is_repeated = (field_descriptor.label == _FieldDescriptor.LABEL_REPEATED)
is_packable = (is_repeated and
wire_format.IsTypePackable(field_descriptor.type))
is_proto3 = field_descriptor.containing_type.syntax == 'proto3'
if not is_packable:
is_packed = False
elif field_descriptor.containing_type.syntax == 'proto2':
@ -333,8 +334,12 @@ def _AttachFieldHelpers(cls, field_descriptor):
decode_type = _FieldDescriptor.TYPE_INT32
oneof_descriptor = None
clear_if_default = False
if field_descriptor.containing_oneof is not None:
oneof_descriptor = field_descriptor
elif (is_proto3 and not is_repeated and
field_descriptor.cpp_type != _FieldDescriptor.CPPTYPE_MESSAGE):
clear_if_default = True
if is_map_entry:
is_message_map = _IsMessageMapField(field_descriptor)
@ -347,11 +352,17 @@ def _AttachFieldHelpers(cls, field_descriptor):
field_decoder = decoder.StringDecoder(
field_descriptor.number, is_repeated, is_packed,
field_descriptor, field_descriptor._default_constructor,
is_strict_utf8_check)
else:
is_strict_utf8_check, clear_if_default)
elif field_descriptor.cpp_type == _FieldDescriptor.CPPTYPE_MESSAGE:
field_decoder = type_checkers.TYPE_TO_DECODER[decode_type](
field_descriptor.number, is_repeated, is_packed,
field_descriptor, field_descriptor._default_constructor)
else:
field_decoder = type_checkers.TYPE_TO_DECODER[decode_type](
field_descriptor.number, is_repeated, is_packed,
# pylint: disable=protected-access
field_descriptor, field_descriptor._default_constructor,
clear_if_default)
cls._decoders_by_tag[tag_bytes] = (field_decoder, oneof_descriptor)

@ -195,7 +195,6 @@ class _Printer(object):
self.preserving_proto_field_name = preserving_proto_field_name
self.use_integers_for_enums = use_integers_for_enums
self.descriptor_pool = descriptor_pool
# TODO(jieluo): change the float precision default to 8 valid digits.
if float_precision:
self.float_format = '.{}g'.format(float_precision)
else:
@ -720,12 +719,18 @@ def _ConvertScalarFieldValue(value, field, require_str=False):
if field.cpp_type in _INT_TYPES:
return _ConvertInteger(value)
elif field.cpp_type in _FLOAT_TYPES:
return _ConvertFloat(value)
return _ConvertFloat(value, field)
elif field.cpp_type == descriptor.FieldDescriptor.CPPTYPE_BOOL:
return _ConvertBool(value, require_str)
elif field.cpp_type == descriptor.FieldDescriptor.CPPTYPE_STRING:
if field.type == descriptor.FieldDescriptor.TYPE_BYTES:
return base64.b64decode(value)
if isinstance(value, six.text_type):
encoded = value.encode('utf-8')
else:
encoded = value
# Add extra padding '='
padded_value = encoded + b'=' * (4 - len(encoded) % 4)
return base64.urlsafe_b64decode(padded_value)
else:
# Checking for unpaired surrogates appears to be unreliable,
# depending on the specific Python version, so we check manually.
@ -769,11 +774,32 @@ def _ConvertInteger(value):
if isinstance(value, six.text_type) and value.find(' ') != -1:
raise ParseError('Couldn\'t parse integer: "{0}".'.format(value))
if isinstance(value, bool):
raise ParseError('Bool value {0} is not acceptable for '
'integer field.'.format(value))
return int(value)
def _ConvertFloat(value):
def _ConvertFloat(value, field):
"""Convert an floating point number."""
if isinstance(value, float):
if math.isnan(value):
raise ParseError('Couldn\'t parse NaN, use quoted "NaN" instead.')
if math.isinf(value):
if value > 0:
raise ParseError('Couldn\'t parse Infinity or value too large, '
'use quoted "Infinity" instead.')
else:
raise ParseError('Couldn\'t parse -Infinity or value too small, '
'use quoted "-Infinity" instead.')
if field.cpp_type == descriptor.FieldDescriptor.CPPTYPE_FLOAT:
# pylint: disable=protected-access
if value > type_checkers._FLOAT_MAX:
raise ParseError('Float value too large')
# pylint: disable=protected-access
if value < type_checkers._FLOAT_MIN:
raise ParseError('Float value too small')
if value == 'nan':
raise ParseError('Couldn\'t parse float "nan", use "NaN" instead.')
try:

@ -1690,7 +1690,7 @@ static PyObject* FindMethodByName(PyBaseDescriptor *self, PyObject* arg) {
}
const MethodDescriptor* method_descriptor =
_GetDescriptor(self)->FindMethodByName(std::string(name, name_size));
_GetDescriptor(self)->FindMethodByName(StringParam(name, name_size));
if (method_descriptor == NULL) {
PyErr_Format(PyExc_KeyError, "Couldn't find method %.200s", name);
return NULL;

@ -41,6 +41,9 @@ namespace google {
namespace protobuf {
namespace python {
// Should match the type of ConstStringParam.
using StringParam = std::string;
extern PyTypeObject PyMessageDescriptor_Type;
extern PyTypeObject PyFieldDescriptor_Type;
extern PyTypeObject PyEnumDescriptor_Type;

@ -81,9 +81,9 @@ struct PyContainer;
typedef int (*CountMethod)(PyContainer* self);
typedef const void* (*GetByIndexMethod)(PyContainer* self, int index);
typedef const void* (*GetByNameMethod)(PyContainer* self,
const std::string& name);
ConstStringParam name);
typedef const void* (*GetByCamelcaseNameMethod)(PyContainer* self,
const std::string& name);
ConstStringParam name);
typedef const void* (*GetByNumberMethod)(PyContainer* self, int index);
typedef PyObject* (*NewObjectFromItemMethod)(const void* descriptor);
typedef const std::string& (*GetItemNameMethod)(const void* descriptor);
@ -183,7 +183,7 @@ static bool _GetItemByKey(PyContainer* self, PyObject* key, const void** item) {
return false;
}
*item = self->container_def->get_by_name_fn(
self, std::string(name, name_size));
self, StringParam(name, name_size));
return true;
}
case PyContainer::KIND_BYCAMELCASENAME:
@ -200,7 +200,7 @@ static bool _GetItemByKey(PyContainer* self, PyObject* key, const void** item) {
return false;
}
*item = self->container_def->get_by_camelcase_name_fn(
self, std::string(camelcase_name, name_size));
self, StringParam(camelcase_name, name_size));
return true;
}
case PyContainer::KIND_BYNUMBER:
@ -962,12 +962,12 @@ static int Count(PyContainer* self) {
return GetDescriptor(self)->field_count();
}
static const void* GetByName(PyContainer* self, const std::string& name) {
static const void* GetByName(PyContainer* self, ConstStringParam name) {
return GetDescriptor(self)->FindFieldByName(name);
}
static const void* GetByCamelcaseName(PyContainer* self,
const std::string& name) {
ConstStringParam name) {
return GetDescriptor(self)->FindFieldByCamelcaseName(name);
}
@ -1040,7 +1040,7 @@ static int Count(PyContainer* self) {
return GetDescriptor(self)->nested_type_count();
}
static const void* GetByName(PyContainer* self, const std::string& name) {
static const void* GetByName(PyContainer* self, ConstStringParam name) {
return GetDescriptor(self)->FindNestedTypeByName(name);
}
@ -1092,7 +1092,7 @@ static int Count(PyContainer* self) {
return GetDescriptor(self)->enum_type_count();
}
static const void* GetByName(PyContainer* self, const std::string& name) {
static const void* GetByName(PyContainer* self, ConstStringParam name) {
return GetDescriptor(self)->FindEnumTypeByName(name);
}
@ -1155,7 +1155,7 @@ static int Count(PyContainer* self) {
return count;
}
static const void* GetByName(PyContainer* self, const std::string& name) {
static const void* GetByName(PyContainer* self, ConstStringParam name) {
return GetDescriptor(self)->FindEnumValueByName(name);
}
@ -1215,7 +1215,7 @@ static int Count(PyContainer* self) {
return GetDescriptor(self)->extension_count();
}
static const void* GetByName(PyContainer* self, const std::string& name) {
static const void* GetByName(PyContainer* self, ConstStringParam name) {
return GetDescriptor(self)->FindExtensionByName(name);
}
@ -1267,7 +1267,7 @@ static int Count(PyContainer* self) {
return GetDescriptor(self)->oneof_decl_count();
}
static const void* GetByName(PyContainer* self, const std::string& name) {
static const void* GetByName(PyContainer* self, ConstStringParam name) {
return GetDescriptor(self)->FindOneofByName(name);
}
@ -1333,7 +1333,7 @@ static const void* GetByIndex(PyContainer* self, int index) {
return GetDescriptor(self)->value(index);
}
static const void* GetByName(PyContainer* self, const std::string& name) {
static const void* GetByName(PyContainer* self, ConstStringParam name) {
return GetDescriptor(self)->FindValueByName(name);
}
@ -1454,7 +1454,7 @@ static int Count(PyContainer* self) {
return GetDescriptor(self)->method_count();
}
static const void* GetByName(PyContainer* self, const std::string& name) {
static const void* GetByName(PyContainer* self, ConstStringParam name) {
return GetDescriptor(self)->FindMethodByName(name);
}
@ -1516,7 +1516,7 @@ static int Count(PyContainer* self) {
return GetDescriptor(self)->message_type_count();
}
static const void* GetByName(PyContainer* self, const std::string& name) {
static const void* GetByName(PyContainer* self, ConstStringParam name) {
return GetDescriptor(self)->FindMessageTypeByName(name);
}
@ -1564,7 +1564,7 @@ static int Count(PyContainer* self) {
return GetDescriptor(self)->enum_type_count();
}
static const void* GetByName(PyContainer* self, const std::string& name) {
static const void* GetByName(PyContainer* self, ConstStringParam name) {
return GetDescriptor(self)->FindEnumTypeByName(name);
}
@ -1612,7 +1612,7 @@ static int Count(PyContainer* self) {
return GetDescriptor(self)->extension_count();
}
static const void* GetByName(PyContainer* self, const std::string& name) {
static const void* GetByName(PyContainer* self, ConstStringParam name) {
return GetDescriptor(self)->FindExtensionByName(name);
}
@ -1660,7 +1660,7 @@ static int Count(PyContainer* self) {
return GetDescriptor(self)->service_count();
}
static const void* GetByName(PyContainer* self, const std::string& name) {
static const void* GetByName(PyContainer* self, ConstStringParam name) {
return GetDescriptor(self)->FindServiceByName(name);
}

@ -240,7 +240,7 @@ static PyObject* FindMessageByName(PyObject* self, PyObject* arg) {
const Descriptor* message_descriptor =
reinterpret_cast<PyDescriptorPool*>(self)->pool->FindMessageTypeByName(
std::string(name, name_size));
StringParam(name, name_size));
if (message_descriptor == NULL) {
return SetErrorFromCollector(
@ -264,7 +264,7 @@ static PyObject* FindFileByName(PyObject* self, PyObject* arg) {
PyDescriptorPool* py_pool = reinterpret_cast<PyDescriptorPool*>(self);
const FileDescriptor* file_descriptor =
py_pool->pool->FindFileByName(std::string(name, name_size));
py_pool->pool->FindFileByName(StringParam(name, name_size));
if (file_descriptor == NULL) {
return SetErrorFromCollector(py_pool->error_collector, name, "file");
@ -280,7 +280,7 @@ PyObject* FindFieldByName(PyDescriptorPool* self, PyObject* arg) {
}
const FieldDescriptor* field_descriptor =
self->pool->FindFieldByName(std::string(name, name_size));
self->pool->FindFieldByName(StringParam(name, name_size));
if (field_descriptor == NULL) {
return SetErrorFromCollector(self->error_collector, name, "field");
}
@ -301,7 +301,7 @@ PyObject* FindExtensionByName(PyDescriptorPool* self, PyObject* arg) {
}
const FieldDescriptor* field_descriptor =
self->pool->FindExtensionByName(std::string(name, name_size));
self->pool->FindExtensionByName(StringParam(name, name_size));
if (field_descriptor == NULL) {
return SetErrorFromCollector(self->error_collector, name,
"extension field");
@ -323,7 +323,7 @@ PyObject* FindEnumTypeByName(PyDescriptorPool* self, PyObject* arg) {
}
const EnumDescriptor* enum_descriptor =
self->pool->FindEnumTypeByName(std::string(name, name_size));
self->pool->FindEnumTypeByName(StringParam(name, name_size));
if (enum_descriptor == NULL) {
return SetErrorFromCollector(self->error_collector, name, "enum");
}
@ -344,7 +344,7 @@ PyObject* FindOneofByName(PyDescriptorPool* self, PyObject* arg) {
}
const OneofDescriptor* oneof_descriptor =
self->pool->FindOneofByName(std::string(name, name_size));
self->pool->FindOneofByName(StringParam(name, name_size));
if (oneof_descriptor == NULL) {
return SetErrorFromCollector(self->error_collector, name, "oneof");
}
@ -366,7 +366,7 @@ static PyObject* FindServiceByName(PyObject* self, PyObject* arg) {
const ServiceDescriptor* service_descriptor =
reinterpret_cast<PyDescriptorPool*>(self)->pool->FindServiceByName(
std::string(name, name_size));
StringParam(name, name_size));
if (service_descriptor == NULL) {
return SetErrorFromCollector(
reinterpret_cast<PyDescriptorPool*>(self)->error_collector, name,
@ -386,7 +386,7 @@ static PyObject* FindMethodByName(PyObject* self, PyObject* arg) {
const MethodDescriptor* method_descriptor =
reinterpret_cast<PyDescriptorPool*>(self)->pool->FindMethodByName(
std::string(name, name_size));
StringParam(name, name_size));
if (method_descriptor == NULL) {
return SetErrorFromCollector(
reinterpret_cast<PyDescriptorPool*>(self)->error_collector, name,
@ -406,7 +406,7 @@ static PyObject* FindFileContainingSymbol(PyObject* self, PyObject* arg) {
const FileDescriptor* file_descriptor =
reinterpret_cast<PyDescriptorPool*>(self)->pool->FindFileContainingSymbol(
std::string(name, name_size));
StringParam(name, name_size));
if (file_descriptor == NULL) {
return SetErrorFromCollector(
reinterpret_cast<PyDescriptorPool*>(self)->error_collector, name,

@ -240,11 +240,11 @@ PyObject* _FindExtensionByName(ExtensionDict* self, PyObject* arg) {
PyDescriptorPool* pool = cmessage::GetFactoryForMessage(self->parent)->pool;
const FieldDescriptor* message_extension =
pool->pool->FindExtensionByName(std::string(name, name_size));
pool->pool->FindExtensionByName(StringParam(name, name_size));
if (message_extension == NULL) {
// Is is the name of a message set extension?
const Descriptor* message_descriptor =
pool->pool->FindMessageTypeByName(std::string(name, name_size));
pool->pool->FindMessageTypeByName(StringParam(name, name_size));
if (message_descriptor && message_descriptor->extension_count() > 0) {
const FieldDescriptor* extension = message_descriptor->extension(0);
if (extension->is_extension() &&

@ -243,7 +243,7 @@ static PyObject* New(PyTypeObject* type,
}
message_descriptor =
GetDefaultDescriptorPool()->pool->FindMessageTypeByName(
std::string(full_name, name_size));
StringParam(full_name, name_size));
if (message_descriptor == nullptr) {
PyErr_Format(PyExc_KeyError,
"Can not find message descriptor %s "
@ -984,7 +984,7 @@ static PyObject* GetIntegerEnumValue(const FieldDescriptor& descriptor,
return NULL;
}
const EnumValueDescriptor* enum_value_descriptor =
enum_descriptor->FindValueByName(std::string(enum_label, size));
enum_descriptor->FindValueByName(StringParam(enum_label, size));
if (enum_value_descriptor == NULL) {
PyErr_Format(PyExc_ValueError, "unknown enum label \"%s\"", enum_label);
return NULL;
@ -1399,7 +1399,7 @@ int HasFieldByDescriptor(CMessage* self,
}
const FieldDescriptor* FindFieldWithOneofs(const Message* message,
const std::string& field_name,
ConstStringParam field_name,
bool* in_oneof) {
*in_oneof = false;
const Descriptor* descriptor = message->GetDescriptor();
@ -1455,7 +1455,7 @@ PyObject* HasField(CMessage* self, PyObject* arg) {
Message* message = self->message;
bool is_in_oneof;
const FieldDescriptor* field_descriptor =
FindFieldWithOneofs(message, std::string(field_name, size), &is_in_oneof);
FindFieldWithOneofs(message, StringParam(field_name, size), &is_in_oneof);
if (field_descriptor == NULL) {
if (!is_in_oneof) {
PyErr_Format(PyExc_ValueError, "Protocol message %s has no field %s.",
@ -1632,7 +1632,7 @@ PyObject* ClearField(CMessage* self, PyObject* arg) {
AssureWritable(self);
bool is_in_oneof;
const FieldDescriptor* field_descriptor = FindFieldWithOneofs(
self->message, std::string(field_name, field_size), &is_in_oneof);
self->message, StringParam(field_name, field_size), &is_in_oneof);
if (field_descriptor == NULL) {
if (is_in_oneof) {
// We gave the name of a oneof, and none of its fields are set.
@ -2033,13 +2033,12 @@ static PyObject* WhichOneof(CMessage* self, PyObject* arg) {
char *name_data;
if (PyString_AsStringAndSize(arg, &name_data, &name_size) < 0)
return NULL;
std::string oneof_name = std::string(name_data, name_size);
const OneofDescriptor* oneof_desc =
self->message->GetDescriptor()->FindOneofByName(oneof_name);
self->message->GetDescriptor()->FindOneofByName(
StringParam(name_data, name_size));
if (oneof_desc == NULL) {
PyErr_Format(PyExc_ValueError,
"Protocol message has no oneof \"%s\" field.",
oneof_name.c_str());
"Protocol message has no oneof \"%s\" field.", name_data);
return NULL;
}
const FieldDescriptor* field_in_oneof =

@ -80,14 +80,16 @@ python setup.py build
python setup.py test
# Deploy source package to testing PyPI
python setup.py sdist upload -r https://test.pypi.org/legacy/
python setup.py sdist
twine upload --skip-existing -r testpypi -u protobuf-wheel-test dist/*
# Test locally with different python versions.
run_install_test ${TESTING_VERSION} python2.7 https://test.pypi.org/simple
run_install_test ${TESTING_VERSION} python3 https://test.pypi.org/simple
# Deploy egg/wheel packages to testing PyPI and test again.
python setup.py bdist_egg bdist_wheel upload -r https://test.pypi.org/legacy/
python setup.py clean build bdist_wheel
twine upload --skip-existing -r testpypi -u protobuf-wheel-test dist/*
run_install_test ${TESTING_VERSION} python2.7 https://test.pypi.org/simple
run_install_test ${TESTING_VERSION} python3 https://test.pypi.org/simple
@ -103,13 +105,15 @@ if [ $TESTING_ONLY -eq 0 ]; then
echo "Publishing to PyPI..."
# Be sure to run build before sdist, because otherwise sdist will not include
# well-known types.
python setup.py clean build sdist upload
python setup.py clean build sdist
twine upload --skip-existing -u protobuf-packages dist/*
# Be sure to run clean before bdist_xxx, because otherwise bdist_xxx will
# include files you may not want in the package. E.g., if you have built
# and tested with --cpp_implemenation, bdist_xxx will include the _message.so
# file even when you no longer pass the --cpp_implemenation flag. See:
# https://github.com/protocolbuffers/protobuf/issues/3042
python setup.py clean build bdist_egg bdist_wheel upload
python setup.py clean build bdist_wheel
twine upload --skip-existing -u protobuf-packages dist/*
else
# Set the version number back (i.e., remove dev suffix).
sed -i -r "s/__version__ = '.*'/__version__ = '${VERSION}'/" google/protobuf/__init__.py

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

@ -69,7 +69,7 @@ PROTOBUF_NAMESPACE_OPEN
class PROTOBUF_EXPORT Any PROTOBUF_FINAL :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.Any) */ {
public:
inline Any() : Any(nullptr) {};
inline Any() : Any(nullptr) {}
virtual ~Any();
Any(const Any& from);

@ -79,7 +79,7 @@ PROTOBUF_NAMESPACE_OPEN
class PROTOBUF_EXPORT Api PROTOBUF_FINAL :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.Api) */ {
public:
inline Api() : Api(nullptr) {};
inline Api() : Api(nullptr) {}
virtual ~Api();
Api(const Api& from);
@ -332,7 +332,7 @@ class PROTOBUF_EXPORT Api PROTOBUF_FINAL :
class PROTOBUF_EXPORT Method PROTOBUF_FINAL :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.Method) */ {
public:
inline Method() : Method(nullptr) {};
inline Method() : Method(nullptr) {}
virtual ~Method();
Method(const Method& from);
@ -565,7 +565,7 @@ class PROTOBUF_EXPORT Method PROTOBUF_FINAL :
class PROTOBUF_EXPORT Mixin PROTOBUF_FINAL :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.Mixin) */ {
public:
inline Mixin() : Mixin(nullptr) {};
inline Mixin() : Mixin(nullptr) {}
virtual ~Mixin();
Mixin(const Mixin& from);

@ -1104,6 +1104,7 @@ PopulateSingleSimpleDescriptorDatabase(const std::string& descriptor_set_name) {
bool CommandLineInterface::AllowProto3Optional(
const FileDescriptor& file) const {
// If the --experimental_allow_proto3_optional flag was set, we allow.
if (allow_proto3_optional_) return true;
// Whitelist all ads protos. Ads is an early adopter of this feature.

@ -2373,48 +2373,50 @@ TEST_F(CommandLineInterfaceTest, MissingValueAtEndError) {
}
TEST_F(CommandLineInterfaceTest, Proto3OptionalDisallowed) {
CreateTempFile("foo.proto",
CreateTempFile("google/foo.proto",
"syntax = \"proto3\";\n"
"message Foo {\n"
" optional int32 i = 1;\n"
"}\n");
Run("protocol_compiler --proto_path=$tmpdir foo.proto -odescriptor.pb");
Run("protocol_compiler --proto_path=$tmpdir google/foo.proto "
"-odescriptor.pb");
ExpectErrorSubstring("--experimental_allow_proto3_optional was not set");
}
TEST_F(CommandLineInterfaceTest, Proto3OptionalDisallowedDescriptor) {
CreateTempFile("foo.proto",
CreateTempFile("google/foo.proto",
"syntax = \"proto3\";\n"
"message Foo {\n"
" optional int32 i = 1;\n"
"}\n");
Run("protocol_compiler --experimental_allow_proto3_optional "
"--proto_path=$tmpdir foo.proto "
"--proto_path=$tmpdir google/foo.proto "
" -o$tmpdir/descriptor.pb");
ExpectNoErrors();
Run("protocol_compiler --descriptor_set_in=$tmpdir/descriptor.pb foo.proto "
"--test_out=$tmpdir");
Run("protocol_compiler --descriptor_set_in=$tmpdir/descriptor.pb"
" google/foo.proto --test_out=$tmpdir");
ExpectErrorSubstring("--experimental_allow_proto3_optional was not set");
}
TEST_F(CommandLineInterfaceTest, Proto3OptionalDisallowedGenCode) {
CreateTempFile("foo.proto",
CreateTempFile("google/foo.proto",
"syntax = \"proto3\";\n"
"message Foo {\n"
" optional int32 i = 1;\n"
"}\n");
Run("protocol_compiler --proto_path=$tmpdir foo.proto --test_out=$tmpdir");
Run("protocol_compiler --proto_path=$tmpdir google/foo.proto "
"--test_out=$tmpdir");
ExpectErrorSubstring("--experimental_allow_proto3_optional was not set");
}
TEST_F(CommandLineInterfaceTest, Proto3OptionalDisallowedNoCodegenSupport) {
CreateTempFile("foo.proto",
CreateTempFile("google/foo.proto",
"syntax = \"proto3\";\n"
"message Foo {\n"
" optional int32 i = 1;\n"
@ -2425,7 +2427,7 @@ TEST_F(CommandLineInterfaceTest, Proto3OptionalDisallowedNoCodegenSupport) {
CodeGenerator::FEATURE_PROTO3_OPTIONAL);
Run("protocol_compiler --experimental_allow_proto3_optional "
"--proto_path=$tmpdir foo.proto --no_proto3_optional_out=$tmpdir");
"--proto_path=$tmpdir google/foo.proto --no_proto3_optional_out=$tmpdir");
ExpectErrorSubstring(
"code generator --no_proto3_optional_out hasn't been updated to support "
@ -2433,14 +2435,14 @@ TEST_F(CommandLineInterfaceTest, Proto3OptionalDisallowedNoCodegenSupport) {
}
TEST_F(CommandLineInterfaceTest, Proto3OptionalAllowWithFlag) {
CreateTempFile("foo.proto",
CreateTempFile("google/foo.proto",
"syntax = \"proto3\";\n"
"message Foo {\n"
" optional int32 i = 1;\n"
"}\n");
Run("protocol_compiler --experimental_allow_proto3_optional "
"--proto_path=$tmpdir foo.proto --test_out=$tmpdir");
"--proto_path=$tmpdir google/foo.proto --test_out=$tmpdir");
ExpectNoErrors();
}

@ -1123,7 +1123,7 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* printer) {
format.Indent();
if (SupportsArenas(descriptor_)) {
format("inline $classname$() : $classname$(nullptr) {};\n");
format("inline $classname$() : $classname$(nullptr) {}\n");
} else {
format("$classname$();\n");
}

@ -161,6 +161,12 @@ void FieldGeneratorBase::GenerateExtensionCode(io::Printer* printer) {
// and repeated fields need this default is to not generate any code
}
void FieldGeneratorBase::GenerateParsingCode(io::Printer* printer, bool use_parse_context) {
// for some field types the value of "use_parse_context" doesn't matter,
// so we fallback to the default implementation.
GenerateParsingCode(printer);
}
void FieldGeneratorBase::AddDeprecatedFlag(io::Printer* printer) {
if (descriptor_->options().deprecated()) {
printer->Print("[global::System.ObsoleteAttribute]\n");

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

Loading…
Cancel
Save