From 5a811ac6f9d92a6875a7a1e0f1cdb8058640cc62 Mon Sep 17 00:00:00 2001 From: Jie Luo Date: Mon, 27 Apr 2015 14:27:21 -0700 Subject: [PATCH] fix bug for Field Presence --- src/google/protobuf/compiler/csharp/csharp_enum_field.cc | 2 +- src/google/protobuf/compiler/csharp/csharp_primitive_field.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/google/protobuf/compiler/csharp/csharp_enum_field.cc b/src/google/protobuf/compiler/csharp/csharp_enum_field.cc index 1fbd1c6c3d..34d1c5c610 100644 --- a/src/google/protobuf/compiler/csharp/csharp_enum_field.cc +++ b/src/google/protobuf/compiler/csharp/csharp_enum_field.cc @@ -170,7 +170,7 @@ void EnumFieldGenerator::WriteHash(Writer* writer) { } else { writer->WriteLine("if ($0$ != $1$) {", property_name(), default_value()); } - writer->WriteLine(" hash ^= $1$_.GetHashCode();", name()); + writer->WriteLine(" hash ^= $0$_.GetHashCode();", name()); writer->WriteLine("}"); } void EnumFieldGenerator::WriteEquals(Writer* writer) { diff --git a/src/google/protobuf/compiler/csharp/csharp_primitive_field.cc b/src/google/protobuf/compiler/csharp/csharp_primitive_field.cc index 10e886ebd7..a193afdaf0 100644 --- a/src/google/protobuf/compiler/csharp/csharp_primitive_field.cc +++ b/src/google/protobuf/compiler/csharp/csharp_primitive_field.cc @@ -161,7 +161,7 @@ void PrimitiveFieldGenerator::WriteHash(Writer* writer) { } else { writer->WriteLine("if ($0$ != $1$) {", property_name(), default_value()); } - writer->WriteLine(" hash ^= $1$_.GetHashCode();", name()); + writer->WriteLine(" hash ^= $0$_.GetHashCode();", name()); writer->WriteLine("}"); } void PrimitiveFieldGenerator::WriteEquals(Writer* writer) {