diff options
author | Jie Luo <jieluo@google.com> | 2017-12-19 11:54:11 -0800 |
---|---|---|
committer | Jie Luo <jieluo@google.com> | 2017-12-19 15:38:02 -0800 |
commit | b308580bb1c3f87a062ac1448a3e0bdaab9d40cf (patch) | |
tree | ea211f27b3deb05a9ba5461079288020a11b5c8d /csharp/src/Google.Protobuf/WellKnownTypes/Any.cs | |
parent | 3a06fe1fc9590b534f403114a0668befba926947 (diff) | |
download | protobuf-b308580bb1c3f87a062ac1448a3e0bdaab9d40cf.tar.gz protobuf-b308580bb1c3f87a062ac1448a3e0bdaab9d40cf.tar.bz2 protobuf-b308580bb1c3f87a062ac1448a3e0bdaab9d40cf.zip |
Cherrypick for csharp, including:
Add preserve UnknownFields
Compare floating point values bitwise
Add auto-generated header to C# generated files
Diffstat (limited to 'csharp/src/Google.Protobuf/WellKnownTypes/Any.cs')
-rw-r--r-- | csharp/src/Google.Protobuf/WellKnownTypes/Any.cs | 22 |
1 files changed, 18 insertions, 4 deletions
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 +// <auto-generated> +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/protobuf/any.proto +// </auto-generated> #pragma warning disable 1591, 0612, 3021 #region Designer generated code @@ -119,6 +121,7 @@ namespace Google.Protobuf.WellKnownTypes { /// </summary> public sealed partial class Any : pb::IMessage<Any> { private static readonly pb::MessageParser<Any> _parser = new pb::MessageParser<Any>(() => new Any()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser<Any> 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(); |