Sync from Piper @316511779
PROTOBUF_SYNC_PIPER
diff --git a/CHANGES.txt b/CHANGES.txt
index 43be322..0f540f7 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -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)
diff --git a/Protobuf.podspec b/Protobuf.podspec
index a05b712..3b7a716 100644
--- a/Protobuf.podspec
+++ b/Protobuf.podspec
@@ -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'
diff --git a/conformance/failure_list_csharp.txt b/conformance/failure_list_csharp.txt
index f82f0f2..31bdf25 100644
--- a/conformance/failure_list_csharp.txt
+++ b/conformance/failure_list_csharp.txt
@@ -1,4 +1,3 @@
Recommended.Proto3.JsonInput.BytesFieldBase64Url.JsonOutput
Recommended.Proto3.JsonInput.BytesFieldBase64Url.ProtobufOutput
-Required.Proto2.JsonInput.StoresDefaultPrimitive.Validator
Recommended.Proto2.JsonInput.FieldNameExtension.Validator
diff --git a/conformance/failure_list_python.txt b/conformance/failure_list_python.txt
index 3f7a811..e69de29 100644
--- a/conformance/failure_list_python.txt
+++ b/conformance/failure_list_python.txt
@@ -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
diff --git a/conformance/failure_list_python_cpp.txt b/conformance/failure_list_python_cpp.txt
index df16455..9efb6cf 100644
--- a/conformance/failure_list_python_cpp.txt
+++ b/conformance/failure_list_python_cpp.txt
@@ -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
diff --git a/csharp/Google.Protobuf.Tools.nuspec b/csharp/Google.Protobuf.Tools.nuspec
index 50aca1b..d0c088f 100644
--- a/csharp/Google.Protobuf.Tools.nuspec
+++ b/csharp/Google.Protobuf.Tools.nuspec
@@ -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>
diff --git a/csharp/src/AddressBook/Addressbook.cs b/csharp/src/AddressBook/Addressbook.cs
index 3b1da4d..1b1c1b6 100644
--- a/csharp/src/AddressBook/Addressbook.cs
+++ b/csharp/src/AddressBook/Addressbook.cs
@@ -49,7 +49,11 @@
/// <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 @@
[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 @@
}
}
}
+ #endif
#region Nested types
/// <summary>Container for nested types declared in the Person message type.</summary>
@@ -304,7 +344,11 @@
[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 @@
[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 @@
}
}
}
+ #endif
}
@@ -474,7 +539,11 @@
/// <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 @@
[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 @@
}
}
}
+ #endif
}
diff --git a/csharp/src/Google.Protobuf.Benchmarks/BenchmarkMessage1Proto3.cs b/csharp/src/Google.Protobuf.Benchmarks/BenchmarkMessage1Proto3.cs
index 291a585..6a21334 100644
--- a/csharp/src/Google.Protobuf.Benchmarks/BenchmarkMessage1Proto3.cs
+++ b/csharp/src/Google.Protobuf.Benchmarks/BenchmarkMessage1Proto3.cs
@@ -64,7 +64,11 @@
}
#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 @@
[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 @@
}
}
}
+ #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 @@
[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 @@
}
}
}
+ #endif
}
diff --git a/csharp/src/Google.Protobuf.Benchmarks/Benchmarks.cs b/csharp/src/Google.Protobuf.Benchmarks/Benchmarks.cs
index 456edbf..ce2248a 100644
--- a/csharp/src/Google.Protobuf.Benchmarks/Benchmarks.cs
+++ b/csharp/src/Google.Protobuf.Benchmarks/Benchmarks.cs
@@ -38,7 +38,11 @@
}
#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 @@
[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 @@
}
}
}
+ #endif
}
diff --git a/csharp/src/Google.Protobuf.Benchmarks/ParseMessagesBenchmark.cs b/csharp/src/Google.Protobuf.Benchmarks/ParseMessagesBenchmark.cs
index 30f3e9e..92c3dbe 100644
--- a/csharp/src/Google.Protobuf.Benchmarks/ParseMessagesBenchmark.cs
+++ b/csharp/src/Google.Protobuf.Benchmarks/ParseMessagesBenchmark.cs
@@ -37,6 +37,7 @@
using System.Linq;
using System.Buffers;
using Google.Protobuf.WellKnownTypes;
+using Benchmarks.Proto3;
namespace Google.Protobuf.Benchmarks
{
@@ -50,6 +51,7 @@
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 };
@@ -84,6 +86,18 @@
}
[Benchmark]
+ public IMessage RepeatedFieldMessage_ParseFromByteArray()
+ {
+ return repeatedFieldTest.ParseFromByteArray();
+ }
+
+ [Benchmark]
+ public IMessage RepeatedFieldMessage_ParseFromReadOnlySequence()
+ {
+ return repeatedFieldTest.ParseFromReadOnlySequence();
+ }
+
+ [Benchmark]
public IMessage EmptyMessage_ParseFromByteArray()
{
return emptyMessageTest.ParseFromByteArray();
@@ -123,6 +137,20 @@
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 @@
};
}
+ 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;
diff --git a/csharp/src/Google.Protobuf.Benchmarks/WrapperBenchmarkMessages.cs b/csharp/src/Google.Protobuf.Benchmarks/WrapperBenchmarkMessages.cs
index 76e95d6..95f613e 100644
--- a/csharp/src/Google.Protobuf.Benchmarks/WrapperBenchmarkMessages.cs
+++ b/csharp/src/Google.Protobuf.Benchmarks/WrapperBenchmarkMessages.cs
@@ -237,7 +237,11 @@
/// a message that has a large number of wrapper fields
/// obfuscated version of an internal message
/// </summary>
- public sealed partial class ManyWrapperFieldsMessage : pb::IMessage<ManyWrapperFieldsMessage>, pb::IBufferMessage {
+ public sealed partial class ManyWrapperFieldsMessage : pb::IMessage<ManyWrapperFieldsMessage>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<ManyWrapperFieldsMessage> _parser = new pb::MessageParser<ManyWrapperFieldsMessage>(() => new ManyWrapperFieldsMessage());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -3303,9 +3307,787 @@
[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: {
+ double? value = _single_doubleField1_codec.Read(input);
+ if (doubleField1_ == null || value != 0D) {
+ DoubleField1 = value;
+ }
+ break;
+ }
+ case 18: {
+ long? value = _single_int64Field2_codec.Read(input);
+ if (int64Field2_ == null || value != 0L) {
+ Int64Field2 = value;
+ }
+ break;
+ }
+ case 26: {
+ long? value = _single_int64Field3_codec.Read(input);
+ if (int64Field3_ == null || value != 0L) {
+ Int64Field3 = value;
+ }
+ break;
+ }
+ case 34: {
+ long? value = _single_int64Field4_codec.Read(input);
+ if (int64Field4_ == null || value != 0L) {
+ Int64Field4 = value;
+ }
+ break;
+ }
+ case 58: {
+ double? value = _single_doubleField7_codec.Read(input);
+ if (doubleField7_ == null || value != 0D) {
+ DoubleField7 = value;
+ }
+ break;
+ }
+ case 66: {
+ double? value = _single_doubleField8_codec.Read(input);
+ if (doubleField8_ == null || value != 0D) {
+ DoubleField8 = value;
+ }
+ break;
+ }
+ case 74: {
+ double? value = _single_doubleField9_codec.Read(input);
+ if (doubleField9_ == null || value != 0D) {
+ DoubleField9 = value;
+ }
+ break;
+ }
+ case 82: {
+ double? value = _single_doubleField10_codec.Read(input);
+ if (doubleField10_ == null || value != 0D) {
+ DoubleField10 = value;
+ }
+ break;
+ }
+ case 90: {
+ double? value = _single_doubleField11_codec.Read(input);
+ if (doubleField11_ == null || value != 0D) {
+ DoubleField11 = value;
+ }
+ break;
+ }
+ case 114: {
+ double? value = _single_doubleField14_codec.Read(input);
+ if (doubleField14_ == null || value != 0D) {
+ DoubleField14 = value;
+ }
+ break;
+ }
+ case 122: {
+ double? value = _single_doubleField15_codec.Read(input);
+ if (doubleField15_ == null || value != 0D) {
+ DoubleField15 = value;
+ }
+ break;
+ }
+ case 154: {
+ long? value = _single_int64Field19_codec.Read(input);
+ if (int64Field19_ == null || value != 0L) {
+ Int64Field19 = value;
+ }
+ break;
+ }
+ case 162: {
+ double? value = _single_doubleField20_codec.Read(input);
+ if (doubleField20_ == null || value != 0D) {
+ DoubleField20 = value;
+ }
+ break;
+ }
+ case 170: {
+ double? value = _single_doubleField21_codec.Read(input);
+ if (doubleField21_ == null || value != 0D) {
+ DoubleField21 = value;
+ }
+ break;
+ }
+ case 178: {
+ double? value = _single_doubleField22_codec.Read(input);
+ if (doubleField22_ == null || value != 0D) {
+ DoubleField22 = value;
+ }
+ break;
+ }
+ case 202: {
+ double? value = _single_doubleField25_codec.Read(input);
+ if (doubleField25_ == null || value != 0D) {
+ DoubleField25 = value;
+ }
+ break;
+ }
+ case 210: {
+ long? value = _single_int64Field26_codec.Read(input);
+ if (int64Field26_ == null || value != 0L) {
+ Int64Field26 = value;
+ }
+ break;
+ }
+ case 226: {
+ double? value = _single_doubleField28_codec.Read(input);
+ if (doubleField28_ == null || value != 0D) {
+ DoubleField28 = value;
+ }
+ break;
+ }
+ case 234: {
+ double? value = _single_doubleField29_codec.Read(input);
+ if (doubleField29_ == null || value != 0D) {
+ DoubleField29 = value;
+ }
+ break;
+ }
+ case 242: {
+ double? value = _single_doubleField30_codec.Read(input);
+ if (doubleField30_ == null || value != 0D) {
+ DoubleField30 = value;
+ }
+ break;
+ }
+ case 250: {
+ double? value = _single_doubleField31_codec.Read(input);
+ if (doubleField31_ == null || value != 0D) {
+ DoubleField31 = value;
+ }
+ break;
+ }
+ case 258: {
+ long? value = _single_int64Field32_codec.Read(input);
+ if (int64Field32_ == null || value != 0L) {
+ Int64Field32 = value;
+ }
+ break;
+ }
+ case 298: {
+ long? value = _single_int64Field37_codec.Read(input);
+ if (int64Field37_ == null || value != 0L) {
+ Int64Field37 = value;
+ }
+ break;
+ }
+ case 306: {
+ double? value = _single_doubleField38_codec.Read(input);
+ if (doubleField38_ == null || value != 0D) {
+ DoubleField38 = value;
+ }
+ break;
+ }
+ case 314: {
+ long? value = _single_interactions_codec.Read(input);
+ if (interactions_ == null || value != 0L) {
+ Interactions = value;
+ }
+ break;
+ }
+ case 322: {
+ double? value = _single_doubleField40_codec.Read(input);
+ if (doubleField40_ == null || value != 0D) {
+ DoubleField40 = value;
+ }
+ break;
+ }
+ case 330: {
+ long? value = _single_int64Field41_codec.Read(input);
+ if (int64Field41_ == null || value != 0L) {
+ Int64Field41 = value;
+ }
+ break;
+ }
+ case 338: {
+ double? value = _single_doubleField42_codec.Read(input);
+ if (doubleField42_ == null || value != 0D) {
+ DoubleField42 = value;
+ }
+ break;
+ }
+ case 346: {
+ long? value = _single_int64Field43_codec.Read(input);
+ if (int64Field43_ == null || value != 0L) {
+ Int64Field43 = value;
+ }
+ break;
+ }
+ case 354: {
+ long? value = _single_int64Field44_codec.Read(input);
+ if (int64Field44_ == null || value != 0L) {
+ Int64Field44 = value;
+ }
+ break;
+ }
+ case 362: {
+ double? value = _single_doubleField45_codec.Read(input);
+ if (doubleField45_ == null || value != 0D) {
+ DoubleField45 = value;
+ }
+ break;
+ }
+ case 370: {
+ double? value = _single_doubleField46_codec.Read(input);
+ if (doubleField46_ == null || value != 0D) {
+ DoubleField46 = value;
+ }
+ break;
+ }
+ case 378: {
+ double? value = _single_doubleField47_codec.Read(input);
+ if (doubleField47_ == null || value != 0D) {
+ DoubleField47 = value;
+ }
+ break;
+ }
+ case 386: {
+ double? value = _single_doubleField48_codec.Read(input);
+ if (doubleField48_ == null || value != 0D) {
+ DoubleField48 = value;
+ }
+ break;
+ }
+ case 394: {
+ double? value = _single_doubleField49_codec.Read(input);
+ if (doubleField49_ == null || value != 0D) {
+ DoubleField49 = value;
+ }
+ break;
+ }
+ case 402: {
+ double? value = _single_doubleField50_codec.Read(input);
+ if (doubleField50_ == null || value != 0D) {
+ DoubleField50 = value;
+ }
+ break;
+ }
+ case 410: {
+ double? value = _single_doubleField51_codec.Read(input);
+ if (doubleField51_ == null || value != 0D) {
+ DoubleField51 = value;
+ }
+ break;
+ }
+ case 418: {
+ double? value = _single_doubleField52_codec.Read(input);
+ if (doubleField52_ == null || value != 0D) {
+ DoubleField52 = value;
+ }
+ break;
+ }
+ case 426: {
+ double? value = _single_doubleField53_codec.Read(input);
+ if (doubleField53_ == null || value != 0D) {
+ DoubleField53 = value;
+ }
+ break;
+ }
+ case 434: {
+ double? value = _single_doubleField54_codec.Read(input);
+ if (doubleField54_ == null || value != 0D) {
+ DoubleField54 = value;
+ }
+ break;
+ }
+ case 442: {
+ double? value = _single_doubleField55_codec.Read(input);
+ if (doubleField55_ == null || value != 0D) {
+ DoubleField55 = value;
+ }
+ break;
+ }
+ case 450: {
+ double? value = _single_doubleField56_codec.Read(input);
+ if (doubleField56_ == null || value != 0D) {
+ DoubleField56 = value;
+ }
+ break;
+ }
+ case 458: {
+ double? value = _single_doubleField57_codec.Read(input);
+ if (doubleField57_ == null || value != 0D) {
+ DoubleField57 = value;
+ }
+ break;
+ }
+ case 466: {
+ double? value = _single_doubleField58_codec.Read(input);
+ if (doubleField58_ == null || value != 0D) {
+ DoubleField58 = value;
+ }
+ break;
+ }
+ case 474: {
+ long? value = _single_int64Field59_codec.Read(input);
+ if (int64Field59_ == null || value != 0L) {
+ Int64Field59 = value;
+ }
+ break;
+ }
+ case 482: {
+ long? value = _single_int64Field60_codec.Read(input);
+ if (int64Field60_ == null || value != 0L) {
+ Int64Field60 = value;
+ }
+ break;
+ }
+ case 498: {
+ double? value = _single_doubleField62_codec.Read(input);
+ if (doubleField62_ == null || value != 0D) {
+ DoubleField62 = value;
+ }
+ break;
+ }
+ case 522: {
+ double? value = _single_doubleField65_codec.Read(input);
+ if (doubleField65_ == null || value != 0D) {
+ DoubleField65 = value;
+ }
+ break;
+ }
+ case 530: {
+ double? value = _single_doubleField66_codec.Read(input);
+ if (doubleField66_ == null || value != 0D) {
+ DoubleField66 = value;
+ }
+ break;
+ }
+ case 538: {
+ double? value = _single_doubleField67_codec.Read(input);
+ if (doubleField67_ == null || value != 0D) {
+ DoubleField67 = value;
+ }
+ break;
+ }
+ case 546: {
+ double? value = _single_doubleField68_codec.Read(input);
+ if (doubleField68_ == null || value != 0D) {
+ DoubleField68 = value;
+ }
+ break;
+ }
+ case 554: {
+ double? value = _single_doubleField69_codec.Read(input);
+ if (doubleField69_ == null || value != 0D) {
+ DoubleField69 = value;
+ }
+ break;
+ }
+ case 562: {
+ double? value = _single_doubleField70_codec.Read(input);
+ if (doubleField70_ == null || value != 0D) {
+ DoubleField70 = value;
+ }
+ break;
+ }
+ case 570: {
+ double? value = _single_doubleField71_codec.Read(input);
+ if (doubleField71_ == null || value != 0D) {
+ DoubleField71 = value;
+ }
+ break;
+ }
+ case 578: {
+ double? value = _single_doubleField72_codec.Read(input);
+ if (doubleField72_ == null || value != 0D) {
+ DoubleField72 = value;
+ }
+ break;
+ }
+ case 586: {
+ string value = _single_stringField73_codec.Read(input);
+ if (stringField73_ == null || value != "") {
+ StringField73 = value;
+ }
+ break;
+ }
+ case 594: {
+ string value = _single_stringField74_codec.Read(input);
+ if (stringField74_ == null || value != "") {
+ StringField74 = value;
+ }
+ break;
+ }
+ case 602: {
+ double? value = _single_doubleField75_codec.Read(input);
+ if (doubleField75_ == null || value != 0D) {
+ DoubleField75 = value;
+ }
+ break;
+ }
+ case 618: {
+ double? value = _single_doubleField77_codec.Read(input);
+ if (doubleField77_ == null || value != 0D) {
+ DoubleField77 = value;
+ }
+ break;
+ }
+ case 626: {
+ double? value = _single_doubleField78_codec.Read(input);
+ if (doubleField78_ == null || value != 0D) {
+ DoubleField78 = value;
+ }
+ break;
+ }
+ case 634: {
+ double? value = _single_doubleField79_codec.Read(input);
+ if (doubleField79_ == null || value != 0D) {
+ DoubleField79 = value;
+ }
+ break;
+ }
+ case 640: {
+ EnumField80 = input.ReadInt32();
+ break;
+ }
+ case 648: {
+ EnumField81 = input.ReadInt32();
+ break;
+ }
+ case 658: {
+ long? value = _single_int64Field82_codec.Read(input);
+ if (int64Field82_ == null || value != 0L) {
+ Int64Field82 = value;
+ }
+ break;
+ }
+ case 664: {
+ EnumField83 = input.ReadInt32();
+ break;
+ }
+ case 674: {
+ double? value = _single_doubleField84_codec.Read(input);
+ if (doubleField84_ == null || value != 0D) {
+ DoubleField84 = value;
+ }
+ break;
+ }
+ case 682: {
+ long? value = _single_int64Field85_codec.Read(input);
+ if (int64Field85_ == null || value != 0L) {
+ Int64Field85 = value;
+ }
+ break;
+ }
+ case 690: {
+ long? value = _single_int64Field86_codec.Read(input);
+ if (int64Field86_ == null || value != 0L) {
+ Int64Field86 = value;
+ }
+ break;
+ }
+ case 698: {
+ long? value = _single_int64Field87_codec.Read(input);
+ if (int64Field87_ == null || value != 0L) {
+ Int64Field87 = value;
+ }
+ break;
+ }
+ case 706: {
+ double? value = _single_doubleField88_codec.Read(input);
+ if (doubleField88_ == null || value != 0D) {
+ DoubleField88 = value;
+ }
+ break;
+ }
+ case 714: {
+ double? value = _single_doubleField89_codec.Read(input);
+ if (doubleField89_ == null || value != 0D) {
+ DoubleField89 = value;
+ }
+ break;
+ }
+ case 722: {
+ double? value = _single_doubleField90_codec.Read(input);
+ if (doubleField90_ == null || value != 0D) {
+ DoubleField90 = value;
+ }
+ break;
+ }
+ case 730: {
+ double? value = _single_doubleField91_codec.Read(input);
+ if (doubleField91_ == null || value != 0D) {
+ DoubleField91 = value;
+ }
+ break;
+ }
+ case 738: {
+ double? value = _single_doubleField92_codec.Read(input);
+ if (doubleField92_ == null || value != 0D) {
+ DoubleField92 = value;
+ }
+ break;
+ }
+ case 746: {
+ double? value = _single_doubleField93_codec.Read(input);
+ if (doubleField93_ == null || value != 0D) {
+ DoubleField93 = value;
+ }
+ break;
+ }
+ case 754: {
+ double? value = _single_doubleField94_codec.Read(input);
+ if (doubleField94_ == null || value != 0D) {
+ DoubleField94 = value;
+ }
+ break;
+ }
+ case 762: {
+ double? value = _single_doubleField95_codec.Read(input);
+ if (doubleField95_ == null || value != 0D) {
+ DoubleField95 = value;
+ }
+ break;
+ }
+ case 770: {
+ double? value = _single_doubleField96_codec.Read(input);
+ if (doubleField96_ == null || value != 0D) {
+ DoubleField96 = value;
+ }
+ break;
+ }
+ case 778: {
+ double? value = _single_doubleField97_codec.Read(input);
+ if (doubleField97_ == null || value != 0D) {
+ DoubleField97 = value;
+ }
+ break;
+ }
+ case 786: {
+ double? value = _single_doubleField98_codec.Read(input);
+ if (doubleField98_ == null || value != 0D) {
+ DoubleField98 = value;
+ }
+ break;
+ }
+ case 794: {
+ double? value = _single_doubleField99_codec.Read(input);
+ if (doubleField99_ == null || value != 0D) {
+ DoubleField99 = value;
+ }
+ break;
+ }
+ case 802:
+ case 800: {
+ repeatedIntField100_.AddEntriesFrom(input, _repeated_repeatedIntField100_codec);
+ break;
+ }
+ case 810: {
+ double? value = _single_doubleField101_codec.Read(input);
+ if (doubleField101_ == null || value != 0D) {
+ DoubleField101 = value;
+ }
+ break;
+ }
+ case 818: {
+ double? value = _single_doubleField102_codec.Read(input);
+ if (doubleField102_ == null || value != 0D) {
+ DoubleField102 = value;
+ }
+ break;
+ }
+ case 826: {
+ double? value = _single_doubleField103_codec.Read(input);
+ if (doubleField103_ == null || value != 0D) {
+ DoubleField103 = value;
+ }
+ break;
+ }
+ case 834: {
+ double? value = _single_doubleField104_codec.Read(input);
+ if (doubleField104_ == null || value != 0D) {
+ DoubleField104 = value;
+ }
+ break;
+ }
+ case 842: {
+ double? value = _single_doubleField105_codec.Read(input);
+ if (doubleField105_ == null || value != 0D) {
+ DoubleField105 = value;
+ }
+ break;
+ }
+ case 850: {
+ double? value = _single_doubleField106_codec.Read(input);
+ if (doubleField106_ == null || value != 0D) {
+ DoubleField106 = value;
+ }
+ break;
+ }
+ case 858: {
+ long? value = _single_int64Field107_codec.Read(input);
+ if (int64Field107_ == null || value != 0L) {
+ Int64Field107 = value;
+ }
+ break;
+ }
+ case 866: {
+ double? value = _single_doubleField108_codec.Read(input);
+ if (doubleField108_ == null || value != 0D) {
+ DoubleField108 = value;
+ }
+ break;
+ }
+ case 874: {
+ double? value = _single_doubleField109_codec.Read(input);
+ if (doubleField109_ == null || value != 0D) {
+ DoubleField109 = value;
+ }
+ break;
+ }
+ case 882: {
+ long? value = _single_int64Field110_codec.Read(input);
+ if (int64Field110_ == null || value != 0L) {
+ Int64Field110 = value;
+ }
+ break;
+ }
+ case 890: {
+ double? value = _single_doubleField111_codec.Read(input);
+ if (doubleField111_ == null || value != 0D) {
+ DoubleField111 = value;
+ }
+ break;
+ }
+ case 898: {
+ long? value = _single_int64Field112_codec.Read(input);
+ if (int64Field112_ == null || value != 0L) {
+ Int64Field112 = value;
+ }
+ break;
+ }
+ case 906: {
+ double? value = _single_doubleField113_codec.Read(input);
+ if (doubleField113_ == null || value != 0D) {
+ DoubleField113 = value;
+ }
+ break;
+ }
+ case 914: {
+ long? value = _single_int64Field114_codec.Read(input);
+ if (int64Field114_ == null || value != 0L) {
+ Int64Field114 = value;
+ }
+ break;
+ }
+ case 922: {
+ long? value = _single_int64Field115_codec.Read(input);
+ if (int64Field115_ == null || value != 0L) {
+ Int64Field115 = value;
+ }
+ break;
+ }
+ case 930: {
+ double? value = _single_doubleField116_codec.Read(input);
+ if (doubleField116_ == null || value != 0D) {
+ DoubleField116 = value;
+ }
+ break;
+ }
+ case 938: {
+ long? value = _single_int64Field117_codec.Read(input);
+ if (int64Field117_ == null || value != 0L) {
+ Int64Field117 = value;
+ }
+ break;
+ }
+ case 946: {
+ double? value = _single_doubleField118_codec.Read(input);
+ if (doubleField118_ == null || value != 0D) {
+ DoubleField118 = value;
+ }
+ break;
+ }
+ case 954: {
+ double? value = _single_doubleField119_codec.Read(input);
+ if (doubleField119_ == null || value != 0D) {
+ DoubleField119 = value;
+ }
+ break;
+ }
+ case 962: {
+ double? value = _single_doubleField120_codec.Read(input);
+ if (doubleField120_ == null || value != 0D) {
+ DoubleField120 = value;
+ }
+ break;
+ }
+ case 970: {
+ double? value = _single_doubleField121_codec.Read(input);
+ if (doubleField121_ == null || value != 0D) {
+ DoubleField121 = value;
+ }
+ break;
+ }
+ case 978: {
+ double? value = _single_doubleField122_codec.Read(input);
+ if (doubleField122_ == null || value != 0D) {
+ DoubleField122 = value;
+ }
+ break;
+ }
+ case 986: {
+ double? value = _single_doubleField123_codec.Read(input);
+ if (doubleField123_ == null || value != 0D) {
+ DoubleField123 = value;
+ }
+ break;
+ }
+ case 994: {
+ double? value = _single_doubleField124_codec.Read(input);
+ if (doubleField124_ == null || value != 0D) {
+ DoubleField124 = value;
+ }
+ break;
+ }
+ case 1002: {
+ long? value = _single_int64Field125_codec.Read(input);
+ if (int64Field125_ == null || value != 0L) {
+ Int64Field125 = value;
+ }
+ break;
+ }
+ case 1010: {
+ long? value = _single_int64Field126_codec.Read(input);
+ if (int64Field126_ == null || value != 0L) {
+ Int64Field126 = value;
+ }
+ break;
+ }
+ case 1018: {
+ long? value = _single_int64Field127_codec.Read(input);
+ if (int64Field127_ == null || value != 0L) {
+ Int64Field127 = value;
+ }
+ break;
+ }
+ case 1026: {
+ double? value = _single_doubleField128_codec.Read(input);
+ if (doubleField128_ == null || value != 0D) {
+ DoubleField128 = value;
+ }
+ break;
+ }
+ case 1034: {
+ double? value = _single_doubleField129_codec.Read(input);
+ if (doubleField129_ == null || value != 0D) {
+ DoubleField129 = value;
+ }
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -4083,6 +4865,7 @@
}
}
}
+ #endif
}
@@ -4090,7 +4873,11 @@
/// same as ManyWrapperFieldsMessages, but with primitive fields
/// for comparison.
/// </summary>
- public sealed partial class ManyPrimitiveFieldsMessage : pb::IMessage<ManyPrimitiveFieldsMessage>, pb::IBufferMessage {
+ public sealed partial class ManyPrimitiveFieldsMessage : pb::IMessage<ManyPrimitiveFieldsMessage>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<ManyPrimitiveFieldsMessage> _parser = new pb::MessageParser<ManyPrimitiveFieldsMessage>(() => new ManyPrimitiveFieldsMessage());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -6835,9 +7622,466 @@
[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: {
+ DoubleField1 = input.ReadDouble();
+ break;
+ }
+ case 16: {
+ Int64Field2 = input.ReadInt64();
+ break;
+ }
+ case 24: {
+ Int64Field3 = input.ReadInt64();
+ break;
+ }
+ case 32: {
+ Int64Field4 = input.ReadInt64();
+ break;
+ }
+ case 57: {
+ DoubleField7 = input.ReadDouble();
+ break;
+ }
+ case 65: {
+ DoubleField8 = input.ReadDouble();
+ break;
+ }
+ case 73: {
+ DoubleField9 = input.ReadDouble();
+ break;
+ }
+ case 81: {
+ DoubleField10 = input.ReadDouble();
+ break;
+ }
+ case 89: {
+ DoubleField11 = input.ReadDouble();
+ break;
+ }
+ case 113: {
+ DoubleField14 = input.ReadDouble();
+ break;
+ }
+ case 121: {
+ DoubleField15 = input.ReadDouble();
+ break;
+ }
+ case 152: {
+ Int64Field19 = input.ReadInt64();
+ break;
+ }
+ case 161: {
+ DoubleField20 = input.ReadDouble();
+ break;
+ }
+ case 169: {
+ DoubleField21 = input.ReadDouble();
+ break;
+ }
+ case 177: {
+ DoubleField22 = input.ReadDouble();
+ break;
+ }
+ case 201: {
+ DoubleField25 = input.ReadDouble();
+ break;
+ }
+ case 208: {
+ Int64Field26 = input.ReadInt64();
+ break;
+ }
+ case 225: {
+ DoubleField28 = input.ReadDouble();
+ break;
+ }
+ case 233: {
+ DoubleField29 = input.ReadDouble();
+ break;
+ }
+ case 241: {
+ DoubleField30 = input.ReadDouble();
+ break;
+ }
+ case 249: {
+ DoubleField31 = input.ReadDouble();
+ break;
+ }
+ case 256: {
+ Int64Field32 = input.ReadInt64();
+ break;
+ }
+ case 296: {
+ Int64Field37 = input.ReadInt64();
+ break;
+ }
+ case 305: {
+ DoubleField38 = input.ReadDouble();
+ break;
+ }
+ case 312: {
+ Interactions = input.ReadInt64();
+ break;
+ }
+ case 321: {
+ DoubleField40 = input.ReadDouble();
+ break;
+ }
+ case 328: {
+ Int64Field41 = input.ReadInt64();
+ break;
+ }
+ case 337: {
+ DoubleField42 = input.ReadDouble();
+ break;
+ }
+ case 344: {
+ Int64Field43 = input.ReadInt64();
+ break;
+ }
+ case 352: {
+ Int64Field44 = input.ReadInt64();
+ break;
+ }
+ case 361: {
+ DoubleField45 = input.ReadDouble();
+ break;
+ }
+ case 369: {
+ DoubleField46 = input.ReadDouble();
+ break;
+ }
+ case 377: {
+ DoubleField47 = input.ReadDouble();
+ break;
+ }
+ case 385: {
+ DoubleField48 = input.ReadDouble();
+ break;
+ }
+ case 393: {
+ DoubleField49 = input.ReadDouble();
+ break;
+ }
+ case 401: {
+ DoubleField50 = input.ReadDouble();
+ break;
+ }
+ case 409: {
+ DoubleField51 = input.ReadDouble();
+ break;
+ }
+ case 417: {
+ DoubleField52 = input.ReadDouble();
+ break;
+ }
+ case 425: {
+ DoubleField53 = input.ReadDouble();
+ break;
+ }
+ case 433: {
+ DoubleField54 = input.ReadDouble();
+ break;
+ }
+ case 441: {
+ DoubleField55 = input.ReadDouble();
+ break;
+ }
+ case 449: {
+ DoubleField56 = input.ReadDouble();
+ break;
+ }
+ case 457: {
+ DoubleField57 = input.ReadDouble();
+ break;
+ }
+ case 465: {
+ DoubleField58 = input.ReadDouble();
+ break;
+ }
+ case 472: {
+ Int64Field59 = input.ReadInt64();
+ break;
+ }
+ case 480: {
+ Int64Field60 = input.ReadInt64();
+ break;
+ }
+ case 497: {
+ DoubleField62 = input.ReadDouble();
+ break;
+ }
+ case 521: {
+ DoubleField65 = input.ReadDouble();
+ break;
+ }
+ case 529: {
+ DoubleField66 = input.ReadDouble();
+ break;
+ }
+ case 537: {
+ DoubleField67 = input.ReadDouble();
+ break;
+ }
+ case 545: {
+ DoubleField68 = input.ReadDouble();
+ break;
+ }
+ case 553: {
+ DoubleField69 = input.ReadDouble();
+ break;
+ }
+ case 561: {
+ DoubleField70 = input.ReadDouble();
+ break;
+ }
+ case 569: {
+ DoubleField71 = input.ReadDouble();
+ break;
+ }
+ case 577: {
+ DoubleField72 = input.ReadDouble();
+ break;
+ }
+ case 586: {
+ StringField73 = input.ReadString();
+ break;
+ }
+ case 594: {
+ StringField74 = input.ReadString();
+ break;
+ }
+ case 601: {
+ DoubleField75 = input.ReadDouble();
+ break;
+ }
+ case 617: {
+ DoubleField77 = input.ReadDouble();
+ break;
+ }
+ case 625: {
+ DoubleField78 = input.ReadDouble();
+ break;
+ }
+ case 633: {
+ DoubleField79 = input.ReadDouble();
+ break;
+ }
+ case 640: {
+ EnumField80 = input.ReadInt32();
+ break;
+ }
+ case 648: {
+ EnumField81 = input.ReadInt32();
+ break;
+ }
+ case 656: {
+ Int64Field82 = input.ReadInt64();
+ break;
+ }
+ case 664: {
+ EnumField83 = input.ReadInt32();
+ break;
+ }
+ case 673: {
+ DoubleField84 = input.ReadDouble();
+ break;
+ }
+ case 680: {
+ Int64Field85 = input.ReadInt64();
+ break;
+ }
+ case 688: {
+ Int64Field86 = input.ReadInt64();
+ break;
+ }
+ case 696: {
+ Int64Field87 = input.ReadInt64();
+ break;
+ }
+ case 705: {
+ DoubleField88 = input.ReadDouble();
+ break;
+ }
+ case 713: {
+ DoubleField89 = input.ReadDouble();
+ break;
+ }
+ case 721: {
+ DoubleField90 = input.ReadDouble();
+ break;
+ }
+ case 729: {
+ DoubleField91 = input.ReadDouble();
+ break;
+ }
+ case 737: {
+ DoubleField92 = input.ReadDouble();
+ break;
+ }
+ case 745: {
+ DoubleField93 = input.ReadDouble();
+ break;
+ }
+ case 753: {
+ DoubleField94 = input.ReadDouble();
+ break;
+ }
+ case 761: {
+ DoubleField95 = input.ReadDouble();
+ break;
+ }
+ case 769: {
+ DoubleField96 = input.ReadDouble();
+ break;
+ }
+ case 777: {
+ DoubleField97 = input.ReadDouble();
+ break;
+ }
+ case 785: {
+ DoubleField98 = input.ReadDouble();
+ break;
+ }
+ case 793: {
+ DoubleField99 = input.ReadDouble();
+ break;
+ }
+ case 802:
+ case 800: {
+ repeatedIntField100_.AddEntriesFrom(input, _repeated_repeatedIntField100_codec);
+ break;
+ }
+ case 809: {
+ DoubleField101 = input.ReadDouble();
+ break;
+ }
+ case 817: {
+ DoubleField102 = input.ReadDouble();
+ break;
+ }
+ case 825: {
+ DoubleField103 = input.ReadDouble();
+ break;
+ }
+ case 833: {
+ DoubleField104 = input.ReadDouble();
+ break;
+ }
+ case 841: {
+ DoubleField105 = input.ReadDouble();
+ break;
+ }
+ case 849: {
+ DoubleField106 = input.ReadDouble();
+ break;
+ }
+ case 856: {
+ Int64Field107 = input.ReadInt64();
+ break;
+ }
+ case 865: {
+ DoubleField108 = input.ReadDouble();
+ break;
+ }
+ case 873: {
+ DoubleField109 = input.ReadDouble();
+ break;
+ }
+ case 880: {
+ Int64Field110 = input.ReadInt64();
+ break;
+ }
+ case 889: {
+ DoubleField111 = input.ReadDouble();
+ break;
+ }
+ case 896: {
+ Int64Field112 = input.ReadInt64();
+ break;
+ }
+ case 905: {
+ DoubleField113 = input.ReadDouble();
+ break;
+ }
+ case 912: {
+ Int64Field114 = input.ReadInt64();
+ break;
+ }
+ case 920: {
+ Int64Field115 = input.ReadInt64();
+ break;
+ }
+ case 929: {
+ DoubleField116 = input.ReadDouble();
+ break;
+ }
+ case 936: {
+ Int64Field117 = input.ReadInt64();
+ break;
+ }
+ case 945: {
+ DoubleField118 = input.ReadDouble();
+ break;
+ }
+ case 953: {
+ DoubleField119 = input.ReadDouble();
+ break;
+ }
+ case 961: {
+ DoubleField120 = input.ReadDouble();
+ break;
+ }
+ case 969: {
+ DoubleField121 = input.ReadDouble();
+ break;
+ }
+ case 977: {
+ DoubleField122 = input.ReadDouble();
+ break;
+ }
+ case 985: {
+ DoubleField123 = input.ReadDouble();
+ break;
+ }
+ case 993: {
+ DoubleField124 = input.ReadDouble();
+ break;
+ }
+ case 1000: {
+ Int64Field125 = input.ReadInt64();
+ break;
+ }
+ case 1008: {
+ Int64Field126 = input.ReadInt64();
+ break;
+ }
+ case 1016: {
+ Int64Field127 = input.ReadInt64();
+ break;
+ }
+ case 1025: {
+ DoubleField128 = input.ReadDouble();
+ break;
+ }
+ case 1033: {
+ DoubleField129 = input.ReadDouble();
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -7294,6 +8538,7 @@
}
}
}
+ #endif
}
diff --git a/csharp/src/Google.Protobuf.Conformance/Conformance.cs b/csharp/src/Google.Protobuf.Conformance/Conformance.cs
index f9bda13..2c08466 100644
--- a/csharp/src/Google.Protobuf.Conformance/Conformance.cs
+++ b/csharp/src/Google.Protobuf.Conformance/Conformance.cs
@@ -107,7 +107,11 @@
/// 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 @@
[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 @@
}
}
}
+ #endif
}
@@ -240,7 +261,11 @@
/// 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 @@
[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 @@
}
}
}
+ #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 @@
[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 @@
}
}
}
+ #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 @@
[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 @@
}
}
}
+ #endif
}
diff --git a/csharp/src/Google.Protobuf.Conformance/Program.cs b/csharp/src/Google.Protobuf.Conformance/Program.cs
index d1093ab..d721ecf 100644
--- a/csharp/src/Google.Protobuf.Conformance/Program.cs
+++ b/csharp/src/Google.Protobuf.Conformance/Program.cs
@@ -83,44 +83,52 @@
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);
+ switch (request.MessageType)
+ {
+ 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})");
+ }
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);
- }
- 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
- {
- 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);
}
diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/MapUnittestProto3.cs b/csharp/src/Google.Protobuf.Test.TestProtos/MapUnittestProto3.cs
index 8d20605..308ccbd 100644
--- a/csharp/src/Google.Protobuf.Test.TestProtos/MapUnittestProto3.cs
+++ b/csharp/src/Google.Protobuf.Test.TestProtos/MapUnittestProto3.cs
@@ -176,7 +176,11 @@
/// <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 @@
[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 @@
}
}
}
+ #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 @@
[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 @@
}
}
}
+ #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 @@
[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 @@
}
}
}
+ #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 @@
[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 @@
}
}
}
+ #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 @@
[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 @@
}
}
}
+ #endif
}
@@ -1447,7 +1679,11 @@
/// 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 @@
[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 @@
}
}
}
+ #endif
#region Nested types
/// <summary>Container for nested types declared in the MessageContainingEnumCalledType message type.</summary>
@@ -1587,7 +1840,11 @@
/// <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 @@
[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 @@
}
}
}
+ #endif
}
diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/TestMessagesProto2.cs b/csharp/src/Google.Protobuf.Test.TestProtos/TestMessagesProto2.cs
index bef3645..eb22955 100644
--- a/csharp/src/Google.Protobuf.Test.TestProtos/TestMessagesProto2.cs
+++ b/csharp/src/Google.Protobuf.Test.TestProtos/TestMessagesProto2.cs
@@ -244,7 +244,11 @@
/// 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 @@
[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 @@
}
}
}
+ #endif
public TValue GetExtension<TValue>(pb::Extension<TestAllTypesProto2, TValue> extension) {
return pb::ExtensionSet.Get(ref _extensions, extension);
@@ -3897,7 +4449,11 @@
[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 @@
[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 @@
}
}
}
+ #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 @@
[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 @@
}
}
}
+ #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 @@
[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 @@
}
}
}
+ #endif
public TValue GetExtension<TValue>(pb::Extension<MessageSetCorrect, TValue> extension) {
return pb::ExtensionSet.Get(ref _extensions, extension);
@@ -4424,7 +5050,11 @@
}
- 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 @@
[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 @@
}
}
}
+ #endif
#region Extensions
/// <summary>Container for extensions for other messages declared in the MessageSetCorrectExtension1 message type.</summary>
@@ -4579,7 +5226,11 @@
}
- 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 @@
[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 @@
}
}
}
+ #endif
#region Extensions
/// <summary>Container for extensions for other messages declared in the MessageSetCorrectExtension2 message type.</summary>
@@ -4742,7 +5410,11 @@
}
- 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 @@
[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 @@
}
}
}
+ #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 @@
[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 @@
}
}
}
+ #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 @@
[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 @@
}
}
}
+ #endif
}
diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/TestMessagesProto3.cs b/csharp/src/Google.Protobuf.Test.TestProtos/TestMessagesProto3.cs
index 465d5e8..41bc006 100644
--- a/csharp/src/Google.Protobuf.Test.TestProtos/TestMessagesProto3.cs
+++ b/csharp/src/Google.Protobuf.Test.TestProtos/TestMessagesProto3.cs
@@ -259,7 +259,11 @@
/// 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 @@
[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 @@
}
}
}
+ #endif
#region Nested types
/// <summary>Container for nested types declared in the TestAllTypesProto3 message type.</summary>
@@ -4120,7 +4836,11 @@
[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 @@
[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 @@
}
}
}
+ #endif
}
@@ -4293,7 +5037,11 @@
}
- 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 @@
[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 @@
}
}
}
+ #endif
}
diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/Unittest.cs b/csharp/src/Google.Protobuf.Test.TestProtos/Unittest.cs
index 9b5825a..373f569 100644
--- a/csharp/src/Google.Protobuf.Test.TestProtos/Unittest.cs
+++ b/csharp/src/Google.Protobuf.Test.TestProtos/Unittest.cs
@@ -1120,7 +1120,11 @@
/// This proto includes every type of field in both singular and repeated
/// forms.
/// </summary>
- public sealed partial class TestAllTypes : pb::IMessage<TestAllTypes>, pb::IBufferMessage {
+ public sealed partial class TestAllTypes : pb::IMessage<TestAllTypes>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<TestAllTypes> _parser = new pb::MessageParser<TestAllTypes>(() => new TestAllTypes());
private pb::UnknownFieldSet _unknownFields;
private int _hasBits0;
@@ -3442,9 +3446,360 @@
[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 131: {
+ if (!HasOptionalGroup) {
+ OptionalGroup = new global::Google.Protobuf.TestProtos.Proto2.TestAllTypes.Types.OptionalGroup();
+ }
+ input.ReadGroup(OptionalGroup);
+ break;
+ }
+ case 146: {
+ if (optionalNestedMessage_ == null) {
+ OptionalNestedMessage = new global::Google.Protobuf.TestProtos.Proto2.TestAllTypes.Types.NestedMessage();
+ }
+ input.ReadMessage(OptionalNestedMessage);
+ break;
+ }
+ case 154: {
+ if (optionalForeignMessage_ == null) {
+ OptionalForeignMessage = new global::Google.Protobuf.TestProtos.Proto2.ForeignMessage();
+ }
+ input.ReadMessage(OptionalForeignMessage);
+ break;
+ }
+ case 162: {
+ if (optionalImportMessage_ == null) {
+ OptionalImportMessage = new global::Google.Protobuf.TestProtos.Proto2.ImportMessage();
+ }
+ input.ReadMessage(OptionalImportMessage);
+ break;
+ }
+ case 168: {
+ OptionalNestedEnum = (global::Google.Protobuf.TestProtos.Proto2.TestAllTypes.Types.NestedEnum) input.ReadEnum();
+ break;
+ }
+ case 176: {
+ OptionalForeignEnum = (global::Google.Protobuf.TestProtos.Proto2.ForeignEnum) input.ReadEnum();
+ break;
+ }
+ case 184: {
+ OptionalImportEnum = (global::Google.Protobuf.TestProtos.Proto2.ImportEnum) input.ReadEnum();
+ break;
+ }
+ case 194: {
+ OptionalStringPiece = input.ReadString();
+ break;
+ }
+ case 202: {
+ OptionalCord = input.ReadString();
+ break;
+ }
+ case 210: {
+ if (optionalPublicImportMessage_ == null) {
+ OptionalPublicImportMessage = new global::Google.Protobuf.TestProtos.Proto2.PublicImportMessage();
+ }
+ input.ReadMessage(OptionalPublicImportMessage);
+ break;
+ }
+ case 218: {
+ if (optionalLazyMessage_ == null) {
+ OptionalLazyMessage = new global::Google.Protobuf.TestProtos.Proto2.TestAllTypes.Types.NestedMessage();
+ }
+ input.ReadMessage(OptionalLazyMessage);
+ 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 371: {
+ repeatedGroup_.AddEntriesFrom(input, _repeated_repeatedGroup_codec);
+ break;
+ }
+ case 386: {
+ repeatedNestedMessage_.AddEntriesFrom(input, _repeated_repeatedNestedMessage_codec);
+ break;
+ }
+ case 394: {
+ repeatedForeignMessage_.AddEntriesFrom(input, _repeated_repeatedForeignMessage_codec);
+ break;
+ }
+ case 402: {
+ repeatedImportMessage_.AddEntriesFrom(input, _repeated_repeatedImportMessage_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 426:
+ case 424: {
+ repeatedImportEnum_.AddEntriesFrom(input, _repeated_repeatedImportEnum_codec);
+ break;
+ }
+ case 434: {
+ repeatedStringPiece_.AddEntriesFrom(input, _repeated_repeatedStringPiece_codec);
+ break;
+ }
+ case 442: {
+ repeatedCord_.AddEntriesFrom(input, _repeated_repeatedCord_codec);
+ break;
+ }
+ case 458: {
+ repeatedLazyMessage_.AddEntriesFrom(input, _repeated_repeatedLazyMessage_codec);
+ break;
+ }
+ case 488: {
+ DefaultInt32 = input.ReadInt32();
+ break;
+ }
+ case 496: {
+ DefaultInt64 = input.ReadInt64();
+ break;
+ }
+ case 504: {
+ DefaultUint32 = input.ReadUInt32();
+ break;
+ }
+ case 512: {
+ DefaultUint64 = input.ReadUInt64();
+ break;
+ }
+ case 520: {
+ DefaultSint32 = input.ReadSInt32();
+ break;
+ }
+ case 528: {
+ DefaultSint64 = input.ReadSInt64();
+ break;
+ }
+ case 541: {
+ DefaultFixed32 = input.ReadFixed32();
+ break;
+ }
+ case 545: {
+ DefaultFixed64 = input.ReadFixed64();
+ break;
+ }
+ case 557: {
+ DefaultSfixed32 = input.ReadSFixed32();
+ break;
+ }
+ case 561: {
+ DefaultSfixed64 = input.ReadSFixed64();
+ break;
+ }
+ case 573: {
+ DefaultFloat = input.ReadFloat();
+ break;
+ }
+ case 577: {
+ DefaultDouble = input.ReadDouble();
+ break;
+ }
+ case 584: {
+ DefaultBool = input.ReadBool();
+ break;
+ }
+ case 594: {
+ DefaultString = input.ReadString();
+ break;
+ }
+ case 602: {
+ DefaultBytes = input.ReadBytes();
+ break;
+ }
+ case 648: {
+ DefaultNestedEnum = (global::Google.Protobuf.TestProtos.Proto2.TestAllTypes.Types.NestedEnum) input.ReadEnum();
+ break;
+ }
+ case 656: {
+ DefaultForeignEnum = (global::Google.Protobuf.TestProtos.Proto2.ForeignEnum) input.ReadEnum();
+ break;
+ }
+ case 664: {
+ DefaultImportEnum = (global::Google.Protobuf.TestProtos.Proto2.ImportEnum) input.ReadEnum();
+ break;
+ }
+ case 674: {
+ DefaultStringPiece = input.ReadString();
+ break;
+ }
+ case 682: {
+ DefaultCord = input.ReadString();
+ break;
+ }
+ case 888: {
+ OneofUint32 = input.ReadUInt32();
+ break;
+ }
+ case 898: {
+ global::Google.Protobuf.TestProtos.Proto2.TestAllTypes.Types.NestedMessage subBuilder = new global::Google.Protobuf.TestProtos.Proto2.TestAllTypes.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;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -3795,6 +4150,7 @@
}
}
}
+ #endif
#region Nested types
/// <summary>Container for nested types declared in the TestAllTypes message type.</summary>
@@ -3810,7 +4166,11 @@
[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;
@@ -3943,9 +4303,25 @@
[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;
@@ -3961,10 +4337,15 @@
}
}
}
+ #endif
}
- 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;
@@ -4092,9 +4473,27 @@
[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 132:
+ return;
+ default:
+ _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ break;
+ case 136: {
+ 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;
@@ -4112,10 +4511,15 @@
}
}
}
+ #endif
}
- public sealed partial class RepeatedGroup : pb::IMessage<RepeatedGroup>, pb::IBufferMessage {
+ public sealed partial class RepeatedGroup : pb::IMessage<RepeatedGroup>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<RepeatedGroup> _parser = new pb::MessageParser<RepeatedGroup>(() => new RepeatedGroup());
private pb::UnknownFieldSet _unknownFields;
private int _hasBits0;
@@ -4243,9 +4647,27 @@
[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 372:
+ return;
+ default:
+ _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ break;
+ case 376: {
+ 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;
@@ -4263,6 +4685,7 @@
}
}
}
+ #endif
}
@@ -4274,7 +4697,11 @@
/// <summary>
/// This proto includes a recursively nested message.
/// </summary>
- public sealed partial class NestedTestAllTypes : pb::IMessage<NestedTestAllTypes>, pb::IBufferMessage {
+ public sealed partial class NestedTestAllTypes : pb::IMessage<NestedTestAllTypes>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<NestedTestAllTypes> _parser = new pb::MessageParser<NestedTestAllTypes>(() => new NestedTestAllTypes());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -4433,9 +4860,39 @@
[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 (child_ == null) {
+ Child = new global::Google.Protobuf.TestProtos.Proto2.NestedTestAllTypes();
+ }
+ input.ReadMessage(Child);
+ break;
+ }
+ case 18: {
+ if (payload_ == null) {
+ Payload = new global::Google.Protobuf.TestProtos.Proto2.TestAllTypes();
+ }
+ input.ReadMessage(Payload);
+ break;
+ }
+ case 26: {
+ repeatedChild_.AddEntriesFrom(input, _repeated_repeatedChild_codec);
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -4465,10 +4922,15 @@
}
}
}
+ #endif
}
- public sealed partial class TestDeprecatedFields : pb::IMessage<TestDeprecatedFields>, pb::IBufferMessage {
+ public sealed partial class TestDeprecatedFields : pb::IMessage<TestDeprecatedFields>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<TestDeprecatedFields> _parser = new pb::MessageParser<TestDeprecatedFields>(() => new TestDeprecatedFields());
private pb::UnknownFieldSet _unknownFields;
private int _hasBits0;
@@ -4666,9 +5128,29 @@
[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: {
+ DeprecatedInt32 = input.ReadInt32();
+ break;
+ }
+ case 16: {
+ DeprecatedInt32InOneof = input.ReadInt32();
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -4688,11 +5170,16 @@
}
}
}
+ #endif
}
[global::System.ObsoleteAttribute]
- public sealed partial class TestDeprecatedMessage : pb::IMessage<TestDeprecatedMessage>, pb::IBufferMessage {
+ public sealed partial class TestDeprecatedMessage : pb::IMessage<TestDeprecatedMessage>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<TestDeprecatedMessage> _parser = new pb::MessageParser<TestDeprecatedMessage>(() => new TestDeprecatedMessage());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -4781,9 +5268,21 @@
[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;
@@ -4795,6 +5294,7 @@
}
}
}
+ #endif
}
@@ -4802,7 +5302,11 @@
/// Define these after TestAllTypes to make sure the compiler can handle
/// that.
/// </summary>
- 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;
private int _hasBits0;
@@ -4967,9 +5471,29 @@
[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;
+ }
+ case 16: {
+ 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;
@@ -4989,10 +5513,15 @@
}
}
}
+ #endif
}
- public sealed partial class TestReservedFields : pb::IMessage<TestReservedFields>, pb::IBufferMessage {
+ public sealed partial class TestReservedFields : pb::IMessage<TestReservedFields>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<TestReservedFields> _parser = new pb::MessageParser<TestReservedFields>(() => new TestReservedFields());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -5081,9 +5610,21 @@
[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;
@@ -5095,10 +5636,15 @@
}
}
}
+ #endif
}
- public sealed partial class TestAllExtensions : pb::IExtendableMessage<TestAllExtensions>, pb::IBufferMessage {
+ public sealed partial class TestAllExtensions : pb::IExtendableMessage<TestAllExtensions>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<TestAllExtensions> _parser = new pb::MessageParser<TestAllExtensions>(() => new TestAllExtensions());
private pb::UnknownFieldSet _unknownFields;
private pb::ExtensionSet<TestAllExtensions> _extensions;
@@ -5203,9 +5749,23 @@
[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;
@@ -5219,6 +5779,7 @@
}
}
}
+ #endif
public TValue GetExtension<TValue>(pb::Extension<TestAllExtensions, TValue> extension) {
return pb::ExtensionSet.Get(ref _extensions, extension);
@@ -5244,7 +5805,11 @@
}
- public sealed partial class OptionalGroup_extension : pb::IMessage<OptionalGroup_extension>, pb::IBufferMessage {
+ public sealed partial class OptionalGroup_extension : pb::IMessage<OptionalGroup_extension>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<OptionalGroup_extension> _parser = new pb::MessageParser<OptionalGroup_extension>(() => new OptionalGroup_extension());
private pb::UnknownFieldSet _unknownFields;
private int _hasBits0;
@@ -5372,9 +5937,27 @@
[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 132:
+ return;
+ default:
+ _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ break;
+ case 136: {
+ 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;
@@ -5392,10 +5975,15 @@
}
}
}
+ #endif
}
- public sealed partial class RepeatedGroup_extension : pb::IMessage<RepeatedGroup_extension>, pb::IBufferMessage {
+ public sealed partial class RepeatedGroup_extension : pb::IMessage<RepeatedGroup_extension>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<RepeatedGroup_extension> _parser = new pb::MessageParser<RepeatedGroup_extension>(() => new RepeatedGroup_extension());
private pb::UnknownFieldSet _unknownFields;
private int _hasBits0;
@@ -5523,9 +6111,27 @@
[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 372:
+ return;
+ default:
+ _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ break;
+ case 376: {
+ 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;
@@ -5543,10 +6149,15 @@
}
}
}
+ #endif
}
- public sealed partial class TestGroup : pb::IMessage<TestGroup>, pb::IBufferMessage {
+ public sealed partial class TestGroup : pb::IMessage<TestGroup>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<TestGroup> _parser = new pb::MessageParser<TestGroup>(() => new TestGroup());
private pb::UnknownFieldSet _unknownFields;
private int _hasBits0;
@@ -5712,9 +6323,32 @@
[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 131: {
+ if (!HasOptionalGroup) {
+ OptionalGroup = new global::Google.Protobuf.TestProtos.Proto2.TestGroup.Types.OptionalGroup();
+ }
+ input.ReadGroup(OptionalGroup);
+ break;
+ }
+ case 176: {
+ OptionalForeignEnum = (global::Google.Protobuf.TestProtos.Proto2.ForeignEnum) input.ReadEnum();
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -5737,12 +6371,17 @@
}
}
}
+ #endif
#region Nested types
/// <summary>Container for nested types declared in the TestGroup 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;
@@ -5870,9 +6509,27 @@
[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 132:
+ return;
+ default:
+ _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ break;
+ case 136: {
+ 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;
@@ -5890,6 +6547,7 @@
}
}
}
+ #endif
}
@@ -5898,7 +6556,11 @@
}
- public sealed partial class TestGroupExtension : pb::IExtendableMessage<TestGroupExtension>, pb::IBufferMessage {
+ public sealed partial class TestGroupExtension : pb::IExtendableMessage<TestGroupExtension>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<TestGroupExtension> _parser = new pb::MessageParser<TestGroupExtension>(() => new TestGroupExtension());
private pb::UnknownFieldSet _unknownFields;
private pb::ExtensionSet<TestGroupExtension> _extensions;
@@ -6003,9 +6665,23 @@
[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;
@@ -6019,6 +6695,7 @@
}
}
}
+ #endif
public TValue GetExtension<TValue>(pb::Extension<TestGroupExtension, TValue> extension) {
return pb::ExtensionSet.Get(ref _extensions, extension);
@@ -6044,7 +6721,11 @@
}
- public sealed partial class TestNestedExtension : pb::IMessage<TestNestedExtension>, pb::IBufferMessage {
+ public sealed partial class TestNestedExtension : pb::IMessage<TestNestedExtension>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<TestNestedExtension> _parser = new pb::MessageParser<TestNestedExtension>(() => new TestNestedExtension());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -6133,9 +6814,21 @@
[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;
@@ -6147,12 +6840,17 @@
}
}
}
+ #endif
#region Nested types
/// <summary>Container for nested types declared in the TestNestedExtension message type.</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static partial class Types {
- public sealed partial class OptionalGroup_extension : pb::IMessage<OptionalGroup_extension>, pb::IBufferMessage {
+ public sealed partial class OptionalGroup_extension : pb::IMessage<OptionalGroup_extension>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<OptionalGroup_extension> _parser = new pb::MessageParser<OptionalGroup_extension>(() => new OptionalGroup_extension());
private pb::UnknownFieldSet _unknownFields;
private int _hasBits0;
@@ -6280,9 +6978,27 @@
[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 132:
+ return;
+ default:
+ _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ break;
+ case 136: {
+ 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;
@@ -6300,6 +7016,7 @@
}
}
}
+ #endif
}
@@ -6338,7 +7055,11 @@
/// required filed because the code output is basically identical to
/// optional fields for all types.
/// </summary>
- public sealed partial class TestRequired : pb::IMessage<TestRequired>, pb::IBufferMessage {
+ public sealed partial class TestRequired : pb::IMessage<TestRequired>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<TestRequired> _parser = new pb::MessageParser<TestRequired>(() => new TestRequired());
private pb::UnknownFieldSet _unknownFields;
private int _hasBits0;
@@ -7656,9 +8377,153 @@
[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 16: {
+ Dummy2 = input.ReadInt32();
+ break;
+ }
+ case 24: {
+ B = input.ReadInt32();
+ break;
+ }
+ case 32: {
+ Dummy4 = input.ReadInt32();
+ break;
+ }
+ case 40: {
+ Dummy5 = input.ReadInt32();
+ break;
+ }
+ case 48: {
+ Dummy6 = input.ReadInt32();
+ break;
+ }
+ case 56: {
+ Dummy7 = input.ReadInt32();
+ break;
+ }
+ case 64: {
+ Dummy8 = input.ReadInt32();
+ break;
+ }
+ case 72: {
+ Dummy9 = input.ReadInt32();
+ break;
+ }
+ case 80: {
+ Dummy10 = input.ReadInt32();
+ break;
+ }
+ case 88: {
+ Dummy11 = input.ReadInt32();
+ break;
+ }
+ case 96: {
+ Dummy12 = input.ReadInt32();
+ break;
+ }
+ case 104: {
+ Dummy13 = input.ReadInt32();
+ break;
+ }
+ case 112: {
+ Dummy14 = input.ReadInt32();
+ break;
+ }
+ case 120: {
+ Dummy15 = input.ReadInt32();
+ break;
+ }
+ case 128: {
+ Dummy16 = input.ReadInt32();
+ break;
+ }
+ case 136: {
+ Dummy17 = input.ReadInt32();
+ break;
+ }
+ case 144: {
+ Dummy18 = input.ReadInt32();
+ break;
+ }
+ case 152: {
+ Dummy19 = input.ReadInt32();
+ break;
+ }
+ case 160: {
+ Dummy20 = input.ReadInt32();
+ break;
+ }
+ case 168: {
+ Dummy21 = input.ReadInt32();
+ break;
+ }
+ case 176: {
+ Dummy22 = input.ReadInt32();
+ break;
+ }
+ case 184: {
+ Dummy23 = input.ReadInt32();
+ break;
+ }
+ case 192: {
+ Dummy24 = input.ReadInt32();
+ break;
+ }
+ case 200: {
+ Dummy25 = input.ReadInt32();
+ break;
+ }
+ case 208: {
+ Dummy26 = input.ReadInt32();
+ break;
+ }
+ case 216: {
+ Dummy27 = input.ReadInt32();
+ break;
+ }
+ case 224: {
+ Dummy28 = input.ReadInt32();
+ break;
+ }
+ case 232: {
+ Dummy29 = input.ReadInt32();
+ break;
+ }
+ case 240: {
+ Dummy30 = input.ReadInt32();
+ break;
+ }
+ case 248: {
+ Dummy31 = input.ReadInt32();
+ break;
+ }
+ case 256: {
+ Dummy32 = input.ReadInt32();
+ break;
+ }
+ case 264: {
+ 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;
@@ -7802,6 +8667,7 @@
}
}
}
+ #endif
#region Extensions
/// <summary>Container for extensions for other messages declared in the TestRequired message type.</summary>
@@ -7816,7 +8682,11 @@
}
- public sealed partial class TestRequiredForeign : pb::IMessage<TestRequiredForeign>, pb::IBufferMessage {
+ public sealed partial class TestRequiredForeign : pb::IMessage<TestRequiredForeign>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<TestRequiredForeign> _parser = new pb::MessageParser<TestRequiredForeign>(() => new TestRequiredForeign());
private pb::UnknownFieldSet _unknownFields;
private int _hasBits0;
@@ -7987,9 +8857,36 @@
[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 (optionalMessage_ == null) {
+ OptionalMessage = new global::Google.Protobuf.TestProtos.Proto2.TestRequired();
+ }
+ input.ReadMessage(OptionalMessage);
+ break;
+ }
+ case 18: {
+ repeatedMessage_.AddEntriesFrom(input, _repeated_repeatedMessage_codec);
+ break;
+ }
+ case 24: {
+ Dummy = input.ReadInt32();
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -8016,10 +8913,15 @@
}
}
}
+ #endif
}
- public sealed partial class TestRequiredMessage : pb::IMessage<TestRequiredMessage>, pb::IBufferMessage {
+ public sealed partial class TestRequiredMessage : pb::IMessage<TestRequiredMessage>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<TestRequiredMessage> _parser = new pb::MessageParser<TestRequiredMessage>(() => new TestRequiredMessage());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -8178,9 +9080,39 @@
[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 (optionalMessage_ == null) {
+ OptionalMessage = new global::Google.Protobuf.TestProtos.Proto2.TestRequired();
+ }
+ input.ReadMessage(OptionalMessage);
+ break;
+ }
+ case 18: {
+ repeatedMessage_.AddEntriesFrom(input, _repeated_repeatedMessage_codec);
+ break;
+ }
+ case 26: {
+ if (requiredMessage_ == null) {
+ RequiredMessage = new global::Google.Protobuf.TestProtos.Proto2.TestRequired();
+ }
+ input.ReadMessage(RequiredMessage);
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -8210,13 +9142,18 @@
}
}
}
+ #endif
}
/// <summary>
/// Test that we can use NestedMessage from outside TestAllTypes.
/// </summary>
- public sealed partial class TestForeignNested : pb::IMessage<TestForeignNested>, pb::IBufferMessage {
+ public sealed partial class TestForeignNested : pb::IMessage<TestForeignNested>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<TestForeignNested> _parser = new pb::MessageParser<TestForeignNested>(() => new TestForeignNested());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -8332,9 +9269,28 @@
[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 (foreignNested_ == null) {
+ ForeignNested = new global::Google.Protobuf.TestProtos.Proto2.TestAllTypes.Types.NestedMessage();
+ }
+ input.ReadMessage(ForeignNested);
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -8353,13 +9309,18 @@
}
}
}
+ #endif
}
/// <summary>
/// TestEmptyMessage is used to test unknown field support.
/// </summary>
- public sealed partial class TestEmptyMessage : pb::IMessage<TestEmptyMessage>, pb::IBufferMessage {
+ public sealed partial class TestEmptyMessage : pb::IMessage<TestEmptyMessage>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<TestEmptyMessage> _parser = new pb::MessageParser<TestEmptyMessage>(() => new TestEmptyMessage());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -8448,9 +9409,21 @@
[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;
@@ -8462,6 +9435,7 @@
}
}
}
+ #endif
}
@@ -8469,7 +9443,11 @@
/// Like above, but declare all field numbers as potential extensions. No
/// actual extensions should ever be defined for this type.
/// </summary>
- public sealed partial class TestEmptyMessageWithExtensions : pb::IExtendableMessage<TestEmptyMessageWithExtensions>, pb::IBufferMessage {
+ public sealed partial class TestEmptyMessageWithExtensions : pb::IExtendableMessage<TestEmptyMessageWithExtensions>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<TestEmptyMessageWithExtensions> _parser = new pb::MessageParser<TestEmptyMessageWithExtensions>(() => new TestEmptyMessageWithExtensions());
private pb::UnknownFieldSet _unknownFields;
private pb::ExtensionSet<TestEmptyMessageWithExtensions> _extensions;
@@ -8574,9 +9552,23 @@
[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;
@@ -8590,6 +9582,7 @@
}
}
}
+ #endif
public TValue GetExtension<TValue>(pb::Extension<TestEmptyMessageWithExtensions, TValue> extension) {
return pb::ExtensionSet.Get(ref _extensions, extension);
@@ -8615,7 +9608,11 @@
}
- public sealed partial class TestMultipleExtensionRanges : pb::IExtendableMessage<TestMultipleExtensionRanges>, pb::IBufferMessage {
+ public sealed partial class TestMultipleExtensionRanges : pb::IExtendableMessage<TestMultipleExtensionRanges>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<TestMultipleExtensionRanges> _parser = new pb::MessageParser<TestMultipleExtensionRanges>(() => new TestMultipleExtensionRanges());
private pb::UnknownFieldSet _unknownFields;
private pb::ExtensionSet<TestMultipleExtensionRanges> _extensions;
@@ -8720,9 +9717,23 @@
[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;
@@ -8736,6 +9747,7 @@
}
}
}
+ #endif
public TValue GetExtension<TValue>(pb::Extension<TestMultipleExtensionRanges, TValue> extension) {
return pb::ExtensionSet.Get(ref _extensions, extension);
@@ -8764,7 +9776,11 @@
/// <summary>
/// Test that really large tag numbers don't break anything.
/// </summary>
- public sealed partial class TestReallyLargeTagNumber : pb::IMessage<TestReallyLargeTagNumber>, pb::IBufferMessage {
+ public sealed partial class TestReallyLargeTagNumber : pb::IMessage<TestReallyLargeTagNumber>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<TestReallyLargeTagNumber> _parser = new pb::MessageParser<TestReallyLargeTagNumber>(() => new TestReallyLargeTagNumber());
private pb::UnknownFieldSet _unknownFields;
private int _hasBits0;
@@ -8933,9 +9949,29 @@
[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 2147483640: {
+ 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;
@@ -8955,10 +9991,15 @@
}
}
}
+ #endif
}
- public sealed partial class TestRecursiveMessage : pb::IMessage<TestRecursiveMessage>, pb::IBufferMessage {
+ public sealed partial class TestRecursiveMessage : pb::IMessage<TestRecursiveMessage>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<TestRecursiveMessage> _parser = new pb::MessageParser<TestRecursiveMessage>(() => new TestRecursiveMessage());
private pb::UnknownFieldSet _unknownFields;
private int _hasBits0;
@@ -9113,9 +10154,32 @@
[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 (a_ == null) {
+ A = new global::Google.Protobuf.TestProtos.Proto2.TestRecursiveMessage();
+ }
+ input.ReadMessage(A);
+ break;
+ }
+ case 16: {
+ 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;
@@ -9138,13 +10202,18 @@
}
}
}
+ #endif
}
/// <summary>
/// Test that mutual recursion works.
/// </summary>
- public sealed partial class TestMutualRecursionA : pb::IMessage<TestMutualRecursionA>, pb::IBufferMessage {
+ public sealed partial class TestMutualRecursionA : pb::IMessage<TestMutualRecursionA>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<TestMutualRecursionA> _parser = new pb::MessageParser<TestMutualRecursionA>(() => new TestMutualRecursionA());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -9298,9 +10367,35 @@
[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 (bb_ == null) {
+ Bb = new global::Google.Protobuf.TestProtos.Proto2.TestMutualRecursionB();
+ }
+ input.ReadMessage(Bb);
+ break;
+ }
+ case 19: {
+ if (!HasSubGroup) {
+ SubGroup = new global::Google.Protobuf.TestProtos.Proto2.TestMutualRecursionA.Types.SubGroup();
+ }
+ input.ReadGroup(SubGroup);
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -9326,12 +10421,17 @@
}
}
}
+ #endif
#region Nested types
/// <summary>Container for nested types declared in the TestMutualRecursionA message type.</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static partial class Types {
- public sealed partial class SubMessage : pb::IMessage<SubMessage>, pb::IBufferMessage {
+ public sealed partial class SubMessage : pb::IMessage<SubMessage>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<SubMessage> _parser = new pb::MessageParser<SubMessage>(() => new SubMessage());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -9447,9 +10547,28 @@
[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 (b_ == null) {
+ B = new global::Google.Protobuf.TestProtos.Proto2.TestMutualRecursionB();
+ }
+ input.ReadMessage(B);
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -9468,10 +10587,15 @@
}
}
}
+ #endif
}
- public sealed partial class SubGroup : pb::IMessage<SubGroup>, pb::IBufferMessage {
+ public sealed partial class SubGroup : pb::IMessage<SubGroup>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<SubGroup> _parser = new pb::MessageParser<SubGroup>(() => new SubGroup());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -9617,9 +10741,37 @@
[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 20:
+ return;
+ default:
+ _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ break;
+ case 26: {
+ if (subMessage_ == null) {
+ SubMessage = new global::Google.Protobuf.TestProtos.Proto2.TestMutualRecursionA.Types.SubMessage();
+ }
+ input.ReadMessage(SubMessage);
+ break;
+ }
+ case 34: {
+ if (notInThisScc_ == null) {
+ NotInThisScc = new global::Google.Protobuf.TestProtos.Proto2.TestAllTypes();
+ }
+ input.ReadMessage(NotInThisScc);
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -9647,6 +10799,7 @@
}
}
}
+ #endif
}
@@ -9655,7 +10808,11 @@
}
- public sealed partial class TestMutualRecursionB : pb::IMessage<TestMutualRecursionB>, pb::IBufferMessage {
+ public sealed partial class TestMutualRecursionB : pb::IMessage<TestMutualRecursionB>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<TestMutualRecursionB> _parser = new pb::MessageParser<TestMutualRecursionB>(() => new TestMutualRecursionB());
private pb::UnknownFieldSet _unknownFields;
private int _hasBits0;
@@ -9810,9 +10967,32 @@
[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 (a_ == null) {
+ A = new global::Google.Protobuf.TestProtos.Proto2.TestMutualRecursionA();
+ }
+ input.ReadMessage(A);
+ break;
+ }
+ case 16: {
+ OptionalInt32 = input.ReadInt32();
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -9835,10 +11015,15 @@
}
}
}
+ #endif
}
- public sealed partial class TestIsInitialized : pb::IMessage<TestIsInitialized>, pb::IBufferMessage {
+ public sealed partial class TestIsInitialized : pb::IMessage<TestIsInitialized>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<TestIsInitialized> _parser = new pb::MessageParser<TestIsInitialized>(() => new TestIsInitialized());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -9954,9 +11139,28 @@
[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 (subMessage_ == null) {
+ SubMessage = new global::Google.Protobuf.TestProtos.Proto2.TestIsInitialized.Types.SubMessage();
+ }
+ input.ReadMessage(SubMessage);
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -9975,12 +11179,17 @@
}
}
}
+ #endif
#region Nested types
/// <summary>Container for nested types declared in the TestIsInitialized message type.</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static partial class Types {
- public sealed partial class SubMessage : pb::IMessage<SubMessage>, pb::IBufferMessage {
+ public sealed partial class SubMessage : pb::IMessage<SubMessage>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<SubMessage> _parser = new pb::MessageParser<SubMessage>(() => new SubMessage());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -10107,9 +11316,28 @@
[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 11: {
+ if (!HasSubGroup) {
+ SubGroup = new global::Google.Protobuf.TestProtos.Proto2.TestIsInitialized.Types.SubMessage.Types.SubGroup();
+ }
+ input.ReadGroup(SubGroup);
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -10128,12 +11356,17 @@
}
}
}
+ #endif
#region Nested types
/// <summary>Container for nested types declared in the SubMessage message type.</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static partial class Types {
- public sealed partial class SubGroup : pb::IMessage<SubGroup>, pb::IBufferMessage {
+ public sealed partial class SubGroup : pb::IMessage<SubGroup>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<SubGroup> _parser = new pb::MessageParser<SubGroup>(() => new SubGroup());
private pb::UnknownFieldSet _unknownFields;
private int _hasBits0;
@@ -10261,9 +11494,27 @@
[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 12:
+ return;
+ default:
+ _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ break;
+ case 16: {
+ 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;
@@ -10281,6 +11532,7 @@
}
}
}
+ #endif
}
@@ -10300,7 +11552,11 @@
/// to compile with proto1, this will emit an error; so we only include it
/// in protobuf_unittest_proto.
/// </summary>
- public sealed partial class TestDupFieldNumber : pb::IMessage<TestDupFieldNumber>, pb::IBufferMessage {
+ public sealed partial class TestDupFieldNumber : pb::IMessage<TestDupFieldNumber>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<TestDupFieldNumber> _parser = new pb::MessageParser<TestDupFieldNumber>(() => new TestDupFieldNumber());
private pb::UnknownFieldSet _unknownFields;
private int _hasBits0;
@@ -10507,9 +11763,39 @@
[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 19: {
+ if (!HasFoo) {
+ Foo = new global::Google.Protobuf.TestProtos.Proto2.TestDupFieldNumber.Types.Foo();
+ }
+ input.ReadGroup(Foo);
+ break;
+ }
+ case 27: {
+ if (!HasBar) {
+ Bar = new global::Google.Protobuf.TestProtos.Proto2.TestDupFieldNumber.Types.Bar();
+ }
+ input.ReadGroup(Bar);
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -10539,12 +11825,17 @@
}
}
}
+ #endif
#region Nested types
/// <summary>Container for nested types declared in the TestDupFieldNumber message type.</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static partial class Types {
- 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;
private int _hasBits0;
@@ -10672,9 +11963,27 @@
[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 20:
+ 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;
@@ -10692,10 +12001,15 @@
}
}
}
+ #endif
}
- 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;
private int _hasBits0;
@@ -10823,9 +12137,27 @@
[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 28:
+ 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;
@@ -10843,6 +12175,7 @@
}
}
}
+ #endif
}
@@ -10854,7 +12187,11 @@
/// <summary>
/// Additional messages for testing lazy fields.
/// </summary>
- public sealed partial class TestEagerMessage : pb::IMessage<TestEagerMessage>, pb::IBufferMessage {
+ public sealed partial class TestEagerMessage : pb::IMessage<TestEagerMessage>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<TestEagerMessage> _parser = new pb::MessageParser<TestEagerMessage>(() => new TestEagerMessage());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -10970,9 +12307,28 @@
[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 (subMessage_ == null) {
+ SubMessage = new global::Google.Protobuf.TestProtos.Proto2.TestAllTypes();
+ }
+ input.ReadMessage(SubMessage);
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -10991,10 +12347,15 @@
}
}
}
+ #endif
}
- public sealed partial class TestLazyMessage : pb::IMessage<TestLazyMessage>, pb::IBufferMessage {
+ public sealed partial class TestLazyMessage : pb::IMessage<TestLazyMessage>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<TestLazyMessage> _parser = new pb::MessageParser<TestLazyMessage>(() => new TestLazyMessage());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -11110,9 +12471,28 @@
[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 (subMessage_ == null) {
+ SubMessage = new global::Google.Protobuf.TestProtos.Proto2.TestAllTypes();
+ }
+ input.ReadMessage(SubMessage);
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -11131,13 +12511,18 @@
}
}
}
+ #endif
}
/// <summary>
/// Needed for a Python test.
/// </summary>
- public sealed partial class TestNestedMessageHasBits : pb::IMessage<TestNestedMessageHasBits>, pb::IBufferMessage {
+ public sealed partial class TestNestedMessageHasBits : pb::IMessage<TestNestedMessageHasBits>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<TestNestedMessageHasBits> _parser = new pb::MessageParser<TestNestedMessageHasBits>(() => new TestNestedMessageHasBits());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -11253,9 +12638,28 @@
[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 (optionalNestedMessage_ == null) {
+ OptionalNestedMessage = new global::Google.Protobuf.TestProtos.Proto2.TestNestedMessageHasBits.Types.NestedMessage();
+ }
+ input.ReadMessage(OptionalNestedMessage);
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -11274,12 +12678,17 @@
}
}
}
+ #endif
#region Nested types
/// <summary>Container for nested types declared in the TestNestedMessageHasBits message type.</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static partial class Types {
- 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]
@@ -11400,9 +12809,30 @@
[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:
+ case 8: {
+ nestedmessageRepeatedInt32_.AddEntriesFrom(input, _repeated_nestedmessageRepeatedInt32_codec);
+ break;
+ }
+ case 18: {
+ nestedmessageRepeatedForeignmessage_.AddEntriesFrom(input, _repeated_nestedmessageRepeatedForeignmessage_codec);
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -11423,6 +12853,7 @@
}
}
}
+ #endif
}
@@ -11435,7 +12866,11 @@
/// Test message with CamelCase field names. This violates Protocol Buffer
/// standard style.
/// </summary>
- public sealed partial class TestCamelCaseFieldNames : pb::IMessage<TestCamelCaseFieldNames>, pb::IBufferMessage {
+ public sealed partial class TestCamelCaseFieldNames : pb::IMessage<TestCamelCaseFieldNames>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<TestCamelCaseFieldNames> _parser = new pb::MessageParser<TestCamelCaseFieldNames>(() => new TestCamelCaseFieldNames());
private pb::UnknownFieldSet _unknownFields;
private int _hasBits0;
@@ -11831,9 +13266,74 @@
[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: {
+ PrimitiveField = input.ReadInt32();
+ break;
+ }
+ case 18: {
+ StringField = input.ReadString();
+ break;
+ }
+ case 24: {
+ EnumField = (global::Google.Protobuf.TestProtos.Proto2.ForeignEnum) input.ReadEnum();
+ break;
+ }
+ case 34: {
+ if (messageField_ == null) {
+ MessageField = new global::Google.Protobuf.TestProtos.Proto2.ForeignMessage();
+ }
+ input.ReadMessage(MessageField);
+ break;
+ }
+ case 42: {
+ StringPieceField = input.ReadString();
+ break;
+ }
+ case 50: {
+ CordField = input.ReadString();
+ break;
+ }
+ case 58:
+ case 56: {
+ repeatedPrimitiveField_.AddEntriesFrom(input, _repeated_repeatedPrimitiveField_codec);
+ break;
+ }
+ case 66: {
+ repeatedStringField_.AddEntriesFrom(input, _repeated_repeatedStringField_codec);
+ break;
+ }
+ case 74:
+ case 72: {
+ repeatedEnumField_.AddEntriesFrom(input, _repeated_repeatedEnumField_codec);
+ break;
+ }
+ case 82: {
+ repeatedMessageField_.AddEntriesFrom(input, _repeated_repeatedMessageField_codec);
+ break;
+ }
+ case 90: {
+ repeatedStringPieceField_.AddEntriesFrom(input, _repeated_repeatedStringPieceField_codec);
+ break;
+ }
+ case 98: {
+ repeatedCordField_.AddEntriesFrom(input, _repeated_repeatedCordField_codec);
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -11898,6 +13398,7 @@
}
}
}
+ #endif
}
@@ -11905,7 +13406,11 @@
/// We list fields out of order, to ensure that we're using field number and not
/// field index to determine serialization order.
/// </summary>
- public sealed partial class TestFieldOrderings : pb::IExtendableMessage<TestFieldOrderings>, pb::IBufferMessage {
+ public sealed partial class TestFieldOrderings : pb::IExtendableMessage<TestFieldOrderings>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<TestFieldOrderings> _parser = new pb::MessageParser<TestFieldOrderings>(() => new TestFieldOrderings());
private pb::UnknownFieldSet _unknownFields;
private pb::ExtensionSet<TestFieldOrderings> _extensions;
@@ -12149,9 +13654,42 @@
[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: {
+ MyInt = input.ReadInt64();
+ break;
+ }
+ case 90: {
+ MyString = input.ReadString();
+ break;
+ }
+ case 813: {
+ MyFloat = input.ReadFloat();
+ break;
+ }
+ case 1602: {
+ if (optionalNestedMessage_ == null) {
+ OptionalNestedMessage = new global::Google.Protobuf.TestProtos.Proto2.TestFieldOrderings.Types.NestedMessage();
+ }
+ input.ReadMessage(OptionalNestedMessage);
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -12184,6 +13722,7 @@
}
}
}
+ #endif
public TValue GetExtension<TValue>(pb::Extension<TestFieldOrderings, TValue> extension) {
return pb::ExtensionSet.Get(ref _extensions, extension);
@@ -12211,7 +13750,11 @@
/// <summary>Container for nested types declared in the TestFieldOrderings message type.</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static partial class Types {
- 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;
@@ -12381,9 +13924,29 @@
[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;
+ }
+ case 16: {
+ Oo = input.ReadInt64();
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -12403,6 +13966,7 @@
}
}
}
+ #endif
}
@@ -12411,7 +13975,11 @@
}
- public sealed partial class TestExtensionOrderings1 : pb::IMessage<TestExtensionOrderings1>, pb::IBufferMessage {
+ public sealed partial class TestExtensionOrderings1 : pb::IMessage<TestExtensionOrderings1>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<TestExtensionOrderings1> _parser = new pb::MessageParser<TestExtensionOrderings1>(() => new TestExtensionOrderings1());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -12536,9 +14104,25 @@
[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: {
+ MyString = input.ReadString();
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -12554,6 +14138,7 @@
}
}
}
+ #endif
#region Extensions
/// <summary>Container for extensions for other messages declared in the TestExtensionOrderings1 message type.</summary>
@@ -12566,7 +14151,11 @@
}
- public sealed partial class TestExtensionOrderings2 : pb::IMessage<TestExtensionOrderings2>, pb::IBufferMessage {
+ public sealed partial class TestExtensionOrderings2 : pb::IMessage<TestExtensionOrderings2>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<TestExtensionOrderings2> _parser = new pb::MessageParser<TestExtensionOrderings2>(() => new TestExtensionOrderings2());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -12691,9 +14280,25 @@
[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: {
+ MyString = input.ReadString();
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -12709,12 +14314,17 @@
}
}
}
+ #endif
#region Nested types
/// <summary>Container for nested types declared in the TestExtensionOrderings2 message type.</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static partial class Types {
- public sealed partial class TestExtensionOrderings3 : pb::IMessage<TestExtensionOrderings3>, pb::IBufferMessage {
+ public sealed partial class TestExtensionOrderings3 : pb::IMessage<TestExtensionOrderings3>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<TestExtensionOrderings3> _parser = new pb::MessageParser<TestExtensionOrderings3>(() => new TestExtensionOrderings3());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -12839,9 +14449,25 @@
[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: {
+ MyString = input.ReadString();
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -12857,6 +14483,7 @@
}
}
}
+ #endif
#region Extensions
/// <summary>Container for extensions for other messages declared in the TestExtensionOrderings3 message type.</summary>
@@ -12883,7 +14510,11 @@
}
- public sealed partial class TestExtremeDefaultValues : pb::IMessage<TestExtremeDefaultValues>, pb::IBufferMessage {
+ public sealed partial class TestExtremeDefaultValues : pb::IMessage<TestExtremeDefaultValues>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<TestExtremeDefaultValues> _parser = new pb::MessageParser<TestExtremeDefaultValues>(() => new TestExtremeDefaultValues());
private pb::UnknownFieldSet _unknownFields;
private int _hasBits0;
@@ -13989,9 +15620,129 @@
[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: {
+ EscapedBytes = input.ReadBytes();
+ break;
+ }
+ case 16: {
+ LargeUint32 = input.ReadUInt32();
+ break;
+ }
+ case 24: {
+ LargeUint64 = input.ReadUInt64();
+ break;
+ }
+ case 32: {
+ SmallInt32 = input.ReadInt32();
+ break;
+ }
+ case 40: {
+ SmallInt64 = input.ReadInt64();
+ break;
+ }
+ case 50: {
+ Utf8String = input.ReadString();
+ break;
+ }
+ case 61: {
+ ZeroFloat = input.ReadFloat();
+ break;
+ }
+ case 69: {
+ OneFloat = input.ReadFloat();
+ break;
+ }
+ case 77: {
+ SmallFloat = input.ReadFloat();
+ break;
+ }
+ case 85: {
+ NegativeOneFloat = input.ReadFloat();
+ break;
+ }
+ case 93: {
+ NegativeFloat = input.ReadFloat();
+ break;
+ }
+ case 101: {
+ LargeFloat = input.ReadFloat();
+ break;
+ }
+ case 109: {
+ SmallNegativeFloat = input.ReadFloat();
+ break;
+ }
+ case 113: {
+ InfDouble = input.ReadDouble();
+ break;
+ }
+ case 121: {
+ NegInfDouble = input.ReadDouble();
+ break;
+ }
+ case 129: {
+ NanDouble = input.ReadDouble();
+ break;
+ }
+ case 141: {
+ InfFloat = input.ReadFloat();
+ break;
+ }
+ case 149: {
+ NegInfFloat = input.ReadFloat();
+ break;
+ }
+ case 157: {
+ NanFloat = input.ReadFloat();
+ break;
+ }
+ case 162: {
+ CppTrigraph = input.ReadString();
+ break;
+ }
+ case 168: {
+ ReallySmallInt32 = input.ReadInt32();
+ break;
+ }
+ case 176: {
+ ReallySmallInt64 = input.ReadInt64();
+ break;
+ }
+ case 186: {
+ StringWithZero = input.ReadString();
+ break;
+ }
+ case 194: {
+ BytesWithZero = input.ReadBytes();
+ break;
+ }
+ case 202: {
+ StringPieceWithZero = input.ReadString();
+ break;
+ }
+ case 210: {
+ CordWithZero = input.ReadString();
+ break;
+ }
+ case 218: {
+ ReplacementString = input.ReadString();
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -14111,10 +15862,15 @@
}
}
}
+ #endif
}
- public sealed partial class SparseEnumMessage : pb::IMessage<SparseEnumMessage>, pb::IBufferMessage {
+ public sealed partial class SparseEnumMessage : pb::IMessage<SparseEnumMessage>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<SparseEnumMessage> _parser = new pb::MessageParser<SparseEnumMessage>(() => new SparseEnumMessage());
private pb::UnknownFieldSet _unknownFields;
private int _hasBits0;
@@ -14242,9 +15998,25 @@
[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: {
+ SparseEnum = (global::Google.Protobuf.TestProtos.Proto2.TestSparseEnum) input.ReadEnum();
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -14260,13 +16032,18 @@
}
}
}
+ #endif
}
/// <summary>
/// Test String and Bytes: string is for valid UTF-8 strings
/// </summary>
- public sealed partial class OneString : pb::IMessage<OneString>, pb::IBufferMessage {
+ public sealed partial class OneString : pb::IMessage<OneString>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<OneString> _parser = new pb::MessageParser<OneString>(() => new OneString());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -14391,9 +16168,25 @@
[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: {
+ Data = input.ReadString();
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -14409,10 +16202,15 @@
}
}
}
+ #endif
}
- public sealed partial class MoreString : pb::IMessage<MoreString>, pb::IBufferMessage {
+ public sealed partial class MoreString : pb::IMessage<MoreString>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<MoreString> _parser = new pb::MessageParser<MoreString>(() => new MoreString());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -14517,9 +16315,25 @@
[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: {
+ data_.AddEntriesFrom(input, _repeated_data_codec);
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -14535,10 +16349,15 @@
}
}
}
+ #endif
}
- public sealed partial class OneBytes : pb::IMessage<OneBytes>, pb::IBufferMessage {
+ public sealed partial class OneBytes : pb::IMessage<OneBytes>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<OneBytes> _parser = new pb::MessageParser<OneBytes>(() => new OneBytes());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -14663,9 +16482,25 @@
[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: {
+ Data = input.ReadBytes();
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -14681,10 +16516,15 @@
}
}
}
+ #endif
}
- public sealed partial class MoreBytes : pb::IMessage<MoreBytes>, pb::IBufferMessage {
+ public sealed partial class MoreBytes : pb::IMessage<MoreBytes>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<MoreBytes> _parser = new pb::MessageParser<MoreBytes>(() => new MoreBytes());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -14789,9 +16629,25 @@
[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: {
+ data_.AddEntriesFrom(input, _repeated_data_codec);
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -14807,13 +16663,18 @@
}
}
}
+ #endif
}
/// <summary>
/// Test int32, uint32, int64, uint64, and bool are all compatible
/// </summary>
- public sealed partial class Int32Message : pb::IMessage<Int32Message>, pb::IBufferMessage {
+ public sealed partial class Int32Message : pb::IMessage<Int32Message>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<Int32Message> _parser = new pb::MessageParser<Int32Message>(() => new Int32Message());
private pb::UnknownFieldSet _unknownFields;
private int _hasBits0;
@@ -14941,9 +16802,25 @@
[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: {
+ Data = input.ReadInt32();
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -14959,10 +16836,15 @@
}
}
}
+ #endif
}
- public sealed partial class Uint32Message : pb::IMessage<Uint32Message>, pb::IBufferMessage {
+ public sealed partial class Uint32Message : pb::IMessage<Uint32Message>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<Uint32Message> _parser = new pb::MessageParser<Uint32Message>(() => new Uint32Message());
private pb::UnknownFieldSet _unknownFields;
private int _hasBits0;
@@ -15090,9 +16972,25 @@
[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: {
+ Data = input.ReadUInt32();
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -15108,10 +17006,15 @@
}
}
}
+ #endif
}
- public sealed partial class Int64Message : pb::IMessage<Int64Message>, pb::IBufferMessage {
+ public sealed partial class Int64Message : pb::IMessage<Int64Message>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<Int64Message> _parser = new pb::MessageParser<Int64Message>(() => new Int64Message());
private pb::UnknownFieldSet _unknownFields;
private int _hasBits0;
@@ -15239,9 +17142,25 @@
[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: {
+ Data = input.ReadInt64();
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -15257,10 +17176,15 @@
}
}
}
+ #endif
}
- public sealed partial class Uint64Message : pb::IMessage<Uint64Message>, pb::IBufferMessage {
+ public sealed partial class Uint64Message : pb::IMessage<Uint64Message>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<Uint64Message> _parser = new pb::MessageParser<Uint64Message>(() => new Uint64Message());
private pb::UnknownFieldSet _unknownFields;
private int _hasBits0;
@@ -15388,9 +17312,25 @@
[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: {
+ Data = input.ReadUInt64();
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -15406,10 +17346,15 @@
}
}
}
+ #endif
}
- public sealed partial class BoolMessage : pb::IMessage<BoolMessage>, pb::IBufferMessage {
+ public sealed partial class BoolMessage : pb::IMessage<BoolMessage>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<BoolMessage> _parser = new pb::MessageParser<BoolMessage>(() => new BoolMessage());
private pb::UnknownFieldSet _unknownFields;
private int _hasBits0;
@@ -15537,9 +17482,25 @@
[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: {
+ Data = input.ReadBool();
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -15555,13 +17516,18 @@
}
}
}
+ #endif
}
/// <summary>
/// Test oneofs.
/// </summary>
- public sealed partial class TestOneof : pb::IMessage<TestOneof>, pb::IBufferMessage {
+ public sealed partial class TestOneof : pb::IMessage<TestOneof>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<TestOneof> _parser = new pb::MessageParser<TestOneof>(() => new TestOneof());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -15826,9 +17792,47 @@
[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: {
+ FooInt = input.ReadInt32();
+ break;
+ }
+ case 18: {
+ FooString = input.ReadString();
+ break;
+ }
+ case 26: {
+ global::Google.Protobuf.TestProtos.Proto2.TestAllTypes subBuilder = new global::Google.Protobuf.TestProtos.Proto2.TestAllTypes();
+ if (fooCase_ == FooOneofCase.FooMessage) {
+ subBuilder.MergeFrom(FooMessage);
+ }
+ input.ReadMessage(subBuilder);
+ FooMessage = subBuilder;
+ break;
+ }
+ case 35: {
+ global::Google.Protobuf.TestProtos.Proto2.TestOneof.Types.FooGroup subBuilder = new global::Google.Protobuf.TestProtos.Proto2.TestOneof.Types.FooGroup();
+ if (HasFooGroup) {
+ subBuilder.MergeFrom(FooGroup);
+ }
+ input.ReadGroup(subBuilder);
+ FooGroup = subBuilder;
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -15866,12 +17870,17 @@
}
}
}
+ #endif
#region Nested types
/// <summary>Container for nested types declared in the TestOneof message type.</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static partial class Types {
- public sealed partial class FooGroup : pb::IMessage<FooGroup>, pb::IBufferMessage {
+ public sealed partial class FooGroup : pb::IMessage<FooGroup>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<FooGroup> _parser = new pb::MessageParser<FooGroup>(() => new FooGroup());
private pb::UnknownFieldSet _unknownFields;
private int _hasBits0;
@@ -16035,9 +18044,31 @@
[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 36:
+ return;
+ default:
+ _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ break;
+ case 40: {
+ A = input.ReadInt32();
+ break;
+ }
+ case 50: {
+ B = input.ReadString();
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -16059,6 +18090,7 @@
}
}
}
+ #endif
}
@@ -16067,7 +18099,11 @@
}
- public sealed partial class TestOneofBackwardsCompatible : pb::IMessage<TestOneofBackwardsCompatible>, pb::IBufferMessage {
+ public sealed partial class TestOneofBackwardsCompatible : pb::IMessage<TestOneofBackwardsCompatible>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<TestOneofBackwardsCompatible> _parser = new pb::MessageParser<TestOneofBackwardsCompatible>(() => new TestOneofBackwardsCompatible());
private pb::UnknownFieldSet _unknownFields;
private int _hasBits0;
@@ -16296,9 +18332,43 @@
[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: {
+ FooInt = input.ReadInt32();
+ break;
+ }
+ case 18: {
+ FooString = input.ReadString();
+ break;
+ }
+ case 26: {
+ if (fooMessage_ == null) {
+ FooMessage = new global::Google.Protobuf.TestProtos.Proto2.TestAllTypes();
+ }
+ input.ReadMessage(FooMessage);
+ break;
+ }
+ case 35: {
+ if (!HasFooGroup) {
+ FooGroup = new global::Google.Protobuf.TestProtos.Proto2.TestOneofBackwardsCompatible.Types.FooGroup();
+ }
+ input.ReadGroup(FooGroup);
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -16332,12 +18402,17 @@
}
}
}
+ #endif
#region Nested types
/// <summary>Container for nested types declared in the TestOneofBackwardsCompatible message type.</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static partial class Types {
- public sealed partial class FooGroup : pb::IMessage<FooGroup>, pb::IBufferMessage {
+ public sealed partial class FooGroup : pb::IMessage<FooGroup>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<FooGroup> _parser = new pb::MessageParser<FooGroup>(() => new FooGroup());
private pb::UnknownFieldSet _unknownFields;
private int _hasBits0;
@@ -16501,9 +18576,31 @@
[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 36:
+ return;
+ default:
+ _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ break;
+ case 40: {
+ A = input.ReadInt32();
+ break;
+ }
+ case 50: {
+ B = input.ReadString();
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -16525,6 +18622,7 @@
}
}
}
+ #endif
}
@@ -16533,7 +18631,11 @@
}
- public sealed partial class TestOneof2 : pb::IMessage<TestOneof2>, pb::IBufferMessage {
+ public sealed partial class TestOneof2 : pb::IMessage<TestOneof2>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<TestOneof2> _parser = new pb::MessageParser<TestOneof2>(() => new TestOneof2());
private pb::UnknownFieldSet _unknownFields;
private int _hasBits0;
@@ -17318,9 +19420,106 @@
[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: {
+ FooInt = input.ReadInt32();
+ break;
+ }
+ case 18: {
+ FooString = input.ReadString();
+ break;
+ }
+ case 26: {
+ FooCord = input.ReadString();
+ break;
+ }
+ case 34: {
+ FooStringPiece = input.ReadString();
+ break;
+ }
+ case 42: {
+ FooBytes = input.ReadBytes();
+ break;
+ }
+ case 48: {
+ foo_ = input.ReadEnum();
+ fooCase_ = FooOneofCase.FooEnum;
+ break;
+ }
+ case 58: {
+ global::Google.Protobuf.TestProtos.Proto2.TestOneof2.Types.NestedMessage subBuilder = new global::Google.Protobuf.TestProtos.Proto2.TestOneof2.Types.NestedMessage();
+ if (fooCase_ == FooOneofCase.FooMessage) {
+ subBuilder.MergeFrom(FooMessage);
+ }
+ input.ReadMessage(subBuilder);
+ FooMessage = subBuilder;
+ break;
+ }
+ case 67: {
+ global::Google.Protobuf.TestProtos.Proto2.TestOneof2.Types.FooGroup subBuilder = new global::Google.Protobuf.TestProtos.Proto2.TestOneof2.Types.FooGroup();
+ if (HasFooGroup) {
+ subBuilder.MergeFrom(FooGroup);
+ }
+ input.ReadGroup(subBuilder);
+ FooGroup = subBuilder;
+ break;
+ }
+ case 90: {
+ global::Google.Protobuf.TestProtos.Proto2.TestOneof2.Types.NestedMessage subBuilder = new global::Google.Protobuf.TestProtos.Proto2.TestOneof2.Types.NestedMessage();
+ if (fooCase_ == FooOneofCase.FooLazyMessage) {
+ subBuilder.MergeFrom(FooLazyMessage);
+ }
+ input.ReadMessage(subBuilder);
+ FooLazyMessage = subBuilder;
+ break;
+ }
+ case 96: {
+ BarInt = input.ReadInt32();
+ break;
+ }
+ case 106: {
+ BarString = input.ReadString();
+ break;
+ }
+ case 114: {
+ BarCord = input.ReadString();
+ break;
+ }
+ case 122: {
+ BarStringPiece = input.ReadString();
+ break;
+ }
+ case 130: {
+ BarBytes = input.ReadBytes();
+ break;
+ }
+ case 136: {
+ bar_ = input.ReadEnum();
+ barCase_ = BarOneofCase.BarEnum;
+ break;
+ }
+ case 144: {
+ BazInt = input.ReadInt32();
+ break;
+ }
+ case 154: {
+ BazString = input.ReadString();
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -17417,6 +19616,7 @@
}
}
}
+ #endif
#region Nested types
/// <summary>Container for nested types declared in the TestOneof2 message type.</summary>
@@ -17428,7 +19628,11 @@
[pbr::OriginalName("BAZ")] Baz = 3,
}
- public sealed partial class FooGroup : pb::IMessage<FooGroup>, pb::IBufferMessage {
+ public sealed partial class FooGroup : pb::IMessage<FooGroup>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<FooGroup> _parser = new pb::MessageParser<FooGroup>(() => new FooGroup());
private pb::UnknownFieldSet _unknownFields;
private int _hasBits0;
@@ -17592,9 +19796,31 @@
[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 68:
+ return;
+ default:
+ _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ break;
+ case 72: {
+ A = input.ReadInt32();
+ break;
+ }
+ case 82: {
+ B = input.ReadString();
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -17616,10 +19842,15 @@
}
}
}
+ #endif
}
- 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;
@@ -17763,9 +19994,30 @@
[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: {
+ QuxInt = input.ReadInt64();
+ break;
+ }
+ case 18:
+ case 16: {
+ corgeInt_.AddEntriesFrom(input, _repeated_corgeInt_codec);
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -17786,6 +20038,7 @@
}
}
}
+ #endif
}
@@ -17794,7 +20047,11 @@
}
- public sealed partial class TestRequiredOneof : pb::IMessage<TestRequiredOneof>, pb::IBufferMessage {
+ public sealed partial class TestRequiredOneof : pb::IMessage<TestRequiredOneof>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<TestRequiredOneof> _parser = new pb::MessageParser<TestRequiredOneof>(() => new TestRequiredOneof());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -18016,9 +20273,38 @@
[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: {
+ FooInt = input.ReadInt32();
+ break;
+ }
+ case 18: {
+ FooString = input.ReadString();
+ break;
+ }
+ case 26: {
+ global::Google.Protobuf.TestProtos.Proto2.TestRequiredOneof.Types.NestedMessage subBuilder = new global::Google.Protobuf.TestProtos.Proto2.TestRequiredOneof.Types.NestedMessage();
+ if (fooCase_ == FooOneofCase.FooMessage) {
+ subBuilder.MergeFrom(FooMessage);
+ }
+ input.ReadMessage(subBuilder);
+ FooMessage = subBuilder;
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -18047,12 +20333,17 @@
}
}
}
+ #endif
#region Nested types
/// <summary>Container for nested types declared in the TestRequiredOneof message type.</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static partial class Types {
- 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;
@@ -18180,9 +20471,25 @@
[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: {
+ RequiredDouble = input.ReadDouble();
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -18198,6 +20505,7 @@
}
}
}
+ #endif
}
@@ -18206,7 +20514,11 @@
}
- public sealed partial class TestRequiredMap : pb::IMessage<TestRequiredMap>, pb::IBufferMessage {
+ public sealed partial class TestRequiredMap : pb::IMessage<TestRequiredMap>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<TestRequiredMap> _parser = new pb::MessageParser<TestRequiredMap>(() => new TestRequiredMap());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -18311,9 +20623,25 @@
[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: {
+ foo_.AddEntriesFrom(input, _map_foo_codec);
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -18329,12 +20657,17 @@
}
}
}
+ #endif
#region Nested types
/// <summary>Container for nested types declared in the TestRequiredMap message type.</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static partial class Types {
- 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;
@@ -18462,9 +20795,25 @@
[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: {
+ RequiredInt32 = input.ReadInt32();
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -18480,6 +20829,7 @@
}
}
}
+ #endif
}
@@ -18488,7 +20838,11 @@
}
- public sealed partial class TestPackedTypes : pb::IMessage<TestPackedTypes>, pb::IBufferMessage {
+ public sealed partial class TestPackedTypes : pb::IMessage<TestPackedTypes>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<TestPackedTypes> _parser = new pb::MessageParser<TestPackedTypes>(() => new TestPackedTypes());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -18801,9 +21155,91 @@
[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 722:
+ case 720: {
+ packedInt32_.AddEntriesFrom(input, _repeated_packedInt32_codec);
+ break;
+ }
+ case 730:
+ case 728: {
+ packedInt64_.AddEntriesFrom(input, _repeated_packedInt64_codec);
+ break;
+ }
+ case 738:
+ case 736: {
+ packedUint32_.AddEntriesFrom(input, _repeated_packedUint32_codec);
+ break;
+ }
+ case 746:
+ case 744: {
+ packedUint64_.AddEntriesFrom(input, _repeated_packedUint64_codec);
+ break;
+ }
+ case 754:
+ case 752: {
+ packedSint32_.AddEntriesFrom(input, _repeated_packedSint32_codec);
+ break;
+ }
+ case 762:
+ case 760: {
+ packedSint64_.AddEntriesFrom(input, _repeated_packedSint64_codec);
+ break;
+ }
+ case 770:
+ case 773: {
+ packedFixed32_.AddEntriesFrom(input, _repeated_packedFixed32_codec);
+ break;
+ }
+ case 778:
+ case 777: {
+ packedFixed64_.AddEntriesFrom(input, _repeated_packedFixed64_codec);
+ break;
+ }
+ case 786:
+ case 789: {
+ packedSfixed32_.AddEntriesFrom(input, _repeated_packedSfixed32_codec);
+ break;
+ }
+ case 794:
+ case 793: {
+ packedSfixed64_.AddEntriesFrom(input, _repeated_packedSfixed64_codec);
+ break;
+ }
+ case 802:
+ case 805: {
+ packedFloat_.AddEntriesFrom(input, _repeated_packedFloat_codec);
+ break;
+ }
+ case 810:
+ case 809: {
+ packedDouble_.AddEntriesFrom(input, _repeated_packedDouble_codec);
+ break;
+ }
+ case 818:
+ case 816: {
+ packedBool_.AddEntriesFrom(input, _repeated_packedBool_codec);
+ break;
+ }
+ case 826:
+ case 824: {
+ packedEnum_.AddEntriesFrom(input, _repeated_packedEnum_codec);
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -18885,6 +21321,7 @@
}
}
}
+ #endif
}
@@ -18892,7 +21329,11 @@
/// A message with the same fields as TestPackedTypes, but without packing. Used
/// to test packed <-> unpacked wire compatibility.
/// </summary>
- public sealed partial class TestUnpackedTypes : pb::IMessage<TestUnpackedTypes>, pb::IBufferMessage {
+ public sealed partial class TestUnpackedTypes : pb::IMessage<TestUnpackedTypes>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<TestUnpackedTypes> _parser = new pb::MessageParser<TestUnpackedTypes>(() => new TestUnpackedTypes());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -19205,9 +21646,91 @@
[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 722:
+ case 720: {
+ unpackedInt32_.AddEntriesFrom(input, _repeated_unpackedInt32_codec);
+ break;
+ }
+ case 730:
+ case 728: {
+ unpackedInt64_.AddEntriesFrom(input, _repeated_unpackedInt64_codec);
+ break;
+ }
+ case 738:
+ case 736: {
+ unpackedUint32_.AddEntriesFrom(input, _repeated_unpackedUint32_codec);
+ break;
+ }
+ case 746:
+ case 744: {
+ unpackedUint64_.AddEntriesFrom(input, _repeated_unpackedUint64_codec);
+ break;
+ }
+ case 754:
+ case 752: {
+ unpackedSint32_.AddEntriesFrom(input, _repeated_unpackedSint32_codec);
+ break;
+ }
+ case 762:
+ case 760: {
+ unpackedSint64_.AddEntriesFrom(input, _repeated_unpackedSint64_codec);
+ break;
+ }
+ case 770:
+ case 773: {
+ unpackedFixed32_.AddEntriesFrom(input, _repeated_unpackedFixed32_codec);
+ break;
+ }
+ case 778:
+ case 777: {
+ unpackedFixed64_.AddEntriesFrom(input, _repeated_unpackedFixed64_codec);
+ break;
+ }
+ case 786:
+ case 789: {
+ unpackedSfixed32_.AddEntriesFrom(input, _repeated_unpackedSfixed32_codec);
+ break;
+ }
+ case 794:
+ case 793: {
+ unpackedSfixed64_.AddEntriesFrom(input, _repeated_unpackedSfixed64_codec);
+ break;
+ }
+ case 802:
+ case 805: {
+ unpackedFloat_.AddEntriesFrom(input, _repeated_unpackedFloat_codec);
+ break;
+ }
+ case 810:
+ case 809: {
+ unpackedDouble_.AddEntriesFrom(input, _repeated_unpackedDouble_codec);
+ break;
+ }
+ case 818:
+ case 816: {
+ unpackedBool_.AddEntriesFrom(input, _repeated_unpackedBool_codec);
+ break;
+ }
+ case 826:
+ case 824: {
+ unpackedEnum_.AddEntriesFrom(input, _repeated_unpackedEnum_codec);
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -19289,10 +21812,15 @@
}
}
}
+ #endif
}
- public sealed partial class TestPackedExtensions : pb::IExtendableMessage<TestPackedExtensions>, pb::IBufferMessage {
+ public sealed partial class TestPackedExtensions : pb::IExtendableMessage<TestPackedExtensions>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<TestPackedExtensions> _parser = new pb::MessageParser<TestPackedExtensions>(() => new TestPackedExtensions());
private pb::UnknownFieldSet _unknownFields;
private pb::ExtensionSet<TestPackedExtensions> _extensions;
@@ -19397,9 +21925,23 @@
[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;
@@ -19413,6 +21955,7 @@
}
}
}
+ #endif
public TValue GetExtension<TValue>(pb::Extension<TestPackedExtensions, TValue> extension) {
return pb::ExtensionSet.Get(ref _extensions, extension);
@@ -19438,7 +21981,11 @@
}
- public sealed partial class TestUnpackedExtensions : pb::IExtendableMessage<TestUnpackedExtensions>, pb::IBufferMessage {
+ public sealed partial class TestUnpackedExtensions : pb::IExtendableMessage<TestUnpackedExtensions>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<TestUnpackedExtensions> _parser = new pb::MessageParser<TestUnpackedExtensions>(() => new TestUnpackedExtensions());
private pb::UnknownFieldSet _unknownFields;
private pb::ExtensionSet<TestUnpackedExtensions> _extensions;
@@ -19543,9 +22090,23 @@
[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;
@@ -19559,6 +22120,7 @@
}
}
}
+ #endif
public TValue GetExtension<TValue>(pb::Extension<TestUnpackedExtensions, TValue> extension) {
return pb::ExtensionSet.Get(ref _extensions, extension);
@@ -19589,7 +22151,11 @@
/// a set of extensions to TestAllExtensions dynamically, based on the fields
/// of this message type.
/// </summary>
- public sealed partial class TestDynamicExtensions : pb::IMessage<TestDynamicExtensions>, pb::IBufferMessage {
+ public sealed partial class TestDynamicExtensions : pb::IMessage<TestDynamicExtensions>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<TestDynamicExtensions> _parser = new pb::MessageParser<TestDynamicExtensions>(() => new TestDynamicExtensions());
private pb::UnknownFieldSet _unknownFields;
private int _hasBits0;
@@ -19877,9 +22443,56 @@
[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 16005: {
+ ScalarExtension = input.ReadFixed32();
+ break;
+ }
+ case 16008: {
+ EnumExtension = (global::Google.Protobuf.TestProtos.Proto2.ForeignEnum) input.ReadEnum();
+ break;
+ }
+ case 16016: {
+ DynamicEnumExtension = (global::Google.Protobuf.TestProtos.Proto2.TestDynamicExtensions.Types.DynamicEnumType) input.ReadEnum();
+ break;
+ }
+ case 16026: {
+ if (messageExtension_ == null) {
+ MessageExtension = new global::Google.Protobuf.TestProtos.Proto2.ForeignMessage();
+ }
+ input.ReadMessage(MessageExtension);
+ break;
+ }
+ case 16034: {
+ if (dynamicMessageExtension_ == null) {
+ DynamicMessageExtension = new global::Google.Protobuf.TestProtos.Proto2.TestDynamicExtensions.Types.DynamicMessageType();
+ }
+ input.ReadMessage(DynamicMessageExtension);
+ break;
+ }
+ case 16042: {
+ repeatedExtension_.AddEntriesFrom(input, _repeated_repeatedExtension_codec);
+ break;
+ }
+ case 16050:
+ case 16048: {
+ packedExtension_.AddEntriesFrom(input, _repeated_packedExtension_codec);
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -19926,6 +22539,7 @@
}
}
}
+ #endif
#region Nested types
/// <summary>Container for nested types declared in the TestDynamicExtensions message type.</summary>
@@ -19937,7 +22551,11 @@
[pbr::OriginalName("DYNAMIC_BAZ")] DynamicBaz = 2202,
}
- public sealed partial class DynamicMessageType : pb::IMessage<DynamicMessageType>, pb::IBufferMessage {
+ public sealed partial class DynamicMessageType : pb::IMessage<DynamicMessageType>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<DynamicMessageType> _parser = new pb::MessageParser<DynamicMessageType>(() => new DynamicMessageType());
private pb::UnknownFieldSet _unknownFields;
private int _hasBits0;
@@ -20065,9 +22683,25 @@
[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 16800: {
+ DynamicField = input.ReadInt32();
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -20083,6 +22717,7 @@
}
}
}
+ #endif
}
@@ -20091,7 +22726,11 @@
}
- public sealed partial class TestRepeatedScalarDifferentTagSizes : pb::IMessage<TestRepeatedScalarDifferentTagSizes>, pb::IBufferMessage {
+ public sealed partial class TestRepeatedScalarDifferentTagSizes : pb::IMessage<TestRepeatedScalarDifferentTagSizes>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<TestRepeatedScalarDifferentTagSizes> _parser = new pb::MessageParser<TestRepeatedScalarDifferentTagSizes>(() => new TestRepeatedScalarDifferentTagSizes());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -20290,9 +22929,51 @@
[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 98:
+ case 101: {
+ repeatedFixed32_.AddEntriesFrom(input, _repeated_repeatedFixed32_codec);
+ break;
+ }
+ case 106:
+ case 104: {
+ repeatedInt32_.AddEntriesFrom(input, _repeated_repeatedInt32_codec);
+ break;
+ }
+ case 16370:
+ case 16369: {
+ repeatedFixed64_.AddEntriesFrom(input, _repeated_repeatedFixed64_codec);
+ break;
+ }
+ case 16378:
+ case 16376: {
+ repeatedInt64_.AddEntriesFrom(input, _repeated_repeatedInt64_codec);
+ break;
+ }
+ case 2097138:
+ case 2097141: {
+ repeatedFloat_.AddEntriesFrom(input, _repeated_repeatedFloat_codec);
+ break;
+ }
+ case 2097146:
+ case 2097144: {
+ repeatedUint64_.AddEntriesFrom(input, _repeated_repeatedUint64_codec);
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -20334,6 +23015,7 @@
}
}
}
+ #endif
}
@@ -20341,7 +23023,11 @@
/// Test that if an optional or required message/group field appears multiple
/// times in the input, they need to be merged.
/// </summary>
- public sealed partial class TestParsingMerge : pb::IExtendableMessage<TestParsingMerge>, pb::IBufferMessage {
+ public sealed partial class TestParsingMerge : pb::IExtendableMessage<TestParsingMerge>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<TestParsingMerge> _parser = new pb::MessageParser<TestParsingMerge>(() => new TestParsingMerge());
private pb::UnknownFieldSet _unknownFields;
private pb::ExtensionSet<TestParsingMerge> _extensions;
@@ -20570,9 +23256,52 @@
[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 10: {
+ if (requiredAllTypes_ == null) {
+ RequiredAllTypes = new global::Google.Protobuf.TestProtos.Proto2.TestAllTypes();
+ }
+ input.ReadMessage(RequiredAllTypes);
+ break;
+ }
+ case 18: {
+ if (optionalAllTypes_ == null) {
+ OptionalAllTypes = new global::Google.Protobuf.TestProtos.Proto2.TestAllTypes();
+ }
+ input.ReadMessage(OptionalAllTypes);
+ break;
+ }
+ case 26: {
+ repeatedAllTypes_.AddEntriesFrom(input, _repeated_repeatedAllTypes_codec);
+ break;
+ }
+ case 83: {
+ if (!HasOptionalGroup) {
+ OptionalGroup = new global::Google.Protobuf.TestProtos.Proto2.TestParsingMerge.Types.OptionalGroup();
+ }
+ input.ReadGroup(OptionalGroup);
+ break;
+ }
+ case 163: {
+ repeatedGroup_.AddEntriesFrom(input, _repeated_repeatedGroup_codec);
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -20615,6 +23344,7 @@
}
}
}
+ #endif
public TValue GetExtension<TValue>(pb::Extension<TestParsingMerge, TValue> extension) {
return pb::ExtensionSet.Get(ref _extensions, extension);
@@ -20649,7 +23379,11 @@
/// Repeated fields in RepeatedFieldsGenerator are expected to be merged into
/// the corresponding required/optional fields in TestParsingMerge.
/// </summary>
- public sealed partial class RepeatedFieldsGenerator : pb::IMessage<RepeatedFieldsGenerator>, pb::IBufferMessage {
+ public sealed partial class RepeatedFieldsGenerator : pb::IMessage<RepeatedFieldsGenerator>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<RepeatedFieldsGenerator> _parser = new pb::MessageParser<RepeatedFieldsGenerator>(() => new RepeatedFieldsGenerator());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -20850,9 +23584,49 @@
[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_.AddEntriesFrom(input, _repeated_field1_codec);
+ break;
+ }
+ case 18: {
+ field2_.AddEntriesFrom(input, _repeated_field2_codec);
+ break;
+ }
+ case 26: {
+ field3_.AddEntriesFrom(input, _repeated_field3_codec);
+ break;
+ }
+ case 83: {
+ group1_.AddEntriesFrom(input, _repeated_group1_codec);
+ break;
+ }
+ case 163: {
+ group2_.AddEntriesFrom(input, _repeated_group2_codec);
+ break;
+ }
+ case 8002: {
+ ext1_.AddEntriesFrom(input, _repeated_ext1_codec);
+ break;
+ }
+ case 8010: {
+ ext2_.AddEntriesFrom(input, _repeated_ext2_codec);
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -20892,12 +23666,17 @@
}
}
}
+ #endif
#region Nested types
/// <summary>Container for nested types declared in the RepeatedFieldsGenerator message type.</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static partial class Types {
- public sealed partial class Group1 : pb::IMessage<Group1>, pb::IBufferMessage {
+ public sealed partial class Group1 : pb::IMessage<Group1>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<Group1> _parser = new pb::MessageParser<Group1>(() => new Group1());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -21013,9 +23792,30 @@
[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 84:
+ return;
+ default:
+ _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ break;
+ case 90: {
+ if (field1_ == null) {
+ Field1 = new global::Google.Protobuf.TestProtos.Proto2.TestAllTypes();
+ }
+ input.ReadMessage(Field1);
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -21036,10 +23836,15 @@
}
}
}
+ #endif
}
- public sealed partial class Group2 : pb::IMessage<Group2>, pb::IBufferMessage {
+ public sealed partial class Group2 : pb::IMessage<Group2>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<Group2> _parser = new pb::MessageParser<Group2>(() => new Group2());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -21155,9 +23960,30 @@
[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 164:
+ return;
+ default:
+ _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ break;
+ case 170: {
+ if (field1_ == null) {
+ Field1 = new global::Google.Protobuf.TestProtos.Proto2.TestAllTypes();
+ }
+ input.ReadMessage(Field1);
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -21178,6 +24004,7 @@
}
}
}
+ #endif
}
@@ -21186,7 +24013,11 @@
}
- 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;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -21302,9 +24133,30 @@
[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 84:
+ return;
+ default:
+ _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ break;
+ case 90: {
+ if (optionalGroupAllTypes_ == null) {
+ OptionalGroupAllTypes = new global::Google.Protobuf.TestProtos.Proto2.TestAllTypes();
+ }
+ input.ReadMessage(OptionalGroupAllTypes);
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -21325,10 +24177,15 @@
}
}
}
+ #endif
}
- public sealed partial class RepeatedGroup : pb::IMessage<RepeatedGroup>, pb::IBufferMessage {
+ public sealed partial class RepeatedGroup : pb::IMessage<RepeatedGroup>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<RepeatedGroup> _parser = new pb::MessageParser<RepeatedGroup>(() => new RepeatedGroup());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -21444,9 +24301,30 @@
[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 164:
+ return;
+ default:
+ _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ break;
+ case 170: {
+ if (repeatedGroupAllTypes_ == null) {
+ RepeatedGroupAllTypes = new global::Google.Protobuf.TestProtos.Proto2.TestAllTypes();
+ }
+ input.ReadMessage(RepeatedGroupAllTypes);
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -21467,6 +24345,7 @@
}
}
}
+ #endif
}
@@ -21486,7 +24365,11 @@
}
- public sealed partial class TestCommentInjectionMessage : pb::IMessage<TestCommentInjectionMessage>, pb::IBufferMessage {
+ public sealed partial class TestCommentInjectionMessage : pb::IMessage<TestCommentInjectionMessage>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<TestCommentInjectionMessage> _parser = new pb::MessageParser<TestCommentInjectionMessage>(() => new TestCommentInjectionMessage());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -21614,9 +24497,25 @@
[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: {
+ A = input.ReadString();
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -21632,13 +24531,18 @@
}
}
}
+ #endif
}
/// <summary>
/// Test that RPC services work.
/// </summary>
- public sealed partial class FooRequest : pb::IMessage<FooRequest>, pb::IBufferMessage {
+ public sealed partial class FooRequest : pb::IMessage<FooRequest>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<FooRequest> _parser = new pb::MessageParser<FooRequest>(() => new FooRequest());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -21727,9 +24631,21 @@
[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;
@@ -21741,10 +24657,15 @@
}
}
}
+ #endif
}
- public sealed partial class FooResponse : pb::IMessage<FooResponse>, pb::IBufferMessage {
+ public sealed partial class FooResponse : pb::IMessage<FooResponse>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<FooResponse> _parser = new pb::MessageParser<FooResponse>(() => new FooResponse());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -21833,9 +24754,21 @@
[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;
@@ -21847,10 +24780,15 @@
}
}
}
+ #endif
}
- public sealed partial class FooClientMessage : pb::IMessage<FooClientMessage>, pb::IBufferMessage {
+ public sealed partial class FooClientMessage : pb::IMessage<FooClientMessage>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<FooClientMessage> _parser = new pb::MessageParser<FooClientMessage>(() => new FooClientMessage());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -21939,9 +24877,21 @@
[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;
@@ -21953,10 +24903,15 @@
}
}
}
+ #endif
}
- public sealed partial class FooServerMessage : pb::IMessage<FooServerMessage>, pb::IBufferMessage {
+ public sealed partial class FooServerMessage : pb::IMessage<FooServerMessage>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<FooServerMessage> _parser = new pb::MessageParser<FooServerMessage>(() => new FooServerMessage());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -22045,9 +25000,21 @@
[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;
@@ -22059,10 +25026,15 @@
}
}
}
+ #endif
}
- public sealed partial class BarRequest : pb::IMessage<BarRequest>, pb::IBufferMessage {
+ public sealed partial class BarRequest : pb::IMessage<BarRequest>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<BarRequest> _parser = new pb::MessageParser<BarRequest>(() => new BarRequest());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -22151,9 +25123,21 @@
[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;
@@ -22165,10 +25149,15 @@
}
}
}
+ #endif
}
- public sealed partial class BarResponse : pb::IMessage<BarResponse>, pb::IBufferMessage {
+ public sealed partial class BarResponse : pb::IMessage<BarResponse>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<BarResponse> _parser = new pb::MessageParser<BarResponse>(() => new BarResponse());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -22257,9 +25246,21 @@
[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;
@@ -22271,10 +25272,15 @@
}
}
}
+ #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;
private int _hasBits0;
@@ -22587,9 +25593,45 @@
[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: {
+ FieldName1 = input.ReadInt32();
+ break;
+ }
+ case 16: {
+ FieldName2 = input.ReadInt32();
+ break;
+ }
+ case 24: {
+ FieldName3 = input.ReadInt32();
+ break;
+ }
+ case 32: {
+ FieldName4 = input.ReadInt32();
+ break;
+ }
+ case 40: {
+ FIELDNAME5 = input.ReadInt32();
+ break;
+ }
+ case 48: {
+ FieldName6 = input.ReadInt32();
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -22625,10 +25667,15 @@
}
}
}
+ #endif
}
- public sealed partial class TestHugeFieldNumbers : pb::IExtendableMessage<TestHugeFieldNumbers>, pb::IBufferMessage {
+ public sealed partial class TestHugeFieldNumbers : pb::IExtendableMessage<TestHugeFieldNumbers>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<TestHugeFieldNumbers> _parser = new pb::MessageParser<TestHugeFieldNumbers>(() => new TestHugeFieldNumbers());
private pb::UnknownFieldSet _unknownFields;
private pb::ExtensionSet<TestHugeFieldNumbers> _extensions;
@@ -23203,9 +26250,92 @@
[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 4294960000: {
+ OptionalInt32 = input.ReadInt32();
+ break;
+ }
+ case 4294960008: {
+ Fixed32 = input.ReadInt32();
+ break;
+ }
+ case 4294960018:
+ case 4294960016: {
+ repeatedInt32_.AddEntriesFrom(input, _repeated_repeatedInt32_codec);
+ break;
+ }
+ case 4294960026:
+ case 4294960024: {
+ packedInt32_.AddEntriesFrom(input, _repeated_packedInt32_codec);
+ break;
+ }
+ case 4294960032: {
+ OptionalEnum = (global::Google.Protobuf.TestProtos.Proto2.ForeignEnum) input.ReadEnum();
+ break;
+ }
+ case 4294960042: {
+ OptionalString = input.ReadString();
+ break;
+ }
+ case 4294960050: {
+ OptionalBytes = input.ReadBytes();
+ break;
+ }
+ case 4294960058: {
+ if (optionalMessage_ == null) {
+ OptionalMessage = new global::Google.Protobuf.TestProtos.Proto2.ForeignMessage();
+ }
+ input.ReadMessage(OptionalMessage);
+ break;
+ }
+ case 4294960067: {
+ if (!HasOptionalGroup) {
+ OptionalGroup = new global::Google.Protobuf.TestProtos.Proto2.TestHugeFieldNumbers.Types.OptionalGroup();
+ }
+ input.ReadGroup(OptionalGroup);
+ break;
+ }
+ case 4294960082: {
+ stringStringMap_.AddEntriesFrom(input, _map_stringStringMap_codec);
+ break;
+ }
+ case 4294960088: {
+ OneofUint32 = input.ReadUInt32();
+ break;
+ }
+ case 4294960098: {
+ global::Google.Protobuf.TestProtos.Proto2.TestAllTypes subBuilder = new global::Google.Protobuf.TestProtos.Proto2.TestAllTypes();
+ if (oneofFieldCase_ == OneofFieldOneofCase.OneofTestAllTypes) {
+ subBuilder.MergeFrom(OneofTestAllTypes);
+ }
+ input.ReadMessage(subBuilder);
+ OneofTestAllTypes = subBuilder;
+ break;
+ }
+ case 4294960106: {
+ OneofString = input.ReadString();
+ break;
+ }
+ case 4294960114: {
+ OneofBytes = input.ReadBytes();
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -23288,6 +26418,7 @@
}
}
}
+ #endif
public TValue GetExtension<TValue>(pb::Extension<TestHugeFieldNumbers, TValue> extension) {
return pb::ExtensionSet.Get(ref _extensions, extension);
@@ -23315,7 +26446,11 @@
/// <summary>Container for nested types declared in the TestHugeFieldNumbers 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;
@@ -23443,9 +26578,27 @@
[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 4294960068:
+ return;
+ default:
+ _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ break;
+ case 4294960072: {
+ GroupA = input.ReadInt32();
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -23463,6 +26616,7 @@
}
}
}
+ #endif
}
@@ -23471,7 +26625,11 @@
}
- public sealed partial class TestExtensionInsideTable : pb::IExtendableMessage<TestExtensionInsideTable>, pb::IBufferMessage {
+ public sealed partial class TestExtensionInsideTable : pb::IExtendableMessage<TestExtensionInsideTable>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<TestExtensionInsideTable> _parser = new pb::MessageParser<TestExtensionInsideTable>(() => new TestExtensionInsideTable());
private pb::UnknownFieldSet _unknownFields;
private pb::ExtensionSet<TestExtensionInsideTable> _extensions;
@@ -23911,9 +27069,59 @@
[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: {
+ Field1 = input.ReadInt32();
+ break;
+ }
+ case 16: {
+ Field2 = input.ReadInt32();
+ break;
+ }
+ case 24: {
+ Field3 = input.ReadInt32();
+ break;
+ }
+ case 32: {
+ Field4 = input.ReadInt32();
+ break;
+ }
+ case 48: {
+ Field6 = input.ReadInt32();
+ break;
+ }
+ case 56: {
+ Field7 = input.ReadInt32();
+ break;
+ }
+ case 64: {
+ Field8 = input.ReadInt32();
+ break;
+ }
+ case 72: {
+ Field9 = input.ReadInt32();
+ break;
+ }
+ case 80: {
+ Field10 = input.ReadInt32();
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -23963,6 +27171,7 @@
}
}
}
+ #endif
public TValue GetExtension<TValue>(pb::Extension<TestExtensionInsideTable, TValue> extension) {
return pb::ExtensionSet.Get(ref _extensions, extension);
diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestCustomOptionsProto3.cs b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestCustomOptionsProto3.cs
index 818748b..26455da 100644
--- a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestCustomOptionsProto3.cs
+++ b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestCustomOptionsProto3.cs
@@ -257,7 +257,11 @@
/// 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 @@
[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 @@
}
}
}
+ #endif
#region Nested types
/// <summary>Container for nested types declared in the TestMessageWithCustomOptions message type.</summary>
@@ -464,7 +489,11 @@
/// 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 @@
[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 @@
}
}
}
+ #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 @@
[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 @@
}
}
}
+ #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 @@
[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 @@
}
}
}
+ #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 @@
[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 @@
}
}
}
+ #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 @@
[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 @@
}
}
}
+ #endif
#region Nested types
/// <summary>Container for nested types declared in the DummyMessageContainingEnum message type.</summary>
@@ -1007,7 +1117,11 @@
}
- 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 @@
[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 @@
}
}
}
+ #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 @@
[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 @@
}
}
}
+ #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 @@
[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 @@
}
}
}
+ #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 @@
[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 @@
}
}
}
+ #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 @@
[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 @@
}
}
}
+ #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 @@
[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 @@
}
}
}
+ #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 @@
[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 @@
}
}
}
+ #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 @@
[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 @@
}
}
}
+ #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 @@
[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 @@
}
}
}
+ #endif
#region Extensions
/// <summary>Container for extensions for other messages declared in the ComplexOptionType4 message type.</summary>
@@ -2226,7 +2532,11 @@
}
- 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 @@
[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 @@
}
}
}
+ #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 @@
[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 @@
}
}
}
+ #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 @@
[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 @@
}
}
}
+ #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 @@
[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 @@
}
}
}
+ #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 @@
[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 @@
}
}
}
+ #endif
#region Nested types
/// <summary>Container for nested types declared in the NestedOptionType message type.</summary>
@@ -2921,7 +3335,11 @@
[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 @@
[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 @@
}
}
}
+ #endif
}
diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestImport.cs b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestImport.cs
index 1cddcd8..6ac9f11 100644
--- a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestImport.cs
+++ b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestImport.cs
@@ -59,7 +59,11 @@
#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 @@
[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 @@
}
}
}
+ #endif
}
diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestImportProto3.cs b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestImportProto3.cs
index bcd27bf..99575b1 100644
--- a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestImportProto3.cs
+++ b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestImportProto3.cs
@@ -50,7 +50,11 @@
#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 @@
[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 @@
}
}
}
+ #endif
}
diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestImportPublic.cs b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestImportPublic.cs
index 6b35c10..9bdcf1d 100644
--- a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestImportPublic.cs
+++ b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestImportPublic.cs
@@ -37,7 +37,11 @@
}
#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 @@
[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 @@
}
}
}
+ #endif
}
diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestImportPublicProto3.cs b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestImportPublicProto3.cs
index 664c666..dba9165 100644
--- a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestImportPublicProto3.cs
+++ b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestImportPublicProto3.cs
@@ -38,7 +38,11 @@
}
#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 @@
[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 @@
}
}
}
+ #endif
}
diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssue6936B.cs b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssue6936B.cs
index bede87a..660dbbd 100644
--- a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssue6936B.cs
+++ b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssue6936B.cs
@@ -37,7 +37,11 @@
}
#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 @@
[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 @@
}
}
}
+ #endif
}
diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssue6936C.cs b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssue6936C.cs
index e86780f..b7498d6 100644
--- a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssue6936C.cs
+++ b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssue6936C.cs
@@ -39,7 +39,11 @@
}
#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 @@
[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 @@
}
}
}
+ #endif
}
diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssues.cs b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssues.cs
index 68884e1..f5c46a9 100644
--- a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssues.cs
+++ b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssues.cs
@@ -88,7 +88,11 @@
/// 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 @@
[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 @@
}
}
}
+ #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 @@
[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 @@
}
}
}
+ #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 @@
[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 @@
}
}
}
+ #endif
}
@@ -420,7 +471,11 @@
}
- 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 @@
[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 @@
}
}
}
+ #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 @@
[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 @@
}
}
}
+ #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 @@
[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 @@
}
}
}
+ #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 @@
[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 @@
}
}
}
+ #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 @@
[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 @@
}
}
}
+ #endif
#region Nested types
/// <summary>Container for nested types declared in the ReservedNames message type.</summary>
@@ -1270,7 +1461,11 @@
/// <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 @@
[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 @@
}
}
}
+ #endif
}
@@ -1393,7 +1601,11 @@
/// 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 @@
[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 @@
}
}
}
+ #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 @@
[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 @@
}
}
}
+ #endif
}
@@ -1927,7 +2205,11 @@
/// 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 @@
[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 @@
}
}
}
+ #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 @@
[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 @@
}
}
}
+ #endif
}
diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestProto3.cs b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestProto3.cs
index 5d0ea86..468e48b 100644
--- a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestProto3.cs
+++ b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestProto3.cs
@@ -254,7 +254,11 @@
/// This proto includes every type of field in both singular and repeated
/// forms.
/// </summary>
- public sealed partial class TestAllTypes : pb::IMessage<TestAllTypes>, pb::IBufferMessage {
+ public sealed partial class TestAllTypes : pb::IMessage<TestAllTypes>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<TestAllTypes> _parser = new pb::MessageParser<TestAllTypes>(() => new TestAllTypes());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1383,9 +1387,246 @@
[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: {
+ SingleInt32 = input.ReadInt32();
+ break;
+ }
+ case 16: {
+ SingleInt64 = input.ReadInt64();
+ break;
+ }
+ case 24: {
+ SingleUint32 = input.ReadUInt32();
+ break;
+ }
+ case 32: {
+ SingleUint64 = input.ReadUInt64();
+ break;
+ }
+ case 40: {
+ SingleSint32 = input.ReadSInt32();
+ break;
+ }
+ case 48: {
+ SingleSint64 = input.ReadSInt64();
+ break;
+ }
+ case 61: {
+ SingleFixed32 = input.ReadFixed32();
+ break;
+ }
+ case 65: {
+ SingleFixed64 = input.ReadFixed64();
+ break;
+ }
+ case 77: {
+ SingleSfixed32 = input.ReadSFixed32();
+ break;
+ }
+ case 81: {
+ SingleSfixed64 = input.ReadSFixed64();
+ break;
+ }
+ case 93: {
+ SingleFloat = input.ReadFloat();
+ break;
+ }
+ case 97: {
+ SingleDouble = input.ReadDouble();
+ break;
+ }
+ case 104: {
+ SingleBool = input.ReadBool();
+ break;
+ }
+ case 114: {
+ SingleString = input.ReadString();
+ break;
+ }
+ case 122: {
+ SingleBytes = input.ReadBytes();
+ break;
+ }
+ case 146: {
+ if (singleNestedMessage_ == null) {
+ SingleNestedMessage = new global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage();
+ }
+ input.ReadMessage(SingleNestedMessage);
+ break;
+ }
+ case 154: {
+ if (singleForeignMessage_ == null) {
+ SingleForeignMessage = new global::Google.Protobuf.TestProtos.ForeignMessage();
+ }
+ input.ReadMessage(SingleForeignMessage);
+ break;
+ }
+ case 162: {
+ if (singleImportMessage_ == null) {
+ SingleImportMessage = new global::Google.Protobuf.TestProtos.ImportMessage();
+ }
+ input.ReadMessage(SingleImportMessage);
+ break;
+ }
+ case 168: {
+ SingleNestedEnum = (global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedEnum) input.ReadEnum();
+ break;
+ }
+ case 176: {
+ SingleForeignEnum = (global::Google.Protobuf.TestProtos.ForeignEnum) input.ReadEnum();
+ break;
+ }
+ case 184: {
+ SingleImportEnum = (global::Google.Protobuf.TestProtos.ImportEnum) input.ReadEnum();
+ break;
+ }
+ case 210: {
+ if (singlePublicImportMessage_ == null) {
+ SinglePublicImportMessage = new global::Google.Protobuf.TestProtos.PublicImportMessage();
+ }
+ input.ReadMessage(SinglePublicImportMessage);
+ 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 402: {
+ repeatedImportMessage_.AddEntriesFrom(input, _repeated_repeatedImportMessage_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 426:
+ case 424: {
+ repeatedImportEnum_.AddEntriesFrom(input, _repeated_repeatedImportEnum_codec);
+ break;
+ }
+ case 434: {
+ repeatedPublicImportMessage_.AddEntriesFrom(input, _repeated_repeatedPublicImportMessage_codec);
+ break;
+ }
+ case 888: {
+ OneofUint32 = input.ReadUInt32();
+ break;
+ }
+ case 898: {
+ global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage subBuilder = new global::Google.Protobuf.TestProtos.TestAllTypes.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;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -1622,6 +1863,7 @@
}
}
}
+ #endif
#region Nested types
/// <summary>Container for nested types declared in the TestAllTypes message type.</summary>
@@ -1638,7 +1880,11 @@
[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;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1756,9 +2002,25 @@
[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;
@@ -1774,6 +2036,7 @@
}
}
}
+ #endif
}
@@ -1785,7 +2048,11 @@
/// <summary>
/// This proto includes a recursively nested message.
/// </summary>
- public sealed partial class NestedTestAllTypes : pb::IMessage<NestedTestAllTypes>, pb::IBufferMessage {
+ public sealed partial class NestedTestAllTypes : pb::IMessage<NestedTestAllTypes>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<NestedTestAllTypes> _parser = new pb::MessageParser<NestedTestAllTypes>(() => new NestedTestAllTypes());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1944,9 +2211,39 @@
[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 (child_ == null) {
+ Child = new global::Google.Protobuf.TestProtos.NestedTestAllTypes();
+ }
+ input.ReadMessage(Child);
+ break;
+ }
+ case 18: {
+ if (payload_ == null) {
+ Payload = new global::Google.Protobuf.TestProtos.TestAllTypes();
+ }
+ input.ReadMessage(Payload);
+ break;
+ }
+ case 26: {
+ repeatedChild_.AddEntriesFrom(input, _repeated_repeatedChild_codec);
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -1976,10 +2273,15 @@
}
}
}
+ #endif
}
- public sealed partial class TestDeprecatedFields : pb::IMessage<TestDeprecatedFields>, pb::IBufferMessage {
+ public sealed partial class TestDeprecatedFields : pb::IMessage<TestDeprecatedFields>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<TestDeprecatedFields> _parser = new pb::MessageParser<TestDeprecatedFields>(() => new TestDeprecatedFields());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -2093,9 +2395,25 @@
[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: {
+ DeprecatedInt32 = input.ReadInt32();
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -2111,6 +2429,7 @@
}
}
}
+ #endif
}
@@ -2118,7 +2437,11 @@
/// Define these after TestAllTypes to make sure the compiler can handle
/// that.
/// </summary>
- 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]
@@ -2231,9 +2554,25 @@
[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;
@@ -2249,10 +2588,15 @@
}
}
}
+ #endif
}
- public sealed partial class TestReservedFields : pb::IMessage<TestReservedFields>, pb::IBufferMessage {
+ public sealed partial class TestReservedFields : pb::IMessage<TestReservedFields>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<TestReservedFields> _parser = new pb::MessageParser<TestReservedFields>(() => new TestReservedFields());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -2341,9 +2685,21 @@
[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;
@@ -2355,13 +2711,18 @@
}
}
}
+ #endif
}
/// <summary>
/// Test that we can use NestedMessage from outside TestAllTypes.
/// </summary>
- public sealed partial class TestForeignNested : pb::IMessage<TestForeignNested>, pb::IBufferMessage {
+ public sealed partial class TestForeignNested : pb::IMessage<TestForeignNested>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<TestForeignNested> _parser = new pb::MessageParser<TestForeignNested>(() => new TestForeignNested());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -2477,9 +2838,28 @@
[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 (foreignNested_ == null) {
+ ForeignNested = new global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage();
+ }
+ input.ReadMessage(ForeignNested);
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -2498,13 +2878,18 @@
}
}
}
+ #endif
}
/// <summary>
/// Test that really large tag numbers don't break anything.
/// </summary>
- public sealed partial class TestReallyLargeTagNumber : pb::IMessage<TestReallyLargeTagNumber>, pb::IBufferMessage {
+ public sealed partial class TestReallyLargeTagNumber : pb::IMessage<TestReallyLargeTagNumber>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<TestReallyLargeTagNumber> _parser = new pb::MessageParser<TestReallyLargeTagNumber>(() => new TestReallyLargeTagNumber());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -2645,9 +3030,29 @@
[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 2147483640: {
+ 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;
@@ -2667,10 +3072,15 @@
}
}
}
+ #endif
}
- public sealed partial class TestRecursiveMessage : pb::IMessage<TestRecursiveMessage>, pb::IBufferMessage {
+ public sealed partial class TestRecursiveMessage : pb::IMessage<TestRecursiveMessage>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<TestRecursiveMessage> _parser = new pb::MessageParser<TestRecursiveMessage>(() => new TestRecursiveMessage());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -2810,9 +3220,32 @@
[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 (a_ == null) {
+ A = new global::Google.Protobuf.TestProtos.TestRecursiveMessage();
+ }
+ input.ReadMessage(A);
+ break;
+ }
+ case 16: {
+ 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;
@@ -2835,13 +3268,18 @@
}
}
}
+ #endif
}
/// <summary>
/// Test that mutual recursion works.
/// </summary>
- public sealed partial class TestMutualRecursionA : pb::IMessage<TestMutualRecursionA>, pb::IBufferMessage {
+ public sealed partial class TestMutualRecursionA : pb::IMessage<TestMutualRecursionA>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<TestMutualRecursionA> _parser = new pb::MessageParser<TestMutualRecursionA>(() => new TestMutualRecursionA());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -2957,9 +3395,28 @@
[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 (bb_ == null) {
+ Bb = new global::Google.Protobuf.TestProtos.TestMutualRecursionB();
+ }
+ input.ReadMessage(Bb);
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -2978,10 +3435,15 @@
}
}
}
+ #endif
}
- public sealed partial class TestMutualRecursionB : pb::IMessage<TestMutualRecursionB>, pb::IBufferMessage {
+ public sealed partial class TestMutualRecursionB : pb::IMessage<TestMutualRecursionB>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<TestMutualRecursionB> _parser = new pb::MessageParser<TestMutualRecursionB>(() => new TestMutualRecursionB());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -3121,9 +3583,32 @@
[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 (a_ == null) {
+ A = new global::Google.Protobuf.TestProtos.TestMutualRecursionA();
+ }
+ input.ReadMessage(A);
+ break;
+ }
+ case 16: {
+ OptionalInt32 = input.ReadInt32();
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -3146,10 +3631,15 @@
}
}
}
+ #endif
}
- public sealed partial class TestEnumAllowAlias : pb::IMessage<TestEnumAllowAlias>, pb::IBufferMessage {
+ public sealed partial class TestEnumAllowAlias : pb::IMessage<TestEnumAllowAlias>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<TestEnumAllowAlias> _parser = new pb::MessageParser<TestEnumAllowAlias>(() => new TestEnumAllowAlias());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -3262,9 +3752,25 @@
[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::Google.Protobuf.TestProtos.TestEnumWithDupValue) input.ReadEnum();
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -3280,6 +3786,7 @@
}
}
}
+ #endif
}
@@ -3287,7 +3794,11 @@
/// Test message with CamelCase field names. This violates Protocol Buffer
/// standard style.
/// </summary>
- public sealed partial class TestCamelCaseFieldNames : pb::IMessage<TestCamelCaseFieldNames>, pb::IBufferMessage {
+ public sealed partial class TestCamelCaseFieldNames : pb::IMessage<TestCamelCaseFieldNames>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<TestCamelCaseFieldNames> _parser = new pb::MessageParser<TestCamelCaseFieldNames>(() => new TestCamelCaseFieldNames());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -3539,9 +4050,58 @@
[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: {
+ PrimitiveField = input.ReadInt32();
+ break;
+ }
+ case 18: {
+ StringField = input.ReadString();
+ break;
+ }
+ case 24: {
+ EnumField = (global::Google.Protobuf.TestProtos.ForeignEnum) input.ReadEnum();
+ break;
+ }
+ case 34: {
+ if (messageField_ == null) {
+ MessageField = new global::Google.Protobuf.TestProtos.ForeignMessage();
+ }
+ input.ReadMessage(MessageField);
+ break;
+ }
+ case 58:
+ case 56: {
+ repeatedPrimitiveField_.AddEntriesFrom(input, _repeated_repeatedPrimitiveField_codec);
+ break;
+ }
+ case 66: {
+ repeatedStringField_.AddEntriesFrom(input, _repeated_repeatedStringField_codec);
+ break;
+ }
+ case 74:
+ case 72: {
+ repeatedEnumField_.AddEntriesFrom(input, _repeated_repeatedEnumField_codec);
+ break;
+ }
+ case 82: {
+ repeatedMessageField_.AddEntriesFrom(input, _repeated_repeatedMessageField_codec);
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -3590,6 +4150,7 @@
}
}
}
+ #endif
}
@@ -3597,7 +4158,11 @@
/// We list fields out of order, to ensure that we're using field number and not
/// field index to determine serialization order.
/// </summary>
- public sealed partial class TestFieldOrderings : pb::IMessage<TestFieldOrderings>, pb::IBufferMessage {
+ public sealed partial class TestFieldOrderings : pb::IMessage<TestFieldOrderings>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<TestFieldOrderings> _parser = new pb::MessageParser<TestFieldOrderings>(() => new TestFieldOrderings());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -3785,9 +4350,40 @@
[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: {
+ MyInt = input.ReadInt64();
+ break;
+ }
+ case 90: {
+ MyString = input.ReadString();
+ break;
+ }
+ case 813: {
+ MyFloat = input.ReadFloat();
+ break;
+ }
+ case 1602: {
+ if (singleNestedMessage_ == null) {
+ SingleNestedMessage = new global::Google.Protobuf.TestProtos.TestFieldOrderings.Types.NestedMessage();
+ }
+ input.ReadMessage(SingleNestedMessage);
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -3818,12 +4414,17 @@
}
}
}
+ #endif
#region Nested types
/// <summary>Container for nested types declared in the TestFieldOrderings message type.</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static partial class Types {
- 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]
@@ -3965,9 +4566,29 @@
[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;
+ }
+ case 16: {
+ Oo = input.ReadInt64();
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -3987,6 +4608,7 @@
}
}
}
+ #endif
}
@@ -3995,7 +4617,11 @@
}
- public sealed partial class SparseEnumMessage : pb::IMessage<SparseEnumMessage>, pb::IBufferMessage {
+ public sealed partial class SparseEnumMessage : pb::IMessage<SparseEnumMessage>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<SparseEnumMessage> _parser = new pb::MessageParser<SparseEnumMessage>(() => new SparseEnumMessage());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -4108,9 +4734,25 @@
[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: {
+ SparseEnum = (global::Google.Protobuf.TestProtos.TestSparseEnum) input.ReadEnum();
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -4126,13 +4768,18 @@
}
}
}
+ #endif
}
/// <summary>
/// Test String and Bytes: string is for valid UTF-8 strings
/// </summary>
- public sealed partial class OneString : pb::IMessage<OneString>, pb::IBufferMessage {
+ public sealed partial class OneString : pb::IMessage<OneString>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<OneString> _parser = new pb::MessageParser<OneString>(() => new OneString());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -4245,9 +4892,25 @@
[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: {
+ Data = input.ReadString();
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -4263,10 +4926,15 @@
}
}
}
+ #endif
}
- public sealed partial class MoreString : pb::IMessage<MoreString>, pb::IBufferMessage {
+ public sealed partial class MoreString : pb::IMessage<MoreString>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<MoreString> _parser = new pb::MessageParser<MoreString>(() => new MoreString());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -4371,9 +5039,25 @@
[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: {
+ data_.AddEntriesFrom(input, _repeated_data_codec);
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -4389,10 +5073,15 @@
}
}
}
+ #endif
}
- public sealed partial class OneBytes : pb::IMessage<OneBytes>, pb::IBufferMessage {
+ public sealed partial class OneBytes : pb::IMessage<OneBytes>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<OneBytes> _parser = new pb::MessageParser<OneBytes>(() => new OneBytes());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -4505,9 +5194,25 @@
[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: {
+ Data = input.ReadBytes();
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -4523,10 +5228,15 @@
}
}
}
+ #endif
}
- public sealed partial class MoreBytes : pb::IMessage<MoreBytes>, pb::IBufferMessage {
+ public sealed partial class MoreBytes : pb::IMessage<MoreBytes>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<MoreBytes> _parser = new pb::MessageParser<MoreBytes>(() => new MoreBytes());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -4639,9 +5349,25 @@
[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: {
+ Data = input.ReadBytes();
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -4657,13 +5383,18 @@
}
}
}
+ #endif
}
/// <summary>
/// Test int32, uint32, int64, uint64, and bool are all compatible
/// </summary>
- public sealed partial class Int32Message : pb::IMessage<Int32Message>, pb::IBufferMessage {
+ public sealed partial class Int32Message : pb::IMessage<Int32Message>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<Int32Message> _parser = new pb::MessageParser<Int32Message>(() => new Int32Message());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -4776,9 +5507,25 @@
[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: {
+ Data = input.ReadInt32();
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -4794,10 +5541,15 @@
}
}
}
+ #endif
}
- public sealed partial class Uint32Message : pb::IMessage<Uint32Message>, pb::IBufferMessage {
+ public sealed partial class Uint32Message : pb::IMessage<Uint32Message>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<Uint32Message> _parser = new pb::MessageParser<Uint32Message>(() => new Uint32Message());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -4910,9 +5662,25 @@
[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: {
+ Data = input.ReadUInt32();
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -4928,10 +5696,15 @@
}
}
}
+ #endif
}
- public sealed partial class Int64Message : pb::IMessage<Int64Message>, pb::IBufferMessage {
+ public sealed partial class Int64Message : pb::IMessage<Int64Message>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<Int64Message> _parser = new pb::MessageParser<Int64Message>(() => new Int64Message());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -5044,9 +5817,25 @@
[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: {
+ Data = input.ReadInt64();
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -5062,10 +5851,15 @@
}
}
}
+ #endif
}
- public sealed partial class Uint64Message : pb::IMessage<Uint64Message>, pb::IBufferMessage {
+ public sealed partial class Uint64Message : pb::IMessage<Uint64Message>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<Uint64Message> _parser = new pb::MessageParser<Uint64Message>(() => new Uint64Message());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -5178,9 +5972,25 @@
[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: {
+ Data = input.ReadUInt64();
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -5196,10 +6006,15 @@
}
}
}
+ #endif
}
- public sealed partial class BoolMessage : pb::IMessage<BoolMessage>, pb::IBufferMessage {
+ public sealed partial class BoolMessage : pb::IMessage<BoolMessage>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<BoolMessage> _parser = new pb::MessageParser<BoolMessage>(() => new BoolMessage());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -5312,9 +6127,25 @@
[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: {
+ Data = input.ReadBool();
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -5330,13 +6161,18 @@
}
}
}
+ #endif
}
/// <summary>
/// Test oneofs.
/// </summary>
- public sealed partial class TestOneof : pb::IMessage<TestOneof>, pb::IBufferMessage {
+ public sealed partial class TestOneof : pb::IMessage<TestOneof>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<TestOneof> _parser = new pb::MessageParser<TestOneof>(() => new TestOneof());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -5534,9 +6370,38 @@
[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: {
+ FooInt = input.ReadInt32();
+ break;
+ }
+ case 18: {
+ FooString = input.ReadString();
+ break;
+ }
+ case 26: {
+ global::Google.Protobuf.TestProtos.TestAllTypes subBuilder = new global::Google.Protobuf.TestProtos.TestAllTypes();
+ if (fooCase_ == FooOneofCase.FooMessage) {
+ subBuilder.MergeFrom(FooMessage);
+ }
+ input.ReadMessage(subBuilder);
+ FooMessage = subBuilder;
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -5565,10 +6430,15 @@
}
}
}
+ #endif
}
- public sealed partial class TestPackedTypes : pb::IMessage<TestPackedTypes>, pb::IBufferMessage {
+ public sealed partial class TestPackedTypes : pb::IMessage<TestPackedTypes>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<TestPackedTypes> _parser = new pb::MessageParser<TestPackedTypes>(() => new TestPackedTypes());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -5881,9 +6751,91 @@
[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 722:
+ case 720: {
+ packedInt32_.AddEntriesFrom(input, _repeated_packedInt32_codec);
+ break;
+ }
+ case 730:
+ case 728: {
+ packedInt64_.AddEntriesFrom(input, _repeated_packedInt64_codec);
+ break;
+ }
+ case 738:
+ case 736: {
+ packedUint32_.AddEntriesFrom(input, _repeated_packedUint32_codec);
+ break;
+ }
+ case 746:
+ case 744: {
+ packedUint64_.AddEntriesFrom(input, _repeated_packedUint64_codec);
+ break;
+ }
+ case 754:
+ case 752: {
+ packedSint32_.AddEntriesFrom(input, _repeated_packedSint32_codec);
+ break;
+ }
+ case 762:
+ case 760: {
+ packedSint64_.AddEntriesFrom(input, _repeated_packedSint64_codec);
+ break;
+ }
+ case 770:
+ case 773: {
+ packedFixed32_.AddEntriesFrom(input, _repeated_packedFixed32_codec);
+ break;
+ }
+ case 778:
+ case 777: {
+ packedFixed64_.AddEntriesFrom(input, _repeated_packedFixed64_codec);
+ break;
+ }
+ case 786:
+ case 789: {
+ packedSfixed32_.AddEntriesFrom(input, _repeated_packedSfixed32_codec);
+ break;
+ }
+ case 794:
+ case 793: {
+ packedSfixed64_.AddEntriesFrom(input, _repeated_packedSfixed64_codec);
+ break;
+ }
+ case 802:
+ case 805: {
+ packedFloat_.AddEntriesFrom(input, _repeated_packedFloat_codec);
+ break;
+ }
+ case 810:
+ case 809: {
+ packedDouble_.AddEntriesFrom(input, _repeated_packedDouble_codec);
+ break;
+ }
+ case 818:
+ case 816: {
+ packedBool_.AddEntriesFrom(input, _repeated_packedBool_codec);
+ break;
+ }
+ case 826:
+ case 824: {
+ packedEnum_.AddEntriesFrom(input, _repeated_packedEnum_codec);
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -5965,6 +6917,7 @@
}
}
}
+ #endif
}
@@ -5972,7 +6925,11 @@
/// A message with the same fields as TestPackedTypes, but without packing. Used
/// to test packed <-> unpacked wire compatibility.
/// </summary>
- public sealed partial class TestUnpackedTypes : pb::IMessage<TestUnpackedTypes>, pb::IBufferMessage {
+ public sealed partial class TestUnpackedTypes : pb::IMessage<TestUnpackedTypes>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<TestUnpackedTypes> _parser = new pb::MessageParser<TestUnpackedTypes>(() => new TestUnpackedTypes());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -6285,9 +7242,91 @@
[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 722:
+ case 720: {
+ unpackedInt32_.AddEntriesFrom(input, _repeated_unpackedInt32_codec);
+ break;
+ }
+ case 730:
+ case 728: {
+ unpackedInt64_.AddEntriesFrom(input, _repeated_unpackedInt64_codec);
+ break;
+ }
+ case 738:
+ case 736: {
+ unpackedUint32_.AddEntriesFrom(input, _repeated_unpackedUint32_codec);
+ break;
+ }
+ case 746:
+ case 744: {
+ unpackedUint64_.AddEntriesFrom(input, _repeated_unpackedUint64_codec);
+ break;
+ }
+ case 754:
+ case 752: {
+ unpackedSint32_.AddEntriesFrom(input, _repeated_unpackedSint32_codec);
+ break;
+ }
+ case 762:
+ case 760: {
+ unpackedSint64_.AddEntriesFrom(input, _repeated_unpackedSint64_codec);
+ break;
+ }
+ case 770:
+ case 773: {
+ unpackedFixed32_.AddEntriesFrom(input, _repeated_unpackedFixed32_codec);
+ break;
+ }
+ case 778:
+ case 777: {
+ unpackedFixed64_.AddEntriesFrom(input, _repeated_unpackedFixed64_codec);
+ break;
+ }
+ case 786:
+ case 789: {
+ unpackedSfixed32_.AddEntriesFrom(input, _repeated_unpackedSfixed32_codec);
+ break;
+ }
+ case 794:
+ case 793: {
+ unpackedSfixed64_.AddEntriesFrom(input, _repeated_unpackedSfixed64_codec);
+ break;
+ }
+ case 802:
+ case 805: {
+ unpackedFloat_.AddEntriesFrom(input, _repeated_unpackedFloat_codec);
+ break;
+ }
+ case 810:
+ case 809: {
+ unpackedDouble_.AddEntriesFrom(input, _repeated_unpackedDouble_codec);
+ break;
+ }
+ case 818:
+ case 816: {
+ unpackedBool_.AddEntriesFrom(input, _repeated_unpackedBool_codec);
+ break;
+ }
+ case 826:
+ case 824: {
+ unpackedEnum_.AddEntriesFrom(input, _repeated_unpackedEnum_codec);
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -6369,10 +7408,15 @@
}
}
}
+ #endif
}
- public sealed partial class TestRepeatedScalarDifferentTagSizes : pb::IMessage<TestRepeatedScalarDifferentTagSizes>, pb::IBufferMessage {
+ public sealed partial class TestRepeatedScalarDifferentTagSizes : pb::IMessage<TestRepeatedScalarDifferentTagSizes>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<TestRepeatedScalarDifferentTagSizes> _parser = new pb::MessageParser<TestRepeatedScalarDifferentTagSizes>(() => new TestRepeatedScalarDifferentTagSizes());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -6571,9 +7615,51 @@
[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 98:
+ case 101: {
+ repeatedFixed32_.AddEntriesFrom(input, _repeated_repeatedFixed32_codec);
+ break;
+ }
+ case 106:
+ case 104: {
+ repeatedInt32_.AddEntriesFrom(input, _repeated_repeatedInt32_codec);
+ break;
+ }
+ case 16370:
+ case 16369: {
+ repeatedFixed64_.AddEntriesFrom(input, _repeated_repeatedFixed64_codec);
+ break;
+ }
+ case 16378:
+ case 16376: {
+ repeatedInt64_.AddEntriesFrom(input, _repeated_repeatedInt64_codec);
+ break;
+ }
+ case 2097138:
+ case 2097141: {
+ repeatedFloat_.AddEntriesFrom(input, _repeated_repeatedFloat_codec);
+ break;
+ }
+ case 2097146:
+ case 2097144: {
+ repeatedUint64_.AddEntriesFrom(input, _repeated_repeatedUint64_codec);
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -6615,10 +7701,15 @@
}
}
}
+ #endif
}
- public sealed partial class TestCommentInjectionMessage : pb::IMessage<TestCommentInjectionMessage>, pb::IBufferMessage {
+ public sealed partial class TestCommentInjectionMessage : pb::IMessage<TestCommentInjectionMessage>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<TestCommentInjectionMessage> _parser = new pb::MessageParser<TestCommentInjectionMessage>(() => new TestCommentInjectionMessage());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -6734,9 +7825,25 @@
[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: {
+ A = input.ReadString();
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -6752,13 +7859,18 @@
}
}
}
+ #endif
}
/// <summary>
/// Test that RPC services work.
/// </summary>
- public sealed partial class FooRequest : pb::IMessage<FooRequest>, pb::IBufferMessage {
+ public sealed partial class FooRequest : pb::IMessage<FooRequest>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<FooRequest> _parser = new pb::MessageParser<FooRequest>(() => new FooRequest());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -6847,9 +7959,21 @@
[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;
@@ -6861,10 +7985,15 @@
}
}
}
+ #endif
}
- public sealed partial class FooResponse : pb::IMessage<FooResponse>, pb::IBufferMessage {
+ public sealed partial class FooResponse : pb::IMessage<FooResponse>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<FooResponse> _parser = new pb::MessageParser<FooResponse>(() => new FooResponse());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -6953,9 +8082,21 @@
[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;
@@ -6967,10 +8108,15 @@
}
}
}
+ #endif
}
- public sealed partial class FooClientMessage : pb::IMessage<FooClientMessage>, pb::IBufferMessage {
+ public sealed partial class FooClientMessage : pb::IMessage<FooClientMessage>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<FooClientMessage> _parser = new pb::MessageParser<FooClientMessage>(() => new FooClientMessage());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -7059,9 +8205,21 @@
[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;
@@ -7073,10 +8231,15 @@
}
}
}
+ #endif
}
- public sealed partial class FooServerMessage : pb::IMessage<FooServerMessage>, pb::IBufferMessage {
+ public sealed partial class FooServerMessage : pb::IMessage<FooServerMessage>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<FooServerMessage> _parser = new pb::MessageParser<FooServerMessage>(() => new FooServerMessage());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -7165,9 +8328,21 @@
[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;
@@ -7179,10 +8354,15 @@
}
}
}
+ #endif
}
- public sealed partial class BarRequest : pb::IMessage<BarRequest>, pb::IBufferMessage {
+ public sealed partial class BarRequest : pb::IMessage<BarRequest>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<BarRequest> _parser = new pb::MessageParser<BarRequest>(() => new BarRequest());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -7271,9 +8451,21 @@
[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;
@@ -7285,10 +8477,15 @@
}
}
}
+ #endif
}
- public sealed partial class BarResponse : pb::IMessage<BarResponse>, pb::IBufferMessage {
+ public sealed partial class BarResponse : pb::IMessage<BarResponse>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<BarResponse> _parser = new pb::MessageParser<BarResponse>(() => new BarResponse());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -7377,9 +8574,21 @@
[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;
@@ -7391,10 +8600,15 @@
}
}
}
+ #endif
}
- public sealed partial class TestEmptyMessage : pb::IMessage<TestEmptyMessage>, pb::IBufferMessage {
+ public sealed partial class TestEmptyMessage : pb::IMessage<TestEmptyMessage>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<TestEmptyMessage> _parser = new pb::MessageParser<TestEmptyMessage>(() => new TestEmptyMessage());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -7483,9 +8697,21 @@
[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;
@@ -7497,13 +8723,18 @@
}
}
}
+ #endif
}
/// <summary>
/// This is a leading comment
/// </summary>
- public sealed partial class CommentMessage : pb::IMessage<CommentMessage>, pb::IBufferMessage {
+ public sealed partial class CommentMessage : pb::IMessage<CommentMessage>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<CommentMessage> _parser = new pb::MessageParser<CommentMessage>(() => new CommentMessage());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -7619,9 +8850,25 @@
[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;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -7637,6 +8884,7 @@
}
}
}
+ #endif
#region Nested types
/// <summary>Container for nested types declared in the CommentMessage message type.</summary>
@@ -7655,7 +8903,11 @@
/// <summary>
/// Leading nested message comment
/// </summary>
- public sealed partial class NestedCommentMessage : pb::IMessage<NestedCommentMessage>, pb::IBufferMessage {
+ public sealed partial class NestedCommentMessage : pb::IMessage<NestedCommentMessage>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<NestedCommentMessage> _parser = new pb::MessageParser<NestedCommentMessage>(() => new NestedCommentMessage());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -7771,9 +9023,25 @@
[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: {
+ NestedText = input.ReadString();
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -7789,6 +9057,7 @@
}
}
}
+ #endif
}
diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestProto3Optional.cs b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestProto3Optional.cs
index 21e55f7..c8cd7f7 100644
--- a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestProto3Optional.cs
+++ b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestProto3Optional.cs
@@ -67,7 +67,11 @@
}
#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 @@
[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 @@
}
}
}
+ #endif
#region Nested types
/// <summary>Container for nested types declared in the TestProto3Optional message type.</summary>
@@ -978,7 +1085,11 @@
[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 @@
[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 @@
}
}
}
+ #endif
}
diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestSelfreferentialOptions.cs b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestSelfreferentialOptions.cs
index e466d54..4365368 100644
--- a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestSelfreferentialOptions.cs
+++ b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestSelfreferentialOptions.cs
@@ -63,7 +63,11 @@
}
#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 @@
[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 @@
}
}
}
+ #endif
public TValue GetExtension<TValue>(pb::Extension<FooOptions, TValue> extension) {
return pb::ExtensionSet.Get(ref _extensions, extension);
diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestWellKnownTypes.cs b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestWellKnownTypes.cs
index c67187e..30c906c 100644
--- a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestWellKnownTypes.cs
+++ b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestWellKnownTypes.cs
@@ -179,7 +179,11 @@
/// 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 @@
[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 @@
}
}
}
+ #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 @@
[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 @@
}
}
}
+ #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 @@
[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 @@
}
}
}
+ #endif
}
@@ -2172,7 +2545,11 @@
/// 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 @@
[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 @@
}
}
}
+ #endif
}
diff --git a/csharp/src/Google.Protobuf.Test/ByteStringTest.cs b/csharp/src/Google.Protobuf.Test/ByteStringTest.cs
index 84e6341..0ef8d8f 100644
--- a/csharp/src/Google.Protobuf.Test/ByteStringTest.cs
+++ b/csharp/src/Google.Protobuf.Test/ByteStringTest.cs
@@ -233,5 +233,21 @@
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);
+ }
}
}
\ No newline at end of file
diff --git a/csharp/src/Google.Protobuf.Test/Collections/RepeatedFieldTest.cs b/csharp/src/Google.Protobuf.Test/Collections/RepeatedFieldTest.cs
index 527c7d4..61453e5 100644
--- a/csharp/src/Google.Protobuf.Test/Collections/RepeatedFieldTest.cs
+++ b/csharp/src/Google.Protobuf.Test/Collections/RepeatedFieldTest.cs
@@ -595,6 +595,95 @@
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()
diff --git a/csharp/src/Google.Protobuf.Test/JsonFormatterTest.cs b/csharp/src/Google.Protobuf.Test/JsonFormatterTest.cs
index b07a841..5e9730b 100644
--- a/csharp/src/Google.Protobuf.Test/JsonFormatterTest.cs
+++ b/csharp/src/Google.Protobuf.Test/JsonFormatterTest.cs
@@ -40,6 +40,7 @@
using static Google.Protobuf.JsonParserTest; // For WrapInQuotes
using System.IO;
using Google.Protobuf.Collections;
+using ProtobufUnittest;
namespace Google.Protobuf
{
@@ -154,6 +155,48 @@
}
[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()
{
AssertJson("{ 'repeatedInt32': [ 1, 2, 3, 4, 5 ] }",
@@ -313,14 +356,16 @@
}
[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 @@
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();
diff --git a/csharp/src/Google.Protobuf.Test/JsonParserTest.cs b/csharp/src/Google.Protobuf.Test/JsonParserTest.cs
index a6cf04a..f9f8cde 100644
--- a/csharp/src/Google.Protobuf.Test/JsonParserTest.cs
+++ b/csharp/src/Google.Protobuf.Test/JsonParserTest.cs
@@ -34,6 +34,7 @@
using Google.Protobuf.TestProtos;
using Google.Protobuf.WellKnownTypes;
using NUnit.Framework;
+using ProtobufTestMessages.Proto2;
using System;
namespace Google.Protobuf
@@ -950,6 +951,16 @@
}
[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\"")]
[TestCase("[0, 1, 2]")]
diff --git a/csharp/src/Google.Protobuf.Test/ReadOnlySequenceFactory.cs b/csharp/src/Google.Protobuf.Test/ReadOnlySequenceFactory.cs
index d2050d3..588b559 100644
--- a/csharp/src/Google.Protobuf.Test/ReadOnlySequenceFactory.cs
+++ b/csharp/src/Google.Protobuf.Test/ReadOnlySequenceFactory.cs
@@ -50,9 +50,9 @@
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]);
diff --git a/csharp/src/Google.Protobuf.Test/RefStructCompatibilityTest.cs b/csharp/src/Google.Protobuf.Test/RefStructCompatibilityTest.cs
new file mode 100644
index 0000000..f2d9a2d
--- /dev/null
+++ b/csharp/src/Google.Protobuf.Test/RefStructCompatibilityTest.cs
@@ -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);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/csharp/src/Google.Protobuf/ByteString.cs b/csharp/src/Google.Protobuf/ByteString.cs
index 027c8d8..74dc865 100644
--- a/csharp/src/Google.Protobuf/ByteString.cs
+++ b/csharp/src/Google.Protobuf/ByteString.cs
@@ -34,6 +34,7 @@
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 @@
/// 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>
diff --git a/csharp/src/Google.Protobuf/Collections/RepeatedField.cs b/csharp/src/Google.Protobuf/Collections/RepeatedField.cs
index 5c39aab..b1bd9b1 100644
--- a/csharp/src/Google.Protobuf/Collections/RepeatedField.cs
+++ b/csharp/src/Google.Protobuf/Collections/RepeatedField.cs
@@ -35,6 +35,7 @@
using System.Collections.Generic;
using System.IO;
using System.Security;
+using System.Threading;
namespace Google.Protobuf.Collections
{
@@ -126,9 +127,31 @@
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))
{
- Add(reader(ref ctx));
+ 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
+ {
+ // 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 @@
}
}
+ 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>
diff --git a/csharp/src/Google.Protobuf/Google.Protobuf.csproj b/csharp/src/Google.Protobuf/Google.Protobuf.csproj
index 11615c8..db86da5 100644
--- a/csharp/src/Google.Protobuf/Google.Protobuf.csproj
+++ b/csharp/src/Google.Protobuf/Google.Protobuf.csproj
@@ -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>
diff --git a/csharp/src/Google.Protobuf/JsonFormatter.cs b/csharp/src/Google.Protobuf/JsonFormatter.cs
index 5aaefe7..699a81d 100644
--- a/csharp/src/Google.Protobuf/JsonFormatter.cs
+++ b/csharp/src/Google.Protobuf/JsonFormatter.cs
@@ -221,19 +221,12 @@
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 @@
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 @@
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 @@
}
/// <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; }
diff --git a/csharp/src/Google.Protobuf/Reflection/Descriptor.cs b/csharp/src/Google.Protobuf/Reflection/Descriptor.cs
index 3c6e82b..fda5676 100644
--- a/csharp/src/Google.Protobuf/Reflection/Descriptor.cs
+++ b/csharp/src/Google.Protobuf/Reflection/Descriptor.cs
@@ -194,7 +194,11 @@
/// The protocol compiler can output a FileDescriptorSet containing the .proto
/// files it parses.
/// </summary>
- public sealed partial class FileDescriptorSet : pb::IMessage<FileDescriptorSet>, pb::IBufferMessage {
+ public sealed partial class FileDescriptorSet : pb::IMessage<FileDescriptorSet>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<FileDescriptorSet> _parser = new pb::MessageParser<FileDescriptorSet>(() => new FileDescriptorSet());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -299,9 +303,25 @@
[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: {
+ file_.AddEntriesFrom(input, _repeated_file_codec);
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -317,13 +337,18 @@
}
}
}
+ #endif
}
/// <summary>
/// Describes a complete .proto file.
/// </summary>
- public sealed partial class FileDescriptorProto : pb::IMessage<FileDescriptorProto>, pb::IBufferMessage {
+ public sealed partial class FileDescriptorProto : pb::IMessage<FileDescriptorProto>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<FileDescriptorProto> _parser = new pb::MessageParser<FileDescriptorProto>(() => new FileDescriptorProto());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -715,9 +740,77 @@
[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: {
+ Package = input.ReadString();
+ break;
+ }
+ case 26: {
+ dependency_.AddEntriesFrom(input, _repeated_dependency_codec);
+ break;
+ }
+ case 34: {
+ messageType_.AddEntriesFrom(input, _repeated_messageType_codec);
+ break;
+ }
+ case 42: {
+ enumType_.AddEntriesFrom(input, _repeated_enumType_codec);
+ break;
+ }
+ case 50: {
+ service_.AddEntriesFrom(input, _repeated_service_codec);
+ break;
+ }
+ case 58: {
+ extension_.AddEntriesFrom(input, _repeated_extension_codec);
+ break;
+ }
+ case 66: {
+ if (options_ == null) {
+ Options = new global::Google.Protobuf.Reflection.FileOptions();
+ }
+ input.ReadMessage(Options);
+ break;
+ }
+ case 74: {
+ if (sourceCodeInfo_ == null) {
+ SourceCodeInfo = new global::Google.Protobuf.Reflection.SourceCodeInfo();
+ }
+ input.ReadMessage(SourceCodeInfo);
+ break;
+ }
+ case 82:
+ case 80: {
+ publicDependency_.AddEntriesFrom(input, _repeated_publicDependency_codec);
+ break;
+ }
+ case 90:
+ case 88: {
+ weakDependency_.AddEntriesFrom(input, _repeated_weakDependency_codec);
+ break;
+ }
+ case 98: {
+ Syntax = input.ReadString();
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -785,13 +878,18 @@
}
}
}
+ #endif
}
/// <summary>
/// Describes a message type.
/// </summary>
- public sealed partial class DescriptorProto : pb::IMessage<DescriptorProto>, pb::IBufferMessage {
+ public sealed partial class DescriptorProto : pb::IMessage<DescriptorProto>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<DescriptorProto> _parser = new pb::MessageParser<DescriptorProto>(() => new DescriptorProto());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1075,9 +1173,64 @@
[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: {
+ field_.AddEntriesFrom(input, _repeated_field_codec);
+ break;
+ }
+ case 26: {
+ nestedType_.AddEntriesFrom(input, _repeated_nestedType_codec);
+ break;
+ }
+ case 34: {
+ enumType_.AddEntriesFrom(input, _repeated_enumType_codec);
+ break;
+ }
+ case 42: {
+ extensionRange_.AddEntriesFrom(input, _repeated_extensionRange_codec);
+ break;
+ }
+ case 50: {
+ extension_.AddEntriesFrom(input, _repeated_extension_codec);
+ break;
+ }
+ case 58: {
+ if (options_ == null) {
+ Options = new global::Google.Protobuf.Reflection.MessageOptions();
+ }
+ input.ReadMessage(Options);
+ break;
+ }
+ case 66: {
+ oneofDecl_.AddEntriesFrom(input, _repeated_oneofDecl_codec);
+ break;
+ }
+ case 74: {
+ reservedRange_.AddEntriesFrom(input, _repeated_reservedRange_codec);
+ break;
+ }
+ case 82: {
+ reservedName_.AddEntriesFrom(input, _repeated_reservedName_codec);
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -1132,12 +1285,17 @@
}
}
}
+ #endif
#region Nested types
/// <summary>Container for nested types declared in the DescriptorProto message type.</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static partial class Types {
- public sealed partial class ExtensionRange : pb::IMessage<ExtensionRange>, pb::IBufferMessage {
+ public sealed partial class ExtensionRange : pb::IMessage<ExtensionRange>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<ExtensionRange> _parser = new pb::MessageParser<ExtensionRange>(() => new ExtensionRange());
private pb::UnknownFieldSet _unknownFields;
private int _hasBits0;
@@ -1335,9 +1493,36 @@
[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: {
+ Start = input.ReadInt32();
+ break;
+ }
+ case 16: {
+ End = input.ReadInt32();
+ break;
+ }
+ case 26: {
+ if (options_ == null) {
+ Options = new global::Google.Protobuf.Reflection.ExtensionRangeOptions();
+ }
+ input.ReadMessage(Options);
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -1364,6 +1549,7 @@
}
}
}
+ #endif
}
@@ -1372,7 +1558,11 @@
/// fields or extension ranges in the same message. Reserved ranges may
/// not overlap.
/// </summary>
- public sealed partial class ReservedRange : pb::IMessage<ReservedRange>, pb::IBufferMessage {
+ public sealed partial class ReservedRange : pb::IMessage<ReservedRange>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<ReservedRange> _parser = new pb::MessageParser<ReservedRange>(() => new ReservedRange());
private pb::UnknownFieldSet _unknownFields;
private int _hasBits0;
@@ -1543,9 +1733,29 @@
[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: {
+ Start = input.ReadInt32();
+ break;
+ }
+ case 16: {
+ End = input.ReadInt32();
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -1565,6 +1775,7 @@
}
}
}
+ #endif
}
@@ -1573,7 +1784,11 @@
}
- public sealed partial class ExtensionRangeOptions : pb::IExtendableMessage<ExtensionRangeOptions>, pb::IBufferMessage {
+ public sealed partial class ExtensionRangeOptions : pb::IExtendableMessage<ExtensionRangeOptions>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<ExtensionRangeOptions> _parser = new pb::MessageParser<ExtensionRangeOptions>(() => new ExtensionRangeOptions());
private pb::UnknownFieldSet _unknownFields;
internal pb::ExtensionSet<ExtensionRangeOptions> _extensions;
@@ -1697,9 +1912,27 @@
[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 7994: {
+ uninterpretedOption_.AddEntriesFrom(input, _repeated_uninterpretedOption_codec);
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -1717,6 +1950,7 @@
}
}
}
+ #endif
public TValue GetExtension<TValue>(pb::Extension<ExtensionRangeOptions, TValue> extension) {
return pb::ExtensionSet.Get(ref _extensions, extension);
@@ -1745,7 +1979,11 @@
/// <summary>
/// Describes a field within a message.
/// </summary>
- public sealed partial class FieldDescriptorProto : pb::IMessage<FieldDescriptorProto>, pb::IBufferMessage {
+ public sealed partial class FieldDescriptorProto : pb::IMessage<FieldDescriptorProto>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<FieldDescriptorProto> _parser = new pb::MessageParser<FieldDescriptorProto>(() => new FieldDescriptorProto());
private pb::UnknownFieldSet _unknownFields;
private int _hasBits0;
@@ -2283,9 +2521,68 @@
[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: {
+ Extendee = input.ReadString();
+ break;
+ }
+ case 24: {
+ Number = input.ReadInt32();
+ break;
+ }
+ case 32: {
+ Label = (global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Label) input.ReadEnum();
+ break;
+ }
+ case 40: {
+ Type = (global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Type) input.ReadEnum();
+ break;
+ }
+ case 50: {
+ TypeName = input.ReadString();
+ break;
+ }
+ case 58: {
+ DefaultValue = input.ReadString();
+ break;
+ }
+ case 66: {
+ if (options_ == null) {
+ Options = new global::Google.Protobuf.Reflection.FieldOptions();
+ }
+ input.ReadMessage(Options);
+ break;
+ }
+ case 72: {
+ OneofIndex = input.ReadInt32();
+ break;
+ }
+ case 82: {
+ JsonName = input.ReadString();
+ break;
+ }
+ case 136: {
+ Proto3Optional = input.ReadBool();
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -2344,6 +2641,7 @@
}
}
}
+ #endif
#region Nested types
/// <summary>Container for nested types declared in the FieldDescriptorProto message type.</summary>
@@ -2417,7 +2715,11 @@
/// <summary>
/// Describes a oneof.
/// </summary>
- public sealed partial class OneofDescriptorProto : pb::IMessage<OneofDescriptorProto>, pb::IBufferMessage {
+ public sealed partial class OneofDescriptorProto : pb::IMessage<OneofDescriptorProto>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<OneofDescriptorProto> _parser = new pb::MessageParser<OneofDescriptorProto>(() => new OneofDescriptorProto());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -2569,9 +2871,32 @@
[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 (options_ == null) {
+ Options = new global::Google.Protobuf.Reflection.OneofOptions();
+ }
+ input.ReadMessage(Options);
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -2594,13 +2919,18 @@
}
}
}
+ #endif
}
/// <summary>
/// Describes an enum type.
/// </summary>
- public sealed partial class EnumDescriptorProto : pb::IMessage<EnumDescriptorProto>, pb::IBufferMessage {
+ public sealed partial class EnumDescriptorProto : pb::IMessage<EnumDescriptorProto>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<EnumDescriptorProto> _parser = new pb::MessageParser<EnumDescriptorProto>(() => new EnumDescriptorProto());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -2809,9 +3139,44 @@
[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: {
+ value_.AddEntriesFrom(input, _repeated_value_codec);
+ break;
+ }
+ case 26: {
+ if (options_ == null) {
+ Options = new global::Google.Protobuf.Reflection.EnumOptions();
+ }
+ input.ReadMessage(Options);
+ break;
+ }
+ case 34: {
+ reservedRange_.AddEntriesFrom(input, _repeated_reservedRange_codec);
+ break;
+ }
+ case 42: {
+ reservedName_.AddEntriesFrom(input, _repeated_reservedName_codec);
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -2846,6 +3211,7 @@
}
}
}
+ #endif
#region Nested types
/// <summary>Container for nested types declared in the EnumDescriptorProto message type.</summary>
@@ -2859,7 +3225,11 @@
/// is inclusive such that it can appropriately represent the entire int32
/// domain.
/// </summary>
- public sealed partial class EnumReservedRange : pb::IMessage<EnumReservedRange>, pb::IBufferMessage {
+ public sealed partial class EnumReservedRange : pb::IMessage<EnumReservedRange>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<EnumReservedRange> _parser = new pb::MessageParser<EnumReservedRange>(() => new EnumReservedRange());
private pb::UnknownFieldSet _unknownFields;
private int _hasBits0;
@@ -3030,9 +3400,29 @@
[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: {
+ Start = input.ReadInt32();
+ break;
+ }
+ case 16: {
+ End = 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 +3442,7 @@
}
}
}
+ #endif
}
@@ -3063,7 +3454,11 @@
/// <summary>
/// Describes a value within an enum.
/// </summary>
- public sealed partial class EnumValueDescriptorProto : pb::IMessage<EnumValueDescriptorProto>, pb::IBufferMessage {
+ public sealed partial class EnumValueDescriptorProto : pb::IMessage<EnumValueDescriptorProto>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<EnumValueDescriptorProto> _parser = new pb::MessageParser<EnumValueDescriptorProto>(() => new EnumValueDescriptorProto());
private pb::UnknownFieldSet _unknownFields;
private int _hasBits0;
@@ -3254,9 +3649,36 @@
[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: {
+ if (options_ == null) {
+ Options = new global::Google.Protobuf.Reflection.EnumValueOptions();
+ }
+ input.ReadMessage(Options);
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -3283,13 +3705,18 @@
}
}
}
+ #endif
}
/// <summary>
/// Describes a service.
/// </summary>
- public sealed partial class ServiceDescriptorProto : pb::IMessage<ServiceDescriptorProto>, pb::IBufferMessage {
+ public sealed partial class ServiceDescriptorProto : pb::IMessage<ServiceDescriptorProto>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<ServiceDescriptorProto> _parser = new pb::MessageParser<ServiceDescriptorProto>(() => new ServiceDescriptorProto());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -3457,9 +3884,36 @@
[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: {
+ method_.AddEntriesFrom(input, _repeated_method_codec);
+ break;
+ }
+ case 26: {
+ if (options_ == null) {
+ Options = new global::Google.Protobuf.Reflection.ServiceOptions();
+ }
+ input.ReadMessage(Options);
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -3486,13 +3940,18 @@
}
}
}
+ #endif
}
/// <summary>
/// Describes a method of a service.
/// </summary>
- public sealed partial class MethodDescriptorProto : pb::IMessage<MethodDescriptorProto>, pb::IBufferMessage {
+ public sealed partial class MethodDescriptorProto : pb::IMessage<MethodDescriptorProto>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<MethodDescriptorProto> _parser = new pb::MessageParser<MethodDescriptorProto>(() => new MethodDescriptorProto());
private pb::UnknownFieldSet _unknownFields;
private int _hasBits0;
@@ -3802,9 +4261,48 @@
[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: {
+ InputType = input.ReadString();
+ break;
+ }
+ case 26: {
+ OutputType = input.ReadString();
+ break;
+ }
+ case 34: {
+ if (options_ == null) {
+ Options = new global::Google.Protobuf.Reflection.MethodOptions();
+ }
+ input.ReadMessage(Options);
+ break;
+ }
+ case 40: {
+ ClientStreaming = input.ReadBool();
+ break;
+ }
+ case 48: {
+ ServerStreaming = input.ReadBool();
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -3843,10 +4341,15 @@
}
}
}
+ #endif
}
- public sealed partial class FileOptions : pb::IExtendableMessage<FileOptions>, pb::IBufferMessage {
+ public sealed partial class FileOptions : pb::IExtendableMessage<FileOptions>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<FileOptions> _parser = new pb::MessageParser<FileOptions>(() => new FileOptions());
private pb::UnknownFieldSet _unknownFields;
internal pb::ExtensionSet<FileOptions> _extensions;
@@ -4799,9 +5302,107 @@
[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 10: {
+ JavaPackage = input.ReadString();
+ break;
+ }
+ case 66: {
+ JavaOuterClassname = input.ReadString();
+ break;
+ }
+ case 72: {
+ OptimizeFor = (global::Google.Protobuf.Reflection.FileOptions.Types.OptimizeMode) input.ReadEnum();
+ break;
+ }
+ case 80: {
+ JavaMultipleFiles = input.ReadBool();
+ break;
+ }
+ case 90: {
+ GoPackage = input.ReadString();
+ break;
+ }
+ case 128: {
+ CcGenericServices = input.ReadBool();
+ break;
+ }
+ case 136: {
+ JavaGenericServices = input.ReadBool();
+ break;
+ }
+ case 144: {
+ PyGenericServices = input.ReadBool();
+ break;
+ }
+ case 160: {
+ JavaGenerateEqualsAndHash = input.ReadBool();
+ break;
+ }
+ case 184: {
+ Deprecated = input.ReadBool();
+ break;
+ }
+ case 216: {
+ JavaStringCheckUtf8 = input.ReadBool();
+ break;
+ }
+ case 248: {
+ CcEnableArenas = input.ReadBool();
+ break;
+ }
+ case 290: {
+ ObjcClassPrefix = input.ReadString();
+ break;
+ }
+ case 298: {
+ CsharpNamespace = input.ReadString();
+ break;
+ }
+ case 314: {
+ SwiftPrefix = input.ReadString();
+ break;
+ }
+ case 322: {
+ PhpClassPrefix = input.ReadString();
+ break;
+ }
+ case 330: {
+ PhpNamespace = input.ReadString();
+ break;
+ }
+ case 336: {
+ PhpGenericServices = input.ReadBool();
+ break;
+ }
+ case 354: {
+ PhpMetadataNamespace = input.ReadString();
+ break;
+ }
+ case 362: {
+ RubyPackage = input.ReadString();
+ break;
+ }
+ case 7994: {
+ uninterpretedOption_.AddEntriesFrom(input, _repeated_uninterpretedOption_codec);
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -4899,6 +5500,7 @@
}
}
}
+ #endif
public TValue GetExtension<TValue>(pb::Extension<FileOptions, TValue> extension) {
return pb::ExtensionSet.Get(ref _extensions, extension);
@@ -4949,7 +5551,11 @@
}
- public sealed partial class MessageOptions : pb::IExtendableMessage<MessageOptions>, pb::IBufferMessage {
+ public sealed partial class MessageOptions : pb::IExtendableMessage<MessageOptions>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<MessageOptions> _parser = new pb::MessageParser<MessageOptions>(() => new MessageOptions());
private pb::UnknownFieldSet _unknownFields;
internal pb::ExtensionSet<MessageOptions> _extensions;
@@ -5277,9 +5883,43 @@
[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: {
+ MessageSetWireFormat = input.ReadBool();
+ break;
+ }
+ case 16: {
+ NoStandardDescriptorAccessor = input.ReadBool();
+ break;
+ }
+ case 24: {
+ Deprecated = input.ReadBool();
+ break;
+ }
+ case 56: {
+ MapEntry = input.ReadBool();
+ break;
+ }
+ case 7994: {
+ uninterpretedOption_.AddEntriesFrom(input, _repeated_uninterpretedOption_codec);
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -5313,6 +5953,7 @@
}
}
}
+ #endif
public TValue GetExtension<TValue>(pb::Extension<MessageOptions, TValue> extension) {
return pb::ExtensionSet.Get(ref _extensions, extension);
@@ -5338,7 +5979,11 @@
}
- public sealed partial class FieldOptions : pb::IExtendableMessage<FieldOptions>, pb::IBufferMessage {
+ public sealed partial class FieldOptions : pb::IExtendableMessage<FieldOptions>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<FieldOptions> _parser = new pb::MessageParser<FieldOptions>(() => new FieldOptions());
private pb::UnknownFieldSet _unknownFields;
internal pb::ExtensionSet<FieldOptions> _extensions;
@@ -5750,9 +6395,51 @@
[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: {
+ Ctype = (global::Google.Protobuf.Reflection.FieldOptions.Types.CType) input.ReadEnum();
+ break;
+ }
+ case 16: {
+ Packed = input.ReadBool();
+ break;
+ }
+ case 24: {
+ Deprecated = input.ReadBool();
+ break;
+ }
+ case 40: {
+ Lazy = input.ReadBool();
+ break;
+ }
+ case 48: {
+ Jstype = (global::Google.Protobuf.Reflection.FieldOptions.Types.JSType) input.ReadEnum();
+ break;
+ }
+ case 80: {
+ Weak = input.ReadBool();
+ break;
+ }
+ case 7994: {
+ uninterpretedOption_.AddEntriesFrom(input, _repeated_uninterpretedOption_codec);
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -5794,6 +6481,7 @@
}
}
}
+ #endif
public TValue GetExtension<TValue>(pb::Extension<FieldOptions, TValue> extension) {
return pb::ExtensionSet.Get(ref _extensions, extension);
@@ -5850,7 +6538,11 @@
}
- public sealed partial class OneofOptions : pb::IExtendableMessage<OneofOptions>, pb::IBufferMessage {
+ public sealed partial class OneofOptions : pb::IExtendableMessage<OneofOptions>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<OneofOptions> _parser = new pb::MessageParser<OneofOptions>(() => new OneofOptions());
private pb::UnknownFieldSet _unknownFields;
internal pb::ExtensionSet<OneofOptions> _extensions;
@@ -5974,9 +6666,27 @@
[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 7994: {
+ uninterpretedOption_.AddEntriesFrom(input, _repeated_uninterpretedOption_codec);
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -5994,6 +6704,7 @@
}
}
}
+ #endif
public TValue GetExtension<TValue>(pb::Extension<OneofOptions, TValue> extension) {
return pb::ExtensionSet.Get(ref _extensions, extension);
@@ -6019,7 +6730,11 @@
}
- public sealed partial class EnumOptions : pb::IExtendableMessage<EnumOptions>, pb::IBufferMessage {
+ public sealed partial class EnumOptions : pb::IExtendableMessage<EnumOptions>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<EnumOptions> _parser = new pb::MessageParser<EnumOptions>(() => new EnumOptions());
private pb::UnknownFieldSet _unknownFields;
internal pb::ExtensionSet<EnumOptions> _extensions;
@@ -6229,9 +6944,35 @@
[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 16: {
+ AllowAlias = input.ReadBool();
+ break;
+ }
+ case 24: {
+ Deprecated = input.ReadBool();
+ break;
+ }
+ case 7994: {
+ uninterpretedOption_.AddEntriesFrom(input, _repeated_uninterpretedOption_codec);
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -6257,6 +6998,7 @@
}
}
}
+ #endif
public TValue GetExtension<TValue>(pb::Extension<EnumOptions, TValue> extension) {
return pb::ExtensionSet.Get(ref _extensions, extension);
@@ -6282,7 +7024,11 @@
}
- public sealed partial class EnumValueOptions : pb::IExtendableMessage<EnumValueOptions>, pb::IBufferMessage {
+ public sealed partial class EnumValueOptions : pb::IExtendableMessage<EnumValueOptions>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<EnumValueOptions> _parser = new pb::MessageParser<EnumValueOptions>(() => new EnumValueOptions());
private pb::UnknownFieldSet _unknownFields;
internal pb::ExtensionSet<EnumValueOptions> _extensions;
@@ -6451,9 +7197,31 @@
[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: {
+ Deprecated = input.ReadBool();
+ break;
+ }
+ case 7994: {
+ uninterpretedOption_.AddEntriesFrom(input, _repeated_uninterpretedOption_codec);
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -6475,6 +7243,7 @@
}
}
}
+ #endif
public TValue GetExtension<TValue>(pb::Extension<EnumValueOptions, TValue> extension) {
return pb::ExtensionSet.Get(ref _extensions, extension);
@@ -6500,7 +7269,11 @@
}
- public sealed partial class ServiceOptions : pb::IExtendableMessage<ServiceOptions>, pb::IBufferMessage {
+ public sealed partial class ServiceOptions : pb::IExtendableMessage<ServiceOptions>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<ServiceOptions> _parser = new pb::MessageParser<ServiceOptions>(() => new ServiceOptions());
private pb::UnknownFieldSet _unknownFields;
internal pb::ExtensionSet<ServiceOptions> _extensions;
@@ -6669,9 +7442,31 @@
[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 264: {
+ Deprecated = input.ReadBool();
+ break;
+ }
+ case 7994: {
+ uninterpretedOption_.AddEntriesFrom(input, _repeated_uninterpretedOption_codec);
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -6693,6 +7488,7 @@
}
}
}
+ #endif
public TValue GetExtension<TValue>(pb::Extension<ServiceOptions, TValue> extension) {
return pb::ExtensionSet.Get(ref _extensions, extension);
@@ -6718,7 +7514,11 @@
}
- public sealed partial class MethodOptions : pb::IExtendableMessage<MethodOptions>, pb::IBufferMessage {
+ public sealed partial class MethodOptions : pb::IExtendableMessage<MethodOptions>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<MethodOptions> _parser = new pb::MessageParser<MethodOptions>(() => new MethodOptions());
private pb::UnknownFieldSet _unknownFields;
internal pb::ExtensionSet<MethodOptions> _extensions;
@@ -6924,9 +7724,35 @@
[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 264: {
+ Deprecated = input.ReadBool();
+ break;
+ }
+ case 272: {
+ IdempotencyLevel = (global::Google.Protobuf.Reflection.MethodOptions.Types.IdempotencyLevel) input.ReadEnum();
+ break;
+ }
+ case 7994: {
+ uninterpretedOption_.AddEntriesFrom(input, _repeated_uninterpretedOption_codec);
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -6952,6 +7778,7 @@
}
}
}
+ #endif
public TValue GetExtension<TValue>(pb::Extension<MethodOptions, TValue> extension) {
return pb::ExtensionSet.Get(ref _extensions, extension);
@@ -7009,7 +7836,11 @@
/// or produced by Descriptor::CopyTo()) will never have UninterpretedOptions
/// in them.
/// </summary>
- public sealed partial class UninterpretedOption : pb::IMessage<UninterpretedOption>, pb::IBufferMessage {
+ public sealed partial class UninterpretedOption : pb::IMessage<UninterpretedOption>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<UninterpretedOption> _parser = new pb::MessageParser<UninterpretedOption>(() => new UninterpretedOption());
private pb::UnknownFieldSet _unknownFields;
private int _hasBits0;
@@ -7339,9 +8170,49 @@
[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 18: {
+ name_.AddEntriesFrom(input, _repeated_name_codec);
+ break;
+ }
+ case 26: {
+ IdentifierValue = input.ReadString();
+ break;
+ }
+ case 32: {
+ PositiveIntValue = input.ReadUInt64();
+ break;
+ }
+ case 40: {
+ NegativeIntValue = input.ReadInt64();
+ break;
+ }
+ case 49: {
+ DoubleValue = input.ReadDouble();
+ break;
+ }
+ case 58: {
+ StringValue = input.ReadBytes();
+ break;
+ }
+ case 66: {
+ AggregateValue = input.ReadString();
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -7381,6 +8252,7 @@
}
}
}
+ #endif
#region Nested types
/// <summary>Container for nested types declared in the UninterpretedOption message type.</summary>
@@ -7393,7 +8265,11 @@
/// E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents
/// "foo.(bar.baz).qux".
/// </summary>
- public sealed partial class NamePart : pb::IMessage<NamePart>, pb::IBufferMessage {
+ public sealed partial class NamePart : pb::IMessage<NamePart>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<NamePart> _parser = new pb::MessageParser<NamePart>(() => new NamePart());
private pb::UnknownFieldSet _unknownFields;
private int _hasBits0;
@@ -7557,9 +8433,29 @@
[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: {
+ NamePart_ = input.ReadString();
+ break;
+ }
+ case 16: {
+ IsExtension = input.ReadBool();
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -7579,6 +8475,7 @@
}
}
}
+ #endif
}
@@ -7591,7 +8488,11 @@
/// Encapsulates information about the original source file from which a
/// FileDescriptorProto was generated.
/// </summary>
- public sealed partial class SourceCodeInfo : pb::IMessage<SourceCodeInfo>, pb::IBufferMessage {
+ public sealed partial class SourceCodeInfo : pb::IMessage<SourceCodeInfo>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<SourceCodeInfo> _parser = new pb::MessageParser<SourceCodeInfo>(() => new SourceCodeInfo());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -7741,9 +8642,25 @@
[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: {
+ location_.AddEntriesFrom(input, _repeated_location_codec);
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -7759,12 +8676,17 @@
}
}
}
+ #endif
#region Nested types
/// <summary>Container for nested types declared in the SourceCodeInfo message type.</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static partial class Types {
- public sealed partial class Location : pb::IMessage<Location>, pb::IBufferMessage {
+ public sealed partial class Location : pb::IMessage<Location>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<Location> _parser = new pb::MessageParser<Location>(() => new Location());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -8054,9 +8976,43 @@
[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:
+ case 8: {
+ path_.AddEntriesFrom(input, _repeated_path_codec);
+ break;
+ }
+ case 18:
+ case 16: {
+ span_.AddEntriesFrom(input, _repeated_span_codec);
+ break;
+ }
+ case 26: {
+ LeadingComments = input.ReadString();
+ break;
+ }
+ case 34: {
+ TrailingComments = input.ReadString();
+ break;
+ }
+ case 50: {
+ leadingDetachedComments_.AddEntriesFrom(input, _repeated_leadingDetachedComments_codec);
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -8090,6 +9046,7 @@
}
}
}
+ #endif
}
@@ -8103,7 +9060,11 @@
/// file. A GeneratedCodeInfo message is associated with only one generated
/// source file, but may contain references to different source .proto files.
/// </summary>
- public sealed partial class GeneratedCodeInfo : pb::IMessage<GeneratedCodeInfo>, pb::IBufferMessage {
+ public sealed partial class GeneratedCodeInfo : pb::IMessage<GeneratedCodeInfo>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<GeneratedCodeInfo> _parser = new pb::MessageParser<GeneratedCodeInfo>(() => new GeneratedCodeInfo());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -8212,9 +9173,25 @@
[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: {
+ annotation_.AddEntriesFrom(input, _repeated_annotation_codec);
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -8230,12 +9207,17 @@
}
}
}
+ #endif
#region Nested types
/// <summary>Container for nested types declared in the GeneratedCodeInfo message type.</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static partial class Types {
- public sealed partial class Annotation : pb::IMessage<Annotation>, pb::IBufferMessage {
+ public sealed partial class Annotation : pb::IMessage<Annotation>
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
private static readonly pb::MessageParser<Annotation> _parser = new pb::MessageParser<Annotation>(() => new Annotation());
private pb::UnknownFieldSet _unknownFields;
private int _hasBits0;
@@ -8468,9 +9450,38 @@
[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:
+ case 8: {
+ path_.AddEntriesFrom(input, _repeated_path_codec);
+ break;
+ }
+ case 18: {
+ SourceFile = input.ReadString();
+ break;
+ }
+ case 24: {
+ Begin = input.ReadInt32();
+ break;
+ }
+ case 32: {
+ End = input.ReadInt32();
+ break;
+ }
+ }
+ }
+ #endif
}
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
@@ -8499,6 +9510,7 @@
}
}
}
+ #endif
}
diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Any.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Any.cs
index c4e7447..fc23560 100644
--- a/csharp/src/Google.Protobuf/WellKnownTypes/Any.cs
+++ b/csharp/src/Google.Protobuf/WellKnownTypes/Any.cs
@@ -119,7 +119,11 @@
/// "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 @@
[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 @@
}
}
}
+ #endif
}
diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Api.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Api.cs
index 1f29224..e8f1a50 100644
--- a/csharp/src/Google.Protobuf/WellKnownTypes/Api.cs
+++ b/csharp/src/Google.Protobuf/WellKnownTypes/Api.cs
@@ -64,7 +64,11 @@
/// 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 @@
[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 @@
}
}
}
+ #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 @@
[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 @@
}
}
}
+ #endif
}
@@ -787,7 +880,11 @@
/// ...
/// }
/// </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 @@
[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 @@
}
}
}
+ #endif
}
diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Duration.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Duration.cs
index 804b82f..8ef1b37 100644
--- a/csharp/src/Google.Protobuf/WellKnownTypes/Duration.cs
+++ b/csharp/src/Google.Protobuf/WellKnownTypes/Duration.cs
@@ -100,7 +100,11 @@
/// 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 @@
[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 @@
}
}
}
+ #endif
}
diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Empty.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Empty.cs
index f73c345..ff04940 100644
--- a/csharp/src/Google.Protobuf/WellKnownTypes/Empty.cs
+++ b/csharp/src/Google.Protobuf/WellKnownTypes/Empty.cs
@@ -50,7 +50,11 @@
///
/// 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 @@
[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 @@
}
}
}
+ #endif
}
diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/FieldMask.cs b/csharp/src/Google.Protobuf/WellKnownTypes/FieldMask.cs
index 25a2f05..72c049f 100644
--- a/csharp/src/Google.Protobuf/WellKnownTypes/FieldMask.cs
+++ b/csharp/src/Google.Protobuf/WellKnownTypes/FieldMask.cs
@@ -240,7 +240,11 @@
/// 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 @@
[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 @@
}
}
}
+ #endif
}
diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/SourceContext.cs b/csharp/src/Google.Protobuf/WellKnownTypes/SourceContext.cs
index 99d40a5..dbfc8a9 100644
--- a/csharp/src/Google.Protobuf/WellKnownTypes/SourceContext.cs
+++ b/csharp/src/Google.Protobuf/WellKnownTypes/SourceContext.cs
@@ -44,7 +44,11 @@
/// `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 @@
[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 @@
}
}
}
+ #endif
}
diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Struct.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Struct.cs
index 8405742..2ba1b1c 100644
--- a/csharp/src/Google.Protobuf/WellKnownTypes/Struct.cs
+++ b/csharp/src/Google.Protobuf/WellKnownTypes/Struct.cs
@@ -77,7 +77,11 @@
///
/// 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 @@
[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 @@
}
}
}
+ #endif
}
@@ -214,7 +235,11 @@
///
/// 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 @@
[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 @@
}
}
}
+ #endif
}
@@ -571,7 +644,11 @@
///
/// 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 @@
[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 @@
}
}
}
+ #endif
}
diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Timestamp.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Timestamp.cs
index 31cbe95..208cd26 100644
--- a/csharp/src/Google.Protobuf/WellKnownTypes/Timestamp.cs
+++ b/csharp/src/Google.Protobuf/WellKnownTypes/Timestamp.cs
@@ -123,7 +123,11 @@
/// 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 @@
[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 @@
}
}
}
+ #endif
}
diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Type.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Type.cs
index 3c074f8..453ff8d 100644
--- a/csharp/src/Google.Protobuf/WellKnownTypes/Type.cs
+++ b/csharp/src/Google.Protobuf/WellKnownTypes/Type.cs
@@ -94,7 +94,11 @@
/// <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 @@
[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 @@
}
}
}
+ #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 @@
[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 @@
}
}
}
+ #endif
#region Nested types
/// <summary>Container for nested types declared in the Field message type.</summary>
@@ -895,7 +996,11 @@
/// <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 @@
[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 @@
}
}
}
+ #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 @@
[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 @@
}
}
}
+ #endif
}
@@ -1344,7 +1514,11 @@
/// 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 @@
[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 @@
}
}
}
+ #endif
}
diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Wrappers.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Wrappers.cs
index 41313fc..fa3458c 100644
--- a/csharp/src/Google.Protobuf/WellKnownTypes/Wrappers.cs
+++ b/csharp/src/Google.Protobuf/WellKnownTypes/Wrappers.cs
@@ -57,7 +57,11 @@
///
/// 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 @@
[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 @@
}
}
}
+ #endif
}
@@ -199,7 +220,11 @@
///
/// 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 @@
[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 @@
}
}
}
+ #endif
}
@@ -341,7 +383,11 @@
///
/// 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 @@
[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 @@
}
}
}
+ #endif
}
@@ -483,7 +546,11 @@
///
/// 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 @@
[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 @@
}
}
}
+ #endif
}
@@ -625,7 +709,11 @@
///
/// 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 @@
[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 @@
}
}
}
+ #endif
}
@@ -767,7 +872,11 @@
///
/// 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 @@
[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 @@
}
}
}
+ #endif
}
@@ -909,7 +1035,11 @@
///
/// 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 @@
[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 @@
}
}
}
+ #endif
}
@@ -1051,7 +1198,11 @@
///
/// 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 @@
[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 @@
}
}
}
+ #endif
}
@@ -1193,7 +1361,11 @@
///
/// 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 @@
[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 @@
}
}
}
+ #endif
}
diff --git a/docs/third_party.md b/docs/third_party.md
index 11a6efb..257f9d5 100644
--- a/docs/third_party.md
+++ b/docs/third_party.md
@@ -18,6 +18,7 @@
* 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/
diff --git a/java/bom/pom.xml b/java/bom/pom.xml
index 5a63a1d..ff2d106 100644
--- a/java/bom/pom.xml
+++ b/java/bom/pom.xml
@@ -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>
diff --git a/java/core/pom.xml b/java/core/pom.xml
index 4112eb2..b2b0b03 100644
--- a/java/core/pom.xml
+++ b/java/core/pom.xml
@@ -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>
diff --git a/java/lite/pom.xml b/java/lite/pom.xml
index 30e6f37..49686cd 100644
--- a/java/lite/pom.xml
+++ b/java/lite/pom.xml
@@ -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>
diff --git a/java/pom.xml b/java/pom.xml
index f61c857..0a813e0 100644
--- a/java/pom.xml
+++ b/java/pom.xml
@@ -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>
diff --git a/java/util/pom.xml b/java/util/pom.xml
index a9b8b4a..daa123a 100644
--- a/java/util/pom.xml
+++ b/java/util/pom.xml
@@ -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>
diff --git a/java/util/src/main/java/com/google/protobuf/util/FieldMaskTree.java b/java/util/src/main/java/com/google/protobuf/util/FieldMaskTree.java
index d07731d..4092b30 100644
--- a/java/util/src/main/java/com/google/protobuf/util/FieldMaskTree.java
+++ b/java/util/src/main/java/com/google/protobuf/util/FieldMaskTree.java
@@ -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 @@
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 @@
* 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) {
@@ -135,13 +137,52 @@
}
/**
+ * 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.
*/
FieldMask toFieldMask() {
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 @@
}
// 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);
diff --git a/java/util/src/main/java/com/google/protobuf/util/FieldMaskUtil.java b/java/util/src/main/java/com/google/protobuf/util/FieldMaskUtil.java
index 312d30f..0c2f90c 100644
--- a/java/util/src/main/java/com/google/protobuf/util/FieldMaskUtil.java
+++ b/java/util/src/main/java/com/google/protobuf/util/FieldMaskUtil.java
@@ -276,6 +276,16 @@
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.
*/
diff --git a/java/util/src/test/java/com/google/protobuf/util/FieldMaskTreeTest.java b/java/util/src/test/java/com/google/protobuf/util/FieldMaskTreeTest.java
index baae224..7ec37d0 100644
--- a/java/util/src/test/java/com/google/protobuf/util/FieldMaskTreeTest.java
+++ b/java/util/src/test/java/com/google/protobuf/util/FieldMaskTreeTest.java
@@ -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 @@
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 @@
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());
diff --git a/java/util/src/test/java/com/google/protobuf/util/FieldMaskUtilTest.java b/java/util/src/test/java/com/google/protobuf/util/FieldMaskUtilTest.java
index 78b470e..796020e 100644
--- a/java/util/src/test/java/com/google/protobuf/util/FieldMaskUtilTest.java
+++ b/java/util/src/test/java/com/google/protobuf/util/FieldMaskUtilTest.java
@@ -224,6 +224,24 @@
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.
diff --git a/kokoro/macos/objectivec_cocoapods_integration/build.sh b/kokoro/macos/objectivec_cocoapods_integration/build.sh
index f96d289..8f3c9b4 100755
--- a/kokoro/macos/objectivec_cocoapods_integration/build.sh
+++ b/kokoro/macos/objectivec_cocoapods_integration/build.sh
@@ -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
diff --git a/kokoro/macos/prepare_build_macos_rc b/kokoro/macos/prepare_build_macos_rc
index 2428750..18ce60b 100755
--- a/kokoro/macos/prepare_build_macos_rc
+++ b/kokoro/macos/prepare_build_macos_rc
@@ -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 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.
-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
+# 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
+
+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
diff --git a/kokoro/macos/python/build.sh b/kokoro/macos/python/build.sh
index 6b17b95..388e24b 100755
--- a/kokoro/macos/python/build.sh
+++ b/kokoro/macos/python/build.sh
@@ -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
diff --git a/kokoro/macos/python_cpp/build.sh b/kokoro/macos/python_cpp/build.sh
index cb53def..f86dd6f 100755
--- a/kokoro/macos/python_cpp/build.sh
+++ b/kokoro/macos/python_cpp/build.sh
@@ -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
diff --git a/kokoro/macos/ruby23/build.sh b/kokoro/macos/ruby23/build.sh
index dc950a2..9317838 100755
--- a/kokoro/macos/ruby23/build.sh
+++ b/kokoro/macos/ruby23/build.sh
@@ -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
diff --git a/kokoro/macos/ruby24/build.sh b/kokoro/macos/ruby24/build.sh
index 3c3a190..51bb2e6 100755
--- a/kokoro/macos/ruby24/build.sh
+++ b/kokoro/macos/ruby24/build.sh
@@ -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
diff --git a/kokoro/macos/ruby25/build.sh b/kokoro/macos/ruby25/build.sh
index 38e90aa..ba2d0a4 100755
--- a/kokoro/macos/ruby25/build.sh
+++ b/kokoro/macos/ruby25/build.sh
@@ -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
diff --git a/kokoro/macos/ruby26/build.sh b/kokoro/macos/ruby26/build.sh
index 6c33ed0..5a4c243 100755
--- a/kokoro/macos/ruby26/build.sh
+++ b/kokoro/macos/ruby26/build.sh
@@ -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
diff --git a/kokoro/macos/ruby27/build.sh b/kokoro/macos/ruby27/build.sh
index 16bcbd6..b1529b9 100755
--- a/kokoro/macos/ruby27/build.sh
+++ b/kokoro/macos/ruby27/build.sh
@@ -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
diff --git a/objectivec/GPBDescriptor_PackagePrivate.h b/objectivec/GPBDescriptor_PackagePrivate.h
index b3d6730..408f8d4 100644
--- a/objectivec/GPBDescriptor_PackagePrivate.h
+++ b/objectivec/GPBDescriptor_PackagePrivate.h
@@ -131,14 +131,29 @@
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;
diff --git a/objectivec/README.md b/objectivec/README.md
index 69fe631..5982939 100644
--- a/objectivec/README.md
+++ b/objectivec/README.md
@@ -172,6 +172,12 @@
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
------------
diff --git a/php/composer.json b/php/composer.json
index b618ea1..abcc293 100644
--- a/php/composer.json
+++ b/php/composer.json
@@ -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"
}
}
diff --git a/php/ext/google/protobuf/message.c b/php/ext/google/protobuf/message.c
index e8d4c6f..0366337 100644
--- a/php/ext/google/protobuf/message.c
+++ b/php/ext/google/protobuf/message.c
@@ -1726,7 +1726,7 @@
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;
}
diff --git a/php/ext/google/protobuf/package.xml b/php/ext/google/protobuf/package.xml
index 5c9d810..01a4b86 100644
--- a/php/ext/google/protobuf/package.xml
+++ b/php/ext/google/protobuf/package.xml
@@ -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 @@
<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>
diff --git a/php/ext/google/protobuf/protobuf.h b/php/ext/google/protobuf/protobuf.h
index 090f960..5208887 100644
--- a/php/ext/google/protobuf/protobuf.h
+++ b/php/ext/google/protobuf/protobuf.h
@@ -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, 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);
diff --git a/php/tests/compile_extension.sh b/php/tests/compile_extension.sh
index 3d6759e..ae0a6a3 100755
--- a/php/tests/compile_extension.sh
+++ b/php/tests/compile_extension.sh
@@ -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 @@
pushd ../ext/google/protobuf
make clean || true
-set -e
phpize && ./configure --with-php-config=$(which php-config) CFLAGS="$CFLAGS" && make
popd
diff --git a/php/tests/generate_protos.sh b/php/tests/generate_protos.sh
new file mode 100755
index 0000000..0c2a555
--- /dev/null
+++ b/php/tests/generate_protos.sh
@@ -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
diff --git a/php/tests/generated_class_test.php b/php/tests/generated_class_test.php
index 6af00ef..053697d 100644
--- a/php/tests/generated_class_test.php
+++ b/php/tests/generated_class_test.php
@@ -1527,6 +1527,21 @@
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); */
}
}
diff --git a/php/tests/test.sh b/php/tests/test.sh
index 3ecc0c7..bb2ada3 100755
--- a/php/tests/test.sh
+++ b/php/tests/test.sh
@@ -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 @@
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 @@
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 @@
# 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
diff --git a/protoc-artifacts/pom.xml b/protoc-artifacts/pom.xml
index ed028d5..6d750c5 100644
--- a/protoc-artifacts/pom.xml
+++ b/protoc-artifacts/pom.xml
@@ -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>
diff --git a/python/google/protobuf/internal/decoder.py b/python/google/protobuf/internal/decoder.py
index 092dab5..6804986 100644
--- a/python/google/protobuf/internal/decoder.py
+++ b/python/google/protobuf/internal/decoder.py
@@ -209,7 +209,8 @@
_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 @@
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 @@
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 @@
(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 @@
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 @@
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 @@
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
diff --git a/python/google/protobuf/internal/encoder.py b/python/google/protobuf/internal/encoder.py
index 0d1f49d..0c016f3 100644
--- a/python/google/protobuf/internal/encoder.py
+++ b/python/google/protobuf/internal/encoder.py
@@ -372,14 +372,15 @@
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 @@
"""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
diff --git a/python/google/protobuf/internal/json_format_test.py b/python/google/protobuf/internal/json_format_test.py
index 104b947..68aa21c 100755
--- a/python/google/protobuf/internal/json_format_test.py
+++ b/python/google/protobuf/internal/json_format_test.py
@@ -830,10 +830,14 @@
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 @@
'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 @@
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 @@
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}',
diff --git a/python/google/protobuf/internal/message_test.py b/python/google/protobuf/internal/message_test.py
index 0508bb2..e5c3c76 100755
--- a/python/google/protobuf/internal/message_test.py
+++ b/python/google/protobuf/internal/message_test.py
@@ -1675,6 +1675,17 @@
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'))
diff --git a/python/google/protobuf/internal/python_message.py b/python/google/protobuf/internal/python_message.py
index beea894..d1f4dcd 100644
--- a/python/google/protobuf/internal/python_message.py
+++ b/python/google/protobuf/internal/python_message.py
@@ -295,6 +295,7 @@
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 @@
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 @@
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)
diff --git a/python/google/protobuf/json_format.py b/python/google/protobuf/json_format.py
index 70912c1..4d76d02 100644
--- a/python/google/protobuf/json_format.py
+++ b/python/google/protobuf/json_format.py
@@ -195,7 +195,6 @@
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 @@
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 @@
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:
diff --git a/python/google/protobuf/pyext/descriptor.cc b/python/google/protobuf/pyext/descriptor.cc
index 24b2b46..75f1760 100644
--- a/python/google/protobuf/pyext/descriptor.cc
+++ b/python/google/protobuf/pyext/descriptor.cc
@@ -1690,7 +1690,7 @@
}
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;
diff --git a/python/google/protobuf/pyext/descriptor.h b/python/google/protobuf/pyext/descriptor.h
index 327ba4b..b99209d 100644
--- a/python/google/protobuf/pyext/descriptor.h
+++ b/python/google/protobuf/pyext/descriptor.h
@@ -41,6 +41,9 @@
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;
diff --git a/python/google/protobuf/pyext/descriptor_containers.cc b/python/google/protobuf/pyext/descriptor_containers.cc
index 865f0c0..c6ec258 100644
--- a/python/google/protobuf/pyext/descriptor_containers.cc
+++ b/python/google/protobuf/pyext/descriptor_containers.cc
@@ -81,9 +81,9 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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);
}
diff --git a/python/google/protobuf/pyext/descriptor_pool.cc b/python/google/protobuf/pyext/descriptor_pool.cc
index 2cffea3..6f1464e 100644
--- a/python/google/protobuf/pyext/descriptor_pool.cc
+++ b/python/google/protobuf/pyext/descriptor_pool.cc
@@ -240,7 +240,7 @@
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 @@
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 @@
}
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 @@
}
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 @@
}
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 @@
}
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 @@
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 @@
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 @@
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,
diff --git a/python/google/protobuf/pyext/extension_dict.cc b/python/google/protobuf/pyext/extension_dict.cc
index d7226d0..e9ac714 100644
--- a/python/google/protobuf/pyext/extension_dict.cc
+++ b/python/google/protobuf/pyext/extension_dict.cc
@@ -240,11 +240,11 @@
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() &&
diff --git a/python/google/protobuf/pyext/message.cc b/python/google/protobuf/pyext/message.cc
index 41ac2ca..b7d7385 100644
--- a/python/google/protobuf/pyext/message.cc
+++ b/python/google/protobuf/pyext/message.cc
@@ -243,7 +243,7 @@
}
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 @@
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 @@
}
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 @@
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 @@
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 @@
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 =
diff --git a/python/release.sh b/python/release.sh
index 8d35640..c915e12 100755
--- a/python/release.sh
+++ b/python/release.sh
@@ -80,14 +80,16 @@
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 @@
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
diff --git a/ruby/google-protobuf.gemspec b/ruby/google-protobuf.gemspec
index 469074f..2160d52 100644
--- a/ruby/google-protobuf.gemspec
+++ b/ruby/google-protobuf.gemspec
@@ -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"
diff --git a/src/google/protobuf/any.pb.h b/src/google/protobuf/any.pb.h
index 08913bf..2bc234b 100644
--- a/src/google/protobuf/any.pb.h
+++ b/src/google/protobuf/any.pb.h
@@ -69,7 +69,7 @@
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);
diff --git a/src/google/protobuf/api.pb.h b/src/google/protobuf/api.pb.h
index 3e199b6..c51087b 100644
--- a/src/google/protobuf/api.pb.h
+++ b/src/google/protobuf/api.pb.h
@@ -79,7 +79,7 @@
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 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 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);
diff --git a/src/google/protobuf/compiler/command_line_interface.cc b/src/google/protobuf/compiler/command_line_interface.cc
index b55070f..fbd5196 100644
--- a/src/google/protobuf/compiler/command_line_interface.cc
+++ b/src/google/protobuf/compiler/command_line_interface.cc
@@ -1104,6 +1104,7 @@
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.
diff --git a/src/google/protobuf/compiler/command_line_interface_unittest.cc b/src/google/protobuf/compiler/command_line_interface_unittest.cc
index a51ad92..e42ca26 100644
--- a/src/google/protobuf/compiler/command_line_interface_unittest.cc
+++ b/src/google/protobuf/compiler/command_line_interface_unittest.cc
@@ -2373,48 +2373,50 @@
}
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 @@
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, 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();
}
diff --git a/src/google/protobuf/compiler/cpp/cpp_message.cc b/src/google/protobuf/compiler/cpp/cpp_message.cc
index 4e5d87e..61a2395 100644
--- a/src/google/protobuf/compiler/cpp/cpp_message.cc
+++ b/src/google/protobuf/compiler/cpp/cpp_message.cc
@@ -1123,7 +1123,7 @@
format.Indent();
if (SupportsArenas(descriptor_)) {
- format("inline $classname$() : $classname$(nullptr) {};\n");
+ format("inline $classname$() : $classname$(nullptr) {}\n");
} else {
format("$classname$();\n");
}
diff --git a/src/google/protobuf/compiler/csharp/csharp_field_base.cc b/src/google/protobuf/compiler/csharp/csharp_field_base.cc
index c69e248..7d00402 100644
--- a/src/google/protobuf/compiler/csharp/csharp_field_base.cc
+++ b/src/google/protobuf/compiler/csharp/csharp_field_base.cc
@@ -161,6 +161,12 @@
// 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");
diff --git a/src/google/protobuf/compiler/csharp/csharp_field_base.h b/src/google/protobuf/compiler/csharp/csharp_field_base.h
index 594461d..022ba21 100644
--- a/src/google/protobuf/compiler/csharp/csharp_field_base.h
+++ b/src/google/protobuf/compiler/csharp/csharp_field_base.h
@@ -61,6 +61,7 @@
virtual void GenerateMembers(io::Printer* printer) = 0;
virtual void GenerateMergingCode(io::Printer* printer) = 0;
virtual void GenerateParsingCode(io::Printer* printer) = 0;
+ virtual void GenerateParsingCode(io::Printer* printer, bool use_parse_context);
virtual void GenerateSerializationCode(io::Printer* printer) = 0;
virtual void GenerateSerializedSizeCode(io::Printer* printer) = 0;
diff --git a/src/google/protobuf/compiler/csharp/csharp_generator.cc b/src/google/protobuf/compiler/csharp/csharp_generator.cc
index c2170f1..8d90a1d 100644
--- a/src/google/protobuf/compiler/csharp/csharp_generator.cc
+++ b/src/google/protobuf/compiler/csharp/csharp_generator.cc
@@ -51,7 +51,7 @@
Generator::Generator() {}
Generator::~Generator() {}
-uint64 Generator::GetSupportedFeatures() const {
+uint64_t Generator::GetSupportedFeatures() const {
return CodeGenerator::Feature::FEATURE_PROTO3_OPTIONAL;
}
diff --git a/src/google/protobuf/compiler/csharp/csharp_generator.h b/src/google/protobuf/compiler/csharp/csharp_generator.h
index 76806db..8875d4c 100644
--- a/src/google/protobuf/compiler/csharp/csharp_generator.h
+++ b/src/google/protobuf/compiler/csharp/csharp_generator.h
@@ -57,7 +57,7 @@
const string& parameter,
GeneratorContext* generator_context,
string* error) const override;
- uint64 GetSupportedFeatures() const override;
+ uint64_t GetSupportedFeatures() const override;
};
} // namespace csharp
diff --git a/src/google/protobuf/compiler/csharp/csharp_map_field.cc b/src/google/protobuf/compiler/csharp/csharp_map_field.cc
index 9f3db76..472aba6 100644
--- a/src/google/protobuf/compiler/csharp/csharp_map_field.cc
+++ b/src/google/protobuf/compiler/csharp/csharp_map_field.cc
@@ -94,9 +94,15 @@
}
void MapFieldGenerator::GenerateParsingCode(io::Printer* printer) {
+ GenerateParsingCode(printer, true);
+}
+
+void MapFieldGenerator::GenerateParsingCode(io::Printer* printer, bool use_parse_context) {
printer->Print(
variables_,
- "$name$_.AddEntriesFrom(ref input, _map_$name$_codec);\n");
+ use_parse_context
+ ? "$name$_.AddEntriesFrom(ref input, _map_$name$_codec);\n"
+ : "$name$_.AddEntriesFrom(input, _map_$name$_codec);\n");
}
void MapFieldGenerator::GenerateSerializationCode(io::Printer* printer) {
diff --git a/src/google/protobuf/compiler/csharp/csharp_map_field.h b/src/google/protobuf/compiler/csharp/csharp_map_field.h
index b920b9f..5054c94 100644
--- a/src/google/protobuf/compiler/csharp/csharp_map_field.h
+++ b/src/google/protobuf/compiler/csharp/csharp_map_field.h
@@ -56,6 +56,7 @@
virtual void GenerateMembers(io::Printer* printer);
virtual void GenerateMergingCode(io::Printer* printer);
virtual void GenerateParsingCode(io::Printer* printer);
+ virtual void GenerateParsingCode(io::Printer* printer, bool use_parse_context);
virtual void GenerateSerializationCode(io::Printer* printer);
virtual void GenerateSerializedSizeCode(io::Printer* printer);
diff --git a/src/google/protobuf/compiler/csharp/csharp_message.cc b/src/google/protobuf/compiler/csharp/csharp_message.cc
index 4ff0c7b..e742fc9 100644
--- a/src/google/protobuf/compiler/csharp/csharp_message.cc
+++ b/src/google/protobuf/compiler/csharp/csharp_message.cc
@@ -125,13 +125,15 @@
"$access_level$ sealed partial class $class_name$ : ");
if (has_extension_ranges_) {
- printer->Print(vars, "pb::IExtendableMessage<$class_name$>");
+ printer->Print(vars, "pb::IExtendableMessage<$class_name$>\n");
}
else {
- printer->Print(vars, "pb::IMessage<$class_name$>");
+ printer->Print(vars, "pb::IMessage<$class_name$>\n");
}
- printer->Print(", pb::IBufferMessage");
- printer->Print(" {\n");
+ printer->Print("#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE\n");
+ printer->Print(" , pb::IBufferMessage\n");
+ printer->Print("#endif\n");
+ printer->Print("{\n");
printer->Indent();
// All static fields and properties
@@ -633,17 +635,34 @@
printer->Outdent();
printer->Print("}\n\n");
-
WriteGeneratedCodeAttributes(printer);
printer->Print("public void MergeFrom(pb::CodedInputStream input) {\n");
+ printer->Print("#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE\n");
printer->Indent();
printer->Print("input.ReadRawMessage(this);\n");
printer->Outdent();
+ printer->Print("#else\n");
+ printer->Indent();
+ GenerateMainParseLoop(printer, false);
+ printer->Outdent();
+ printer->Print("#endif\n");
printer->Print("}\n\n");
+ printer->Print("#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE\n");
WriteGeneratedCodeAttributes(printer);
printer->Print("void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {\n");
printer->Indent();
+ GenerateMainParseLoop(printer, true);
+ printer->Outdent();
+ printer->Print("}\n"); // method
+ printer->Print("#endif\n\n");
+
+}
+
+void MessageGenerator::GenerateMainParseLoop(io::Printer* printer, bool use_parse_context) {
+ std::map<string, string> vars;
+ vars["maybe_ref_input"] = use_parse_context ? "ref input" : "input";
+
printer->Print(
"uint tag;\n"
"while ((tag = input.ReadTag()) != 0) {\n"
@@ -657,16 +676,16 @@
"end_tag", StrCat(end_tag_));
}
if (has_extension_ranges_) {
- printer->Print(
+ printer->Print(vars,
"default:\n"
- " if (!pb::ExtensionSet.TryMergeFieldFrom(ref _extensions, ref input)) {\n"
- " _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);\n"
+ " if (!pb::ExtensionSet.TryMergeFieldFrom(ref _extensions, $maybe_ref_input$)) {\n"
+ " _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, $maybe_ref_input$);\n"
" }\n"
" break;\n");
} else {
- printer->Print(
+ printer->Print(vars,
"default:\n"
- " _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);\n"
+ " _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, $maybe_ref_input$);\n"
" break;\n");
}
for (int i = 0; i < fields_by_number().size(); i++) {
@@ -693,7 +712,7 @@
printer->Indent();
std::unique_ptr<FieldGeneratorBase> generator(
CreateFieldGeneratorInternal(field));
- generator->GenerateParsingCode(printer);
+ generator->GenerateParsingCode(printer, use_parse_context);
printer->Print("break;\n");
printer->Outdent();
printer->Print("}\n");
@@ -702,8 +721,6 @@
printer->Print("}\n"); // switch
printer->Outdent();
printer->Print("}\n"); // while
- printer->Outdent();
- printer->Print("}\n\n"); // method
}
// it's a waste of space to track presence for all values, so we only track them if they're not nullable
diff --git a/src/google/protobuf/compiler/csharp/csharp_message.h b/src/google/protobuf/compiler/csharp/csharp_message.h
index 5642dc8..dde85e0 100644
--- a/src/google/protobuf/compiler/csharp/csharp_message.h
+++ b/src/google/protobuf/compiler/csharp/csharp_message.h
@@ -67,6 +67,7 @@
void GenerateMessageSerializationMethods(io::Printer* printer);
void GenerateMergingMethods(io::Printer* printer);
+ void GenerateMainParseLoop(io::Printer* printer, bool use_parse_context);
int GetPresenceIndex(const FieldDescriptor* descriptor);
FieldGeneratorBase* CreateFieldGeneratorInternal(
diff --git a/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc b/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc
index aae7091..402e44c 100644
--- a/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc
+++ b/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc
@@ -78,9 +78,15 @@
}
void RepeatedEnumFieldGenerator::GenerateParsingCode(io::Printer* printer) {
+ GenerateParsingCode(printer, true);
+}
+
+void RepeatedEnumFieldGenerator::GenerateParsingCode(io::Printer* printer, bool use_parse_context) {
printer->Print(
variables_,
- "$name$_.AddEntriesFrom(ref input, _repeated_$name$_codec);\n");
+ use_parse_context
+ ? "$name$_.AddEntriesFrom(ref input, _repeated_$name$_codec);\n"
+ : "$name$_.AddEntriesFrom(input, _repeated_$name$_codec);\n");
}
void RepeatedEnumFieldGenerator::GenerateSerializationCode(io::Printer* printer) {
diff --git a/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.h b/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.h
index c7a632a..4ce13e6 100644
--- a/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.h
+++ b/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.h
@@ -59,6 +59,7 @@
virtual void GenerateMembers(io::Printer* printer);
virtual void GenerateMergingCode(io::Printer* printer);
virtual void GenerateParsingCode(io::Printer* printer);
+ virtual void GenerateParsingCode(io::Printer* printer, bool use_parse_context);
virtual void GenerateSerializationCode(io::Printer* printer);
virtual void GenerateSerializedSizeCode(io::Printer* printer);
virtual void GenerateExtensionCode(io::Printer* printer);
diff --git a/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.cc b/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.cc
index 2e2cfa8..4483740 100644
--- a/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.cc
+++ b/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.cc
@@ -93,9 +93,15 @@
}
void RepeatedMessageFieldGenerator::GenerateParsingCode(io::Printer* printer) {
+ GenerateParsingCode(printer, true);
+}
+
+void RepeatedMessageFieldGenerator::GenerateParsingCode(io::Printer* printer, bool use_parse_context) {
printer->Print(
variables_,
- "$name$_.AddEntriesFrom(ref input, _repeated_$name$_codec);\n");
+ use_parse_context
+ ? "$name$_.AddEntriesFrom(ref input, _repeated_$name$_codec);\n"
+ : "$name$_.AddEntriesFrom(input, _repeated_$name$_codec);\n");
}
void RepeatedMessageFieldGenerator::GenerateSerializationCode(io::Printer* printer) {
diff --git a/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.h b/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.h
index 74f6874..2cf33a4 100644
--- a/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.h
+++ b/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.h
@@ -59,6 +59,7 @@
virtual void GenerateMembers(io::Printer* printer);
virtual void GenerateMergingCode(io::Printer* printer);
virtual void GenerateParsingCode(io::Printer* printer);
+ virtual void GenerateParsingCode(io::Printer* printer, bool use_parse_context);
virtual void GenerateSerializationCode(io::Printer* printer);
virtual void GenerateSerializedSizeCode(io::Printer* printer);
virtual void GenerateExtensionCode(io::Printer* printer);
diff --git a/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc b/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc
index d4ff302..9231210 100644
--- a/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc
+++ b/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc
@@ -78,9 +78,15 @@
}
void RepeatedPrimitiveFieldGenerator::GenerateParsingCode(io::Printer* printer) {
+ GenerateParsingCode(printer, true);
+}
+
+void RepeatedPrimitiveFieldGenerator::GenerateParsingCode(io::Printer* printer, bool use_parse_context) {
printer->Print(
variables_,
- "$name$_.AddEntriesFrom(ref input, _repeated_$name$_codec);\n");
+ use_parse_context
+ ? "$name$_.AddEntriesFrom(ref input, _repeated_$name$_codec);\n"
+ : "$name$_.AddEntriesFrom(input, _repeated_$name$_codec);\n");
}
void RepeatedPrimitiveFieldGenerator::GenerateSerializationCode(io::Printer* printer) {
diff --git a/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.h b/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.h
index 2a3be48..58db62d 100644
--- a/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.h
+++ b/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.h
@@ -55,6 +55,7 @@
virtual void GenerateMembers(io::Printer* printer);
virtual void GenerateMergingCode(io::Printer* printer);
virtual void GenerateParsingCode(io::Printer* printer);
+ virtual void GenerateParsingCode(io::Printer* printer, bool use_parse_context);
virtual void GenerateSerializationCode(io::Printer* printer);
virtual void GenerateSerializedSizeCode(io::Printer* printer);
virtual void GenerateExtensionCode(io::Printer* printer);
diff --git a/src/google/protobuf/compiler/csharp/csharp_wrapper_field.cc b/src/google/protobuf/compiler/csharp/csharp_wrapper_field.cc
index cada81c..24381dd 100644
--- a/src/google/protobuf/compiler/csharp/csharp_wrapper_field.cc
+++ b/src/google/protobuf/compiler/csharp/csharp_wrapper_field.cc
@@ -114,12 +114,21 @@
}
void WrapperFieldGenerator::GenerateParsingCode(io::Printer* printer) {
+ GenerateParsingCode(printer, true);
+}
+
+void WrapperFieldGenerator::GenerateParsingCode(io::Printer* printer, bool use_parse_context) {
printer->Print(
variables_,
- "$type_name$ value = _single_$name$_codec.Read(ref input);\n"
- "if ($has_not_property_check$ || value != $default_value$) {\n"
- " $property_name$ = value;\n"
- "}\n");
+ use_parse_context
+ ? "$type_name$ value = _single_$name$_codec.Read(ref input);\n"
+ "if ($has_not_property_check$ || value != $default_value$) {\n"
+ " $property_name$ = value;\n"
+ "}\n"
+ : "$type_name$ value = _single_$name$_codec.Read(input);\n"
+ "if ($has_not_property_check$ || value != $default_value$) {\n"
+ " $property_name$ = value;\n"
+ "}\n");
}
void WrapperFieldGenerator::GenerateSerializationCode(io::Printer* printer) {
@@ -248,9 +257,15 @@
}
void WrapperOneofFieldGenerator::GenerateParsingCode(io::Printer* printer) {
+ GenerateParsingCode(printer, true);
+}
+
+void WrapperOneofFieldGenerator::GenerateParsingCode(io::Printer* printer, bool use_parse_context) {
printer->Print(
variables_,
- "$property_name$ = _oneof_$name$_codec.Read(ref input);\n");
+ use_parse_context
+ ? "$property_name$ = _oneof_$name$_codec.Read(ref input);\n"
+ : "$property_name$ = _oneof_$name$_codec.Read(input);\n");
}
void WrapperOneofFieldGenerator::GenerateSerializationCode(io::Printer* printer) {
diff --git a/src/google/protobuf/compiler/csharp/csharp_wrapper_field.h b/src/google/protobuf/compiler/csharp/csharp_wrapper_field.h
index 394e27d..438080d 100644
--- a/src/google/protobuf/compiler/csharp/csharp_wrapper_field.h
+++ b/src/google/protobuf/compiler/csharp/csharp_wrapper_field.h
@@ -58,6 +58,7 @@
virtual void GenerateMembers(io::Printer* printer);
virtual void GenerateMergingCode(io::Printer* printer);
virtual void GenerateParsingCode(io::Printer* printer);
+ virtual void GenerateParsingCode(io::Printer* printer, bool use_parse_context);
virtual void GenerateSerializationCode(io::Printer* printer);
virtual void GenerateSerializedSizeCode(io::Printer* printer);
virtual void GenerateExtensionCode(io::Printer* printer);
@@ -83,6 +84,7 @@
virtual void GenerateMembers(io::Printer* printer);
virtual void GenerateMergingCode(io::Printer* printer);
virtual void GenerateParsingCode(io::Printer* printer);
+ virtual void GenerateParsingCode(io::Printer* printer, bool use_parse_context);
virtual void GenerateSerializationCode(io::Printer* printer);
virtual void GenerateSerializedSizeCode(io::Printer* printer);
};
diff --git a/src/google/protobuf/compiler/main.cc b/src/google/protobuf/compiler/main.cc
index 5239e09..a702ca9 100644
--- a/src/google/protobuf/compiler/main.cc
+++ b/src/google/protobuf/compiler/main.cc
@@ -28,8 +28,6 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-// Author: kenton@google.com (Kenton Varda)
-
#include <google/protobuf/compiler/cpp/cpp_generator.h>
#include <google/protobuf/compiler/java/java_generator.h>
#include <google/protobuf/compiler/js/js_generator.h>
@@ -87,10 +85,10 @@
cli.RegisterGenerator("--csharp_out", "--csharp_opt", &csharp_generator,
"Generate C# source file.");
- // Objective C
+ // Objective-C
objectivec::ObjectiveCGenerator objc_generator;
cli.RegisterGenerator("--objc_out", "--objc_opt", &objc_generator,
- "Generate Objective C header and source.");
+ "Generate Objective-C header and source.");
// JavaScript
js::Generator js_generator;
diff --git a/src/google/protobuf/compiler/objectivec/objectivec_file.cc b/src/google/protobuf/compiler/objectivec/objectivec_file.cc
index 04733ca..58ca9c1 100644
--- a/src/google/protobuf/compiler/objectivec/objectivec_file.cc
+++ b/src/google/protobuf/compiler/objectivec/objectivec_file.cc
@@ -209,15 +209,15 @@
FileGenerator::~FileGenerator() {}
void FileGenerator::GenerateHeader(io::Printer *printer) {
- std::set<string> headers;
+ std::vector<string> headers;
// Generated files bundled with the library get minimal imports, everything
// else gets the wrapper so everything is usable.
if (is_bundled_proto_) {
- headers.insert("GPBRootObject.h");
- headers.insert("GPBMessage.h");
- headers.insert("GPBDescriptor.h");
+ headers.push_back("GPBDescriptor.h");
+ headers.push_back("GPBMessage.h");
+ headers.push_back("GPBRootObject.h");
} else {
- headers.insert("GPBProtocolBuffers.h");
+ headers.push_back("GPBProtocolBuffers.h");
}
PrintFileRuntimePreamble(printer, headers);
@@ -242,6 +242,7 @@
ImportWriter import_writer(
options_.generate_for_named_framework,
options_.named_framework_to_proto_path_mappings_path,
+ options_.runtime_import_prefix,
is_bundled_proto_);
const string header_extension(kHeaderExtension);
for (int i = 0; i < file_->public_dependency_count(); i++) {
@@ -337,8 +338,8 @@
void FileGenerator::GenerateSource(io::Printer *printer) {
// #import the runtime support.
- std::set<string> headers;
- headers.insert("GPBProtocolBuffers_RuntimeSupport.h");
+ std::vector<string> headers;
+ headers.push_back("GPBProtocolBuffers_RuntimeSupport.h");
PrintFileRuntimePreamble(printer, headers);
// Enums use atomic in the generated code, so add the system import as needed.
@@ -355,6 +356,7 @@
ImportWriter import_writer(
options_.generate_for_named_framework,
options_.named_framework_to_proto_path_mappings_path,
+ options_.runtime_import_prefix,
is_bundled_proto_);
const string header_extension(kHeaderExtension);
@@ -590,48 +592,15 @@
// files. This currently only supports the runtime coming from a framework
// as defined by the official CocoaPod.
void FileGenerator::PrintFileRuntimePreamble(
- io::Printer* printer, const std::set<string>& headers_to_import) const {
+ io::Printer* printer, const std::vector<string>& headers_to_import) const {
printer->Print(
"// Generated by the protocol buffer compiler. DO NOT EDIT!\n"
"// source: $filename$\n"
"\n",
"filename", file_->name());
-
- const string framework_name(ProtobufLibraryFrameworkName);
- const string cpp_symbol(ProtobufFrameworkImportSymbol(framework_name));
-
- printer->Print(
- "// This CPP symbol can be defined to use imports that match up to the framework\n"
- "// imports needed when using CocoaPods.\n"
- "#if !defined($cpp_symbol$)\n"
- " #define $cpp_symbol$ 0\n"
- "#endif\n"
- "\n"
- "#if $cpp_symbol$\n",
- "cpp_symbol", cpp_symbol);
-
-
- for (std::set<string>::const_iterator iter = headers_to_import.begin();
- iter != headers_to_import.end(); ++iter) {
- printer->Print(
- " #import <$framework_name$/$header$>\n",
- "header", *iter,
- "framework_name", framework_name);
- }
-
- printer->Print(
- "#else\n");
-
- for (std::set<string>::const_iterator iter = headers_to_import.begin();
- iter != headers_to_import.end(); ++iter) {
- printer->Print(
- " #import \"$header$\"\n",
- "header", *iter);
- }
-
- printer->Print(
- "#endif\n"
- "\n");
+ ImportWriter::PrintRuntimeImports(
+ printer, headers_to_import, options_.runtime_import_prefix, true);
+ printer->Print("\n");
}
} // namespace objectivec
diff --git a/src/google/protobuf/compiler/objectivec/objectivec_file.h b/src/google/protobuf/compiler/objectivec/objectivec_file.h
index fd57263..258bd13 100644
--- a/src/google/protobuf/compiler/objectivec/objectivec_file.h
+++ b/src/google/protobuf/compiler/objectivec/objectivec_file.h
@@ -72,7 +72,7 @@
const Options options_;
void PrintFileRuntimePreamble(
- io::Printer* printer, const std::set<string>& headers_to_import) const;
+ io::Printer* printer, const std::vector<string>& headers_to_import) const;
};
} // namespace objectivec
diff --git a/src/google/protobuf/compiler/objectivec/objectivec_generator.cc b/src/google/protobuf/compiler/objectivec/objectivec_generator.cc
index 25338ad..257e4f9 100644
--- a/src/google/protobuf/compiler/objectivec/objectivec_generator.cc
+++ b/src/google/protobuf/compiler/objectivec/objectivec_generator.cc
@@ -127,6 +127,13 @@
// with generate_for_named_framework, or the relative path to it's include
// path otherwise.
generation_options.named_framework_to_proto_path_mappings_path = options[i].second;
+ } else if (options[i].first == "runtime_import_prefix") {
+ // Path to use as a prefix on #imports 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.
+ generation_options.runtime_import_prefix =
+ StripSuffixString(options[i].second, "/");
} else {
*error = "error: Unknown generator option: " + options[i].first;
return false;
diff --git a/src/google/protobuf/compiler/objectivec/objectivec_generator.h b/src/google/protobuf/compiler/objectivec/objectivec_generator.h
index b09e2b2..d1e490c 100644
--- a/src/google/protobuf/compiler/objectivec/objectivec_generator.h
+++ b/src/google/protobuf/compiler/objectivec/objectivec_generator.h
@@ -67,7 +67,7 @@
GeneratorContext* context,
string* error) const override;
- uint64 GetSupportedFeatures() const override {
+ uint64_t GetSupportedFeatures() const override {
return FEATURE_PROTO3_OPTIONAL;
}
};
diff --git a/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc b/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc
index df11689..8b2b719 100644
--- a/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc
+++ b/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc
@@ -1566,10 +1566,12 @@
ImportWriter::ImportWriter(
const string& generate_for_named_framework,
const string& named_framework_to_proto_path_mappings_path,
+ const string& runtime_import_prefix,
bool include_wkt_imports)
: generate_for_named_framework_(generate_for_named_framework),
named_framework_to_proto_path_mappings_path_(
named_framework_to_proto_path_mappings_path),
+ runtime_import_prefix_(runtime_import_prefix),
include_wkt_imports_(include_wkt_imports),
need_to_parse_mapping_file_(true) {
}
@@ -1585,8 +1587,7 @@
if (include_wkt_imports_) {
const string header_name =
"GPB" + FilePathBasename(file) + header_extension;
- protobuf_framework_imports_.push_back(header_name);
- protobuf_non_framework_imports_.push_back(header_name);
+ protobuf_imports_.push_back(header_name);
}
return;
}
@@ -1616,36 +1617,10 @@
}
void ImportWriter::Print(io::Printer* printer) const {
- assert(protobuf_non_framework_imports_.size() ==
- protobuf_framework_imports_.size());
-
bool add_blank_line = false;
- if (!protobuf_framework_imports_.empty()) {
- const string framework_name(ProtobufLibraryFrameworkName);
- const string cpp_symbol(ProtobufFrameworkImportSymbol(framework_name));
-
- printer->Print(
- "#if $cpp_symbol$\n",
- "cpp_symbol", cpp_symbol);
- for (std::vector<string>::const_iterator iter = protobuf_framework_imports_.begin();
- iter != protobuf_framework_imports_.end(); ++iter) {
- printer->Print(
- " #import <$framework_name$/$header$>\n",
- "framework_name", framework_name,
- "header", *iter);
- }
- printer->Print(
- "#else\n");
- for (std::vector<string>::const_iterator iter = protobuf_non_framework_imports_.begin();
- iter != protobuf_non_framework_imports_.end(); ++iter) {
- printer->Print(
- " #import \"$header$\"\n",
- "header", *iter);
- }
- printer->Print(
- "#endif\n");
-
+ if (!protobuf_imports_.empty()) {
+ PrintRuntimeImports(printer, protobuf_imports_, runtime_import_prefix_);
add_blank_line = true;
}
@@ -1678,6 +1653,57 @@
}
}
+void ImportWriter::PrintRuntimeImports(
+ io::Printer* printer,
+ const std::vector<string>& header_to_import,
+ const string& runtime_import_prefix,
+ bool default_cpp_symbol) {
+
+ // Given an override, use that.
+ if (!runtime_import_prefix.empty()) {
+ for (const auto& header : header_to_import) {
+ printer->Print(
+ " #import \"$import_prefix$/$header$\"\n",
+ "import_prefix", runtime_import_prefix,
+ "header", header);
+ }
+ return;
+ }
+
+ const string framework_name(ProtobufLibraryFrameworkName);
+ const string cpp_symbol(ProtobufFrameworkImportSymbol(framework_name));
+
+ if (default_cpp_symbol) {
+ printer->Print(
+ "// This CPP symbol can be defined to use imports that match up to the framework\n"
+ "// imports needed when using CocoaPods.\n"
+ "#if !defined($cpp_symbol$)\n"
+ " #define $cpp_symbol$ 0\n"
+ "#endif\n"
+ "\n",
+ "cpp_symbol", cpp_symbol);
+ }
+
+ printer->Print(
+ "#if $cpp_symbol$\n",
+ "cpp_symbol", cpp_symbol);
+ for (const auto& header : header_to_import) {
+ printer->Print(
+ " #import <$framework_name$/$header$>\n",
+ "framework_name", framework_name,
+ "header", header);
+ }
+ printer->Print(
+ "#else\n");
+ for (const auto& header : header_to_import) {
+ printer->Print(
+ " #import \"$header$\"\n",
+ "header", header);
+ }
+ printer->Print(
+ "#endif\n");
+}
+
void ImportWriter::ParseFrameworkMappings() {
need_to_parse_mapping_file_ = false;
if (named_framework_to_proto_path_mappings_path_.empty()) {
diff --git a/src/google/protobuf/compiler/objectivec/objectivec_helpers.h b/src/google/protobuf/compiler/objectivec/objectivec_helpers.h
index 5f91f4e..02f540f 100644
--- a/src/google/protobuf/compiler/objectivec/objectivec_helpers.h
+++ b/src/google/protobuf/compiler/objectivec/objectivec_helpers.h
@@ -53,6 +53,7 @@
std::vector<string> expected_prefixes_suppressions;
string generate_for_named_framework;
string named_framework_to_proto_path_mappings_path;
+ string runtime_import_prefix;
};
// Escape C++ trigraphs by escaping question marks to "\?".
@@ -279,12 +280,18 @@
public:
ImportWriter(const string& generate_for_named_framework,
const string& named_framework_to_proto_path_mappings_path,
+ const string& runtime_import_prefix,
bool include_wkt_imports);
~ImportWriter();
void AddFile(const FileDescriptor* file, const string& header_extension);
void Print(io::Printer *printer) const;
+ static void PrintRuntimeImports(io::Printer *printer,
+ const std::vector<string>& header_to_import,
+ const string& runtime_import_prefix,
+ bool default_cpp_symbol = false);
+
private:
class ProtoFrameworkCollector : public LineConsumer {
public:
@@ -301,12 +308,12 @@
const string generate_for_named_framework_;
const string named_framework_to_proto_path_mappings_path_;
+ const string runtime_import_prefix_;
const bool include_wkt_imports_;
std::map<string, string> proto_file_to_framework_name_;
bool need_to_parse_mapping_file_;
- std::vector<string> protobuf_framework_imports_;
- std::vector<string> protobuf_non_framework_imports_;
+ std::vector<string> protobuf_imports_;
std::vector<string> other_framework_imports_;
std::vector<string> other_imports_;
};
diff --git a/src/google/protobuf/compiler/plugin.pb.h b/src/google/protobuf/compiler/plugin.pb.h
index f4a0449..186be67 100644
--- a/src/google/protobuf/compiler/plugin.pb.h
+++ b/src/google/protobuf/compiler/plugin.pb.h
@@ -115,7 +115,7 @@
class PROTOC_EXPORT Version PROTOBUF_FINAL :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.compiler.Version) */ {
public:
- inline Version() : Version(nullptr) {};
+ inline Version() : Version(nullptr) {}
virtual ~Version();
Version(const Version& from);
@@ -316,7 +316,7 @@
class PROTOC_EXPORT CodeGeneratorRequest PROTOBUF_FINAL :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.compiler.CodeGeneratorRequest) */ {
public:
- inline CodeGeneratorRequest() : CodeGeneratorRequest(nullptr) {};
+ inline CodeGeneratorRequest() : CodeGeneratorRequest(nullptr) {}
virtual ~CodeGeneratorRequest();
CodeGeneratorRequest(const CodeGeneratorRequest& from);
@@ -538,7 +538,7 @@
class PROTOC_EXPORT CodeGeneratorResponse_File PROTOBUF_FINAL :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.compiler.CodeGeneratorResponse.File) */ {
public:
- inline CodeGeneratorResponse_File() : CodeGeneratorResponse_File(nullptr) {};
+ inline CodeGeneratorResponse_File() : CodeGeneratorResponse_File(nullptr) {}
virtual ~CodeGeneratorResponse_File();
CodeGeneratorResponse_File(const CodeGeneratorResponse_File& from);
@@ -738,7 +738,7 @@
class PROTOC_EXPORT CodeGeneratorResponse PROTOBUF_FINAL :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.compiler.CodeGeneratorResponse) */ {
public:
- inline CodeGeneratorResponse() : CodeGeneratorResponse(nullptr) {};
+ inline CodeGeneratorResponse() : CodeGeneratorResponse(nullptr) {}
virtual ~CodeGeneratorResponse();
CodeGeneratorResponse(const CodeGeneratorResponse& from);
diff --git a/src/google/protobuf/compiler/python/python_generator.cc b/src/google/protobuf/compiler/python/python_generator.cc
index a95b37f..b4beda6 100644
--- a/src/google/protobuf/compiler/python/python_generator.cc
+++ b/src/google/protobuf/compiler/python/python_generator.cc
@@ -106,11 +106,12 @@
// Keywords reserved by the Python language.
const char* const kKeywords[] = {
- "False", "None", "True", "and", "as", "assert", "break",
- "class", "continue", "def", "del", "elif", "else", "except",
- "finally", "for", "from", "global", "if", "import", "in",
- "is", "lambda", "nonlocal", "not", "or", "pass", "raise",
- "return", "try", "while", "with", "yield", "print",
+ "False", "None", "True", "and", "as", "assert",
+ "async", "await", "break", "class", "continue", "def",
+ "del", "elif", "else", "except", "finally", "for",
+ "from", "global", "if", "import", "in", "is",
+ "lambda", "nonlocal", "not", "or", "pass", "raise",
+ "return", "try", "while", "with", "yield", "print",
};
const char* const* kKeywordsEnd =
kKeywords + (sizeof(kKeywords) / sizeof(kKeywords[0]));
diff --git a/src/google/protobuf/compiler/ruby/ruby_generator.h b/src/google/protobuf/compiler/ruby/ruby_generator.h
index ea4f30a..b40fcd0 100644
--- a/src/google/protobuf/compiler/ruby/ruby_generator.h
+++ b/src/google/protobuf/compiler/ruby/ruby_generator.h
@@ -52,7 +52,7 @@
bool Generate(const FileDescriptor* file, const string& parameter,
GeneratorContext* generator_context,
string* error) const override;
- uint64 GetSupportedFeatures() const override {
+ uint64_t GetSupportedFeatures() const override {
return FEATURE_PROTO3_OPTIONAL;
}
};
diff --git a/src/google/protobuf/descriptor.pb.h b/src/google/protobuf/descriptor.pb.h
index fd0ed66..49a6f05 100644
--- a/src/google/protobuf/descriptor.pb.h
+++ b/src/google/protobuf/descriptor.pb.h
@@ -333,7 +333,7 @@
class PROTOBUF_EXPORT FileDescriptorSet PROTOBUF_FINAL :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.FileDescriptorSet) */ {
public:
- inline FileDescriptorSet() : FileDescriptorSet(nullptr) {};
+ inline FileDescriptorSet() : FileDescriptorSet(nullptr) {}
virtual ~FileDescriptorSet();
FileDescriptorSet(const FileDescriptorSet& from);
@@ -486,7 +486,7 @@
class PROTOBUF_EXPORT FileDescriptorProto PROTOBUF_FINAL :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.FileDescriptorProto) */ {
public:
- inline FileDescriptorProto() : FileDescriptorProto(nullptr) {};
+ inline FileDescriptorProto() : FileDescriptorProto(nullptr) {}
virtual ~FileDescriptorProto();
FileDescriptorProto(const FileDescriptorProto& from);
@@ -880,7 +880,7 @@
class PROTOBUF_EXPORT DescriptorProto_ExtensionRange PROTOBUF_FINAL :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.DescriptorProto.ExtensionRange) */ {
public:
- inline DescriptorProto_ExtensionRange() : DescriptorProto_ExtensionRange(nullptr) {};
+ inline DescriptorProto_ExtensionRange() : DescriptorProto_ExtensionRange(nullptr) {}
virtual ~DescriptorProto_ExtensionRange();
DescriptorProto_ExtensionRange(const DescriptorProto_ExtensionRange& from);
@@ -1064,7 +1064,7 @@
class PROTOBUF_EXPORT DescriptorProto_ReservedRange PROTOBUF_FINAL :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.DescriptorProto.ReservedRange) */ {
public:
- inline DescriptorProto_ReservedRange() : DescriptorProto_ReservedRange(nullptr) {};
+ inline DescriptorProto_ReservedRange() : DescriptorProto_ReservedRange(nullptr) {}
virtual ~DescriptorProto_ReservedRange();
DescriptorProto_ReservedRange(const DescriptorProto_ReservedRange& from);
@@ -1228,7 +1228,7 @@
class PROTOBUF_EXPORT DescriptorProto PROTOBUF_FINAL :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.DescriptorProto) */ {
public:
- inline DescriptorProto() : DescriptorProto(nullptr) {};
+ inline DescriptorProto() : DescriptorProto(nullptr) {}
virtual ~DescriptorProto();
DescriptorProto(const DescriptorProto& from);
@@ -1573,7 +1573,7 @@
class PROTOBUF_EXPORT ExtensionRangeOptions PROTOBUF_FINAL :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.ExtensionRangeOptions) */ {
public:
- inline ExtensionRangeOptions() : ExtensionRangeOptions(nullptr) {};
+ inline ExtensionRangeOptions() : ExtensionRangeOptions(nullptr) {}
virtual ~ExtensionRangeOptions();
ExtensionRangeOptions(const ExtensionRangeOptions& from);
@@ -1729,7 +1729,7 @@
class PROTOBUF_EXPORT FieldDescriptorProto PROTOBUF_FINAL :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.FieldDescriptorProto) */ {
public:
- inline FieldDescriptorProto() : FieldDescriptorProto(nullptr) {};
+ inline FieldDescriptorProto() : FieldDescriptorProto(nullptr) {}
virtual ~FieldDescriptorProto();
FieldDescriptorProto(const FieldDescriptorProto& from);
@@ -2162,7 +2162,7 @@
class PROTOBUF_EXPORT OneofDescriptorProto PROTOBUF_FINAL :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.OneofDescriptorProto) */ {
public:
- inline OneofDescriptorProto() : OneofDescriptorProto(nullptr) {};
+ inline OneofDescriptorProto() : OneofDescriptorProto(nullptr) {}
virtual ~OneofDescriptorProto();
OneofDescriptorProto(const OneofDescriptorProto& from);
@@ -2338,7 +2338,7 @@
class PROTOBUF_EXPORT EnumDescriptorProto_EnumReservedRange PROTOBUF_FINAL :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.EnumDescriptorProto.EnumReservedRange) */ {
public:
- inline EnumDescriptorProto_EnumReservedRange() : EnumDescriptorProto_EnumReservedRange(nullptr) {};
+ inline EnumDescriptorProto_EnumReservedRange() : EnumDescriptorProto_EnumReservedRange(nullptr) {}
virtual ~EnumDescriptorProto_EnumReservedRange();
EnumDescriptorProto_EnumReservedRange(const EnumDescriptorProto_EnumReservedRange& from);
@@ -2502,7 +2502,7 @@
class PROTOBUF_EXPORT EnumDescriptorProto PROTOBUF_FINAL :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.EnumDescriptorProto) */ {
public:
- inline EnumDescriptorProto() : EnumDescriptorProto(nullptr) {};
+ inline EnumDescriptorProto() : EnumDescriptorProto(nullptr) {}
virtual ~EnumDescriptorProto();
EnumDescriptorProto(const EnumDescriptorProto& from);
@@ -2746,7 +2746,7 @@
class PROTOBUF_EXPORT EnumValueDescriptorProto PROTOBUF_FINAL :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.EnumValueDescriptorProto) */ {
public:
- inline EnumValueDescriptorProto() : EnumValueDescriptorProto(nullptr) {};
+ inline EnumValueDescriptorProto() : EnumValueDescriptorProto(nullptr) {}
virtual ~EnumValueDescriptorProto();
EnumValueDescriptorProto(const EnumValueDescriptorProto& from);
@@ -2937,7 +2937,7 @@
class PROTOBUF_EXPORT ServiceDescriptorProto PROTOBUF_FINAL :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.ServiceDescriptorProto) */ {
public:
- inline ServiceDescriptorProto() : ServiceDescriptorProto(nullptr) {};
+ inline ServiceDescriptorProto() : ServiceDescriptorProto(nullptr) {}
virtual ~ServiceDescriptorProto();
ServiceDescriptorProto(const ServiceDescriptorProto& from);
@@ -3133,7 +3133,7 @@
class PROTOBUF_EXPORT MethodDescriptorProto PROTOBUF_FINAL :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.MethodDescriptorProto) */ {
public:
- inline MethodDescriptorProto() : MethodDescriptorProto(nullptr) {};
+ inline MethodDescriptorProto() : MethodDescriptorProto(nullptr) {}
virtual ~MethodDescriptorProto();
MethodDescriptorProto(const MethodDescriptorProto& from);
@@ -3383,7 +3383,7 @@
class PROTOBUF_EXPORT FileOptions PROTOBUF_FINAL :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.FileOptions) */ {
public:
- inline FileOptions() : FileOptions(nullptr) {};
+ inline FileOptions() : FileOptions(nullptr) {}
virtual ~FileOptions();
FileOptions(const FileOptions& from);
@@ -3942,7 +3942,7 @@
class PROTOBUF_EXPORT MessageOptions PROTOBUF_FINAL :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.MessageOptions) */ {
public:
- inline MessageOptions() : MessageOptions(nullptr) {};
+ inline MessageOptions() : MessageOptions(nullptr) {}
virtual ~MessageOptions();
MessageOptions(const MessageOptions& from);
@@ -4159,7 +4159,7 @@
class PROTOBUF_EXPORT FieldOptions PROTOBUF_FINAL :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.FieldOptions) */ {
public:
- inline FieldOptions() : FieldOptions(nullptr) {};
+ inline FieldOptions() : FieldOptions(nullptr) {}
virtual ~FieldOptions();
FieldOptions(const FieldOptions& from);
@@ -4470,7 +4470,7 @@
class PROTOBUF_EXPORT OneofOptions PROTOBUF_FINAL :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.OneofOptions) */ {
public:
- inline OneofOptions() : OneofOptions(nullptr) {};
+ inline OneofOptions() : OneofOptions(nullptr) {}
virtual ~OneofOptions();
OneofOptions(const OneofOptions& from);
@@ -4626,7 +4626,7 @@
class PROTOBUF_EXPORT EnumOptions PROTOBUF_FINAL :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.EnumOptions) */ {
public:
- inline EnumOptions() : EnumOptions(nullptr) {};
+ inline EnumOptions() : EnumOptions(nullptr) {}
virtual ~EnumOptions();
EnumOptions(const EnumOptions& from);
@@ -4813,7 +4813,7 @@
class PROTOBUF_EXPORT EnumValueOptions PROTOBUF_FINAL :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.EnumValueOptions) */ {
public:
- inline EnumValueOptions() : EnumValueOptions(nullptr) {};
+ inline EnumValueOptions() : EnumValueOptions(nullptr) {}
virtual ~EnumValueOptions();
EnumValueOptions(const EnumValueOptions& from);
@@ -4985,7 +4985,7 @@
class PROTOBUF_EXPORT ServiceOptions PROTOBUF_FINAL :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.ServiceOptions) */ {
public:
- inline ServiceOptions() : ServiceOptions(nullptr) {};
+ inline ServiceOptions() : ServiceOptions(nullptr) {}
virtual ~ServiceOptions();
ServiceOptions(const ServiceOptions& from);
@@ -5157,7 +5157,7 @@
class PROTOBUF_EXPORT MethodOptions PROTOBUF_FINAL :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.MethodOptions) */ {
public:
- inline MethodOptions() : MethodOptions(nullptr) {};
+ inline MethodOptions() : MethodOptions(nullptr) {}
virtual ~MethodOptions();
MethodOptions(const MethodOptions& from);
@@ -5376,7 +5376,7 @@
class PROTOBUF_EXPORT UninterpretedOption_NamePart PROTOBUF_FINAL :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.UninterpretedOption.NamePart) */ {
public:
- inline UninterpretedOption_NamePart() : UninterpretedOption_NamePart(nullptr) {};
+ inline UninterpretedOption_NamePart() : UninterpretedOption_NamePart(nullptr) {}
virtual ~UninterpretedOption_NamePart();
UninterpretedOption_NamePart(const UninterpretedOption_NamePart& from);
@@ -5550,7 +5550,7 @@
class PROTOBUF_EXPORT UninterpretedOption PROTOBUF_FINAL :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.UninterpretedOption) */ {
public:
- inline UninterpretedOption() : UninterpretedOption(nullptr) {};
+ inline UninterpretedOption() : UninterpretedOption(nullptr) {}
virtual ~UninterpretedOption();
UninterpretedOption(const UninterpretedOption& from);
@@ -5817,7 +5817,7 @@
class PROTOBUF_EXPORT SourceCodeInfo_Location PROTOBUF_FINAL :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.SourceCodeInfo.Location) */ {
public:
- inline SourceCodeInfo_Location() : SourceCodeInfo_Location(nullptr) {};
+ inline SourceCodeInfo_Location() : SourceCodeInfo_Location(nullptr) {}
virtual ~SourceCodeInfo_Location();
SourceCodeInfo_Location(const SourceCodeInfo_Location& from);
@@ -6071,7 +6071,7 @@
class PROTOBUF_EXPORT SourceCodeInfo PROTOBUF_FINAL :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.SourceCodeInfo) */ {
public:
- inline SourceCodeInfo() : SourceCodeInfo(nullptr) {};
+ inline SourceCodeInfo() : SourceCodeInfo(nullptr) {}
virtual ~SourceCodeInfo();
SourceCodeInfo(const SourceCodeInfo& from);
@@ -6226,7 +6226,7 @@
class PROTOBUF_EXPORT GeneratedCodeInfo_Annotation PROTOBUF_FINAL :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.GeneratedCodeInfo.Annotation) */ {
public:
- inline GeneratedCodeInfo_Annotation() : GeneratedCodeInfo_Annotation(nullptr) {};
+ inline GeneratedCodeInfo_Annotation() : GeneratedCodeInfo_Annotation(nullptr) {}
virtual ~GeneratedCodeInfo_Annotation();
GeneratedCodeInfo_Annotation(const GeneratedCodeInfo_Annotation& from);
@@ -6437,7 +6437,7 @@
class PROTOBUF_EXPORT GeneratedCodeInfo PROTOBUF_FINAL :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.GeneratedCodeInfo) */ {
public:
- inline GeneratedCodeInfo() : GeneratedCodeInfo(nullptr) {};
+ inline GeneratedCodeInfo() : GeneratedCodeInfo(nullptr) {}
virtual ~GeneratedCodeInfo();
GeneratedCodeInfo(const GeneratedCodeInfo& from);
diff --git a/src/google/protobuf/duration.pb.h b/src/google/protobuf/duration.pb.h
index 675cb93..685e123 100644
--- a/src/google/protobuf/duration.pb.h
+++ b/src/google/protobuf/duration.pb.h
@@ -69,7 +69,7 @@
class PROTOBUF_EXPORT Duration PROTOBUF_FINAL :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.Duration) */ {
public:
- inline Duration() : Duration(nullptr) {};
+ inline Duration() : Duration(nullptr) {}
virtual ~Duration();
Duration(const Duration& from);
diff --git a/src/google/protobuf/empty.pb.h b/src/google/protobuf/empty.pb.h
index 232c194..88d0794 100644
--- a/src/google/protobuf/empty.pb.h
+++ b/src/google/protobuf/empty.pb.h
@@ -69,7 +69,7 @@
class PROTOBUF_EXPORT Empty PROTOBUF_FINAL :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.Empty) */ {
public:
- inline Empty() : Empty(nullptr) {};
+ inline Empty() : Empty(nullptr) {}
virtual ~Empty();
Empty(const Empty& from);
diff --git a/src/google/protobuf/field_mask.pb.h b/src/google/protobuf/field_mask.pb.h
index b32ae3f..2d876c7 100644
--- a/src/google/protobuf/field_mask.pb.h
+++ b/src/google/protobuf/field_mask.pb.h
@@ -69,7 +69,7 @@
class PROTOBUF_EXPORT FieldMask PROTOBUF_FINAL :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.FieldMask) */ {
public:
- inline FieldMask() : FieldMask(nullptr) {};
+ inline FieldMask() : FieldMask(nullptr) {}
virtual ~FieldMask();
FieldMask(const FieldMask& from);
diff --git a/src/google/protobuf/map_entry_lite.h b/src/google/protobuf/map_entry_lite.h
index 7125ba1..161d08d 100644
--- a/src/google/protobuf/map_entry_lite.h
+++ b/src/google/protobuf/map_entry_lite.h
@@ -266,13 +266,8 @@
size_t ByteSizeLong() const override {
size_t size = 0;
- size += has_key() ? kTagSize +
- static_cast<size_t>(KeyTypeHandler::ByteSize(key()))
- : 0;
- size += has_value()
- ? kTagSize +
- static_cast<size_t>(ValueTypeHandler::ByteSize(value()))
- : 0;
+ size += kTagSize + static_cast<size_t>(KeyTypeHandler::ByteSize(key()));
+ size += kTagSize + static_cast<size_t>(ValueTypeHandler::ByteSize(value()));
return size;
}
diff --git a/src/google/protobuf/map_type_handler.h b/src/google/protobuf/map_type_handler.h
index 5efc6fb..d54aa22 100644
--- a/src/google/protobuf/map_type_handler.h
+++ b/src/google/protobuf/map_type_handler.h
@@ -240,7 +240,7 @@
int default_enum); \
static inline size_t SpaceUsedInMapEntryLong(const TypeOnMemory& value); \
static inline size_t SpaceUsedInMapLong(const TypeOnMemory& value); \
- static inline size_t SpaceUsedInMapLong(const std::string& value); \
+ static inline size_t SpaceUsedInMapLong(ConstStringParam value); \
static inline void AssignDefaultValue(TypeOnMemory* value); \
static inline const MapEntryAccessorType& DefaultIfNotInitialized( \
const TypeOnMemory& value, const TypeOnMemory& default_value); \
@@ -643,8 +643,8 @@
template <typename Type> \
inline size_t \
MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>::SpaceUsedInMapLong( \
- const std::string& value) { \
- return sizeof(value); \
+ ConstStringParam value) { \
+ return sizeof(std::string); \
} \
template <typename Type> \
inline void MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>::Clear( \
diff --git a/src/google/protobuf/repeated_field.h b/src/google/protobuf/repeated_field.h
index fd01a66..07800f5 100644
--- a/src/google/protobuf/repeated_field.h
+++ b/src/google/protobuf/repeated_field.h
@@ -439,43 +439,50 @@
//
// The first version executes at 7 cycles per iteration while the second
// version near 1 or 2 cycles.
- class FastAdder {
+ template <int = 0, bool = std::is_pod<Element>::value>
+ class FastAdderImpl {
public:
- explicit FastAdder(RepeatedField* rf) : repeated_field_(rf) {
- if (kIsPod) {
- index_ = repeated_field_->current_size_;
+ explicit FastAdderImpl(RepeatedField* rf) : repeated_field_(rf) {
+ index_ = repeated_field_->current_size_;
+ capacity_ = repeated_field_->total_size_;
+ buffer_ = repeated_field_->unsafe_elements();
+ }
+ ~FastAdderImpl() { repeated_field_->current_size_ = index_; }
+
+ void Add(Element val) {
+ if (index_ == capacity_) {
+ repeated_field_->current_size_ = index_;
+ repeated_field_->Reserve(index_ + 1);
capacity_ = repeated_field_->total_size_;
buffer_ = repeated_field_->unsafe_elements();
}
- }
- ~FastAdder() {
- if (kIsPod) repeated_field_->current_size_ = index_;
- }
-
- void Add(const Element& val) {
- if (kIsPod) {
- if (index_ == capacity_) {
- repeated_field_->current_size_ = index_;
- repeated_field_->Reserve(index_ + 1);
- capacity_ = repeated_field_->total_size_;
- buffer_ = repeated_field_->unsafe_elements();
- }
- buffer_[index_++] = val;
- } else {
- repeated_field_->Add(val);
- }
+ buffer_[index_++] = val;
}
private:
- constexpr static bool kIsPod = std::is_pod<Element>::value;
RepeatedField* repeated_field_;
int index_;
int capacity_;
Element* buffer_;
- GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FastAdder);
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FastAdderImpl);
};
+ // FastAdder is a wrapper for adding fields. The specialization above handles
+ // POD types more efficiently than RepeatedField.
+ template <int I>
+ class FastAdderImpl<I, false> {
+ public:
+ explicit FastAdderImpl(RepeatedField* rf) : repeated_field_(rf) {}
+ void Add(const Element& val) { repeated_field_->Add(val); }
+
+ private:
+ RepeatedField* repeated_field_;
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FastAdderImpl);
+ };
+
+ using FastAdder = FastAdderImpl<>;
+
friend class TestRepeatedFieldHelper;
friend class ::google::protobuf::internal::ParseContext;
};
@@ -1329,8 +1336,15 @@
template <typename Element>
inline void RepeatedField<Element>::Add(const Element& value) {
uint32 size = current_size_;
- if (static_cast<int>(size) == total_size_) Reserve(total_size_ + 1);
- elements()[size] = value;
+ if (static_cast<int>(size) == total_size_) {
+ // value could reference an element of the array. Reserving new space will
+ // invalidate the reference. So we must make a copy first.
+ auto tmp = value;
+ Reserve(total_size_ + 1);
+ elements()[size] = std::move(tmp);
+ } else {
+ elements()[size] = value;
+ }
current_size_ = size + 1;
}
diff --git a/src/google/protobuf/repeated_field_unittest.cc b/src/google/protobuf/repeated_field_unittest.cc
index 3d64782..26b2384 100644
--- a/src/google/protobuf/repeated_field_unittest.cc
+++ b/src/google/protobuf/repeated_field_unittest.cc
@@ -807,6 +807,14 @@
// strings.
}
+TEST(RepeatedField, TestSAddFromSelf) {
+ RepeatedField<int> field;
+ field.Add(0);
+ for (int i = 0; i < 1000; i++) {
+ field.Add(field[0]);
+ }
+}
+
// ===================================================================
// RepeatedPtrField tests. These pretty much just mirror the RepeatedField
// tests above.
diff --git a/src/google/protobuf/source_context.pb.h b/src/google/protobuf/source_context.pb.h
index c0326de..b48860d 100644
--- a/src/google/protobuf/source_context.pb.h
+++ b/src/google/protobuf/source_context.pb.h
@@ -69,7 +69,7 @@
class PROTOBUF_EXPORT SourceContext PROTOBUF_FINAL :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.SourceContext) */ {
public:
- inline SourceContext() : SourceContext(nullptr) {};
+ inline SourceContext() : SourceContext(nullptr) {}
virtual ~SourceContext();
SourceContext(const SourceContext& from);
diff --git a/src/google/protobuf/struct.pb.h b/src/google/protobuf/struct.pb.h
index c0fdf90..0c56821 100644
--- a/src/google/protobuf/struct.pb.h
+++ b/src/google/protobuf/struct.pb.h
@@ -141,7 +141,7 @@
class PROTOBUF_EXPORT Struct PROTOBUF_FINAL :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.Struct) */ {
public:
- inline Struct() : Struct(nullptr) {};
+ inline Struct() : Struct(nullptr) {}
virtual ~Struct();
Struct(const Struct& from);
@@ -292,7 +292,7 @@
class PROTOBUF_EXPORT Value PROTOBUF_FINAL :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.Value) */ {
public:
- inline Value() : Value(nullptr) {};
+ inline Value() : Value(nullptr) {}
virtual ~Value();
Value(const Value& from);
@@ -547,7 +547,7 @@
class PROTOBUF_EXPORT ListValue PROTOBUF_FINAL :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.ListValue) */ {
public:
- inline ListValue() : ListValue(nullptr) {};
+ inline ListValue() : ListValue(nullptr) {}
virtual ~ListValue();
ListValue(const ListValue& from);
diff --git a/src/google/protobuf/timestamp.pb.h b/src/google/protobuf/timestamp.pb.h
index b3db098..687aafd 100644
--- a/src/google/protobuf/timestamp.pb.h
+++ b/src/google/protobuf/timestamp.pb.h
@@ -69,7 +69,7 @@
class PROTOBUF_EXPORT Timestamp PROTOBUF_FINAL :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.Timestamp) */ {
public:
- inline Timestamp() : Timestamp(nullptr) {};
+ inline Timestamp() : Timestamp(nullptr) {}
virtual ~Timestamp();
Timestamp(const Timestamp& from);
diff --git a/src/google/protobuf/type.pb.h b/src/google/protobuf/type.pb.h
index ea57370..302cd71 100644
--- a/src/google/protobuf/type.pb.h
+++ b/src/google/protobuf/type.pb.h
@@ -182,7 +182,7 @@
class PROTOBUF_EXPORT Type PROTOBUF_FINAL :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.Type) */ {
public:
- inline Type() : Type(nullptr) {};
+ inline Type() : Type(nullptr) {}
virtual ~Type();
Type(const Type& from);
@@ -423,7 +423,7 @@
class PROTOBUF_EXPORT Field PROTOBUF_FINAL :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.Field) */ {
public:
- inline Field() : Field(nullptr) {};
+ inline Field() : Field(nullptr) {}
virtual ~Field();
Field(const Field& from);
@@ -794,7 +794,7 @@
class PROTOBUF_EXPORT Enum PROTOBUF_FINAL :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.Enum) */ {
public:
- inline Enum() : Enum(nullptr) {};
+ inline Enum() : Enum(nullptr) {}
virtual ~Enum();
Enum(const Enum& from);
@@ -1009,7 +1009,7 @@
class PROTOBUF_EXPORT EnumValue PROTOBUF_FINAL :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.EnumValue) */ {
public:
- inline EnumValue() : EnumValue(nullptr) {};
+ inline EnumValue() : EnumValue(nullptr) {}
virtual ~EnumValue();
EnumValue(const EnumValue& from);
@@ -1184,7 +1184,7 @@
class PROTOBUF_EXPORT Option PROTOBUF_FINAL :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.Option) */ {
public:
- inline Option() : Option(nullptr) {};
+ inline Option() : Option(nullptr) {}
virtual ~Option();
Option(const Option& from);
diff --git a/src/google/protobuf/util/internal/json_stream_parser.cc b/src/google/protobuf/util/internal/json_stream_parser.cc
index b94e3c2..8cb22c7 100644
--- a/src/google/protobuf/util/internal/json_stream_parser.cc
+++ b/src/google/protobuf/util/internal/json_stream_parser.cc
@@ -82,8 +82,8 @@
// Indicates a character may not be part of an unquoted key.
inline bool IsKeySeparator(char c) {
- return (ascii_isspace(c) || c == '"' || c == '\'' || c == '{' || c == '}' ||
- c == '[' || c == ']' || c == ':' || c == ',');
+ return (ascii_isspace(c) || c == '"' || c == '\'' || c == '{' ||
+ c == '}' || c == '[' || c == ']' || c == ':' || c == ',');
}
inline void ReplaceInvalidCodePoints(StringPiece str,
diff --git a/src/google/protobuf/util/internal/proto_writer.cc b/src/google/protobuf/util/internal/proto_writer.cc
index ea95932..de93085 100644
--- a/src/google/protobuf/util/internal/proto_writer.cc
+++ b/src/google/protobuf/util/internal/proto_writer.cc
@@ -406,7 +406,9 @@
now->parent()->parent_field_ != now->parent_field_) {
std::string name = now->parent_field_->name();
int i = 0;
- while (i < name.size() && (ascii_isalnum(name[i]) || name[i] == '_')) ++i;
+ while (i < name.size() &&
+ (ascii_isalnum(name[i]) || name[i] == '_'))
+ ++i;
if (i > 0 && i == name.size()) { // safe field name
if (loc.empty()) {
loc = name;
diff --git a/src/google/protobuf/util/internal/utility.cc b/src/google/protobuf/util/internal/utility.cc
index e3cdbcb..84682fa 100644
--- a/src/google/protobuf/util/internal/utility.cc
+++ b/src/google/protobuf/util/internal/utility.cc
@@ -270,7 +270,8 @@
// 1) following a lowercase: "...aB..."
// 2) followed by a lowercase: "...ABc..."
if (!result.empty() && is_cap &&
- (!was_cap || (i + 1 < input.size() && ascii_islower(input[i + 1])))) {
+ (!was_cap ||
+ (i + 1 < input.size() && ascii_islower(input[i + 1])))) {
first_word = false;
result.push_back(input[i]);
} else {
@@ -310,9 +311,9 @@
// (e.g. "GoogleLAB" => "google_lab")
// 4) Followed by a lowercase: "...ABc..." => "...a_bc..."
// (e.g. "GBike" => "g_bike")
- if (was_not_underscore && // case 1 out
- (was_not_cap || // case 2 in, case 3 out
- (i + 1 < input.size() && // case 3 out
+ if (was_not_underscore && // case 1 out
+ (was_not_cap || // case 2 in, case 3 out
+ (i + 1 < input.size() && // case 3 out
ascii_islower(input[i + 1])))) { // case 4 in
// We add an underscore for case 2 and case 4.
result.push_back('_');
diff --git a/src/google/protobuf/wrappers.pb.h b/src/google/protobuf/wrappers.pb.h
index d6ee3fc..14c6480 100644
--- a/src/google/protobuf/wrappers.pb.h
+++ b/src/google/protobuf/wrappers.pb.h
@@ -101,7 +101,7 @@
class PROTOBUF_EXPORT DoubleValue PROTOBUF_FINAL :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.DoubleValue) */ {
public:
- inline DoubleValue() : DoubleValue(nullptr) {};
+ inline DoubleValue() : DoubleValue(nullptr) {}
virtual ~DoubleValue();
DoubleValue(const DoubleValue& from);
@@ -238,7 +238,7 @@
class PROTOBUF_EXPORT FloatValue PROTOBUF_FINAL :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.FloatValue) */ {
public:
- inline FloatValue() : FloatValue(nullptr) {};
+ inline FloatValue() : FloatValue(nullptr) {}
virtual ~FloatValue();
FloatValue(const FloatValue& from);
@@ -375,7 +375,7 @@
class PROTOBUF_EXPORT Int64Value PROTOBUF_FINAL :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.Int64Value) */ {
public:
- inline Int64Value() : Int64Value(nullptr) {};
+ inline Int64Value() : Int64Value(nullptr) {}
virtual ~Int64Value();
Int64Value(const Int64Value& from);
@@ -512,7 +512,7 @@
class PROTOBUF_EXPORT UInt64Value PROTOBUF_FINAL :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.UInt64Value) */ {
public:
- inline UInt64Value() : UInt64Value(nullptr) {};
+ inline UInt64Value() : UInt64Value(nullptr) {}
virtual ~UInt64Value();
UInt64Value(const UInt64Value& from);
@@ -649,7 +649,7 @@
class PROTOBUF_EXPORT Int32Value PROTOBUF_FINAL :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.Int32Value) */ {
public:
- inline Int32Value() : Int32Value(nullptr) {};
+ inline Int32Value() : Int32Value(nullptr) {}
virtual ~Int32Value();
Int32Value(const Int32Value& from);
@@ -786,7 +786,7 @@
class PROTOBUF_EXPORT UInt32Value PROTOBUF_FINAL :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.UInt32Value) */ {
public:
- inline UInt32Value() : UInt32Value(nullptr) {};
+ inline UInt32Value() : UInt32Value(nullptr) {}
virtual ~UInt32Value();
UInt32Value(const UInt32Value& from);
@@ -923,7 +923,7 @@
class PROTOBUF_EXPORT BoolValue PROTOBUF_FINAL :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.BoolValue) */ {
public:
- inline BoolValue() : BoolValue(nullptr) {};
+ inline BoolValue() : BoolValue(nullptr) {}
virtual ~BoolValue();
BoolValue(const BoolValue& from);
@@ -1060,7 +1060,7 @@
class PROTOBUF_EXPORT StringValue PROTOBUF_FINAL :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.StringValue) */ {
public:
- inline StringValue() : StringValue(nullptr) {};
+ inline StringValue() : StringValue(nullptr) {}
virtual ~StringValue();
StringValue(const StringValue& from);
@@ -1204,7 +1204,7 @@
class PROTOBUF_EXPORT BytesValue PROTOBUF_FINAL :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.BytesValue) */ {
public:
- inline BytesValue() : BytesValue(nullptr) {};
+ inline BytesValue() : BytesValue(nullptr) {}
virtual ~BytesValue();
BytesValue(const BytesValue& from);
diff --git a/tests.sh b/tests.sh
index 0a0e798..ca998e1 100755
--- a/tests.sh
+++ b/tests.sh
@@ -305,8 +305,6 @@
}
build_objectivec_cocoapods_integration() {
- # Update pod to the latest version.
- gem install cocoapods --no_document
objectivec/Tests/CocoaPods/run_tests.sh
}
@@ -457,48 +455,16 @@
cd conformance && make test_nodejs && cd ..
}
-generate_php_test_proto() {
- internal_build_cpp
- pushd php/tests
- # Generate test file
- rm -rf generated
- mkdir 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
- pushd ../../src
- ./protoc --php_out=../php/tests/generated -I../php/tests -I. \
- ../php/tests/proto/test_import_descriptor_proto.proto
- popd
- popd
-}
-
use_php() {
VERSION=$1
export PATH=/usr/local/php-${VERSION}/bin:$PATH
- generate_php_test_proto
+ internal_build_cpp
}
use_php_zts() {
VERSION=$1
export PATH=/usr/local/php-${VERSION}-zts/bin:$PATH
- generate_php_test_proto
+ internal_build_cpp
}
build_php5.5() {
@@ -507,11 +473,9 @@
pushd php
rm -rf vendor
composer update
- ./vendor/bin/phpunit
+ composer test
popd
- pushd conformance
- make test_php
- popd
+ (cd conformance && make test_php)
}
build_php5.5_c() {
@@ -534,6 +498,7 @@
rm -rf vendor
composer update
tests/compile_extension.sh
+ tests/generate_protos.sh
php -dextension=./ext/google/protobuf/modules/protobuf.so ./vendor/bin/phpunit
popd
}
@@ -557,11 +522,9 @@
pushd php
rm -rf vendor
composer update
- ./vendor/bin/phpunit
+ composer test
popd
- pushd conformance
- make test_php
- popd
+ (cd conformance && make test_php)
}
build_php5.6_c() {
@@ -584,6 +547,7 @@
rm -rf vendor
composer update
tests/compile_extension.sh
+ tests/generate_protos.sh
php -dextension=./ext/google/protobuf/modules/protobuf.so ./vendor/bin/phpunit
popd
}
@@ -603,18 +567,13 @@
}
build_php5.6_mac() {
- generate_php_test_proto
+ internal_build_cpp
# Install PHP
curl -s https://php-osx.liip.ch/install.sh | bash -s 5.6
PHP_FOLDER=`find /usr/local -type d -name "php5-5.6*"` # The folder name may change upon time
test ! -z "$PHP_FOLDER"
export PATH="$PHP_FOLDER/bin:$PATH"
- # Install phpunit
- curl https://phar.phpunit.de/phpunit-5.6.8.phar -L -o phpunit.phar
- chmod +x phpunit.phar
- sudo mv phpunit.phar /usr/local/bin/phpunit
-
# Install valgrind
echo "#! /bin/bash" > valgrind
chmod ug+x valgrind
@@ -630,7 +589,7 @@
pushd php
rm -rf vendor
composer update
- ./vendor/bin/phpunit
+ composer test
popd
(cd conformance && make test_php)
}
@@ -655,6 +614,7 @@
rm -rf vendor
composer update
tests/compile_extension.sh
+ tests/generate_protos.sh
php -dextension=./ext/google/protobuf/modules/protobuf.so ./vendor/bin/phpunit
popd
}
@@ -674,18 +634,13 @@
}
build_php7.0_mac() {
- generate_php_test_proto
+ internal_build_cpp
# Install PHP
curl -s https://php-osx.liip.ch/install.sh | bash -s 7.0
PHP_FOLDER=`find /usr/local -type d -name "php5-7.0*"` # The folder name may change upon time
test ! -z "$PHP_FOLDER"
export PATH="$PHP_FOLDER/bin:$PATH"
- # Install phpunit
- curl https://phar.phpunit.de/phpunit-5.6.0.phar -L -o phpunit.phar
- chmod +x phpunit.phar
- sudo mv phpunit.phar /usr/local/bin/phpunit
-
# Install valgrind
echo "#! /bin/bash" > valgrind
chmod ug+x valgrind
@@ -697,7 +652,7 @@
}
build_php7.3_mac() {
- generate_php_test_proto
+ internal_build_cpp
# Install PHP
# We can't test PHP 7.4 with these binaries yet:
# https://github.com/liip/php-osx/issues/276
@@ -706,11 +661,6 @@
test ! -z "$PHP_FOLDER"
export PATH="$PHP_FOLDER/bin:$PATH"
- # Install phpunit
- curl https://phar.phpunit.de/phpunit-8.phar -L -o phpunit.phar
- chmod +x phpunit.phar
- sudo mv phpunit.phar /usr/local/bin/phpunit
-
# Install valgrind
echo "#! /bin/bash" > valgrind
chmod ug+x valgrind
@@ -736,7 +686,7 @@
pushd php
rm -rf vendor
composer update
- ./vendor/bin/phpunit
+ composer test
popd
(cd conformance && make test_php)
}
@@ -761,6 +711,7 @@
rm -rf vendor
composer update
tests/compile_extension.sh
+ tests/generate_protos.sh
php -dextension=./ext/google/protobuf/modules/protobuf.so ./vendor/bin/phpunit
popd
}
@@ -784,7 +735,7 @@
pushd php
rm -rf vendor
composer update
- ./vendor/bin/phpunit
+ composer test
popd
(cd conformance && make test_php)
}
@@ -810,6 +761,7 @@
rm -rf vendor
composer update
tests/compile_extension.sh
+ tests/generate_protos.sh
php -dextension=./ext/google/protobuf/modules/protobuf.so ./vendor/bin/phpunit
popd
(cd php/ext/google/protobuf && phpize --clean)