From 1acacf46ccd386de8ee660335b4b1a8dffb2967d Mon Sep 17 00:00:00 2001 From: Bo Yang Date: Fri, 1 Dec 2017 20:14:19 -0800 Subject: Fix memory leak when creating repeated field via array. --- php/ext/google/protobuf/type_check.c | 3 +-- php/tests/memory_leak_test.php | 5 +++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/php/ext/google/protobuf/type_check.c b/php/ext/google/protobuf/type_check.c index f588774c..50e0f8c1 100644 --- a/php/ext/google/protobuf/type_check.c +++ b/php/ext/google/protobuf/type_check.c @@ -461,8 +461,7 @@ void check_repeated_field(const zend_class_entry* klass, PHP_PROTO_LONG type, CACHED_PTR_TO_ZVAL_PTR((CACHED_VALUE*)memory) TSRMLS_CC); } - Z_DELREF_P(CACHED_TO_ZVAL_PTR(repeated_field)); - RETURN_ZVAL(CACHED_TO_ZVAL_PTR(repeated_field), 1, 0); + RETURN_ZVAL(CACHED_TO_ZVAL_PTR(repeated_field), 1, 1); } else if (Z_TYPE_P(val) == IS_OBJECT) { if (!instanceof_function(Z_OBJCE_P(val), repeated_field_type TSRMLS_CC)) { diff --git a/php/tests/memory_leak_test.php b/php/tests/memory_leak_test.php index b76c8bff..fa272b56 100644 --- a/php/tests/memory_leak_test.php +++ b/php/tests/memory_leak_test.php @@ -105,6 +105,11 @@ $m = new TestMessage(); $m->mergeFromString(hex2bin('F80601')); assert('F80601', bin2hex($m->serializeToString())); +// Test create repeated field via array. +$str_arr = array(); +$m = new TestMessage(); +$m->setRepeatedString($str_arr); + # $from = new TestMessage(); # $to = new TestMessage(); # TestUtil::setTestMessage($from); -- cgit v1.2.3 From b140cb3145f697a025d7b81b53a190d1e89b17dc Mon Sep 17 00:00:00 2001 From: Bo Yang Date: Mon, 4 Dec 2017 12:32:10 -0800 Subject: Fix memory leak when creating map field via array. --- php/ext/google/protobuf/type_check.c | 3 +-- php/tests/memory_leak_test.php | 5 +++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/php/ext/google/protobuf/type_check.c b/php/ext/google/protobuf/type_check.c index 50e0f8c1..37171426 100644 --- a/php/ext/google/protobuf/type_check.c +++ b/php/ext/google/protobuf/type_check.c @@ -534,8 +534,7 @@ void check_map_field(const zend_class_entry* klass, PHP_PROTO_LONG key_type, CACHED_PTR_TO_ZVAL_PTR((CACHED_VALUE*)value) TSRMLS_CC); } - Z_DELREF_P(CACHED_TO_ZVAL_PTR(map_field)); - RETURN_ZVAL(CACHED_TO_ZVAL_PTR(map_field), 1, 0); + RETURN_ZVAL(CACHED_TO_ZVAL_PTR(map_field), 1, 1); } else if (Z_TYPE_P(val) == IS_OBJECT) { if (!instanceof_function(Z_OBJCE_P(val), map_field_type TSRMLS_CC)) { zend_error(E_USER_ERROR, "Given value is not an instance of %s.", diff --git a/php/tests/memory_leak_test.php b/php/tests/memory_leak_test.php index fa272b56..772b466f 100644 --- a/php/tests/memory_leak_test.php +++ b/php/tests/memory_leak_test.php @@ -110,6 +110,11 @@ $str_arr = array(); $m = new TestMessage(); $m->setRepeatedString($str_arr); +// Test create map field via array. +$str_arr = array(); +$m = new TestMessage(); +$m->setMapStringString($str_arr); + # $from = new TestMessage(); # $to = new TestMessage(); # TestUtil::setTestMessage($from); -- cgit v1.2.3 From de44982a747519602409fcf7b0cceaf123bf1420 Mon Sep 17 00:00:00 2001 From: Paul Yang Date: Thu, 30 Nov 2017 12:21:00 -0800 Subject: Remove duplicate typedef. (#3975) --- php/ext/google/protobuf/protobuf.h | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/php/ext/google/protobuf/protobuf.h b/php/ext/google/protobuf/protobuf.h index 18343772..e2a67220 100644 --- a/php/ext/google/protobuf/protobuf.h +++ b/php/ext/google/protobuf/protobuf.h @@ -608,48 +608,36 @@ typedef struct Api Api; typedef struct BoolValue BoolValue; typedef struct BytesValue BytesValue; typedef struct Descriptor Descriptor; -typedef struct Descriptor Descriptor; typedef struct DescriptorPool DescriptorPool; typedef struct DoubleValue DoubleValue; typedef struct Duration Duration; -typedef struct Enum Enum; typedef struct EnumDescriptor EnumDescriptor; -typedef struct EnumDescriptor EnumDescriptor; -typedef struct EnumValue EnumValue; -typedef struct EnumValueDescriptor EnumValueDescriptor; +typedef struct Enum Enum; typedef struct EnumValueDescriptor EnumValueDescriptor; -typedef struct Field Field; -typedef struct FieldDescriptor FieldDescriptor; -typedef struct FieldDescriptor FieldDescriptor; -typedef struct FieldMask FieldMask; +typedef struct EnumValue EnumValue; typedef struct Field_Cardinality Field_Cardinality; +typedef struct FieldDescriptor FieldDescriptor; +typedef struct Field Field; typedef struct Field_Kind Field_Kind; +typedef struct FieldMask FieldMask; typedef struct FloatValue FloatValue; typedef struct GPBEmpty GPBEmpty; typedef struct Int32Value Int32Value; typedef struct Int64Value Int64Value; typedef struct InternalDescriptorPool InternalDescriptorPool; typedef struct ListValue ListValue; -typedef struct Map Map; -typedef struct Map Map; -typedef struct MapIter MapIter; typedef struct MapIter MapIter; +typedef struct Map Map; typedef struct MessageField MessageField; -typedef struct MessageField MessageField; -typedef struct MessageHeader MessageHeader; typedef struct MessageHeader MessageHeader; typedef struct MessageLayout MessageLayout; -typedef struct MessageLayout MessageLayout; typedef struct Method Method; typedef struct Mixin Mixin; typedef struct NullValue NullValue; typedef struct Oneof Oneof; -typedef struct Oneof Oneof; typedef struct Option Option; -typedef struct RepeatedField RepeatedField; -typedef struct RepeatedField RepeatedField; -typedef struct RepeatedFieldIter RepeatedFieldIter; typedef struct RepeatedFieldIter RepeatedFieldIter; +typedef struct RepeatedField RepeatedField; typedef struct SourceContext SourceContext; typedef struct StringValue StringValue; typedef struct Struct Struct; -- cgit v1.2.3 From e0d3aa057b89540cf83de6639a86d1ddb7199315 Mon Sep 17 00:00:00 2001 From: Bo Yang Date: Fri, 1 Dec 2017 20:14:19 -0800 Subject: Fix memory leak when creating repeated field via array. --- php/ext/google/protobuf/type_check.c | 3 +-- php/tests/memory_leak_test.php | 5 +++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/php/ext/google/protobuf/type_check.c b/php/ext/google/protobuf/type_check.c index f588774c..50e0f8c1 100644 --- a/php/ext/google/protobuf/type_check.c +++ b/php/ext/google/protobuf/type_check.c @@ -461,8 +461,7 @@ void check_repeated_field(const zend_class_entry* klass, PHP_PROTO_LONG type, CACHED_PTR_TO_ZVAL_PTR((CACHED_VALUE*)memory) TSRMLS_CC); } - Z_DELREF_P(CACHED_TO_ZVAL_PTR(repeated_field)); - RETURN_ZVAL(CACHED_TO_ZVAL_PTR(repeated_field), 1, 0); + RETURN_ZVAL(CACHED_TO_ZVAL_PTR(repeated_field), 1, 1); } else if (Z_TYPE_P(val) == IS_OBJECT) { if (!instanceof_function(Z_OBJCE_P(val), repeated_field_type TSRMLS_CC)) { diff --git a/php/tests/memory_leak_test.php b/php/tests/memory_leak_test.php index b76c8bff..fa272b56 100644 --- a/php/tests/memory_leak_test.php +++ b/php/tests/memory_leak_test.php @@ -105,6 +105,11 @@ $m = new TestMessage(); $m->mergeFromString(hex2bin('F80601')); assert('F80601', bin2hex($m->serializeToString())); +// Test create repeated field via array. +$str_arr = array(); +$m = new TestMessage(); +$m->setRepeatedString($str_arr); + # $from = new TestMessage(); # $to = new TestMessage(); # TestUtil::setTestMessage($from); -- cgit v1.2.3 From 7d3437152ad420d4382b883f0a52a86526166ef5 Mon Sep 17 00:00:00 2001 From: Bo Yang Date: Mon, 4 Dec 2017 12:32:10 -0800 Subject: Fix memory leak when creating map field via array. --- php/ext/google/protobuf/type_check.c | 3 +-- php/tests/memory_leak_test.php | 5 +++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/php/ext/google/protobuf/type_check.c b/php/ext/google/protobuf/type_check.c index 50e0f8c1..37171426 100644 --- a/php/ext/google/protobuf/type_check.c +++ b/php/ext/google/protobuf/type_check.c @@ -534,8 +534,7 @@ void check_map_field(const zend_class_entry* klass, PHP_PROTO_LONG key_type, CACHED_PTR_TO_ZVAL_PTR((CACHED_VALUE*)value) TSRMLS_CC); } - Z_DELREF_P(CACHED_TO_ZVAL_PTR(map_field)); - RETURN_ZVAL(CACHED_TO_ZVAL_PTR(map_field), 1, 0); + RETURN_ZVAL(CACHED_TO_ZVAL_PTR(map_field), 1, 1); } else if (Z_TYPE_P(val) == IS_OBJECT) { if (!instanceof_function(Z_OBJCE_P(val), map_field_type TSRMLS_CC)) { zend_error(E_USER_ERROR, "Given value is not an instance of %s.", diff --git a/php/tests/memory_leak_test.php b/php/tests/memory_leak_test.php index fa272b56..772b466f 100644 --- a/php/tests/memory_leak_test.php +++ b/php/tests/memory_leak_test.php @@ -110,6 +110,11 @@ $str_arr = array(); $m = new TestMessage(); $m->setRepeatedString($str_arr); +// Test create map field via array. +$str_arr = array(); +$m = new TestMessage(); +$m->setMapStringString($str_arr); + # $from = new TestMessage(); # $to = new TestMessage(); # TestUtil::setTestMessage($from); -- cgit v1.2.3 From 3b7a5f451546888ad96aaa143ef86fea904a03ec Mon Sep 17 00:00:00 2001 From: Bo Yang Date: Tue, 5 Dec 2017 16:44:19 -0800 Subject: Fix several more memory leak --- php/ext/google/protobuf/def.c | 1 + php/ext/google/protobuf/message.c | 8 ++++---- php/ext/google/protobuf/type_check.c | 1 + php/tests/memory_leak_test.php | 23 +++++++++++++++++++++-- 4 files changed, 27 insertions(+), 6 deletions(-) diff --git a/php/ext/google/protobuf/def.c b/php/ext/google/protobuf/def.c index 13f7cdd6..55291e23 100644 --- a/php/ext/google/protobuf/def.c +++ b/php/ext/google/protobuf/def.c @@ -249,6 +249,7 @@ PHP_METHOD(Descriptor, getField) { MAKE_STD_ZVAL(field_hashtable_value); ZVAL_OBJ(field_hashtable_value, field_descriptor_type->create_object( field_descriptor_type TSRMLS_CC)); + Z_DELREF_P(field_hashtable_value); #else field_hashtable_value = field_descriptor_type->create_object(field_descriptor_type TSRMLS_CC); diff --git a/php/ext/google/protobuf/message.c b/php/ext/google/protobuf/message.c index 3fce2c17..b11c7215 100644 --- a/php/ext/google/protobuf/message.c +++ b/php/ext/google/protobuf/message.c @@ -374,7 +374,7 @@ PHP_METHOD(Message, whichOneof) { LOWER_FIELD) \ PHP_METHOD(UPPER_CLASS, get##UPPER_FIELD) { \ zval member; \ - PHP_PROTO_ZVAL_STRING(&member, LOWER_FIELD, 1); \ + PHP_PROTO_ZVAL_STRING(&member, LOWER_FIELD, 0); \ PHP_PROTO_FAKE_SCOPE_BEGIN(LOWER_CLASS##_type); \ zval* value = message_get_property_internal(getThis(), &member TSRMLS_CC); \ PHP_PROTO_FAKE_SCOPE_END; \ @@ -387,7 +387,7 @@ PHP_METHOD(Message, whichOneof) { return; \ } \ zval member; \ - PHP_PROTO_ZVAL_STRING(&member, LOWER_FIELD, 1); \ + PHP_PROTO_ZVAL_STRING(&member, LOWER_FIELD, 0); \ message_set_property_internal(getThis(), &member, value TSRMLS_CC); \ PHP_PROTO_RETVAL_ZVAL(getThis()); \ } @@ -396,7 +396,7 @@ PHP_METHOD(Message, whichOneof) { LOWER_FIELD) \ PHP_METHOD(UPPER_CLASS, get##UPPER_FIELD) { \ zval member; \ - PHP_PROTO_ZVAL_STRING(&member, LOWER_FIELD, 1); \ + PHP_PROTO_ZVAL_STRING(&member, LOWER_FIELD, 0); \ PHP_PROTO_FAKE_SCOPE_BEGIN(LOWER_CLASS##_type); \ message_get_oneof_property_internal(getThis(), &member, \ return_value TSRMLS_CC); \ @@ -409,7 +409,7 @@ PHP_METHOD(Message, whichOneof) { return; \ } \ zval member; \ - PHP_PROTO_ZVAL_STRING(&member, LOWER_FIELD, 1); \ + PHP_PROTO_ZVAL_STRING(&member, LOWER_FIELD, 0); \ message_set_property_internal(getThis(), &member, value TSRMLS_CC); \ PHP_PROTO_RETVAL_ZVAL(getThis()); \ } diff --git a/php/ext/google/protobuf/type_check.c b/php/ext/google/protobuf/type_check.c index 37171426..85f5051e 100644 --- a/php/ext/google/protobuf/type_check.c +++ b/php/ext/google/protobuf/type_check.c @@ -532,6 +532,7 @@ void check_map_field(const zend_class_entry* klass, PHP_PROTO_LONG key_type, map_field_handlers->write_dimension( CACHED_TO_ZVAL_PTR(map_field), &key, CACHED_PTR_TO_ZVAL_PTR((CACHED_VALUE*)value) TSRMLS_CC); + zval_dtor(&key); } RETURN_ZVAL(CACHED_TO_ZVAL_PTR(map_field), 1, 1); diff --git a/php/tests/memory_leak_test.php b/php/tests/memory_leak_test.php index 772b466f..29ca7787 100644 --- a/php/tests/memory_leak_test.php +++ b/php/tests/memory_leak_test.php @@ -106,15 +106,34 @@ $m->mergeFromString(hex2bin('F80601')); assert('F80601', bin2hex($m->serializeToString())); // Test create repeated field via array. -$str_arr = array(); +$str_arr = array("abc"); $m = new TestMessage(); $m->setRepeatedString($str_arr); // Test create map field via array. -$str_arr = array(); +$str_arr = array("abc"=>"abc"); $m = new TestMessage(); $m->setMapStringString($str_arr); +// Test unset +$from = new TestMessage(); +TestUtil::setTestMessage($from); +unset($from); + +// Test wellknown +$from = new \Google\Protobuf\Timestamp(); +$from->setSeconds(1); +assert(1, $from->getSeconds()); + +$from = new \Google\Protobuf\Value(); +$from->setNumberValue(1); +assert(1, $from->getNumberValue()); + +// Test descriptor +$pool = \Google\Protobuf\DescriptorPool::getGeneratedPool(); +$desc = $pool->getDescriptorByClassName("\Foo\TestMessage"); +$field = $desc->getField(1); + # $from = new TestMessage(); # $to = new TestMessage(); # TestUtil::setTestMessage($from); -- cgit v1.2.3 From 212563d756d50a70272d42d7f8b6374ce5a86317 Mon Sep 17 00:00:00 2001 From: Bo Yang Date: Tue, 5 Dec 2017 18:29:51 -0800 Subject: Fix memory leak in php7 --- php/ext/google/protobuf/def.c | 1 + php/ext/google/protobuf/message.c | 12 ++++++++---- php/tests/memory_leak_test.php | 3 ++- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/php/ext/google/protobuf/def.c b/php/ext/google/protobuf/def.c index 55291e23..8140fe47 100644 --- a/php/ext/google/protobuf/def.c +++ b/php/ext/google/protobuf/def.c @@ -253,6 +253,7 @@ PHP_METHOD(Descriptor, getField) { #else field_hashtable_value = field_descriptor_type->create_object(field_descriptor_type TSRMLS_CC); + --GC_REFCOUNT(field_hashtable_value); #endif FieldDescriptor *field_php = UNBOX_HASHTABLE_VALUE(FieldDescriptor, field_hashtable_value); diff --git a/php/ext/google/protobuf/message.c b/php/ext/google/protobuf/message.c index b11c7215..cf75d979 100644 --- a/php/ext/google/protobuf/message.c +++ b/php/ext/google/protobuf/message.c @@ -374,10 +374,11 @@ PHP_METHOD(Message, whichOneof) { LOWER_FIELD) \ PHP_METHOD(UPPER_CLASS, get##UPPER_FIELD) { \ zval member; \ - PHP_PROTO_ZVAL_STRING(&member, LOWER_FIELD, 0); \ + PHP_PROTO_ZVAL_STRING(&member, LOWER_FIELD, 1); \ PHP_PROTO_FAKE_SCOPE_BEGIN(LOWER_CLASS##_type); \ zval* value = message_get_property_internal(getThis(), &member TSRMLS_CC); \ PHP_PROTO_FAKE_SCOPE_END; \ + zval_dtor(&member); \ PHP_PROTO_RETVAL_ZVAL(value); \ } \ PHP_METHOD(UPPER_CLASS, set##UPPER_FIELD) { \ @@ -387,8 +388,9 @@ PHP_METHOD(Message, whichOneof) { return; \ } \ zval member; \ - PHP_PROTO_ZVAL_STRING(&member, LOWER_FIELD, 0); \ + PHP_PROTO_ZVAL_STRING(&member, LOWER_FIELD, 1); \ message_set_property_internal(getThis(), &member, value TSRMLS_CC); \ + zval_dtor(&member); \ PHP_PROTO_RETVAL_ZVAL(getThis()); \ } @@ -396,11 +398,12 @@ PHP_METHOD(Message, whichOneof) { LOWER_FIELD) \ PHP_METHOD(UPPER_CLASS, get##UPPER_FIELD) { \ zval member; \ - PHP_PROTO_ZVAL_STRING(&member, LOWER_FIELD, 0); \ + PHP_PROTO_ZVAL_STRING(&member, LOWER_FIELD, 1); \ PHP_PROTO_FAKE_SCOPE_BEGIN(LOWER_CLASS##_type); \ message_get_oneof_property_internal(getThis(), &member, \ return_value TSRMLS_CC); \ PHP_PROTO_FAKE_SCOPE_END; \ + zval_dtor(&member); \ } \ PHP_METHOD(UPPER_CLASS, set##UPPER_FIELD) { \ zval* value = NULL; \ @@ -409,8 +412,9 @@ PHP_METHOD(Message, whichOneof) { return; \ } \ zval member; \ - PHP_PROTO_ZVAL_STRING(&member, LOWER_FIELD, 0); \ + PHP_PROTO_ZVAL_STRING(&member, LOWER_FIELD, 1); \ message_set_property_internal(getThis(), &member, value TSRMLS_CC); \ + zval_dtor(&member); \ PHP_PROTO_RETVAL_ZVAL(getThis()); \ } diff --git a/php/tests/memory_leak_test.php b/php/tests/memory_leak_test.php index 29ca7787..8ea84f68 100644 --- a/php/tests/memory_leak_test.php +++ b/php/tests/memory_leak_test.php @@ -50,7 +50,8 @@ $to->mergeFromString($data); TestUtil::assertTestMessage($to); -$from->setRecursive($from); +// TODO(teboring): This causes following tests fail in php7. +# $from->setRecursive($from); $arr = new RepeatedField(GPBType::MESSAGE, TestMessage::class); $arr[] = new TestMessage; -- cgit v1.2.3 From ba60b854b6da0494e91b81edc7b91ef3ddf219c9 Mon Sep 17 00:00:00 2001 From: Bo Yang Date: Wed, 6 Dec 2017 10:46:57 -0800 Subject: Update php c extension version number to 3.5.0.1 --- php/ext/google/protobuf/package.xml | 6 +++--- php/ext/google/protobuf/protobuf.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/php/ext/google/protobuf/package.xml b/php/ext/google/protobuf/package.xml index 4a473801..07641b4e 100644 --- a/php/ext/google/protobuf/package.xml +++ b/php/ext/google/protobuf/package.xml @@ -10,11 +10,11 @@ protobuf-opensource@google.com yes - 2017-09-14 + 2017-12-06 - 3.4.1 - 3.4.1 + 3.5.0.1 + 3.5.0.1 stable diff --git a/php/ext/google/protobuf/protobuf.h b/php/ext/google/protobuf/protobuf.h index e2a67220..8289eb2b 100644 --- a/php/ext/google/protobuf/protobuf.h +++ b/php/ext/google/protobuf/protobuf.h @@ -37,7 +37,7 @@ #include "upb.h" #define PHP_PROTOBUF_EXTNAME "protobuf" -#define PHP_PROTOBUF_VERSION "3.4.1" +#define PHP_PROTOBUF_VERSION "3.5.0.1" #define MAX_LENGTH_OF_INT64 20 #define SIZEOF_INT64 8 -- cgit v1.2.3 From 457f6a607ce167132b833c049b0eaf3a9c4b3f5f Mon Sep 17 00:00:00 2001 From: Bo Yang Date: Wed, 6 Dec 2017 10:54:11 -0800 Subject: Add release log --- php/ext/google/protobuf/package.xml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/php/ext/google/protobuf/package.xml b/php/ext/google/protobuf/package.xml index 07641b4e..0107ebc2 100644 --- a/php/ext/google/protobuf/package.xml +++ b/php/ext/google/protobuf/package.xml @@ -165,6 +165,22 @@ GA release. 3-Clause BSD License +GA release. + + + + + 3.5.0.1 + 3.5.0.1 + + + stable + stable + + 2017-12-06 + + 3-Clause BSD License + GA release. -- cgit v1.2.3 From 953a0253fc1bd69ae788bbcb672c4cdfe562b8cd Mon Sep 17 00:00:00 2001 From: Laszlo Csomor Date: Thu, 30 Nov 2017 11:20:11 +0100 Subject: io_win32_unittest: make //:win32_test run again Do not use "googletest.h", apprently that leads to linking errors on Windows which I couldn't figure out how to solve, and decided to just go with plain gTest instead. See https://github.com/google/protobuf/issues/3951 --- src/google/protobuf/stubs/io_win32_unittest.cc | 78 ++++++++++---------------- 1 file changed, 29 insertions(+), 49 deletions(-) diff --git a/src/google/protobuf/stubs/io_win32_unittest.cc b/src/google/protobuf/stubs/io_win32_unittest.cc index ce6f7162..a5c7dbfd 100644 --- a/src/google/protobuf/stubs/io_win32_unittest.cc +++ b/src/google/protobuf/stubs/io_win32_unittest.cc @@ -48,7 +48,6 @@ #include #include -#include #include #include @@ -89,62 +88,43 @@ void StripTrailingSlashes(string* str) { for (; i >= 0 && ((*str)[i] == '/' || (*str)[i] == '\\'); --i) {} str->resize(i+1); } -} // namespace -void IoWin32Test::SetUp() { - test_tmpdir = string(TestTempDir()); - wtest_tmpdir.clear(); - if (test_tmpdir.empty()) { - const char* test_tmpdir_env = getenv("TEST_TMPDIR"); - if (test_tmpdir_env != NULL && *test_tmpdir_env) { - test_tmpdir = string(test_tmpdir_env); - } +bool GetEnvVar(const char* name, string* result) { + DWORD size = ::GetEnvironmentVariableA(name, NULL, 0); + if (size > 0 && GetLastError() != ERROR_ENVVAR_NOT_FOUND) { + scoped_array str(new char[size]); + ::GetEnvironmentVariableA(name, str.get(), size); + result->assign(str.get()); + return true; + } else { + return false; + } +} - // Only Bazel defines TEST_TMPDIR, CMake does not, so look for other - // suitable environment variables. - if (test_tmpdir.empty()) { - static const char* names[] = {"TEMP", "TMP"}; - for (int i = 0; i < sizeof(names)/sizeof(names[0]); ++i) { - const char* name = names[i]; - test_tmpdir_env = getenv(name); - if (test_tmpdir_env != NULL && *test_tmpdir_env) { - test_tmpdir = string(test_tmpdir_env); - break; - } - } - } +} // namespace - // No other temp directory was found. Use the current director - if (test_tmpdir.empty()) { - char buffer[MAX_PATH]; - // Use GetCurrentDirectoryA instead of GetCurrentDirectoryW, because the - // current working directory must always be shorter than MAX_PATH, even - // with - // "\\?\" prefix (except on Windows 10 version 1607 and beyond, after - // opting in to long paths by default [1]). - // - // [1] https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx#maxpath - DWORD result = ::GetCurrentDirectoryA(MAX_PATH, buffer); - if (result > 0) { - test_tmpdir = string(buffer); - } else { - // Using assertions in SetUp/TearDown seems to confuse the test - // framework, so just leave the member variables empty in case of - // failure. - GOOGLE_CHECK_OK(false); - return; - } - } +void IoWin32Test::SetUp() { + string tmp; + bool ok = false; + if (!ok) { + ok = GetEnvVar("TEST_TMPDIR", &tmp); + } + if (!ok) { + ok = GetEnvVar("TEMP", &tmp); + } + if (!ok) { + ok = GetEnvVar("TMP", &tmp); + } + if (!ok || tmp.empty()) { + FAIL(); } - StripTrailingSlashes(&test_tmpdir); - test_tmpdir += "\\io_win32_unittest.tmp"; - // CreateDirectoryA's limit is 248 chars, see MSDN. - // https://msdn.microsoft.com/en-us/library/windows/desktop/aa363855(v=vs.85).aspx + StripTrailingSlashes(&tmp); + test_tmpdir = tmp + "\\io_win32_unittest.tmp"; wtest_tmpdir = testonly_path_to_winpath(test_tmpdir); if (!DeleteAllUnder(wtest_tmpdir) || !CreateAllUnder(wtest_tmpdir)) { - GOOGLE_CHECK_OK(false); + FAIL(); test_tmpdir.clear(); wtest_tmpdir.clear(); } -- cgit v1.2.3 From 65da9fd97f67a9499771b6294cf017248ece5661 Mon Sep 17 00:00:00 2001 From: Laszlo Csomor Date: Thu, 30 Nov 2017 14:12:24 +0100 Subject: io_win32: support non-ASCII paths Fixes https://github.com/google/protobuf/issues/3951 --- src/google/protobuf/stubs/io_win32.cc | 157 ++++++++++++++++--------- src/google/protobuf/stubs/io_win32.h | 18 ++- src/google/protobuf/stubs/io_win32_unittest.cc | 90 +++++++++----- 3 files changed, 176 insertions(+), 89 deletions(-) diff --git a/src/google/protobuf/stubs/io_win32.cc b/src/google/protobuf/stubs/io_win32.cc index fa2cb8b1..b5af494a 100644 --- a/src/google/protobuf/stubs/io_win32.cc +++ b/src/google/protobuf/stubs/io_win32.cc @@ -30,10 +30,11 @@ // Author: laszlocsomor@google.com (Laszlo Csomor) // -// Implementation for long-path-aware open/mkdir/etc. on Windows. +// Implementation for long-path-aware open/mkdir/access/etc. on Windows, as well +// as for the supporting utility functions. // // These functions convert the input path to an absolute Windows path -// with "\\?\" prefix if necessary, then pass that to _wopen/_wmkdir/etc. +// with "\\?\" prefix, then pass that to _wopen/_wmkdir/_waccess/etc. // (declared in ) respectively. This allows working with files/directories // whose paths are longer than MAX_PATH (260 chars). // @@ -59,7 +60,6 @@ #include #include -#include #include #include #include @@ -89,6 +89,11 @@ struct CharTraits { static bool is_alpha(wchar_t ch) { return iswalpha(ch); } }; +template +bool null_or_empty(const char_type* s) { + return s == nullptr || *s == 0; +} + // Returns true if the path starts with a drive letter, e.g. "c:". // Note that this won't check for the "\" after the drive letter, so this also // returns true for "c:foo" (which is "c:\${PWD}\foo"). @@ -121,16 +126,7 @@ bool is_drive_relative(const char_type* path) { return has_drive_letter(path) && (path[2] == 0 || !is_separator(path[2])); } -template -void replace_directory_separators(char_type* p) { - for (; *p; ++p) { - if (*p == '/') { - *p = '\\'; - } - } -} - -string join_paths(const string& path1, const string& path2) { +wstring join_paths(const wstring& path1, const wstring& path2) { if (path1.empty() || is_path_absolute(path2.c_str()) || has_longpath_prefix(path2.c_str())) { return path2; @@ -144,23 +140,23 @@ string join_paths(const string& path1, const string& path2) { : (path1 + path2); } else { return is_separator(path2[0]) ? (path1 + path2) - : (path1 + '\\' + path2); + : (path1 + L'\\' + path2); } } -string normalize(string path) { +wstring normalize(wstring path) { if (has_longpath_prefix(path.c_str())) { path = path.substr(4); } - static const string dot("."); - static const string dotdot(".."); + static const wstring dot(L"."); + static const wstring dotdot(L".."); - std::vector segments; + std::vector segments; int segment_start = -1; // Find the path segments in `path` (separated by "/"). for (int i = 0;; ++i) { - if (!is_separator(path[i]) && path[i] != '\0') { + if (!is_separator(path[i]) && path[i] != L'\0') { // The current character does not end a segment, so start one unless it's // already started. if (segment_start < 0) { @@ -169,7 +165,7 @@ string normalize(string path) { } else if (segment_start >= 0 && i > segment_start) { // The current character is "/" or "\0", so this ends a segment. // Add that to `segments` if there's anything to add; handle "." and "..". - string segment(path, segment_start, i - segment_start); + wstring segment(path, segment_start, i - segment_start); segment_start = -1; if (segment == dotdot) { if (!segments.empty() && @@ -180,7 +176,7 @@ string normalize(string path) { segments.push_back(segment); } } - if (path[i] == '\0') { + if (path[i] == L'\0') { break; } } @@ -189,64 +185,58 @@ string normalize(string path) { // form of it, e.g. "c:\.."). if (segments.size() == 1 && segments[0].size() == 2 && has_drive_letter(segments[0].c_str())) { - return segments[0] + '\\'; + return segments[0] + L'\\'; } // Join all segments. bool first = true; - std::ostringstream result; + std::wstringstream result; for (int i = 0; i < segments.size(); ++i) { if (!first) { - result << '\\'; + result << L'\\'; } first = false; result << segments[i]; } // Preserve trailing separator if the input contained it. if (!path.empty() && is_separator(path[path.size() - 1])) { - result << '\\'; + result << L'\\'; } return result.str(); } -WCHAR* as_wstring(const string& s) { - int len = ::MultiByteToWideChar(CP_UTF8, 0, s.c_str(), s.size(), NULL, 0); - WCHAR* result = new WCHAR[len + 1]; - ::MultiByteToWideChar(CP_UTF8, 0, s.c_str(), s.size(), result, len + 1); - result[len] = 0; - return result; -} - -void as_wchar_path(const string& path, wstring* wchar_path) { - scoped_array wbuf(as_wstring(path)); - replace_directory_separators(wbuf.get()); - wchar_path->assign(wbuf.get()); -} - -bool as_windows_path(const string& path, wstring* result) { - if (path.empty()) { +bool as_windows_path(const char* path, wstring* result) { + if (null_or_empty(path)) { result->clear(); return true; } - if (is_separator(path[0]) || is_drive_relative(path.c_str())) { + if (is_separator(path[0]) || is_drive_relative(path)) { + return false; + } + + wstring wpath; + if (!strings::utf8_to_wcs(path, &wpath)) { return false; } - string mutable_path = path; - if (!is_path_absolute(mutable_path.c_str()) && - !has_longpath_prefix(mutable_path.c_str())) { - char cwd[MAX_PATH]; - ::GetCurrentDirectoryA(MAX_PATH, cwd); - mutable_path = join_paths(cwd, mutable_path); + if (!is_path_absolute(wpath.c_str()) && !has_longpath_prefix(wpath.c_str())) { + int size = ::GetCurrentDirectoryW(0, NULL); + if (size == 0 && GetLastError() != ERROR_INSUFFICIENT_BUFFER) { + return false; + } + scoped_array wcwd(new WCHAR[size]); + ::GetCurrentDirectoryW(size, wcwd.get()); + wpath = join_paths(wcwd.get(), wpath); } - as_wchar_path(normalize(mutable_path), result); - if (!has_longpath_prefix(result->c_str())) { + wpath = normalize(wpath); + if (!has_longpath_prefix(wpath.c_str())) { // Add the "\\?\" prefix unconditionally. This way we prevent the Win32 API // from processing the path and "helpfully" removing trailing dots from the // path, for example. // See https://github.com/bazelbuild/bazel/issues/2935 - *result = wstring(L"\\\\?\\") + *result; + wpath = wstring(L"\\\\?\\") + wpath; } + *result = wpath; return true; } @@ -319,13 +309,21 @@ int stat(const char* path, struct _stat* buffer) { FILE* fopen(const char* path, const char* mode) { #ifdef SUPPORT_LONGPATHS + if (null_or_empty(path)) { + errno = EINVAL; + return NULL; + } wstring wpath; if (!as_windows_path(path, &wpath)) { errno = ENOENT; return NULL; } - scoped_array wmode(as_wstring(mode)); - return ::_wfopen(wpath.c_str(), wmode.get()); + wstring wmode; + if (!strings::utf8_to_wcs(mode, &wmode)) { + errno = EINVAL; + return NULL; + } + return ::_wfopen(wpath.c_str(), wmode.c_str()); #else return ::fopen(path, mode); #endif @@ -347,16 +345,61 @@ int write(int fd, const void* buffer, size_t size) { return ::_write(fd, buffer, size); } -wstring testonly_path_to_winpath(const string& path) { +wstring testonly_utf8_to_winpath(const char* path) { wstring wpath; - as_windows_path(path, &wpath); - return wpath; + return as_windows_path(path, &wpath) ? wpath : wstring(); +} + +namespace strings { + +bool wcs_to_mbs(const WCHAR* s, string* out, bool outUtf8) { + if (null_or_empty(s)) { + out->clear(); + return true; + } + BOOL usedDefaultChar = FALSE; + SetLastError(0); + int size = WideCharToMultiByte( + outUtf8 ? CP_UTF8 : CP_ACP, 0, s, -1, NULL, 0, NULL, + outUtf8 ? NULL : &usedDefaultChar); + if ((size == 0 && GetLastError() != ERROR_INSUFFICIENT_BUFFER) + || usedDefaultChar) { + return false; + } + scoped_array astr(new CHAR[size]); + WideCharToMultiByte( + outUtf8 ? CP_UTF8 : CP_ACP, 0, s, -1, astr.get(), size, NULL, NULL); + out->assign(astr.get()); + return true; +} + +bool mbs_to_wcs(const char* s, wstring* out, bool inUtf8) { + if (null_or_empty(s)) { + out->clear(); + return true; + } + + SetLastError(0); + int size = + MultiByteToWideChar(inUtf8 ? CP_UTF8 : CP_ACP, 0, s, -1, NULL, 0); + if (size == 0 && GetLastError() != ERROR_INSUFFICIENT_BUFFER) { + return false; + } + scoped_array wstr(new WCHAR[size]); + MultiByteToWideChar( + inUtf8 ? CP_UTF8 : CP_ACP, 0, s, -1, wstr.get(), size + 1); + out->assign(wstr.get()); + return true; } +bool utf8_to_wcs(const char* input, wstring* out) { + return mbs_to_wcs(input, out, true); +} + +} // namespace strings } // namespace win32 } // namespace internal } // namespace protobuf } // namespace google #endif // defined(_WIN32) - diff --git a/src/google/protobuf/stubs/io_win32.h b/src/google/protobuf/stubs/io_win32.h index 53160089..60d0ceb6 100644 --- a/src/google/protobuf/stubs/io_win32.h +++ b/src/google/protobuf/stubs/io_win32.h @@ -69,8 +69,22 @@ LIBPROTOBUF_EXPORT int read(int fd, void* buffer, size_t size); LIBPROTOBUF_EXPORT int setmode(int fd, int mode); LIBPROTOBUF_EXPORT int stat(const char* path, struct _stat* buffer); LIBPROTOBUF_EXPORT int write(int fd, const void* buffer, size_t size); -LIBPROTOBUF_EXPORT std::wstring testonly_path_to_winpath( - const std::string& path); +LIBPROTOBUF_EXPORT std::wstring testonly_utf8_to_winpath(const char* path); + +namespace strings { + +// Convert from UTF-16 to Active-Code-Page-encoded or to UTF-8-encoded text. +LIBPROTOBUF_EXPORT bool wcs_to_mbs( + const wchar_t* s, std::string* out, bool outUtf8); + +// Convert from Active-Code-Page-encoded or UTF-8-encoded text to UTF-16. +LIBPROTOBUF_EXPORT bool mbs_to_wcs( + const char* s, std::wstring* out, bool inUtf8); + +// Convert from UTF-8-encoded text to UTF-16. +LIBPROTOBUF_EXPORT bool utf8_to_wcs(const char* input, std::wstring* out); + +} // namespace strings } // namespace win32 } // namespace internal diff --git a/src/google/protobuf/stubs/io_win32_unittest.cc b/src/google/protobuf/stubs/io_win32_unittest.cc index a5c7dbfd..e88b7554 100644 --- a/src/google/protobuf/stubs/io_win32_unittest.cc +++ b/src/google/protobuf/stubs/io_win32_unittest.cc @@ -30,7 +30,8 @@ // Author: laszlocsomor@google.com (Laszlo Csomor) // -// Unit tests for long-path-aware open/mkdir/access on Windows. +// Unit tests for long-path-aware open/mkdir/access/etc. on Windows, as well as +// for the supporting utility functions. // // This file is only used on Windows, it's empty on other platforms. @@ -89,13 +90,17 @@ void StripTrailingSlashes(string* str) { str->resize(i+1); } -bool GetEnvVar(const char* name, string* result) { - DWORD size = ::GetEnvironmentVariableA(name, NULL, 0); +bool GetEnvVarAsUtf8(const WCHAR* name, string* result) { + DWORD size = ::GetEnvironmentVariableW(name, NULL, 0); if (size > 0 && GetLastError() != ERROR_ENVVAR_NOT_FOUND) { - scoped_array str(new char[size]); - ::GetEnvironmentVariableA(name, str.get(), size); - result->assign(str.get()); - return true; + scoped_array wcs(new WCHAR[size]); + ::GetEnvironmentVariableW(name, wcs.get(), size); + // GetEnvironmentVariableA retrieves an Active-Code-Page-encoded text which + // we'd first need to convert to UTF-16 then to UTF-8, because there seems + // to be no API function to do that conversion directly. + // GetEnvironmentVariableW retrieves an UTF-16-encoded text, which we need + // to convert to UTF-8. + return strings::wcs_to_mbs(wcs.get(), result, true); } else { return false; } @@ -104,30 +109,30 @@ bool GetEnvVar(const char* name, string* result) { } // namespace void IoWin32Test::SetUp() { + test_tmpdir.clear(); + wtest_tmpdir.clear(); + string tmp; bool ok = false; if (!ok) { - ok = GetEnvVar("TEST_TMPDIR", &tmp); + ok = GetEnvVarAsUtf8(L"TEST_TMPDIR", &tmp); } if (!ok) { - ok = GetEnvVar("TEMP", &tmp); + ok = GetEnvVarAsUtf8(L"TEMP", &tmp); } if (!ok) { - ok = GetEnvVar("TMP", &tmp); + ok = GetEnvVarAsUtf8(L"TMP", &tmp); } if (!ok || tmp.empty()) { FAIL(); } - StripTrailingSlashes(&tmp); test_tmpdir = tmp + "\\io_win32_unittest.tmp"; - wtest_tmpdir = testonly_path_to_winpath(test_tmpdir); - if (!DeleteAllUnder(wtest_tmpdir) || !CreateAllUnder(wtest_tmpdir)) { - FAIL(); - test_tmpdir.clear(); - wtest_tmpdir.clear(); - } + wtest_tmpdir = testonly_utf8_to_winpath(test_tmpdir.c_str()); + ASSERT_FALSE(wtest_tmpdir.empty()); + ASSERT_TRUE(DeleteAllUnder(wtest_tmpdir)); + ASSERT_TRUE(CreateAllUnder(wtest_tmpdir)); } void IoWin32Test::TearDown() { @@ -171,8 +176,8 @@ bool IoWin32Test::DeleteAllUnder(wstring path) { path = wstring(L"\\\\?\\") + path; } // Append "\" if necessary. - if (path[path.size() - 1] != '\\') { - path.push_back('\\'); + if (path[path.size() - 1] != L'\\') { + path.push_back(L'\\'); } WIN32_FIND_DATAW metadata; @@ -290,12 +295,12 @@ TEST_F(IoWin32Test, MkdirTest) { } TEST_F(IoWin32Test, ChdirTest) { - char owd[MAX_PATH]; - EXPECT_GT(::GetCurrentDirectoryA(MAX_PATH, owd), 0); + WCHAR owd[MAX_PATH]; + EXPECT_GT(::GetCurrentDirectoryW(MAX_PATH, owd), 0); string path("C:\\"); EXPECT_EQ(access(path.c_str(), F_OK), 0); ASSERT_EQ(chdir(path.c_str()), 0); - EXPECT_TRUE(::SetCurrentDirectoryA(owd)); + EXPECT_TRUE(::SetCurrentDirectoryW(owd)); // Do not try to chdir into the test_tmpdir, it may already contain directory // names with trailing dots. @@ -316,11 +321,11 @@ TEST_F(IoWin32Test, AsWindowsPathTest) { EXPECT_GT(GetCurrentDirectoryW(size, cwd_str.get()), 0); wstring cwd = wstring(L"\\\\?\\") + cwd_str.get(); - ASSERT_EQ(testonly_path_to_winpath("relative_mkdirtest"), + ASSERT_EQ(testonly_utf8_to_winpath("relative_mkdirtest"), cwd + L"\\relative_mkdirtest"); - ASSERT_EQ(testonly_path_to_winpath("preserve//\\trailing///"), + ASSERT_EQ(testonly_utf8_to_winpath("preserve//\\trailing///"), cwd + L"\\preserve\\trailing\\"); - ASSERT_EQ(testonly_path_to_winpath("./normalize_me\\/../blah"), + ASSERT_EQ(testonly_utf8_to_winpath("./normalize_me\\/../blah"), cwd + L"\\blah"); std::ostringstream relpath; for (wchar_t* p = cwd_str.get(); *p; ++p) { @@ -329,18 +334,43 @@ TEST_F(IoWin32Test, AsWindowsPathTest) { } } relpath << ".\\/../\\./beyond-toplevel"; - ASSERT_EQ(testonly_path_to_winpath(relpath.str()), + ASSERT_EQ(testonly_utf8_to_winpath(relpath.str().c_str()), wstring(L"\\\\?\\") + cwd_str.get()[0] + L":\\beyond-toplevel"); // Absolute unix paths lack drive letters, driveless absolute windows paths // do too. Neither can be converted to a drive-specifying absolute Windows // path. - ASSERT_EQ(testonly_path_to_winpath("/absolute/unix/path"), L""); + ASSERT_EQ(testonly_utf8_to_winpath("/absolute/unix/path"), L""); // Though valid on Windows, we also don't support UNC paths (\\UNC\\blah). - ASSERT_EQ(testonly_path_to_winpath("\\driveless\\absolute"), L""); + ASSERT_EQ(testonly_utf8_to_winpath("\\driveless\\absolute"), L""); // Though valid in cmd.exe, drive-relative paths are not supported. - ASSERT_EQ(testonly_path_to_winpath("c:foo"), L""); - ASSERT_EQ(testonly_path_to_winpath("c:/foo"), L"\\\\?\\c:\\foo"); + ASSERT_EQ(testonly_utf8_to_winpath("c:foo"), L""); + ASSERT_EQ(testonly_utf8_to_winpath("c:/foo"), L"\\\\?\\c:\\foo"); +} + +TEST_F(IoWin32Test, Utf8ToUtf16Test) { + const char hi_utf8[] = { + 'h', 'i', ' ', + // utf-8: 11010000 10011111, utf-16: 100 0001 1111 = 0x041F + 0xd0, 0x9f, + // utf-8: 11010001 10000000, utf-16: 100 0100 0000 = 0x0440 + 0xd1, 0x80, + // utf-8: 11010000 10111000, utf-16: 100 0011 1000 = 0x0438 + 0xd0, 0xb8, + // utf-8: 11010000 10110010, utf-16: 100 0011 0010 = 0x0432 + 0xd0, 0xb2, + // utf-8: 11010000 10110101, utf-16: 100 0011 0101 = 0x0435 + 0xd0, 0xb5, + // utf-8: 11010001 10000010, utf-16: 100 0100 0010 = 0x0442 + 0xd1, 0x82, 0 + }; + const wchar_t hi_utf16[] = { + L'h', L'i', L' ', 0x041f, 0x0440, 0x0438, 0x0432, 0x0435, 0x0442, 0 + }; + + wstring wcs; + ASSERT_TRUE(strings::utf8_to_wcs(hi_utf8, &wcs)); + ASSERT_EQ(wcs, hi_utf16); } } // namespace -- cgit v1.2.3 From 57a01c7fbe89ca540e32a02c1f46b9e0478b3a8f Mon Sep 17 00:00:00 2001 From: Laszlo Csomor Date: Thu, 30 Nov 2017 17:32:11 +0100 Subject: io_win32: add more encoding-related tests --- src/google/protobuf/stubs/io_win32.cc | 18 +++-- src/google/protobuf/stubs/io_win32.h | 3 + src/google/protobuf/stubs/io_win32_unittest.cc | 99 +++++++++++++++++++------- 3 files changed, 89 insertions(+), 31 deletions(-) diff --git a/src/google/protobuf/stubs/io_win32.cc b/src/google/protobuf/stubs/io_win32.cc index b5af494a..ad2d2d26 100644 --- a/src/google/protobuf/stubs/io_win32.cc +++ b/src/google/protobuf/stubs/io_win32.cc @@ -210,16 +210,20 @@ bool as_windows_path(const char* path, wstring* result) { result->clear(); return true; } - if (is_separator(path[0]) || is_drive_relative(path)) { - return false; - } - wstring wpath; if (!strings::utf8_to_wcs(path, &wpath)) { return false; } + if (has_longpath_prefix(wpath.c_str())) { + *result = wpath; + return true; + } + if (is_separator(path[0]) || is_drive_relative(path)) { + return false; + } - if (!is_path_absolute(wpath.c_str()) && !has_longpath_prefix(wpath.c_str())) { + + if (!is_path_absolute(wpath.c_str())) { int size = ::GetCurrentDirectoryW(0, NULL); if (size == 0 && GetLastError() != ERROR_INSUFFICIENT_BUFFER) { return false; @@ -396,6 +400,10 @@ bool utf8_to_wcs(const char* input, wstring* out) { return mbs_to_wcs(input, out, true); } +bool wcs_to_utf8(const wchar_t* input, string* out) { + return wcs_to_mbs(input, out, true); +} + } // namespace strings } // namespace win32 } // namespace internal diff --git a/src/google/protobuf/stubs/io_win32.h b/src/google/protobuf/stubs/io_win32.h index 60d0ceb6..9e17d253 100644 --- a/src/google/protobuf/stubs/io_win32.h +++ b/src/google/protobuf/stubs/io_win32.h @@ -84,6 +84,9 @@ LIBPROTOBUF_EXPORT bool mbs_to_wcs( // Convert from UTF-8-encoded text to UTF-16. LIBPROTOBUF_EXPORT bool utf8_to_wcs(const char* input, std::wstring* out); +// Convert from UTF-16-encoded text to UTF-8. +LIBPROTOBUF_EXPORT bool wcs_to_utf8(const wchar_t* input, std::string* out); + } // namespace strings } // namespace win32 diff --git a/src/google/protobuf/stubs/io_win32_unittest.cc b/src/google/protobuf/stubs/io_win32_unittest.cc index e88b7554..7a331872 100644 --- a/src/google/protobuf/stubs/io_win32_unittest.cc +++ b/src/google/protobuf/stubs/io_win32_unittest.cc @@ -61,6 +61,27 @@ namespace internal { namespace win32 { namespace { +const char kUtf8Text[] = { + 'h', 'i', ' ', + // utf-8: 11010000 10011111, utf-16: 100 0001 1111 = 0x041F + 0xd0, 0x9f, + // utf-8: 11010001 10000000, utf-16: 100 0100 0000 = 0x0440 + 0xd1, 0x80, + // utf-8: 11010000 10111000, utf-16: 100 0011 1000 = 0x0438 + 0xd0, 0xb8, + // utf-8: 11010000 10110010, utf-16: 100 0011 0010 = 0x0432 + 0xd0, 0xb2, + // utf-8: 11010000 10110101, utf-16: 100 0011 0101 = 0x0435 + 0xd0, 0xb5, + // utf-8: 11010001 10000010, utf-16: 100 0100 0010 = 0x0442 + 0xd1, 0x82, 0 +}; + +const wchar_t kUtf16Text[] = { + L'h', L'i', L' ', + L'\x41f', L'\x440', L'\x438', L'\x432', L'\x435', L'\x442', 0 +}; + using std::string; using std::wstring; @@ -73,6 +94,7 @@ class IoWin32Test : public ::testing::Test { bool CreateAllUnder(wstring path); bool DeleteAllUnder(wstring path); + WCHAR working_directory[MAX_PATH]; string test_tmpdir; wstring wtest_tmpdir; }; @@ -111,6 +133,7 @@ bool GetEnvVarAsUtf8(const WCHAR* name, string* result) { void IoWin32Test::SetUp() { test_tmpdir.clear(); wtest_tmpdir.clear(); + EXPECT_GT(::GetCurrentDirectoryW(MAX_PATH, working_directory), 0); string tmp; bool ok = false; @@ -128,7 +151,14 @@ void IoWin32Test::SetUp() { } StripTrailingSlashes(&tmp); - test_tmpdir = tmp + "\\io_win32_unittest.tmp"; + std::stringstream result; + // Deleting files and directories is asynchronous on Windows, and if TearDown + // just deleted the previous temp directory, sometimes we cannot recreate the + // same directory. + // Use a counter so every test method gets its own temp directory. + static int counter = 0; + result << tmp << "\\io_win32_test" << counter++ << ".tmp"; + test_tmpdir = result.str(); wtest_tmpdir = testonly_utf8_to_winpath(test_tmpdir.c_str()); ASSERT_FALSE(wtest_tmpdir.empty()); ASSERT_TRUE(DeleteAllUnder(wtest_tmpdir)); @@ -139,6 +169,7 @@ void IoWin32Test::TearDown() { if (!wtest_tmpdir.empty()) { DeleteAllUnder(wtest_tmpdir); } + ::SetCurrentDirectoryW(working_directory); } bool IoWin32Test::CreateAllUnder(wstring path) { @@ -294,13 +325,24 @@ TEST_F(IoWin32Test, MkdirTest) { ASSERT_EQ(errno, ENOENT); } +TEST_F(IoWin32Test, MkdirTestNonAscii) { + ASSERT_INITIALIZED; + + // Create a non-ASCII path. + // Ensure that we can create the directory using SetCurrentDirectoryW. + EXPECT_TRUE(CreateDirectoryW((wtest_tmpdir + L"\\1").c_str(), NULL)); + EXPECT_TRUE(CreateDirectoryW((wtest_tmpdir + L"\\1\\" + kUtf16Text).c_str(), NULL)); + // Ensure that we can create a very similarly named directory using mkdir. + // We don't attemp to delete and recreate the same directory, because on + // Windows, deleting files and directories seems to be asynchronous. + EXPECT_EQ(mkdir((test_tmpdir + "\\2").c_str(), 0644), 0); + EXPECT_EQ(mkdir((test_tmpdir + "\\2\\" + kUtf8Text).c_str(), 0644), 0); +} + TEST_F(IoWin32Test, ChdirTest) { - WCHAR owd[MAX_PATH]; - EXPECT_GT(::GetCurrentDirectoryW(MAX_PATH, owd), 0); string path("C:\\"); EXPECT_EQ(access(path.c_str(), F_OK), 0); ASSERT_EQ(chdir(path.c_str()), 0); - EXPECT_TRUE(::SetCurrentDirectoryW(owd)); // Do not try to chdir into the test_tmpdir, it may already contain directory // names with trailing dots. @@ -315,6 +357,26 @@ TEST_F(IoWin32Test, ChdirTest) { ASSERT_NE(chdir(path.c_str()), 0); } +TEST_F(IoWin32Test, ChdirTestNonAscii) { + ASSERT_INITIALIZED; + + // Create a directory with a non-ASCII path and ensure we can cd into it. + wstring wNonAscii(wtest_tmpdir + L"\\" + kUtf16Text); + string nonAscii; + EXPECT_TRUE(strings::wcs_to_utf8(wNonAscii.c_str(), &nonAscii)); + EXPECT_TRUE(CreateDirectoryW(wNonAscii.c_str(), NULL)); + WCHAR cwd[MAX_PATH]; + EXPECT_TRUE(GetCurrentDirectoryW(MAX_PATH, cwd)); + // Ensure that we can cd into the path using SetCurrentDirectoryW. + EXPECT_TRUE(SetCurrentDirectoryW(wNonAscii.c_str())); + EXPECT_TRUE(SetCurrentDirectoryW(cwd)); + // Ensure that we can cd into the path using chdir. + ASSERT_EQ(chdir(nonAscii.c_str()), 0); + // Ensure that the GetCurrentDirectoryW returns the desired path. + EXPECT_TRUE(GetCurrentDirectoryW(MAX_PATH, cwd)); + ASSERT_EQ(wNonAscii, cwd); +} + TEST_F(IoWin32Test, AsWindowsPathTest) { DWORD size = GetCurrentDirectoryW(0, NULL); scoped_array cwd_str(new wchar_t[size]); @@ -346,31 +408,16 @@ TEST_F(IoWin32Test, AsWindowsPathTest) { // Though valid in cmd.exe, drive-relative paths are not supported. ASSERT_EQ(testonly_utf8_to_winpath("c:foo"), L""); ASSERT_EQ(testonly_utf8_to_winpath("c:/foo"), L"\\\\?\\c:\\foo"); + ASSERT_EQ(testonly_utf8_to_winpath("\\\\?\\C:\\foo"), L"\\\\?\\C:\\foo"); } -TEST_F(IoWin32Test, Utf8ToUtf16Test) { - const char hi_utf8[] = { - 'h', 'i', ' ', - // utf-8: 11010000 10011111, utf-16: 100 0001 1111 = 0x041F - 0xd0, 0x9f, - // utf-8: 11010001 10000000, utf-16: 100 0100 0000 = 0x0440 - 0xd1, 0x80, - // utf-8: 11010000 10111000, utf-16: 100 0011 1000 = 0x0438 - 0xd0, 0xb8, - // utf-8: 11010000 10110010, utf-16: 100 0011 0010 = 0x0432 - 0xd0, 0xb2, - // utf-8: 11010000 10110101, utf-16: 100 0011 0101 = 0x0435 - 0xd0, 0xb5, - // utf-8: 11010001 10000010, utf-16: 100 0100 0010 = 0x0442 - 0xd1, 0x82, 0 - }; - const wchar_t hi_utf16[] = { - L'h', L'i', L' ', 0x041f, 0x0440, 0x0438, 0x0432, 0x0435, 0x0442, 0 - }; - +TEST_F(IoWin32Test, Utf8Utf16ConversionTest) { + string mbs; wstring wcs; - ASSERT_TRUE(strings::utf8_to_wcs(hi_utf8, &wcs)); - ASSERT_EQ(wcs, hi_utf16); + ASSERT_TRUE(strings::utf8_to_wcs(kUtf8Text, &wcs)); + ASSERT_TRUE(strings::wcs_to_utf8(kUtf16Text, &mbs)); + ASSERT_EQ(wcs, kUtf16Text); + ASSERT_EQ(mbs, kUtf8Text); } } // namespace -- cgit v1.2.3 From 3f1b1a6da5f1a778ccad46b6f340e82ad4c99209 Mon Sep 17 00:00:00 2001 From: Laszlo Csomor Date: Fri, 1 Dec 2017 10:29:34 +0100 Subject: io_win32_unittest: use CWD as last tempdir If the test cannot find a temp directory by checking environment variables, it will fall back to using the current working directory as the temp directory root. This is what the test used to do as of commit https://github.com/google/protobuf/commit/6de51caed52d798815954646b230c5aef3e4d2fc and what was then changed by commit https://github.com/google/protobuf/pull/3978/commits/792d098769d8e000d8d474c8ffd201d2eabc2134 --- src/google/protobuf/stubs/io_win32_unittest.cc | 29 +++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/src/google/protobuf/stubs/io_win32_unittest.cc b/src/google/protobuf/stubs/io_win32_unittest.cc index 7a331872..d277ad6e 100644 --- a/src/google/protobuf/stubs/io_win32_unittest.cc +++ b/src/google/protobuf/stubs/io_win32_unittest.cc @@ -128,6 +128,22 @@ bool GetEnvVarAsUtf8(const WCHAR* name, string* result) { } } +bool GetCwdAsUtf8(string* result) { + DWORD size = ::GetCurrentDirectoryW(0, NULL); + if (size == 0 && GetLastError() == ERROR_INSUFFICIENT_BUFFER) { + scoped_array wcs(new WCHAR[size]); + ::GetCurrentDirectoryW(size, wcs.get()); + // GetCurrentDirectoryA retrieves an Active-Code-Page-encoded text which + // we'd first need to convert to UTF-16 then to UTF-8, because there seems + // to be no API function to do that conversion directly. + // GetCurrentDirectoryW retrieves an UTF-16-encoded text, which we need + // to convert to UTF-8. + return strings::wcs_to_mbs(wcs.get(), result, true); + } else { + return false; + } +} + } // namespace void IoWin32Test::SetUp() { @@ -138,16 +154,23 @@ void IoWin32Test::SetUp() { string tmp; bool ok = false; if (!ok) { + // Bazel sets this environment variable when it runs tests. ok = GetEnvVarAsUtf8(L"TEST_TMPDIR", &tmp); } if (!ok) { + // Bazel 0.8.0 sets this environment for every build and test action. ok = GetEnvVarAsUtf8(L"TEMP", &tmp); } if (!ok) { + // Bazel 0.8.0 sets this environment for every build and test action. ok = GetEnvVarAsUtf8(L"TMP", &tmp); } + if (!ok) { + // Fall back to using the current directory. + ok = GetCwdAsUtf8(&tmp); + } if (!ok || tmp.empty()) { - FAIL(); + FAIL() << "Cannot find a temp directory."; } StripTrailingSlashes(&tmp); @@ -156,8 +179,8 @@ void IoWin32Test::SetUp() { // just deleted the previous temp directory, sometimes we cannot recreate the // same directory. // Use a counter so every test method gets its own temp directory. - static int counter = 0; - result << tmp << "\\io_win32_test" << counter++ << ".tmp"; + static unsigned int counter = 0; + result << tmp << "\\w32tst" << counter++ << ".tmp"; test_tmpdir = result.str(); wtest_tmpdir = testonly_utf8_to_winpath(test_tmpdir.c_str()); ASSERT_FALSE(wtest_tmpdir.empty()); -- cgit v1.2.3 From eb3bd6ec297b4dff3734c51a159713e559f5c2cf Mon Sep 17 00:00:00 2001 From: Laszlo Csomor Date: Fri, 1 Dec 2017 11:09:34 +0100 Subject: io_win32_unittest: fix condition in GetCwdAsUtf8 --- src/google/protobuf/stubs/io_win32_unittest.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/google/protobuf/stubs/io_win32_unittest.cc b/src/google/protobuf/stubs/io_win32_unittest.cc index d277ad6e..710548a2 100644 --- a/src/google/protobuf/stubs/io_win32_unittest.cc +++ b/src/google/protobuf/stubs/io_win32_unittest.cc @@ -130,7 +130,7 @@ bool GetEnvVarAsUtf8(const WCHAR* name, string* result) { bool GetCwdAsUtf8(string* result) { DWORD size = ::GetCurrentDirectoryW(0, NULL); - if (size == 0 && GetLastError() == ERROR_INSUFFICIENT_BUFFER) { + if (size > 0 && GetLastError() == ERROR_INSUFFICIENT_BUFFER) { scoped_array wcs(new WCHAR[size]); ::GetCurrentDirectoryW(size, wcs.get()); // GetCurrentDirectoryA retrieves an Active-Code-Page-encoded text which -- cgit v1.2.3 From a3a1c93fb4bb204fd42cb91ac1053f93bec4da7a Mon Sep 17 00:00:00 2001 From: Laszlo Csomor Date: Fri, 1 Dec 2017 11:31:12 +0100 Subject: io_win32_unittest: remove incorrect error check Unlike GetEnvironmentVariableW, GetCurrentDirectoryW doesn't set ERROR_INSUFFICIENT_BUFFER. --- src/google/protobuf/stubs/io_win32_unittest.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/google/protobuf/stubs/io_win32_unittest.cc b/src/google/protobuf/stubs/io_win32_unittest.cc index 710548a2..b216aece 100644 --- a/src/google/protobuf/stubs/io_win32_unittest.cc +++ b/src/google/protobuf/stubs/io_win32_unittest.cc @@ -122,7 +122,7 @@ bool GetEnvVarAsUtf8(const WCHAR* name, string* result) { // to be no API function to do that conversion directly. // GetEnvironmentVariableW retrieves an UTF-16-encoded text, which we need // to convert to UTF-8. - return strings::wcs_to_mbs(wcs.get(), result, true); + return strings::wcs_to_utf8(wcs.get(), result); } else { return false; } @@ -130,7 +130,7 @@ bool GetEnvVarAsUtf8(const WCHAR* name, string* result) { bool GetCwdAsUtf8(string* result) { DWORD size = ::GetCurrentDirectoryW(0, NULL); - if (size > 0 && GetLastError() == ERROR_INSUFFICIENT_BUFFER) { + if (size > 0) { scoped_array wcs(new WCHAR[size]); ::GetCurrentDirectoryW(size, wcs.get()); // GetCurrentDirectoryA retrieves an Active-Code-Page-encoded text which @@ -138,7 +138,7 @@ bool GetCwdAsUtf8(string* result) { // to be no API function to do that conversion directly. // GetCurrentDirectoryW retrieves an UTF-16-encoded text, which we need // to convert to UTF-8. - return strings::wcs_to_mbs(wcs.get(), result, true); + return strings::wcs_to_utf8(wcs.get(), result); } else { return false; } -- cgit v1.2.3 From c370f88fb18eecc33650ec3ce06f7bdcc11d1596 Mon Sep 17 00:00:00 2001 From: Paul Yang Date: Thu, 7 Dec 2017 11:16:47 -0800 Subject: Recursively clear unknown fields in submessages. (#3982) * Recursively clear unknown fields in submessages. * Recursively discard unknown fields in submsg for c extension * Fix zts build * Add comment for tests * Add a TODO to add a util for encoding varint for better readability. * Add test for oneof message field. --- php/ext/google/protobuf/encode_decode.c | 95 +++++++++++++++++++++++++++- php/src/Google/Protobuf/Internal/Message.php | 28 ++++++++ php/tests/encode_decode_test.php | 40 +++++++++++- 3 files changed, 159 insertions(+), 4 deletions(-) diff --git a/php/ext/google/protobuf/encode_decode.c b/php/ext/google/protobuf/encode_decode.c index ae5a61f5..b98121bb 100644 --- a/php/ext/google/protobuf/encode_decode.c +++ b/php/ext/google/protobuf/encode_decode.c @@ -1402,7 +1402,6 @@ static void putarray(zval* array, const upb_fielddef* f, upb_sink* sink, RepeatedField* intern = UNBOX(RepeatedField, array); HashTable *ht = PHP_PROTO_HASH_OF(intern->array); size = zend_hash_num_elements(ht); - // size = zend_hash_num_elements(PHP_PROTO_HASH_OF(intern->array)); if (size == 0) return; upb_sink_startseq(sink, getsel(f, UPB_HANDLER_STARTSEQ), &subsink); @@ -1615,11 +1614,101 @@ PHP_METHOD(Message, mergeFromJsonString) { } } -PHP_METHOD(Message, discardUnknownFields) { - MessageHeader* msg = UNBOX(MessageHeader, getThis()); +// TODO(teboring): refactoring with putrawmsg +static void discard_unknown_fields(MessageHeader* msg) { + upb_msg_field_iter it; + stringsink* unknown = DEREF(message_data(msg), 0, stringsink*); if (unknown != NULL) { stringsink_uninit(unknown); DEREF(message_data(msg), 0, stringsink*) = NULL; } + + // Recursively discard unknown fields of submessages. + Descriptor* desc = msg->descriptor; + TSRMLS_FETCH(); + for (upb_msg_field_begin(&it, desc->msgdef); + !upb_msg_field_done(&it); + upb_msg_field_next(&it)) { + upb_fielddef* f = upb_msg_iter_field(&it); + uint32_t offset = desc->layout->fields[upb_fielddef_index(f)].offset; + bool containing_oneof = false; + + if (upb_fielddef_containingoneof(f)) { + uint32_t oneof_case_offset = + desc->layout->fields[upb_fielddef_index(f)].case_offset; + // For a oneof, check that this field is actually present -- skip all the + // below if not. + if (DEREF(message_data(msg), oneof_case_offset, uint32_t) != + upb_fielddef_number(f)) { + continue; + } + // Otherwise, fall through to the appropriate singular-field handler + // below. + containing_oneof = true; + } + + if (is_map_field(f)) { + MapIter map_it; + int len, size; + const upb_fielddef* value_field; + + value_field = map_field_value(f); + if (!upb_fielddef_issubmsg(value_field)) continue; + + zval* map_php = CACHED_PTR_TO_ZVAL_PTR( + DEREF(message_data(msg), offset, CACHED_VALUE*)); + if (map_php == NULL) continue; + + Map* intern = UNBOX(Map, map_php); + for (map_begin(map_php, &map_it TSRMLS_CC); + !map_done(&map_it); map_next(&map_it)) { + upb_value value = map_iter_value(&map_it, &len); + void* memory = raw_value(upb_value_memory(&value), value_field); +#if PHP_MAJOR_VERSION < 7 + MessageHeader *submsg = UNBOX(MessageHeader, *(zval**)memory); +#else + MessageHeader *submsg = + (MessageHeader*)((char*)(Z_OBJ_P((zval*)memory)) - + XtOffsetOf(MessageHeader, std)); +#endif + discard_unknown_fields(submsg); + } + } else if (upb_fielddef_isseq(f)) { + if (!upb_fielddef_issubmsg(f)) continue; + + zval* array_php = CACHED_PTR_TO_ZVAL_PTR( + DEREF(message_data(msg), offset, CACHED_VALUE*)); + if (array_php == NULL) continue; + + int size, i; + RepeatedField* intern = UNBOX(RepeatedField, array_php); + HashTable *ht = PHP_PROTO_HASH_OF(intern->array); + size = zend_hash_num_elements(ht); + if (size == 0) continue; + + for (i = 0; i < size; i++) { + void* memory = repeated_field_index_native(intern, i TSRMLS_CC); +#if PHP_MAJOR_VERSION < 7 + MessageHeader *submsg = UNBOX(MessageHeader, *(zval**)memory); +#else + MessageHeader *submsg = + (MessageHeader*)((char*)(Z_OBJ_P((zval*)memory)) - + XtOffsetOf(MessageHeader, std)); +#endif + discard_unknown_fields(submsg); + } + } else if (upb_fielddef_issubmsg(f)) { + zval* submsg_php = CACHED_PTR_TO_ZVAL_PTR( + DEREF(message_data(msg), offset, CACHED_VALUE*)); + if (Z_TYPE_P(submsg_php) == IS_NULL) continue; + MessageHeader* submsg = UNBOX(MessageHeader, submsg_php); + discard_unknown_fields(submsg); + } + } +} + +PHP_METHOD(Message, discardUnknownFields) { + MessageHeader* msg = UNBOX(MessageHeader, getThis()); + discard_unknown_fields(msg); } diff --git a/php/src/Google/Protobuf/Internal/Message.php b/php/src/Google/Protobuf/Internal/Message.php index 26d20575..93e81c01 100644 --- a/php/src/Google/Protobuf/Internal/Message.php +++ b/php/src/Google/Protobuf/Internal/Message.php @@ -583,6 +583,34 @@ class Message public function discardUnknownFields() { $this->unknown = ""; + foreach ($this->desc->getField() as $field) { + if ($field->getType() != GPBType::MESSAGE) { + continue; + } + if ($field->isMap()) { + $value_field = $field->getMessageType()->getFieldByNumber(2); + if ($value_field->getType() != GPBType::MESSAGE) { + continue; + } + $getter = $field->getGetter(); + $map = $this->$getter(); + foreach ($map as $key => $value) { + $value->discardUnknownFields(); + } + } else if ($field->getLabel() === GPBLabel::REPEATED) { + $getter = $field->getGetter(); + $arr = $this->$getter(); + foreach ($arr as $sub) { + $sub->discardUnknownFields(); + } + } else if ($field->getLabel() === GPBLabel::OPTIONAL) { + $getter = $field->getGetter(); + $sub = $this->$getter(); + if (!is_null($sub)) { + $sub->discardUnknownFields(); + } + } + } } /** diff --git a/php/tests/encode_decode_test.php b/php/tests/encode_decode_test.php index 4512c871..74d5526d 100644 --- a/php/tests/encode_decode_test.php +++ b/php/tests/encode_decode_test.php @@ -443,36 +443,74 @@ class EncodeDecodeTest extends TestBase public function testUnknown() { + // Test preserve unknown for varint. $m = new TestMessage(); - $from = hex2bin('F80601'); + $from = hex2bin('F80601'); // TODO(teboring): Add a util to encode + // varint for better readability $m->mergeFromString($from); $to = $m->serializeToString(); $this->assertSame(bin2hex($from), bin2hex($to)); + // Test preserve unknown for 64-bit. $m = new TestMessage(); $from = hex2bin('F9060000000000000000'); $m->mergeFromString($from); $to = $m->serializeToString(); $this->assertSame(bin2hex($from), bin2hex($to)); + // Test preserve unknown for length delimited. $m = new TestMessage(); $from = hex2bin('FA0600'); $m->mergeFromString($from); $to = $m->serializeToString(); $this->assertSame(bin2hex($from), bin2hex($to)); + // Test preserve unknown for 32-bit. $m = new TestMessage(); $from = hex2bin('FD0600000000'); $m->mergeFromString($from); $to = $m->serializeToString(); $this->assertSame(bin2hex($from), bin2hex($to)); + // Test discard unknown in message. $m = new TestMessage(); $from = hex2bin('F80601'); $m->mergeFromString($from); $m->discardUnknownFields(); $to = $m->serializeToString(); $this->assertSame("", bin2hex($to)); + + // Test discard unknown for singular message field. + $m = new TestMessage(); + $from = hex2bin('8A0103F80601'); + $m->mergeFromString($from); + $m->discardUnknownFields(); + $to = $m->serializeToString(); + $this->assertSame("8a0100", bin2hex($to)); + + // Test discard unknown for repeated message field. + $m = new TestMessage(); + $from = hex2bin('FA0203F80601'); + $m->mergeFromString($from); + $m->discardUnknownFields(); + $to = $m->serializeToString(); + $this->assertSame("fa0200", bin2hex($to)); + + // Test discard unknown for map message value field. + $m = new TestMessage(); + $from = hex2bin("BA050708011203F80601"); + $m->mergeFromString($from); + $m->discardUnknownFields(); + $to = $m->serializeToString(); + $this->assertSame("ba050408011200", bin2hex($to)); + + // Test discard unknown for singular message field. + $m = new TestMessage(); + $from = hex2bin('9A0403F80601'); + $m->mergeFromString($from); + $m->discardUnknownFields(); + $to = $m->serializeToString(); + $this->assertSame("9a0400", bin2hex($to)); } public function testJsonEncode() -- cgit v1.2.3 From 0e7b58956684c7c2fc228eff9173ea2ae50de911 Mon Sep 17 00:00:00 2001 From: Paul Yang Date: Thu, 7 Dec 2017 14:18:38 -0800 Subject: Add discard unknown API in ruby. (#3990) * Add discard unknown API in ruby. * Add test for oneof message field. * Add TestUnknown to represent unknown field data clearly. * Only serialize the message with unknown fields itself in test. * Move discard_unknown from Message to Google.Protobuf --- Makefile.am | 1 + ruby/ext/google/protobuf_c/encode_decode.c | 88 ++++++++++++++++++++++++++++++ ruby/ext/google/protobuf_c/protobuf.c | 2 + ruby/ext/google/protobuf_c/protobuf.h | 1 + ruby/tests/encode_decode_test.rb | 63 +++++++++++++++++++++ ruby/tests/generated_code.proto | 13 +++++ 6 files changed, 168 insertions(+) create mode 100644 ruby/tests/encode_decode_test.rb diff --git a/Makefile.am b/Makefile.am index cd1cfc3e..cba02e3d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -907,6 +907,7 @@ ruby_EXTRA_DIST= \ ruby/src/main/java/google/ProtobufJavaService.java \ ruby/src/main/sentinel.proto \ ruby/tests/basic.rb \ + ruby/tests/encode_decode_test.rb \ ruby/tests/gc_test.rb \ ruby/tests/repeated_field_test.rb \ ruby/tests/stress.rb \ diff --git a/ruby/ext/google/protobuf_c/encode_decode.c b/ruby/ext/google/protobuf_c/encode_decode.c index d1b6e89e..12080d03 100644 --- a/ruby/ext/google/protobuf_c/encode_decode.c +++ b/ruby/ext/google/protobuf_c/encode_decode.c @@ -1305,3 +1305,91 @@ VALUE Message_encode_json(int argc, VALUE* argv, VALUE klass) { } } +static void discard_unknown(VALUE msg_rb, const Descriptor* desc) { + MessageHeader* msg; + upb_msg_field_iter it; + + TypedData_Get_Struct(msg_rb, MessageHeader, &Message_type, msg); + + stringsink* unknown = msg->unknown_fields; + if (unknown != NULL) { + stringsink_uninit(unknown); + msg->unknown_fields = NULL; + } + + for (upb_msg_field_begin(&it, desc->msgdef); + !upb_msg_field_done(&it); + upb_msg_field_next(&it)) { + upb_fielddef *f = upb_msg_iter_field(&it); + uint32_t offset = + desc->layout->fields[upb_fielddef_index(f)].offset + + sizeof(MessageHeader); + + if (upb_fielddef_containingoneof(f)) { + uint32_t oneof_case_offset = + desc->layout->fields[upb_fielddef_index(f)].case_offset + + sizeof(MessageHeader); + // For a oneof, check that this field is actually present -- skip all the + // below if not. + if (DEREF(msg, oneof_case_offset, uint32_t) != + upb_fielddef_number(f)) { + continue; + } + // Otherwise, fall through to the appropriate singular-field handler + // below. + } + + if (!upb_fielddef_issubmsg(f)) { + continue; + } + + if (is_map_field(f)) { + if (!upb_fielddef_issubmsg(map_field_value(f))) continue; + VALUE map = DEREF(msg, offset, VALUE); + if (map == Qnil) continue; + Map_iter map_it; + for (Map_begin(map, &map_it); !Map_done(&map_it); Map_next(&map_it)) { + VALUE submsg = Map_iter_value(&map_it); + VALUE descriptor = rb_ivar_get(submsg, descriptor_instancevar_interned); + const Descriptor* subdesc = ruby_to_Descriptor(descriptor); + discard_unknown(submsg, subdesc); + } + } else if (upb_fielddef_isseq(f)) { + VALUE ary = DEREF(msg, offset, VALUE); + if (ary == Qnil) continue; + int size = NUM2INT(RepeatedField_length(ary)); + for (int i = 0; i < size; i++) { + void* memory = RepeatedField_index_native(ary, i); + VALUE submsg = *((VALUE *)memory); + VALUE descriptor = rb_ivar_get(submsg, descriptor_instancevar_interned); + const Descriptor* subdesc = ruby_to_Descriptor(descriptor); + discard_unknown(submsg, subdesc); + } + } else { + VALUE submsg = DEREF(msg, offset, VALUE); + if (submsg == Qnil) continue; + VALUE descriptor = rb_ivar_get(submsg, descriptor_instancevar_interned); + const Descriptor* subdesc = ruby_to_Descriptor(descriptor); + discard_unknown(submsg, subdesc); + } + } +} + +/* + * call-seq: + * Google::Protobuf.discard_unknown(msg) + * + * Discard unknown fields in the given message object and recursively discard + * unknown fields in submessages. + */ +VALUE Google_Protobuf_discard_unknown(VALUE self, VALUE msg_rb) { + VALUE klass = CLASS_OF(msg_rb); + VALUE descriptor = rb_ivar_get(klass, descriptor_instancevar_interned); + Descriptor* desc = ruby_to_Descriptor(descriptor); + if (klass == cRepeatedField || klass == cMap) { + rb_raise(rb_eArgError, "Expected proto msg for discard unknown."); + } else { + discard_unknown(msg_rb, desc); + } + return Qnil; +} diff --git a/ruby/ext/google/protobuf_c/protobuf.c b/ruby/ext/google/protobuf_c/protobuf.c index c7750c44..db696426 100644 --- a/ruby/ext/google/protobuf_c/protobuf.c +++ b/ruby/ext/google/protobuf_c/protobuf.c @@ -103,6 +103,8 @@ void Init_protobuf_c() { cError = rb_const_get(protobuf, rb_intern("Error")); cParseError = rb_const_get(protobuf, rb_intern("ParseError")); + rb_define_singleton_method(protobuf, "discard_unknown", + Google_Protobuf_discard_unknown, 1); rb_define_singleton_method(protobuf, "deep_copy", Google_Protobuf_deep_copy, 1); diff --git a/ruby/ext/google/protobuf_c/protobuf.h b/ruby/ext/google/protobuf_c/protobuf.h index 1291ac59..5266aa8d 100644 --- a/ruby/ext/google/protobuf_c/protobuf.h +++ b/ruby/ext/google/protobuf_c/protobuf.h @@ -515,6 +515,7 @@ VALUE Message_encode(VALUE klass, VALUE msg_rb); VALUE Message_decode_json(VALUE klass, VALUE data); VALUE Message_encode_json(int argc, VALUE* argv, VALUE klass); +VALUE Google_Protobuf_discard_unknown(VALUE self, VALUE msg_rb); VALUE Google_Protobuf_deep_copy(VALUE self, VALUE obj); VALUE build_module_from_enumdesc(EnumDescriptor* enumdef); diff --git a/ruby/tests/encode_decode_test.rb b/ruby/tests/encode_decode_test.rb new file mode 100644 index 00000000..09581ab0 --- /dev/null +++ b/ruby/tests/encode_decode_test.rb @@ -0,0 +1,63 @@ +#!/usr/bin/ruby + +# generated_code.rb is in the same directory as this test. +$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__))) + +require 'generated_code_pb' +require 'test/unit' + +def hex2bin(s) + s.scan(/../).map { |x| x.hex.chr }.join +end + +class EncodeDecodeTest < Test::Unit::TestCase + def test_discard_unknown + # Test discard unknown in message. + unknown_msg = A::B::C::TestUnknown.new(:unknown_field => 1) + from = A::B::C::TestUnknown.encode(unknown_msg) + m = A::B::C::TestMessage.decode(from) + Google::Protobuf.discard_unknown(m) + to = A::B::C::TestMessage.encode(m) + assert_equal '', to + + # Test discard unknown for singular message field. + unknown_msg = A::B::C::TestUnknown.new( + :optional_unknown => + A::B::C::TestUnknown.new(:unknown_field => 1)) + from = A::B::C::TestUnknown.encode(unknown_msg) + m = A::B::C::TestMessage.decode(from) + Google::Protobuf.discard_unknown(m) + to = A::B::C::TestMessage.encode(m.optional_msg) + assert_equal '', to + + # Test discard unknown for repeated message field. + unknown_msg = A::B::C::TestUnknown.new( + :repeated_unknown => + [A::B::C::TestUnknown.new(:unknown_field => 1)]) + from = A::B::C::TestUnknown.encode(unknown_msg) + m = A::B::C::TestMessage.decode(from) + Google::Protobuf.discard_unknown(m) + to = A::B::C::TestMessage.encode(m.repeated_msg[0]) + assert_equal '', to + + # Test discard unknown for map value message field. + unknown_msg = A::B::C::TestUnknown.new( + :map_unknown => + {"" => A::B::C::TestUnknown.new(:unknown_field => 1)}) + from = A::B::C::TestUnknown.encode(unknown_msg) + m = A::B::C::TestMessage.decode(from) + Google::Protobuf.discard_unknown(m) + to = A::B::C::TestMessage.encode(m.map_string_msg['']) + assert_equal '', to + + # Test discard unknown for oneof message field. + unknown_msg = A::B::C::TestUnknown.new( + :oneof_unknown => + A::B::C::TestUnknown.new(:unknown_field => 1)) + from = A::B::C::TestUnknown.encode(unknown_msg) + m = A::B::C::TestMessage.decode(from) + Google::Protobuf.discard_unknown(m) + to = A::B::C::TestMessage.encode(m.oneof_msg) + assert_equal '', to + end +end diff --git a/ruby/tests/generated_code.proto b/ruby/tests/generated_code.proto index 62fd83ed..3b934bd6 100644 --- a/ruby/tests/generated_code.proto +++ b/ruby/tests/generated_code.proto @@ -57,6 +57,9 @@ message TestMessage { } NestedMessage nested_message = 80; + + // Reserved for non-existing field test. + // int32 non_exist = 89; } enum TestEnum { @@ -65,3 +68,13 @@ enum TestEnum { B = 2; C = 3; } + +message TestUnknown { + TestUnknown optional_unknown = 11; + repeated TestUnknown repeated_unknown = 31; + oneof my_oneof { + TestUnknown oneof_unknown = 51; + } + map map_unknown = 67; + int32 unknown_field = 89; +} -- cgit v1.2.3 From cf7c15e31a456f634d4e3deaf4ef74a6bfad825d Mon Sep 17 00:00:00 2001 From: Paul Yang Date: Fri, 8 Dec 2017 12:38:25 -0800 Subject: Fix ruby gc_test in ruby 2.4 (#4011) * Fix ruby gc_test in ruby 2.4 * Initialize global variables to Qnil. --- ruby/ext/google/protobuf_c/defs.c | 22 +++++++++++----------- ruby/ext/google/protobuf_c/map.c | 2 +- ruby/ext/google/protobuf_c/repeated_field.c | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/ruby/ext/google/protobuf_c/defs.c b/ruby/ext/google/protobuf_c/defs.c index 34d9663a..d9d2ebac 100644 --- a/ruby/ext/google/protobuf_c/defs.c +++ b/ruby/ext/google/protobuf_c/defs.c @@ -76,7 +76,7 @@ static upb_enumdef* check_enum_notfrozen(const upb_enumdef* def) { // ----------------------------------------------------------------------------- #define DEFINE_CLASS(name, string_name) \ - VALUE c ## name; \ + VALUE c ## name = Qnil; \ const rb_data_type_t _ ## name ## _type = { \ string_name, \ { name ## _mark, name ## _free, NULL }, \ @@ -126,11 +126,11 @@ void DescriptorPool_register(VALUE module) { rb_define_method(klass, "lookup", DescriptorPool_lookup, 1); rb_define_singleton_method(klass, "generated_pool", DescriptorPool_generated_pool, 0); - cDescriptorPool = klass; rb_gc_register_address(&cDescriptorPool); + cDescriptorPool = klass; - generated_pool = rb_class_new_instance(0, NULL, klass); rb_gc_register_address(&generated_pool); + generated_pool = rb_class_new_instance(0, NULL, klass); } static void add_descriptor_to_pool(DescriptorPool* self, @@ -299,8 +299,8 @@ void Descriptor_register(VALUE module) { rb_define_method(klass, "name", Descriptor_name, 0); rb_define_method(klass, "name=", Descriptor_name_set, 1); rb_include_module(klass, rb_mEnumerable); - cDescriptor = klass; rb_gc_register_address(&cDescriptor); + cDescriptor = klass; } /* @@ -518,8 +518,8 @@ void FieldDescriptor_register(VALUE module) { rb_define_method(klass, "subtype", FieldDescriptor_subtype, 0); rb_define_method(klass, "get", FieldDescriptor_get, 1); rb_define_method(klass, "set", FieldDescriptor_set, 2); - cFieldDescriptor = klass; rb_gc_register_address(&cFieldDescriptor); + cFieldDescriptor = klass; } /* @@ -916,8 +916,8 @@ void OneofDescriptor_register(VALUE module) { rb_define_method(klass, "add_field", OneofDescriptor_add_field, 1); rb_define_method(klass, "each", OneofDescriptor_each, 0); rb_include_module(klass, rb_mEnumerable); - cOneofDescriptor = klass; rb_gc_register_address(&cOneofDescriptor); + cOneofDescriptor = klass; } /* @@ -1037,8 +1037,8 @@ void EnumDescriptor_register(VALUE module) { rb_define_method(klass, "each", EnumDescriptor_each, 0); rb_define_method(klass, "enummodule", EnumDescriptor_enummodule, 0); rb_include_module(klass, rb_mEnumerable); - cEnumDescriptor = klass; rb_gc_register_address(&cEnumDescriptor); + cEnumDescriptor = klass; } /* @@ -1202,8 +1202,8 @@ void MessageBuilderContext_register(VALUE module) { rb_define_method(klass, "repeated", MessageBuilderContext_repeated, -1); rb_define_method(klass, "map", MessageBuilderContext_map, -1); rb_define_method(klass, "oneof", MessageBuilderContext_oneof, 1); - cMessageBuilderContext = klass; rb_gc_register_address(&cMessageBuilderContext); + cMessageBuilderContext = klass; } /* @@ -1491,8 +1491,8 @@ void OneofBuilderContext_register(VALUE module) { rb_define_method(klass, "initialize", OneofBuilderContext_initialize, 2); rb_define_method(klass, "optional", OneofBuilderContext_optional, -1); - cOneofBuilderContext = klass; rb_gc_register_address(&cOneofBuilderContext); + cOneofBuilderContext = klass; } /* @@ -1569,8 +1569,8 @@ void EnumBuilderContext_register(VALUE module) { rb_define_method(klass, "initialize", EnumBuilderContext_initialize, 1); rb_define_method(klass, "value", EnumBuilderContext_value, 2); - cEnumBuilderContext = klass; rb_gc_register_address(&cEnumBuilderContext); + cEnumBuilderContext = klass; } /* @@ -1645,8 +1645,8 @@ void Builder_register(VALUE module) { rb_define_method(klass, "add_enum", Builder_add_enum, 1); rb_define_method(klass, "initialize", Builder_initialize, 0); rb_define_method(klass, "finalize_to_pool", Builder_finalize_to_pool, 1); - cBuilder = klass; rb_gc_register_address(&cBuilder); + cBuilder = klass; } /* diff --git a/ruby/ext/google/protobuf_c/map.c b/ruby/ext/google/protobuf_c/map.c index 26e22dc7..8c2f6424 100644 --- a/ruby/ext/google/protobuf_c/map.c +++ b/ruby/ext/google/protobuf_c/map.c @@ -825,8 +825,8 @@ VALUE Map_iter_value(Map_iter* iter) { void Map_register(VALUE module) { VALUE klass = rb_define_class_under(module, "Map", rb_cObject); rb_define_alloc_func(klass, Map_alloc); - cMap = klass; rb_gc_register_address(&cMap); + cMap = klass; rb_define_method(klass, "initialize", Map_init, -1); rb_define_method(klass, "each", Map_each, 0); diff --git a/ruby/ext/google/protobuf_c/repeated_field.c b/ruby/ext/google/protobuf_c/repeated_field.c index 1c651c19..c6620ee6 100644 --- a/ruby/ext/google/protobuf_c/repeated_field.c +++ b/ruby/ext/google/protobuf_c/repeated_field.c @@ -626,8 +626,8 @@ void RepeatedField_register(VALUE module) { VALUE klass = rb_define_class_under( module, "RepeatedField", rb_cObject); rb_define_alloc_func(klass, RepeatedField_alloc); - cRepeatedField = klass; rb_gc_register_address(&cRepeatedField); + cRepeatedField = klass; rb_define_method(klass, "initialize", RepeatedField_init, -1); -- cgit v1.2.3 From 3b13c3f02e476bb668a28fce3e86a1ec62f85562 Mon Sep 17 00:00:00 2001 From: Bo Yang Date: Mon, 11 Dec 2017 15:44:27 -0800 Subject: Add backslach to make class explict in global namespace --- php/src/Google/Protobuf/Internal/Message.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/php/src/Google/Protobuf/Internal/Message.php b/php/src/Google/Protobuf/Internal/Message.php index 93e81c01..b7f83c57 100644 --- a/php/src/Google/Protobuf/Internal/Message.php +++ b/php/src/Google/Protobuf/Internal/Message.php @@ -1111,7 +1111,7 @@ class Message } try { $this->mergeFromJsonArray($array); - } catch (Exception $e) { + } catch (\Exception $e) { throw new GPBDecodeException($e->getMessage()); } } -- cgit v1.2.3 From 9f6aceaa8ce8250d9e36225180c218035bd49fe9 Mon Sep 17 00:00:00 2001 From: Bo Yang Date: Tue, 12 Dec 2017 12:06:51 -0800 Subject: Add PROTOBUF_ENABLE_TIMESTAMP to let user decide whether timestamp util can be used at install time. --- php/ext/google/protobuf/message.c | 13 ++++++++++++- php/tests/test.sh | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/php/ext/google/protobuf/message.c b/php/ext/google/protobuf/message.c index b14c1f0c..70080a3b 100644 --- a/php/ext/google/protobuf/message.c +++ b/php/ext/google/protobuf/message.c @@ -29,9 +29,12 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include -#include #include +#ifdef PROTOBUF_ENABLE_TIMESTAMP +#include +#endif + #include "protobuf.h" #include "utf8.h" @@ -1121,6 +1124,7 @@ PHP_PROTO_FIELD_ACCESSORS(Timestamp, timestamp, Seconds, "seconds") PHP_PROTO_FIELD_ACCESSORS(Timestamp, timestamp, Nanos, "nanos") PHP_METHOD(Timestamp, fromDateTime) { +#ifdef PROTOBUF_ENABLE_TIMESTAMP zval* datetime; zval member; @@ -1149,9 +1153,13 @@ PHP_METHOD(Timestamp, fromDateTime) { storage = message_data(self); memory = slot_memory(self->descriptor->layout, storage, field); *(int32_t*)memory = 0; +#else + zend_error(E_USER_ERROR, "fromDateTime needs date extension."); +#endif } PHP_METHOD(Timestamp, toDateTime) { +#ifdef PROTOBUF_ENABLE_TIMESTAMP zval datetime; php_date_instantiate(php_date_get_date_ce(), &datetime TSRMLS_CC); php_date_obj* dateobj = UNBOX(php_date_obj, &datetime); @@ -1184,6 +1192,9 @@ PHP_METHOD(Timestamp, toDateTime) { zval* datetime_ptr = &datetime; PHP_PROTO_RETVAL_ZVAL(datetime_ptr); +#else + zend_error(E_USER_ERROR, "toDateTime needs date extension."); +#endif } // ----------------------------------------------------------------------------- diff --git a/php/tests/test.sh b/php/tests/test.sh index c35372d3..a308a1d2 100755 --- a/php/tests/test.sh +++ b/php/tests/test.sh @@ -5,7 +5,7 @@ pushd ../ext/google/protobuf/ make clean || true set -e # Add following in configure for debug: --enable-debug CFLAGS='-g -O0' -phpize && ./configure CFLAGS='-g -O0' && make +phpize && ./configure CFLAGS='-g -O0 -DPROTOBUF_ENABLE_TIMESTAMP' && make popd tests=( array_test.php encode_decode_test.php generated_class_test.php generated_phpdoc_test.php map_field_test.php well_known_test.php generated_service_test.php descriptors_test.php ) -- cgit v1.2.3 From 88102eae8f86045307e9d46ad900f91158227f2b Mon Sep 17 00:00:00 2001 From: Bo Yang Date: Tue, 12 Dec 2017 13:57:49 -0800 Subject: Replace private timelib_update_ts with public date_timestamp_get --- php/ext/google/protobuf/message.c | 24 +++++++++++++++++++----- php/tests/memory_leak_test.php | 12 ++++++++++++ 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/php/ext/google/protobuf/message.c b/php/ext/google/protobuf/message.c index 70080a3b..5b654a78 100644 --- a/php/ext/google/protobuf/message.c +++ b/php/ext/google/protobuf/message.c @@ -1133,12 +1133,24 @@ PHP_METHOD(Timestamp, fromDateTime) { return; } - php_date_obj* dateobj = UNBOX(php_date_obj, datetime); - if (!dateobj->time->sse_uptodate) { - timelib_update_ts(dateobj->time, NULL); + // Get timestamp from Datetime object. + zval* retval_ptr; + zval* function_name; + int64_t timestamp; + + MAKE_STD_ZVAL(retval_ptr); + MAKE_STD_ZVAL(function_name); + + ZVAL_STRING(function_name, "date_timestamp_get", 1); + + if (call_user_function(EG(function_table), NULL, + function_name, retval_ptr, 1, + &datetime TSRMLS_CC) == SUCCESS) { + protobuf_convert_to_int64(retval_ptr, ×tamp); } - int64_t timestamp = dateobj->time->sse; + zval_ptr_dtor(&retval_ptr); + zval_ptr_dtor(&function_name); // Set seconds MessageHeader* self = UNBOX(MessageHeader, getThis()); @@ -1146,13 +1158,15 @@ PHP_METHOD(Timestamp, fromDateTime) { upb_msgdef_ntofz(self->descriptor->msgdef, "seconds"); void* storage = message_data(self); void* memory = slot_memory(self->descriptor->layout, storage, field); - *(int64_t*)memory = dateobj->time->sse; + *(int64_t*)memory = timestamp; // Set nanos field = upb_msgdef_ntofz(self->descriptor->msgdef, "nanos"); storage = message_data(self); memory = slot_memory(self->descriptor->layout, storage, field); *(int32_t*)memory = 0; + + RETURN_NULL(); #else zend_error(E_USER_ERROR, "fromDateTime needs date extension."); #endif diff --git a/php/tests/memory_leak_test.php b/php/tests/memory_leak_test.php index 8ea84f68..ce268838 100644 --- a/php/tests/memory_leak_test.php +++ b/php/tests/memory_leak_test.php @@ -126,6 +126,18 @@ $from = new \Google\Protobuf\Timestamp(); $from->setSeconds(1); assert(1, $from->getSeconds()); +$timestamp = new \Google\Protobuf\Timestamp(); + +date_default_timezone_set('UTC'); +$from = new DateTime('2011-01-01T15:03:01.012345UTC'); +$timestamp->fromDateTime($from); +assert($from->format('U'), $timestamp->getSeconds()); +assert(0, $timestamp->getNanos()); + +$to = $timestamp->toDateTime(); +assert(\DateTime::class, get_class($to)); +assert($from->format('U'), $to->format('U')); + $from = new \Google\Protobuf\Value(); $from->setNumberValue(1); assert(1, $from->getNumberValue()); -- cgit v1.2.3 From fffe8d39f810d147c6db65f90ae4f71f4e0f0116 Mon Sep 17 00:00:00 2001 From: Bo Yang Date: Tue, 12 Dec 2017 17:47:04 -0800 Subject: Call php method via function name instead of calling directly. This changes the linking error if php extension is not statically linked to a runtime error. In this way, users who don't need Timestamp can still use protobuf even if date extension is not statically linked in php. --- php/ext/google/protobuf/message.c | 70 ++++++++++++++++++++++---------------- php/ext/google/protobuf/protobuf.h | 4 +++ php/tests/memory_leak_test.php | 8 ++--- php/tests/test.sh | 2 +- 4 files changed, 50 insertions(+), 34 deletions(-) diff --git a/php/ext/google/protobuf/message.c b/php/ext/google/protobuf/message.c index 5b654a78..7d7d8651 100644 --- a/php/ext/google/protobuf/message.c +++ b/php/ext/google/protobuf/message.c @@ -31,10 +31,6 @@ #include #include -#ifdef PROTOBUF_ENABLE_TIMESTAMP -#include -#endif - #include "protobuf.h" #include "utf8.h" @@ -1124,7 +1120,6 @@ PHP_PROTO_FIELD_ACCESSORS(Timestamp, timestamp, Seconds, "seconds") PHP_PROTO_FIELD_ACCESSORS(Timestamp, timestamp, Nanos, "nanos") PHP_METHOD(Timestamp, fromDateTime) { -#ifdef PROTOBUF_ENABLE_TIMESTAMP zval* datetime; zval member; @@ -1134,23 +1129,27 @@ PHP_METHOD(Timestamp, fromDateTime) { } // Get timestamp from Datetime object. - zval* retval_ptr; - zval* function_name; + zval retval; + zval function_name; int64_t timestamp; - MAKE_STD_ZVAL(retval_ptr); - MAKE_STD_ZVAL(function_name); +#if PHP_MAJOR_VERSION < 7 + INIT_ZVAL(retval); + INIT_ZVAL(function_name); +#endif - ZVAL_STRING(function_name, "date_timestamp_get", 1); + PHP_PROTO_ZVAL_STRING(&function_name, "date_timestamp_get", 1); - if (call_user_function(EG(function_table), NULL, - function_name, retval_ptr, 1, - &datetime TSRMLS_CC) == SUCCESS) { - protobuf_convert_to_int64(retval_ptr, ×tamp); + if (call_user_function(EG(function_table), NULL, &function_name, &retval, 1, + ZVAL_PTR_TO_CACHED_PTR(datetime) TSRMLS_CC) == FAILURE) { + zend_error(E_ERROR, "Cannot get timestamp from DateTime."); + return; } - zval_ptr_dtor(&retval_ptr); - zval_ptr_dtor(&function_name); + protobuf_convert_to_int64(&retval, ×tamp); + + zval_dtor(&retval); + zval_dtor(&function_name); // Set seconds MessageHeader* self = UNBOX(MessageHeader, getThis()); @@ -1167,17 +1166,9 @@ PHP_METHOD(Timestamp, fromDateTime) { *(int32_t*)memory = 0; RETURN_NULL(); -#else - zend_error(E_USER_ERROR, "fromDateTime needs date extension."); -#endif } PHP_METHOD(Timestamp, toDateTime) { -#ifdef PROTOBUF_ENABLE_TIMESTAMP - zval datetime; - php_date_instantiate(php_date_get_date_ce(), &datetime TSRMLS_CC); - php_date_obj* dateobj = UNBOX(php_date_obj, &datetime); - // Get seconds MessageHeader* self = UNBOX(MessageHeader, getThis()); const upb_fielddef* field = @@ -1198,16 +1189,37 @@ PHP_METHOD(Timestamp, toDateTime) { strftime(formated_time, sizeof(formated_time), "%Y-%m-%dT%H:%M:%SUTC", utc_time); - if (!php_date_initialize(dateobj, formated_time, strlen(formated_time), NULL, - NULL, 0 TSRMLS_CC)) { - zval_dtor(&datetime); - RETURN_NULL(); + // Create Datetime object. + zval datetime; + zval formated_time_php; + zval function_name; + int64_t timestamp = 0; + +#if PHP_MAJOR_VERSION < 7 + INIT_ZVAL(function_name); + INIT_ZVAL(formated_time_php); +#endif + + PHP_PROTO_ZVAL_STRING(&function_name, "date_create", 1); + PHP_PROTO_ZVAL_STRING(&formated_time_php, formated_time, 1); + + CACHED_VALUE params[1] = {ZVAL_TO_CACHED_VALUE(formated_time_php)}; + + if (call_user_function(EG(function_table), NULL, + &function_name, &datetime, 1, + params TSRMLS_CC) == FAILURE) { + zend_error(E_ERROR, "Cannot create DateTime."); + return; } + zval_dtor(&formated_time_php); + zval_dtor(&function_name); + +#if PHP_MAJOR_VERSION < 7 zval* datetime_ptr = &datetime; PHP_PROTO_RETVAL_ZVAL(datetime_ptr); #else - zend_error(E_USER_ERROR, "toDateTime needs date extension."); + ZVAL_OBJ(return_value, Z_OBJ(datetime)); #endif } diff --git a/php/ext/google/protobuf/protobuf.h b/php/ext/google/protobuf/protobuf.h index f299b415..6ab0f134 100644 --- a/php/ext/google/protobuf/protobuf.h +++ b/php/ext/google/protobuf/protobuf.h @@ -182,6 +182,8 @@ #define CACHED_TO_ZVAL_PTR(VALUE) (VALUE) #define CACHED_PTR_TO_ZVAL_PTR(VALUE) (*VALUE) #define ZVAL_PTR_TO_CACHED_PTR(VALUE) (&VALUE) +#define ZVAL_PTR_TO_CACHED_VALUE(VALUE) (VALUE) +#define ZVAL_TO_CACHED_VALUE(VALUE) (&VALUE) #define CREATE_OBJ_ON_ALLOCATED_ZVAL_PTR(zval_ptr, class_type) \ ZVAL_OBJ(zval_ptr, class_type->create_object(class_type TSRMLS_CC)); @@ -452,6 +454,8 @@ static inline int php_proto_zend_hash_get_current_data_ex(HashTable* ht, #define CACHED_TO_ZVAL_PTR(VALUE) (&VALUE) #define CACHED_PTR_TO_ZVAL_PTR(VALUE) (VALUE) #define ZVAL_PTR_TO_CACHED_PTR(VALUE) (VALUE) +#define ZVAL_PTR_TO_CACHED_VALUE(VALUE) (*VALUE) +#define ZVAL_TO_CACHED_VALUE(VALUE) (VALUE) #define CREATE_OBJ_ON_ALLOCATED_ZVAL_PTR(zval_ptr, class_type) \ ZVAL_OBJ(zval_ptr, class_type->create_object(class_type)); diff --git a/php/tests/memory_leak_test.php b/php/tests/memory_leak_test.php index ce268838..507635e7 100644 --- a/php/tests/memory_leak_test.php +++ b/php/tests/memory_leak_test.php @@ -131,12 +131,12 @@ $timestamp = new \Google\Protobuf\Timestamp(); date_default_timezone_set('UTC'); $from = new DateTime('2011-01-01T15:03:01.012345UTC'); $timestamp->fromDateTime($from); -assert($from->format('U'), $timestamp->getSeconds()); -assert(0, $timestamp->getNanos()); +assert($from->format('U') == $timestamp->getSeconds()); +assert(0 == $timestamp->getNanos()); $to = $timestamp->toDateTime(); -assert(\DateTime::class, get_class($to)); -assert($from->format('U'), $to->format('U')); +assert(\DateTime::class == get_class($to)); +assert($from->format('U') == $to->format('U')); $from = new \Google\Protobuf\Value(); $from->setNumberValue(1); diff --git a/php/tests/test.sh b/php/tests/test.sh index a308a1d2..c35372d3 100755 --- a/php/tests/test.sh +++ b/php/tests/test.sh @@ -5,7 +5,7 @@ pushd ../ext/google/protobuf/ make clean || true set -e # Add following in configure for debug: --enable-debug CFLAGS='-g -O0' -phpize && ./configure CFLAGS='-g -O0 -DPROTOBUF_ENABLE_TIMESTAMP' && make +phpize && ./configure CFLAGS='-g -O0' && make popd tests=( array_test.php encode_decode_test.php generated_class_test.php generated_phpdoc_test.php map_field_test.php well_known_test.php generated_service_test.php descriptors_test.php ) -- cgit v1.2.3 From edcf15e7f4de104f39e5daa1909bfcc93642ad53 Mon Sep 17 00:00:00 2001 From: Oleg Kolosov Date: Tue, 12 Dec 2017 14:08:15 +0100 Subject: Create containing directory before generating well_known_types_embed.cc This fixes the following build error: oldpwd=`pwd` && cd .../protobuf/src && \ $oldpwd/js_embed google/protobuf/compiler/js/well_known_types/any.js google/protobuf/compiler/js/well_known_types/struct.js google/protobuf/compiler/js/well_known_types/timestamp.js > $oldpwd/google/protobuf/compiler/js/well_known_types_embed.cc /bin/bash: line 1: .../protobuf/target/src/google/protobuf/compiler/js/well_known_types_embed.cc: No such file or directory Makefile:8201: recipe for target 'google/protobuf/compiler/js/well_known_types_embed.cc' failed which is observed during the cross-compilation since the version 3.2. --- src/Makefile.am | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Makefile.am b/src/Makefile.am index 1d651dc8..12d1e80c 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -525,6 +525,7 @@ js_well_known_types_sources = \ google/protobuf/compiler/js/well_known_types/timestamp.js # We have to cd to $(srcdir) so that out-of-tree builds work properly. google/protobuf/compiler/js/well_known_types_embed.cc: js_embed$(EXEEXT) $(js_well_known_types_sources) + mkdir -p `dirname $@` && \ oldpwd=`pwd` && cd $(srcdir) && \ $$oldpwd/js_embed$(EXEEXT) $(js_well_known_types_sources) > $$oldpwd/$@ -- cgit v1.2.3 From 7ef21dd81bb1841ea5fa44e9d26e2b23b1bf1468 Mon Sep 17 00:00:00 2001 From: Jisi Liu Date: Wed, 13 Dec 2017 13:00:02 -0800 Subject: Use matching enum type for IsPOD. --- src/google/protobuf/compiler/cpp/cpp_message.cc | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/google/protobuf/compiler/cpp/cpp_message.cc b/src/google/protobuf/compiler/cpp/cpp_message.cc index 60467598..34a70b12 100644 --- a/src/google/protobuf/compiler/cpp/cpp_message.cc +++ b/src/google/protobuf/compiler/cpp/cpp_message.cc @@ -113,16 +113,16 @@ struct ExtensionRangeSorter { bool IsPOD(const FieldDescriptor* field) { if (field->is_repeated() || field->is_extension()) return false; switch (field->cpp_type()) { - case internal::WireFormatLite::CPPTYPE_ENUM: - case internal::WireFormatLite::CPPTYPE_INT32: - case internal::WireFormatLite::CPPTYPE_INT64: - case internal::WireFormatLite::CPPTYPE_UINT32: - case internal::WireFormatLite::CPPTYPE_UINT64: - case internal::WireFormatLite::CPPTYPE_FLOAT: - case internal::WireFormatLite::CPPTYPE_DOUBLE: - case internal::WireFormatLite::CPPTYPE_BOOL: + case FieldDescriptor::CPPTYPE_ENUM: + case FieldDescriptor::CPPTYPE_INT32: + case FieldDescriptor::CPPTYPE_INT64: + case FieldDescriptor::CPPTYPE_UINT32: + case FieldDescriptor::CPPTYPE_UINT64: + case FieldDescriptor::CPPTYPE_FLOAT: + case FieldDescriptor::CPPTYPE_DOUBLE: + case FieldDescriptor::CPPTYPE_BOOL: return true; - case internal::WireFormatLite::CPPTYPE_STRING: + case FieldDescriptor::CPPTYPE_STRING: return false; default: return false; -- cgit v1.2.3 From 6b01e6440cdac325bc131ec6713eab9d8307414a Mon Sep 17 00:00:00 2001 From: Jisi Liu Date: Wed, 13 Dec 2017 13:06:29 -0800 Subject: Explicitly propagate the status of Flush(). Before the change, an implicit Flush() will be triggered in the destructor of the input stream. However, the return code of Flush() is not discarded. This change makes sure when Flush() fails, we will return false. --- src/google/protobuf/message.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/google/protobuf/message.cc b/src/google/protobuf/message.cc index a0d3feba..42ec0337 100644 --- a/src/google/protobuf/message.cc +++ b/src/google/protobuf/message.cc @@ -170,12 +170,12 @@ size_t Message::SpaceUsedLong() const { bool Message::SerializeToFileDescriptor(int file_descriptor) const { io::FileOutputStream output(file_descriptor); - return SerializeToZeroCopyStream(&output); + return SerializeToZeroCopyStream(&output) && output.Flush(); } bool Message::SerializePartialToFileDescriptor(int file_descriptor) const { io::FileOutputStream output(file_descriptor); - return SerializePartialToZeroCopyStream(&output); + return SerializePartialToZeroCopyStream(&output) && output.Flush(); } bool Message::SerializeToOstream(std::ostream* output) const { -- cgit v1.2.3 From 1a549d9a902151e980bfa76093b3d82b7589e158 Mon Sep 17 00:00:00 2001 From: Bo Yang Date: Wed, 13 Dec 2017 17:09:55 -0800 Subject: Avoid using php_date_get_date_ce() in case date extension is not available. --- php/ext/google/protobuf/message.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/php/ext/google/protobuf/message.c b/php/ext/google/protobuf/message.c index 7d7d8651..df5eb408 100644 --- a/php/ext/google/protobuf/message.c +++ b/php/ext/google/protobuf/message.c @@ -1123,8 +1123,21 @@ PHP_METHOD(Timestamp, fromDateTime) { zval* datetime; zval member; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &datetime, - php_date_get_date_ce()) == FAILURE) { + if (zend_parse_parameters( + ZEND_NUM_ARGS() TSRMLS_CC, "z", &datetime) == FAILURE) { + return; + } + + zend_class_entry* ce = Z_OBJCE_P(datetime); + PHP_PROTO_CE_DECLARE datetime_ce; + if (php_proto_zend_lookup_class("\\Datetime", 9, &datetime_ce) == + FAILURE) { + zend_error(E_ERROR, "Make sure date extension is enabled."); + return; + } + + if (!instanceof_function(PHP_PROTO_CE_UNREF(datetime_ce), ce TSRMLS_CC)) { + zend_error(E_USER_ERROR, "Expect Datetime."); return; } -- cgit v1.2.3 From acadade56ef2cb0950f4d324f233af5eaeaff262 Mon Sep 17 00:00:00 2001 From: Jisi Liu Date: Thu, 14 Dec 2017 11:26:58 -0800 Subject: Remove py2.6 support. --- python/setup.py | 1 - 1 file changed, 1 deletion(-) diff --git a/python/setup.py b/python/setup.py index efb74fe7..0f7e58b0 100755 --- a/python/setup.py +++ b/python/setup.py @@ -240,7 +240,6 @@ if __name__ == '__main__': classifiers=[ "Programming Language :: Python", "Programming Language :: Python :: 2", - "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", -- cgit v1.2.3 From 39159c89f1e6924c1b12a6f12478b6de199894f4 Mon Sep 17 00:00:00 2001 From: Bo Yang Date: Thu, 14 Dec 2017 11:33:34 -0800 Subject: Accept DatetimeInterface in fromDatetime --- php/ext/google/protobuf/message.c | 17 ++++++----------- php/ext/google/protobuf/protobuf.c | 9 ++++++++- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/php/ext/google/protobuf/message.c b/php/ext/google/protobuf/message.c index df5eb408..8b7d57ad 100644 --- a/php/ext/google/protobuf/message.c +++ b/php/ext/google/protobuf/message.c @@ -1123,21 +1123,16 @@ PHP_METHOD(Timestamp, fromDateTime) { zval* datetime; zval member; - if (zend_parse_parameters( - ZEND_NUM_ARGS() TSRMLS_CC, "z", &datetime) == FAILURE) { - return; - } - - zend_class_entry* ce = Z_OBJCE_P(datetime); - PHP_PROTO_CE_DECLARE datetime_ce; - if (php_proto_zend_lookup_class("\\Datetime", 9, &datetime_ce) == - FAILURE) { + PHP_PROTO_CE_DECLARE date_interface_ce; + if (php_proto_zend_lookup_class("\\DatetimeInterface", 18, + &date_interface_ce) == FAILURE) { zend_error(E_ERROR, "Make sure date extension is enabled."); return; } - if (!instanceof_function(PHP_PROTO_CE_UNREF(datetime_ce), ce TSRMLS_CC)) { - zend_error(E_USER_ERROR, "Expect Datetime."); + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &datetime, + date_interface_ce) == FAILURE) { + zend_error(E_USER_ERROR, "Expect DatetimeInterface."); return; } diff --git a/php/ext/google/protobuf/protobuf.c b/php/ext/google/protobuf/protobuf.c index 265d636e..daebb460 100644 --- a/php/ext/google/protobuf/protobuf.c +++ b/php/ext/google/protobuf/protobuf.c @@ -182,8 +182,15 @@ zend_function_entry protobuf_functions[] = { ZEND_FE_END }; +static const zend_module_dep protobuf_deps[] = { + ZEND_MOD_OPTIONAL("date") + ZEND_MOD_END +}; + zend_module_entry protobuf_module_entry = { - STANDARD_MODULE_HEADER, + STANDARD_MODULE_HEADER_EX, + NULL, + protobuf_deps, PHP_PROTOBUF_EXTNAME, // extension name protobuf_functions, // function list PHP_MINIT(protobuf), // process startup -- cgit v1.2.3 From 8d6f13e86d62b47570810371a6c0528cfb10b781 Mon Sep 17 00:00:00 2001 From: Bo Yang Date: Thu, 14 Dec 2017 13:24:00 -0800 Subject: Fix for php5.5 --- php/ext/google/protobuf/message.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/php/ext/google/protobuf/message.c b/php/ext/google/protobuf/message.c index 8b7d57ad..24472682 100644 --- a/php/ext/google/protobuf/message.c +++ b/php/ext/google/protobuf/message.c @@ -1131,7 +1131,7 @@ PHP_METHOD(Timestamp, fromDateTime) { } if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &datetime, - date_interface_ce) == FAILURE) { + PHP_PROTO_CE_UNREF(date_interface_ce)) == FAILURE) { zend_error(E_USER_ERROR, "Expect DatetimeInterface."); return; } -- cgit v1.2.3 From 3a06fe1fc9590b534f403114a0668befba926947 Mon Sep 17 00:00:00 2001 From: Feng Xiao Date: Thu, 14 Dec 2017 17:54:18 -0800 Subject: Fix file permission for python package. `umask 0022` makes sure the created package will be accessible by all users. --- python/release.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/python/release.sh b/python/release.sh index b0bf3b3f..01fc5e23 100755 --- a/python/release.sh +++ b/python/release.sh @@ -47,6 +47,7 @@ DEV=$2 # Make sure all files are world-readable. find python -type d -exec chmod a+r,a+x {} + find python -type f -exec chmod a+r {} + +umask 0022 # Check that the supplied version number matches what's inside the source code. SOURCE_VERSION=`get_source_version` -- cgit v1.2.3 From 050fc9a43717193ffbccbd8ca5d19e1e5648c815 Mon Sep 17 00:00:00 2001 From: Jisi Liu Date: Tue, 19 Dec 2017 11:00:33 -0800 Subject: Update version number to 3.5.1 --- Protobuf.podspec | 2 +- configure.ac | 2 +- csharp/Google.Protobuf.Tools.nuspec | 2 +- csharp/src/Google.Protobuf/Google.Protobuf.csproj | 2 +- java/core/pom.xml | 2 +- java/pom.xml | 2 +- java/util/pom.xml | 2 +- js/package.json | 2 +- protoc-artifacts/pom.xml | 2 +- python/google/protobuf/__init__.py | 2 +- ruby/google-protobuf.gemspec | 2 +- src/Makefile.am | 6 +++--- src/google/protobuf/any.pb.h | 2 +- src/google/protobuf/api.pb.h | 2 +- src/google/protobuf/compiler/plugin.pb.h | 2 +- src/google/protobuf/descriptor.pb.h | 2 +- src/google/protobuf/duration.pb.h | 2 +- src/google/protobuf/empty.pb.h | 2 +- src/google/protobuf/field_mask.pb.h | 2 +- src/google/protobuf/source_context.pb.h | 2 +- src/google/protobuf/struct.pb.h | 2 +- src/google/protobuf/stubs/common.h | 2 +- src/google/protobuf/timestamp.pb.h | 2 +- src/google/protobuf/type.pb.h | 2 +- src/google/protobuf/wrappers.pb.h | 2 +- 25 files changed, 27 insertions(+), 27 deletions(-) diff --git a/Protobuf.podspec b/Protobuf.podspec index b65ac43c..84a37996 100644 --- a/Protobuf.podspec +++ b/Protobuf.podspec @@ -5,7 +5,7 @@ # dependent projects use the :git notation to refer to the library. Pod::Spec.new do |s| s.name = 'Protobuf' - s.version = '3.5.0' + s.version = '3.5.1' s.summary = 'Protocol Buffers v.3 runtime library for Objective-C.' s.homepage = 'https://github.com/google/protobuf' s.license = '3-Clause BSD License' diff --git a/configure.ac b/configure.ac index 3e36ddc1..7ff20b13 100644 --- a/configure.ac +++ b/configure.ac @@ -17,7 +17,7 @@ AC_PREREQ(2.59) # In the SVN trunk, the version should always be the next anticipated release # version with the "-pre" suffix. (We used to use "-SNAPSHOT" but this pushed # the size of one file name in the dist tarfile over the 99-char limit.) -AC_INIT([Protocol Buffers],[3.5.0],[protobuf@googlegroups.com],[protobuf]) +AC_INIT([Protocol Buffers],[3.5.1],[protobuf@googlegroups.com],[protobuf]) AM_MAINTAINER_MODE([enable]) diff --git a/csharp/Google.Protobuf.Tools.nuspec b/csharp/Google.Protobuf.Tools.nuspec index 7cd9dc59..62eb3b58 100644 --- a/csharp/Google.Protobuf.Tools.nuspec +++ b/csharp/Google.Protobuf.Tools.nuspec @@ -5,7 +5,7 @@ Google Protocol Buffers tools Tools for Protocol Buffers - Google's data interchange format. See project site for more info. - 3.5.0 + 3.5.1 Google Inc. protobuf-packages https://github.com/google/protobuf/blob/master/LICENSE diff --git a/csharp/src/Google.Protobuf/Google.Protobuf.csproj b/csharp/src/Google.Protobuf/Google.Protobuf.csproj index bf7a5e7d..4df0bda6 100644 --- a/csharp/src/Google.Protobuf/Google.Protobuf.csproj +++ b/csharp/src/Google.Protobuf/Google.Protobuf.csproj @@ -4,7 +4,7 @@ C# runtime library for Protocol Buffers - Google's data interchange format. Copyright 2015, Google Inc. Google Protocol Buffers - 3.5.0 + 3.5.1 Google Inc. netstandard1.0;net45 true diff --git a/java/core/pom.xml b/java/core/pom.xml index 95f6f7ff..4b65e72e 100644 --- a/java/core/pom.xml +++ b/java/core/pom.xml @@ -6,7 +6,7 @@ com.google.protobuf protobuf-parent - 3.5.0 + 3.5.1 protobuf-java diff --git a/java/pom.xml b/java/pom.xml index fa0d0e13..6e339d7f 100644 --- a/java/pom.xml +++ b/java/pom.xml @@ -11,7 +11,7 @@ com.google.protobuf protobuf-parent - 3.5.0 + 3.5.1 pom Protocol Buffers [Parent] diff --git a/java/util/pom.xml b/java/util/pom.xml index c3f2a69a..3de624fa 100644 --- a/java/util/pom.xml +++ b/java/util/pom.xml @@ -6,7 +6,7 @@ com.google.protobuf protobuf-parent - 3.5.0 + 3.5.1 protobuf-java-util diff --git a/js/package.json b/js/package.json index 50ebdac8..3c1c2a42 100644 --- a/js/package.json +++ b/js/package.json @@ -1,6 +1,6 @@ { "name": "google-protobuf", - "version": "3.5.0", + "version": "3.5.1", "description": "Protocol Buffers for JavaScript", "main": "google-protobuf.js", "files": [ diff --git a/protoc-artifacts/pom.xml b/protoc-artifacts/pom.xml index 742fab93..0f9dd9f8 100644 --- a/protoc-artifacts/pom.xml +++ b/protoc-artifacts/pom.xml @@ -10,7 +10,7 @@ com.google.protobuf protoc - 3.5.0 + 3.5.1 pom Protobuf Compiler diff --git a/python/google/protobuf/__init__.py b/python/google/protobuf/__init__.py index 0f4d63b0..950f9b2d 100755 --- a/python/google/protobuf/__init__.py +++ b/python/google/protobuf/__init__.py @@ -30,7 +30,7 @@ # Copyright 2007 Google Inc. All Rights Reserved. -__version__ = '3.5.0.post1' +__version__ = '3.5.1' if __name__ != '__main__': try: diff --git a/ruby/google-protobuf.gemspec b/ruby/google-protobuf.gemspec index c3963822..998952d0 100644 --- a/ruby/google-protobuf.gemspec +++ b/ruby/google-protobuf.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |s| s.name = "google-protobuf" - s.version = "3.5.0" + s.version = "3.5.1" s.licenses = ["BSD-3-Clause"] s.summary = "Protocol Buffers" s.description = "Protocol Buffers are Google's data interchange format." diff --git a/src/Makefile.am b/src/Makefile.am index 12d1e80c..cdc2298b 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -182,7 +182,7 @@ nobase_include_HEADERS = \ lib_LTLIBRARIES = libprotobuf-lite.la libprotobuf.la libprotoc.la libprotobuf_lite_la_LIBADD = $(PTHREAD_LIBS) -libprotobuf_lite_la_LDFLAGS = -version-info 15:0:0 -export-dynamic -no-undefined +libprotobuf_lite_la_LDFLAGS = -version-info 15:1:0 -export-dynamic -no-undefined if HAVE_LD_VERSION_SCRIPT libprotobuf_lite_la_LDFLAGS += -Wl,--version-script=$(srcdir)/libprotobuf-lite.map EXTRA_libprotobuf_lite_la_DEPENDENCIES = libprotobuf-lite.map @@ -231,7 +231,7 @@ libprotobuf_lite_la_SOURCES = \ google/protobuf/io/zero_copy_stream_impl_lite.cc libprotobuf_la_LIBADD = $(PTHREAD_LIBS) -libprotobuf_la_LDFLAGS = -version-info 15:0:0 -export-dynamic -no-undefined +libprotobuf_la_LDFLAGS = -version-info 15:1:0 -export-dynamic -no-undefined if HAVE_LD_VERSION_SCRIPT libprotobuf_la_LDFLAGS += -Wl,--version-script=$(srcdir)/libprotobuf.map EXTRA_libprotobuf_la_DEPENDENCIES = libprotobuf.map @@ -322,7 +322,7 @@ libprotobuf_la_SOURCES = \ nodist_libprotobuf_la_SOURCES = $(nodist_libprotobuf_lite_la_SOURCES) libprotoc_la_LIBADD = $(PTHREAD_LIBS) libprotobuf.la -libprotoc_la_LDFLAGS = -version-info 15:0:0 -export-dynamic -no-undefined +libprotoc_la_LDFLAGS = -version-info 15:1:0 -export-dynamic -no-undefined if HAVE_LD_VERSION_SCRIPT libprotoc_la_LDFLAGS += -Wl,--version-script=$(srcdir)/libprotoc.map EXTRA_libprotoc_la_DEPENDENCIES = libprotoc.map diff --git a/src/google/protobuf/any.pb.h b/src/google/protobuf/any.pb.h index 580acc6a..32847239 100644 --- a/src/google/protobuf/any.pb.h +++ b/src/google/protobuf/any.pb.h @@ -13,7 +13,7 @@ #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3005000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION +#if 3005001 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION #error This file was generated by an older version of protoc which is #error incompatible with your Protocol Buffer headers. Please #error regenerate this file with a newer version of protoc. diff --git a/src/google/protobuf/api.pb.h b/src/google/protobuf/api.pb.h index 26af28fb..96ff3f15 100644 --- a/src/google/protobuf/api.pb.h +++ b/src/google/protobuf/api.pb.h @@ -13,7 +13,7 @@ #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3005000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION +#if 3005001 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION #error This file was generated by an older version of protoc which is #error incompatible with your Protocol Buffer headers. Please #error regenerate this file with a newer version of protoc. diff --git a/src/google/protobuf/compiler/plugin.pb.h b/src/google/protobuf/compiler/plugin.pb.h index c3d96e83..ef1cfb93 100644 --- a/src/google/protobuf/compiler/plugin.pb.h +++ b/src/google/protobuf/compiler/plugin.pb.h @@ -13,7 +13,7 @@ #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3005000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION +#if 3005001 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION #error This file was generated by an older version of protoc which is #error incompatible with your Protocol Buffer headers. Please #error regenerate this file with a newer version of protoc. diff --git a/src/google/protobuf/descriptor.pb.h b/src/google/protobuf/descriptor.pb.h index 1a35681b..4ed5cac9 100644 --- a/src/google/protobuf/descriptor.pb.h +++ b/src/google/protobuf/descriptor.pb.h @@ -13,7 +13,7 @@ #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3005000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION +#if 3005001 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION #error This file was generated by an older version of protoc which is #error incompatible with your Protocol Buffer headers. Please #error regenerate this file with a newer version of protoc. diff --git a/src/google/protobuf/duration.pb.h b/src/google/protobuf/duration.pb.h index 555122aa..e13328ac 100644 --- a/src/google/protobuf/duration.pb.h +++ b/src/google/protobuf/duration.pb.h @@ -13,7 +13,7 @@ #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3005000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION +#if 3005001 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION #error This file was generated by an older version of protoc which is #error incompatible with your Protocol Buffer headers. Please #error regenerate this file with a newer version of protoc. diff --git a/src/google/protobuf/empty.pb.h b/src/google/protobuf/empty.pb.h index b7f32f4e..76e0e4c6 100644 --- a/src/google/protobuf/empty.pb.h +++ b/src/google/protobuf/empty.pb.h @@ -13,7 +13,7 @@ #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3005000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION +#if 3005001 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION #error This file was generated by an older version of protoc which is #error incompatible with your Protocol Buffer headers. Please #error regenerate this file with a newer version of protoc. diff --git a/src/google/protobuf/field_mask.pb.h b/src/google/protobuf/field_mask.pb.h index 9b9032c4..d57a4494 100644 --- a/src/google/protobuf/field_mask.pb.h +++ b/src/google/protobuf/field_mask.pb.h @@ -13,7 +13,7 @@ #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3005000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION +#if 3005001 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION #error This file was generated by an older version of protoc which is #error incompatible with your Protocol Buffer headers. Please #error regenerate this file with a newer version of protoc. diff --git a/src/google/protobuf/source_context.pb.h b/src/google/protobuf/source_context.pb.h index fdab394c..dfa2444c 100644 --- a/src/google/protobuf/source_context.pb.h +++ b/src/google/protobuf/source_context.pb.h @@ -13,7 +13,7 @@ #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3005000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION +#if 3005001 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION #error This file was generated by an older version of protoc which is #error incompatible with your Protocol Buffer headers. Please #error regenerate this file with a newer version of protoc. diff --git a/src/google/protobuf/struct.pb.h b/src/google/protobuf/struct.pb.h index 36b56e95..cdc00dcd 100644 --- a/src/google/protobuf/struct.pb.h +++ b/src/google/protobuf/struct.pb.h @@ -13,7 +13,7 @@ #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3005000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION +#if 3005001 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION #error This file was generated by an older version of protoc which is #error incompatible with your Protocol Buffer headers. Please #error regenerate this file with a newer version of protoc. diff --git a/src/google/protobuf/stubs/common.h b/src/google/protobuf/stubs/common.h index 79bb2396..d11b8100 100644 --- a/src/google/protobuf/stubs/common.h +++ b/src/google/protobuf/stubs/common.h @@ -101,7 +101,7 @@ namespace internal { // The current version, represented as a single integer to make comparison // easier: major * 10^6 + minor * 10^3 + micro -#define GOOGLE_PROTOBUF_VERSION 3005000 +#define GOOGLE_PROTOBUF_VERSION 3005001 // A suffix string for alpha, beta or rc releases. Empty for stable releases. #define GOOGLE_PROTOBUF_VERSION_SUFFIX "" diff --git a/src/google/protobuf/timestamp.pb.h b/src/google/protobuf/timestamp.pb.h index 3d5ee5ca..6c7136e2 100644 --- a/src/google/protobuf/timestamp.pb.h +++ b/src/google/protobuf/timestamp.pb.h @@ -13,7 +13,7 @@ #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3005000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION +#if 3005001 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION #error This file was generated by an older version of protoc which is #error incompatible with your Protocol Buffer headers. Please #error regenerate this file with a newer version of protoc. diff --git a/src/google/protobuf/type.pb.h b/src/google/protobuf/type.pb.h index e080339e..8ee74a12 100644 --- a/src/google/protobuf/type.pb.h +++ b/src/google/protobuf/type.pb.h @@ -13,7 +13,7 @@ #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3005000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION +#if 3005001 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION #error This file was generated by an older version of protoc which is #error incompatible with your Protocol Buffer headers. Please #error regenerate this file with a newer version of protoc. diff --git a/src/google/protobuf/wrappers.pb.h b/src/google/protobuf/wrappers.pb.h index 9c1ed5f2..a2f10c8b 100644 --- a/src/google/protobuf/wrappers.pb.h +++ b/src/google/protobuf/wrappers.pb.h @@ -13,7 +13,7 @@ #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3005000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION +#if 3005001 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION #error This file was generated by an older version of protoc which is #error incompatible with your Protocol Buffer headers. Please #error regenerate this file with a newer version of protoc. -- cgit v1.2.3 From 7bd16064847c410c0f1e5169b8f494fee8b14c93 Mon Sep 17 00:00:00 2001 From: Jisi Liu Date: Tue, 19 Dec 2017 11:28:30 -0800 Subject: Update changelog for 3.5.1 --- CHANGES.txt | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/CHANGES.txt b/CHANGES.txt index ea3252bb..5b77b9e1 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,3 +1,29 @@ +2017-12-19 version 3.5.1 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript) + Planned Future Changes + * Make C++ implementation C++11 only: we plan to require C++11 to build + protobuf code starting from 3.6.0 release. Please join this github issue: + https://github.com/google/protobuf/issues/2780 to provide your feedback. + + C++ + * protoc in Windows now accepts non-ascii characters in paths again. + * Fixed one usage of C++11 feature in field_mask_util.cc + * Fixed some compiler warnings. + + PHP + * Fixed memory leak in C-extension implementation. + * Added discardUnknokwnFields API. + * Removed duplicatd typedef in C-extension headers. + * Avoided calling private php methods (timelib_update_ts). + * Fixed Any.php to use fully-qualified name for DescriptorPool. + + Ruby + * Added Google_Protobuf_discard_unknown for discarding unknown fields in + messages. + + C# + * Unknown fields are now preserved by default. + + 2017-11-13 version 3.5.0 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript) Planned Future Changes * Make C++ implementation C++11 only: we plan to require C++11 to build -- cgit v1.2.3 From 501093d778258197cb8eec10d31cc9497520e459 Mon Sep 17 00:00:00 2001 From: Jisi Liu Date: Tue, 19 Dec 2017 12:20:13 -0800 Subject: Replace C++11 only method std::map::at --- src/google/protobuf/util/field_mask_util.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/google/protobuf/util/field_mask_util.cc b/src/google/protobuf/util/field_mask_util.cc index 4d0d3a46..8a413498 100644 --- a/src/google/protobuf/util/field_mask_util.cc +++ b/src/google/protobuf/util/field_mask_util.cc @@ -374,7 +374,7 @@ void FieldMaskTree::RemovePath(const string& path, } } if (ContainsKey(node->children, parts[i])) { - node = node->children.at(parts[i]); + node = node->children[parts[i]]; if (field_descriptor->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) { current_descriptor = field_descriptor->message_type(); } -- cgit v1.2.3 From 62616e152268ccd8dc001b791d76862a92af7432 Mon Sep 17 00:00:00 2001 From: Jisi Liu Date: Tue, 19 Dec 2017 15:22:18 -0800 Subject: Update changelog --- CHANGES.txt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 5b77b9e1..a3ba4789 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -4,9 +4,12 @@ protobuf code starting from 3.6.0 release. Please join this github issue: https://github.com/google/protobuf/issues/2780 to provide your feedback. + protoc + * Fixed a bug introduced in 3.5.0 and protoc in Windows now accepts non-ascii + characters in paths again. + C++ - * protoc in Windows now accepts non-ascii characters in paths again. - * Fixed one usage of C++11 feature in field_mask_util.cc + * Removed several usages of C++11 features in the code base. * Fixed some compiler warnings. PHP @@ -22,6 +25,8 @@ C# * Unknown fields are now preserved by default. + * Floating point values are now bitwise compared, affecting message equality + check and Contains() API in map and repeated fields. 2017-11-13 version 3.5.0 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript) -- cgit v1.2.3 From 19d0e9934c997b1dc46ad539c37d67ea6c6fc33f Mon Sep 17 00:00:00 2001 From: Jisi Liu Date: Tue, 19 Dec 2017 15:23:37 -0800 Subject: Fix string::back() usage in googletest.cc --- src/google/protobuf/testing/googletest.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/google/protobuf/testing/googletest.cc b/src/google/protobuf/testing/googletest.cc index c329b6c1..b81d3994 100644 --- a/src/google/protobuf/testing/googletest.cc +++ b/src/google/protobuf/testing/googletest.cc @@ -132,7 +132,7 @@ string GetTemporaryDirectoryName() { // with "\\?\") but these will be degenerate in the sense that you cannot // chdir into such directories (or navigate into them with Windows Explorer) // nor can you open such files with some programs (e.g. Notepad). - if (result.back() == '.') { + if (result[result.size() - 1] == '.') { result[result.size() - 1] = '_'; } // On Win32, tmpnam() returns a file prefixed with '\', but which is supposed -- cgit v1.2.3 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 --- Makefile.am | 14 +- conformance/failure_list_csharp.txt | 1 - .../Google.Protobuf.Test/GeneratedMessageTest.cs | 12 +- csharp/generate_protos.sh | 30 +- csharp/protos/README.md | 3 + csharp/protos/map_unittest_proto3.proto | 116 +++ csharp/protos/unittest_import_proto3.proto | 56 ++ csharp/protos/unittest_import_public_proto3.proto | 41 + csharp/protos/unittest_issues.proto | 1 - csharp/protos/unittest_proto3.proto | 380 ++++++++ csharp/src/AddressBook/Addressbook.cs | 54 +- .../src/Google.Protobuf.Conformance/Conformance.cs | 38 +- .../Collections/MapFieldTest.cs | 43 + .../Collections/ProtobufEqualityComparersTest.cs | 124 +++ .../Collections/RepeatedFieldTest.cs | 13 + .../Google.Protobuf.Test/GeneratedMessageTest.cs | 21 +- .../src/Google.Protobuf.Test/JsonFormatterTest.cs | 6 +- csharp/src/Google.Protobuf.Test/JsonParserTest.cs | 4 +- .../Reflection/DescriptorsTest.cs | 34 +- csharp/src/Google.Protobuf.Test/SampleNaNs.cs | 53 ++ .../TestProtos/MapUnittestProto3.cs | 370 +++++--- .../TestProtos/TestMessagesProto3.cs | 95 +- .../TestProtos/UnittestCustomOptionsProto3.cs | 342 +++++++- .../TestProtos/UnittestImportProto3.cs | 40 +- .../TestProtos/UnittestImportPublicProto3.cs | 34 +- .../TestProtos/UnittestIssues.cs | 218 ++++- .../TestProtos/UnittestProto3.cs | 970 ++++++++++++++++----- .../TestProtos/UnittestWellKnownTypes.cs | 131 ++- .../Google.Protobuf.Test/UnknownFieldSetTest.cs | 128 +++ .../Google.Protobuf.Test/WellKnownTypes/AnyTest.cs | 6 +- .../WellKnownTypes/WrappersTest.cs | 11 + 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 +++- .../protobuf/compiler/csharp/csharp_message.cc | 102 ++- .../compiler/csharp/csharp_primitive_field.cc | 20 +- .../compiler/csharp/csharp_reflection_class.cc | 6 +- .../compiler/csharp/csharp_wrapper_field.cc | 22 +- 55 files changed, 4529 insertions(+), 769 deletions(-) create mode 100644 csharp/protos/README.md create mode 100644 csharp/protos/map_unittest_proto3.proto create mode 100644 csharp/protos/unittest_import_proto3.proto create mode 100644 csharp/protos/unittest_import_public_proto3.proto create mode 100644 csharp/protos/unittest_proto3.proto create mode 100644 csharp/src/Google.Protobuf.Test/Collections/ProtobufEqualityComparersTest.cs create mode 100644 csharp/src/Google.Protobuf.Test/SampleNaNs.cs create mode 100644 csharp/src/Google.Protobuf.Test/UnknownFieldSetTest.cs 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 diff --git a/Makefile.am b/Makefile.am index cba02e3d..19a16071 100644 --- a/Makefile.am +++ b/Makefile.am @@ -61,8 +61,13 @@ csharp_EXTRA_DIST= \ csharp/keys/Google.Protobuf.public.snk \ csharp/keys/Google.Protobuf.snk \ csharp/keys/README.md \ + csharp/protos/README.md \ + csharp/protos/map_unittest_proto3.proto \ csharp/protos/unittest_custom_options_proto3.proto \ + csharp/protos/unittest_import_public_proto3.proto \ + csharp/protos/unittest_import_proto3.proto \ csharp/protos/unittest_issues.proto \ + csharp/protos/unittest_proto3.proto \ csharp/src/AddressBook/AddPerson.cs \ csharp/src/AddressBook/Addressbook.cs \ csharp/src/AddressBook/AddressBook.csproj \ @@ -79,6 +84,7 @@ csharp_EXTRA_DIST= \ csharp/src/Google.Protobuf.Test/CodedInputStreamTest.cs \ csharp/src/Google.Protobuf.Test/CodedOutputStreamTest.cs \ csharp/src/Google.Protobuf.Test/Collections/MapFieldTest.cs \ + csharp/src/Google.Protobuf.Test/Collections/ProtobufEqualityComparersTest.cs \ csharp/src/Google.Protobuf.Test/Collections/RepeatedFieldTest.cs \ csharp/src/Google.Protobuf.Test/Compatibility/PropertyInfoExtensionsTest.cs \ csharp/src/Google.Protobuf.Test/Compatibility/StreamExtensionsTest.cs \ @@ -99,6 +105,7 @@ csharp_EXTRA_DIST= \ csharp/src/Google.Protobuf.Test/Reflection/TypeRegistryTest.cs \ csharp/src/Google.Protobuf.Test/SampleEnum.cs \ csharp/src/Google.Protobuf.Test/SampleMessages.cs \ + csharp/src/Google.Protobuf.Test/SampleNaNs.cs \ csharp/src/Google.Protobuf.Test/TestCornerCases.cs \ csharp/src/Google.Protobuf.Test/TestProtos/ForeignMessagePartial.cs \ csharp/src/Google.Protobuf.Test/TestProtos/MapUnittestProto3.cs \ @@ -114,13 +121,16 @@ csharp_EXTRA_DIST= \ csharp/src/Google.Protobuf.Test/WellKnownTypes/FieldMaskTest.cs \ csharp/src/Google.Protobuf.Test/WellKnownTypes/TimestampTest.cs \ csharp/src/Google.Protobuf.Test/WellKnownTypes/WrappersTest.cs \ + csharp/src/Google.Protobuf.Test/UnknownFieldSetTest.cs \ csharp/src/Google.Protobuf.sln \ csharp/src/Google.Protobuf/ByteArray.cs \ csharp/src/Google.Protobuf/ByteString.cs \ csharp/src/Google.Protobuf/CodedInputStream.cs \ csharp/src/Google.Protobuf/CodedOutputStream.ComputeSize.cs \ csharp/src/Google.Protobuf/CodedOutputStream.cs \ + csharp/src/Google.Protobuf/Collections/Lists.cs \ csharp/src/Google.Protobuf/Collections/MapField.cs \ + csharp/src/Google.Protobuf/Collections/ProtobufEqualityComparers.cs \ csharp/src/Google.Protobuf/Collections/ReadOnlyDictionary.cs \ csharp/src/Google.Protobuf/Collections/RepeatedField.cs \ csharp/src/Google.Protobuf/Compatibility/PropertyInfoExtensions.cs \ @@ -188,7 +198,9 @@ csharp_EXTRA_DIST= \ csharp/src/Google.Protobuf/WellKnownTypes/ValuePartial.cs \ csharp/src/Google.Protobuf/WellKnownTypes/Wrappers.cs \ csharp/src/Google.Protobuf/WellKnownTypes/WrappersPartial.cs \ - csharp/src/Google.Protobuf/WireFormat.cs + csharp/src/Google.Protobuf/WireFormat.cs \ + csharp/src/Google.Protobuf/UnknownField.cs \ + csharp/src/Google.Protobuf/UnknownFieldSet.cs java_EXTRA_DIST= \ java/README.md \ diff --git a/conformance/failure_list_csharp.txt b/conformance/failure_list_csharp.txt index cd84e693..2a20aa78 100644 --- a/conformance/failure_list_csharp.txt +++ b/conformance/failure_list_csharp.txt @@ -1,3 +1,2 @@ Recommended.Proto3.JsonInput.BytesFieldBase64Url.JsonOutput Recommended.Proto3.JsonInput.BytesFieldBase64Url.ProtobufOutput -Required.Proto3.ProtobufInput.UnknownVarint.ProtobufOutput diff --git a/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/GeneratedMessageTest.cs b/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/GeneratedMessageTest.cs index 8b153d69..429c51ff 100644 --- a/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/GeneratedMessageTest.cs +++ b/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/GeneratedMessageTest.cs @@ -638,7 +638,7 @@ namespace Google.Protobuf } [Test] - public void IgnoreUnknownFields_RealDataStillRead() + public void DiscardUnknownFields_RealDataStillRead() { var message = SampleMessages.CreateFullTestAllTypes(); var stream = new MemoryStream(); @@ -652,16 +652,18 @@ namespace Google.Protobuf stream.Position = 0; var parsed = TestAllTypes.Parser.ParseFrom(stream); - Assert.AreEqual(message, parsed); + // TODO(jieluo): Add test back after DiscardUnknownFields is supported + // Assert.AreEqual(message, parsed); } [Test] - public void IgnoreUnknownFields_AllTypes() + public void DiscardUnknownFields_AllTypes() { // Simple way of ensuring we can skip all kinds of fields. var data = SampleMessages.CreateFullTestAllTypes().ToByteArray(); var empty = Empty.Parser.ParseFrom(data); - Assert.AreEqual(new Empty(), empty); + // TODO(jieluo): Add test back after DiscardUnknownField is supported. + // Assert.AreEqual(new Empty(), empty); } // This was originally seen as a conformance test failure. @@ -720,4 +722,4 @@ namespace Google.Protobuf Assert.AreEqual("{ \"c\": 31 }", writer.ToString()); } } -} \ No newline at end of file +} diff --git a/csharp/generate_protos.sh b/csharp/generate_protos.sh index d2f47479..5c748e35 100755 --- a/csharp/generate_protos.sh +++ b/csharp/generate_protos.sh @@ -3,7 +3,7 @@ # You first need to make sure protoc has been built (see instructions on # building protoc in root of this repository) -set -ex +set -e # cd to repository root pushd $(dirname $0)/.. @@ -40,28 +40,20 @@ $PROTOC -Isrc --csharp_out=csharp/src/Google.Protobuf \ src/google/protobuf/type.proto \ src/google/protobuf/wrappers.proto -# Test protos where the namespace matches the target location -$PROTOC -Isrc --csharp_out=csharp/src/Google.Protobuf.Test \ - --csharp_opt=base_namespace=Google.Protobuf \ - src/google/protobuf/map_unittest_proto3.proto \ - src/google/protobuf/unittest_proto3.proto \ - src/google/protobuf/unittest_import_proto3.proto \ - src/google/protobuf/unittest_import_public_proto3.proto \ - src/google/protobuf/unittest_well_known_types.proto - -# Different base namespace to the protos above -$PROTOC -Isrc -Icsharp/protos --csharp_out=csharp/src/Google.Protobuf.Test \ - --csharp_opt=base_namespace=UnitTest.Issues \ +# Test protos +$PROTOC -Isrc -Icsharp/protos \ + --csharp_out=csharp/src/Google.Protobuf.Test/TestProtos \ + csharp/protos/map_unittest_proto3.proto \ csharp/protos/unittest_issues.proto \ - csharp/protos/unittest_custom_options_proto3.proto - -# Don't specify a base namespace at all; we just want to make sure the -# results end up in TestProtos. -$PROTOC -Isrc --csharp_out=csharp/src/Google.Protobuf.Test/TestProtos \ + csharp/protos/unittest_custom_options_proto3.proto \ + csharp/protos/unittest_proto3.proto \ + csharp/protos/unittest_import_proto3.proto \ + csharp/protos/unittest_import_public_proto3.proto \ + src/google/protobuf/unittest_well_known_types.proto \ src/google/protobuf/test_messages_proto3.proto # AddressBook sample protos -$PROTOC -Iexamples --csharp_out=csharp/src/AddressBook \ +$PROTOC -Iexamples -Isrc --csharp_out=csharp/src/AddressBook \ examples/addressbook.proto $PROTOC -Iconformance -Isrc --csharp_out=csharp/src/Google.Protobuf.Conformance \ diff --git a/csharp/protos/README.md b/csharp/protos/README.md new file mode 100644 index 00000000..bdd66fcf --- /dev/null +++ b/csharp/protos/README.md @@ -0,0 +1,3 @@ +This directory contains unit test protos adapted from those in +src/google/protobuf, and C#-specific test protos for regression +tests against bugs found in the C# codegen or library. diff --git a/csharp/protos/map_unittest_proto3.proto b/csharp/protos/map_unittest_proto3.proto new file mode 100644 index 00000000..e43e858b --- /dev/null +++ b/csharp/protos/map_unittest_proto3.proto @@ -0,0 +1,116 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// This file is mostly equivalent to map_unittest.proto, but imports +// unittest_proto3.proto instead of unittest.proto, so that it only +// uses proto3 messages. This makes it suitable for testing +// implementations which only support proto3. +// The TestRequiredMessageMap message has been removed as there are no +// required fields in proto3. +syntax = "proto3"; + +option csharp_namespace = "Google.Protobuf.TestProtos"; + +import "unittest_proto3.proto"; + +package protobuf_unittest3; + +// Tests maps. +message TestMap { + map map_int32_int32 = 1; + map map_int64_int64 = 2; + map map_uint32_uint32 = 3; + map map_uint64_uint64 = 4; + map map_sint32_sint32 = 5; + map map_sint64_sint64 = 6; + map map_fixed32_fixed32 = 7; + map map_fixed64_fixed64 = 8; + map map_sfixed32_sfixed32 = 9; + map map_sfixed64_sfixed64 = 10; + map map_int32_float = 11; + map map_int32_double = 12; + map map_bool_bool = 13; + map map_string_string = 14; + map map_int32_bytes = 15; + map map_int32_enum = 16; + map map_int32_foreign_message = 17; +} + +message TestMapSubmessage { + TestMap test_map = 1; +} + +message TestMessageMap { + map map_int32_message = 1; +} + +// Two map fields share the same entry default instance. +message TestSameTypeMap { + map map1 = 1; + map map2 = 2; +} + +enum MapEnum { + MAP_ENUM_FOO = 0; + MAP_ENUM_BAR = 1; + MAP_ENUM_BAZ = 2; +} + +message TestArenaMap { + map map_int32_int32 = 1; + map map_int64_int64 = 2; + map map_uint32_uint32 = 3; + map map_uint64_uint64 = 4; + map map_sint32_sint32 = 5; + map map_sint64_sint64 = 6; + map map_fixed32_fixed32 = 7; + map map_fixed64_fixed64 = 8; + map map_sfixed32_sfixed32 = 9; + map map_sfixed64_sfixed64 = 10; + map map_int32_float = 11; + map map_int32_double = 12; + map map_bool_bool = 13; + map map_int32_enum = 14; + map map_int32_foreign_message = 15; +} + +// Previously, message containing enum called Type cannot be used as value of +// map field. +message MessageContainingEnumCalledType { + enum Type { + TYPE_FOO = 0; + } + map type = 1; +} + +// Previously, message cannot contain map field called "entry". +message MessageContainingMapCalledEntry { + map entry = 1; +} diff --git a/csharp/protos/unittest_import_proto3.proto b/csharp/protos/unittest_import_proto3.proto new file mode 100644 index 00000000..2e666822 --- /dev/null +++ b/csharp/protos/unittest_import_proto3.proto @@ -0,0 +1,56 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Author: kenton@google.com (Kenton Varda) +// Based on original Protocol Buffers design by +// Sanjay Ghemawat, Jeff Dean, and others. +// +// A proto file which is imported by unittest_proto3.proto to test importing. + +syntax = "proto3"; + +package protobuf_unittest_import; + +option csharp_namespace = "Google.Protobuf.TestProtos"; + +// Test public import +import public "unittest_import_public_proto3.proto"; + +message ImportMessage { + int32 d = 1; +} + +enum ImportEnum { + IMPORT_ENUM_UNSPECIFIED = 0; + IMPORT_FOO = 7; + IMPORT_BAR = 8; + IMPORT_BAZ = 9; +} + diff --git a/csharp/protos/unittest_import_public_proto3.proto b/csharp/protos/unittest_import_public_proto3.proto new file mode 100644 index 00000000..88c20799 --- /dev/null +++ b/csharp/protos/unittest_import_public_proto3.proto @@ -0,0 +1,41 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Author: liujisi@google.com (Pherl Liu) + +syntax = "proto3"; + +package protobuf_unittest_import; + +option csharp_namespace = "Google.Protobuf.TestProtos"; + +message PublicImportMessage { + int32 e = 1; +} diff --git a/csharp/protos/unittest_issues.proto b/csharp/protos/unittest_issues.proto index 332c81dc..0d8793e1 100644 --- a/csharp/protos/unittest_issues.proto +++ b/csharp/protos/unittest_issues.proto @@ -7,7 +7,6 @@ syntax = "proto3"; option csharp_namespace = "UnitTest.Issues.TestProtos"; package unittest_issues; -option optimize_for = SPEED; // Issue 307: when generating doubly-nested types, any references // should be of the form A.Types.B.Types.C. diff --git a/csharp/protos/unittest_proto3.proto b/csharp/protos/unittest_proto3.proto new file mode 100644 index 00000000..ef4933a5 --- /dev/null +++ b/csharp/protos/unittest_proto3.proto @@ -0,0 +1,380 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Author: kenton@google.com (Kenton Varda) +// Based on original Protocol Buffers design by +// Sanjay Ghemawat, Jeff Dean, and others. +// +// A proto file we will use for unit testing. + +syntax = "proto3"; + +option csharp_namespace = "Google.Protobuf.TestProtos"; + +// Only present so we can test that we can read it (as an example +// of a non-C# option) +option java_outer_classname = "UnittestProto"; + +import "unittest_import_proto3.proto"; + +package protobuf_unittest3; + +// This proto includes every type of field in both singular and repeated +// forms. +message TestAllTypes { + message NestedMessage { + // The field name "b" fails to compile in proto1 because it conflicts with + // a local variable named "b" in one of the generated methods. Doh. + // This file needs to compile in proto1 to test backwards-compatibility. + int32 bb = 1; + } + + enum NestedEnum { + NESTED_ENUM_UNSPECIFIED = 0; + FOO = 1; + BAR = 2; + BAZ = 3; + NEG = -1; // Intentionally negative. + } + + // Singular + int32 single_int32 = 1; + int64 single_int64 = 2; + uint32 single_uint32 = 3; + uint64 single_uint64 = 4; + sint32 single_sint32 = 5; + sint64 single_sint64 = 6; + fixed32 single_fixed32 = 7; + fixed64 single_fixed64 = 8; + sfixed32 single_sfixed32 = 9; + sfixed64 single_sfixed64 = 10; + float single_float = 11; + double single_double = 12; + bool single_bool = 13; + string single_string = 14; + bytes single_bytes = 15; + + NestedMessage single_nested_message = 18; + ForeignMessage single_foreign_message = 19; + protobuf_unittest_import.ImportMessage single_import_message = 20; + + NestedEnum single_nested_enum = 21; + ForeignEnum single_foreign_enum = 22; + protobuf_unittest_import.ImportEnum single_import_enum = 23; + + // Defined in unittest_import_public.proto + protobuf_unittest_import.PublicImportMessage + single_public_import_message = 26; + + // Repeated + repeated int32 repeated_int32 = 31; + repeated int64 repeated_int64 = 32; + repeated uint32 repeated_uint32 = 33; + repeated uint64 repeated_uint64 = 34; + repeated sint32 repeated_sint32 = 35; + repeated sint64 repeated_sint64 = 36; + repeated fixed32 repeated_fixed32 = 37; + repeated fixed64 repeated_fixed64 = 38; + repeated sfixed32 repeated_sfixed32 = 39; + repeated sfixed64 repeated_sfixed64 = 40; + repeated float repeated_float = 41; + repeated double repeated_double = 42; + repeated bool repeated_bool = 43; + repeated string repeated_string = 44; + repeated bytes repeated_bytes = 45; + + repeated NestedMessage repeated_nested_message = 48; + repeated ForeignMessage repeated_foreign_message = 49; + repeated protobuf_unittest_import.ImportMessage repeated_import_message = 50; + + repeated NestedEnum repeated_nested_enum = 51; + repeated ForeignEnum repeated_foreign_enum = 52; + repeated protobuf_unittest_import.ImportEnum repeated_import_enum = 53; + // Defined in unittest_import_public.proto + repeated protobuf_unittest_import.PublicImportMessage + repeated_public_import_message = 54; + + // For oneof test + oneof oneof_field { + uint32 oneof_uint32 = 111; + NestedMessage oneof_nested_message = 112; + string oneof_string = 113; + bytes oneof_bytes = 114; + } +} + +// This proto includes a recusively nested message. +message NestedTestAllTypes { + NestedTestAllTypes child = 1; + TestAllTypes payload = 2; + repeated NestedTestAllTypes repeated_child = 3; +} + +message TestDeprecatedFields { + int32 deprecated_int32 = 1 [deprecated=true]; +} + +// Define these after TestAllTypes to make sure the compiler can handle +// that. +message ForeignMessage { + int32 c = 1; +} + +enum ForeignEnum { + FOREIGN_UNSPECIFIED = 0; + FOREIGN_FOO = 4; + FOREIGN_BAR = 5; + FOREIGN_BAZ = 6; +} + +message TestReservedFields { + reserved 2, 15, 9 to 11; + reserved "bar", "baz"; +} + + +// Test that we can use NestedMessage from outside TestAllTypes. +message TestForeignNested { + TestAllTypes.NestedMessage foreign_nested = 1; +} + +// Test that really large tag numbers don't break anything. +message TestReallyLargeTagNumber { + // The largest possible tag number is 2^28 - 1, since the wire format uses + // three bits to communicate wire type. + int32 a = 1; + int32 bb = 268435455; +} + +message TestRecursiveMessage { + TestRecursiveMessage a = 1; + int32 i = 2; +} + +// Test that mutual recursion works. +message TestMutualRecursionA { + TestMutualRecursionB bb = 1; +} + +message TestMutualRecursionB { + TestMutualRecursionA a = 1; + int32 optional_int32 = 2; +} + +message TestEnumAllowAlias { + TestEnumWithDupValue value = 1; +} + +// Test an enum that has multiple values with the same number. +enum TestEnumWithDupValue { + TEST_ENUM_WITH_DUP_VALUE_UNSPECIFIED = 0; + option allow_alias = true; + + FOO1 = 1; + BAR1 = 2; + BAZ = 3; + FOO2 = 1; + BAR2 = 2; +} + +// Test an enum with large, unordered values. +enum TestSparseEnum { + TEST_SPARSE_ENUM_UNSPECIFIED = 0; + SPARSE_A = 123; + SPARSE_B = 62374; + SPARSE_C = 12589234; + SPARSE_D = -15; + SPARSE_E = -53452; + // In proto3, value 0 must be the first one specified + // SPARSE_F = 0; + SPARSE_G = 2; +} + +// Test message with CamelCase field names. This violates Protocol Buffer +// standard style. +message TestCamelCaseFieldNames { + int32 PrimitiveField = 1; + string StringField = 2; + ForeignEnum EnumField = 3; + ForeignMessage MessageField = 4; + + repeated int32 RepeatedPrimitiveField = 7; + repeated string RepeatedStringField = 8; + repeated ForeignEnum RepeatedEnumField = 9; + repeated ForeignMessage RepeatedMessageField = 10; +} + + +// We list fields out of order, to ensure that we're using field number and not +// field index to determine serialization order. +message TestFieldOrderings { + string my_string = 11; + int64 my_int = 1; + float my_float = 101; + message NestedMessage { + int64 oo = 2; + // The field name "b" fails to compile in proto1 because it conflicts with + // a local variable named "b" in one of the generated methods. Doh. + // This file needs to compile in proto1 to test backwards-compatibility. + int32 bb = 1; + } + + NestedMessage single_nested_message = 200; +} + +message SparseEnumMessage { + TestSparseEnum sparse_enum = 1; +} + +// Test String and Bytes: string is for valid UTF-8 strings +message OneString { + string data = 1; +} + +message MoreString { + repeated string data = 1; +} + +message OneBytes { + bytes data = 1; +} + +message MoreBytes { + bytes data = 1; +} + +// Test int32, uint32, int64, uint64, and bool are all compatible +message Int32Message { + int32 data = 1; +} + +message Uint32Message { + uint32 data = 1; +} + +message Int64Message { + int64 data = 1; +} + +message Uint64Message { + uint64 data = 1; +} + +message BoolMessage { + bool data = 1; +} + +// Test oneofs. +message TestOneof { + oneof foo { + int32 foo_int = 1; + string foo_string = 2; + TestAllTypes foo_message = 3; + } +} + +// Test messages for packed fields + +message TestPackedTypes { + repeated int32 packed_int32 = 90 [packed = true]; + repeated int64 packed_int64 = 91 [packed = true]; + repeated uint32 packed_uint32 = 92 [packed = true]; + repeated uint64 packed_uint64 = 93 [packed = true]; + repeated sint32 packed_sint32 = 94 [packed = true]; + repeated sint64 packed_sint64 = 95 [packed = true]; + repeated fixed32 packed_fixed32 = 96 [packed = true]; + repeated fixed64 packed_fixed64 = 97 [packed = true]; + repeated sfixed32 packed_sfixed32 = 98 [packed = true]; + repeated sfixed64 packed_sfixed64 = 99 [packed = true]; + repeated float packed_float = 100 [packed = true]; + repeated double packed_double = 101 [packed = true]; + repeated bool packed_bool = 102 [packed = true]; + repeated ForeignEnum packed_enum = 103 [packed = true]; +} + +// A message with the same fields as TestPackedTypes, but without packing. Used +// to test packed <-> unpacked wire compatibility. +message TestUnpackedTypes { + repeated int32 unpacked_int32 = 90 [packed = false]; + repeated int64 unpacked_int64 = 91 [packed = false]; + repeated uint32 unpacked_uint32 = 92 [packed = false]; + repeated uint64 unpacked_uint64 = 93 [packed = false]; + repeated sint32 unpacked_sint32 = 94 [packed = false]; + repeated sint64 unpacked_sint64 = 95 [packed = false]; + repeated fixed32 unpacked_fixed32 = 96 [packed = false]; + repeated fixed64 unpacked_fixed64 = 97 [packed = false]; + repeated sfixed32 unpacked_sfixed32 = 98 [packed = false]; + repeated sfixed64 unpacked_sfixed64 = 99 [packed = false]; + repeated float unpacked_float = 100 [packed = false]; + repeated double unpacked_double = 101 [packed = false]; + repeated bool unpacked_bool = 102 [packed = false]; + repeated ForeignEnum unpacked_enum = 103 [packed = false]; +} + +message TestRepeatedScalarDifferentTagSizes { + // Parsing repeated fixed size values used to fail. This message needs to be + // used in order to get a tag of the right size; all of the repeated fields + // in TestAllTypes didn't trigger the check. + repeated fixed32 repeated_fixed32 = 12; + // Check for a varint type, just for good measure. + repeated int32 repeated_int32 = 13; + + // These have two-byte tags. + repeated fixed64 repeated_fixed64 = 2046; + repeated int64 repeated_int64 = 2047; + + // Three byte tags. + repeated float repeated_float = 262142; + repeated uint64 repeated_uint64 = 262143; +} + +message TestCommentInjectionMessage { + // */ <- This should not close the generated doc comment + string a = 1; +} + + +// Test that RPC services work. +message FooRequest {} +message FooResponse {} + +message FooClientMessage {} +message FooServerMessage{} + +service TestService { + rpc Foo(FooRequest) returns (FooResponse); + rpc Bar(BarRequest) returns (BarResponse); +} + + +message BarRequest {} +message BarResponse {} + +message TestEmptyMessage {} diff --git a/csharp/src/AddressBook/Addressbook.cs b/csharp/src/AddressBook/Addressbook.cs index e595e58b..ceb93699 100644 --- a/csharp/src/AddressBook/Addressbook.cs +++ b/csharp/src/AddressBook/Addressbook.cs @@ -1,5 +1,7 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: addressbook.proto +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: addressbook.proto +// #pragma warning disable 1591, 0612, 3021 #region Designer generated code @@ -49,6 +51,7 @@ namespace Google.Protobuf.Examples.AddressBook { /// public sealed partial class Person : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Person()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -76,6 +79,7 @@ namespace Google.Protobuf.Examples.AddressBook { email_ = other.email_; phones_ = other.phones_.Clone(); LastUpdated = other.lastUpdated_ != null ? other.LastUpdated.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -158,7 +162,7 @@ namespace Google.Protobuf.Examples.AddressBook { if (Email != other.Email) return false; if(!phones_.Equals(other.phones_)) return false; if (!object.Equals(LastUpdated, other.LastUpdated)) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -169,6 +173,9 @@ namespace Google.Protobuf.Examples.AddressBook { if (Email.Length != 0) hash ^= Email.GetHashCode(); hash ^= phones_.GetHashCode(); if (lastUpdated_ != null) hash ^= LastUpdated.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -196,6 +203,9 @@ namespace Google.Protobuf.Examples.AddressBook { output.WriteRawTag(42); output.WriteMessage(LastUpdated); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -214,6 +224,9 @@ namespace Google.Protobuf.Examples.AddressBook { if (lastUpdated_ != null) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(LastUpdated); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -238,6 +251,7 @@ namespace Google.Protobuf.Examples.AddressBook { } LastUpdated.MergeFrom(other.LastUpdated); } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -246,7 +260,7 @@ namespace Google.Protobuf.Examples.AddressBook { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { Name = input.ReadString(); @@ -287,6 +301,7 @@ namespace Google.Protobuf.Examples.AddressBook { public sealed partial class PhoneNumber : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new PhoneNumber()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -311,6 +326,7 @@ namespace Google.Protobuf.Examples.AddressBook { public PhoneNumber(PhoneNumber other) : this() { number_ = other.number_; type_ = other.type_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -355,7 +371,7 @@ namespace Google.Protobuf.Examples.AddressBook { } if (Number != other.Number) return false; if (Type != other.Type) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -363,6 +379,9 @@ namespace Google.Protobuf.Examples.AddressBook { int hash = 1; if (Number.Length != 0) hash ^= Number.GetHashCode(); if (Type != 0) hash ^= Type.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -381,6 +400,9 @@ namespace Google.Protobuf.Examples.AddressBook { output.WriteRawTag(16); output.WriteEnum((int) Type); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -392,6 +414,9 @@ namespace Google.Protobuf.Examples.AddressBook { if (Type != 0) { size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Type); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -406,6 +431,7 @@ namespace Google.Protobuf.Examples.AddressBook { if (other.Type != 0) { Type = other.Type; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -414,7 +440,7 @@ namespace Google.Protobuf.Examples.AddressBook { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { Number = input.ReadString(); @@ -440,6 +466,7 @@ namespace Google.Protobuf.Examples.AddressBook { /// public sealed partial class AddressBook : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new AddressBook()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -463,6 +490,7 @@ namespace Google.Protobuf.Examples.AddressBook { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public AddressBook(AddressBook other) : this() { people_ = other.people_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -494,13 +522,16 @@ namespace Google.Protobuf.Examples.AddressBook { return true; } if(!people_.Equals(other.people_)) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; hash ^= people_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -512,12 +543,18 @@ namespace Google.Protobuf.Examples.AddressBook { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { people_.WriteTo(output, _repeated_people_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; size += people_.CalculateSize(_repeated_people_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -527,6 +564,7 @@ namespace Google.Protobuf.Examples.AddressBook { return; } people_.Add(other.people_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -535,7 +573,7 @@ namespace Google.Protobuf.Examples.AddressBook { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { people_.AddEntriesFrom(input, _repeated_people_codec); diff --git a/csharp/src/Google.Protobuf.Conformance/Conformance.cs b/csharp/src/Google.Protobuf.Conformance/Conformance.cs index 394607b9..f6118ea2 100644 --- a/csharp/src/Google.Protobuf.Conformance/Conformance.cs +++ b/csharp/src/Google.Protobuf.Conformance/Conformance.cs @@ -1,5 +1,7 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: conformance.proto +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: conformance.proto +// #pragma warning disable 1591, 0612, 3021 #region Designer generated code @@ -62,6 +64,7 @@ namespace Conformance { /// public sealed partial class ConformanceRequest : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ConformanceRequest()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -95,6 +98,7 @@ namespace Conformance { break; } + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -191,7 +195,7 @@ namespace Conformance { if (RequestedOutputFormat != other.RequestedOutputFormat) return false; if (MessageType != other.MessageType) return false; if (PayloadCase != other.PayloadCase) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -202,6 +206,9 @@ namespace Conformance { if (RequestedOutputFormat != 0) hash ^= RequestedOutputFormat.GetHashCode(); if (MessageType.Length != 0) hash ^= MessageType.GetHashCode(); hash ^= (int) payloadCase_; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -228,6 +235,9 @@ namespace Conformance { output.WriteRawTag(34); output.WriteString(MessageType); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -245,6 +255,9 @@ namespace Conformance { if (MessageType.Length != 0) { size += 1 + pb::CodedOutputStream.ComputeStringSize(MessageType); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -268,6 +281,7 @@ namespace Conformance { break; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -276,7 +290,7 @@ namespace Conformance { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { ProtobufPayload = input.ReadBytes(); @@ -305,6 +319,7 @@ namespace Conformance { /// public sealed partial class ConformanceResponse : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ConformanceResponse()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -348,6 +363,7 @@ namespace Conformance { break; } + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -493,7 +509,7 @@ namespace Conformance { if (JsonPayload != other.JsonPayload) return false; if (Skipped != other.Skipped) return false; if (ResultCase != other.ResultCase) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -506,6 +522,9 @@ namespace Conformance { if (resultCase_ == ResultOneofCase.JsonPayload) hash ^= JsonPayload.GetHashCode(); if (resultCase_ == ResultOneofCase.Skipped) hash ^= Skipped.GetHashCode(); hash ^= (int) resultCase_; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -540,6 +559,9 @@ namespace Conformance { output.WriteRawTag(50); output.WriteString(SerializeError); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -563,6 +585,9 @@ namespace Conformance { if (resultCase_ == ResultOneofCase.Skipped) { size += 1 + pb::CodedOutputStream.ComputeStringSize(Skipped); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -592,6 +617,7 @@ namespace Conformance { break; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -600,7 +626,7 @@ namespace Conformance { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { ParseError = input.ReadString(); diff --git a/csharp/src/Google.Protobuf.Test/Collections/MapFieldTest.cs b/csharp/src/Google.Protobuf.Test/Collections/MapFieldTest.cs index 68b4de45..8791dffc 100644 --- a/csharp/src/Google.Protobuf.Test/Collections/MapFieldTest.cs +++ b/csharp/src/Google.Protobuf.Test/Collections/MapFieldTest.cs @@ -540,6 +540,49 @@ namespace Google.Protobuf.Collections Assert.Throws(() => map.ToString()); } + [Test] + public void NaNValuesComparedBitwise() + { + var map1 = new MapField + { + { "x", SampleNaNs.Regular }, + { "y", SampleNaNs.SignallingFlipped } + }; + + var map2 = new MapField + { + { "x", SampleNaNs.Regular }, + { "y", SampleNaNs.PayloadFlipped } + }; + + var map3 = new MapField + { + { "x", SampleNaNs.Regular }, + { "y", SampleNaNs.SignallingFlipped } + }; + + EqualityTester.AssertInequality(map1, map2); + EqualityTester.AssertEquality(map1, map3); + Assert.True(map1.Values.Contains(SampleNaNs.SignallingFlipped)); + Assert.False(map2.Values.Contains(SampleNaNs.SignallingFlipped)); + } + + // This wouldn't usually happen, as protos can't use doubles as map keys, + // but let's be consistent. + [Test] + public void NaNKeysComparedBitwise() + { + var map = new MapField + { + { SampleNaNs.Regular, "x" }, + { SampleNaNs.SignallingFlipped, "y" } + }; + Assert.AreEqual("x", map[SampleNaNs.Regular]); + Assert.AreEqual("y", map[SampleNaNs.SignallingFlipped]); + string ignored; + Assert.False(map.TryGetValue(SampleNaNs.PayloadFlipped, out ignored)); + } + #if !NET35 [Test] public void IDictionaryKeys_Equals_IReadOnlyDictionaryKeys() diff --git a/csharp/src/Google.Protobuf.Test/Collections/ProtobufEqualityComparersTest.cs b/csharp/src/Google.Protobuf.Test/Collections/ProtobufEqualityComparersTest.cs new file mode 100644 index 00000000..c76d7ca1 --- /dev/null +++ b/csharp/src/Google.Protobuf.Test/Collections/ProtobufEqualityComparersTest.cs @@ -0,0 +1,124 @@ +#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 NUnit.Framework; +using System.Collections.Generic; +using System.Linq; +using static Google.Protobuf.Collections.ProtobufEqualityComparers; + +namespace Google.Protobuf.Collections +{ + public class ProtobufEqualityComparersTest + { + private static readonly double[] doubles = + { + 0, + 1, + 1.5, + -1.5, + double.PositiveInfinity, + double.NegativeInfinity, + // Three different types of NaN... + SampleNaNs.Regular, + SampleNaNs.SignallingFlipped, + SampleNaNs.PayloadFlipped + }; + + [Test] + public void GetEqualityComparer_Default() + { + // It's more pain than it's worth to try to parameterize these tests. + Assert.AreSame(EqualityComparer.Default, GetEqualityComparer()); + Assert.AreSame(EqualityComparer.Default, GetEqualityComparer()); + Assert.AreSame(EqualityComparer.Default, GetEqualityComparer()); + Assert.AreSame(EqualityComparer.Default, GetEqualityComparer()); + } + + [Test] + public void GetEqualityComparer_NotDefault() + { + // It's more pain than it's worth to try to parameterize these tests. + Assert.AreSame(BitwiseDoubleEqualityComparer, GetEqualityComparer()); + Assert.AreSame(BitwiseSingleEqualityComparer, GetEqualityComparer()); + Assert.AreSame(BitwiseNullableDoubleEqualityComparer, GetEqualityComparer()); + Assert.AreSame(BitwiseNullableSingleEqualityComparer, GetEqualityComparer()); + } + + [Test] + public void DoubleComparisons() + { + ValidateEqualityComparer(BitwiseDoubleEqualityComparer, doubles); + } + + [Test] + public void NullableDoubleComparisons() + { + ValidateEqualityComparer(BitwiseNullableDoubleEqualityComparer, doubles.Select(d => (double?) d).Concat(new double?[] { null })); + } + + [Test] + public void SingleComparisons() + { + ValidateEqualityComparer(BitwiseSingleEqualityComparer, doubles.Select(d => (float) d)); + } + + [Test] + public void NullableSingleComparisons() + { + ValidateEqualityComparer(BitwiseNullableSingleEqualityComparer, doubles.Select(d => (float?) d).Concat(new float?[] { null })); + } + + private static void ValidateEqualityComparer(EqualityComparer comparer, IEnumerable values) + { + var array = values.ToArray(); + // Each value should be equal to itself, but not to any other value. + for (int i = 0; i < array.Length; i++) + { + for (int j = 0; j < array.Length; j++) + { + if (i == j) + { + Assert.IsTrue(comparer.Equals(array[i], array[j]), + "{0} should be equal to itself", array[i], array[j]); + } + else + { + Assert.IsFalse(comparer.Equals(array[i], array[j]), + "{0} and {1} should not be equal", array[i], array[j]); + Assert.AreNotEqual(comparer.GetHashCode(array[i]), comparer.GetHashCode(array[j]), + "Hash codes for {0} and {1} should not be equal", array[i], array[j]); + } + } + } + } + } +} diff --git a/csharp/src/Google.Protobuf.Test/Collections/RepeatedFieldTest.cs b/csharp/src/Google.Protobuf.Test/Collections/RepeatedFieldTest.cs index 6852f75f..129923b6 100644 --- a/csharp/src/Google.Protobuf.Test/Collections/RepeatedFieldTest.cs +++ b/csharp/src/Google.Protobuf.Test/Collections/RepeatedFieldTest.cs @@ -742,5 +742,18 @@ namespace Google.Protobuf.Collections var text = list.ToString(); Assert.AreEqual(text, "[ { \"foo\": 20 } ]", message.ToString()); } + + [Test] + public void NaNValuesComparedBitwise() + { + var list1 = new RepeatedField { SampleNaNs.Regular, SampleNaNs.SignallingFlipped }; + var list2 = new RepeatedField { SampleNaNs.Regular, SampleNaNs.PayloadFlipped }; + var list3 = new RepeatedField { SampleNaNs.Regular, SampleNaNs.SignallingFlipped }; + + EqualityTester.AssertInequality(list1, list2); + EqualityTester.AssertEquality(list1, list3); + Assert.True(list1.Contains(SampleNaNs.SignallingFlipped)); + Assert.False(list2.Contains(SampleNaNs.SignallingFlipped)); + } } } diff --git a/csharp/src/Google.Protobuf.Test/GeneratedMessageTest.cs b/csharp/src/Google.Protobuf.Test/GeneratedMessageTest.cs index 8b153d69..5694754e 100644 --- a/csharp/src/Google.Protobuf.Test/GeneratedMessageTest.cs +++ b/csharp/src/Google.Protobuf.Test/GeneratedMessageTest.cs @@ -638,7 +638,7 @@ namespace Google.Protobuf } [Test] - public void IgnoreUnknownFields_RealDataStillRead() + public void DiscardUnknownFields_RealDataStillRead() { var message = SampleMessages.CreateFullTestAllTypes(); var stream = new MemoryStream(); @@ -652,16 +652,18 @@ namespace Google.Protobuf stream.Position = 0; var parsed = TestAllTypes.Parser.ParseFrom(stream); - Assert.AreEqual(message, parsed); + // TODO(jieluo): Add test back when DiscardUnknownFields API is supported. + // Assert.AreEqual(message, parsed); } [Test] - public void IgnoreUnknownFields_AllTypes() + public void DiscardUnknownFields_AllTypes() { // Simple way of ensuring we can skip all kinds of fields. var data = SampleMessages.CreateFullTestAllTypes().ToByteArray(); var empty = Empty.Parser.ParseFrom(data); - Assert.AreEqual(new Empty(), empty); + // TODO(jieluo): Add test back when DiscardUnknownFields API is supported. + // Assert.AreNotEqual(new Empty(), empty); } // This was originally seen as a conformance test failure. @@ -719,5 +721,16 @@ namespace Google.Protobuf JsonFormatter.Default.Format(message, writer); Assert.AreEqual("{ \"c\": 31 }", writer.ToString()); } + + [Test] + public void NaNComparisons() + { + var message1 = new TestAllTypes { SingleDouble = SampleNaNs.Regular }; + var message2 = new TestAllTypes { SingleDouble = SampleNaNs.PayloadFlipped }; + var message3 = new TestAllTypes { SingleDouble = SampleNaNs.Regular }; + + EqualityTester.AssertInequality(message1, message2); + EqualityTester.AssertEquality(message1, message3); + } } } \ No newline at end of file diff --git a/csharp/src/Google.Protobuf.Test/JsonFormatterTest.cs b/csharp/src/Google.Protobuf.Test/JsonFormatterTest.cs index 53ac3dc9..1c7a8cdf 100644 --- a/csharp/src/Google.Protobuf.Test/JsonFormatterTest.cs +++ b/csharp/src/Google.Protobuf.Test/JsonFormatterTest.cs @@ -514,7 +514,7 @@ namespace Google.Protobuf var formatter = new JsonFormatter(JsonFormatter.Settings.Default.WithTypeRegistry(TypeRegistry.FromMessages(TestAllTypes.Descriptor))); var message = new TestAllTypes { SingleInt32 = 10, SingleNestedMessage = new TestAllTypes.Types.NestedMessage { Bb = 20 } }; var any = Any.Pack(message); - AssertJson("{ '@type': 'type.googleapis.com/protobuf_unittest.TestAllTypes', 'singleInt32': 10, 'singleNestedMessage': { 'bb': 20 } }", formatter.Format(any)); + AssertJson("{ '@type': 'type.googleapis.com/protobuf_unittest3.TestAllTypes', 'singleInt32': 10, 'singleNestedMessage': { 'bb': 20 } }", formatter.Format(any)); } [Test] @@ -523,7 +523,7 @@ namespace Google.Protobuf var formatter = new JsonFormatter(JsonFormatter.Settings.Default.WithTypeRegistry(TypeRegistry.FromMessages(TestAllTypes.Descriptor))); var message = new TestAllTypes { SingleInt32 = 10 }; var any = Any.Pack(message, "foo.bar/baz"); - AssertJson("{ '@type': 'foo.bar/baz/protobuf_unittest.TestAllTypes', 'singleInt32': 10 }", formatter.Format(any)); + AssertJson("{ '@type': 'foo.bar/baz/protobuf_unittest3.TestAllTypes', 'singleInt32': 10 }", formatter.Format(any)); } [Test] @@ -536,7 +536,7 @@ namespace Google.Protobuf var doubleNestedMessage = new TestAllTypes { SingleInt32 = 20 }; var nestedMessage = Any.Pack(doubleNestedMessage); var message = new TestWellKnownTypes { AnyField = Any.Pack(nestedMessage) }; - AssertJson("{ 'anyField': { '@type': 'type.googleapis.com/google.protobuf.Any', 'value': { '@type': 'type.googleapis.com/protobuf_unittest.TestAllTypes', 'singleInt32': 20 } } }", + AssertJson("{ 'anyField': { '@type': 'type.googleapis.com/google.protobuf.Any', 'value': { '@type': 'type.googleapis.com/protobuf_unittest3.TestAllTypes', 'singleInt32': 20 } } }", formatter.Format(message)); } diff --git a/csharp/src/Google.Protobuf.Test/JsonParserTest.cs b/csharp/src/Google.Protobuf.Test/JsonParserTest.cs index 2c515433..329ae9be 100644 --- a/csharp/src/Google.Protobuf.Test/JsonParserTest.cs +++ b/csharp/src/Google.Protobuf.Test/JsonParserTest.cs @@ -809,7 +809,7 @@ namespace Google.Protobuf var json = formatter.Format(original); // This is tested in JsonFormatterTest var parser = new JsonParser(new JsonParser.Settings(10, registry)); Assert.AreEqual(original, parser.Parse(json)); - string valueFirstJson = "{ \"singleInt32\": 10, \"singleNestedMessage\": { \"bb\": 20 }, \"@type\": \"type.googleapis.com/protobuf_unittest.TestAllTypes\" }"; + string valueFirstJson = "{ \"singleInt32\": 10, \"singleNestedMessage\": { \"bb\": 20 }, \"@type\": \"type.googleapis.com/protobuf_unittest3.TestAllTypes\" }"; Assert.AreEqual(original, parser.Parse(valueFirstJson)); } @@ -820,7 +820,7 @@ namespace Google.Protobuf var message = new TestAllTypes { SingleInt32 = 10 }; var original = Any.Pack(message, "custom.prefix/middle-part"); var parser = new JsonParser(new JsonParser.Settings(10, registry)); - string json = "{ \"@type\": \"custom.prefix/middle-part/protobuf_unittest.TestAllTypes\", \"singleInt32\": 10 }"; + string json = "{ \"@type\": \"custom.prefix/middle-part/protobuf_unittest3.TestAllTypes\", \"singleInt32\": 10 }"; Assert.AreEqual(original, parser.Parse(json)); } diff --git a/csharp/src/Google.Protobuf.Test/Reflection/DescriptorsTest.cs b/csharp/src/Google.Protobuf.Test/Reflection/DescriptorsTest.cs index 52d5a676..29a376e0 100644 --- a/csharp/src/Google.Protobuf.Test/Reflection/DescriptorsTest.cs +++ b/csharp/src/Google.Protobuf.Test/Reflection/DescriptorsTest.cs @@ -48,13 +48,13 @@ namespace Google.Protobuf.Reflection { FileDescriptor file = UnittestProto3Reflection.Descriptor; - Assert.AreEqual("google/protobuf/unittest_proto3.proto", file.Name); - Assert.AreEqual("protobuf_unittest", file.Package); + Assert.AreEqual("unittest_proto3.proto", file.Name); + Assert.AreEqual("protobuf_unittest3", file.Package); Assert.AreEqual("UnittestProto", file.Proto.Options.JavaOuterClassname); - Assert.AreEqual("google/protobuf/unittest_proto3.proto", file.Proto.Name); + Assert.AreEqual("unittest_proto3.proto", file.Proto.Name); - // unittest.proto doesn't have any public imports, but unittest_import.proto does. + // unittest_proto3.proto doesn't have any public imports, but unittest_import_proto3.proto does. Assert.AreEqual(0, file.PublicDependencies.Count); Assert.AreEqual(1, UnittestImportProto3Reflection.Descriptor.PublicDependencies.Count); Assert.AreEqual(UnittestImportPublicProto3Reflection.Descriptor, UnittestImportProto3Reflection.Descriptor.PublicDependencies[0]); @@ -68,7 +68,7 @@ namespace Google.Protobuf.Reflection Assert.AreEqual(messageType, file.MessageTypes[0]); Assert.AreEqual(messageType, file.FindTypeByName("TestAllTypes")); Assert.Null(file.FindTypeByName("NoSuchType")); - Assert.Null(file.FindTypeByName("protobuf_unittest.TestAllTypes")); + Assert.Null(file.FindTypeByName("protobuf_unittest3.TestAllTypes")); for (int i = 0; i < file.MessageTypes.Count; i++) { Assert.AreEqual(i, file.MessageTypes[i].Index); @@ -76,7 +76,7 @@ namespace Google.Protobuf.Reflection Assert.AreEqual(file.EnumTypes[0], file.FindTypeByName("ForeignEnum")); Assert.Null(file.FindTypeByName("NoSuchType")); - Assert.Null(file.FindTypeByName("protobuf_unittest.ForeignEnum")); + Assert.Null(file.FindTypeByName("protobuf_unittest3.ForeignEnum")); Assert.AreEqual(1, UnittestImportProto3Reflection.Descriptor.EnumTypes.Count); Assert.AreEqual("ImportEnum", UnittestImportProto3Reflection.Descriptor.EnumTypes[0].Name); for (int i = 0; i < file.EnumTypes.Count; i++) @@ -87,6 +87,16 @@ namespace Google.Protobuf.Reflection Assert.AreEqual(10, file.SerializedData[0]); } + [Test] + public void FileDescriptor_NonRootPath() + { + // unittest_proto3.proto used to be in google/protobuf. Now it's in the C#-specific location, + // let's test something that's still in a directory. + FileDescriptor file = UnittestWellKnownTypesReflection.Descriptor; + Assert.AreEqual("google/protobuf/unittest_well_known_types.proto", file.Name); + Assert.AreEqual("protobuf_unittest", file.Package); + } + [Test] public void MessageDescriptor() { @@ -94,7 +104,7 @@ namespace Google.Protobuf.Reflection MessageDescriptor nestedType = TestAllTypes.Types.NestedMessage.Descriptor; Assert.AreEqual("TestAllTypes", messageType.Name); - Assert.AreEqual("protobuf_unittest.TestAllTypes", messageType.FullName); + Assert.AreEqual("protobuf_unittest3.TestAllTypes", messageType.FullName); Assert.AreEqual(UnittestProto3Reflection.Descriptor, messageType.File); Assert.IsNull(messageType.ContainingType); Assert.IsNull(messageType.Proto.Options); @@ -102,7 +112,7 @@ namespace Google.Protobuf.Reflection Assert.AreEqual("TestAllTypes", messageType.Name); Assert.AreEqual("NestedMessage", nestedType.Name); - Assert.AreEqual("protobuf_unittest.TestAllTypes.NestedMessage", nestedType.FullName); + Assert.AreEqual("protobuf_unittest3.TestAllTypes.NestedMessage", nestedType.FullName); Assert.AreEqual(UnittestProto3Reflection.Descriptor, nestedType.File); Assert.AreEqual(messageType, nestedType.ContainingType); @@ -143,7 +153,7 @@ namespace Google.Protobuf.Reflection FieldDescriptor messageField = messageType.FindDescriptor("single_foreign_message"); Assert.AreEqual("single_int32", primitiveField.Name); - Assert.AreEqual("protobuf_unittest.TestAllTypes.single_int32", + Assert.AreEqual("protobuf_unittest3.TestAllTypes.single_int32", primitiveField.FullName); Assert.AreEqual(1, primitiveField.FieldNumber); Assert.AreEqual(messageType, primitiveField.ContainingType); @@ -180,13 +190,13 @@ namespace Google.Protobuf.Reflection EnumDescriptor nestedType = TestAllTypes.Descriptor.FindDescriptor("NestedEnum"); Assert.AreEqual("ForeignEnum", enumType.Name); - Assert.AreEqual("protobuf_unittest.ForeignEnum", enumType.FullName); + Assert.AreEqual("protobuf_unittest3.ForeignEnum", enumType.FullName); Assert.AreEqual(UnittestProto3Reflection.Descriptor, enumType.File); Assert.Null(enumType.ContainingType); Assert.Null(enumType.Proto.Options); Assert.AreEqual("NestedEnum", nestedType.Name); - Assert.AreEqual("protobuf_unittest.TestAllTypes.NestedEnum", + Assert.AreEqual("protobuf_unittest3.TestAllTypes.NestedEnum", nestedType.FullName); Assert.AreEqual(UnittestProto3Reflection.Descriptor, nestedType.File); Assert.AreEqual(TestAllTypes.Descriptor, nestedType.ContainingType); @@ -209,7 +219,7 @@ namespace Google.Protobuf.Reflection { OneofDescriptor descriptor = TestAllTypes.Descriptor.FindDescriptor("oneof_field"); Assert.AreEqual("oneof_field", descriptor.Name); - Assert.AreEqual("protobuf_unittest.TestAllTypes.oneof_field", descriptor.FullName); + Assert.AreEqual("protobuf_unittest3.TestAllTypes.oneof_field", descriptor.FullName); var expectedFields = new[] { TestAllTypes.OneofBytesFieldNumber, diff --git a/csharp/src/Google.Protobuf.Test/SampleNaNs.cs b/csharp/src/Google.Protobuf.Test/SampleNaNs.cs new file mode 100644 index 00000000..08b50191 --- /dev/null +++ b/csharp/src/Google.Protobuf.Test/SampleNaNs.cs @@ -0,0 +1,53 @@ +#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; + +namespace Google.Protobuf +{ + /// + /// Samples of different not-a-number values, for testing equality comparisons. + /// + public static class SampleNaNs + { + public static double Regular { get; } = double.NaN; + + // Signalling bit is inverted compared with double.NaN. Doesn't really matter + // whether that makes it quiet or signalling - it's different. + public static double SignallingFlipped { get; } = + BitConverter.Int64BitsToDouble(BitConverter.DoubleToInt64Bits(double.NaN) ^ -0x8000_0000_0000_0000L); + + // A bit in the middle of the mantissa is flipped; this difference is preserved when casting to float. + public static double PayloadFlipped { get; } = + BitConverter.Int64BitsToDouble(BitConverter.DoubleToInt64Bits(double.NaN) ^ 0x1_0000_0000L); + } +} diff --git a/csharp/src/Google.Protobuf.Test/TestProtos/MapUnittestProto3.cs b/csharp/src/Google.Protobuf.Test/TestProtos/MapUnittestProto3.cs index 9c0518a3..cb1bc920 100644 --- a/csharp/src/Google.Protobuf.Test/TestProtos/MapUnittestProto3.cs +++ b/csharp/src/Google.Protobuf.Test/TestProtos/MapUnittestProto3.cs @@ -1,5 +1,7 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/protobuf/map_unittest_proto3.proto +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: map_unittest_proto3.proto +// #pragma warning disable 1591, 0612, 3021 #region Designer generated code @@ -9,11 +11,11 @@ using pbr = global::Google.Protobuf.Reflection; using scg = global::System.Collections.Generic; namespace Google.Protobuf.TestProtos { - /// Holder for reflection information generated from google/protobuf/map_unittest_proto3.proto + /// Holder for reflection information generated from map_unittest_proto3.proto public static partial class MapUnittestProto3Reflection { #region Descriptor - /// File descriptor for google/protobuf/map_unittest_proto3.proto + /// File descriptor for map_unittest_proto3.proto public static pbr::FileDescriptor Descriptor { get { return descriptor; } } @@ -22,130 +24,130 @@ namespace Google.Protobuf.TestProtos { static MapUnittestProto3Reflection() { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( - "Cilnb29nbGUvcHJvdG9idWYvbWFwX3VuaXR0ZXN0X3Byb3RvMy5wcm90bxIR", - "cHJvdG9idWZfdW5pdHRlc3QaJWdvb2dsZS9wcm90b2J1Zi91bml0dGVzdF9w", - "cm90bzMucHJvdG8ilhIKB1Rlc3RNYXASRgoPbWFwX2ludDMyX2ludDMyGAEg", - "AygLMi0ucHJvdG9idWZfdW5pdHRlc3QuVGVzdE1hcC5NYXBJbnQzMkludDMy", - "RW50cnkSRgoPbWFwX2ludDY0X2ludDY0GAIgAygLMi0ucHJvdG9idWZfdW5p", - "dHRlc3QuVGVzdE1hcC5NYXBJbnQ2NEludDY0RW50cnkSSgoRbWFwX3VpbnQz", - "Ml91aW50MzIYAyADKAsyLy5wcm90b2J1Zl91bml0dGVzdC5UZXN0TWFwLk1h", - "cFVpbnQzMlVpbnQzMkVudHJ5EkoKEW1hcF91aW50NjRfdWludDY0GAQgAygL", - "Mi8ucHJvdG9idWZfdW5pdHRlc3QuVGVzdE1hcC5NYXBVaW50NjRVaW50NjRF", - "bnRyeRJKChFtYXBfc2ludDMyX3NpbnQzMhgFIAMoCzIvLnByb3RvYnVmX3Vu", - "aXR0ZXN0LlRlc3RNYXAuTWFwU2ludDMyU2ludDMyRW50cnkSSgoRbWFwX3Np", - "bnQ2NF9zaW50NjQYBiADKAsyLy5wcm90b2J1Zl91bml0dGVzdC5UZXN0TWFw", - "Lk1hcFNpbnQ2NFNpbnQ2NEVudHJ5Ek4KE21hcF9maXhlZDMyX2ZpeGVkMzIY", - "ByADKAsyMS5wcm90b2J1Zl91bml0dGVzdC5UZXN0TWFwLk1hcEZpeGVkMzJG", - "aXhlZDMyRW50cnkSTgoTbWFwX2ZpeGVkNjRfZml4ZWQ2NBgIIAMoCzIxLnBy", - "b3RvYnVmX3VuaXR0ZXN0LlRlc3RNYXAuTWFwRml4ZWQ2NEZpeGVkNjRFbnRy", - "eRJSChVtYXBfc2ZpeGVkMzJfc2ZpeGVkMzIYCSADKAsyMy5wcm90b2J1Zl91", - "bml0dGVzdC5UZXN0TWFwLk1hcFNmaXhlZDMyU2ZpeGVkMzJFbnRyeRJSChVt", - "YXBfc2ZpeGVkNjRfc2ZpeGVkNjQYCiADKAsyMy5wcm90b2J1Zl91bml0dGVz", - "dC5UZXN0TWFwLk1hcFNmaXhlZDY0U2ZpeGVkNjRFbnRyeRJGCg9tYXBfaW50", - "MzJfZmxvYXQYCyADKAsyLS5wcm90b2J1Zl91bml0dGVzdC5UZXN0TWFwLk1h", - "cEludDMyRmxvYXRFbnRyeRJIChBtYXBfaW50MzJfZG91YmxlGAwgAygLMi4u", - "cHJvdG9idWZfdW5pdHRlc3QuVGVzdE1hcC5NYXBJbnQzMkRvdWJsZUVudHJ5", - "EkIKDW1hcF9ib29sX2Jvb2wYDSADKAsyKy5wcm90b2J1Zl91bml0dGVzdC5U", - "ZXN0TWFwLk1hcEJvb2xCb29sRW50cnkSSgoRbWFwX3N0cmluZ19zdHJpbmcY", - "DiADKAsyLy5wcm90b2J1Zl91bml0dGVzdC5UZXN0TWFwLk1hcFN0cmluZ1N0", - "cmluZ0VudHJ5EkYKD21hcF9pbnQzMl9ieXRlcxgPIAMoCzItLnByb3RvYnVm", - "X3VuaXR0ZXN0LlRlc3RNYXAuTWFwSW50MzJCeXRlc0VudHJ5EkQKDm1hcF9p", - "bnQzMl9lbnVtGBAgAygLMiwucHJvdG9idWZfdW5pdHRlc3QuVGVzdE1hcC5N", - "YXBJbnQzMkVudW1FbnRyeRJZChltYXBfaW50MzJfZm9yZWlnbl9tZXNzYWdl", - "GBEgAygLMjYucHJvdG9idWZfdW5pdHRlc3QuVGVzdE1hcC5NYXBJbnQzMkZv", - "cmVpZ25NZXNzYWdlRW50cnkaNAoSTWFwSW50MzJJbnQzMkVudHJ5EgsKA2tl", - "eRgBIAEoBRINCgV2YWx1ZRgCIAEoBToCOAEaNAoSTWFwSW50NjRJbnQ2NEVu", - "dHJ5EgsKA2tleRgBIAEoAxINCgV2YWx1ZRgCIAEoAzoCOAEaNgoUTWFwVWlu", - "dDMyVWludDMyRW50cnkSCwoDa2V5GAEgASgNEg0KBXZhbHVlGAIgASgNOgI4", - "ARo2ChRNYXBVaW50NjRVaW50NjRFbnRyeRILCgNrZXkYASABKAQSDQoFdmFs", - "dWUYAiABKAQ6AjgBGjYKFE1hcFNpbnQzMlNpbnQzMkVudHJ5EgsKA2tleRgB", - "IAEoERINCgV2YWx1ZRgCIAEoEToCOAEaNgoUTWFwU2ludDY0U2ludDY0RW50", - "cnkSCwoDa2V5GAEgASgSEg0KBXZhbHVlGAIgASgSOgI4ARo4ChZNYXBGaXhl", - "ZDMyRml4ZWQzMkVudHJ5EgsKA2tleRgBIAEoBxINCgV2YWx1ZRgCIAEoBzoC", - "OAEaOAoWTWFwRml4ZWQ2NEZpeGVkNjRFbnRyeRILCgNrZXkYASABKAYSDQoF", - "dmFsdWUYAiABKAY6AjgBGjoKGE1hcFNmaXhlZDMyU2ZpeGVkMzJFbnRyeRIL", - "CgNrZXkYASABKA8SDQoFdmFsdWUYAiABKA86AjgBGjoKGE1hcFNmaXhlZDY0", - "U2ZpeGVkNjRFbnRyeRILCgNrZXkYASABKBASDQoFdmFsdWUYAiABKBA6AjgB", - "GjQKEk1hcEludDMyRmxvYXRFbnRyeRILCgNrZXkYASABKAUSDQoFdmFsdWUY", - "AiABKAI6AjgBGjUKE01hcEludDMyRG91YmxlRW50cnkSCwoDa2V5GAEgASgF", - "Eg0KBXZhbHVlGAIgASgBOgI4ARoyChBNYXBCb29sQm9vbEVudHJ5EgsKA2tl", - "eRgBIAEoCBINCgV2YWx1ZRgCIAEoCDoCOAEaNgoUTWFwU3RyaW5nU3RyaW5n", - "RW50cnkSCwoDa2V5GAEgASgJEg0KBXZhbHVlGAIgASgJOgI4ARo0ChJNYXBJ", - "bnQzMkJ5dGVzRW50cnkSCwoDa2V5GAEgASgFEg0KBXZhbHVlGAIgASgMOgI4", - "ARpPChFNYXBJbnQzMkVudW1FbnRyeRILCgNrZXkYASABKAUSKQoFdmFsdWUY", - "AiABKA4yGi5wcm90b2J1Zl91bml0dGVzdC5NYXBFbnVtOgI4ARpgChtNYXBJ", - "bnQzMkZvcmVpZ25NZXNzYWdlRW50cnkSCwoDa2V5GAEgASgFEjAKBXZhbHVl", - "GAIgASgLMiEucHJvdG9idWZfdW5pdHRlc3QuRm9yZWlnbk1lc3NhZ2U6AjgB", - "IkEKEVRlc3RNYXBTdWJtZXNzYWdlEiwKCHRlc3RfbWFwGAEgASgLMhoucHJv", - "dG9idWZfdW5pdHRlc3QuVGVzdE1hcCK8AQoOVGVzdE1lc3NhZ2VNYXASUQoR", - "bWFwX2ludDMyX21lc3NhZ2UYASADKAsyNi5wcm90b2J1Zl91bml0dGVzdC5U", - "ZXN0TWVzc2FnZU1hcC5NYXBJbnQzMk1lc3NhZ2VFbnRyeRpXChRNYXBJbnQz", - "Mk1lc3NhZ2VFbnRyeRILCgNrZXkYASABKAUSLgoFdmFsdWUYAiABKAsyHy5w", - "cm90b2J1Zl91bml0dGVzdC5UZXN0QWxsVHlwZXM6AjgBIuMBCg9UZXN0U2Ft", - "ZVR5cGVNYXASOgoEbWFwMRgBIAMoCzIsLnByb3RvYnVmX3VuaXR0ZXN0LlRl", - "c3RTYW1lVHlwZU1hcC5NYXAxRW50cnkSOgoEbWFwMhgCIAMoCzIsLnByb3Rv", - "YnVmX3VuaXR0ZXN0LlRlc3RTYW1lVHlwZU1hcC5NYXAyRW50cnkaKwoJTWFw", - "MUVudHJ5EgsKA2tleRgBIAEoBRINCgV2YWx1ZRgCIAEoBToCOAEaKwoJTWFw", - "MkVudHJ5EgsKA2tleRgBIAEoBRINCgV2YWx1ZRgCIAEoBToCOAEi5BAKDFRl", - "c3RBcmVuYU1hcBJLCg9tYXBfaW50MzJfaW50MzIYASADKAsyMi5wcm90b2J1", - "Zl91bml0dGVzdC5UZXN0QXJlbmFNYXAuTWFwSW50MzJJbnQzMkVudHJ5EksK", - "D21hcF9pbnQ2NF9pbnQ2NBgCIAMoCzIyLnByb3RvYnVmX3VuaXR0ZXN0LlRl", - "c3RBcmVuYU1hcC5NYXBJbnQ2NEludDY0RW50cnkSTwoRbWFwX3VpbnQzMl91", - "aW50MzIYAyADKAsyNC5wcm90b2J1Zl91bml0dGVzdC5UZXN0QXJlbmFNYXAu", - "TWFwVWludDMyVWludDMyRW50cnkSTwoRbWFwX3VpbnQ2NF91aW50NjQYBCAD", - "KAsyNC5wcm90b2J1Zl91bml0dGVzdC5UZXN0QXJlbmFNYXAuTWFwVWludDY0", - "VWludDY0RW50cnkSTwoRbWFwX3NpbnQzMl9zaW50MzIYBSADKAsyNC5wcm90", - "b2J1Zl91bml0dGVzdC5UZXN0QXJlbmFNYXAuTWFwU2ludDMyU2ludDMyRW50", - "cnkSTwoRbWFwX3NpbnQ2NF9zaW50NjQYBiADKAsyNC5wcm90b2J1Zl91bml0", - "dGVzdC5UZXN0QXJlbmFNYXAuTWFwU2ludDY0U2ludDY0RW50cnkSUwoTbWFw", - "X2ZpeGVkMzJfZml4ZWQzMhgHIAMoCzI2LnByb3RvYnVmX3VuaXR0ZXN0LlRl", - "c3RBcmVuYU1hcC5NYXBGaXhlZDMyRml4ZWQzMkVudHJ5ElMKE21hcF9maXhl", - "ZDY0X2ZpeGVkNjQYCCADKAsyNi5wcm90b2J1Zl91bml0dGVzdC5UZXN0QXJl", - "bmFNYXAuTWFwRml4ZWQ2NEZpeGVkNjRFbnRyeRJXChVtYXBfc2ZpeGVkMzJf", - "c2ZpeGVkMzIYCSADKAsyOC5wcm90b2J1Zl91bml0dGVzdC5UZXN0QXJlbmFN", - "YXAuTWFwU2ZpeGVkMzJTZml4ZWQzMkVudHJ5ElcKFW1hcF9zZml4ZWQ2NF9z", - "Zml4ZWQ2NBgKIAMoCzI4LnByb3RvYnVmX3VuaXR0ZXN0LlRlc3RBcmVuYU1h", - "cC5NYXBTZml4ZWQ2NFNmaXhlZDY0RW50cnkSSwoPbWFwX2ludDMyX2Zsb2F0", - "GAsgAygLMjIucHJvdG9idWZfdW5pdHRlc3QuVGVzdEFyZW5hTWFwLk1hcElu", - "dDMyRmxvYXRFbnRyeRJNChBtYXBfaW50MzJfZG91YmxlGAwgAygLMjMucHJv", - "dG9idWZfdW5pdHRlc3QuVGVzdEFyZW5hTWFwLk1hcEludDMyRG91YmxlRW50", - "cnkSRwoNbWFwX2Jvb2xfYm9vbBgNIAMoCzIwLnByb3RvYnVmX3VuaXR0ZXN0", - "LlRlc3RBcmVuYU1hcC5NYXBCb29sQm9vbEVudHJ5EkkKDm1hcF9pbnQzMl9l", - "bnVtGA4gAygLMjEucHJvdG9idWZfdW5pdHRlc3QuVGVzdEFyZW5hTWFwLk1h", - "cEludDMyRW51bUVudHJ5El4KGW1hcF9pbnQzMl9mb3JlaWduX21lc3NhZ2UY", - "DyADKAsyOy5wcm90b2J1Zl91bml0dGVzdC5UZXN0QXJlbmFNYXAuTWFwSW50", - "MzJGb3JlaWduTWVzc2FnZUVudHJ5GjQKEk1hcEludDMySW50MzJFbnRyeRIL", - "CgNrZXkYASABKAUSDQoFdmFsdWUYAiABKAU6AjgBGjQKEk1hcEludDY0SW50", - "NjRFbnRyeRILCgNrZXkYASABKAMSDQoFdmFsdWUYAiABKAM6AjgBGjYKFE1h", - "cFVpbnQzMlVpbnQzMkVudHJ5EgsKA2tleRgBIAEoDRINCgV2YWx1ZRgCIAEo", - "DToCOAEaNgoUTWFwVWludDY0VWludDY0RW50cnkSCwoDa2V5GAEgASgEEg0K", - "BXZhbHVlGAIgASgEOgI4ARo2ChRNYXBTaW50MzJTaW50MzJFbnRyeRILCgNr", - "ZXkYASABKBESDQoFdmFsdWUYAiABKBE6AjgBGjYKFE1hcFNpbnQ2NFNpbnQ2", - "NEVudHJ5EgsKA2tleRgBIAEoEhINCgV2YWx1ZRgCIAEoEjoCOAEaOAoWTWFw", - "Rml4ZWQzMkZpeGVkMzJFbnRyeRILCgNrZXkYASABKAcSDQoFdmFsdWUYAiAB", - "KAc6AjgBGjgKFk1hcEZpeGVkNjRGaXhlZDY0RW50cnkSCwoDa2V5GAEgASgG", - "Eg0KBXZhbHVlGAIgASgGOgI4ARo6ChhNYXBTZml4ZWQzMlNmaXhlZDMyRW50", - "cnkSCwoDa2V5GAEgASgPEg0KBXZhbHVlGAIgASgPOgI4ARo6ChhNYXBTZml4", - "ZWQ2NFNmaXhlZDY0RW50cnkSCwoDa2V5GAEgASgQEg0KBXZhbHVlGAIgASgQ", - "OgI4ARo0ChJNYXBJbnQzMkZsb2F0RW50cnkSCwoDa2V5GAEgASgFEg0KBXZh", - "bHVlGAIgASgCOgI4ARo1ChNNYXBJbnQzMkRvdWJsZUVudHJ5EgsKA2tleRgB", - "IAEoBRINCgV2YWx1ZRgCIAEoAToCOAEaMgoQTWFwQm9vbEJvb2xFbnRyeRIL", - "CgNrZXkYASABKAgSDQoFdmFsdWUYAiABKAg6AjgBGk8KEU1hcEludDMyRW51", - "bUVudHJ5EgsKA2tleRgBIAEoBRIpCgV2YWx1ZRgCIAEoDjIaLnByb3RvYnVm", - "X3VuaXR0ZXN0Lk1hcEVudW06AjgBGmAKG01hcEludDMyRm9yZWlnbk1lc3Nh", - "Z2VFbnRyeRILCgNrZXkYASABKAUSMAoFdmFsdWUYAiABKAsyIS5wcm90b2J1", - "Zl91bml0dGVzdC5Gb3JlaWduTWVzc2FnZToCOAEi5AEKH01lc3NhZ2VDb250", - "YWluaW5nRW51bUNhbGxlZFR5cGUSSgoEdHlwZRgBIAMoCzI8LnByb3RvYnVm", - "X3VuaXR0ZXN0Lk1lc3NhZ2VDb250YWluaW5nRW51bUNhbGxlZFR5cGUuVHlw", - "ZUVudHJ5Gl8KCVR5cGVFbnRyeRILCgNrZXkYASABKAUSQQoFdmFsdWUYAiAB", - "KAsyMi5wcm90b2J1Zl91bml0dGVzdC5NZXNzYWdlQ29udGFpbmluZ0VudW1D", - "YWxsZWRUeXBlOgI4ASIUCgRUeXBlEgwKCFRZUEVfRk9PEAAinQEKH01lc3Nh", - "Z2VDb250YWluaW5nTWFwQ2FsbGVkRW50cnkSTAoFZW50cnkYASADKAsyPS5w", - "cm90b2J1Zl91bml0dGVzdC5NZXNzYWdlQ29udGFpbmluZ01hcENhbGxlZEVu", - "dHJ5LkVudHJ5RW50cnkaLAoKRW50cnlFbnRyeRILCgNrZXkYASABKAUSDQoF", - "dmFsdWUYAiABKAU6AjgBKj8KB01hcEVudW0SEAoMTUFQX0VOVU1fRk9PEAAS", - "EAoMTUFQX0VOVU1fQkFSEAESEAoMTUFQX0VOVU1fQkFaEAJCIPgBAaoCGkdv", - "b2dsZS5Qcm90b2J1Zi5UZXN0UHJvdG9zYgZwcm90bzM=")); + "ChltYXBfdW5pdHRlc3RfcHJvdG8zLnByb3RvEhJwcm90b2J1Zl91bml0dGVz", + "dDMaFXVuaXR0ZXN0X3Byb3RvMy5wcm90byKpEgoHVGVzdE1hcBJHCg9tYXBf", + "aW50MzJfaW50MzIYASADKAsyLi5wcm90b2J1Zl91bml0dGVzdDMuVGVzdE1h", + "cC5NYXBJbnQzMkludDMyRW50cnkSRwoPbWFwX2ludDY0X2ludDY0GAIgAygL", + "Mi4ucHJvdG9idWZfdW5pdHRlc3QzLlRlc3RNYXAuTWFwSW50NjRJbnQ2NEVu", + "dHJ5EksKEW1hcF91aW50MzJfdWludDMyGAMgAygLMjAucHJvdG9idWZfdW5p", + "dHRlc3QzLlRlc3RNYXAuTWFwVWludDMyVWludDMyRW50cnkSSwoRbWFwX3Vp", + "bnQ2NF91aW50NjQYBCADKAsyMC5wcm90b2J1Zl91bml0dGVzdDMuVGVzdE1h", + "cC5NYXBVaW50NjRVaW50NjRFbnRyeRJLChFtYXBfc2ludDMyX3NpbnQzMhgF", + "IAMoCzIwLnByb3RvYnVmX3VuaXR0ZXN0My5UZXN0TWFwLk1hcFNpbnQzMlNp", + "bnQzMkVudHJ5EksKEW1hcF9zaW50NjRfc2ludDY0GAYgAygLMjAucHJvdG9i", + "dWZfdW5pdHRlc3QzLlRlc3RNYXAuTWFwU2ludDY0U2ludDY0RW50cnkSTwoT", + "bWFwX2ZpeGVkMzJfZml4ZWQzMhgHIAMoCzIyLnByb3RvYnVmX3VuaXR0ZXN0", + "My5UZXN0TWFwLk1hcEZpeGVkMzJGaXhlZDMyRW50cnkSTwoTbWFwX2ZpeGVk", + "NjRfZml4ZWQ2NBgIIAMoCzIyLnByb3RvYnVmX3VuaXR0ZXN0My5UZXN0TWFw", + "Lk1hcEZpeGVkNjRGaXhlZDY0RW50cnkSUwoVbWFwX3NmaXhlZDMyX3NmaXhl", + "ZDMyGAkgAygLMjQucHJvdG9idWZfdW5pdHRlc3QzLlRlc3RNYXAuTWFwU2Zp", + "eGVkMzJTZml4ZWQzMkVudHJ5ElMKFW1hcF9zZml4ZWQ2NF9zZml4ZWQ2NBgK", + "IAMoCzI0LnByb3RvYnVmX3VuaXR0ZXN0My5UZXN0TWFwLk1hcFNmaXhlZDY0", + "U2ZpeGVkNjRFbnRyeRJHCg9tYXBfaW50MzJfZmxvYXQYCyADKAsyLi5wcm90", + "b2J1Zl91bml0dGVzdDMuVGVzdE1hcC5NYXBJbnQzMkZsb2F0RW50cnkSSQoQ", + "bWFwX2ludDMyX2RvdWJsZRgMIAMoCzIvLnByb3RvYnVmX3VuaXR0ZXN0My5U", + "ZXN0TWFwLk1hcEludDMyRG91YmxlRW50cnkSQwoNbWFwX2Jvb2xfYm9vbBgN", + "IAMoCzIsLnByb3RvYnVmX3VuaXR0ZXN0My5UZXN0TWFwLk1hcEJvb2xCb29s", + "RW50cnkSSwoRbWFwX3N0cmluZ19zdHJpbmcYDiADKAsyMC5wcm90b2J1Zl91", + "bml0dGVzdDMuVGVzdE1hcC5NYXBTdHJpbmdTdHJpbmdFbnRyeRJHCg9tYXBf", + "aW50MzJfYnl0ZXMYDyADKAsyLi5wcm90b2J1Zl91bml0dGVzdDMuVGVzdE1h", + "cC5NYXBJbnQzMkJ5dGVzRW50cnkSRQoObWFwX2ludDMyX2VudW0YECADKAsy", + "LS5wcm90b2J1Zl91bml0dGVzdDMuVGVzdE1hcC5NYXBJbnQzMkVudW1FbnRy", + "eRJaChltYXBfaW50MzJfZm9yZWlnbl9tZXNzYWdlGBEgAygLMjcucHJvdG9i", + "dWZfdW5pdHRlc3QzLlRlc3RNYXAuTWFwSW50MzJGb3JlaWduTWVzc2FnZUVu", + "dHJ5GjQKEk1hcEludDMySW50MzJFbnRyeRILCgNrZXkYASABKAUSDQoFdmFs", + "dWUYAiABKAU6AjgBGjQKEk1hcEludDY0SW50NjRFbnRyeRILCgNrZXkYASAB", + "KAMSDQoFdmFsdWUYAiABKAM6AjgBGjYKFE1hcFVpbnQzMlVpbnQzMkVudHJ5", + "EgsKA2tleRgBIAEoDRINCgV2YWx1ZRgCIAEoDToCOAEaNgoUTWFwVWludDY0", + "VWludDY0RW50cnkSCwoDa2V5GAEgASgEEg0KBXZhbHVlGAIgASgEOgI4ARo2", + "ChRNYXBTaW50MzJTaW50MzJFbnRyeRILCgNrZXkYASABKBESDQoFdmFsdWUY", + "AiABKBE6AjgBGjYKFE1hcFNpbnQ2NFNpbnQ2NEVudHJ5EgsKA2tleRgBIAEo", + "EhINCgV2YWx1ZRgCIAEoEjoCOAEaOAoWTWFwRml4ZWQzMkZpeGVkMzJFbnRy", + "eRILCgNrZXkYASABKAcSDQoFdmFsdWUYAiABKAc6AjgBGjgKFk1hcEZpeGVk", + "NjRGaXhlZDY0RW50cnkSCwoDa2V5GAEgASgGEg0KBXZhbHVlGAIgASgGOgI4", + "ARo6ChhNYXBTZml4ZWQzMlNmaXhlZDMyRW50cnkSCwoDa2V5GAEgASgPEg0K", + "BXZhbHVlGAIgASgPOgI4ARo6ChhNYXBTZml4ZWQ2NFNmaXhlZDY0RW50cnkS", + "CwoDa2V5GAEgASgQEg0KBXZhbHVlGAIgASgQOgI4ARo0ChJNYXBJbnQzMkZs", + "b2F0RW50cnkSCwoDa2V5GAEgASgFEg0KBXZhbHVlGAIgASgCOgI4ARo1ChNN", + "YXBJbnQzMkRvdWJsZUVudHJ5EgsKA2tleRgBIAEoBRINCgV2YWx1ZRgCIAEo", + "AToCOAEaMgoQTWFwQm9vbEJvb2xFbnRyeRILCgNrZXkYASABKAgSDQoFdmFs", + "dWUYAiABKAg6AjgBGjYKFE1hcFN0cmluZ1N0cmluZ0VudHJ5EgsKA2tleRgB", + "IAEoCRINCgV2YWx1ZRgCIAEoCToCOAEaNAoSTWFwSW50MzJCeXRlc0VudHJ5", + "EgsKA2tleRgBIAEoBRINCgV2YWx1ZRgCIAEoDDoCOAEaUAoRTWFwSW50MzJF", + "bnVtRW50cnkSCwoDa2V5GAEgASgFEioKBXZhbHVlGAIgASgOMhsucHJvdG9i", + "dWZfdW5pdHRlc3QzLk1hcEVudW06AjgBGmEKG01hcEludDMyRm9yZWlnbk1l", + "c3NhZ2VFbnRyeRILCgNrZXkYASABKAUSMQoFdmFsdWUYAiABKAsyIi5wcm90", + "b2J1Zl91bml0dGVzdDMuRm9yZWlnbk1lc3NhZ2U6AjgBIkIKEVRlc3RNYXBT", + "dWJtZXNzYWdlEi0KCHRlc3RfbWFwGAEgASgLMhsucHJvdG9idWZfdW5pdHRl", + "c3QzLlRlc3RNYXAivgEKDlRlc3RNZXNzYWdlTWFwElIKEW1hcF9pbnQzMl9t", + "ZXNzYWdlGAEgAygLMjcucHJvdG9idWZfdW5pdHRlc3QzLlRlc3RNZXNzYWdl", + "TWFwLk1hcEludDMyTWVzc2FnZUVudHJ5GlgKFE1hcEludDMyTWVzc2FnZUVu", + "dHJ5EgsKA2tleRgBIAEoBRIvCgV2YWx1ZRgCIAEoCzIgLnByb3RvYnVmX3Vu", + "aXR0ZXN0My5UZXN0QWxsVHlwZXM6AjgBIuUBCg9UZXN0U2FtZVR5cGVNYXAS", + "OwoEbWFwMRgBIAMoCzItLnByb3RvYnVmX3VuaXR0ZXN0My5UZXN0U2FtZVR5", + "cGVNYXAuTWFwMUVudHJ5EjsKBG1hcDIYAiADKAsyLS5wcm90b2J1Zl91bml0", + "dGVzdDMuVGVzdFNhbWVUeXBlTWFwLk1hcDJFbnRyeRorCglNYXAxRW50cnkS", + "CwoDa2V5GAEgASgFEg0KBXZhbHVlGAIgASgFOgI4ARorCglNYXAyRW50cnkS", + "CwoDa2V5GAEgASgFEg0KBXZhbHVlGAIgASgFOgI4ASL1EAoMVGVzdEFyZW5h", + "TWFwEkwKD21hcF9pbnQzMl9pbnQzMhgBIAMoCzIzLnByb3RvYnVmX3VuaXR0", + "ZXN0My5UZXN0QXJlbmFNYXAuTWFwSW50MzJJbnQzMkVudHJ5EkwKD21hcF9p", + "bnQ2NF9pbnQ2NBgCIAMoCzIzLnByb3RvYnVmX3VuaXR0ZXN0My5UZXN0QXJl", + "bmFNYXAuTWFwSW50NjRJbnQ2NEVudHJ5ElAKEW1hcF91aW50MzJfdWludDMy", + "GAMgAygLMjUucHJvdG9idWZfdW5pdHRlc3QzLlRlc3RBcmVuYU1hcC5NYXBV", + "aW50MzJVaW50MzJFbnRyeRJQChFtYXBfdWludDY0X3VpbnQ2NBgEIAMoCzI1", + "LnByb3RvYnVmX3VuaXR0ZXN0My5UZXN0QXJlbmFNYXAuTWFwVWludDY0VWlu", + "dDY0RW50cnkSUAoRbWFwX3NpbnQzMl9zaW50MzIYBSADKAsyNS5wcm90b2J1", + "Zl91bml0dGVzdDMuVGVzdEFyZW5hTWFwLk1hcFNpbnQzMlNpbnQzMkVudHJ5", + "ElAKEW1hcF9zaW50NjRfc2ludDY0GAYgAygLMjUucHJvdG9idWZfdW5pdHRl", + "c3QzLlRlc3RBcmVuYU1hcC5NYXBTaW50NjRTaW50NjRFbnRyeRJUChNtYXBf", + "Zml4ZWQzMl9maXhlZDMyGAcgAygLMjcucHJvdG9idWZfdW5pdHRlc3QzLlRl", + "c3RBcmVuYU1hcC5NYXBGaXhlZDMyRml4ZWQzMkVudHJ5ElQKE21hcF9maXhl", + "ZDY0X2ZpeGVkNjQYCCADKAsyNy5wcm90b2J1Zl91bml0dGVzdDMuVGVzdEFy", + "ZW5hTWFwLk1hcEZpeGVkNjRGaXhlZDY0RW50cnkSWAoVbWFwX3NmaXhlZDMy", + "X3NmaXhlZDMyGAkgAygLMjkucHJvdG9idWZfdW5pdHRlc3QzLlRlc3RBcmVu", + "YU1hcC5NYXBTZml4ZWQzMlNmaXhlZDMyRW50cnkSWAoVbWFwX3NmaXhlZDY0", + "X3NmaXhlZDY0GAogAygLMjkucHJvdG9idWZfdW5pdHRlc3QzLlRlc3RBcmVu", + "YU1hcC5NYXBTZml4ZWQ2NFNmaXhlZDY0RW50cnkSTAoPbWFwX2ludDMyX2Zs", + "b2F0GAsgAygLMjMucHJvdG9idWZfdW5pdHRlc3QzLlRlc3RBcmVuYU1hcC5N", + "YXBJbnQzMkZsb2F0RW50cnkSTgoQbWFwX2ludDMyX2RvdWJsZRgMIAMoCzI0", + "LnByb3RvYnVmX3VuaXR0ZXN0My5UZXN0QXJlbmFNYXAuTWFwSW50MzJEb3Vi", + "bGVFbnRyeRJICg1tYXBfYm9vbF9ib29sGA0gAygLMjEucHJvdG9idWZfdW5p", + "dHRlc3QzLlRlc3RBcmVuYU1hcC5NYXBCb29sQm9vbEVudHJ5EkoKDm1hcF9p", + "bnQzMl9lbnVtGA4gAygLMjIucHJvdG9idWZfdW5pdHRlc3QzLlRlc3RBcmVu", + "YU1hcC5NYXBJbnQzMkVudW1FbnRyeRJfChltYXBfaW50MzJfZm9yZWlnbl9t", + "ZXNzYWdlGA8gAygLMjwucHJvdG9idWZfdW5pdHRlc3QzLlRlc3RBcmVuYU1h", + "cC5NYXBJbnQzMkZvcmVpZ25NZXNzYWdlRW50cnkaNAoSTWFwSW50MzJJbnQz", + "MkVudHJ5EgsKA2tleRgBIAEoBRINCgV2YWx1ZRgCIAEoBToCOAEaNAoSTWFw", + "SW50NjRJbnQ2NEVudHJ5EgsKA2tleRgBIAEoAxINCgV2YWx1ZRgCIAEoAzoC", + "OAEaNgoUTWFwVWludDMyVWludDMyRW50cnkSCwoDa2V5GAEgASgNEg0KBXZh", + "bHVlGAIgASgNOgI4ARo2ChRNYXBVaW50NjRVaW50NjRFbnRyeRILCgNrZXkY", + "ASABKAQSDQoFdmFsdWUYAiABKAQ6AjgBGjYKFE1hcFNpbnQzMlNpbnQzMkVu", + "dHJ5EgsKA2tleRgBIAEoERINCgV2YWx1ZRgCIAEoEToCOAEaNgoUTWFwU2lu", + "dDY0U2ludDY0RW50cnkSCwoDa2V5GAEgASgSEg0KBXZhbHVlGAIgASgSOgI4", + "ARo4ChZNYXBGaXhlZDMyRml4ZWQzMkVudHJ5EgsKA2tleRgBIAEoBxINCgV2", + "YWx1ZRgCIAEoBzoCOAEaOAoWTWFwRml4ZWQ2NEZpeGVkNjRFbnRyeRILCgNr", + "ZXkYASABKAYSDQoFdmFsdWUYAiABKAY6AjgBGjoKGE1hcFNmaXhlZDMyU2Zp", + "eGVkMzJFbnRyeRILCgNrZXkYASABKA8SDQoFdmFsdWUYAiABKA86AjgBGjoK", + "GE1hcFNmaXhlZDY0U2ZpeGVkNjRFbnRyeRILCgNrZXkYASABKBASDQoFdmFs", + "dWUYAiABKBA6AjgBGjQKEk1hcEludDMyRmxvYXRFbnRyeRILCgNrZXkYASAB", + "KAUSDQoFdmFsdWUYAiABKAI6AjgBGjUKE01hcEludDMyRG91YmxlRW50cnkS", + "CwoDa2V5GAEgASgFEg0KBXZhbHVlGAIgASgBOgI4ARoyChBNYXBCb29sQm9v", + "bEVudHJ5EgsKA2tleRgBIAEoCBINCgV2YWx1ZRgCIAEoCDoCOAEaUAoRTWFw", + "SW50MzJFbnVtRW50cnkSCwoDa2V5GAEgASgFEioKBXZhbHVlGAIgASgOMhsu", + "cHJvdG9idWZfdW5pdHRlc3QzLk1hcEVudW06AjgBGmEKG01hcEludDMyRm9y", + "ZWlnbk1lc3NhZ2VFbnRyeRILCgNrZXkYASABKAUSMQoFdmFsdWUYAiABKAsy", + "Ii5wcm90b2J1Zl91bml0dGVzdDMuRm9yZWlnbk1lc3NhZ2U6AjgBIuYBCh9N", + "ZXNzYWdlQ29udGFpbmluZ0VudW1DYWxsZWRUeXBlEksKBHR5cGUYASADKAsy", + "PS5wcm90b2J1Zl91bml0dGVzdDMuTWVzc2FnZUNvbnRhaW5pbmdFbnVtQ2Fs", + "bGVkVHlwZS5UeXBlRW50cnkaYAoJVHlwZUVudHJ5EgsKA2tleRgBIAEoBRJC", + "CgV2YWx1ZRgCIAEoCzIzLnByb3RvYnVmX3VuaXR0ZXN0My5NZXNzYWdlQ29u", + "dGFpbmluZ0VudW1DYWxsZWRUeXBlOgI4ASIUCgRUeXBlEgwKCFRZUEVfRk9P", + "EAAingEKH01lc3NhZ2VDb250YWluaW5nTWFwQ2FsbGVkRW50cnkSTQoFZW50", + "cnkYASADKAsyPi5wcm90b2J1Zl91bml0dGVzdDMuTWVzc2FnZUNvbnRhaW5p", + "bmdNYXBDYWxsZWRFbnRyeS5FbnRyeUVudHJ5GiwKCkVudHJ5RW50cnkSCwoD", + "a2V5GAEgASgFEg0KBXZhbHVlGAIgASgFOgI4ASo/CgdNYXBFbnVtEhAKDE1B", + "UF9FTlVNX0ZPTxAAEhAKDE1BUF9FTlVNX0JBUhABEhAKDE1BUF9FTlVNX0JB", + "WhACQh2qAhpHb29nbGUuUHJvdG9idWYuVGVzdFByb3Rvc2IGcHJvdG8z")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Google.Protobuf.TestProtos.MapEnum), }, new pbr::GeneratedClrTypeInfo[] { @@ -176,6 +178,7 @@ namespace Google.Protobuf.TestProtos { /// public sealed partial class TestMap : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TestMap()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -215,6 +218,7 @@ namespace Google.Protobuf.TestProtos { mapInt32Bytes_ = other.mapInt32Bytes_.Clone(); mapInt32Enum_ = other.mapInt32Enum_.Clone(); mapInt32ForeignMessage_ = other.mapInt32ForeignMessage_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -422,7 +426,7 @@ namespace Google.Protobuf.TestProtos { if (!MapInt32Bytes.Equals(other.MapInt32Bytes)) return false; if (!MapInt32Enum.Equals(other.MapInt32Enum)) return false; if (!MapInt32ForeignMessage.Equals(other.MapInt32ForeignMessage)) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -445,6 +449,9 @@ namespace Google.Protobuf.TestProtos { hash ^= MapInt32Bytes.GetHashCode(); hash ^= MapInt32Enum.GetHashCode(); hash ^= MapInt32ForeignMessage.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -472,6 +479,9 @@ namespace Google.Protobuf.TestProtos { mapInt32Bytes_.WriteTo(output, _map_mapInt32Bytes_codec); mapInt32Enum_.WriteTo(output, _map_mapInt32Enum_codec); mapInt32ForeignMessage_.WriteTo(output, _map_mapInt32ForeignMessage_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -494,6 +504,9 @@ namespace Google.Protobuf.TestProtos { size += mapInt32Bytes_.CalculateSize(_map_mapInt32Bytes_codec); size += mapInt32Enum_.CalculateSize(_map_mapInt32Enum_codec); size += mapInt32ForeignMessage_.CalculateSize(_map_mapInt32ForeignMessage_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -519,6 +532,7 @@ namespace Google.Protobuf.TestProtos { mapInt32Bytes_.Add(other.mapInt32Bytes_); mapInt32Enum_.Add(other.mapInt32Enum_); mapInt32ForeignMessage_.Add(other.mapInt32ForeignMessage_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -527,7 +541,7 @@ namespace Google.Protobuf.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { mapInt32Int32_.AddEntriesFrom(input, _map_mapInt32Int32_codec); @@ -605,6 +619,7 @@ namespace Google.Protobuf.TestProtos { public sealed partial class TestMapSubmessage : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TestMapSubmessage()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -628,6 +643,7 @@ namespace Google.Protobuf.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestMapSubmessage(TestMapSubmessage other) : this() { TestMap = other.testMap_ != null ? other.TestMap.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -660,13 +676,16 @@ namespace Google.Protobuf.TestProtos { return true; } if (!object.Equals(TestMap, other.TestMap)) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (testMap_ != null) hash ^= TestMap.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -681,6 +700,9 @@ namespace Google.Protobuf.TestProtos { output.WriteRawTag(10); output.WriteMessage(TestMap); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -689,6 +711,9 @@ namespace Google.Protobuf.TestProtos { if (testMap_ != null) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(TestMap); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -703,6 +728,7 @@ namespace Google.Protobuf.TestProtos { } TestMap.MergeFrom(other.TestMap); } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -711,7 +737,7 @@ namespace Google.Protobuf.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { if (testMap_ == null) { @@ -728,6 +754,7 @@ namespace Google.Protobuf.TestProtos { public sealed partial class TestMessageMap : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TestMessageMap()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -751,6 +778,7 @@ namespace Google.Protobuf.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestMessageMap(TestMessageMap other) : this() { mapInt32Message_ = other.mapInt32Message_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -782,13 +810,16 @@ namespace Google.Protobuf.TestProtos { return true; } if (!MapInt32Message.Equals(other.MapInt32Message)) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; hash ^= MapInt32Message.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -800,12 +831,18 @@ namespace Google.Protobuf.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { mapInt32Message_.WriteTo(output, _map_mapInt32Message_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; size += mapInt32Message_.CalculateSize(_map_mapInt32Message_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -815,6 +852,7 @@ namespace Google.Protobuf.TestProtos { return; } mapInt32Message_.Add(other.mapInt32Message_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -823,7 +861,7 @@ namespace Google.Protobuf.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { mapInt32Message_.AddEntriesFrom(input, _map_mapInt32Message_codec); @@ -840,6 +878,7 @@ namespace Google.Protobuf.TestProtos { /// public sealed partial class TestSameTypeMap : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TestSameTypeMap()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -864,6 +903,7 @@ namespace Google.Protobuf.TestProtos { public TestSameTypeMap(TestSameTypeMap other) : this() { map1_ = other.map1_.Clone(); map2_ = other.map2_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -906,7 +946,7 @@ namespace Google.Protobuf.TestProtos { } if (!Map1.Equals(other.Map1)) return false; if (!Map2.Equals(other.Map2)) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -914,6 +954,9 @@ namespace Google.Protobuf.TestProtos { int hash = 1; hash ^= Map1.GetHashCode(); hash ^= Map2.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -926,6 +969,9 @@ namespace Google.Protobuf.TestProtos { public void WriteTo(pb::CodedOutputStream output) { map1_.WriteTo(output, _map_map1_codec); map2_.WriteTo(output, _map_map2_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -933,6 +979,9 @@ namespace Google.Protobuf.TestProtos { int size = 0; size += map1_.CalculateSize(_map_map1_codec); size += map2_.CalculateSize(_map_map2_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -943,6 +992,7 @@ namespace Google.Protobuf.TestProtos { } map1_.Add(other.map1_); map2_.Add(other.map2_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -951,7 +1001,7 @@ namespace Google.Protobuf.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { map1_.AddEntriesFrom(input, _map_map1_codec); @@ -969,6 +1019,7 @@ namespace Google.Protobuf.TestProtos { public sealed partial class TestArenaMap : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TestArenaMap()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -1006,6 +1057,7 @@ namespace Google.Protobuf.TestProtos { mapBoolBool_ = other.mapBoolBool_.Clone(); mapInt32Enum_ = other.mapInt32Enum_.Clone(); mapInt32ForeignMessage_ = other.mapInt32ForeignMessage_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1191,7 +1243,7 @@ namespace Google.Protobuf.TestProtos { if (!MapBoolBool.Equals(other.MapBoolBool)) return false; if (!MapInt32Enum.Equals(other.MapInt32Enum)) return false; if (!MapInt32ForeignMessage.Equals(other.MapInt32ForeignMessage)) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1212,6 +1264,9 @@ namespace Google.Protobuf.TestProtos { hash ^= MapBoolBool.GetHashCode(); hash ^= MapInt32Enum.GetHashCode(); hash ^= MapInt32ForeignMessage.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -1237,6 +1292,9 @@ namespace Google.Protobuf.TestProtos { mapBoolBool_.WriteTo(output, _map_mapBoolBool_codec); mapInt32Enum_.WriteTo(output, _map_mapInt32Enum_codec); mapInt32ForeignMessage_.WriteTo(output, _map_mapInt32ForeignMessage_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1257,6 +1315,9 @@ namespace Google.Protobuf.TestProtos { size += mapBoolBool_.CalculateSize(_map_mapBoolBool_codec); size += mapInt32Enum_.CalculateSize(_map_mapInt32Enum_codec); size += mapInt32ForeignMessage_.CalculateSize(_map_mapInt32ForeignMessage_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -1280,6 +1341,7 @@ namespace Google.Protobuf.TestProtos { mapBoolBool_.Add(other.mapBoolBool_); mapInt32Enum_.Add(other.mapInt32Enum_); mapInt32ForeignMessage_.Add(other.mapInt32ForeignMessage_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1288,7 +1350,7 @@ namespace Google.Protobuf.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { mapInt32Int32_.AddEntriesFrom(input, _map_mapInt32Int32_codec); @@ -1362,6 +1424,7 @@ namespace Google.Protobuf.TestProtos { /// public sealed partial class MessageContainingEnumCalledType : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new MessageContainingEnumCalledType()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -1385,6 +1448,7 @@ namespace Google.Protobuf.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public MessageContainingEnumCalledType(MessageContainingEnumCalledType other) : this() { type_ = other.type_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1416,13 +1480,16 @@ namespace Google.Protobuf.TestProtos { return true; } if (!Type.Equals(other.Type)) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; hash ^= Type.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -1434,12 +1501,18 @@ namespace Google.Protobuf.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { type_.WriteTo(output, _map_type_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; size += type_.CalculateSize(_map_type_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -1449,6 +1522,7 @@ namespace Google.Protobuf.TestProtos { return; } type_.Add(other.type_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1457,7 +1531,7 @@ namespace Google.Protobuf.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { type_.AddEntriesFrom(input, _map_type_codec); @@ -1485,6 +1559,7 @@ namespace Google.Protobuf.TestProtos { /// public sealed partial class MessageContainingMapCalledEntry : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new MessageContainingMapCalledEntry()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -1508,6 +1583,7 @@ namespace Google.Protobuf.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public MessageContainingMapCalledEntry(MessageContainingMapCalledEntry other) : this() { entry_ = other.entry_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1539,13 +1615,16 @@ namespace Google.Protobuf.TestProtos { return true; } if (!Entry.Equals(other.Entry)) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; hash ^= Entry.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -1557,12 +1636,18 @@ namespace Google.Protobuf.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { entry_.WriteTo(output, _map_entry_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; size += entry_.CalculateSize(_map_entry_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -1572,6 +1657,7 @@ namespace Google.Protobuf.TestProtos { return; } entry_.Add(other.entry_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1580,7 +1666,7 @@ namespace Google.Protobuf.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { entry_.AddEntriesFrom(input, _map_entry_codec); diff --git a/csharp/src/Google.Protobuf.Test/TestProtos/TestMessagesProto3.cs b/csharp/src/Google.Protobuf.Test/TestProtos/TestMessagesProto3.cs index 6607be7a..a2a236d9 100644 --- a/csharp/src/Google.Protobuf.Test/TestProtos/TestMessagesProto3.cs +++ b/csharp/src/Google.Protobuf.Test/TestProtos/TestMessagesProto3.cs @@ -1,5 +1,7 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/protobuf/test_messages_proto3.proto +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/protobuf/test_messages_proto3.proto +// #pragma warning disable 1591, 0612, 3021 #region Designer generated code @@ -27,7 +29,7 @@ namespace ProtobufTestMessages.Proto3 { "dWYvYW55LnByb3RvGh5nb29nbGUvcHJvdG9idWYvZHVyYXRpb24ucHJvdG8a", "IGdvb2dsZS9wcm90b2J1Zi9maWVsZF9tYXNrLnByb3RvGhxnb29nbGUvcHJv", "dG9idWYvc3RydWN0LnByb3RvGh9nb29nbGUvcHJvdG9idWYvdGltZXN0YW1w", - "LnByb3RvGh5nb29nbGUvcHJvdG9idWYvd3JhcHBlcnMucHJvdG8irDsKElRl", + "LnByb3RvGh5nb29nbGUvcHJvdG9idWYvd3JhcHBlcnMucHJvdG8itDsKElRl", "c3RBbGxUeXBlc1Byb3RvMxIWCg5vcHRpb25hbF9pbnQzMhgBIAEoBRIWCg5v", "cHRpb25hbF9pbnQ2NBgCIAEoAxIXCg9vcHRpb25hbF91aW50MzIYAyABKA0S", "FwoPb3B0aW9uYWxfdWludDY0GAQgASgEEhcKD29wdGlvbmFsX3NpbnQzMhgF", @@ -196,11 +198,11 @@ namespace ProtobufTestMessages.Proto3 { "Z0ZvcmVpZ25FbnVtRW50cnkSCwoDa2V5GAEgASgJEjkKBXZhbHVlGAIgASgO", "MioucHJvdG9idWZfdGVzdF9tZXNzYWdlcy5wcm90bzMuRm9yZWlnbkVudW06", "AjgBIjkKCk5lc3RlZEVudW0SBwoDRk9PEAASBwoDQkFSEAESBwoDQkFaEAIS", - "EAoDTkVHEP///////////wFCDQoLb25lb2ZfZmllbGQiGwoORm9yZWlnbk1l", - "c3NhZ2USCQoBYxgBIAEoBSpACgtGb3JlaWduRW51bRIPCgtGT1JFSUdOX0ZP", - "TxAAEg8KC0ZPUkVJR05fQkFSEAESDwoLRk9SRUlHTl9CQVoQAkI4Cihjb20u", - "Z29vZ2xlLnByb3RvYnVmX3Rlc3RfbWVzc2FnZXMucHJvdG8zSAH4AQGiAgZQ", - "cm90bzNiBnByb3RvMw==")); + "EAoDTkVHEP///////////wFCDQoLb25lb2ZfZmllbGRKBgj1AxD/AyIbCg5G", + "b3JlaWduTWVzc2FnZRIJCgFjGAEgASgFKkAKC0ZvcmVpZ25FbnVtEg8KC0ZP", + "UkVJR05fRk9PEAASDwoLRk9SRUlHTl9CQVIQARIPCgtGT1JFSUdOX0JBWhAC", + "QjgKKGNvbS5nb29nbGUucHJvdG9idWZfdGVzdF9tZXNzYWdlcy5wcm90bzNI", + "AfgBAaICBlByb3RvM2IGcHJvdG8z")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { global::Google.Protobuf.WellKnownTypes.AnyReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.DurationReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.FieldMaskReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.StructReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.TimestampReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.WrappersReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(new[] {typeof(global::ProtobufTestMessages.Proto3.ForeignEnum), }, new pbr::GeneratedClrTypeInfo[] { @@ -233,6 +235,7 @@ namespace ProtobufTestMessages.Proto3 { /// public sealed partial class TestAllTypesProto3 : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TestAllTypesProto3()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -395,6 +398,7 @@ namespace ProtobufTestMessages.Proto3 { break; } + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1730,8 +1734,8 @@ namespace ProtobufTestMessages.Proto3 { if (OptionalFixed64 != other.OptionalFixed64) return false; if (OptionalSfixed32 != other.OptionalSfixed32) return false; if (OptionalSfixed64 != other.OptionalSfixed64) return false; - if (OptionalFloat != other.OptionalFloat) return false; - if (OptionalDouble != other.OptionalDouble) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.Equals(OptionalFloat, other.OptionalFloat)) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(OptionalDouble, other.OptionalDouble)) return false; if (OptionalBool != other.OptionalBool) return false; if (OptionalString != other.OptionalString) return false; if (OptionalBytes != other.OptionalBytes) return false; @@ -1788,16 +1792,16 @@ namespace ProtobufTestMessages.Proto3 { if (OneofBytes != other.OneofBytes) return false; if (OneofBool != other.OneofBool) return false; if (OneofUint64 != other.OneofUint64) return false; - if (OneofFloat != other.OneofFloat) return false; - if (OneofDouble != other.OneofDouble) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.Equals(OneofFloat, other.OneofFloat)) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(OneofDouble, other.OneofDouble)) return false; if (OneofEnum != other.OneofEnum) return false; if (OptionalBoolWrapper != other.OptionalBoolWrapper) return false; if (OptionalInt32Wrapper != other.OptionalInt32Wrapper) return false; if (OptionalInt64Wrapper != other.OptionalInt64Wrapper) return false; if (OptionalUint32Wrapper != other.OptionalUint32Wrapper) return false; if (OptionalUint64Wrapper != other.OptionalUint64Wrapper) return false; - if (OptionalFloatWrapper != other.OptionalFloatWrapper) return false; - if (OptionalDoubleWrapper != other.OptionalDoubleWrapper) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseNullableSingleEqualityComparer.Equals(OptionalFloatWrapper, other.OptionalFloatWrapper)) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseNullableDoubleEqualityComparer.Equals(OptionalDoubleWrapper, other.OptionalDoubleWrapper)) return false; if (OptionalStringWrapper != other.OptionalStringWrapper) return false; if (OptionalBytesWrapper != other.OptionalBytesWrapper) return false; if(!repeatedBoolWrapper_.Equals(other.repeatedBoolWrapper_)) return false; @@ -1840,7 +1844,7 @@ namespace ProtobufTestMessages.Proto3 { if (FieldName17 != other.FieldName17) return false; if (FieldName18 != other.FieldName18) return false; if (OneofFieldCase != other.OneofFieldCase) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1856,8 +1860,8 @@ namespace ProtobufTestMessages.Proto3 { if (OptionalFixed64 != 0UL) hash ^= OptionalFixed64.GetHashCode(); if (OptionalSfixed32 != 0) hash ^= OptionalSfixed32.GetHashCode(); if (OptionalSfixed64 != 0L) hash ^= OptionalSfixed64.GetHashCode(); - if (OptionalFloat != 0F) hash ^= OptionalFloat.GetHashCode(); - if (OptionalDouble != 0D) hash ^= OptionalDouble.GetHashCode(); + if (OptionalFloat != 0F) hash ^= pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode(OptionalFloat); + if (OptionalDouble != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(OptionalDouble); if (OptionalBool != false) hash ^= OptionalBool.GetHashCode(); if (OptionalString.Length != 0) hash ^= OptionalString.GetHashCode(); if (OptionalBytes.Length != 0) hash ^= OptionalBytes.GetHashCode(); @@ -1914,16 +1918,16 @@ namespace ProtobufTestMessages.Proto3 { if (oneofFieldCase_ == OneofFieldOneofCase.OneofBytes) hash ^= OneofBytes.GetHashCode(); if (oneofFieldCase_ == OneofFieldOneofCase.OneofBool) hash ^= OneofBool.GetHashCode(); if (oneofFieldCase_ == OneofFieldOneofCase.OneofUint64) hash ^= OneofUint64.GetHashCode(); - if (oneofFieldCase_ == OneofFieldOneofCase.OneofFloat) hash ^= OneofFloat.GetHashCode(); - if (oneofFieldCase_ == OneofFieldOneofCase.OneofDouble) hash ^= OneofDouble.GetHashCode(); + if (oneofFieldCase_ == OneofFieldOneofCase.OneofFloat) hash ^= pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode(OneofFloat); + if (oneofFieldCase_ == OneofFieldOneofCase.OneofDouble) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(OneofDouble); if (oneofFieldCase_ == OneofFieldOneofCase.OneofEnum) hash ^= OneofEnum.GetHashCode(); if (optionalBoolWrapper_ != null) hash ^= OptionalBoolWrapper.GetHashCode(); if (optionalInt32Wrapper_ != null) hash ^= OptionalInt32Wrapper.GetHashCode(); if (optionalInt64Wrapper_ != null) hash ^= OptionalInt64Wrapper.GetHashCode(); if (optionalUint32Wrapper_ != null) hash ^= OptionalUint32Wrapper.GetHashCode(); if (optionalUint64Wrapper_ != null) hash ^= OptionalUint64Wrapper.GetHashCode(); - if (optionalFloatWrapper_ != null) hash ^= OptionalFloatWrapper.GetHashCode(); - if (optionalDoubleWrapper_ != null) hash ^= OptionalDoubleWrapper.GetHashCode(); + if (optionalFloatWrapper_ != null) hash ^= pbc::ProtobufEqualityComparers.BitwiseNullableSingleEqualityComparer.GetHashCode(OptionalFloatWrapper); + if (optionalDoubleWrapper_ != null) hash ^= pbc::ProtobufEqualityComparers.BitwiseNullableDoubleEqualityComparer.GetHashCode(OptionalDoubleWrapper); if (optionalStringWrapper_ != null) hash ^= OptionalStringWrapper.GetHashCode(); if (optionalBytesWrapper_ != null) hash ^= OptionalBytesWrapper.GetHashCode(); hash ^= repeatedBoolWrapper_.GetHashCode(); @@ -1966,6 +1970,9 @@ namespace ProtobufTestMessages.Proto3 { if (FieldName17 != 0) hash ^= FieldName17.GetHashCode(); if (FieldName18 != 0) hash ^= FieldName18.GetHashCode(); hash ^= (int) oneofFieldCase_; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -2278,6 +2285,9 @@ namespace ProtobufTestMessages.Proto3 { output.WriteRawTag(144, 26); output.WriteInt32(FieldName18); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2530,6 +2540,9 @@ namespace ProtobufTestMessages.Proto3 { if (FieldName18 != 0) { size += 2 + pb::CodedOutputStream.ComputeInt32Size(FieldName18); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -2808,7 +2821,10 @@ namespace ProtobufTestMessages.Proto3 { OneofUint32 = other.OneofUint32; break; case OneofFieldOneofCase.OneofNestedMessage: - OneofNestedMessage = other.OneofNestedMessage; + if (OneofNestedMessage == null) { + OneofNestedMessage = new global::ProtobufTestMessages.Proto3.TestAllTypesProto3.Types.NestedMessage(); + } + OneofNestedMessage.MergeFrom(other.OneofNestedMessage); break; case OneofFieldOneofCase.OneofString: OneofString = other.OneofString; @@ -2833,6 +2849,7 @@ namespace ProtobufTestMessages.Proto3 { break; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2841,7 +2858,7 @@ namespace ProtobufTestMessages.Proto3 { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 8: { OptionalInt32 = input.ReadInt32(); @@ -3414,6 +3431,7 @@ namespace ProtobufTestMessages.Proto3 { public sealed partial class NestedMessage : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new NestedMessage()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -3438,6 +3456,7 @@ namespace ProtobufTestMessages.Proto3 { public NestedMessage(NestedMessage other) : this() { a_ = other.a_; Corecursive = other.corecursive_ != null ? other.Corecursive.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3482,7 +3501,7 @@ namespace ProtobufTestMessages.Proto3 { } if (A != other.A) return false; if (!object.Equals(Corecursive, other.Corecursive)) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3490,6 +3509,9 @@ namespace ProtobufTestMessages.Proto3 { int hash = 1; if (A != 0) hash ^= A.GetHashCode(); if (corecursive_ != null) hash ^= Corecursive.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -3508,6 +3530,9 @@ namespace ProtobufTestMessages.Proto3 { output.WriteRawTag(18); output.WriteMessage(Corecursive); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3519,6 +3544,9 @@ namespace ProtobufTestMessages.Proto3 { if (corecursive_ != null) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(Corecursive); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -3536,6 +3564,7 @@ namespace ProtobufTestMessages.Proto3 { } Corecursive.MergeFrom(other.Corecursive); } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3544,7 +3573,7 @@ namespace ProtobufTestMessages.Proto3 { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 8: { A = input.ReadInt32(); @@ -3570,6 +3599,7 @@ namespace ProtobufTestMessages.Proto3 { public sealed partial class ForeignMessage : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ForeignMessage()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -3593,6 +3623,7 @@ namespace ProtobufTestMessages.Proto3 { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public ForeignMessage(ForeignMessage other) : this() { c_ = other.c_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3625,13 +3656,16 @@ namespace ProtobufTestMessages.Proto3 { return true; } if (C != other.C) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (C != 0) hash ^= C.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -3646,6 +3680,9 @@ namespace ProtobufTestMessages.Proto3 { output.WriteRawTag(8); output.WriteInt32(C); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3654,6 +3691,9 @@ namespace ProtobufTestMessages.Proto3 { if (C != 0) { size += 1 + pb::CodedOutputStream.ComputeInt32Size(C); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -3665,6 +3705,7 @@ namespace ProtobufTestMessages.Proto3 { if (other.C != 0) { C = other.C; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3673,7 +3714,7 @@ namespace ProtobufTestMessages.Proto3 { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 8: { C = input.ReadInt32(); diff --git a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestCustomOptionsProto3.cs b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestCustomOptionsProto3.cs index e21ede9c..6d02bda6 100644 --- a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestCustomOptionsProto3.cs +++ b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestCustomOptionsProto3.cs @@ -1,5 +1,7 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: unittest_custom_options_proto3.proto +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: unittest_custom_options_proto3.proto +// #pragma warning disable 1591, 0612, 3021 #region Designer generated code @@ -183,6 +185,7 @@ namespace UnitTest.Issues.TestProtos { /// public sealed partial class TestMessageWithCustomOptions : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TestMessageWithCustomOptions()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -212,6 +215,7 @@ namespace UnitTest.Issues.TestProtos { break; } + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -275,7 +279,7 @@ namespace UnitTest.Issues.TestProtos { if (Field1 != other.Field1) return false; if (OneofField != other.OneofField) return false; if (AnOneofCase != other.AnOneofCase) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -284,6 +288,9 @@ namespace UnitTest.Issues.TestProtos { if (Field1.Length != 0) hash ^= Field1.GetHashCode(); if (anOneofCase_ == AnOneofOneofCase.OneofField) hash ^= OneofField.GetHashCode(); hash ^= (int) anOneofCase_; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -302,6 +309,9 @@ namespace UnitTest.Issues.TestProtos { output.WriteRawTag(16); output.WriteInt32(OneofField); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -313,6 +323,9 @@ namespace UnitTest.Issues.TestProtos { if (anOneofCase_ == AnOneofOneofCase.OneofField) { size += 1 + pb::CodedOutputStream.ComputeInt32Size(OneofField); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -330,6 +343,7 @@ namespace UnitTest.Issues.TestProtos { break; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -338,7 +352,7 @@ namespace UnitTest.Issues.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { Field1 = input.ReadString(); @@ -373,6 +387,7 @@ namespace UnitTest.Issues.TestProtos { /// public sealed partial class CustomOptionFooRequest : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CustomOptionFooRequest()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -395,6 +410,7 @@ namespace UnitTest.Issues.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public CustomOptionFooRequest(CustomOptionFooRequest other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -415,12 +431,15 @@ namespace UnitTest.Issues.TestProtos { 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; } @@ -431,11 +450,17 @@ namespace UnitTest.Issues.TestProtos { [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; } @@ -444,6 +469,7 @@ namespace UnitTest.Issues.TestProtos { if (other == null) { return; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -452,7 +478,7 @@ namespace UnitTest.Issues.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; } } @@ -462,6 +488,7 @@ namespace UnitTest.Issues.TestProtos { public sealed partial class CustomOptionFooResponse : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CustomOptionFooResponse()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -484,6 +511,7 @@ namespace UnitTest.Issues.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public CustomOptionFooResponse(CustomOptionFooResponse other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -504,12 +532,15 @@ namespace UnitTest.Issues.TestProtos { 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; } @@ -520,11 +551,17 @@ namespace UnitTest.Issues.TestProtos { [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; } @@ -533,6 +570,7 @@ namespace UnitTest.Issues.TestProtos { if (other == null) { return; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -541,7 +579,7 @@ namespace UnitTest.Issues.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; } } @@ -551,6 +589,7 @@ namespace UnitTest.Issues.TestProtos { public sealed partial class CustomOptionFooClientMessage : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CustomOptionFooClientMessage()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -573,6 +612,7 @@ namespace UnitTest.Issues.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public CustomOptionFooClientMessage(CustomOptionFooClientMessage other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -593,12 +633,15 @@ namespace UnitTest.Issues.TestProtos { 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; } @@ -609,11 +652,17 @@ namespace UnitTest.Issues.TestProtos { [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; } @@ -622,6 +671,7 @@ namespace UnitTest.Issues.TestProtos { if (other == null) { return; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -630,7 +680,7 @@ namespace UnitTest.Issues.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; } } @@ -640,6 +690,7 @@ namespace UnitTest.Issues.TestProtos { public sealed partial class CustomOptionFooServerMessage : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CustomOptionFooServerMessage()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -662,6 +713,7 @@ namespace UnitTest.Issues.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public CustomOptionFooServerMessage(CustomOptionFooServerMessage other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -682,12 +734,15 @@ namespace UnitTest.Issues.TestProtos { 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; } @@ -698,11 +753,17 @@ namespace UnitTest.Issues.TestProtos { [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; } @@ -711,6 +772,7 @@ namespace UnitTest.Issues.TestProtos { if (other == null) { return; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -719,7 +781,7 @@ namespace UnitTest.Issues.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; } } @@ -729,6 +791,7 @@ namespace UnitTest.Issues.TestProtos { public sealed partial class DummyMessageContainingEnum : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DummyMessageContainingEnum()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -751,6 +814,7 @@ namespace UnitTest.Issues.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public DummyMessageContainingEnum(DummyMessageContainingEnum other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -771,12 +835,15 @@ namespace UnitTest.Issues.TestProtos { 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; } @@ -787,11 +854,17 @@ namespace UnitTest.Issues.TestProtos { [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; } @@ -800,6 +873,7 @@ namespace UnitTest.Issues.TestProtos { if (other == null) { return; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -808,7 +882,7 @@ namespace UnitTest.Issues.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; } } @@ -831,6 +905,7 @@ namespace UnitTest.Issues.TestProtos { public sealed partial class DummyMessageInvalidAsOptionType : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DummyMessageInvalidAsOptionType()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -853,6 +928,7 @@ namespace UnitTest.Issues.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public DummyMessageInvalidAsOptionType(DummyMessageInvalidAsOptionType other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -873,12 +949,15 @@ namespace UnitTest.Issues.TestProtos { 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; } @@ -889,11 +968,17 @@ namespace UnitTest.Issues.TestProtos { [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; } @@ -902,6 +987,7 @@ namespace UnitTest.Issues.TestProtos { if (other == null) { return; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -910,7 +996,7 @@ namespace UnitTest.Issues.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; } } @@ -920,6 +1006,7 @@ namespace UnitTest.Issues.TestProtos { public sealed partial class CustomOptionMinIntegerValues : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CustomOptionMinIntegerValues()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -942,6 +1029,7 @@ namespace UnitTest.Issues.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public CustomOptionMinIntegerValues(CustomOptionMinIntegerValues other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -962,12 +1050,15 @@ namespace UnitTest.Issues.TestProtos { 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; } @@ -978,11 +1069,17 @@ namespace UnitTest.Issues.TestProtos { [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; } @@ -991,6 +1088,7 @@ namespace UnitTest.Issues.TestProtos { if (other == null) { return; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -999,7 +1097,7 @@ namespace UnitTest.Issues.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; } } @@ -1009,6 +1107,7 @@ namespace UnitTest.Issues.TestProtos { public sealed partial class CustomOptionMaxIntegerValues : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CustomOptionMaxIntegerValues()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -1031,6 +1130,7 @@ namespace UnitTest.Issues.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public CustomOptionMaxIntegerValues(CustomOptionMaxIntegerValues other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1051,12 +1151,15 @@ namespace UnitTest.Issues.TestProtos { 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; } @@ -1067,11 +1170,17 @@ namespace UnitTest.Issues.TestProtos { [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; } @@ -1080,6 +1189,7 @@ namespace UnitTest.Issues.TestProtos { if (other == null) { return; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1088,7 +1198,7 @@ namespace UnitTest.Issues.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; } } @@ -1098,6 +1208,7 @@ namespace UnitTest.Issues.TestProtos { public sealed partial class CustomOptionOtherValues : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CustomOptionOtherValues()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -1120,6 +1231,7 @@ namespace UnitTest.Issues.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public CustomOptionOtherValues(CustomOptionOtherValues other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1140,12 +1252,15 @@ namespace UnitTest.Issues.TestProtos { 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; } @@ -1156,11 +1271,17 @@ namespace UnitTest.Issues.TestProtos { [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; } @@ -1169,6 +1290,7 @@ namespace UnitTest.Issues.TestProtos { if (other == null) { return; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1177,7 +1299,7 @@ namespace UnitTest.Issues.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; } } @@ -1187,6 +1309,7 @@ namespace UnitTest.Issues.TestProtos { public sealed partial class SettingRealsFromPositiveInts : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SettingRealsFromPositiveInts()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -1209,6 +1332,7 @@ namespace UnitTest.Issues.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public SettingRealsFromPositiveInts(SettingRealsFromPositiveInts other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1229,12 +1353,15 @@ namespace UnitTest.Issues.TestProtos { 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; } @@ -1245,11 +1372,17 @@ namespace UnitTest.Issues.TestProtos { [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; } @@ -1258,6 +1391,7 @@ namespace UnitTest.Issues.TestProtos { if (other == null) { return; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1266,7 +1400,7 @@ namespace UnitTest.Issues.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; } } @@ -1276,6 +1410,7 @@ namespace UnitTest.Issues.TestProtos { public sealed partial class SettingRealsFromNegativeInts : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SettingRealsFromNegativeInts()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -1298,6 +1433,7 @@ namespace UnitTest.Issues.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public SettingRealsFromNegativeInts(SettingRealsFromNegativeInts other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1318,12 +1454,15 @@ namespace UnitTest.Issues.TestProtos { 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; } @@ -1334,11 +1473,17 @@ namespace UnitTest.Issues.TestProtos { [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; } @@ -1347,6 +1492,7 @@ namespace UnitTest.Issues.TestProtos { if (other == null) { return; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1355,7 +1501,7 @@ namespace UnitTest.Issues.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; } } @@ -1365,6 +1511,7 @@ namespace UnitTest.Issues.TestProtos { public sealed partial class ComplexOptionType1 : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ComplexOptionType1()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -1391,6 +1538,7 @@ namespace UnitTest.Issues.TestProtos { foo2_ = other.foo2_; foo3_ = other.foo3_; foo4_ = other.foo4_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1458,7 +1606,7 @@ namespace UnitTest.Issues.TestProtos { if (Foo2 != other.Foo2) return false; if (Foo3 != other.Foo3) return false; if(!foo4_.Equals(other.foo4_)) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1468,6 +1616,9 @@ namespace UnitTest.Issues.TestProtos { if (Foo2 != 0) hash ^= Foo2.GetHashCode(); if (Foo3 != 0) hash ^= Foo3.GetHashCode(); hash ^= foo4_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -1491,6 +1642,9 @@ namespace UnitTest.Issues.TestProtos { output.WriteInt32(Foo3); } foo4_.WriteTo(output, _repeated_foo4_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1506,6 +1660,9 @@ namespace UnitTest.Issues.TestProtos { size += 1 + pb::CodedOutputStream.ComputeInt32Size(Foo3); } size += foo4_.CalculateSize(_repeated_foo4_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -1524,6 +1681,7 @@ namespace UnitTest.Issues.TestProtos { Foo3 = other.Foo3; } foo4_.Add(other.foo4_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1532,7 +1690,7 @@ namespace UnitTest.Issues.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 8: { Foo = input.ReadInt32(); @@ -1559,6 +1717,7 @@ namespace UnitTest.Issues.TestProtos { public sealed partial class ComplexOptionType2 : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ComplexOptionType2()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -1585,6 +1744,7 @@ namespace UnitTest.Issues.TestProtos { baz_ = other.baz_; Fred = other.fred_ != null ? other.Fred.Clone() : null; barney_ = other.barney_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1652,7 +1812,7 @@ namespace UnitTest.Issues.TestProtos { if (Baz != other.Baz) return false; if (!object.Equals(Fred, other.Fred)) return false; if(!barney_.Equals(other.barney_)) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1662,6 +1822,9 @@ namespace UnitTest.Issues.TestProtos { if (Baz != 0) hash ^= Baz.GetHashCode(); if (fred_ != null) hash ^= Fred.GetHashCode(); hash ^= barney_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -1685,6 +1848,9 @@ namespace UnitTest.Issues.TestProtos { output.WriteMessage(Fred); } barney_.WriteTo(output, _repeated_barney_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1700,6 +1866,9 @@ namespace UnitTest.Issues.TestProtos { size += 1 + pb::CodedOutputStream.ComputeMessageSize(Fred); } size += barney_.CalculateSize(_repeated_barney_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -1724,6 +1893,7 @@ namespace UnitTest.Issues.TestProtos { Fred.MergeFrom(other.Fred); } barney_.Add(other.barney_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1732,7 +1902,7 @@ namespace UnitTest.Issues.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { if (bar_ == null) { @@ -1766,6 +1936,7 @@ namespace UnitTest.Issues.TestProtos { public static partial class Types { public sealed partial class ComplexOptionType4 : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ComplexOptionType4()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -1789,6 +1960,7 @@ namespace UnitTest.Issues.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public ComplexOptionType4(ComplexOptionType4 other) : this() { waldo_ = other.waldo_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1821,13 +1993,16 @@ namespace UnitTest.Issues.TestProtos { return true; } if (Waldo != other.Waldo) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (Waldo != 0) hash ^= Waldo.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -1842,6 +2017,9 @@ namespace UnitTest.Issues.TestProtos { output.WriteRawTag(8); output.WriteInt32(Waldo); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1850,6 +2028,9 @@ namespace UnitTest.Issues.TestProtos { if (Waldo != 0) { size += 1 + pb::CodedOutputStream.ComputeInt32Size(Waldo); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -1861,6 +2042,7 @@ namespace UnitTest.Issues.TestProtos { if (other.Waldo != 0) { Waldo = other.Waldo; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1869,7 +2051,7 @@ namespace UnitTest.Issues.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 8: { Waldo = input.ReadInt32(); @@ -1888,6 +2070,7 @@ namespace UnitTest.Issues.TestProtos { public sealed partial class ComplexOptionType3 : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ComplexOptionType3()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -1911,6 +2094,7 @@ namespace UnitTest.Issues.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public ComplexOptionType3(ComplexOptionType3 other) : this() { qux_ = other.qux_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1943,13 +2127,16 @@ namespace UnitTest.Issues.TestProtos { return true; } if (Qux != other.Qux) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (Qux != 0) hash ^= Qux.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -1964,6 +2151,9 @@ namespace UnitTest.Issues.TestProtos { output.WriteRawTag(8); output.WriteInt32(Qux); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1972,6 +2162,9 @@ namespace UnitTest.Issues.TestProtos { if (Qux != 0) { size += 1 + pb::CodedOutputStream.ComputeInt32Size(Qux); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -1983,6 +2176,7 @@ namespace UnitTest.Issues.TestProtos { if (other.Qux != 0) { Qux = other.Qux; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1991,7 +2185,7 @@ namespace UnitTest.Issues.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 8: { Qux = input.ReadInt32(); @@ -2008,6 +2202,7 @@ namespace UnitTest.Issues.TestProtos { /// public sealed partial class VariousComplexOptions : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new VariousComplexOptions()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -2030,6 +2225,7 @@ namespace UnitTest.Issues.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public VariousComplexOptions(VariousComplexOptions other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2050,12 +2246,15 @@ namespace UnitTest.Issues.TestProtos { 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; } @@ -2066,11 +2265,17 @@ namespace UnitTest.Issues.TestProtos { [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; } @@ -2079,6 +2284,7 @@ namespace UnitTest.Issues.TestProtos { if (other == null) { return; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2087,7 +2293,7 @@ namespace UnitTest.Issues.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; } } @@ -2100,6 +2306,7 @@ namespace UnitTest.Issues.TestProtos { /// public sealed partial class Aggregate : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Aggregate()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -2125,6 +2332,7 @@ namespace UnitTest.Issues.TestProtos { i_ = other.i_; s_ = other.s_; Sub = other.sub_ != null ? other.Sub.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2184,7 +2392,7 @@ namespace UnitTest.Issues.TestProtos { if (I != other.I) return false; if (S != other.S) return false; if (!object.Equals(Sub, other.Sub)) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2193,6 +2401,9 @@ namespace UnitTest.Issues.TestProtos { if (I != 0) hash ^= I.GetHashCode(); if (S.Length != 0) hash ^= S.GetHashCode(); if (sub_ != null) hash ^= Sub.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -2215,6 +2426,9 @@ namespace UnitTest.Issues.TestProtos { output.WriteRawTag(26); output.WriteMessage(Sub); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2229,6 +2443,9 @@ namespace UnitTest.Issues.TestProtos { if (sub_ != null) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(Sub); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -2249,6 +2466,7 @@ namespace UnitTest.Issues.TestProtos { } Sub.MergeFrom(other.Sub); } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2257,7 +2475,7 @@ namespace UnitTest.Issues.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 8: { I = input.ReadInt32(); @@ -2282,6 +2500,7 @@ namespace UnitTest.Issues.TestProtos { public sealed partial class AggregateMessage : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new AggregateMessage()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -2305,6 +2524,7 @@ namespace UnitTest.Issues.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public AggregateMessage(AggregateMessage other) : this() { fieldname_ = other.fieldname_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2337,13 +2557,16 @@ namespace UnitTest.Issues.TestProtos { return true; } if (Fieldname != other.Fieldname) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (Fieldname != 0) hash ^= Fieldname.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -2358,6 +2581,9 @@ namespace UnitTest.Issues.TestProtos { output.WriteRawTag(8); output.WriteInt32(Fieldname); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2366,6 +2592,9 @@ namespace UnitTest.Issues.TestProtos { if (Fieldname != 0) { size += 1 + pb::CodedOutputStream.ComputeInt32Size(Fieldname); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -2377,6 +2606,7 @@ namespace UnitTest.Issues.TestProtos { if (other.Fieldname != 0) { Fieldname = other.Fieldname; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2385,7 +2615,7 @@ namespace UnitTest.Issues.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 8: { Fieldname = input.ReadInt32(); @@ -2402,6 +2632,7 @@ namespace UnitTest.Issues.TestProtos { /// public sealed partial class NestedOptionType : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new NestedOptionType()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -2424,6 +2655,7 @@ namespace UnitTest.Issues.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public NestedOptionType(NestedOptionType other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2444,12 +2676,15 @@ namespace UnitTest.Issues.TestProtos { 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; } @@ -2460,11 +2695,17 @@ namespace UnitTest.Issues.TestProtos { [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; } @@ -2473,6 +2714,7 @@ namespace UnitTest.Issues.TestProtos { if (other == null) { return; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2481,7 +2723,7 @@ namespace UnitTest.Issues.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; } } @@ -2498,6 +2740,7 @@ namespace UnitTest.Issues.TestProtos { public sealed partial class NestedMessage : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new NestedMessage()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -2521,6 +2764,7 @@ namespace UnitTest.Issues.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public NestedMessage(NestedMessage other) : this() { nestedField_ = other.nestedField_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2553,13 +2797,16 @@ namespace UnitTest.Issues.TestProtos { return true; } if (NestedField != other.NestedField) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (NestedField != 0) hash ^= NestedField.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -2574,6 +2821,9 @@ namespace UnitTest.Issues.TestProtos { output.WriteRawTag(8); output.WriteInt32(NestedField); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2582,6 +2832,9 @@ namespace UnitTest.Issues.TestProtos { if (NestedField != 0) { size += 1 + pb::CodedOutputStream.ComputeInt32Size(NestedField); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -2593,6 +2846,7 @@ namespace UnitTest.Issues.TestProtos { if (other.NestedField != 0) { NestedField = other.NestedField; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2601,7 +2855,7 @@ namespace UnitTest.Issues.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 8: { NestedField = input.ReadInt32(); diff --git a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestImportProto3.cs b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestImportProto3.cs index f6df4e87..6bf97151 100644 --- a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestImportProto3.cs +++ b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestImportProto3.cs @@ -1,5 +1,7 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/protobuf/unittest_import_proto3.proto +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: unittest_import_proto3.proto +// #pragma warning disable 1591, 0612, 3021 #region Designer generated code @@ -9,11 +11,11 @@ using pbr = global::Google.Protobuf.Reflection; using scg = global::System.Collections.Generic; namespace Google.Protobuf.TestProtos { - /// Holder for reflection information generated from google/protobuf/unittest_import_proto3.proto + /// Holder for reflection information generated from unittest_import_proto3.proto public static partial class UnittestImportProto3Reflection { #region Descriptor - /// File descriptor for google/protobuf/unittest_import_proto3.proto + /// File descriptor for unittest_import_proto3.proto public static pbr::FileDescriptor Descriptor { get { return descriptor; } } @@ -22,14 +24,12 @@ namespace Google.Protobuf.TestProtos { static UnittestImportProto3Reflection() { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( - "Cixnb29nbGUvcHJvdG9idWYvdW5pdHRlc3RfaW1wb3J0X3Byb3RvMy5wcm90", - "bxIYcHJvdG9idWZfdW5pdHRlc3RfaW1wb3J0GjNnb29nbGUvcHJvdG9idWYv", - "dW5pdHRlc3RfaW1wb3J0X3B1YmxpY19wcm90bzMucHJvdG8iGgoNSW1wb3J0", - "TWVzc2FnZRIJCgFkGAEgASgFKlkKCkltcG9ydEVudW0SGwoXSU1QT1JUX0VO", - "VU1fVU5TUEVDSUZJRUQQABIOCgpJTVBPUlRfRk9PEAcSDgoKSU1QT1JUX0JB", - "UhAIEg4KCklNUE9SVF9CQVoQCUI8Chhjb20uZ29vZ2xlLnByb3RvYnVmLnRl", - "c3RIAfgBAaoCGkdvb2dsZS5Qcm90b2J1Zi5UZXN0UHJvdG9zUABiBnByb3Rv", - "Mw==")); + "Chx1bml0dGVzdF9pbXBvcnRfcHJvdG8zLnByb3RvEhhwcm90b2J1Zl91bml0", + "dGVzdF9pbXBvcnQaI3VuaXR0ZXN0X2ltcG9ydF9wdWJsaWNfcHJvdG8zLnBy", + "b3RvIhoKDUltcG9ydE1lc3NhZ2USCQoBZBgBIAEoBSpZCgpJbXBvcnRFbnVt", + "EhsKF0lNUE9SVF9FTlVNX1VOU1BFQ0lGSUVEEAASDgoKSU1QT1JUX0ZPTxAH", + "Eg4KCklNUE9SVF9CQVIQCBIOCgpJTVBPUlRfQkFaEAlCHaoCGkdvb2dsZS5Q", + "cm90b2J1Zi5UZXN0UHJvdG9zUABiBnByb3RvMw==")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { global::Google.Protobuf.TestProtos.UnittestImportPublicProto3Reflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Google.Protobuf.TestProtos.ImportEnum), }, new pbr::GeneratedClrTypeInfo[] { @@ -52,6 +52,7 @@ namespace Google.Protobuf.TestProtos { #region Messages public sealed partial class ImportMessage : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ImportMessage()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -75,6 +76,7 @@ namespace Google.Protobuf.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public ImportMessage(ImportMessage other) : this() { d_ = other.d_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -107,13 +109,16 @@ namespace Google.Protobuf.TestProtos { return true; } if (D != other.D) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (D != 0) hash ^= D.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -128,6 +133,9 @@ namespace Google.Protobuf.TestProtos { output.WriteRawTag(8); output.WriteInt32(D); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -136,6 +144,9 @@ namespace Google.Protobuf.TestProtos { if (D != 0) { size += 1 + pb::CodedOutputStream.ComputeInt32Size(D); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -147,6 +158,7 @@ namespace Google.Protobuf.TestProtos { if (other.D != 0) { D = other.D; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -155,7 +167,7 @@ namespace Google.Protobuf.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 8: { D = input.ReadInt32(); diff --git a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestImportPublicProto3.cs b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestImportPublicProto3.cs index 67b8edf4..97d181af 100644 --- a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestImportPublicProto3.cs +++ b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestImportPublicProto3.cs @@ -1,5 +1,7 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/protobuf/unittest_import_public_proto3.proto +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: unittest_import_public_proto3.proto +// #pragma warning disable 1591, 0612, 3021 #region Designer generated code @@ -9,11 +11,11 @@ using pbr = global::Google.Protobuf.Reflection; using scg = global::System.Collections.Generic; namespace Google.Protobuf.TestProtos { - /// Holder for reflection information generated from google/protobuf/unittest_import_public_proto3.proto + /// Holder for reflection information generated from unittest_import_public_proto3.proto public static partial class UnittestImportPublicProto3Reflection { #region Descriptor - /// File descriptor for google/protobuf/unittest_import_public_proto3.proto + /// File descriptor for unittest_import_public_proto3.proto public static pbr::FileDescriptor Descriptor { get { return descriptor; } } @@ -22,10 +24,10 @@ namespace Google.Protobuf.TestProtos { static UnittestImportPublicProto3Reflection() { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( - "CjNnb29nbGUvcHJvdG9idWYvdW5pdHRlc3RfaW1wb3J0X3B1YmxpY19wcm90", - "bzMucHJvdG8SGHByb3RvYnVmX3VuaXR0ZXN0X2ltcG9ydCIgChNQdWJsaWNJ", - "bXBvcnRNZXNzYWdlEgkKAWUYASABKAVCNwoYY29tLmdvb2dsZS5wcm90b2J1", - "Zi50ZXN0qgIaR29vZ2xlLlByb3RvYnVmLlRlc3RQcm90b3NiBnByb3RvMw==")); + "CiN1bml0dGVzdF9pbXBvcnRfcHVibGljX3Byb3RvMy5wcm90bxIYcHJvdG9i", + "dWZfdW5pdHRlc3RfaW1wb3J0IiAKE1B1YmxpY0ltcG9ydE1lc3NhZ2USCQoB", + "ZRgBIAEoBUIdqgIaR29vZ2xlLlByb3RvYnVmLlRlc3RQcm90b3NiBnByb3Rv", + "Mw==")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { @@ -38,6 +40,7 @@ namespace Google.Protobuf.TestProtos { #region Messages public sealed partial class PublicImportMessage : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new PublicImportMessage()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -61,6 +64,7 @@ namespace Google.Protobuf.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public PublicImportMessage(PublicImportMessage other) : this() { e_ = other.e_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -93,13 +97,16 @@ namespace Google.Protobuf.TestProtos { return true; } if (E != other.E) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (E != 0) hash ^= E.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -114,6 +121,9 @@ namespace Google.Protobuf.TestProtos { output.WriteRawTag(8); output.WriteInt32(E); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -122,6 +132,9 @@ namespace Google.Protobuf.TestProtos { if (E != 0) { size += 1 + pb::CodedOutputStream.ComputeInt32Size(E); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -133,6 +146,7 @@ namespace Google.Protobuf.TestProtos { if (other.E != 0) { E = other.E; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -141,7 +155,7 @@ namespace Google.Protobuf.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 8: { E = input.ReadInt32(); diff --git a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestIssues.cs b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestIssues.cs index cbf7909c..01a86f8f 100644 --- a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestIssues.cs +++ b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestIssues.cs @@ -1,5 +1,7 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: unittest_issues.proto +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: unittest_issues.proto +// #pragma warning disable 1591, 0612, 3021 #region Designer generated code @@ -48,8 +50,8 @@ namespace UnitTest.Issues.TestProtos { "GAEgASgFEgkKAXkYAiABKAVCBwoFdmFsdWUqVQoMTmVnYXRpdmVFbnVtEhYK", "Ek5FR0FUSVZFX0VOVU1fWkVSTxAAEhYKCUZpdmVCZWxvdxD7//////////8B", "EhUKCE1pbnVzT25lEP///////////wEqLgoORGVwcmVjYXRlZEVudW0SEwoP", - "REVQUkVDQVRFRF9aRVJPEAASBwoDb25lEAFCH0gBqgIaVW5pdFRlc3QuSXNz", - "dWVzLlRlc3RQcm90b3NiBnByb3RvMw==")); + "REVQUkVDQVRFRF9aRVJPEAASBwoDb25lEAFCHaoCGlVuaXRUZXN0Lklzc3Vl", + "cy5UZXN0UHJvdG9zYgZwcm90bzM=")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(new[] {typeof(global::UnitTest.Issues.TestProtos.NegativeEnum), typeof(global::UnitTest.Issues.TestProtos.DeprecatedEnum), }, new pbr::GeneratedClrTypeInfo[] { @@ -88,6 +90,7 @@ namespace UnitTest.Issues.TestProtos { /// public sealed partial class Issue307 : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Issue307()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -110,6 +113,7 @@ namespace UnitTest.Issues.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Issue307(Issue307 other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -130,12 +134,15 @@ namespace UnitTest.Issues.TestProtos { 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; } @@ -146,11 +153,17 @@ namespace UnitTest.Issues.TestProtos { [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; } @@ -159,6 +172,7 @@ namespace UnitTest.Issues.TestProtos { if (other == null) { return; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -167,7 +181,7 @@ namespace UnitTest.Issues.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; } } @@ -179,6 +193,7 @@ namespace UnitTest.Issues.TestProtos { public static partial class Types { public sealed partial class NestedOnce : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new NestedOnce()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -201,6 +216,7 @@ namespace UnitTest.Issues.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public NestedOnce(NestedOnce other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -221,12 +237,15 @@ namespace UnitTest.Issues.TestProtos { 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; } @@ -237,11 +256,17 @@ namespace UnitTest.Issues.TestProtos { [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; } @@ -250,6 +275,7 @@ namespace UnitTest.Issues.TestProtos { if (other == null) { return; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -258,7 +284,7 @@ namespace UnitTest.Issues.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; } } @@ -270,6 +296,7 @@ namespace UnitTest.Issues.TestProtos { public static partial class Types { public sealed partial class NestedTwice : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new NestedTwice()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -292,6 +319,7 @@ namespace UnitTest.Issues.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public NestedTwice(NestedTwice other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -312,12 +340,15 @@ namespace UnitTest.Issues.TestProtos { 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; } @@ -328,11 +359,17 @@ namespace UnitTest.Issues.TestProtos { [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; } @@ -341,6 +378,7 @@ namespace UnitTest.Issues.TestProtos { if (other == null) { return; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -349,7 +387,7 @@ namespace UnitTest.Issues.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; } } @@ -369,6 +407,7 @@ namespace UnitTest.Issues.TestProtos { public sealed partial class NegativeEnumMessage : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new NegativeEnumMessage()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -394,6 +433,7 @@ namespace UnitTest.Issues.TestProtos { value_ = other.value_; values_ = other.values_.Clone(); packedValues_ = other.packedValues_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -448,7 +488,7 @@ namespace UnitTest.Issues.TestProtos { if (Value != other.Value) return false; if(!values_.Equals(other.values_)) return false; if(!packedValues_.Equals(other.packedValues_)) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -457,6 +497,9 @@ namespace UnitTest.Issues.TestProtos { if (Value != 0) hash ^= Value.GetHashCode(); hash ^= values_.GetHashCode(); hash ^= packedValues_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -473,6 +516,9 @@ namespace UnitTest.Issues.TestProtos { } values_.WriteTo(output, _repeated_values_codec); packedValues_.WriteTo(output, _repeated_packedValues_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -483,6 +529,9 @@ namespace UnitTest.Issues.TestProtos { } size += values_.CalculateSize(_repeated_values_codec); size += packedValues_.CalculateSize(_repeated_packedValues_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -496,6 +545,7 @@ namespace UnitTest.Issues.TestProtos { } values_.Add(other.values_); packedValues_.Add(other.packedValues_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -504,7 +554,7 @@ namespace UnitTest.Issues.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 8: { value_ = (global::UnitTest.Issues.TestProtos.NegativeEnum) input.ReadEnum(); @@ -528,6 +578,7 @@ namespace UnitTest.Issues.TestProtos { public sealed partial class DeprecatedChild : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DeprecatedChild()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -550,6 +601,7 @@ namespace UnitTest.Issues.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public DeprecatedChild(DeprecatedChild other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -570,12 +622,15 @@ namespace UnitTest.Issues.TestProtos { 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; } @@ -586,11 +641,17 @@ namespace UnitTest.Issues.TestProtos { [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; } @@ -599,6 +660,7 @@ namespace UnitTest.Issues.TestProtos { if (other == null) { return; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -607,7 +669,7 @@ namespace UnitTest.Issues.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; } } @@ -617,6 +679,7 @@ namespace UnitTest.Issues.TestProtos { public sealed partial class DeprecatedFieldsMessage : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DeprecatedFieldsMessage()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -645,6 +708,7 @@ namespace UnitTest.Issues.TestProtos { messageArray_ = other.messageArray_.Clone(); enumValue_ = other.enumValue_; enumArray_ = other.enumArray_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -740,7 +804,7 @@ namespace UnitTest.Issues.TestProtos { if(!messageArray_.Equals(other.messageArray_)) return false; if (EnumValue != other.EnumValue) return false; if(!enumArray_.Equals(other.enumArray_)) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -752,6 +816,9 @@ namespace UnitTest.Issues.TestProtos { hash ^= messageArray_.GetHashCode(); if (EnumValue != 0) hash ^= EnumValue.GetHashCode(); hash ^= enumArray_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -777,6 +844,9 @@ namespace UnitTest.Issues.TestProtos { output.WriteEnum((int) EnumValue); } enumArray_.WriteTo(output, _repeated_enumArray_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -794,6 +864,9 @@ namespace UnitTest.Issues.TestProtos { size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) EnumValue); } size += enumArray_.CalculateSize(_repeated_enumArray_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -817,6 +890,7 @@ namespace UnitTest.Issues.TestProtos { EnumValue = other.EnumValue; } enumArray_.Add(other.enumArray_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -825,7 +899,7 @@ namespace UnitTest.Issues.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 8: { PrimitiveValue = input.ReadInt32(); @@ -867,6 +941,7 @@ namespace UnitTest.Issues.TestProtos { /// public sealed partial class ItemField : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ItemField()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -890,6 +965,7 @@ namespace UnitTest.Issues.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public ItemField(ItemField other) : this() { item_ = other.item_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -922,13 +998,16 @@ namespace UnitTest.Issues.TestProtos { return true; } if (Item != other.Item) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (Item != 0) hash ^= Item.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -943,6 +1022,9 @@ namespace UnitTest.Issues.TestProtos { output.WriteRawTag(8); output.WriteInt32(Item); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -951,6 +1033,9 @@ namespace UnitTest.Issues.TestProtos { if (Item != 0) { size += 1 + pb::CodedOutputStream.ComputeInt32Size(Item); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -962,6 +1047,7 @@ namespace UnitTest.Issues.TestProtos { if (other.Item != 0) { Item = other.Item; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -970,7 +1056,7 @@ namespace UnitTest.Issues.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 8: { Item = input.ReadInt32(); @@ -984,6 +1070,7 @@ namespace UnitTest.Issues.TestProtos { public sealed partial class ReservedNames : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ReservedNames()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -1008,6 +1095,7 @@ namespace UnitTest.Issues.TestProtos { public ReservedNames(ReservedNames other) : this() { types_ = other.types_; descriptor_ = other.descriptor_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1052,7 +1140,7 @@ namespace UnitTest.Issues.TestProtos { } if (Types_ != other.Types_) return false; if (Descriptor_ != other.Descriptor_) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1060,6 +1148,9 @@ namespace UnitTest.Issues.TestProtos { int hash = 1; if (Types_ != 0) hash ^= Types_.GetHashCode(); if (Descriptor_ != 0) hash ^= Descriptor_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -1078,6 +1169,9 @@ namespace UnitTest.Issues.TestProtos { output.WriteRawTag(16); output.WriteInt32(Descriptor_); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1089,6 +1183,9 @@ namespace UnitTest.Issues.TestProtos { if (Descriptor_ != 0) { size += 1 + pb::CodedOutputStream.ComputeInt32Size(Descriptor_); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -1103,6 +1200,7 @@ namespace UnitTest.Issues.TestProtos { if (other.Descriptor_ != 0) { Descriptor_ = other.Descriptor_; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1111,7 +1209,7 @@ namespace UnitTest.Issues.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 8: { Types_ = input.ReadInt32(); @@ -1134,6 +1232,7 @@ namespace UnitTest.Issues.TestProtos { /// public sealed partial class SomeNestedType : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SomeNestedType()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -1156,6 +1255,7 @@ namespace UnitTest.Issues.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public SomeNestedType(SomeNestedType other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1176,12 +1276,15 @@ namespace UnitTest.Issues.TestProtos { 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; } @@ -1192,11 +1295,17 @@ namespace UnitTest.Issues.TestProtos { [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; } @@ -1205,6 +1314,7 @@ namespace UnitTest.Issues.TestProtos { if (other == null) { return; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1213,7 +1323,7 @@ namespace UnitTest.Issues.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; } } @@ -1240,6 +1350,7 @@ namespace UnitTest.Issues.TestProtos { /// public sealed partial class TestJsonFieldOrdering : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TestJsonFieldOrdering()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -1282,6 +1393,7 @@ namespace UnitTest.Issues.TestProtos { break; } + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1414,7 +1526,7 @@ namespace UnitTest.Issues.TestProtos { if (O2String != other.O2String) return false; if (O1Case != other.O1Case) return false; if (O2Case != other.O2Case) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1428,6 +1540,9 @@ namespace UnitTest.Issues.TestProtos { if (o2Case_ == O2OneofCase.O2String) hash ^= O2String.GetHashCode(); hash ^= (int) o1Case_; hash ^= (int) o2Case_; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -1462,6 +1577,9 @@ namespace UnitTest.Issues.TestProtos { output.WriteRawTag(48); output.WriteInt32(O2Int32); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1485,6 +1603,9 @@ namespace UnitTest.Issues.TestProtos { if (o2Case_ == O2OneofCase.O2String) { size += 1 + pb::CodedOutputStream.ComputeStringSize(O2String); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -1517,6 +1638,7 @@ namespace UnitTest.Issues.TestProtos { break; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1525,7 +1647,7 @@ namespace UnitTest.Issues.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { PlainString = input.ReadString(); @@ -1559,6 +1681,7 @@ namespace UnitTest.Issues.TestProtos { public sealed partial class TestJsonName : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TestJsonName()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -1584,6 +1707,7 @@ namespace UnitTest.Issues.TestProtos { name_ = other.name_; description_ = other.description_; guid_ = other.guid_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1643,7 +1767,7 @@ namespace UnitTest.Issues.TestProtos { if (Name != other.Name) return false; if (Description != other.Description) return false; if (Guid != other.Guid) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1652,6 +1776,9 @@ namespace UnitTest.Issues.TestProtos { if (Name.Length != 0) hash ^= Name.GetHashCode(); if (Description.Length != 0) hash ^= Description.GetHashCode(); if (Guid.Length != 0) hash ^= Guid.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -1674,6 +1801,9 @@ namespace UnitTest.Issues.TestProtos { output.WriteRawTag(26); output.WriteString(Guid); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1688,6 +1818,9 @@ namespace UnitTest.Issues.TestProtos { if (Guid.Length != 0) { size += 1 + pb::CodedOutputStream.ComputeStringSize(Guid); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -1705,6 +1838,7 @@ namespace UnitTest.Issues.TestProtos { if (other.Guid.Length != 0) { Guid = other.Guid; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1713,7 +1847,7 @@ namespace UnitTest.Issues.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { Name = input.ReadString(); @@ -1740,6 +1874,7 @@ namespace UnitTest.Issues.TestProtos { /// public sealed partial class OneofMerging : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new OneofMerging()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -1771,6 +1906,7 @@ namespace UnitTest.Issues.TestProtos { break; } + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1835,7 +1971,7 @@ namespace UnitTest.Issues.TestProtos { if (Text != other.Text) return false; if (!object.Equals(Nested, other.Nested)) return false; if (ValueCase != other.ValueCase) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1844,6 +1980,9 @@ namespace UnitTest.Issues.TestProtos { if (valueCase_ == ValueOneofCase.Text) hash ^= Text.GetHashCode(); if (valueCase_ == ValueOneofCase.Nested) hash ^= Nested.GetHashCode(); hash ^= (int) valueCase_; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -1862,6 +2001,9 @@ namespace UnitTest.Issues.TestProtos { output.WriteRawTag(18); output.WriteMessage(Nested); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1873,6 +2015,9 @@ namespace UnitTest.Issues.TestProtos { if (valueCase_ == ValueOneofCase.Nested) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(Nested); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -1893,6 +2038,7 @@ namespace UnitTest.Issues.TestProtos { break; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1901,7 +2047,7 @@ namespace UnitTest.Issues.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { Text = input.ReadString(); @@ -1926,6 +2072,7 @@ namespace UnitTest.Issues.TestProtos { public static partial class Types { public sealed partial class Nested : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Nested()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -1950,6 +2097,7 @@ namespace UnitTest.Issues.TestProtos { public Nested(Nested other) : this() { x_ = other.x_; y_ = other.y_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1994,7 +2142,7 @@ namespace UnitTest.Issues.TestProtos { } if (X != other.X) return false; if (Y != other.Y) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2002,6 +2150,9 @@ namespace UnitTest.Issues.TestProtos { int hash = 1; if (X != 0) hash ^= X.GetHashCode(); if (Y != 0) hash ^= Y.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -2020,6 +2171,9 @@ namespace UnitTest.Issues.TestProtos { output.WriteRawTag(16); output.WriteInt32(Y); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2031,6 +2185,9 @@ namespace UnitTest.Issues.TestProtos { if (Y != 0) { size += 1 + pb::CodedOutputStream.ComputeInt32Size(Y); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -2045,6 +2202,7 @@ namespace UnitTest.Issues.TestProtos { if (other.Y != 0) { Y = other.Y; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2053,7 +2211,7 @@ namespace UnitTest.Issues.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 8: { X = input.ReadInt32(); diff --git a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestProto3.cs b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestProto3.cs index c11ab84d..4242c192 100644 --- a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestProto3.cs +++ b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestProto3.cs @@ -1,5 +1,7 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/protobuf/unittest_proto3.proto +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: unittest_proto3.proto +// #pragma warning disable 1591, 0612, 3021 #region Designer generated code @@ -9,11 +11,11 @@ using pbr = global::Google.Protobuf.Reflection; using scg = global::System.Collections.Generic; namespace Google.Protobuf.TestProtos { - /// Holder for reflection information generated from google/protobuf/unittest_proto3.proto + /// Holder for reflection information generated from unittest_proto3.proto public static partial class UnittestProto3Reflection { #region Descriptor - /// File descriptor for google/protobuf/unittest_proto3.proto + /// File descriptor for unittest_proto3.proto public static pbr::FileDescriptor Descriptor { get { return descriptor; } } @@ -22,135 +24,135 @@ namespace Google.Protobuf.TestProtos { static UnittestProto3Reflection() { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( - "CiVnb29nbGUvcHJvdG9idWYvdW5pdHRlc3RfcHJvdG8zLnByb3RvEhFwcm90", - "b2J1Zl91bml0dGVzdBosZ29vZ2xlL3Byb3RvYnVmL3VuaXR0ZXN0X2ltcG9y", - "dF9wcm90bzMucHJvdG8i8A8KDFRlc3RBbGxUeXBlcxIUCgxzaW5nbGVfaW50", - "MzIYASABKAUSFAoMc2luZ2xlX2ludDY0GAIgASgDEhUKDXNpbmdsZV91aW50", - "MzIYAyABKA0SFQoNc2luZ2xlX3VpbnQ2NBgEIAEoBBIVCg1zaW5nbGVfc2lu", - "dDMyGAUgASgREhUKDXNpbmdsZV9zaW50NjQYBiABKBISFgoOc2luZ2xlX2Zp", - "eGVkMzIYByABKAcSFgoOc2luZ2xlX2ZpeGVkNjQYCCABKAYSFwoPc2luZ2xl", - "X3NmaXhlZDMyGAkgASgPEhcKD3NpbmdsZV9zZml4ZWQ2NBgKIAEoEBIUCgxz", - "aW5nbGVfZmxvYXQYCyABKAISFQoNc2luZ2xlX2RvdWJsZRgMIAEoARITCgtz", - "aW5nbGVfYm9vbBgNIAEoCBIVCg1zaW5nbGVfc3RyaW5nGA4gASgJEhQKDHNp", - "bmdsZV9ieXRlcxgPIAEoDBJMChVzaW5nbGVfbmVzdGVkX21lc3NhZ2UYEiAB", - "KAsyLS5wcm90b2J1Zl91bml0dGVzdC5UZXN0QWxsVHlwZXMuTmVzdGVkTWVz", - "c2FnZRJBChZzaW5nbGVfZm9yZWlnbl9tZXNzYWdlGBMgASgLMiEucHJvdG9i", - "dWZfdW5pdHRlc3QuRm9yZWlnbk1lc3NhZ2USRgoVc2luZ2xlX2ltcG9ydF9t", - "ZXNzYWdlGBQgASgLMicucHJvdG9idWZfdW5pdHRlc3RfaW1wb3J0LkltcG9y", - "dE1lc3NhZ2USRgoSc2luZ2xlX25lc3RlZF9lbnVtGBUgASgOMioucHJvdG9i", - "dWZfdW5pdHRlc3QuVGVzdEFsbFR5cGVzLk5lc3RlZEVudW0SOwoTc2luZ2xl", - "X2ZvcmVpZ25fZW51bRgWIAEoDjIeLnByb3RvYnVmX3VuaXR0ZXN0LkZvcmVp", - "Z25FbnVtEkAKEnNpbmdsZV9pbXBvcnRfZW51bRgXIAEoDjIkLnByb3RvYnVm", - "X3VuaXR0ZXN0X2ltcG9ydC5JbXBvcnRFbnVtElMKHHNpbmdsZV9wdWJsaWNf", - "aW1wb3J0X21lc3NhZ2UYGiABKAsyLS5wcm90b2J1Zl91bml0dGVzdF9pbXBv", - "cnQuUHVibGljSW1wb3J0TWVzc2FnZRIWCg5yZXBlYXRlZF9pbnQzMhgfIAMo", - "BRIWCg5yZXBlYXRlZF9pbnQ2NBggIAMoAxIXCg9yZXBlYXRlZF91aW50MzIY", - "ISADKA0SFwoPcmVwZWF0ZWRfdWludDY0GCIgAygEEhcKD3JlcGVhdGVkX3Np", - "bnQzMhgjIAMoERIXCg9yZXBlYXRlZF9zaW50NjQYJCADKBISGAoQcmVwZWF0", - "ZWRfZml4ZWQzMhglIAMoBxIYChByZXBlYXRlZF9maXhlZDY0GCYgAygGEhkK", - "EXJlcGVhdGVkX3NmaXhlZDMyGCcgAygPEhkKEXJlcGVhdGVkX3NmaXhlZDY0", - "GCggAygQEhYKDnJlcGVhdGVkX2Zsb2F0GCkgAygCEhcKD3JlcGVhdGVkX2Rv", - "dWJsZRgqIAMoARIVCg1yZXBlYXRlZF9ib29sGCsgAygIEhcKD3JlcGVhdGVk", - "X3N0cmluZxgsIAMoCRIWCg5yZXBlYXRlZF9ieXRlcxgtIAMoDBJOChdyZXBl", - "YXRlZF9uZXN0ZWRfbWVzc2FnZRgwIAMoCzItLnByb3RvYnVmX3VuaXR0ZXN0", - "LlRlc3RBbGxUeXBlcy5OZXN0ZWRNZXNzYWdlEkMKGHJlcGVhdGVkX2ZvcmVp", - "Z25fbWVzc2FnZRgxIAMoCzIhLnByb3RvYnVmX3VuaXR0ZXN0LkZvcmVpZ25N", - "ZXNzYWdlEkgKF3JlcGVhdGVkX2ltcG9ydF9tZXNzYWdlGDIgAygLMicucHJv", - "dG9idWZfdW5pdHRlc3RfaW1wb3J0LkltcG9ydE1lc3NhZ2USSAoUcmVwZWF0", - "ZWRfbmVzdGVkX2VudW0YMyADKA4yKi5wcm90b2J1Zl91bml0dGVzdC5UZXN0", - "QWxsVHlwZXMuTmVzdGVkRW51bRI9ChVyZXBlYXRlZF9mb3JlaWduX2VudW0Y", - "NCADKA4yHi5wcm90b2J1Zl91bml0dGVzdC5Gb3JlaWduRW51bRJCChRyZXBl", - "YXRlZF9pbXBvcnRfZW51bRg1IAMoDjIkLnByb3RvYnVmX3VuaXR0ZXN0X2lt", - "cG9ydC5JbXBvcnRFbnVtElUKHnJlcGVhdGVkX3B1YmxpY19pbXBvcnRfbWVz", - "c2FnZRg2IAMoCzItLnByb3RvYnVmX3VuaXR0ZXN0X2ltcG9ydC5QdWJsaWNJ", - "bXBvcnRNZXNzYWdlEhYKDG9uZW9mX3VpbnQzMhhvIAEoDUgAEk0KFG9uZW9m", - "X25lc3RlZF9tZXNzYWdlGHAgASgLMi0ucHJvdG9idWZfdW5pdHRlc3QuVGVz", - "dEFsbFR5cGVzLk5lc3RlZE1lc3NhZ2VIABIWCgxvbmVvZl9zdHJpbmcYcSAB", - "KAlIABIVCgtvbmVvZl9ieXRlcxhyIAEoDEgAGhsKDU5lc3RlZE1lc3NhZ2US", - "CgoCYmIYASABKAUiVgoKTmVzdGVkRW51bRIbChdORVNURURfRU5VTV9VTlNQ", - "RUNJRklFRBAAEgcKA0ZPTxABEgcKA0JBUhACEgcKA0JBWhADEhAKA05FRxD/", - "//////////8BQg0KC29uZW9mX2ZpZWxkIrsBChJOZXN0ZWRUZXN0QWxsVHlw", - "ZXMSNAoFY2hpbGQYASABKAsyJS5wcm90b2J1Zl91bml0dGVzdC5OZXN0ZWRU", - "ZXN0QWxsVHlwZXMSMAoHcGF5bG9hZBgCIAEoCzIfLnByb3RvYnVmX3VuaXR0", - "ZXN0LlRlc3RBbGxUeXBlcxI9Cg5yZXBlYXRlZF9jaGlsZBgDIAMoCzIlLnBy", - "b3RvYnVmX3VuaXR0ZXN0Lk5lc3RlZFRlc3RBbGxUeXBlcyI0ChRUZXN0RGVw", - "cmVjYXRlZEZpZWxkcxIcChBkZXByZWNhdGVkX2ludDMyGAEgASgFQgIYASIb", - "Cg5Gb3JlaWduTWVzc2FnZRIJCgFjGAEgASgFIjAKElRlc3RSZXNlcnZlZEZp", - "ZWxkc0oECAIQA0oECA8QEEoECAkQDFIDYmFyUgNiYXoiWgoRVGVzdEZvcmVp", - "Z25OZXN0ZWQSRQoOZm9yZWlnbl9uZXN0ZWQYASABKAsyLS5wcm90b2J1Zl91", - "bml0dGVzdC5UZXN0QWxsVHlwZXMuTmVzdGVkTWVzc2FnZSI0ChhUZXN0UmVh", - "bGx5TGFyZ2VUYWdOdW1iZXISCQoBYRgBIAEoBRINCgJiYhj///9/IAEoBSJV", - "ChRUZXN0UmVjdXJzaXZlTWVzc2FnZRIyCgFhGAEgASgLMicucHJvdG9idWZf", - "dW5pdHRlc3QuVGVzdFJlY3Vyc2l2ZU1lc3NhZ2USCQoBaRgCIAEoBSJLChRU", - "ZXN0TXV0dWFsUmVjdXJzaW9uQRIzCgJiYhgBIAEoCzInLnByb3RvYnVmX3Vu", - "aXR0ZXN0LlRlc3RNdXR1YWxSZWN1cnNpb25CImIKFFRlc3RNdXR1YWxSZWN1", - "cnNpb25CEjIKAWEYASABKAsyJy5wcm90b2J1Zl91bml0dGVzdC5UZXN0TXV0", - "dWFsUmVjdXJzaW9uQRIWCg5vcHRpb25hbF9pbnQzMhgCIAEoBSJMChJUZXN0", - "RW51bUFsbG93QWxpYXMSNgoFdmFsdWUYASABKA4yJy5wcm90b2J1Zl91bml0", - "dGVzdC5UZXN0RW51bVdpdGhEdXBWYWx1ZSLrAgoXVGVzdENhbWVsQ2FzZUZp", - "ZWxkTmFtZXMSFgoOUHJpbWl0aXZlRmllbGQYASABKAUSEwoLU3RyaW5nRmll", - "bGQYAiABKAkSMQoJRW51bUZpZWxkGAMgASgOMh4ucHJvdG9idWZfdW5pdHRl", - "c3QuRm9yZWlnbkVudW0SNwoMTWVzc2FnZUZpZWxkGAQgASgLMiEucHJvdG9i", - "dWZfdW5pdHRlc3QuRm9yZWlnbk1lc3NhZ2USHgoWUmVwZWF0ZWRQcmltaXRp", - "dmVGaWVsZBgHIAMoBRIbChNSZXBlYXRlZFN0cmluZ0ZpZWxkGAggAygJEjkK", - "EVJlcGVhdGVkRW51bUZpZWxkGAkgAygOMh4ucHJvdG9idWZfdW5pdHRlc3Qu", - "Rm9yZWlnbkVudW0SPwoUUmVwZWF0ZWRNZXNzYWdlRmllbGQYCiADKAsyIS5w", - "cm90b2J1Zl91bml0dGVzdC5Gb3JlaWduTWVzc2FnZSLHAQoSVGVzdEZpZWxk", - "T3JkZXJpbmdzEhEKCW15X3N0cmluZxgLIAEoCRIOCgZteV9pbnQYASABKAMS", - "EAoIbXlfZmxvYXQYZSABKAISUwoVc2luZ2xlX25lc3RlZF9tZXNzYWdlGMgB", - "IAEoCzIzLnByb3RvYnVmX3VuaXR0ZXN0LlRlc3RGaWVsZE9yZGVyaW5ncy5O", - "ZXN0ZWRNZXNzYWdlGicKDU5lc3RlZE1lc3NhZ2USCgoCb28YAiABKAMSCgoC", - "YmIYASABKAUiSwoRU3BhcnNlRW51bU1lc3NhZ2USNgoLc3BhcnNlX2VudW0Y", - "ASABKA4yIS5wcm90b2J1Zl91bml0dGVzdC5UZXN0U3BhcnNlRW51bSIZCglP", - "bmVTdHJpbmcSDAoEZGF0YRgBIAEoCSIaCgpNb3JlU3RyaW5nEgwKBGRhdGEY", - "ASADKAkiGAoIT25lQnl0ZXMSDAoEZGF0YRgBIAEoDCIZCglNb3JlQnl0ZXMS", - "DAoEZGF0YRgBIAEoDCIcCgxJbnQzMk1lc3NhZ2USDAoEZGF0YRgBIAEoBSId", - "Cg1VaW50MzJNZXNzYWdlEgwKBGRhdGEYASABKA0iHAoMSW50NjRNZXNzYWdl", - "EgwKBGRhdGEYASABKAMiHQoNVWludDY0TWVzc2FnZRIMCgRkYXRhGAEgASgE", - "IhsKC0Jvb2xNZXNzYWdlEgwKBGRhdGEYASABKAgicwoJVGVzdE9uZW9mEhEK", - "B2Zvb19pbnQYASABKAVIABIUCgpmb29fc3RyaW5nGAIgASgJSAASNgoLZm9v", - "X21lc3NhZ2UYAyABKAsyHy5wcm90b2J1Zl91bml0dGVzdC5UZXN0QWxsVHlw", - "ZXNIAEIFCgNmb28iqgMKD1Rlc3RQYWNrZWRUeXBlcxIYCgxwYWNrZWRfaW50", - "MzIYWiADKAVCAhABEhgKDHBhY2tlZF9pbnQ2NBhbIAMoA0ICEAESGQoNcGFj", - "a2VkX3VpbnQzMhhcIAMoDUICEAESGQoNcGFja2VkX3VpbnQ2NBhdIAMoBEIC", - "EAESGQoNcGFja2VkX3NpbnQzMhheIAMoEUICEAESGQoNcGFja2VkX3NpbnQ2", - "NBhfIAMoEkICEAESGgoOcGFja2VkX2ZpeGVkMzIYYCADKAdCAhABEhoKDnBh", - "Y2tlZF9maXhlZDY0GGEgAygGQgIQARIbCg9wYWNrZWRfc2ZpeGVkMzIYYiAD", - "KA9CAhABEhsKD3BhY2tlZF9zZml4ZWQ2NBhjIAMoEEICEAESGAoMcGFja2Vk", - "X2Zsb2F0GGQgAygCQgIQARIZCg1wYWNrZWRfZG91YmxlGGUgAygBQgIQARIX", - "CgtwYWNrZWRfYm9vbBhmIAMoCEICEAESNwoLcGFja2VkX2VudW0YZyADKA4y", - "Hi5wcm90b2J1Zl91bml0dGVzdC5Gb3JlaWduRW51bUICEAEiyAMKEVRlc3RV", - "bnBhY2tlZFR5cGVzEhoKDnVucGFja2VkX2ludDMyGFogAygFQgIQABIaCg51", - "bnBhY2tlZF9pbnQ2NBhbIAMoA0ICEAASGwoPdW5wYWNrZWRfdWludDMyGFwg", - "AygNQgIQABIbCg91bnBhY2tlZF91aW50NjQYXSADKARCAhAAEhsKD3VucGFj", - "a2VkX3NpbnQzMhheIAMoEUICEAASGwoPdW5wYWNrZWRfc2ludDY0GF8gAygS", - "QgIQABIcChB1bnBhY2tlZF9maXhlZDMyGGAgAygHQgIQABIcChB1bnBhY2tl", - "ZF9maXhlZDY0GGEgAygGQgIQABIdChF1bnBhY2tlZF9zZml4ZWQzMhhiIAMo", - "D0ICEAASHQoRdW5wYWNrZWRfc2ZpeGVkNjQYYyADKBBCAhAAEhoKDnVucGFj", - "a2VkX2Zsb2F0GGQgAygCQgIQABIbCg91bnBhY2tlZF9kb3VibGUYZSADKAFC", - "AhAAEhkKDXVucGFja2VkX2Jvb2wYZiADKAhCAhAAEjkKDXVucGFja2VkX2Vu", - "dW0YZyADKA4yHi5wcm90b2J1Zl91bml0dGVzdC5Gb3JlaWduRW51bUICEAAi", - "wAEKI1Rlc3RSZXBlYXRlZFNjYWxhckRpZmZlcmVudFRhZ1NpemVzEhgKEHJl", - "cGVhdGVkX2ZpeGVkMzIYDCADKAcSFgoOcmVwZWF0ZWRfaW50MzIYDSADKAUS", - "GQoQcmVwZWF0ZWRfZml4ZWQ2NBj+DyADKAYSFwoOcmVwZWF0ZWRfaW50NjQY", - "/w8gAygDEhgKDnJlcGVhdGVkX2Zsb2F0GP7/DyADKAISGQoPcmVwZWF0ZWRf", - "dWludDY0GP//DyADKAQiKAobVGVzdENvbW1lbnRJbmplY3Rpb25NZXNzYWdl", - "EgkKAWEYASABKAkiDAoKRm9vUmVxdWVzdCINCgtGb29SZXNwb25zZSISChBG", - "b29DbGllbnRNZXNzYWdlIhIKEEZvb1NlcnZlck1lc3NhZ2UiDAoKQmFyUmVx", - "dWVzdCINCgtCYXJSZXNwb25zZSpZCgtGb3JlaWduRW51bRIXChNGT1JFSUdO", - "X1VOU1BFQ0lGSUVEEAASDwoLRk9SRUlHTl9GT08QBBIPCgtGT1JFSUdOX0JB", - "UhAFEg8KC0ZPUkVJR05fQkFaEAYqdQoUVGVzdEVudW1XaXRoRHVwVmFsdWUS", - "KAokVEVTVF9FTlVNX1dJVEhfRFVQX1ZBTFVFX1VOU1BFQ0lGSUVEEAASCAoE", - "Rk9PMRABEggKBEJBUjEQAhIHCgNCQVoQAxIICgRGT08yEAESCAoEQkFSMhAC", - "GgIQASqdAQoOVGVzdFNwYXJzZUVudW0SIAocVEVTVF9TUEFSU0VfRU5VTV9V", - "TlNQRUNJRklFRBAAEgwKCFNQQVJTRV9BEHsSDgoIU1BBUlNFX0IQpucDEg8K", - "CFNQQVJTRV9DELKxgAYSFQoIU1BBUlNFX0QQ8f//////////ARIVCghTUEFS", - "U0VfRRC03vz///////8BEgwKCFNQQVJTRV9HEAIymQEKC1Rlc3RTZXJ2aWNl", - "EkQKA0ZvbxIdLnByb3RvYnVmX3VuaXR0ZXN0LkZvb1JlcXVlc3QaHi5wcm90", - "b2J1Zl91bml0dGVzdC5Gb29SZXNwb25zZRJECgNCYXISHS5wcm90b2J1Zl91", - "bml0dGVzdC5CYXJSZXF1ZXN0Gh4ucHJvdG9idWZfdW5pdHRlc3QuQmFyUmVz", - "cG9uc2VCOkINVW5pdHRlc3RQcm90b0gBgAEBiAEBkAEB+AEBqgIaR29vZ2xl", - "LlByb3RvYnVmLlRlc3RQcm90b3NiBnByb3RvMw==")); + "ChV1bml0dGVzdF9wcm90bzMucHJvdG8SEnByb3RvYnVmX3VuaXR0ZXN0Mxoc", + "dW5pdHRlc3RfaW1wb3J0X3Byb3RvMy5wcm90byL5DwoMVGVzdEFsbFR5cGVz", + "EhQKDHNpbmdsZV9pbnQzMhgBIAEoBRIUCgxzaW5nbGVfaW50NjQYAiABKAMS", + "FQoNc2luZ2xlX3VpbnQzMhgDIAEoDRIVCg1zaW5nbGVfdWludDY0GAQgASgE", + "EhUKDXNpbmdsZV9zaW50MzIYBSABKBESFQoNc2luZ2xlX3NpbnQ2NBgGIAEo", + "EhIWCg5zaW5nbGVfZml4ZWQzMhgHIAEoBxIWCg5zaW5nbGVfZml4ZWQ2NBgI", + "IAEoBhIXCg9zaW5nbGVfc2ZpeGVkMzIYCSABKA8SFwoPc2luZ2xlX3NmaXhl", + "ZDY0GAogASgQEhQKDHNpbmdsZV9mbG9hdBgLIAEoAhIVCg1zaW5nbGVfZG91", + "YmxlGAwgASgBEhMKC3NpbmdsZV9ib29sGA0gASgIEhUKDXNpbmdsZV9zdHJp", + "bmcYDiABKAkSFAoMc2luZ2xlX2J5dGVzGA8gASgMEk0KFXNpbmdsZV9uZXN0", + "ZWRfbWVzc2FnZRgSIAEoCzIuLnByb3RvYnVmX3VuaXR0ZXN0My5UZXN0QWxs", + "VHlwZXMuTmVzdGVkTWVzc2FnZRJCChZzaW5nbGVfZm9yZWlnbl9tZXNzYWdl", + "GBMgASgLMiIucHJvdG9idWZfdW5pdHRlc3QzLkZvcmVpZ25NZXNzYWdlEkYK", + "FXNpbmdsZV9pbXBvcnRfbWVzc2FnZRgUIAEoCzInLnByb3RvYnVmX3VuaXR0", + "ZXN0X2ltcG9ydC5JbXBvcnRNZXNzYWdlEkcKEnNpbmdsZV9uZXN0ZWRfZW51", + "bRgVIAEoDjIrLnByb3RvYnVmX3VuaXR0ZXN0My5UZXN0QWxsVHlwZXMuTmVz", + "dGVkRW51bRI8ChNzaW5nbGVfZm9yZWlnbl9lbnVtGBYgASgOMh8ucHJvdG9i", + "dWZfdW5pdHRlc3QzLkZvcmVpZ25FbnVtEkAKEnNpbmdsZV9pbXBvcnRfZW51", + "bRgXIAEoDjIkLnByb3RvYnVmX3VuaXR0ZXN0X2ltcG9ydC5JbXBvcnRFbnVt", + "ElMKHHNpbmdsZV9wdWJsaWNfaW1wb3J0X21lc3NhZ2UYGiABKAsyLS5wcm90", + "b2J1Zl91bml0dGVzdF9pbXBvcnQuUHVibGljSW1wb3J0TWVzc2FnZRIWCg5y", + "ZXBlYXRlZF9pbnQzMhgfIAMoBRIWCg5yZXBlYXRlZF9pbnQ2NBggIAMoAxIX", + "Cg9yZXBlYXRlZF91aW50MzIYISADKA0SFwoPcmVwZWF0ZWRfdWludDY0GCIg", + "AygEEhcKD3JlcGVhdGVkX3NpbnQzMhgjIAMoERIXCg9yZXBlYXRlZF9zaW50", + "NjQYJCADKBISGAoQcmVwZWF0ZWRfZml4ZWQzMhglIAMoBxIYChByZXBlYXRl", + "ZF9maXhlZDY0GCYgAygGEhkKEXJlcGVhdGVkX3NmaXhlZDMyGCcgAygPEhkK", + "EXJlcGVhdGVkX3NmaXhlZDY0GCggAygQEhYKDnJlcGVhdGVkX2Zsb2F0GCkg", + "AygCEhcKD3JlcGVhdGVkX2RvdWJsZRgqIAMoARIVCg1yZXBlYXRlZF9ib29s", + "GCsgAygIEhcKD3JlcGVhdGVkX3N0cmluZxgsIAMoCRIWCg5yZXBlYXRlZF9i", + "eXRlcxgtIAMoDBJPChdyZXBlYXRlZF9uZXN0ZWRfbWVzc2FnZRgwIAMoCzIu", + "LnByb3RvYnVmX3VuaXR0ZXN0My5UZXN0QWxsVHlwZXMuTmVzdGVkTWVzc2Fn", + "ZRJEChhyZXBlYXRlZF9mb3JlaWduX21lc3NhZ2UYMSADKAsyIi5wcm90b2J1", + "Zl91bml0dGVzdDMuRm9yZWlnbk1lc3NhZ2USSAoXcmVwZWF0ZWRfaW1wb3J0", + "X21lc3NhZ2UYMiADKAsyJy5wcm90b2J1Zl91bml0dGVzdF9pbXBvcnQuSW1w", + "b3J0TWVzc2FnZRJJChRyZXBlYXRlZF9uZXN0ZWRfZW51bRgzIAMoDjIrLnBy", + "b3RvYnVmX3VuaXR0ZXN0My5UZXN0QWxsVHlwZXMuTmVzdGVkRW51bRI+ChVy", + "ZXBlYXRlZF9mb3JlaWduX2VudW0YNCADKA4yHy5wcm90b2J1Zl91bml0dGVz", + "dDMuRm9yZWlnbkVudW0SQgoUcmVwZWF0ZWRfaW1wb3J0X2VudW0YNSADKA4y", + "JC5wcm90b2J1Zl91bml0dGVzdF9pbXBvcnQuSW1wb3J0RW51bRJVCh5yZXBl", + "YXRlZF9wdWJsaWNfaW1wb3J0X21lc3NhZ2UYNiADKAsyLS5wcm90b2J1Zl91", + "bml0dGVzdF9pbXBvcnQuUHVibGljSW1wb3J0TWVzc2FnZRIWCgxvbmVvZl91", + "aW50MzIYbyABKA1IABJOChRvbmVvZl9uZXN0ZWRfbWVzc2FnZRhwIAEoCzIu", + "LnByb3RvYnVmX3VuaXR0ZXN0My5UZXN0QWxsVHlwZXMuTmVzdGVkTWVzc2Fn", + "ZUgAEhYKDG9uZW9mX3N0cmluZxhxIAEoCUgAEhUKC29uZW9mX2J5dGVzGHIg", + "ASgMSAAaGwoNTmVzdGVkTWVzc2FnZRIKCgJiYhgBIAEoBSJWCgpOZXN0ZWRF", + "bnVtEhsKF05FU1RFRF9FTlVNX1VOU1BFQ0lGSUVEEAASBwoDRk9PEAESBwoD", + "QkFSEAISBwoDQkFaEAMSEAoDTkVHEP///////////wFCDQoLb25lb2ZfZmll", + "bGQivgEKEk5lc3RlZFRlc3RBbGxUeXBlcxI1CgVjaGlsZBgBIAEoCzImLnBy", + "b3RvYnVmX3VuaXR0ZXN0My5OZXN0ZWRUZXN0QWxsVHlwZXMSMQoHcGF5bG9h", + "ZBgCIAEoCzIgLnByb3RvYnVmX3VuaXR0ZXN0My5UZXN0QWxsVHlwZXMSPgoO", + "cmVwZWF0ZWRfY2hpbGQYAyADKAsyJi5wcm90b2J1Zl91bml0dGVzdDMuTmVz", + "dGVkVGVzdEFsbFR5cGVzIjQKFFRlc3REZXByZWNhdGVkRmllbGRzEhwKEGRl", + "cHJlY2F0ZWRfaW50MzIYASABKAVCAhgBIhsKDkZvcmVpZ25NZXNzYWdlEgkK", + "AWMYASABKAUiMAoSVGVzdFJlc2VydmVkRmllbGRzSgQIAhADSgQIDxAQSgQI", + "CRAMUgNiYXJSA2JheiJbChFUZXN0Rm9yZWlnbk5lc3RlZBJGCg5mb3JlaWdu", + "X25lc3RlZBgBIAEoCzIuLnByb3RvYnVmX3VuaXR0ZXN0My5UZXN0QWxsVHlw", + "ZXMuTmVzdGVkTWVzc2FnZSI0ChhUZXN0UmVhbGx5TGFyZ2VUYWdOdW1iZXIS", + "CQoBYRgBIAEoBRINCgJiYhj///9/IAEoBSJWChRUZXN0UmVjdXJzaXZlTWVz", + "c2FnZRIzCgFhGAEgASgLMigucHJvdG9idWZfdW5pdHRlc3QzLlRlc3RSZWN1", + "cnNpdmVNZXNzYWdlEgkKAWkYAiABKAUiTAoUVGVzdE11dHVhbFJlY3Vyc2lv", + "bkESNAoCYmIYASABKAsyKC5wcm90b2J1Zl91bml0dGVzdDMuVGVzdE11dHVh", + "bFJlY3Vyc2lvbkIiYwoUVGVzdE11dHVhbFJlY3Vyc2lvbkISMwoBYRgBIAEo", + "CzIoLnByb3RvYnVmX3VuaXR0ZXN0My5UZXN0TXV0dWFsUmVjdXJzaW9uQRIW", + "Cg5vcHRpb25hbF9pbnQzMhgCIAEoBSJNChJUZXN0RW51bUFsbG93QWxpYXMS", + "NwoFdmFsdWUYASABKA4yKC5wcm90b2J1Zl91bml0dGVzdDMuVGVzdEVudW1X", + "aXRoRHVwVmFsdWUi7wIKF1Rlc3RDYW1lbENhc2VGaWVsZE5hbWVzEhYKDlBy", + "aW1pdGl2ZUZpZWxkGAEgASgFEhMKC1N0cmluZ0ZpZWxkGAIgASgJEjIKCUVu", + "dW1GaWVsZBgDIAEoDjIfLnByb3RvYnVmX3VuaXR0ZXN0My5Gb3JlaWduRW51", + "bRI4CgxNZXNzYWdlRmllbGQYBCABKAsyIi5wcm90b2J1Zl91bml0dGVzdDMu", + "Rm9yZWlnbk1lc3NhZ2USHgoWUmVwZWF0ZWRQcmltaXRpdmVGaWVsZBgHIAMo", + "BRIbChNSZXBlYXRlZFN0cmluZ0ZpZWxkGAggAygJEjoKEVJlcGVhdGVkRW51", + "bUZpZWxkGAkgAygOMh8ucHJvdG9idWZfdW5pdHRlc3QzLkZvcmVpZ25FbnVt", + "EkAKFFJlcGVhdGVkTWVzc2FnZUZpZWxkGAogAygLMiIucHJvdG9idWZfdW5p", + "dHRlc3QzLkZvcmVpZ25NZXNzYWdlIsgBChJUZXN0RmllbGRPcmRlcmluZ3MS", + "EQoJbXlfc3RyaW5nGAsgASgJEg4KBm15X2ludBgBIAEoAxIQCghteV9mbG9h", + "dBhlIAEoAhJUChVzaW5nbGVfbmVzdGVkX21lc3NhZ2UYyAEgASgLMjQucHJv", + "dG9idWZfdW5pdHRlc3QzLlRlc3RGaWVsZE9yZGVyaW5ncy5OZXN0ZWRNZXNz", + "YWdlGicKDU5lc3RlZE1lc3NhZ2USCgoCb28YAiABKAMSCgoCYmIYASABKAUi", + "TAoRU3BhcnNlRW51bU1lc3NhZ2USNwoLc3BhcnNlX2VudW0YASABKA4yIi5w", + "cm90b2J1Zl91bml0dGVzdDMuVGVzdFNwYXJzZUVudW0iGQoJT25lU3RyaW5n", + "EgwKBGRhdGEYASABKAkiGgoKTW9yZVN0cmluZxIMCgRkYXRhGAEgAygJIhgK", + "CE9uZUJ5dGVzEgwKBGRhdGEYASABKAwiGQoJTW9yZUJ5dGVzEgwKBGRhdGEY", + "ASABKAwiHAoMSW50MzJNZXNzYWdlEgwKBGRhdGEYASABKAUiHQoNVWludDMy", + "TWVzc2FnZRIMCgRkYXRhGAEgASgNIhwKDEludDY0TWVzc2FnZRIMCgRkYXRh", + "GAEgASgDIh0KDVVpbnQ2NE1lc3NhZ2USDAoEZGF0YRgBIAEoBCIbCgtCb29s", + "TWVzc2FnZRIMCgRkYXRhGAEgASgIInQKCVRlc3RPbmVvZhIRCgdmb29faW50", + "GAEgASgFSAASFAoKZm9vX3N0cmluZxgCIAEoCUgAEjcKC2Zvb19tZXNzYWdl", + "GAMgASgLMiAucHJvdG9idWZfdW5pdHRlc3QzLlRlc3RBbGxUeXBlc0gAQgUK", + "A2ZvbyKrAwoPVGVzdFBhY2tlZFR5cGVzEhgKDHBhY2tlZF9pbnQzMhhaIAMo", + "BUICEAESGAoMcGFja2VkX2ludDY0GFsgAygDQgIQARIZCg1wYWNrZWRfdWlu", + "dDMyGFwgAygNQgIQARIZCg1wYWNrZWRfdWludDY0GF0gAygEQgIQARIZCg1w", + "YWNrZWRfc2ludDMyGF4gAygRQgIQARIZCg1wYWNrZWRfc2ludDY0GF8gAygS", + "QgIQARIaCg5wYWNrZWRfZml4ZWQzMhhgIAMoB0ICEAESGgoOcGFja2VkX2Zp", + "eGVkNjQYYSADKAZCAhABEhsKD3BhY2tlZF9zZml4ZWQzMhhiIAMoD0ICEAES", + "GwoPcGFja2VkX3NmaXhlZDY0GGMgAygQQgIQARIYCgxwYWNrZWRfZmxvYXQY", + "ZCADKAJCAhABEhkKDXBhY2tlZF9kb3VibGUYZSADKAFCAhABEhcKC3BhY2tl", + "ZF9ib29sGGYgAygIQgIQARI4CgtwYWNrZWRfZW51bRhnIAMoDjIfLnByb3Rv", + "YnVmX3VuaXR0ZXN0My5Gb3JlaWduRW51bUICEAEiyQMKEVRlc3RVbnBhY2tl", + "ZFR5cGVzEhoKDnVucGFja2VkX2ludDMyGFogAygFQgIQABIaCg51bnBhY2tl", + "ZF9pbnQ2NBhbIAMoA0ICEAASGwoPdW5wYWNrZWRfdWludDMyGFwgAygNQgIQ", + "ABIbCg91bnBhY2tlZF91aW50NjQYXSADKARCAhAAEhsKD3VucGFja2VkX3Np", + "bnQzMhheIAMoEUICEAASGwoPdW5wYWNrZWRfc2ludDY0GF8gAygSQgIQABIc", + "ChB1bnBhY2tlZF9maXhlZDMyGGAgAygHQgIQABIcChB1bnBhY2tlZF9maXhl", + "ZDY0GGEgAygGQgIQABIdChF1bnBhY2tlZF9zZml4ZWQzMhhiIAMoD0ICEAAS", + "HQoRdW5wYWNrZWRfc2ZpeGVkNjQYYyADKBBCAhAAEhoKDnVucGFja2VkX2Zs", + "b2F0GGQgAygCQgIQABIbCg91bnBhY2tlZF9kb3VibGUYZSADKAFCAhAAEhkK", + "DXVucGFja2VkX2Jvb2wYZiADKAhCAhAAEjoKDXVucGFja2VkX2VudW0YZyAD", + "KA4yHy5wcm90b2J1Zl91bml0dGVzdDMuRm9yZWlnbkVudW1CAhAAIsABCiNU", + "ZXN0UmVwZWF0ZWRTY2FsYXJEaWZmZXJlbnRUYWdTaXplcxIYChByZXBlYXRl", + "ZF9maXhlZDMyGAwgAygHEhYKDnJlcGVhdGVkX2ludDMyGA0gAygFEhkKEHJl", + "cGVhdGVkX2ZpeGVkNjQY/g8gAygGEhcKDnJlcGVhdGVkX2ludDY0GP8PIAMo", + "AxIYCg5yZXBlYXRlZF9mbG9hdBj+/w8gAygCEhkKD3JlcGVhdGVkX3VpbnQ2", + "NBj//w8gAygEIigKG1Rlc3RDb21tZW50SW5qZWN0aW9uTWVzc2FnZRIJCgFh", + "GAEgASgJIgwKCkZvb1JlcXVlc3QiDQoLRm9vUmVzcG9uc2UiEgoQRm9vQ2xp", + "ZW50TWVzc2FnZSISChBGb29TZXJ2ZXJNZXNzYWdlIgwKCkJhclJlcXVlc3Qi", + "DQoLQmFyUmVzcG9uc2UiEgoQVGVzdEVtcHR5TWVzc2FnZSpZCgtGb3JlaWdu", + "RW51bRIXChNGT1JFSUdOX1VOU1BFQ0lGSUVEEAASDwoLRk9SRUlHTl9GT08Q", + "BBIPCgtGT1JFSUdOX0JBUhAFEg8KC0ZPUkVJR05fQkFaEAYqdQoUVGVzdEVu", + "dW1XaXRoRHVwVmFsdWUSKAokVEVTVF9FTlVNX1dJVEhfRFVQX1ZBTFVFX1VO", + "U1BFQ0lGSUVEEAASCAoERk9PMRABEggKBEJBUjEQAhIHCgNCQVoQAxIICgRG", + "T08yEAESCAoEQkFSMhACGgIQASqdAQoOVGVzdFNwYXJzZUVudW0SIAocVEVT", + "VF9TUEFSU0VfRU5VTV9VTlNQRUNJRklFRBAAEgwKCFNQQVJTRV9BEHsSDgoI", + "U1BBUlNFX0IQpucDEg8KCFNQQVJTRV9DELKxgAYSFQoIU1BBUlNFX0QQ8f//", + "////////ARIVCghTUEFSU0VfRRC03vz///////8BEgwKCFNQQVJTRV9HEAIy", + "nQEKC1Rlc3RTZXJ2aWNlEkYKA0ZvbxIeLnByb3RvYnVmX3VuaXR0ZXN0My5G", + "b29SZXF1ZXN0Gh8ucHJvdG9idWZfdW5pdHRlc3QzLkZvb1Jlc3BvbnNlEkYK", + "A0JhchIeLnByb3RvYnVmX3VuaXR0ZXN0My5CYXJSZXF1ZXN0Gh8ucHJvdG9i", + "dWZfdW5pdHRlc3QzLkJhclJlc3BvbnNlQixCDVVuaXR0ZXN0UHJvdG+qAhpH", + "b29nbGUuUHJvdG9idWYuVGVzdFByb3Rvc2IGcHJvdG8z")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { global::Google.Protobuf.TestProtos.UnittestImportProto3Reflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Google.Protobuf.TestProtos.ForeignEnum), typeof(global::Google.Protobuf.TestProtos.TestEnumWithDupValue), typeof(global::Google.Protobuf.TestProtos.TestSparseEnum), }, new pbr::GeneratedClrTypeInfo[] { @@ -187,7 +189,8 @@ namespace Google.Protobuf.TestProtos { new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.FooClientMessage), global::Google.Protobuf.TestProtos.FooClientMessage.Parser, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.FooServerMessage), global::Google.Protobuf.TestProtos.FooServerMessage.Parser, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.BarRequest), global::Google.Protobuf.TestProtos.BarRequest.Parser, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.BarResponse), global::Google.Protobuf.TestProtos.BarResponse.Parser, null, null, null, null) + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.BarResponse), global::Google.Protobuf.TestProtos.BarResponse.Parser, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestEmptyMessage), global::Google.Protobuf.TestProtos.TestEmptyMessage.Parser, null, null, null, null) })); } #endregion @@ -239,6 +242,7 @@ namespace Google.Protobuf.TestProtos { /// public sealed partial class TestAllTypes : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TestAllTypes()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -320,6 +324,7 @@ namespace Google.Protobuf.TestProtos { break; } + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -889,8 +894,8 @@ namespace Google.Protobuf.TestProtos { if (SingleFixed64 != other.SingleFixed64) return false; if (SingleSfixed32 != other.SingleSfixed32) return false; if (SingleSfixed64 != other.SingleSfixed64) return false; - if (SingleFloat != other.SingleFloat) return false; - if (SingleDouble != other.SingleDouble) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.Equals(SingleFloat, other.SingleFloat)) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(SingleDouble, other.SingleDouble)) return false; if (SingleBool != other.SingleBool) return false; if (SingleString != other.SingleString) return false; if (SingleBytes != other.SingleBytes) return false; @@ -928,7 +933,7 @@ namespace Google.Protobuf.TestProtos { if (OneofString != other.OneofString) return false; if (OneofBytes != other.OneofBytes) return false; if (OneofFieldCase != other.OneofFieldCase) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -944,8 +949,8 @@ namespace Google.Protobuf.TestProtos { if (SingleFixed64 != 0UL) hash ^= SingleFixed64.GetHashCode(); if (SingleSfixed32 != 0) hash ^= SingleSfixed32.GetHashCode(); if (SingleSfixed64 != 0L) hash ^= SingleSfixed64.GetHashCode(); - if (SingleFloat != 0F) hash ^= SingleFloat.GetHashCode(); - if (SingleDouble != 0D) hash ^= SingleDouble.GetHashCode(); + if (SingleFloat != 0F) hash ^= pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode(SingleFloat); + if (SingleDouble != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(SingleDouble); if (SingleBool != false) hash ^= SingleBool.GetHashCode(); if (SingleString.Length != 0) hash ^= SingleString.GetHashCode(); if (SingleBytes.Length != 0) hash ^= SingleBytes.GetHashCode(); @@ -983,6 +988,9 @@ namespace Google.Protobuf.TestProtos { if (oneofFieldCase_ == OneofFieldOneofCase.OneofString) hash ^= OneofString.GetHashCode(); if (oneofFieldCase_ == OneofFieldOneofCase.OneofBytes) hash ^= OneofBytes.GetHashCode(); hash ^= (int) oneofFieldCase_; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -1119,6 +1127,9 @@ namespace Google.Protobuf.TestProtos { output.WriteRawTag(146, 7); output.WriteBytes(OneofBytes); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1224,6 +1235,9 @@ namespace Google.Protobuf.TestProtos { if (oneofFieldCase_ == OneofFieldOneofCase.OneofBytes) { size += 2 + pb::CodedOutputStream.ComputeBytesSize(OneofBytes); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -1337,7 +1351,10 @@ namespace Google.Protobuf.TestProtos { OneofUint32 = other.OneofUint32; break; case OneofFieldOneofCase.OneofNestedMessage: - OneofNestedMessage = other.OneofNestedMessage; + if (OneofNestedMessage == null) { + OneofNestedMessage = new global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage(); + } + OneofNestedMessage.MergeFrom(other.OneofNestedMessage); break; case OneofFieldOneofCase.OneofString: OneofString = other.OneofString; @@ -1347,6 +1364,7 @@ namespace Google.Protobuf.TestProtos { break; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1355,7 +1373,7 @@ namespace Google.Protobuf.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 8: { SingleInt32 = input.ReadInt32(); @@ -1603,6 +1621,7 @@ namespace Google.Protobuf.TestProtos { public sealed partial class NestedMessage : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new NestedMessage()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -1626,6 +1645,7 @@ namespace Google.Protobuf.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public NestedMessage(NestedMessage other) : this() { bb_ = other.bb_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1663,13 +1683,16 @@ namespace Google.Protobuf.TestProtos { return true; } if (Bb != other.Bb) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (Bb != 0) hash ^= Bb.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -1684,6 +1707,9 @@ namespace Google.Protobuf.TestProtos { output.WriteRawTag(8); output.WriteInt32(Bb); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1692,6 +1718,9 @@ namespace Google.Protobuf.TestProtos { if (Bb != 0) { size += 1 + pb::CodedOutputStream.ComputeInt32Size(Bb); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -1703,6 +1732,7 @@ namespace Google.Protobuf.TestProtos { if (other.Bb != 0) { Bb = other.Bb; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1711,7 +1741,7 @@ namespace Google.Protobuf.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 8: { Bb = input.ReadInt32(); @@ -1733,6 +1763,7 @@ namespace Google.Protobuf.TestProtos { /// public sealed partial class NestedTestAllTypes : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new NestedTestAllTypes()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -1758,6 +1789,7 @@ namespace Google.Protobuf.TestProtos { Child = other.child_ != null ? other.Child.Clone() : null; Payload = other.payload_ != null ? other.Payload.Clone() : null; repeatedChild_ = other.repeatedChild_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1813,7 +1845,7 @@ namespace Google.Protobuf.TestProtos { if (!object.Equals(Child, other.Child)) return false; if (!object.Equals(Payload, other.Payload)) return false; if(!repeatedChild_.Equals(other.repeatedChild_)) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1822,6 +1854,9 @@ namespace Google.Protobuf.TestProtos { if (child_ != null) hash ^= Child.GetHashCode(); if (payload_ != null) hash ^= Payload.GetHashCode(); hash ^= repeatedChild_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -1841,6 +1876,9 @@ namespace Google.Protobuf.TestProtos { output.WriteMessage(Payload); } repeatedChild_.WriteTo(output, _repeated_repeatedChild_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1853,6 +1891,9 @@ namespace Google.Protobuf.TestProtos { size += 1 + pb::CodedOutputStream.ComputeMessageSize(Payload); } size += repeatedChild_.CalculateSize(_repeated_repeatedChild_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -1874,6 +1915,7 @@ namespace Google.Protobuf.TestProtos { Payload.MergeFrom(other.Payload); } repeatedChild_.Add(other.repeatedChild_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1882,7 +1924,7 @@ namespace Google.Protobuf.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { if (child_ == null) { @@ -1910,6 +1952,7 @@ namespace Google.Protobuf.TestProtos { public sealed partial class TestDeprecatedFields : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TestDeprecatedFields()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -1933,6 +1976,7 @@ namespace Google.Protobuf.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestDeprecatedFields(TestDeprecatedFields other) : this() { deprecatedInt32_ = other.deprecatedInt32_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1966,13 +2010,16 @@ namespace Google.Protobuf.TestProtos { return true; } if (DeprecatedInt32 != other.DeprecatedInt32) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (DeprecatedInt32 != 0) hash ^= DeprecatedInt32.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -1987,6 +2034,9 @@ namespace Google.Protobuf.TestProtos { output.WriteRawTag(8); output.WriteInt32(DeprecatedInt32); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1995,6 +2045,9 @@ namespace Google.Protobuf.TestProtos { if (DeprecatedInt32 != 0) { size += 1 + pb::CodedOutputStream.ComputeInt32Size(DeprecatedInt32); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -2006,6 +2059,7 @@ namespace Google.Protobuf.TestProtos { if (other.DeprecatedInt32 != 0) { DeprecatedInt32 = other.DeprecatedInt32; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2014,7 +2068,7 @@ namespace Google.Protobuf.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 8: { DeprecatedInt32 = input.ReadInt32(); @@ -2032,6 +2086,7 @@ namespace Google.Protobuf.TestProtos { /// public sealed partial class ForeignMessage : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ForeignMessage()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -2055,6 +2110,7 @@ namespace Google.Protobuf.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public ForeignMessage(ForeignMessage other) : this() { c_ = other.c_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2087,13 +2143,16 @@ namespace Google.Protobuf.TestProtos { return true; } if (C != other.C) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (C != 0) hash ^= C.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -2108,6 +2167,9 @@ namespace Google.Protobuf.TestProtos { output.WriteRawTag(8); output.WriteInt32(C); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2116,6 +2178,9 @@ namespace Google.Protobuf.TestProtos { if (C != 0) { size += 1 + pb::CodedOutputStream.ComputeInt32Size(C); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -2127,6 +2192,7 @@ namespace Google.Protobuf.TestProtos { if (other.C != 0) { C = other.C; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2135,7 +2201,7 @@ namespace Google.Protobuf.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 8: { C = input.ReadInt32(); @@ -2149,6 +2215,7 @@ namespace Google.Protobuf.TestProtos { public sealed partial class TestReservedFields : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TestReservedFields()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -2171,6 +2238,7 @@ namespace Google.Protobuf.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestReservedFields(TestReservedFields other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2191,12 +2259,15 @@ namespace Google.Protobuf.TestProtos { 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; } @@ -2207,11 +2278,17 @@ namespace Google.Protobuf.TestProtos { [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; } @@ -2220,6 +2297,7 @@ namespace Google.Protobuf.TestProtos { if (other == null) { return; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2228,7 +2306,7 @@ namespace Google.Protobuf.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; } } @@ -2241,6 +2319,7 @@ namespace Google.Protobuf.TestProtos { /// public sealed partial class TestForeignNested : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TestForeignNested()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -2264,6 +2343,7 @@ namespace Google.Protobuf.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestForeignNested(TestForeignNested other) : this() { ForeignNested = other.foreignNested_ != null ? other.ForeignNested.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2296,13 +2376,16 @@ namespace Google.Protobuf.TestProtos { return true; } if (!object.Equals(ForeignNested, other.ForeignNested)) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (foreignNested_ != null) hash ^= ForeignNested.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -2317,6 +2400,9 @@ namespace Google.Protobuf.TestProtos { output.WriteRawTag(10); output.WriteMessage(ForeignNested); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2325,6 +2411,9 @@ namespace Google.Protobuf.TestProtos { if (foreignNested_ != null) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(ForeignNested); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -2339,6 +2428,7 @@ namespace Google.Protobuf.TestProtos { } ForeignNested.MergeFrom(other.ForeignNested); } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2347,7 +2437,7 @@ namespace Google.Protobuf.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { if (foreignNested_ == null) { @@ -2367,6 +2457,7 @@ namespace Google.Protobuf.TestProtos { /// public sealed partial class TestReallyLargeTagNumber : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TestReallyLargeTagNumber()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -2391,6 +2482,7 @@ namespace Google.Protobuf.TestProtos { public TestReallyLargeTagNumber(TestReallyLargeTagNumber other) : this() { a_ = other.a_; bb_ = other.bb_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2439,7 +2531,7 @@ namespace Google.Protobuf.TestProtos { } if (A != other.A) return false; if (Bb != other.Bb) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2447,6 +2539,9 @@ namespace Google.Protobuf.TestProtos { int hash = 1; if (A != 0) hash ^= A.GetHashCode(); if (Bb != 0) hash ^= Bb.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -2465,6 +2560,9 @@ namespace Google.Protobuf.TestProtos { output.WriteRawTag(248, 255, 255, 255, 7); output.WriteInt32(Bb); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2476,6 +2574,9 @@ namespace Google.Protobuf.TestProtos { if (Bb != 0) { size += 5 + pb::CodedOutputStream.ComputeInt32Size(Bb); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -2490,6 +2591,7 @@ namespace Google.Protobuf.TestProtos { if (other.Bb != 0) { Bb = other.Bb; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2498,7 +2600,7 @@ namespace Google.Protobuf.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 8: { A = input.ReadInt32(); @@ -2516,6 +2618,7 @@ namespace Google.Protobuf.TestProtos { public sealed partial class TestRecursiveMessage : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TestRecursiveMessage()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -2540,6 +2643,7 @@ namespace Google.Protobuf.TestProtos { public TestRecursiveMessage(TestRecursiveMessage other) : this() { A = other.a_ != null ? other.A.Clone() : null; i_ = other.i_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2584,7 +2688,7 @@ namespace Google.Protobuf.TestProtos { } if (!object.Equals(A, other.A)) return false; if (I != other.I) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2592,6 +2696,9 @@ namespace Google.Protobuf.TestProtos { int hash = 1; if (a_ != null) hash ^= A.GetHashCode(); if (I != 0) hash ^= I.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -2610,6 +2717,9 @@ namespace Google.Protobuf.TestProtos { output.WriteRawTag(16); output.WriteInt32(I); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2621,6 +2731,9 @@ namespace Google.Protobuf.TestProtos { if (I != 0) { size += 1 + pb::CodedOutputStream.ComputeInt32Size(I); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -2638,6 +2751,7 @@ namespace Google.Protobuf.TestProtos { if (other.I != 0) { I = other.I; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2646,7 +2760,7 @@ namespace Google.Protobuf.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { if (a_ == null) { @@ -2670,6 +2784,7 @@ namespace Google.Protobuf.TestProtos { /// public sealed partial class TestMutualRecursionA : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TestMutualRecursionA()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -2693,6 +2808,7 @@ namespace Google.Protobuf.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestMutualRecursionA(TestMutualRecursionA other) : this() { Bb = other.bb_ != null ? other.Bb.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2725,13 +2841,16 @@ namespace Google.Protobuf.TestProtos { return true; } if (!object.Equals(Bb, other.Bb)) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (bb_ != null) hash ^= Bb.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -2746,6 +2865,9 @@ namespace Google.Protobuf.TestProtos { output.WriteRawTag(10); output.WriteMessage(Bb); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2754,6 +2876,9 @@ namespace Google.Protobuf.TestProtos { if (bb_ != null) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(Bb); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -2768,6 +2893,7 @@ namespace Google.Protobuf.TestProtos { } Bb.MergeFrom(other.Bb); } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2776,7 +2902,7 @@ namespace Google.Protobuf.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { if (bb_ == null) { @@ -2793,6 +2919,7 @@ namespace Google.Protobuf.TestProtos { public sealed partial class TestMutualRecursionB : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TestMutualRecursionB()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -2817,6 +2944,7 @@ namespace Google.Protobuf.TestProtos { public TestMutualRecursionB(TestMutualRecursionB other) : this() { A = other.a_ != null ? other.A.Clone() : null; optionalInt32_ = other.optionalInt32_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2861,7 +2989,7 @@ namespace Google.Protobuf.TestProtos { } if (!object.Equals(A, other.A)) return false; if (OptionalInt32 != other.OptionalInt32) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2869,6 +2997,9 @@ namespace Google.Protobuf.TestProtos { int hash = 1; if (a_ != null) hash ^= A.GetHashCode(); if (OptionalInt32 != 0) hash ^= OptionalInt32.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -2887,6 +3018,9 @@ namespace Google.Protobuf.TestProtos { output.WriteRawTag(16); output.WriteInt32(OptionalInt32); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2898,6 +3032,9 @@ namespace Google.Protobuf.TestProtos { if (OptionalInt32 != 0) { size += 1 + pb::CodedOutputStream.ComputeInt32Size(OptionalInt32); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -2915,6 +3052,7 @@ namespace Google.Protobuf.TestProtos { if (other.OptionalInt32 != 0) { OptionalInt32 = other.OptionalInt32; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2923,7 +3061,7 @@ namespace Google.Protobuf.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { if (a_ == null) { @@ -2944,6 +3082,7 @@ namespace Google.Protobuf.TestProtos { public sealed partial class TestEnumAllowAlias : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TestEnumAllowAlias()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -2967,6 +3106,7 @@ namespace Google.Protobuf.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestEnumAllowAlias(TestEnumAllowAlias other) : this() { value_ = other.value_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2999,13 +3139,16 @@ namespace Google.Protobuf.TestProtos { return true; } if (Value != other.Value) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (Value != 0) hash ^= Value.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -3020,6 +3163,9 @@ namespace Google.Protobuf.TestProtos { output.WriteRawTag(8); output.WriteEnum((int) Value); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3028,6 +3174,9 @@ namespace Google.Protobuf.TestProtos { if (Value != 0) { size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Value); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -3039,6 +3188,7 @@ namespace Google.Protobuf.TestProtos { if (other.Value != 0) { Value = other.Value; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3047,7 +3197,7 @@ namespace Google.Protobuf.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 8: { value_ = (global::Google.Protobuf.TestProtos.TestEnumWithDupValue) input.ReadEnum(); @@ -3065,6 +3215,7 @@ namespace Google.Protobuf.TestProtos { /// public sealed partial class TestCamelCaseFieldNames : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TestCamelCaseFieldNames()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -3095,6 +3246,7 @@ namespace Google.Protobuf.TestProtos { repeatedStringField_ = other.repeatedStringField_.Clone(); repeatedEnumField_ = other.repeatedEnumField_.Clone(); repeatedMessageField_ = other.repeatedMessageField_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3207,7 +3359,7 @@ namespace Google.Protobuf.TestProtos { if(!repeatedStringField_.Equals(other.repeatedStringField_)) return false; if(!repeatedEnumField_.Equals(other.repeatedEnumField_)) return false; if(!repeatedMessageField_.Equals(other.repeatedMessageField_)) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3221,6 +3373,9 @@ namespace Google.Protobuf.TestProtos { hash ^= repeatedStringField_.GetHashCode(); hash ^= repeatedEnumField_.GetHashCode(); hash ^= repeatedMessageField_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -3251,6 +3406,9 @@ namespace Google.Protobuf.TestProtos { repeatedStringField_.WriteTo(output, _repeated_repeatedStringField_codec); repeatedEnumField_.WriteTo(output, _repeated_repeatedEnumField_codec); repeatedMessageField_.WriteTo(output, _repeated_repeatedMessageField_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3272,6 +3430,9 @@ namespace Google.Protobuf.TestProtos { size += repeatedStringField_.CalculateSize(_repeated_repeatedStringField_codec); size += repeatedEnumField_.CalculateSize(_repeated_repeatedEnumField_codec); size += repeatedMessageField_.CalculateSize(_repeated_repeatedMessageField_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -3299,6 +3460,7 @@ namespace Google.Protobuf.TestProtos { repeatedStringField_.Add(other.repeatedStringField_); repeatedEnumField_.Add(other.repeatedEnumField_); repeatedMessageField_.Add(other.repeatedMessageField_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3307,7 +3469,7 @@ namespace Google.Protobuf.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 8: { PrimitiveField = input.ReadInt32(); @@ -3358,6 +3520,7 @@ namespace Google.Protobuf.TestProtos { /// public sealed partial class TestFieldOrderings : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TestFieldOrderings()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -3384,6 +3547,7 @@ namespace Google.Protobuf.TestProtos { myInt_ = other.myInt_; myFloat_ = other.myFloat_; SingleNestedMessage = other.singleNestedMessage_ != null ? other.SingleNestedMessage.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3450,9 +3614,9 @@ namespace Google.Protobuf.TestProtos { } if (MyString != other.MyString) return false; if (MyInt != other.MyInt) return false; - if (MyFloat != other.MyFloat) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.Equals(MyFloat, other.MyFloat)) return false; if (!object.Equals(SingleNestedMessage, other.SingleNestedMessage)) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3460,8 +3624,11 @@ namespace Google.Protobuf.TestProtos { int hash = 1; if (MyString.Length != 0) hash ^= MyString.GetHashCode(); if (MyInt != 0L) hash ^= MyInt.GetHashCode(); - if (MyFloat != 0F) hash ^= MyFloat.GetHashCode(); + if (MyFloat != 0F) hash ^= pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode(MyFloat); if (singleNestedMessage_ != null) hash ^= SingleNestedMessage.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -3488,6 +3655,9 @@ namespace Google.Protobuf.TestProtos { output.WriteRawTag(194, 12); output.WriteMessage(SingleNestedMessage); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3505,6 +3675,9 @@ namespace Google.Protobuf.TestProtos { if (singleNestedMessage_ != null) { size += 2 + pb::CodedOutputStream.ComputeMessageSize(SingleNestedMessage); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -3528,6 +3701,7 @@ namespace Google.Protobuf.TestProtos { } SingleNestedMessage.MergeFrom(other.SingleNestedMessage); } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3536,7 +3710,7 @@ namespace Google.Protobuf.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 8: { MyInt = input.ReadInt64(); @@ -3567,6 +3741,7 @@ namespace Google.Protobuf.TestProtos { public static partial class Types { public sealed partial class NestedMessage : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new NestedMessage()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -3591,6 +3766,7 @@ namespace Google.Protobuf.TestProtos { public NestedMessage(NestedMessage other) : this() { oo_ = other.oo_; bb_ = other.bb_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3640,7 +3816,7 @@ namespace Google.Protobuf.TestProtos { } if (Oo != other.Oo) return false; if (Bb != other.Bb) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3648,6 +3824,9 @@ namespace Google.Protobuf.TestProtos { int hash = 1; if (Oo != 0L) hash ^= Oo.GetHashCode(); if (Bb != 0) hash ^= Bb.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -3666,6 +3845,9 @@ namespace Google.Protobuf.TestProtos { output.WriteRawTag(16); output.WriteInt64(Oo); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3677,6 +3859,9 @@ namespace Google.Protobuf.TestProtos { if (Bb != 0) { size += 1 + pb::CodedOutputStream.ComputeInt32Size(Bb); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -3691,6 +3876,7 @@ namespace Google.Protobuf.TestProtos { if (other.Bb != 0) { Bb = other.Bb; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3699,7 +3885,7 @@ namespace Google.Protobuf.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 8: { Bb = input.ReadInt32(); @@ -3722,6 +3908,7 @@ namespace Google.Protobuf.TestProtos { public sealed partial class SparseEnumMessage : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SparseEnumMessage()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -3745,6 +3932,7 @@ namespace Google.Protobuf.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public SparseEnumMessage(SparseEnumMessage other) : this() { sparseEnum_ = other.sparseEnum_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3777,13 +3965,16 @@ namespace Google.Protobuf.TestProtos { return true; } if (SparseEnum != other.SparseEnum) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (SparseEnum != 0) hash ^= SparseEnum.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -3798,6 +3989,9 @@ namespace Google.Protobuf.TestProtos { output.WriteRawTag(8); output.WriteEnum((int) SparseEnum); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3806,6 +4000,9 @@ namespace Google.Protobuf.TestProtos { if (SparseEnum != 0) { size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) SparseEnum); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -3817,6 +4014,7 @@ namespace Google.Protobuf.TestProtos { if (other.SparseEnum != 0) { SparseEnum = other.SparseEnum; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3825,7 +4023,7 @@ namespace Google.Protobuf.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 8: { sparseEnum_ = (global::Google.Protobuf.TestProtos.TestSparseEnum) input.ReadEnum(); @@ -3842,6 +4040,7 @@ namespace Google.Protobuf.TestProtos { /// public sealed partial class OneString : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new OneString()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -3865,6 +4064,7 @@ namespace Google.Protobuf.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public OneString(OneString other) : this() { data_ = other.data_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3897,13 +4097,16 @@ namespace Google.Protobuf.TestProtos { return true; } if (Data != other.Data) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (Data.Length != 0) hash ^= Data.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -3918,6 +4121,9 @@ namespace Google.Protobuf.TestProtos { output.WriteRawTag(10); output.WriteString(Data); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3926,6 +4132,9 @@ namespace Google.Protobuf.TestProtos { if (Data.Length != 0) { size += 1 + pb::CodedOutputStream.ComputeStringSize(Data); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -3937,6 +4146,7 @@ namespace Google.Protobuf.TestProtos { if (other.Data.Length != 0) { Data = other.Data; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3945,7 +4155,7 @@ namespace Google.Protobuf.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { Data = input.ReadString(); @@ -3959,6 +4169,7 @@ namespace Google.Protobuf.TestProtos { public sealed partial class MoreString : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new MoreString()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -3982,6 +4193,7 @@ namespace Google.Protobuf.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public MoreString(MoreString other) : this() { data_ = other.data_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4013,13 +4225,16 @@ namespace Google.Protobuf.TestProtos { return true; } if(!data_.Equals(other.data_)) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; hash ^= data_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -4031,12 +4246,18 @@ namespace Google.Protobuf.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { data_.WriteTo(output, _repeated_data_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; size += data_.CalculateSize(_repeated_data_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -4046,6 +4267,7 @@ namespace Google.Protobuf.TestProtos { return; } data_.Add(other.data_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4054,7 +4276,7 @@ namespace Google.Protobuf.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { data_.AddEntriesFrom(input, _repeated_data_codec); @@ -4068,6 +4290,7 @@ namespace Google.Protobuf.TestProtos { public sealed partial class OneBytes : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new OneBytes()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -4091,6 +4314,7 @@ namespace Google.Protobuf.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public OneBytes(OneBytes other) : this() { data_ = other.data_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4123,13 +4347,16 @@ namespace Google.Protobuf.TestProtos { return true; } if (Data != other.Data) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (Data.Length != 0) hash ^= Data.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -4144,6 +4371,9 @@ namespace Google.Protobuf.TestProtos { output.WriteRawTag(10); output.WriteBytes(Data); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4152,6 +4382,9 @@ namespace Google.Protobuf.TestProtos { if (Data.Length != 0) { size += 1 + pb::CodedOutputStream.ComputeBytesSize(Data); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -4163,6 +4396,7 @@ namespace Google.Protobuf.TestProtos { if (other.Data.Length != 0) { Data = other.Data; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4171,7 +4405,7 @@ namespace Google.Protobuf.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { Data = input.ReadBytes(); @@ -4185,6 +4419,7 @@ namespace Google.Protobuf.TestProtos { public sealed partial class MoreBytes : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new MoreBytes()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -4208,6 +4443,7 @@ namespace Google.Protobuf.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public MoreBytes(MoreBytes other) : this() { data_ = other.data_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4240,13 +4476,16 @@ namespace Google.Protobuf.TestProtos { return true; } if (Data != other.Data) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (Data.Length != 0) hash ^= Data.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -4261,6 +4500,9 @@ namespace Google.Protobuf.TestProtos { output.WriteRawTag(10); output.WriteBytes(Data); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4269,6 +4511,9 @@ namespace Google.Protobuf.TestProtos { if (Data.Length != 0) { size += 1 + pb::CodedOutputStream.ComputeBytesSize(Data); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -4280,6 +4525,7 @@ namespace Google.Protobuf.TestProtos { if (other.Data.Length != 0) { Data = other.Data; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4288,7 +4534,7 @@ namespace Google.Protobuf.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { Data = input.ReadBytes(); @@ -4305,6 +4551,7 @@ namespace Google.Protobuf.TestProtos { /// public sealed partial class Int32Message : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Int32Message()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -4328,6 +4575,7 @@ namespace Google.Protobuf.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Int32Message(Int32Message other) : this() { data_ = other.data_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4360,13 +4608,16 @@ namespace Google.Protobuf.TestProtos { return true; } if (Data != other.Data) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (Data != 0) hash ^= Data.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -4381,6 +4632,9 @@ namespace Google.Protobuf.TestProtos { output.WriteRawTag(8); output.WriteInt32(Data); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4389,6 +4643,9 @@ namespace Google.Protobuf.TestProtos { if (Data != 0) { size += 1 + pb::CodedOutputStream.ComputeInt32Size(Data); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -4400,6 +4657,7 @@ namespace Google.Protobuf.TestProtos { if (other.Data != 0) { Data = other.Data; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4408,7 +4666,7 @@ namespace Google.Protobuf.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 8: { Data = input.ReadInt32(); @@ -4422,6 +4680,7 @@ namespace Google.Protobuf.TestProtos { public sealed partial class Uint32Message : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Uint32Message()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -4445,6 +4704,7 @@ namespace Google.Protobuf.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Uint32Message(Uint32Message other) : this() { data_ = other.data_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4477,13 +4737,16 @@ namespace Google.Protobuf.TestProtos { return true; } if (Data != other.Data) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (Data != 0) hash ^= Data.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -4498,6 +4761,9 @@ namespace Google.Protobuf.TestProtos { output.WriteRawTag(8); output.WriteUInt32(Data); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4506,6 +4772,9 @@ namespace Google.Protobuf.TestProtos { if (Data != 0) { size += 1 + pb::CodedOutputStream.ComputeUInt32Size(Data); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -4517,6 +4786,7 @@ namespace Google.Protobuf.TestProtos { if (other.Data != 0) { Data = other.Data; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4525,7 +4795,7 @@ namespace Google.Protobuf.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 8: { Data = input.ReadUInt32(); @@ -4539,6 +4809,7 @@ namespace Google.Protobuf.TestProtos { public sealed partial class Int64Message : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Int64Message()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -4562,6 +4833,7 @@ namespace Google.Protobuf.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Int64Message(Int64Message other) : this() { data_ = other.data_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4594,13 +4866,16 @@ namespace Google.Protobuf.TestProtos { return true; } if (Data != other.Data) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (Data != 0L) hash ^= Data.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -4615,6 +4890,9 @@ namespace Google.Protobuf.TestProtos { output.WriteRawTag(8); output.WriteInt64(Data); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4623,6 +4901,9 @@ namespace Google.Protobuf.TestProtos { if (Data != 0L) { size += 1 + pb::CodedOutputStream.ComputeInt64Size(Data); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -4634,6 +4915,7 @@ namespace Google.Protobuf.TestProtos { if (other.Data != 0L) { Data = other.Data; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4642,7 +4924,7 @@ namespace Google.Protobuf.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 8: { Data = input.ReadInt64(); @@ -4656,6 +4938,7 @@ namespace Google.Protobuf.TestProtos { public sealed partial class Uint64Message : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Uint64Message()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -4679,6 +4962,7 @@ namespace Google.Protobuf.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Uint64Message(Uint64Message other) : this() { data_ = other.data_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4711,13 +4995,16 @@ namespace Google.Protobuf.TestProtos { return true; } if (Data != other.Data) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (Data != 0UL) hash ^= Data.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -4732,6 +5019,9 @@ namespace Google.Protobuf.TestProtos { output.WriteRawTag(8); output.WriteUInt64(Data); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4740,6 +5030,9 @@ namespace Google.Protobuf.TestProtos { if (Data != 0UL) { size += 1 + pb::CodedOutputStream.ComputeUInt64Size(Data); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -4751,6 +5044,7 @@ namespace Google.Protobuf.TestProtos { if (other.Data != 0UL) { Data = other.Data; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4759,7 +5053,7 @@ namespace Google.Protobuf.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 8: { Data = input.ReadUInt64(); @@ -4773,6 +5067,7 @@ namespace Google.Protobuf.TestProtos { public sealed partial class BoolMessage : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new BoolMessage()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -4796,6 +5091,7 @@ namespace Google.Protobuf.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public BoolMessage(BoolMessage other) : this() { data_ = other.data_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4828,13 +5124,16 @@ namespace Google.Protobuf.TestProtos { return true; } if (Data != other.Data) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (Data != false) hash ^= Data.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -4849,6 +5148,9 @@ namespace Google.Protobuf.TestProtos { output.WriteRawTag(8); output.WriteBool(Data); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4857,6 +5159,9 @@ namespace Google.Protobuf.TestProtos { if (Data != false) { size += 1 + 1; } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -4868,6 +5173,7 @@ namespace Google.Protobuf.TestProtos { if (other.Data != false) { Data = other.Data; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4876,7 +5182,7 @@ namespace Google.Protobuf.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 8: { Data = input.ReadBool(); @@ -4893,6 +5199,7 @@ namespace Google.Protobuf.TestProtos { /// public sealed partial class TestOneof : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TestOneof()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -4927,6 +5234,7 @@ namespace Google.Protobuf.TestProtos { break; } + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -5004,7 +5312,7 @@ namespace Google.Protobuf.TestProtos { if (FooString != other.FooString) return false; if (!object.Equals(FooMessage, other.FooMessage)) return false; if (FooCase != other.FooCase) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -5014,6 +5322,9 @@ namespace Google.Protobuf.TestProtos { if (fooCase_ == FooOneofCase.FooString) hash ^= FooString.GetHashCode(); if (fooCase_ == FooOneofCase.FooMessage) hash ^= FooMessage.GetHashCode(); hash ^= (int) fooCase_; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -5036,6 +5347,9 @@ namespace Google.Protobuf.TestProtos { output.WriteRawTag(26); output.WriteMessage(FooMessage); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -5050,6 +5364,9 @@ namespace Google.Protobuf.TestProtos { if (fooCase_ == FooOneofCase.FooMessage) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(FooMessage); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -5066,10 +5383,14 @@ namespace Google.Protobuf.TestProtos { FooString = other.FooString; break; case FooOneofCase.FooMessage: - FooMessage = other.FooMessage; + if (FooMessage == null) { + FooMessage = new global::Google.Protobuf.TestProtos.TestAllTypes(); + } + FooMessage.MergeFrom(other.FooMessage); break; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -5078,7 +5399,7 @@ namespace Google.Protobuf.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 8: { FooInt = input.ReadInt32(); @@ -5105,6 +5426,7 @@ namespace Google.Protobuf.TestProtos { public sealed partial class TestPackedTypes : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TestPackedTypes()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -5141,6 +5463,7 @@ namespace Google.Protobuf.TestProtos { packedDouble_ = other.packedDouble_.Clone(); packedBool_ = other.packedBool_.Clone(); packedEnum_ = other.packedEnum_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -5315,7 +5638,7 @@ namespace Google.Protobuf.TestProtos { if(!packedDouble_.Equals(other.packedDouble_)) return false; if(!packedBool_.Equals(other.packedBool_)) return false; if(!packedEnum_.Equals(other.packedEnum_)) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -5335,6 +5658,9 @@ namespace Google.Protobuf.TestProtos { hash ^= packedDouble_.GetHashCode(); hash ^= packedBool_.GetHashCode(); hash ^= packedEnum_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -5359,6 +5685,9 @@ namespace Google.Protobuf.TestProtos { packedDouble_.WriteTo(output, _repeated_packedDouble_codec); packedBool_.WriteTo(output, _repeated_packedBool_codec); packedEnum_.WriteTo(output, _repeated_packedEnum_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -5378,6 +5707,9 @@ namespace Google.Protobuf.TestProtos { size += packedDouble_.CalculateSize(_repeated_packedDouble_codec); size += packedBool_.CalculateSize(_repeated_packedBool_codec); size += packedEnum_.CalculateSize(_repeated_packedEnum_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -5400,6 +5732,7 @@ namespace Google.Protobuf.TestProtos { packedDouble_.Add(other.packedDouble_); packedBool_.Add(other.packedBool_); packedEnum_.Add(other.packedEnum_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -5408,7 +5741,7 @@ namespace Google.Protobuf.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 722: case 720: { @@ -5492,6 +5825,7 @@ namespace Google.Protobuf.TestProtos { /// public sealed partial class TestUnpackedTypes : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TestUnpackedTypes()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -5528,6 +5862,7 @@ namespace Google.Protobuf.TestProtos { unpackedDouble_ = other.unpackedDouble_.Clone(); unpackedBool_ = other.unpackedBool_.Clone(); unpackedEnum_ = other.unpackedEnum_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -5702,7 +6037,7 @@ namespace Google.Protobuf.TestProtos { if(!unpackedDouble_.Equals(other.unpackedDouble_)) return false; if(!unpackedBool_.Equals(other.unpackedBool_)) return false; if(!unpackedEnum_.Equals(other.unpackedEnum_)) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -5722,6 +6057,9 @@ namespace Google.Protobuf.TestProtos { hash ^= unpackedDouble_.GetHashCode(); hash ^= unpackedBool_.GetHashCode(); hash ^= unpackedEnum_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -5746,6 +6084,9 @@ namespace Google.Protobuf.TestProtos { unpackedDouble_.WriteTo(output, _repeated_unpackedDouble_codec); unpackedBool_.WriteTo(output, _repeated_unpackedBool_codec); unpackedEnum_.WriteTo(output, _repeated_unpackedEnum_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -5765,6 +6106,9 @@ namespace Google.Protobuf.TestProtos { size += unpackedDouble_.CalculateSize(_repeated_unpackedDouble_codec); size += unpackedBool_.CalculateSize(_repeated_unpackedBool_codec); size += unpackedEnum_.CalculateSize(_repeated_unpackedEnum_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -5787,6 +6131,7 @@ namespace Google.Protobuf.TestProtos { unpackedDouble_.Add(other.unpackedDouble_); unpackedBool_.Add(other.unpackedBool_); unpackedEnum_.Add(other.unpackedEnum_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -5795,7 +6140,7 @@ namespace Google.Protobuf.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 722: case 720: { @@ -5875,6 +6220,7 @@ namespace Google.Protobuf.TestProtos { public sealed partial class TestRepeatedScalarDifferentTagSizes : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TestRepeatedScalarDifferentTagSizes()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -5903,6 +6249,7 @@ namespace Google.Protobuf.TestProtos { repeatedInt64_ = other.repeatedInt64_.Clone(); repeatedFloat_ = other.repeatedFloat_.Clone(); repeatedUint64_ = other.repeatedUint64_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -6003,7 +6350,7 @@ namespace Google.Protobuf.TestProtos { if(!repeatedInt64_.Equals(other.repeatedInt64_)) return false; if(!repeatedFloat_.Equals(other.repeatedFloat_)) return false; if(!repeatedUint64_.Equals(other.repeatedUint64_)) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -6015,6 +6362,9 @@ namespace Google.Protobuf.TestProtos { hash ^= repeatedInt64_.GetHashCode(); hash ^= repeatedFloat_.GetHashCode(); hash ^= repeatedUint64_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -6031,6 +6381,9 @@ namespace Google.Protobuf.TestProtos { repeatedInt64_.WriteTo(output, _repeated_repeatedInt64_codec); repeatedFloat_.WriteTo(output, _repeated_repeatedFloat_codec); repeatedUint64_.WriteTo(output, _repeated_repeatedUint64_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -6042,6 +6395,9 @@ namespace Google.Protobuf.TestProtos { size += repeatedInt64_.CalculateSize(_repeated_repeatedInt64_codec); size += repeatedFloat_.CalculateSize(_repeated_repeatedFloat_codec); size += repeatedUint64_.CalculateSize(_repeated_repeatedUint64_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -6056,6 +6412,7 @@ namespace Google.Protobuf.TestProtos { repeatedInt64_.Add(other.repeatedInt64_); repeatedFloat_.Add(other.repeatedFloat_); repeatedUint64_.Add(other.repeatedUint64_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -6064,7 +6421,7 @@ namespace Google.Protobuf.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 98: case 101: { @@ -6104,6 +6461,7 @@ namespace Google.Protobuf.TestProtos { public sealed partial class TestCommentInjectionMessage : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TestCommentInjectionMessage()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -6127,6 +6485,7 @@ namespace Google.Protobuf.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestCommentInjectionMessage(TestCommentInjectionMessage other) : this() { a_ = other.a_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -6162,13 +6521,16 @@ namespace Google.Protobuf.TestProtos { return true; } if (A != other.A) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (A.Length != 0) hash ^= A.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -6183,6 +6545,9 @@ namespace Google.Protobuf.TestProtos { output.WriteRawTag(10); output.WriteString(A); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -6191,6 +6556,9 @@ namespace Google.Protobuf.TestProtos { if (A.Length != 0) { size += 1 + pb::CodedOutputStream.ComputeStringSize(A); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -6202,6 +6570,7 @@ namespace Google.Protobuf.TestProtos { if (other.A.Length != 0) { A = other.A; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -6210,7 +6579,7 @@ namespace Google.Protobuf.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { A = input.ReadString(); @@ -6227,6 +6596,7 @@ namespace Google.Protobuf.TestProtos { /// public sealed partial class FooRequest : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new FooRequest()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -6249,6 +6619,7 @@ namespace Google.Protobuf.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public FooRequest(FooRequest other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -6269,12 +6640,15 @@ namespace Google.Protobuf.TestProtos { 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; } @@ -6285,11 +6659,17 @@ namespace Google.Protobuf.TestProtos { [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; } @@ -6298,6 +6678,7 @@ namespace Google.Protobuf.TestProtos { if (other == null) { return; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -6306,7 +6687,7 @@ namespace Google.Protobuf.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; } } @@ -6316,6 +6697,7 @@ namespace Google.Protobuf.TestProtos { public sealed partial class FooResponse : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new FooResponse()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -6338,6 +6720,7 @@ namespace Google.Protobuf.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public FooResponse(FooResponse other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -6358,12 +6741,15 @@ namespace Google.Protobuf.TestProtos { 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; } @@ -6374,11 +6760,17 @@ namespace Google.Protobuf.TestProtos { [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; } @@ -6387,6 +6779,7 @@ namespace Google.Protobuf.TestProtos { if (other == null) { return; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -6395,7 +6788,7 @@ namespace Google.Protobuf.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; } } @@ -6405,6 +6798,7 @@ namespace Google.Protobuf.TestProtos { public sealed partial class FooClientMessage : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new FooClientMessage()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -6427,6 +6821,7 @@ namespace Google.Protobuf.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public FooClientMessage(FooClientMessage other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -6447,12 +6842,15 @@ namespace Google.Protobuf.TestProtos { 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; } @@ -6463,11 +6861,17 @@ namespace Google.Protobuf.TestProtos { [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; } @@ -6476,6 +6880,7 @@ namespace Google.Protobuf.TestProtos { if (other == null) { return; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -6484,7 +6889,7 @@ namespace Google.Protobuf.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; } } @@ -6494,6 +6899,7 @@ namespace Google.Protobuf.TestProtos { public sealed partial class FooServerMessage : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new FooServerMessage()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -6516,6 +6922,7 @@ namespace Google.Protobuf.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public FooServerMessage(FooServerMessage other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -6536,12 +6943,15 @@ namespace Google.Protobuf.TestProtos { 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; } @@ -6552,11 +6962,17 @@ namespace Google.Protobuf.TestProtos { [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; } @@ -6565,6 +6981,7 @@ namespace Google.Protobuf.TestProtos { if (other == null) { return; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -6573,7 +6990,7 @@ namespace Google.Protobuf.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; } } @@ -6583,6 +7000,7 @@ namespace Google.Protobuf.TestProtos { public sealed partial class BarRequest : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new BarRequest()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -6605,6 +7023,7 @@ namespace Google.Protobuf.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public BarRequest(BarRequest other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -6625,12 +7044,15 @@ namespace Google.Protobuf.TestProtos { 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; } @@ -6641,11 +7063,17 @@ namespace Google.Protobuf.TestProtos { [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; } @@ -6654,6 +7082,7 @@ namespace Google.Protobuf.TestProtos { if (other == null) { return; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -6662,7 +7091,7 @@ namespace Google.Protobuf.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; } } @@ -6672,6 +7101,7 @@ namespace Google.Protobuf.TestProtos { public sealed partial class BarResponse : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new BarResponse()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -6694,6 +7124,7 @@ namespace Google.Protobuf.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public BarResponse(BarResponse other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -6714,12 +7145,15 @@ namespace Google.Protobuf.TestProtos { 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; } @@ -6730,11 +7164,17 @@ namespace Google.Protobuf.TestProtos { [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; } @@ -6743,6 +7183,108 @@ namespace Google.Protobuf.TestProtos { if (other == null) { return; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + } + } + } + + } + + public sealed partial class TestEmptyMessage : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TestEmptyMessage()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[34]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public TestEmptyMessage() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public TestEmptyMessage(TestEmptyMessage other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public TestEmptyMessage Clone() { + return new TestEmptyMessage(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as TestEmptyMessage); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(TestEmptyMessage other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + 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; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [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; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(TestEmptyMessage other) { + if (other == null) { + return; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -6751,7 +7293,7 @@ namespace Google.Protobuf.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; } } diff --git a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestWellKnownTypes.cs b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestWellKnownTypes.cs index 2c7f0e0e..2e1d2bd6 100644 --- a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestWellKnownTypes.cs +++ b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestWellKnownTypes.cs @@ -1,5 +1,7 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/protobuf/unittest_well_known_types.proto +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/protobuf/unittest_well_known_types.proto +// #pragma warning disable 1591, 0612, 3021 #region Designer generated code @@ -179,6 +181,7 @@ namespace Google.Protobuf.TestProtos { /// public sealed partial class TestWellKnownTypes : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TestWellKnownTypes()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -220,6 +223,7 @@ namespace Google.Protobuf.TestProtos { StringField = other.StringField; BytesField = other.BytesField; ValueField = other.valueField_ != null ? other.ValueField.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -470,8 +474,8 @@ namespace Google.Protobuf.TestProtos { if (!object.Equals(StructField, other.StructField)) return false; if (!object.Equals(TimestampField, other.TimestampField)) return false; if (!object.Equals(TypeField, other.TypeField)) return false; - if (DoubleField != other.DoubleField) return false; - if (FloatField != other.FloatField) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseNullableDoubleEqualityComparer.Equals(DoubleField, other.DoubleField)) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseNullableSingleEqualityComparer.Equals(FloatField, other.FloatField)) return false; if (Int64Field != other.Int64Field) return false; if (Uint64Field != other.Uint64Field) return false; if (Int32Field != other.Int32Field) return false; @@ -480,7 +484,7 @@ namespace Google.Protobuf.TestProtos { if (StringField != other.StringField) return false; if (BytesField != other.BytesField) return false; if (!object.Equals(ValueField, other.ValueField)) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -495,8 +499,8 @@ namespace Google.Protobuf.TestProtos { if (structField_ != null) hash ^= StructField.GetHashCode(); if (timestampField_ != null) hash ^= TimestampField.GetHashCode(); if (typeField_ != null) hash ^= TypeField.GetHashCode(); - if (doubleField_ != null) hash ^= DoubleField.GetHashCode(); - if (floatField_ != null) hash ^= FloatField.GetHashCode(); + if (doubleField_ != null) hash ^= pbc::ProtobufEqualityComparers.BitwiseNullableDoubleEqualityComparer.GetHashCode(DoubleField); + if (floatField_ != null) hash ^= pbc::ProtobufEqualityComparers.BitwiseNullableSingleEqualityComparer.GetHashCode(FloatField); if (int64Field_ != null) hash ^= Int64Field.GetHashCode(); if (uint64Field_ != null) hash ^= Uint64Field.GetHashCode(); if (int32Field_ != null) hash ^= Int32Field.GetHashCode(); @@ -505,6 +509,9 @@ namespace Google.Protobuf.TestProtos { if (stringField_ != null) hash ^= StringField.GetHashCode(); if (bytesField_ != null) hash ^= BytesField.GetHashCode(); if (valueField_ != null) hash ^= ValueField.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -582,6 +589,9 @@ namespace Google.Protobuf.TestProtos { output.WriteRawTag(154, 1); output.WriteMessage(ValueField); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -644,6 +654,9 @@ namespace Google.Protobuf.TestProtos { if (valueField_ != null) { size += 2 + pb::CodedOutputStream.ComputeMessageSize(ValueField); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -757,6 +770,7 @@ namespace Google.Protobuf.TestProtos { } ValueField.MergeFrom(other.ValueField); } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -765,7 +779,7 @@ namespace Google.Protobuf.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { if (anyField_ == null) { @@ -911,6 +925,7 @@ namespace Google.Protobuf.TestProtos { /// public sealed partial class RepeatedWellKnownTypes : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new RepeatedWellKnownTypes()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -951,6 +966,7 @@ namespace Google.Protobuf.TestProtos { boolField_ = other.boolField_.Clone(); stringField_ = other.stringField_.Clone(); bytesField_ = other.bytesField_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1172,7 +1188,7 @@ namespace Google.Protobuf.TestProtos { if(!boolField_.Equals(other.boolField_)) return false; if(!stringField_.Equals(other.stringField_)) return false; if(!bytesField_.Equals(other.bytesField_)) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1196,6 +1212,9 @@ namespace Google.Protobuf.TestProtos { hash ^= boolField_.GetHashCode(); hash ^= stringField_.GetHashCode(); hash ^= bytesField_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -1224,6 +1243,9 @@ namespace Google.Protobuf.TestProtos { boolField_.WriteTo(output, _repeated_boolField_codec); stringField_.WriteTo(output, _repeated_stringField_codec); bytesField_.WriteTo(output, _repeated_bytesField_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1247,6 +1269,9 @@ namespace Google.Protobuf.TestProtos { size += boolField_.CalculateSize(_repeated_boolField_codec); size += stringField_.CalculateSize(_repeated_stringField_codec); size += bytesField_.CalculateSize(_repeated_bytesField_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -1273,6 +1298,7 @@ namespace Google.Protobuf.TestProtos { boolField_.Add(other.boolField_); stringField_.Add(other.stringField_); bytesField_.Add(other.bytesField_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1281,7 +1307,7 @@ namespace Google.Protobuf.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { anyField_.AddEntriesFrom(input, _repeated_anyField_codec); @@ -1363,6 +1389,7 @@ namespace Google.Protobuf.TestProtos { public sealed partial class OneofWellKnownTypes : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new OneofWellKnownTypes()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -1442,6 +1469,7 @@ namespace Google.Protobuf.TestProtos { break; } + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1713,8 +1741,8 @@ namespace Google.Protobuf.TestProtos { if (!object.Equals(StructField, other.StructField)) return false; if (!object.Equals(TimestampField, other.TimestampField)) return false; if (!object.Equals(TypeField, other.TypeField)) return false; - if (DoubleField != other.DoubleField) return false; - if (FloatField != other.FloatField) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseNullableDoubleEqualityComparer.Equals(DoubleField, other.DoubleField)) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseNullableSingleEqualityComparer.Equals(FloatField, other.FloatField)) return false; if (Int64Field != other.Int64Field) return false; if (Uint64Field != other.Uint64Field) return false; if (Int32Field != other.Int32Field) return false; @@ -1723,7 +1751,7 @@ namespace Google.Protobuf.TestProtos { if (StringField != other.StringField) return false; if (BytesField != other.BytesField) return false; if (OneofFieldCase != other.OneofFieldCase) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1738,8 +1766,8 @@ namespace Google.Protobuf.TestProtos { if (oneofFieldCase_ == OneofFieldOneofCase.StructField) hash ^= StructField.GetHashCode(); if (oneofFieldCase_ == OneofFieldOneofCase.TimestampField) hash ^= TimestampField.GetHashCode(); if (oneofFieldCase_ == OneofFieldOneofCase.TypeField) hash ^= TypeField.GetHashCode(); - if (oneofFieldCase_ == OneofFieldOneofCase.DoubleField) hash ^= DoubleField.GetHashCode(); - if (oneofFieldCase_ == OneofFieldOneofCase.FloatField) hash ^= FloatField.GetHashCode(); + if (oneofFieldCase_ == OneofFieldOneofCase.DoubleField) hash ^= pbc::ProtobufEqualityComparers.BitwiseNullableDoubleEqualityComparer.GetHashCode(DoubleField); + if (oneofFieldCase_ == OneofFieldOneofCase.FloatField) hash ^= pbc::ProtobufEqualityComparers.BitwiseNullableSingleEqualityComparer.GetHashCode(FloatField); if (oneofFieldCase_ == OneofFieldOneofCase.Int64Field) hash ^= Int64Field.GetHashCode(); if (oneofFieldCase_ == OneofFieldOneofCase.Uint64Field) hash ^= Uint64Field.GetHashCode(); if (oneofFieldCase_ == OneofFieldOneofCase.Int32Field) hash ^= Int32Field.GetHashCode(); @@ -1748,6 +1776,9 @@ namespace Google.Protobuf.TestProtos { if (oneofFieldCase_ == OneofFieldOneofCase.StringField) hash ^= StringField.GetHashCode(); if (oneofFieldCase_ == OneofFieldOneofCase.BytesField) hash ^= BytesField.GetHashCode(); hash ^= (int) oneofFieldCase_; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -1821,6 +1852,9 @@ namespace Google.Protobuf.TestProtos { if (oneofFieldCase_ == OneofFieldOneofCase.BytesField) { _oneof_bytesField_codec.WriteTagAndValue(output, (pb::ByteString) oneofField_); } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1880,6 +1914,9 @@ namespace Google.Protobuf.TestProtos { if (oneofFieldCase_ == OneofFieldOneofCase.BytesField) { size += _oneof_bytesField_codec.CalculateSizeWithTag(BytesField); } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -1890,31 +1927,58 @@ namespace Google.Protobuf.TestProtos { } switch (other.OneofFieldCase) { case OneofFieldOneofCase.AnyField: - AnyField = other.AnyField; + if (AnyField == null) { + AnyField = new global::Google.Protobuf.WellKnownTypes.Any(); + } + AnyField.MergeFrom(other.AnyField); break; case OneofFieldOneofCase.ApiField: - ApiField = other.ApiField; + if (ApiField == null) { + ApiField = new global::Google.Protobuf.WellKnownTypes.Api(); + } + ApiField.MergeFrom(other.ApiField); break; case OneofFieldOneofCase.DurationField: - DurationField = other.DurationField; + if (DurationField == null) { + DurationField = new global::Google.Protobuf.WellKnownTypes.Duration(); + } + DurationField.MergeFrom(other.DurationField); break; case OneofFieldOneofCase.EmptyField: - EmptyField = other.EmptyField; + if (EmptyField == null) { + EmptyField = new global::Google.Protobuf.WellKnownTypes.Empty(); + } + EmptyField.MergeFrom(other.EmptyField); break; case OneofFieldOneofCase.FieldMaskField: - FieldMaskField = other.FieldMaskField; + if (FieldMaskField == null) { + FieldMaskField = new global::Google.Protobuf.WellKnownTypes.FieldMask(); + } + FieldMaskField.MergeFrom(other.FieldMaskField); break; case OneofFieldOneofCase.SourceContextField: - SourceContextField = other.SourceContextField; + if (SourceContextField == null) { + SourceContextField = new global::Google.Protobuf.WellKnownTypes.SourceContext(); + } + SourceContextField.MergeFrom(other.SourceContextField); break; case OneofFieldOneofCase.StructField: - StructField = other.StructField; + if (StructField == null) { + StructField = new global::Google.Protobuf.WellKnownTypes.Struct(); + } + StructField.MergeFrom(other.StructField); break; case OneofFieldOneofCase.TimestampField: - TimestampField = other.TimestampField; + if (TimestampField == null) { + TimestampField = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + TimestampField.MergeFrom(other.TimestampField); break; case OneofFieldOneofCase.TypeField: - TypeField = other.TypeField; + if (TypeField == null) { + TypeField = new global::Google.Protobuf.WellKnownTypes.Type(); + } + TypeField.MergeFrom(other.TypeField); break; case OneofFieldOneofCase.DoubleField: DoubleField = other.DoubleField; @@ -1945,6 +2009,7 @@ namespace Google.Protobuf.TestProtos { break; } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1953,7 +2018,7 @@ namespace Google.Protobuf.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { global::Google.Protobuf.WellKnownTypes.Any subBuilder = new global::Google.Protobuf.WellKnownTypes.Any(); @@ -2085,6 +2150,7 @@ namespace Google.Protobuf.TestProtos { /// public sealed partial class MapWellKnownTypes : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new MapWellKnownTypes()); + private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -2125,6 +2191,7 @@ namespace Google.Protobuf.TestProtos { boolField_ = other.boolField_.Clone(); stringField_ = other.stringField_.Clone(); bytesField_ = other.bytesField_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2343,7 +2410,7 @@ namespace Google.Protobuf.TestProtos { if (!BoolField.Equals(other.BoolField)) return false; if (!StringField.Equals(other.StringField)) return false; if (!BytesField.Equals(other.BytesField)) return false; - return true; + return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2367,6 +2434,9 @@ namespace Google.Protobuf.TestProtos { hash ^= BoolField.GetHashCode(); hash ^= StringField.GetHashCode(); hash ^= BytesField.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } return hash; } @@ -2395,6 +2465,9 @@ namespace Google.Protobuf.TestProtos { boolField_.WriteTo(output, _map_boolField_codec); stringField_.WriteTo(output, _map_stringField_codec); bytesField_.WriteTo(output, _map_bytesField_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2418,6 +2491,9 @@ namespace Google.Protobuf.TestProtos { size += boolField_.CalculateSize(_map_boolField_codec); size += stringField_.CalculateSize(_map_stringField_codec); size += bytesField_.CalculateSize(_map_bytesField_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } return size; } @@ -2444,6 +2520,7 @@ namespace Google.Protobuf.TestProtos { boolField_.Add(other.boolField_); stringField_.Add(other.stringField_); bytesField_.Add(other.bytesField_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2452,7 +2529,7 @@ namespace Google.Protobuf.TestProtos { while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { anyField_.AddEntriesFrom(input, _map_anyField_codec); diff --git a/csharp/src/Google.Protobuf.Test/UnknownFieldSetTest.cs b/csharp/src/Google.Protobuf.Test/UnknownFieldSetTest.cs new file mode 100644 index 00000000..1edd6fba --- /dev/null +++ b/csharp/src/Google.Protobuf.Test/UnknownFieldSetTest.cs @@ -0,0 +1,128 @@ +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using System; +using Google.Protobuf.TestProtos; +using NUnit.Framework; + +namespace Google.Protobuf +{ + public class UnknownFieldSetTest + { + [Test] + public void EmptyUnknownFieldSet() + { + UnknownFieldSet unknownFields = new UnknownFieldSet(); + Assert.AreEqual(0, unknownFields.CalculateSize()); + } + + [Test] + public void MergeUnknownFieldSet() + { + UnknownFieldSet unknownFields = new UnknownFieldSet(); + UnknownField field = new UnknownField(); + field.AddFixed32(123); + unknownFields.AddOrReplaceField(1, field); + UnknownFieldSet otherUnknownFields = new UnknownFieldSet(); + Assert.IsFalse(otherUnknownFields.HasField(1)); + UnknownFieldSet.MergeFrom(otherUnknownFields, unknownFields); + Assert.IsTrue(otherUnknownFields.HasField(1)); + } + + [Test] + public void TestMergeCodedInput() + { + var message = SampleMessages.CreateFullTestAllTypes(); + var emptyMessage = new TestEmptyMessage(); + emptyMessage.MergeFrom(message.ToByteArray()); + Assert.AreEqual(message.CalculateSize(), emptyMessage.CalculateSize()); + Assert.AreEqual(message.ToByteArray(), emptyMessage.ToByteArray()); + + var newMessage = new TestAllTypes(); + newMessage.MergeFrom(emptyMessage.ToByteArray()); + Assert.AreEqual(message, newMessage); + Assert.AreEqual(message.CalculateSize(), newMessage.CalculateSize()); + } + + [Test] + public void TestMergeMessage() + { + var message = SampleMessages.CreateFullTestAllTypes(); + var emptyMessage = new TestEmptyMessage(); + var otherEmptyMessage = new TestEmptyMessage(); + emptyMessage.MergeFrom(message.ToByteArray()); + otherEmptyMessage.MergeFrom(emptyMessage); + + Assert.AreEqual(message.CalculateSize(), otherEmptyMessage.CalculateSize()); + Assert.AreEqual(message.ToByteArray(), otherEmptyMessage.ToByteArray()); + } + + [Test] + public void TestEquals() + { + var message = SampleMessages.CreateFullTestAllTypes(); + var emptyMessage = new TestEmptyMessage(); + var otherEmptyMessage = new TestEmptyMessage(); + Assert.AreEqual(emptyMessage, otherEmptyMessage); + emptyMessage.MergeFrom(message.ToByteArray()); + Assert.AreNotEqual(emptyMessage.CalculateSize(), + otherEmptyMessage.CalculateSize()); + Assert.AreNotEqual(emptyMessage, otherEmptyMessage); + } + + [Test] + public void TestHashCode() + { + var message = SampleMessages.CreateFullTestAllTypes(); + var emptyMessage = new TestEmptyMessage(); + int hashCode = emptyMessage.GetHashCode(); + emptyMessage.MergeFrom(message.ToByteArray()); + Assert.AreNotEqual(hashCode, emptyMessage.GetHashCode()); + } + + [Test] + public void TestClone() + { + var emptyMessage = new TestEmptyMessage(); + var otherEmptyMessage = new TestEmptyMessage(); + otherEmptyMessage = emptyMessage.Clone(); + Assert.AreEqual(emptyMessage.CalculateSize(), otherEmptyMessage.CalculateSize()); + Assert.AreEqual(emptyMessage.ToByteArray(), otherEmptyMessage.ToByteArray()); + + var message = SampleMessages.CreateFullTestAllTypes(); + emptyMessage.MergeFrom(message.ToByteArray()); + otherEmptyMessage = emptyMessage.Clone(); + Assert.AreEqual(message.CalculateSize(), otherEmptyMessage.CalculateSize()); + Assert.AreEqual(message.ToByteArray(), otherEmptyMessage.ToByteArray()); + } + } +} diff --git a/csharp/src/Google.Protobuf.Test/WellKnownTypes/AnyTest.cs b/csharp/src/Google.Protobuf.Test/WellKnownTypes/AnyTest.cs index a3edd595..6ca1e1f0 100644 --- a/csharp/src/Google.Protobuf.Test/WellKnownTypes/AnyTest.cs +++ b/csharp/src/Google.Protobuf.Test/WellKnownTypes/AnyTest.cs @@ -42,7 +42,7 @@ namespace Google.Protobuf.WellKnownTypes { var message = SampleMessages.CreateFullTestAllTypes(); var any = Any.Pack(message); - Assert.AreEqual("type.googleapis.com/protobuf_unittest.TestAllTypes", any.TypeUrl); + Assert.AreEqual("type.googleapis.com/protobuf_unittest3.TestAllTypes", any.TypeUrl); Assert.AreEqual(message.CalculateSize(), any.Value.Length); } @@ -51,7 +51,7 @@ namespace Google.Protobuf.WellKnownTypes { var message = SampleMessages.CreateFullTestAllTypes(); var any = Any.Pack(message, "foo.bar/baz"); - Assert.AreEqual("foo.bar/baz/protobuf_unittest.TestAllTypes", any.TypeUrl); + Assert.AreEqual("foo.bar/baz/protobuf_unittest3.TestAllTypes", any.TypeUrl); Assert.AreEqual(message.CalculateSize(), any.Value.Length); } @@ -60,7 +60,7 @@ namespace Google.Protobuf.WellKnownTypes { var message = SampleMessages.CreateFullTestAllTypes(); var any = Any.Pack(message, "foo.bar/baz/"); - Assert.AreEqual("foo.bar/baz/protobuf_unittest.TestAllTypes", any.TypeUrl); + Assert.AreEqual("foo.bar/baz/protobuf_unittest3.TestAllTypes", any.TypeUrl); Assert.AreEqual(message.CalculateSize(), any.Value.Length); } diff --git a/csharp/src/Google.Protobuf.Test/WellKnownTypes/WrappersTest.cs b/csharp/src/Google.Protobuf.Test/WellKnownTypes/WrappersTest.cs index 5b7185dc..8ed55744 100644 --- a/csharp/src/Google.Protobuf.Test/WellKnownTypes/WrappersTest.cs +++ b/csharp/src/Google.Protobuf.Test/WellKnownTypes/WrappersTest.cs @@ -417,5 +417,16 @@ namespace Google.Protobuf.WellKnownTypes TestWellKnownTypes.Descriptor.Fields[TestWellKnownTypes.StringFieldFieldNumber].Accessor.Clear(message); Assert.IsNull(message.StringField); } + + [Test] + public void NaNComparisons() + { + var message1 = new TestWellKnownTypes { DoubleField = SampleNaNs.Regular }; + var message2 = new TestWellKnownTypes { DoubleField = SampleNaNs.PayloadFlipped }; + var message3 = new TestWellKnownTypes { DoubleField = SampleNaNs.Regular }; + + EqualityTester.AssertInequality(message1, message2); + EqualityTester.AssertEquality(message1, message3); + } } } 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