From b308580bb1c3f87a062ac1448a3e0bdaab9d40cf Mon Sep 17 00:00:00 2001 From: Jie Luo Date: Tue, 19 Dec 2017 11:54:11 -0800 Subject: Cherrypick for csharp, including: Add preserve UnknownFields Compare floating point values bitwise Add auto-generated header to C# generated files --- csharp/src/Google.Protobuf/CodedInputStream.cs | 6 +- csharp/src/Google.Protobuf/Collections/Lists.cs | 89 +++++ csharp/src/Google.Protobuf/Collections/MapField.cs | 22 +- .../Collections/ProtobufEqualityComparers.cs | 130 +++++++ .../Google.Protobuf/Collections/RepeatedField.cs | 5 +- csharp/src/Google.Protobuf/FieldCodec.cs | 4 +- csharp/src/Google.Protobuf/JsonTokenizer.cs | 2 +- .../src/Google.Protobuf/Reflection/Descriptor.cs | 426 ++++++++++++++++++--- csharp/src/Google.Protobuf/UnknownField.cs | 263 +++++++++++++ csharp/src/Google.Protobuf/UnknownFieldSet.cs | 324 ++++++++++++++++ csharp/src/Google.Protobuf/WellKnownTypes/Any.cs | 22 +- csharp/src/Google.Protobuf/WellKnownTypes/Api.cs | 54 ++- .../src/Google.Protobuf/WellKnownTypes/Duration.cs | 22 +- csharp/src/Google.Protobuf/WellKnownTypes/Empty.cs | 22 +- .../Google.Protobuf/WellKnownTypes/FieldMask.cs | 22 +- .../WellKnownTypes/SourceContext.cs | 22 +- .../src/Google.Protobuf/WellKnownTypes/Struct.cs | 58 ++- .../Google.Protobuf/WellKnownTypes/Timestamp.cs | 22 +- csharp/src/Google.Protobuf/WellKnownTypes/Type.cs | 86 ++++- .../src/Google.Protobuf/WellKnownTypes/Wrappers.cs | 158 ++++++-- 20 files changed, 1614 insertions(+), 145 deletions(-) create mode 100644 csharp/src/Google.Protobuf/Collections/Lists.cs create mode 100644 csharp/src/Google.Protobuf/Collections/ProtobufEqualityComparers.cs create mode 100644 csharp/src/Google.Protobuf/UnknownField.cs create mode 100644 csharp/src/Google.Protobuf/UnknownFieldSet.cs (limited to 'csharp/src/Google.Protobuf') diff --git a/csharp/src/Google.Protobuf/CodedInputStream.cs b/csharp/src/Google.Protobuf/CodedInputStream.cs index abd352b9..24d436c0 100644 --- a/csharp/src/Google.Protobuf/CodedInputStream.cs +++ b/csharp/src/Google.Protobuf/CodedInputStream.cs @@ -424,7 +424,10 @@ namespace Google.Protobuf } } - private void SkipGroup(uint startGroupTag) + /// + /// Skip a group. + /// + internal void SkipGroup(uint startGroupTag) { // Note: Currently we expect this to be the way that groups are read. We could put the recursion // depth changes into the ReadTag method instead, potentially... @@ -1270,7 +1273,6 @@ namespace Google.Protobuf } } } - #endregion } } \ No newline at end of file diff --git a/csharp/src/Google.Protobuf/Collections/Lists.cs b/csharp/src/Google.Protobuf/Collections/Lists.cs new file mode 100644 index 00000000..860795ce --- /dev/null +++ b/csharp/src/Google.Protobuf/Collections/Lists.cs @@ -0,0 +1,89 @@ +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2017 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using System.Collections.Generic; +using System.Collections.ObjectModel; + +namespace Google.Protobuf.Collections +{ + /// + /// Utility to compare if two Lists are the same, and the hash code + /// of a List. + /// + public static class Lists + { + /// + /// Checks if two lists are equal. + /// + public static bool Equals(List left, List right) + { + if (left == right) + { + return true; + } + if (left == null || right == null) + { + return false; + } + if (left.Count != right.Count) + { + return false; + } + IEqualityComparer comparer = EqualityComparer.Default; + for (int i = 0; i < left.Count; i++) + { + if (!comparer.Equals(left[i], right[i])) + { + return false; + } + } + return true; + } + + /// + /// Gets the list's hash code. + /// + public static int GetHashCode(List list) + { + if (list == null) + { + return 0; + } + int hash = 31; + foreach (T element in list) + { + hash = hash * 29 + element.GetHashCode(); + } + return hash; + } + } +} \ No newline at end of file diff --git a/csharp/src/Google.Protobuf/Collections/MapField.cs b/csharp/src/Google.Protobuf/Collections/MapField.cs index 8dac8e30..dbbcc148 100644 --- a/csharp/src/Google.Protobuf/Collections/MapField.cs +++ b/csharp/src/Google.Protobuf/Collections/MapField.cs @@ -71,9 +71,12 @@ namespace Google.Protobuf.Collections , IReadOnlyDictionary #endif { + private static readonly EqualityComparer ValueEqualityComparer = ProtobufEqualityComparers.GetEqualityComparer(); + private static readonly EqualityComparer KeyEqualityComparer = ProtobufEqualityComparers.GetEqualityComparer(); + // TODO: Don't create the map/list until we have an entry. (Assume many maps will be empty.) private readonly Dictionary>> map = - new Dictionary>>(); + new Dictionary>>(KeyEqualityComparer); private readonly LinkedList> list = new LinkedList>(); /// @@ -131,11 +134,8 @@ namespace Google.Protobuf.Collections return map.ContainsKey(key); } - private bool ContainsValue(TValue value) - { - var comparer = EqualityComparer.Default; - return list.Any(pair => comparer.Equals(pair.Value, value)); - } + private bool ContainsValue(TValue value) => + list.Any(pair => ValueEqualityComparer.Equals(pair.Value, value)); /// /// Removes the entry identified by the given key from the map. @@ -293,8 +293,7 @@ namespace Google.Protobuf.Collections bool ICollection>.Contains(KeyValuePair item) { TValue value; - return TryGetValue(item.Key, out value) - && EqualityComparer.Default.Equals(item.Value, value); + return TryGetValue(item.Key, out value) && ValueEqualityComparer.Equals(item.Value, value); } /// @@ -363,11 +362,12 @@ namespace Google.Protobuf.Collections /// public override int GetHashCode() { - var valueComparer = EqualityComparer.Default; + var keyComparer = KeyEqualityComparer; + var valueComparer = ValueEqualityComparer; int hash = 0; foreach (var pair in list) { - hash ^= pair.Key.GetHashCode() * 31 + valueComparer.GetHashCode(pair.Value); + hash ^= keyComparer.GetHashCode(pair.Key) * 31 + valueComparer.GetHashCode(pair.Value); } return hash; } @@ -394,7 +394,7 @@ namespace Google.Protobuf.Collections { return false; } - var valueComparer = EqualityComparer.Default; + var valueComparer = ValueEqualityComparer; foreach (var pair in this) { TValue value; diff --git a/csharp/src/Google.Protobuf/Collections/ProtobufEqualityComparers.cs b/csharp/src/Google.Protobuf/Collections/ProtobufEqualityComparers.cs new file mode 100644 index 00000000..13ef60fc --- /dev/null +++ b/csharp/src/Google.Protobuf/Collections/ProtobufEqualityComparers.cs @@ -0,0 +1,130 @@ +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2017 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using System; +using System.Collections.Generic; + +namespace Google.Protobuf.Collections +{ + /// + /// Provides a central place to implement equality comparisons, primarily for bitwise float/double equality. + /// + public static class ProtobufEqualityComparers + { + /// + /// Returns an equality comparer for suitable for Protobuf equality comparisons. + /// This is usually just the default equality comparer for the type, but floating point numbers are compared + /// bitwise. + /// + /// The type of equality comparer to return. + /// The equality comparer. + public static EqualityComparer GetEqualityComparer() + { + return typeof(T) == typeof(double) ? (EqualityComparer) (object) BitwiseDoubleEqualityComparer + : typeof(T) == typeof(float) ? (EqualityComparer) (object) BitwiseSingleEqualityComparer + : typeof(T) == typeof(double?) ? (EqualityComparer) (object) BitwiseNullableDoubleEqualityComparer + : typeof(T) == typeof(float?) ? (EqualityComparer) (object) BitwiseNullableSingleEqualityComparer + : EqualityComparer.Default; + } + + /// + /// Returns an equality comparer suitable for comparing 64-bit floating point values, by bitwise comparison. + /// (NaN values are considered equal, but only when they have the same representation.) + /// + public static EqualityComparer BitwiseDoubleEqualityComparer { get; } = new BitwiseDoubleEqualityComparerImpl(); + + /// + /// Returns an equality comparer suitable for comparing 32-bit floating point values, by bitwise comparison. + /// (NaN values are considered equal, but only when they have the same representation.) + /// + public static EqualityComparer BitwiseSingleEqualityComparer { get; } = new BitwiseSingleEqualityComparerImpl(); + + /// + /// Returns an equality comparer suitable for comparing nullable 64-bit floating point values, by bitwise comparison. + /// (NaN values are considered equal, but only when they have the same representation.) + /// + public static EqualityComparer BitwiseNullableDoubleEqualityComparer { get; } = new BitwiseNullableDoubleEqualityComparerImpl(); + + /// + /// Returns an equality comparer suitable for comparing nullable 32-bit floating point values, by bitwise comparison. + /// (NaN values are considered equal, but only when they have the same representation.) + /// + public static EqualityComparer BitwiseNullableSingleEqualityComparer { get; } = new BitwiseNullableSingleEqualityComparerImpl(); + + private class BitwiseDoubleEqualityComparerImpl : EqualityComparer + { + public override bool Equals(double x, double y) => + BitConverter.DoubleToInt64Bits(x) == BitConverter.DoubleToInt64Bits(y); + + public override int GetHashCode(double obj) => + BitConverter.DoubleToInt64Bits(obj).GetHashCode(); + } + + private class BitwiseSingleEqualityComparerImpl : EqualityComparer + { + // Just promote values to double and use BitConverter.DoubleToInt64Bits, + // as there's no BitConverter.SingleToInt32Bits, unfortunately. + + public override bool Equals(float x, float y) => + BitConverter.DoubleToInt64Bits(x) == BitConverter.DoubleToInt64Bits(y); + + public override int GetHashCode(float obj) => + BitConverter.DoubleToInt64Bits(obj).GetHashCode(); + } + + private class BitwiseNullableDoubleEqualityComparerImpl : EqualityComparer + { + public override bool Equals(double? x, double? y) => + x == null && y == null ? true + : x == null || y == null ? false + : BitwiseDoubleEqualityComparer.Equals(x.Value, y.Value); + + // The hash code for null is just a constant which is at least *unlikely* to be used + // elsewhere. (Compared with 0, say.) + public override int GetHashCode(double? obj) => + obj == null ? 293864 : BitwiseDoubleEqualityComparer.GetHashCode(obj.Value); + } + + private class BitwiseNullableSingleEqualityComparerImpl : EqualityComparer + { + public override bool Equals(float? x, float? y) => + x == null && y == null ? true + : x == null || y == null ? false + : BitwiseSingleEqualityComparer.Equals(x.Value, y.Value); + + // The hash code for null is just a constant which is at least *unlikely* to be used + // elsewhere. (Compared with 0, say.) + public override int GetHashCode(float? obj) => + obj == null ? 293864 : BitwiseSingleEqualityComparer.GetHashCode(obj.Value); + } + } +} diff --git a/csharp/src/Google.Protobuf/Collections/RepeatedField.cs b/csharp/src/Google.Protobuf/Collections/RepeatedField.cs index 6063ff61..c18b63e2 100755 --- a/csharp/src/Google.Protobuf/Collections/RepeatedField.cs +++ b/csharp/src/Google.Protobuf/Collections/RepeatedField.cs @@ -51,6 +51,7 @@ namespace Google.Protobuf.Collections , IReadOnlyList #endif { + private static readonly EqualityComparer EqualityComparer = ProtobufEqualityComparers.GetEqualityComparer(); private static readonly T[] EmptyArray = new T[0]; private const int MinArraySize = 8; @@ -434,7 +435,7 @@ namespace Google.Protobuf.Collections { return false; } - EqualityComparer comparer = EqualityComparer.Default; + EqualityComparer comparer = EqualityComparer; for (int i = 0; i < count; i++) { if (!comparer.Equals(array[i], other.array[i])) @@ -454,7 +455,7 @@ namespace Google.Protobuf.Collections public int IndexOf(T item) { ProtoPreconditions.CheckNotNullUnconstrained(item, nameof(item)); - EqualityComparer comparer = EqualityComparer.Default; + EqualityComparer comparer = EqualityComparer; for (int i = 0; i < count; i++) { if (comparer.Equals(array[i], item)) diff --git a/csharp/src/Google.Protobuf/FieldCodec.cs b/csharp/src/Google.Protobuf/FieldCodec.cs index c28b47e1..a11f2420 100644 --- a/csharp/src/Google.Protobuf/FieldCodec.cs +++ b/csharp/src/Google.Protobuf/FieldCodec.cs @@ -30,6 +30,7 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #endregion +using Google.Protobuf.Collections; using Google.Protobuf.Compatibility; using Google.Protobuf.WellKnownTypes; using System; @@ -346,6 +347,7 @@ namespace Google.Protobuf /// public sealed class FieldCodec { + private static readonly EqualityComparer EqualityComparer = ProtobufEqualityComparers.GetEqualityComparer(); private static readonly T DefaultDefault; // Only non-nullable value types support packing. This is the simplest way of detecting that. private static readonly bool TypeSupportsPacking = default(T) != null; @@ -469,6 +471,6 @@ namespace Google.Protobuf /// public int CalculateSizeWithTag(T value) => IsDefault(value) ? 0 : ValueSizeCalculator(value) + tagSize; - private bool IsDefault(T value) => EqualityComparer.Default.Equals(value, DefaultValue); + private bool IsDefault(T value) => EqualityComparer.Equals(value, DefaultValue); } } diff --git a/csharp/src/Google.Protobuf/JsonTokenizer.cs b/csharp/src/Google.Protobuf/JsonTokenizer.cs index 2fc1e7c3..0e403f78 100644 --- a/csharp/src/Google.Protobuf/JsonTokenizer.cs +++ b/csharp/src/Google.Protobuf/JsonTokenizer.cs @@ -245,7 +245,7 @@ namespace Google.Protobuf state = State.ObjectAfterColon; break; case ',': - ValidateState(State.ObjectAfterProperty | State.ArrayAfterValue, "Invalid state to read a colon: "); + ValidateState(State.ObjectAfterProperty | State.ArrayAfterValue, "Invalid state to read a comma: "); state = state == State.ObjectAfterProperty ? State.ObjectAfterComma : State.ArrayAfterComma; break; case '"': diff --git a/csharp/src/Google.Protobuf/Reflection/Descriptor.cs b/csharp/src/Google.Protobuf/Reflection/Descriptor.cs index 6aad0e99..af68fa86 100644 --- a/csharp/src/Google.Protobuf/Reflection/Descriptor.cs +++ b/csharp/src/Google.Protobuf/Reflection/Descriptor.cs @@ -1,5 +1,7 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/protobuf/descriptor.proto +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/protobuf/descriptor.proto +// #pragma warning disable 1591, 0612, 3021 #region Designer generated code @@ -192,6 +194,7 @@ namespace Google.Protobuf.Reflection { /// internal sealed partial class FileDescriptorSet : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new FileDescriptorSet()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -215,6 +218,7 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public FileDescriptorSet(FileDescriptorSet other) : this() { file_ = other.file_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -246,13 +250,16 @@ namespace Google.Protobuf.Reflection { return true; } if(!file_.Equals(other.file_)) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; hash ^= file_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -264,12 +271,18 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { file_.WriteTo(output, _repeated_file_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; size += file_.CalculateSize(_repeated_file_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -279,6 +292,7 @@ namespace Google.Protobuf.Reflection { return; } file_.Add(other.file_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -287,7 +301,7 @@ namespace Google.Protobuf.Reflection { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { file_.AddEntriesFrom(input, _repeated_file_codec); @@ -304,6 +318,7 @@ namespace Google.Protobuf.Reflection { /// internal sealed partial class FileDescriptorProto : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new FileDescriptorProto()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -338,6 +353,7 @@ namespace Google.Protobuf.Reflection { Options = other.options_ != null ? other.Options.Clone() : null; SourceCodeInfo = other.sourceCodeInfo_ != null ? other.SourceCodeInfo.Clone() : null; syntax_ = other.syntax_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -524,7 +540,7 @@ namespace Google.Protobuf.Reflection { if (!object.Equals(Options, other.Options)) return false; if (!object.Equals(SourceCodeInfo, other.SourceCodeInfo)) return false; if (Syntax != other.Syntax) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -542,6 +558,9 @@ namespace Google.Protobuf.Reflection { if (options_ != null) hash ^= Options.GetHashCode(); if (sourceCodeInfo_ != null) hash ^= SourceCodeInfo.GetHashCode(); if (Syntax.Length != 0) hash ^= Syntax.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -579,6 +598,9 @@ namespace Google.Protobuf.Reflection { output.WriteRawTag(98); output.WriteString(Syntax); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -606,6 +628,9 @@ namespace Google.Protobuf.Reflection { if (Syntax.Length != 0) { size += 1 + pb::CodedOutputStream.ComputeStringSize(Syntax); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -642,6 +667,7 @@ namespace Google.Protobuf.Reflection { if (other.Syntax.Length != 0) { Syntax = other.Syntax; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -650,7 +676,7 @@ namespace Google.Protobuf.Reflection { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { Name = input.ReadString(); @@ -719,6 +745,7 @@ namespace Google.Protobuf.Reflection { /// internal sealed partial class DescriptorProto : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DescriptorProto()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -751,6 +778,7 @@ namespace Google.Protobuf.Reflection { Options = other.options_ != null ? other.Options.Clone() : null; reservedRange_ = other.reservedRange_.Clone(); reservedName_ = other.reservedName_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -887,7 +915,7 @@ namespace Google.Protobuf.Reflection { if (!object.Equals(Options, other.Options)) return false; if(!reservedRange_.Equals(other.reservedRange_)) return false; if(!reservedName_.Equals(other.reservedName_)) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -903,6 +931,9 @@ namespace Google.Protobuf.Reflection { if (options_ != null) hash ^= Options.GetHashCode(); hash ^= reservedRange_.GetHashCode(); hash ^= reservedName_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -929,6 +960,9 @@ namespace Google.Protobuf.Reflection { oneofDecl_.WriteTo(output, _repeated_oneofDecl_codec); reservedRange_.WriteTo(output, _repeated_reservedRange_codec); reservedName_.WriteTo(output, _repeated_reservedName_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -948,6 +982,9 @@ namespace Google.Protobuf.Reflection { } size += reservedRange_.CalculateSize(_repeated_reservedRange_codec); size += reservedName_.CalculateSize(_repeated_reservedName_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -973,6 +1010,7 @@ namespace Google.Protobuf.Reflection { } reservedRange_.Add(other.reservedRange_); reservedName_.Add(other.reservedName_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -981,7 +1019,7 @@ namespace Google.Protobuf.Reflection { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { Name = input.ReadString(); @@ -1036,6 +1074,7 @@ namespace Google.Protobuf.Reflection { public static partial class Types { internal sealed partial class ExtensionRange : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ExtensionRange()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -1061,6 +1100,7 @@ namespace Google.Protobuf.Reflection { start_ = other.start_; end_ = other.end_; Options = other.options_ != null ? other.Options.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1117,7 +1157,7 @@ namespace Google.Protobuf.Reflection { if (Start != other.Start) return false; if (End != other.End) return false; if (!object.Equals(Options, other.Options)) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1126,6 +1166,9 @@ namespace Google.Protobuf.Reflection { if (Start != 0) hash ^= Start.GetHashCode(); if (End != 0) hash ^= End.GetHashCode(); if (options_ != null) hash ^= Options.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -1148,6 +1191,9 @@ namespace Google.Protobuf.Reflection { output.WriteRawTag(26); output.WriteMessage(Options); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1162,6 +1208,9 @@ namespace Google.Protobuf.Reflection { if (options_ != null) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(Options); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -1182,6 +1231,7 @@ namespace Google.Protobuf.Reflection { } Options.MergeFrom(other.Options); } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1190,7 +1240,7 @@ namespace Google.Protobuf.Reflection { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 8: { Start = input.ReadInt32(); @@ -1220,6 +1270,7 @@ namespace Google.Protobuf.Reflection { /// internal sealed partial class ReservedRange : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ReservedRange()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -1244,6 +1295,7 @@ namespace Google.Protobuf.Reflection { public ReservedRange(ReservedRange other) : this() { start_ = other.start_; end_ = other.end_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1294,7 +1346,7 @@ namespace Google.Protobuf.Reflection { } if (Start != other.Start) return false; if (End != other.End) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1302,6 +1354,9 @@ namespace Google.Protobuf.Reflection { int hash = 1; if (Start != 0) hash ^= Start.GetHashCode(); if (End != 0) hash ^= End.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -1320,6 +1375,9 @@ namespace Google.Protobuf.Reflection { output.WriteRawTag(16); output.WriteInt32(End); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1331,6 +1389,9 @@ namespace Google.Protobuf.Reflection { if (End != 0) { size += 1 + pb::CodedOutputStream.ComputeInt32Size(End); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -1345,6 +1406,7 @@ namespace Google.Protobuf.Reflection { if (other.End != 0) { End = other.End; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1353,7 +1415,7 @@ namespace Google.Protobuf.Reflection { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 8: { Start = input.ReadInt32(); @@ -1376,6 +1438,7 @@ namespace Google.Protobuf.Reflection { internal sealed partial class ExtensionRangeOptions : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ExtensionRangeOptions()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -1399,6 +1462,7 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public ExtensionRangeOptions(ExtensionRangeOptions other) : this() { uninterpretedOption_ = other.uninterpretedOption_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1433,13 +1497,16 @@ namespace Google.Protobuf.Reflection { return true; } if(!uninterpretedOption_.Equals(other.uninterpretedOption_)) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; hash ^= uninterpretedOption_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -1451,12 +1518,18 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { uninterpretedOption_.WriteTo(output, _repeated_uninterpretedOption_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; size += uninterpretedOption_.CalculateSize(_repeated_uninterpretedOption_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -1466,6 +1539,7 @@ namespace Google.Protobuf.Reflection { return; } uninterpretedOption_.Add(other.uninterpretedOption_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1474,7 +1548,7 @@ namespace Google.Protobuf.Reflection { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 7994: { uninterpretedOption_.AddEntriesFrom(input, _repeated_uninterpretedOption_codec); @@ -1491,6 +1565,7 @@ namespace Google.Protobuf.Reflection { /// internal sealed partial class FieldDescriptorProto : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new FieldDescriptorProto()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -1523,6 +1598,7 @@ namespace Google.Protobuf.Reflection { oneofIndex_ = other.oneofIndex_; jsonName_ = other.jsonName_; Options = other.options_ != null ? other.Options.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1695,7 +1771,7 @@ namespace Google.Protobuf.Reflection { if (OneofIndex != other.OneofIndex) return false; if (JsonName != other.JsonName) return false; if (!object.Equals(Options, other.Options)) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1711,6 +1787,9 @@ namespace Google.Protobuf.Reflection { if (OneofIndex != 0) hash ^= OneofIndex.GetHashCode(); if (JsonName.Length != 0) hash ^= JsonName.GetHashCode(); if (options_ != null) hash ^= Options.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -1761,6 +1840,9 @@ namespace Google.Protobuf.Reflection { output.WriteRawTag(82); output.WriteString(JsonName); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1796,6 +1878,9 @@ namespace Google.Protobuf.Reflection { if (options_ != null) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(Options); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -1837,6 +1922,7 @@ namespace Google.Protobuf.Reflection { } Options.MergeFrom(other.Options); } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1845,7 +1931,7 @@ namespace Google.Protobuf.Reflection { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { Name = input.ReadString(); @@ -1968,6 +2054,7 @@ namespace Google.Protobuf.Reflection { /// internal sealed partial class OneofDescriptorProto : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new OneofDescriptorProto()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -1992,6 +2079,7 @@ namespace Google.Protobuf.Reflection { public OneofDescriptorProto(OneofDescriptorProto other) : this() { name_ = other.name_; Options = other.options_ != null ? other.Options.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2036,7 +2124,7 @@ namespace Google.Protobuf.Reflection { } if (Name != other.Name) return false; if (!object.Equals(Options, other.Options)) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2044,6 +2132,9 @@ namespace Google.Protobuf.Reflection { int hash = 1; if (Name.Length != 0) hash ^= Name.GetHashCode(); if (options_ != null) hash ^= Options.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -2062,6 +2153,9 @@ namespace Google.Protobuf.Reflection { output.WriteRawTag(18); output.WriteMessage(Options); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2073,6 +2167,9 @@ namespace Google.Protobuf.Reflection { if (options_ != null) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(Options); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -2090,6 +2187,7 @@ namespace Google.Protobuf.Reflection { } Options.MergeFrom(other.Options); } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2098,7 +2196,7 @@ namespace Google.Protobuf.Reflection { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { Name = input.ReadString(); @@ -2122,6 +2220,7 @@ namespace Google.Protobuf.Reflection { /// internal sealed partial class EnumDescriptorProto : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new EnumDescriptorProto()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -2149,6 +2248,7 @@ namespace Google.Protobuf.Reflection { Options = other.options_ != null ? other.Options.Clone() : null; reservedRange_ = other.reservedRange_.Clone(); reservedName_ = other.reservedName_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2235,7 +2335,7 @@ namespace Google.Protobuf.Reflection { if (!object.Equals(Options, other.Options)) return false; if(!reservedRange_.Equals(other.reservedRange_)) return false; if(!reservedName_.Equals(other.reservedName_)) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2246,6 +2346,9 @@ namespace Google.Protobuf.Reflection { if (options_ != null) hash ^= Options.GetHashCode(); hash ^= reservedRange_.GetHashCode(); hash ^= reservedName_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -2267,6 +2370,9 @@ namespace Google.Protobuf.Reflection { } reservedRange_.WriteTo(output, _repeated_reservedRange_codec); reservedName_.WriteTo(output, _repeated_reservedName_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2281,6 +2387,9 @@ namespace Google.Protobuf.Reflection { } size += reservedRange_.CalculateSize(_repeated_reservedRange_codec); size += reservedName_.CalculateSize(_repeated_reservedName_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -2301,6 +2410,7 @@ namespace Google.Protobuf.Reflection { } reservedRange_.Add(other.reservedRange_); reservedName_.Add(other.reservedName_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2309,7 +2419,7 @@ namespace Google.Protobuf.Reflection { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { Name = input.ReadString(); @@ -2352,6 +2462,7 @@ namespace Google.Protobuf.Reflection { /// internal sealed partial class EnumReservedRange : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new EnumReservedRange()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -2376,6 +2487,7 @@ namespace Google.Protobuf.Reflection { public EnumReservedRange(EnumReservedRange other) : this() { start_ = other.start_; end_ = other.end_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2426,7 +2538,7 @@ namespace Google.Protobuf.Reflection { } if (Start != other.Start) return false; if (End != other.End) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2434,6 +2546,9 @@ namespace Google.Protobuf.Reflection { int hash = 1; if (Start != 0) hash ^= Start.GetHashCode(); if (End != 0) hash ^= End.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -2452,6 +2567,9 @@ namespace Google.Protobuf.Reflection { output.WriteRawTag(16); output.WriteInt32(End); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2463,6 +2581,9 @@ namespace Google.Protobuf.Reflection { if (End != 0) { size += 1 + pb::CodedOutputStream.ComputeInt32Size(End); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -2477,6 +2598,7 @@ namespace Google.Protobuf.Reflection { if (other.End != 0) { End = other.End; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2485,7 +2607,7 @@ namespace Google.Protobuf.Reflection { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 8: { Start = input.ReadInt32(); @@ -2511,6 +2633,7 @@ namespace Google.Protobuf.Reflection { /// internal sealed partial class EnumValueDescriptorProto : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new EnumValueDescriptorProto()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -2536,6 +2659,7 @@ namespace Google.Protobuf.Reflection { name_ = other.name_; number_ = other.number_; Options = other.options_ != null ? other.Options.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2592,7 +2716,7 @@ namespace Google.Protobuf.Reflection { if (Name != other.Name) return false; if (Number != other.Number) return false; if (!object.Equals(Options, other.Options)) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2601,6 +2725,9 @@ namespace Google.Protobuf.Reflection { if (Name.Length != 0) hash ^= Name.GetHashCode(); if (Number != 0) hash ^= Number.GetHashCode(); if (options_ != null) hash ^= Options.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -2623,6 +2750,9 @@ namespace Google.Protobuf.Reflection { output.WriteRawTag(26); output.WriteMessage(Options); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2637,6 +2767,9 @@ namespace Google.Protobuf.Reflection { if (options_ != null) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(Options); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -2657,6 +2790,7 @@ namespace Google.Protobuf.Reflection { } Options.MergeFrom(other.Options); } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2665,7 +2799,7 @@ namespace Google.Protobuf.Reflection { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { Name = input.ReadString(); @@ -2693,6 +2827,7 @@ namespace Google.Protobuf.Reflection { /// internal sealed partial class ServiceDescriptorProto : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ServiceDescriptorProto()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -2718,6 +2853,7 @@ namespace Google.Protobuf.Reflection { name_ = other.name_; method_ = other.method_.Clone(); Options = other.options_ != null ? other.Options.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2773,7 +2909,7 @@ namespace Google.Protobuf.Reflection { if (Name != other.Name) return false; if(!method_.Equals(other.method_)) return false; if (!object.Equals(Options, other.Options)) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2782,6 +2918,9 @@ namespace Google.Protobuf.Reflection { if (Name.Length != 0) hash ^= Name.GetHashCode(); hash ^= method_.GetHashCode(); if (options_ != null) hash ^= Options.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -2801,6 +2940,9 @@ namespace Google.Protobuf.Reflection { output.WriteRawTag(26); output.WriteMessage(Options); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2813,6 +2955,9 @@ namespace Google.Protobuf.Reflection { if (options_ != null) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(Options); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -2831,6 +2976,7 @@ namespace Google.Protobuf.Reflection { } Options.MergeFrom(other.Options); } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2839,7 +2985,7 @@ namespace Google.Protobuf.Reflection { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { Name = input.ReadString(); @@ -2867,6 +3013,7 @@ namespace Google.Protobuf.Reflection { /// internal sealed partial class MethodDescriptorProto : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new MethodDescriptorProto()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -2895,6 +3042,7 @@ namespace Google.Protobuf.Reflection { Options = other.options_ != null ? other.Options.Clone() : null; clientStreaming_ = other.clientStreaming_; serverStreaming_ = other.serverStreaming_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2997,7 +3145,7 @@ namespace Google.Protobuf.Reflection { if (!object.Equals(Options, other.Options)) return false; if (ClientStreaming != other.ClientStreaming) return false; if (ServerStreaming != other.ServerStreaming) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3009,6 +3157,9 @@ namespace Google.Protobuf.Reflection { if (options_ != null) hash ^= Options.GetHashCode(); if (ClientStreaming != false) hash ^= ClientStreaming.GetHashCode(); if (ServerStreaming != false) hash ^= ServerStreaming.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -3043,6 +3194,9 @@ namespace Google.Protobuf.Reflection { output.WriteRawTag(48); output.WriteBool(ServerStreaming); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3066,6 +3220,9 @@ namespace Google.Protobuf.Reflection { if (ServerStreaming != false) { size += 1 + 1; } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -3095,6 +3252,7 @@ namespace Google.Protobuf.Reflection { if (other.ServerStreaming != false) { ServerStreaming = other.ServerStreaming; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3103,7 +3261,7 @@ namespace Google.Protobuf.Reflection { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { Name = input.ReadString(); @@ -3140,6 +3298,7 @@ namespace Google.Protobuf.Reflection { internal sealed partial class FileOptions : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new FileOptions()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -3183,6 +3342,7 @@ namespace Google.Protobuf.Reflection { phpClassPrefix_ = other.phpClassPrefix_; phpNamespace_ = other.phpNamespace_; uninterpretedOption_ = other.uninterpretedOption_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3518,7 +3678,7 @@ namespace Google.Protobuf.Reflection { if (PhpClassPrefix != other.PhpClassPrefix) return false; if (PhpNamespace != other.PhpNamespace) return false; if(!uninterpretedOption_.Equals(other.uninterpretedOption_)) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3543,6 +3703,9 @@ namespace Google.Protobuf.Reflection { if (PhpClassPrefix.Length != 0) hash ^= PhpClassPrefix.GetHashCode(); if (PhpNamespace.Length != 0) hash ^= PhpNamespace.GetHashCode(); hash ^= uninterpretedOption_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -3626,6 +3789,9 @@ namespace Google.Protobuf.Reflection { output.WriteBool(PhpGenericServices); } uninterpretedOption_.WriteTo(output, _repeated_uninterpretedOption_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3686,6 +3852,9 @@ namespace Google.Protobuf.Reflection { size += 2 + pb::CodedOutputStream.ComputeStringSize(PhpNamespace); } size += uninterpretedOption_.CalculateSize(_repeated_uninterpretedOption_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -3749,6 +3918,7 @@ namespace Google.Protobuf.Reflection { PhpNamespace = other.PhpNamespace; } uninterpretedOption_.Add(other.uninterpretedOption_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3868,6 +4038,7 @@ namespace Google.Protobuf.Reflection { internal sealed partial class MessageOptions : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new MessageOptions()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -3897,6 +4068,7 @@ namespace Google.Protobuf.Reflection { deprecated_ = other.deprecated_; mapEntry_ = other.mapEntry_; uninterpretedOption_ = other.uninterpretedOption_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4033,7 +4205,7 @@ namespace Google.Protobuf.Reflection { if (Deprecated != other.Deprecated) return false; if (MapEntry != other.MapEntry) return false; if(!uninterpretedOption_.Equals(other.uninterpretedOption_)) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4044,6 +4216,9 @@ namespace Google.Protobuf.Reflection { if (Deprecated != false) hash ^= Deprecated.GetHashCode(); if (MapEntry != false) hash ^= MapEntry.GetHashCode(); hash ^= uninterpretedOption_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -4071,6 +4246,9 @@ namespace Google.Protobuf.Reflection { output.WriteBool(MapEntry); } uninterpretedOption_.WriteTo(output, _repeated_uninterpretedOption_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4089,6 +4267,9 @@ namespace Google.Protobuf.Reflection { size += 1 + 1; } size += uninterpretedOption_.CalculateSize(_repeated_uninterpretedOption_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -4110,6 +4291,7 @@ namespace Google.Protobuf.Reflection { MapEntry = other.MapEntry; } uninterpretedOption_.Add(other.uninterpretedOption_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4148,6 +4330,7 @@ namespace Google.Protobuf.Reflection { internal sealed partial class FieldOptions : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new FieldOptions()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -4179,6 +4362,7 @@ namespace Google.Protobuf.Reflection { deprecated_ = other.deprecated_; weak_ = other.weak_; uninterpretedOption_ = other.uninterpretedOption_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4349,7 +4533,7 @@ namespace Google.Protobuf.Reflection { if (Deprecated != other.Deprecated) return false; if (Weak != other.Weak) return false; if(!uninterpretedOption_.Equals(other.uninterpretedOption_)) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4362,6 +4546,9 @@ namespace Google.Protobuf.Reflection { if (Deprecated != false) hash ^= Deprecated.GetHashCode(); if (Weak != false) hash ^= Weak.GetHashCode(); hash ^= uninterpretedOption_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -4397,6 +4584,9 @@ namespace Google.Protobuf.Reflection { output.WriteBool(Weak); } uninterpretedOption_.WriteTo(output, _repeated_uninterpretedOption_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4421,6 +4611,9 @@ namespace Google.Protobuf.Reflection { size += 1 + 1; } size += uninterpretedOption_.CalculateSize(_repeated_uninterpretedOption_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -4448,6 +4641,7 @@ namespace Google.Protobuf.Reflection { Weak = other.Weak; } uninterpretedOption_.Add(other.uninterpretedOption_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4525,6 +4719,7 @@ namespace Google.Protobuf.Reflection { internal sealed partial class OneofOptions : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new OneofOptions()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -4550,6 +4745,7 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public OneofOptions(OneofOptions other) : this() { uninterpretedOption_ = other.uninterpretedOption_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4584,13 +4780,16 @@ namespace Google.Protobuf.Reflection { return true; } if(!uninterpretedOption_.Equals(other.uninterpretedOption_)) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; hash ^= uninterpretedOption_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -4602,12 +4801,18 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { uninterpretedOption_.WriteTo(output, _repeated_uninterpretedOption_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; size += uninterpretedOption_.CalculateSize(_repeated_uninterpretedOption_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -4617,6 +4822,7 @@ namespace Google.Protobuf.Reflection { return; } uninterpretedOption_.Add(other.uninterpretedOption_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4639,6 +4845,7 @@ namespace Google.Protobuf.Reflection { internal sealed partial class EnumOptions : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new EnumOptions()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -4666,6 +4873,7 @@ namespace Google.Protobuf.Reflection { allowAlias_ = other.allowAlias_; deprecated_ = other.deprecated_; uninterpretedOption_ = other.uninterpretedOption_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4734,7 +4942,7 @@ namespace Google.Protobuf.Reflection { if (AllowAlias != other.AllowAlias) return false; if (Deprecated != other.Deprecated) return false; if(!uninterpretedOption_.Equals(other.uninterpretedOption_)) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4743,6 +4951,9 @@ namespace Google.Protobuf.Reflection { if (AllowAlias != false) hash ^= AllowAlias.GetHashCode(); if (Deprecated != false) hash ^= Deprecated.GetHashCode(); hash ^= uninterpretedOption_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -4762,6 +4973,9 @@ namespace Google.Protobuf.Reflection { output.WriteBool(Deprecated); } uninterpretedOption_.WriteTo(output, _repeated_uninterpretedOption_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4774,6 +4988,9 @@ namespace Google.Protobuf.Reflection { size += 1 + 1; } size += uninterpretedOption_.CalculateSize(_repeated_uninterpretedOption_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -4789,6 +5006,7 @@ namespace Google.Protobuf.Reflection { Deprecated = other.Deprecated; } uninterpretedOption_.Add(other.uninterpretedOption_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4819,6 +5037,7 @@ namespace Google.Protobuf.Reflection { internal sealed partial class EnumValueOptions : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new EnumValueOptions()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -4845,6 +5064,7 @@ namespace Google.Protobuf.Reflection { public EnumValueOptions(EnumValueOptions other) : this() { deprecated_ = other.deprecated_; uninterpretedOption_ = other.uninterpretedOption_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4897,7 +5117,7 @@ namespace Google.Protobuf.Reflection { } if (Deprecated != other.Deprecated) return false; if(!uninterpretedOption_.Equals(other.uninterpretedOption_)) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4905,6 +5125,9 @@ namespace Google.Protobuf.Reflection { int hash = 1; if (Deprecated != false) hash ^= Deprecated.GetHashCode(); hash ^= uninterpretedOption_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -4920,6 +5143,9 @@ namespace Google.Protobuf.Reflection { output.WriteBool(Deprecated); } uninterpretedOption_.WriteTo(output, _repeated_uninterpretedOption_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4929,6 +5155,9 @@ namespace Google.Protobuf.Reflection { size += 1 + 1; } size += uninterpretedOption_.CalculateSize(_repeated_uninterpretedOption_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -4941,6 +5170,7 @@ namespace Google.Protobuf.Reflection { Deprecated = other.Deprecated; } uninterpretedOption_.Add(other.uninterpretedOption_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4967,6 +5197,7 @@ namespace Google.Protobuf.Reflection { internal sealed partial class ServiceOptions : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ServiceOptions()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -4993,6 +5224,7 @@ namespace Google.Protobuf.Reflection { public ServiceOptions(ServiceOptions other) : this() { deprecated_ = other.deprecated_; uninterpretedOption_ = other.uninterpretedOption_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -5045,7 +5277,7 @@ namespace Google.Protobuf.Reflection { } if (Deprecated != other.Deprecated) return false; if(!uninterpretedOption_.Equals(other.uninterpretedOption_)) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -5053,6 +5285,9 @@ namespace Google.Protobuf.Reflection { int hash = 1; if (Deprecated != false) hash ^= Deprecated.GetHashCode(); hash ^= uninterpretedOption_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -5068,6 +5303,9 @@ namespace Google.Protobuf.Reflection { output.WriteBool(Deprecated); } uninterpretedOption_.WriteTo(output, _repeated_uninterpretedOption_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -5077,6 +5315,9 @@ namespace Google.Protobuf.Reflection { size += 2 + 1; } size += uninterpretedOption_.CalculateSize(_repeated_uninterpretedOption_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -5089,6 +5330,7 @@ namespace Google.Protobuf.Reflection { Deprecated = other.Deprecated; } uninterpretedOption_.Add(other.uninterpretedOption_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -5115,6 +5357,7 @@ namespace Google.Protobuf.Reflection { internal sealed partial class MethodOptions : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new MethodOptions()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -5142,6 +5385,7 @@ namespace Google.Protobuf.Reflection { deprecated_ = other.deprecated_; idempotencyLevel_ = other.idempotencyLevel_; uninterpretedOption_ = other.uninterpretedOption_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -5206,7 +5450,7 @@ namespace Google.Protobuf.Reflection { if (Deprecated != other.Deprecated) return false; if (IdempotencyLevel != other.IdempotencyLevel) return false; if(!uninterpretedOption_.Equals(other.uninterpretedOption_)) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -5215,6 +5459,9 @@ namespace Google.Protobuf.Reflection { if (Deprecated != false) hash ^= Deprecated.GetHashCode(); if (IdempotencyLevel != 0) hash ^= IdempotencyLevel.GetHashCode(); hash ^= uninterpretedOption_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -5234,6 +5481,9 @@ namespace Google.Protobuf.Reflection { output.WriteEnum((int) IdempotencyLevel); } uninterpretedOption_.WriteTo(output, _repeated_uninterpretedOption_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -5246,6 +5496,9 @@ namespace Google.Protobuf.Reflection { size += 2 + pb::CodedOutputStream.ComputeEnumSize((int) IdempotencyLevel); } size += uninterpretedOption_.CalculateSize(_repeated_uninterpretedOption_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -5261,6 +5514,7 @@ namespace Google.Protobuf.Reflection { IdempotencyLevel = other.IdempotencyLevel; } uninterpretedOption_.Add(other.uninterpretedOption_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -5323,6 +5577,7 @@ namespace Google.Protobuf.Reflection { /// internal sealed partial class UninterpretedOption : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new UninterpretedOption()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -5352,6 +5607,7 @@ namespace Google.Protobuf.Reflection { doubleValue_ = other.doubleValue_; stringValue_ = other.stringValue_; aggregateValue_ = other.aggregateValue_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -5456,10 +5712,10 @@ namespace Google.Protobuf.Reflection { if (IdentifierValue != other.IdentifierValue) return false; if (PositiveIntValue != other.PositiveIntValue) return false; if (NegativeIntValue != other.NegativeIntValue) return false; - if (DoubleValue != other.DoubleValue) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(DoubleValue, other.DoubleValue)) return false; if (StringValue != other.StringValue) return false; if (AggregateValue != other.AggregateValue) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -5469,9 +5725,12 @@ namespace Google.Protobuf.Reflection { if (IdentifierValue.Length != 0) hash ^= IdentifierValue.GetHashCode(); if (PositiveIntValue != 0UL) hash ^= PositiveIntValue.GetHashCode(); if (NegativeIntValue != 0L) hash ^= NegativeIntValue.GetHashCode(); - if (DoubleValue != 0D) hash ^= DoubleValue.GetHashCode(); + if (DoubleValue != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(DoubleValue); if (StringValue.Length != 0) hash ^= StringValue.GetHashCode(); if (AggregateValue.Length != 0) hash ^= AggregateValue.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -5507,6 +5766,9 @@ namespace Google.Protobuf.Reflection { output.WriteRawTag(66); output.WriteString(AggregateValue); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -5531,6 +5793,9 @@ namespace Google.Protobuf.Reflection { if (AggregateValue.Length != 0) { size += 1 + pb::CodedOutputStream.ComputeStringSize(AggregateValue); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -5558,6 +5823,7 @@ namespace Google.Protobuf.Reflection { if (other.AggregateValue.Length != 0) { AggregateValue = other.AggregateValue; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -5566,7 +5832,7 @@ namespace Google.Protobuf.Reflection { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 18: { name_.AddEntriesFrom(input, _repeated_name_codec); @@ -5613,6 +5879,7 @@ namespace Google.Protobuf.Reflection { /// internal sealed partial class NamePart : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new NamePart()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -5637,6 +5904,7 @@ namespace Google.Protobuf.Reflection { public NamePart(NamePart other) : this() { namePart_ = other.namePart_; isExtension_ = other.isExtension_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -5681,7 +5949,7 @@ namespace Google.Protobuf.Reflection { } if (NamePart_ != other.NamePart_) return false; if (IsExtension != other.IsExtension) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -5689,6 +5957,9 @@ namespace Google.Protobuf.Reflection { int hash = 1; if (NamePart_.Length != 0) hash ^= NamePart_.GetHashCode(); if (IsExtension != false) hash ^= IsExtension.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -5707,6 +5978,9 @@ namespace Google.Protobuf.Reflection { output.WriteRawTag(16); output.WriteBool(IsExtension); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -5718,6 +5992,9 @@ namespace Google.Protobuf.Reflection { if (IsExtension != false) { size += 1 + 1; } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -5732,6 +6009,7 @@ namespace Google.Protobuf.Reflection { if (other.IsExtension != false) { IsExtension = other.IsExtension; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -5740,7 +6018,7 @@ namespace Google.Protobuf.Reflection { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { NamePart_ = input.ReadString(); @@ -5767,6 +6045,7 @@ namespace Google.Protobuf.Reflection { /// internal sealed partial class SourceCodeInfo : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SourceCodeInfo()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -5790,6 +6069,7 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public SourceCodeInfo(SourceCodeInfo other) : this() { location_ = other.location_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -5866,13 +6146,16 @@ namespace Google.Protobuf.Reflection { return true; } if(!location_.Equals(other.location_)) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; hash ^= location_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -5884,12 +6167,18 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { location_.WriteTo(output, _repeated_location_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; size += location_.CalculateSize(_repeated_location_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -5899,6 +6188,7 @@ namespace Google.Protobuf.Reflection { return; } location_.Add(other.location_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -5907,7 +6197,7 @@ namespace Google.Protobuf.Reflection { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { location_.AddEntriesFrom(input, _repeated_location_codec); @@ -5923,6 +6213,7 @@ namespace Google.Protobuf.Reflection { public static partial class Types { internal sealed partial class Location : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Location()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -5950,6 +6241,7 @@ namespace Google.Protobuf.Reflection { leadingComments_ = other.leadingComments_; trailingComments_ = other.trailingComments_; leadingDetachedComments_ = other.leadingDetachedComments_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -6108,7 +6400,7 @@ namespace Google.Protobuf.Reflection { if (LeadingComments != other.LeadingComments) return false; if (TrailingComments != other.TrailingComments) return false; if(!leadingDetachedComments_.Equals(other.leadingDetachedComments_)) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -6119,6 +6411,9 @@ namespace Google.Protobuf.Reflection { if (LeadingComments.Length != 0) hash ^= LeadingComments.GetHashCode(); if (TrailingComments.Length != 0) hash ^= TrailingComments.GetHashCode(); hash ^= leadingDetachedComments_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -6140,6 +6435,9 @@ namespace Google.Protobuf.Reflection { output.WriteString(TrailingComments); } leadingDetachedComments_.WriteTo(output, _repeated_leadingDetachedComments_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -6154,6 +6452,9 @@ namespace Google.Protobuf.Reflection { size += 1 + pb::CodedOutputStream.ComputeStringSize(TrailingComments); } size += leadingDetachedComments_.CalculateSize(_repeated_leadingDetachedComments_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -6171,6 +6472,7 @@ namespace Google.Protobuf.Reflection { TrailingComments = other.TrailingComments; } leadingDetachedComments_.Add(other.leadingDetachedComments_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -6179,7 +6481,7 @@ namespace Google.Protobuf.Reflection { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: case 8: { @@ -6221,6 +6523,7 @@ namespace Google.Protobuf.Reflection { /// internal sealed partial class GeneratedCodeInfo : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new GeneratedCodeInfo()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -6244,6 +6547,7 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public GeneratedCodeInfo(GeneratedCodeInfo other) : this() { annotation_ = other.annotation_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -6279,13 +6583,16 @@ namespace Google.Protobuf.Reflection { return true; } if(!annotation_.Equals(other.annotation_)) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; hash ^= annotation_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -6297,12 +6604,18 @@ namespace Google.Protobuf.Reflection { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { annotation_.WriteTo(output, _repeated_annotation_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; size += annotation_.CalculateSize(_repeated_annotation_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -6312,6 +6625,7 @@ namespace Google.Protobuf.Reflection { return; } annotation_.Add(other.annotation_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -6320,7 +6634,7 @@ namespace Google.Protobuf.Reflection { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { annotation_.AddEntriesFrom(input, _repeated_annotation_codec); @@ -6336,6 +6650,7 @@ namespace Google.Protobuf.Reflection { public static partial class Types { internal sealed partial class Annotation : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Annotation()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -6362,6 +6677,7 @@ namespace Google.Protobuf.Reflection { sourceFile_ = other.sourceFile_; begin_ = other.begin_; end_ = other.end_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -6445,7 +6761,7 @@ namespace Google.Protobuf.Reflection { if (SourceFile != other.SourceFile) return false; if (Begin != other.Begin) return false; if (End != other.End) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -6455,6 +6771,9 @@ namespace Google.Protobuf.Reflection { if (SourceFile.Length != 0) hash ^= SourceFile.GetHashCode(); if (Begin != 0) hash ^= Begin.GetHashCode(); if (End != 0) hash ^= End.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -6478,6 +6797,9 @@ namespace Google.Protobuf.Reflection { output.WriteRawTag(32); output.WriteInt32(End); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -6493,6 +6815,9 @@ namespace Google.Protobuf.Reflection { if (End != 0) { size += 1 + pb::CodedOutputStream.ComputeInt32Size(End); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -6511,6 +6836,7 @@ namespace Google.Protobuf.Reflection { if (other.End != 0) { End = other.End; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -6519,7 +6845,7 @@ namespace Google.Protobuf.Reflection { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: case 8: { diff --git a/csharp/src/Google.Protobuf/UnknownField.cs b/csharp/src/Google.Protobuf/UnknownField.cs new file mode 100644 index 00000000..0d6eed63 --- /dev/null +++ b/csharp/src/Google.Protobuf/UnknownField.cs @@ -0,0 +1,263 @@ +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2017 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using Google.Protobuf.Collections; + +namespace Google.Protobuf +{ + /// + /// Represents a single field in an UnknownFieldSet. + /// + /// An UnknownField consists of four lists of values. The lists correspond + /// to the four "wire types" used in the protocol buffer binary format. + /// Normally, only one of the four lists will contain any values, since it + /// is impossible to define a valid message type that declares two different + /// types for the same field number. However, the code is designed to allow + /// for the case where the same unknown field number is encountered using + /// multiple different wire types. + /// + /// + internal sealed class UnknownField + { + private List varintList; + private List fixed32List; + private List fixed64List; + private List lengthDelimitedList; + + /// + /// Creates a new UnknownField. + /// + public UnknownField() + { + } + + /// + /// Checks if two unknown field are equal. + /// + public override bool Equals(object other) + { + if (ReferenceEquals(this, other)) + { + return true; + } + UnknownField otherField = other as UnknownField; + return otherField != null + && Lists.Equals(varintList, otherField.varintList) + && Lists.Equals(fixed32List, otherField.fixed32List) + && Lists.Equals(fixed64List, otherField.fixed64List) + && Lists.Equals(lengthDelimitedList, otherField.lengthDelimitedList); + } + + /// + /// Get the hash code of the unknown field. + /// + public override int GetHashCode() + { + int hash = 43; + hash = hash * 47 + Lists.GetHashCode(varintList); + hash = hash * 47 + Lists.GetHashCode(fixed32List); + hash = hash * 47 + Lists.GetHashCode(fixed64List); + hash = hash * 47 + Lists.GetHashCode(lengthDelimitedList); + return hash; + } + + /// + /// Serializes the field, including the field number, and writes it to + /// + /// + /// The unknown field number. + /// The CodedOutputStream to write to. + internal void WriteTo(int fieldNumber, CodedOutputStream output) + { + if (varintList != null) + { + foreach (ulong value in varintList) + { + output.WriteTag(fieldNumber, WireFormat.WireType.Varint); + output.WriteUInt64(value); + } + } + if (fixed32List != null) + { + foreach (uint value in fixed32List) + { + output.WriteTag(fieldNumber, WireFormat.WireType.Fixed32); + output.WriteFixed32(value); + } + } + if (fixed64List != null) + { + foreach (ulong value in fixed64List) + { + output.WriteTag(fieldNumber, WireFormat.WireType.Fixed64); + output.WriteFixed64(value); + } + } + if (lengthDelimitedList != null) + { + foreach (ByteString value in lengthDelimitedList) + { + output.WriteTag(fieldNumber, WireFormat.WireType.LengthDelimited); + output.WriteBytes(value); + } + } + } + + /// + /// Computes the number of bytes required to encode this field, including field + /// number. + /// + internal int GetSerializedSize(int fieldNumber) + { + int result = 0; + if (varintList != null) + { + result += CodedOutputStream.ComputeTagSize(fieldNumber) * varintList.Count; + foreach (ulong value in varintList) + { + result += CodedOutputStream.ComputeUInt64Size(value); + } + } + if (fixed32List != null) + { + result += CodedOutputStream.ComputeTagSize(fieldNumber) * fixed32List.Count; + result += CodedOutputStream.ComputeFixed32Size(1) * fixed32List.Count; + } + if (fixed64List != null) + { + result += CodedOutputStream.ComputeTagSize(fieldNumber) * fixed64List.Count; + result += CodedOutputStream.ComputeFixed64Size(1) * fixed64List.Count; + } + if (lengthDelimitedList != null) + { + result += CodedOutputStream.ComputeTagSize(fieldNumber) * lengthDelimitedList.Count; + foreach (ByteString value in lengthDelimitedList) + { + result += CodedOutputStream.ComputeBytesSize(value); + } + } + return result; + } + + /// + /// Merge the values in into this field. For each list + /// of values, 's values are append to the ones in this + /// field. + /// + internal UnknownField MergeFrom(UnknownField other) + { + varintList = AddAll(varintList, other.varintList); + fixed32List = AddAll(fixed32List, other.fixed32List); + fixed64List = AddAll(fixed64List, other.fixed64List); + lengthDelimitedList = AddAll(lengthDelimitedList, other.lengthDelimitedList); + return this; + } + + /// + /// Returns a new list containing all of the given specified values from + /// both the and lists. + /// If is null and is empty, + /// null is returned. Otherwise, either a new list is created (if + /// is null) or the elements of are added to . + /// + private static List AddAll(List current, IList extras) + { + if (extras.Count == 0) + { + return current; + } + if (current == null) + { + current = new List(extras); + } + else + { + current.AddRange(extras); + } + return current; + } + + /// + /// Adds a varint value. + /// + internal UnknownField AddVarint(ulong value) + { + varintList = Add(varintList, value); + return this; + } + + /// + /// Adds a fixed32 value. + /// + internal UnknownField AddFixed32(uint value) + { + fixed32List = Add(fixed32List, value); + return this; + } + + /// + /// Adds a fixed64 value. + /// + internal UnknownField AddFixed64(ulong value) + { + fixed64List = Add(fixed64List, value); + return this; + } + + /// + /// Adds a length-delimited value. + /// + internal UnknownField AddLengthDelimited(ByteString value) + { + lengthDelimitedList = Add(lengthDelimitedList, value); + return this; + } + + /// + /// Adds to the , creating + /// a new list if is null. The list is returned - either + /// the original reference or the new list. + /// + private static List Add(List list, T value) + { + if (list == null) + { + list = new List(); + } + list.Add(value); + return list; + } + } +} diff --git a/csharp/src/Google.Protobuf/UnknownFieldSet.cs b/csharp/src/Google.Protobuf/UnknownFieldSet.cs new file mode 100644 index 00000000..b43f4774 --- /dev/null +++ b/csharp/src/Google.Protobuf/UnknownFieldSet.cs @@ -0,0 +1,324 @@ +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2015 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using System; +using System.Collections.Generic; +using System.IO; +using Google.Protobuf.Reflection; + +namespace Google.Protobuf +{ + /// + /// Used to keep track of fields which were seen when parsing a protocol message + /// but whose field numbers or types are unrecognized. This most frequently + /// occurs when new fields are added to a message type and then messages containing + /// those fields are read by old software that was built before the new types were + /// added. + /// + /// Most users will never need to use this class directly. + /// + public sealed partial class UnknownFieldSet + { + private readonly IDictionary fields; + + /// + /// Creates a new UnknownFieldSet. + /// + internal UnknownFieldSet() + { + this.fields = new Dictionary(); + } + + /// + /// Checks whether or not the given field number is present in the set. + /// + internal bool HasField(int field) + { + return fields.ContainsKey(field); + } + + /// + /// Serializes the set and writes it to . + /// + public void WriteTo(CodedOutputStream output) + { + foreach (KeyValuePair entry in fields) + { + entry.Value.WriteTo(entry.Key, output); + } + } + + /// + /// Gets the number of bytes required to encode this set. + /// + public int CalculateSize() + { + int result = 0; + foreach (KeyValuePair entry in fields) + { + result += entry.Value.GetSerializedSize(entry.Key); + } + return result; + } + + /// + /// Checks if two unknown field sets are equal. + /// + public override bool Equals(object other) + { + if (ReferenceEquals(this, other)) + { + return true; + } + UnknownFieldSet otherSet = other as UnknownFieldSet; + IDictionary otherFields = otherSet.fields; + if (fields.Count != otherFields.Count) + { + return false; + } + foreach (KeyValuePair leftEntry in fields) + { + UnknownField rightValue; + if (!otherFields.TryGetValue(leftEntry.Key, out rightValue)) + { + return false; + } + if (!leftEntry.Value.Equals(rightValue)) + { + return false; + } + } + return true; + } + + /// + /// Gets the unknown field set's hash code. + /// + public override int GetHashCode() + { + int ret = 1; + foreach (KeyValuePair field in fields) + { + // Use ^ here to make the field order irrelevant. + int hash = field.Key.GetHashCode() ^ field.Value.GetHashCode(); + ret ^= hash; + } + return ret; + } + + // Optimization: We keep around the last field that was + // modified so that we can efficiently add to it multiple times in a + // row (important when parsing an unknown repeated field). + private int lastFieldNumber; + private UnknownField lastField; + + private UnknownField GetOrAddField(int number) + { + if (lastField != null && number == lastFieldNumber) + { + return lastField; + } + if (number == 0) + { + return null; + } + + UnknownField existing; + if (fields.TryGetValue(number, out existing)) + { + return existing; + } + lastField = new UnknownField(); + AddOrReplaceField(number, lastField); + lastFieldNumber = number; + return lastField; + } + + /// + /// Adds a field to the set. If a field with the same number already exists, it + /// is replaced. + /// + internal UnknownFieldSet AddOrReplaceField(int number, UnknownField field) + { + if (number == 0) + { + throw new ArgumentOutOfRangeException("number", "Zero is not a valid field number."); + } + fields[number] = field; + return this; + } + + /// + /// Parse a single field from and merge it + /// into this set. + /// + /// The coded input stream containing the field + /// false if the tag is an "end group" tag, true otherwise + private void MergeFieldFrom(CodedInputStream input) + { + uint tag = input.LastTag; + int number = WireFormat.GetTagFieldNumber(tag); + switch (WireFormat.GetTagWireType(tag)) + { + case WireFormat.WireType.Varint: + { + ulong uint64 = input.ReadUInt64(); + GetOrAddField(number).AddVarint(uint64); + return; + } + case WireFormat.WireType.Fixed32: + { + uint uint32 = input.ReadFixed32(); + GetOrAddField(number).AddFixed32(uint32); + return; + } + case WireFormat.WireType.Fixed64: + { + ulong uint64 = input.ReadFixed64(); + GetOrAddField(number).AddFixed64(uint64); + return; + } + case WireFormat.WireType.LengthDelimited: + { + ByteString bytes = input.ReadBytes(); + GetOrAddField(number).AddLengthDelimited(bytes); + return; + } + case WireFormat.WireType.StartGroup: + { + input.SkipGroup(tag); + return; + } + case WireFormat.WireType.EndGroup: + { + throw new InvalidProtocolBufferException("Merge an unknown field of end-group tag, indicating that the corresponding start-group was missing."); + } + default: + throw new InvalidOperationException("Wire Type is invalid."); + } + } + + /// + /// Create a new UnknownFieldSet if unknownFields is null. + /// Parse a single field from and merge it + /// into unknownFields. + /// + /// The UnknownFieldSet which need to be merged + /// The coded input stream containing the field + /// The merged UnknownFieldSet + public static UnknownFieldSet MergeFieldFrom(UnknownFieldSet unknownFields, + CodedInputStream input) + { + if (unknownFields == null) + { + unknownFields = new UnknownFieldSet(); + } + unknownFields.MergeFieldFrom(input); + return unknownFields; + } + + /// + /// Merges the fields from into this set. + /// If a field number exists in both sets, the values in + /// will be appended to the values in this set. + /// + private UnknownFieldSet MergeFrom(UnknownFieldSet other) + { + if (other != null) + { + foreach (KeyValuePair entry in other.fields) + { + MergeField(entry.Key, entry.Value); + } + } + return this; + } + + /// + /// Created a new UnknownFieldSet to if + /// needed and merges the fields from into the first set. + /// If a field number exists in both sets, the values in + /// will be appended to the values in this set. + /// + public static UnknownFieldSet MergeFrom(UnknownFieldSet unknownFields, + UnknownFieldSet other) + { + if (other == null) + { + return unknownFields; + } + if (unknownFields == null) + { + unknownFields = new UnknownFieldSet(); + } + unknownFields.MergeFrom(other); + return unknownFields; + } + + + /// + /// Adds a field to the unknown field set. If a field with the same + /// number already exists, the two are merged. + /// + private UnknownFieldSet MergeField(int number, UnknownField field) + { + if (number == 0) + { + throw new ArgumentOutOfRangeException("number", "Zero is not a valid field number."); + } + if (HasField(number)) + { + GetOrAddField(number).MergeFrom(field); + } + else + { + AddOrReplaceField(number, field); + } + return this; + } + + /// + /// Clone an unknown field set from . + /// + public static UnknownFieldSet Clone(UnknownFieldSet other) + { + if (other == null) + { + return null; + } + UnknownFieldSet unknownFields = new UnknownFieldSet(); + unknownFields.MergeFrom(other); + return unknownFields; + } + } +} + diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Any.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Any.cs index 5b39b809..5836dfff 100644 --- a/csharp/src/Google.Protobuf/WellKnownTypes/Any.cs +++ b/csharp/src/Google.Protobuf/WellKnownTypes/Any.cs @@ -1,5 +1,7 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/protobuf/any.proto +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/protobuf/any.proto +// #pragma warning disable 1591, 0612, 3021 #region Designer generated code @@ -119,6 +121,7 @@ namespace Google.Protobuf.WellKnownTypes { /// public sealed partial class Any : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Any()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -143,6 +146,7 @@ namespace Google.Protobuf.WellKnownTypes { public Any(Any other) : this() { typeUrl_ = other.typeUrl_; value_ = other.value_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -213,7 +217,7 @@ namespace Google.Protobuf.WellKnownTypes { } if (TypeUrl != other.TypeUrl) return false; if (Value != other.Value) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -221,6 +225,9 @@ namespace Google.Protobuf.WellKnownTypes { int hash = 1; if (TypeUrl.Length != 0) hash ^= TypeUrl.GetHashCode(); if (Value.Length != 0) hash ^= Value.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -239,6 +246,9 @@ namespace Google.Protobuf.WellKnownTypes { output.WriteRawTag(18); output.WriteBytes(Value); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -250,6 +260,9 @@ namespace Google.Protobuf.WellKnownTypes { if (Value.Length != 0) { size += 1 + pb::CodedOutputStream.ComputeBytesSize(Value); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -264,6 +277,7 @@ namespace Google.Protobuf.WellKnownTypes { if (other.Value.Length != 0) { Value = other.Value; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -272,7 +286,7 @@ namespace Google.Protobuf.WellKnownTypes { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { TypeUrl = input.ReadString(); diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Api.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Api.cs index 6705e092..4db1f633 100644 --- a/csharp/src/Google.Protobuf/WellKnownTypes/Api.cs +++ b/csharp/src/Google.Protobuf/WellKnownTypes/Api.cs @@ -1,5 +1,7 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/protobuf/api.proto +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/protobuf/api.proto +// #pragma warning disable 1591, 0612, 3021 #region Designer generated code @@ -64,6 +66,7 @@ namespace Google.Protobuf.WellKnownTypes { /// public sealed partial class Api : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Api()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -93,6 +96,7 @@ namespace Google.Protobuf.WellKnownTypes { SourceContext = other.sourceContext_ != null ? other.SourceContext.Clone() : null; mixins_ = other.mixins_.Clone(); syntax_ = other.syntax_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -235,7 +239,7 @@ namespace Google.Protobuf.WellKnownTypes { if (!object.Equals(SourceContext, other.SourceContext)) return false; if(!mixins_.Equals(other.mixins_)) return false; if (Syntax != other.Syntax) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -248,6 +252,9 @@ namespace Google.Protobuf.WellKnownTypes { if (sourceContext_ != null) hash ^= SourceContext.GetHashCode(); hash ^= mixins_.GetHashCode(); if (Syntax != 0) hash ^= Syntax.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -277,6 +284,9 @@ namespace Google.Protobuf.WellKnownTypes { output.WriteRawTag(56); output.WriteEnum((int) Syntax); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -297,6 +307,9 @@ namespace Google.Protobuf.WellKnownTypes { if (Syntax != 0) { size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Syntax); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -323,6 +336,7 @@ namespace Google.Protobuf.WellKnownTypes { if (other.Syntax != 0) { Syntax = other.Syntax; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -331,7 +345,7 @@ namespace Google.Protobuf.WellKnownTypes { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { Name = input.ReadString(); @@ -375,6 +389,7 @@ namespace Google.Protobuf.WellKnownTypes { /// public sealed partial class Method : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Method()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -404,6 +419,7 @@ namespace Google.Protobuf.WellKnownTypes { responseStreaming_ = other.responseStreaming_; options_ = other.options_.Clone(); syntax_ = other.syntax_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -528,7 +544,7 @@ namespace Google.Protobuf.WellKnownTypes { if (ResponseStreaming != other.ResponseStreaming) return false; if(!options_.Equals(other.options_)) return false; if (Syntax != other.Syntax) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -541,6 +557,9 @@ namespace Google.Protobuf.WellKnownTypes { if (ResponseStreaming != false) hash ^= ResponseStreaming.GetHashCode(); hash ^= options_.GetHashCode(); if (Syntax != 0) hash ^= Syntax.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -576,6 +595,9 @@ namespace Google.Protobuf.WellKnownTypes { output.WriteRawTag(56); output.WriteEnum((int) Syntax); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -600,6 +622,9 @@ namespace Google.Protobuf.WellKnownTypes { if (Syntax != 0) { size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Syntax); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -627,6 +652,7 @@ namespace Google.Protobuf.WellKnownTypes { if (other.Syntax != 0) { Syntax = other.Syntax; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -635,7 +661,7 @@ namespace Google.Protobuf.WellKnownTypes { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { Name = input.ReadString(); @@ -753,6 +779,7 @@ namespace Google.Protobuf.WellKnownTypes { /// public sealed partial class Mixin : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Mixin()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -777,6 +804,7 @@ namespace Google.Protobuf.WellKnownTypes { public Mixin(Mixin other) : this() { name_ = other.name_; root_ = other.root_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -828,7 +856,7 @@ namespace Google.Protobuf.WellKnownTypes { } if (Name != other.Name) return false; if (Root != other.Root) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -836,6 +864,9 @@ namespace Google.Protobuf.WellKnownTypes { int hash = 1; if (Name.Length != 0) hash ^= Name.GetHashCode(); if (Root.Length != 0) hash ^= Root.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -854,6 +885,9 @@ namespace Google.Protobuf.WellKnownTypes { output.WriteRawTag(18); output.WriteString(Root); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -865,6 +899,9 @@ namespace Google.Protobuf.WellKnownTypes { if (Root.Length != 0) { size += 1 + pb::CodedOutputStream.ComputeStringSize(Root); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -879,6 +916,7 @@ namespace Google.Protobuf.WellKnownTypes { if (other.Root.Length != 0) { Root = other.Root; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -887,7 +925,7 @@ namespace Google.Protobuf.WellKnownTypes { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { Name = input.ReadString(); diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Duration.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Duration.cs index 94159cb8..2858b532 100644 --- a/csharp/src/Google.Protobuf/WellKnownTypes/Duration.cs +++ b/csharp/src/Google.Protobuf/WellKnownTypes/Duration.cs @@ -1,5 +1,7 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/protobuf/duration.proto +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/protobuf/duration.proto +// #pragma warning disable 1591, 0612, 3021 #region Designer generated code @@ -100,6 +102,7 @@ namespace Google.Protobuf.WellKnownTypes { /// public sealed partial class Duration : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Duration()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -124,6 +127,7 @@ namespace Google.Protobuf.WellKnownTypes { public Duration(Duration other) : this() { seconds_ = other.seconds_; nanos_ = other.nanos_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -181,7 +185,7 @@ namespace Google.Protobuf.WellKnownTypes { } if (Seconds != other.Seconds) return false; if (Nanos != other.Nanos) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -189,6 +193,9 @@ namespace Google.Protobuf.WellKnownTypes { int hash = 1; if (Seconds != 0L) hash ^= Seconds.GetHashCode(); if (Nanos != 0) hash ^= Nanos.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -207,6 +214,9 @@ namespace Google.Protobuf.WellKnownTypes { output.WriteRawTag(16); output.WriteInt32(Nanos); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -218,6 +228,9 @@ namespace Google.Protobuf.WellKnownTypes { if (Nanos != 0) { size += 1 + pb::CodedOutputStream.ComputeInt32Size(Nanos); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -232,6 +245,7 @@ namespace Google.Protobuf.WellKnownTypes { if (other.Nanos != 0) { Nanos = other.Nanos; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -240,7 +254,7 @@ namespace Google.Protobuf.WellKnownTypes { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 8: { Seconds = input.ReadInt64(); diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Empty.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Empty.cs index aa89e08f..2113add9 100644 --- a/csharp/src/Google.Protobuf/WellKnownTypes/Empty.cs +++ b/csharp/src/Google.Protobuf/WellKnownTypes/Empty.cs @@ -1,5 +1,7 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/protobuf/empty.proto +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/protobuf/empty.proto +// #pragma warning disable 1591, 0612, 3021 #region Designer generated code @@ -50,6 +52,7 @@ namespace Google.Protobuf.WellKnownTypes { /// public sealed partial class Empty : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Empty()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -72,6 +75,7 @@ namespace Google.Protobuf.WellKnownTypes { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Empty(Empty other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -92,12 +96,15 @@ namespace Google.Protobuf.WellKnownTypes { if (ReferenceEquals(other, this)) { return true; } - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -108,11 +115,17 @@ namespace Google.Protobuf.WellKnownTypes { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -121,6 +134,7 @@ namespace Google.Protobuf.WellKnownTypes { if (other == null) { return; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -129,7 +143,7 @@ namespace Google.Protobuf.WellKnownTypes { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; } } diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/FieldMask.cs b/csharp/src/Google.Protobuf/WellKnownTypes/FieldMask.cs index ee4561ff..3565f433 100644 --- a/csharp/src/Google.Protobuf/WellKnownTypes/FieldMask.cs +++ b/csharp/src/Google.Protobuf/WellKnownTypes/FieldMask.cs @@ -1,5 +1,7 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/protobuf/field_mask.proto +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/protobuf/field_mask.proto +// #pragma warning disable 1591, 0612, 3021 #region Designer generated code @@ -248,6 +250,7 @@ namespace Google.Protobuf.WellKnownTypes { /// public sealed partial class FieldMask : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new FieldMask()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -271,6 +274,7 @@ namespace Google.Protobuf.WellKnownTypes { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public FieldMask(FieldMask other) : this() { paths_ = other.paths_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -305,13 +309,16 @@ namespace Google.Protobuf.WellKnownTypes { return true; } if(!paths_.Equals(other.paths_)) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; hash ^= paths_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -323,12 +330,18 @@ namespace Google.Protobuf.WellKnownTypes { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { paths_.WriteTo(output, _repeated_paths_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; size += paths_.CalculateSize(_repeated_paths_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -338,6 +351,7 @@ namespace Google.Protobuf.WellKnownTypes { return; } paths_.Add(other.paths_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -346,7 +360,7 @@ namespace Google.Protobuf.WellKnownTypes { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { paths_.AddEntriesFrom(input, _repeated_paths_codec); diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/SourceContext.cs b/csharp/src/Google.Protobuf/WellKnownTypes/SourceContext.cs index 6ddadf19..124ddaa7 100644 --- a/csharp/src/Google.Protobuf/WellKnownTypes/SourceContext.cs +++ b/csharp/src/Google.Protobuf/WellKnownTypes/SourceContext.cs @@ -1,5 +1,7 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/protobuf/source_context.proto +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/protobuf/source_context.proto +// #pragma warning disable 1591, 0612, 3021 #region Designer generated code @@ -44,6 +46,7 @@ namespace Google.Protobuf.WellKnownTypes { /// public sealed partial class SourceContext : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SourceContext()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -67,6 +70,7 @@ namespace Google.Protobuf.WellKnownTypes { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public SourceContext(SourceContext other) : this() { fileName_ = other.fileName_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -103,13 +107,16 @@ namespace Google.Protobuf.WellKnownTypes { return true; } if (FileName != other.FileName) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (FileName.Length != 0) hash ^= FileName.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -124,6 +131,9 @@ namespace Google.Protobuf.WellKnownTypes { output.WriteRawTag(10); output.WriteString(FileName); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -132,6 +142,9 @@ namespace Google.Protobuf.WellKnownTypes { if (FileName.Length != 0) { size += 1 + pb::CodedOutputStream.ComputeStringSize(FileName); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -143,6 +156,7 @@ namespace Google.Protobuf.WellKnownTypes { if (other.FileName.Length != 0) { FileName = other.FileName; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -151,7 +165,7 @@ namespace Google.Protobuf.WellKnownTypes { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { FileName = input.ReadString(); diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Struct.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Struct.cs index 65119894..194b81e9 100644 --- a/csharp/src/Google.Protobuf/WellKnownTypes/Struct.cs +++ b/csharp/src/Google.Protobuf/WellKnownTypes/Struct.cs @@ -1,5 +1,7 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/protobuf/struct.proto +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/protobuf/struct.proto +// #pragma warning disable 1591, 0612, 3021 #region Designer generated code @@ -77,6 +79,7 @@ namespace Google.Protobuf.WellKnownTypes { /// public sealed partial class Struct : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Struct()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -100,6 +103,7 @@ namespace Google.Protobuf.WellKnownTypes { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Struct(Struct other) : this() { fields_ = other.fields_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -134,13 +138,16 @@ namespace Google.Protobuf.WellKnownTypes { return true; } if (!Fields.Equals(other.Fields)) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; hash ^= Fields.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -152,12 +159,18 @@ namespace Google.Protobuf.WellKnownTypes { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { fields_.WriteTo(output, _map_fields_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; size += fields_.CalculateSize(_map_fields_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -167,6 +180,7 @@ namespace Google.Protobuf.WellKnownTypes { return; } fields_.Add(other.fields_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -175,7 +189,7 @@ namespace Google.Protobuf.WellKnownTypes { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { fields_.AddEntriesFrom(input, _map_fields_codec); @@ -197,6 +211,7 @@ namespace Google.Protobuf.WellKnownTypes { /// public sealed partial class Value : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Value()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -240,6 +255,7 @@ namespace Google.Protobuf.WellKnownTypes { break; } + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -368,25 +384,28 @@ namespace Google.Protobuf.WellKnownTypes { return true; } if (NullValue != other.NullValue) return false; - if (NumberValue != other.NumberValue) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(NumberValue, other.NumberValue)) return false; if (StringValue != other.StringValue) return false; if (BoolValue != other.BoolValue) return false; if (!object.Equals(StructValue, other.StructValue)) return false; if (!object.Equals(ListValue, other.ListValue)) return false; if (KindCase != other.KindCase) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (kindCase_ == KindOneofCase.NullValue) hash ^= NullValue.GetHashCode(); - if (kindCase_ == KindOneofCase.NumberValue) hash ^= NumberValue.GetHashCode(); + if (kindCase_ == KindOneofCase.NumberValue) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(NumberValue); if (kindCase_ == KindOneofCase.StringValue) hash ^= StringValue.GetHashCode(); if (kindCase_ == KindOneofCase.BoolValue) hash ^= BoolValue.GetHashCode(); if (kindCase_ == KindOneofCase.StructValue) hash ^= StructValue.GetHashCode(); if (kindCase_ == KindOneofCase.ListValue) hash ^= ListValue.GetHashCode(); hash ^= (int) kindCase_; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -421,6 +440,9 @@ namespace Google.Protobuf.WellKnownTypes { output.WriteRawTag(50); output.WriteMessage(ListValue); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -444,6 +466,9 @@ namespace Google.Protobuf.WellKnownTypes { if (kindCase_ == KindOneofCase.ListValue) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(ListValue); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -479,6 +504,7 @@ namespace Google.Protobuf.WellKnownTypes { break; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -487,7 +513,7 @@ namespace Google.Protobuf.WellKnownTypes { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 8: { kind_ = input.ReadEnum(); @@ -537,6 +563,7 @@ namespace Google.Protobuf.WellKnownTypes { /// public sealed partial class ListValue : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ListValue()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -560,6 +587,7 @@ namespace Google.Protobuf.WellKnownTypes { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public ListValue(ListValue other) : this() { values_ = other.values_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -594,13 +622,16 @@ namespace Google.Protobuf.WellKnownTypes { return true; } if(!values_.Equals(other.values_)) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; hash ^= values_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -612,12 +643,18 @@ namespace Google.Protobuf.WellKnownTypes { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { values_.WriteTo(output, _repeated_values_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; size += values_.CalculateSize(_repeated_values_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -627,6 +664,7 @@ namespace Google.Protobuf.WellKnownTypes { return; } values_.Add(other.values_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -635,7 +673,7 @@ namespace Google.Protobuf.WellKnownTypes { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { values_.AddEntriesFrom(input, _repeated_values_codec); diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Timestamp.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Timestamp.cs index 9f7ad73a..bf2943df 100644 --- a/csharp/src/Google.Protobuf/WellKnownTypes/Timestamp.cs +++ b/csharp/src/Google.Protobuf/WellKnownTypes/Timestamp.cs @@ -1,5 +1,7 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/protobuf/timestamp.proto +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/protobuf/timestamp.proto +// #pragma warning disable 1591, 0612, 3021 #region Designer generated code @@ -117,6 +119,7 @@ namespace Google.Protobuf.WellKnownTypes { /// public sealed partial class Timestamp : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Timestamp()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -141,6 +144,7 @@ namespace Google.Protobuf.WellKnownTypes { public Timestamp(Timestamp other) : this() { seconds_ = other.seconds_; nanos_ = other.nanos_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -196,7 +200,7 @@ namespace Google.Protobuf.WellKnownTypes { } if (Seconds != other.Seconds) return false; if (Nanos != other.Nanos) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -204,6 +208,9 @@ namespace Google.Protobuf.WellKnownTypes { int hash = 1; if (Seconds != 0L) hash ^= Seconds.GetHashCode(); if (Nanos != 0) hash ^= Nanos.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -222,6 +229,9 @@ namespace Google.Protobuf.WellKnownTypes { output.WriteRawTag(16); output.WriteInt32(Nanos); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -233,6 +243,9 @@ namespace Google.Protobuf.WellKnownTypes { if (Nanos != 0) { size += 1 + pb::CodedOutputStream.ComputeInt32Size(Nanos); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -247,6 +260,7 @@ namespace Google.Protobuf.WellKnownTypes { if (other.Nanos != 0) { Nanos = other.Nanos; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -255,7 +269,7 @@ namespace Google.Protobuf.WellKnownTypes { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 8: { Seconds = input.ReadInt64(); diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Type.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Type.cs index 7375b6cb..84310550 100644 --- a/csharp/src/Google.Protobuf/WellKnownTypes/Type.cs +++ b/csharp/src/Google.Protobuf/WellKnownTypes/Type.cs @@ -1,5 +1,7 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/protobuf/type.proto +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/protobuf/type.proto +// #pragma warning disable 1591, 0612, 3021 #region Designer generated code @@ -94,6 +96,7 @@ namespace Google.Protobuf.WellKnownTypes { /// public sealed partial class Type : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Type()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -122,6 +125,7 @@ namespace Google.Protobuf.WellKnownTypes { options_ = other.options_.Clone(); SourceContext = other.sourceContext_ != null ? other.SourceContext.Clone() : null; syntax_ = other.syntax_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -229,7 +233,7 @@ namespace Google.Protobuf.WellKnownTypes { if(!options_.Equals(other.options_)) return false; if (!object.Equals(SourceContext, other.SourceContext)) return false; if (Syntax != other.Syntax) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -241,6 +245,9 @@ namespace Google.Protobuf.WellKnownTypes { hash ^= options_.GetHashCode(); if (sourceContext_ != null) hash ^= SourceContext.GetHashCode(); if (Syntax != 0) hash ^= Syntax.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -266,6 +273,9 @@ namespace Google.Protobuf.WellKnownTypes { output.WriteRawTag(48); output.WriteEnum((int) Syntax); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -283,6 +293,9 @@ namespace Google.Protobuf.WellKnownTypes { if (Syntax != 0) { size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Syntax); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -306,6 +319,7 @@ namespace Google.Protobuf.WellKnownTypes { if (other.Syntax != 0) { Syntax = other.Syntax; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -314,7 +328,7 @@ namespace Google.Protobuf.WellKnownTypes { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { Name = input.ReadString(); @@ -354,6 +368,7 @@ namespace Google.Protobuf.WellKnownTypes { /// public sealed partial class Field : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Field()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -386,6 +401,7 @@ namespace Google.Protobuf.WellKnownTypes { options_ = other.options_.Clone(); jsonName_ = other.jsonName_; defaultValue_ = other.defaultValue_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -557,7 +573,7 @@ namespace Google.Protobuf.WellKnownTypes { if(!options_.Equals(other.options_)) return false; if (JsonName != other.JsonName) return false; if (DefaultValue != other.DefaultValue) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -573,6 +589,9 @@ namespace Google.Protobuf.WellKnownTypes { hash ^= options_.GetHashCode(); if (JsonName.Length != 0) hash ^= JsonName.GetHashCode(); if (DefaultValue.Length != 0) hash ^= DefaultValue.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -620,6 +639,9 @@ namespace Google.Protobuf.WellKnownTypes { output.WriteRawTag(90); output.WriteString(DefaultValue); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -653,6 +675,9 @@ namespace Google.Protobuf.WellKnownTypes { if (DefaultValue.Length != 0) { size += 1 + pb::CodedOutputStream.ComputeStringSize(DefaultValue); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -689,6 +714,7 @@ namespace Google.Protobuf.WellKnownTypes { if (other.DefaultValue.Length != 0) { DefaultValue = other.DefaultValue; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -697,7 +723,7 @@ namespace Google.Protobuf.WellKnownTypes { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 8: { kind_ = (global::Google.Protobuf.WellKnownTypes.Field.Types.Kind) input.ReadEnum(); @@ -861,6 +887,7 @@ namespace Google.Protobuf.WellKnownTypes { /// public sealed partial class Enum : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Enum()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -888,6 +915,7 @@ namespace Google.Protobuf.WellKnownTypes { options_ = other.options_.Clone(); SourceContext = other.sourceContext_ != null ? other.SourceContext.Clone() : null; syntax_ = other.syntax_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -981,7 +1009,7 @@ namespace Google.Protobuf.WellKnownTypes { if(!options_.Equals(other.options_)) return false; if (!object.Equals(SourceContext, other.SourceContext)) return false; if (Syntax != other.Syntax) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -992,6 +1020,9 @@ namespace Google.Protobuf.WellKnownTypes { hash ^= options_.GetHashCode(); if (sourceContext_ != null) hash ^= SourceContext.GetHashCode(); if (Syntax != 0) hash ^= Syntax.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -1016,6 +1047,9 @@ namespace Google.Protobuf.WellKnownTypes { output.WriteRawTag(40); output.WriteEnum((int) Syntax); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1032,6 +1066,9 @@ namespace Google.Protobuf.WellKnownTypes { if (Syntax != 0) { size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Syntax); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -1054,6 +1091,7 @@ namespace Google.Protobuf.WellKnownTypes { if (other.Syntax != 0) { Syntax = other.Syntax; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1062,7 +1100,7 @@ namespace Google.Protobuf.WellKnownTypes { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { Name = input.ReadString(); @@ -1098,6 +1136,7 @@ namespace Google.Protobuf.WellKnownTypes { /// public sealed partial class EnumValue : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new EnumValue()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -1123,6 +1162,7 @@ namespace Google.Protobuf.WellKnownTypes { name_ = other.name_; number_ = other.number_; options_ = other.options_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1187,7 +1227,7 @@ namespace Google.Protobuf.WellKnownTypes { if (Name != other.Name) return false; if (Number != other.Number) return false; if(!options_.Equals(other.options_)) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1196,6 +1236,9 @@ namespace Google.Protobuf.WellKnownTypes { if (Name.Length != 0) hash ^= Name.GetHashCode(); if (Number != 0) hash ^= Number.GetHashCode(); hash ^= options_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -1215,6 +1258,9 @@ namespace Google.Protobuf.WellKnownTypes { output.WriteInt32(Number); } options_.WriteTo(output, _repeated_options_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1227,6 +1273,9 @@ namespace Google.Protobuf.WellKnownTypes { size += 1 + pb::CodedOutputStream.ComputeInt32Size(Number); } size += options_.CalculateSize(_repeated_options_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -1242,6 +1291,7 @@ namespace Google.Protobuf.WellKnownTypes { Number = other.Number; } options_.Add(other.options_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1250,7 +1300,7 @@ namespace Google.Protobuf.WellKnownTypes { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { Name = input.ReadString(); @@ -1276,6 +1326,7 @@ namespace Google.Protobuf.WellKnownTypes { /// public sealed partial class Option : pb::IMessage