aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/google/protobuf/compiler/csharp/csharp_message.cc
diff options
context:
space:
mode:
authorGravatar Jon Skeet <jonskeet@google.com>2015-06-25 12:08:18 +0100
committerGravatar Jon Skeet <jonskeet@google.com>2015-06-25 12:08:18 +0100
commitdf44ae4413109a7c3ce9f27fb7ae02f0414c29d9 (patch)
tree95554e77d4c4847a278fa645206be2054ca864c2 /src/google/protobuf/compiler/csharp/csharp_message.cc
parente36e601a394e96759a9ccf0eda97c0451c49c2cc (diff)
More map tests, and various production code improvements.
Generated code in next commit.
Diffstat (limited to 'src/google/protobuf/compiler/csharp/csharp_message.cc')
-rw-r--r--src/google/protobuf/compiler/csharp/csharp_message.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/google/protobuf/compiler/csharp/csharp_message.cc b/src/google/protobuf/compiler/csharp/csharp_message.cc
index 3cb91951..9e055f64 100644
--- a/src/google/protobuf/compiler/csharp/csharp_message.cc
+++ b/src/google/protobuf/compiler/csharp/csharp_message.cc
@@ -405,9 +405,10 @@ void MessageGenerator::GenerateFrameworkMethods(io::Printer* printer) {
"}\n\n");
// GetHashCode
+ // Start with a non-zero value to easily distinguish between null and "empty" messages.
printer->Print(
"public override int GetHashCode() {\n"
- " int hash = 0;\n");
+ " int hash = 17;\n");
printer->Indent();
for (int i = 0; i < descriptor_->field_count(); i++) {
scoped_ptr<FieldGeneratorBase> generator(