diff options
61 files changed, 1264 insertions, 584 deletions
@@ -27,7 +27,7 @@ config_setting( # Android builds do not need to link in a separate pthread library. LINK_OPTS = select({ ":android": [], - "//conditions:default": ["-lpthread"], + "//conditions:default": ["-lpthread", "-lm"], }) load( diff --git a/CHANGES.txt b/CHANGES.txt index 3b02056b..11645836 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1381,7 +1381,7 @@ 2008-09-29 version 2.0.2: General - * License changed from Apache 2.0 to New BSD. + * License changed from Apache 2.0 to 3-Clause BSD. * It is now possible to define custom "options", which are basically annotations which may be placed on definitions in a .proto file. For example, you might define a field option called "foo" like so: diff --git a/Protobuf.podspec b/Protobuf.podspec index 4b88a4df..0db70650 100644 --- a/Protobuf.podspec +++ b/Protobuf.podspec @@ -8,7 +8,7 @@ Pod::Spec.new do |s| s.version = '3.2.0' s.summary = 'Protocol Buffers v.3 runtime library for Objective-C.' s.homepage = 'https://github.com/google/protobuf' - s.license = 'New BSD' + s.license = '3-Clause BSD License' s.authors = { 'The Protocol Buffers contributors' => 'protobuf@googlegroups.com' } s.cocoapods_version = '>= 1.0' @@ -74,4 +74,4 @@ Usage The complete documentation for Protocol Buffers is available via the web at: - https://developers.google.com/protocol-buffers/ +https://developers.google.com/protocol-buffers/ diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index df3b2012..7618ba21 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -135,7 +135,7 @@ endif (protobuf_BUILD_SHARED_LIBS) if (MSVC) # Build with multiple processes add_definitions(/MP) - add_definitions(/wd4244 /wd4267 /wd4018 /wd4355 /wd4800 /wd4251 /wd4996 /wd4146 /wd4305) + add_definitions(/wd4244 /wd4267 /wd4018 /wd4355 /wd4800 /wd4251 /wd4996 /wd4146 /wd4305 /wd4309) # Allow big object add_definitions(/bigobj) string(REPLACE "/" "\\" PROTOBUF_SOURCE_WIN32_PATH ${protobuf_SOURCE_DIR}) diff --git a/csharp/src/Google.Protobuf.Test/JsonFormatterTest.cs b/csharp/src/Google.Protobuf.Test/JsonFormatterTest.cs index 302f8143..3b5bf773 100644 --- a/csharp/src/Google.Protobuf.Test/JsonFormatterTest.cs +++ b/csharp/src/Google.Protobuf.Test/JsonFormatterTest.cs @@ -67,6 +67,18 @@ namespace Google.Protobuf } [Test] + public void EnumAllowAlias() + { + var message = new TestEnumAllowAlias + { + Value = TestEnumWithDupValue.Foo2, + }; + var actualText = JsonFormatter.Default.Format(message); + var expectedText = "{ 'value': 'FOO1' }"; + AssertJson(expectedText, actualText); + } + + [Test] public void AllSingleFields() { var message = new TestAllTypes diff --git a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestProto3.cs b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestProto3.cs index d89bbbb0..c11ab84d 100644 --- a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestProto3.cs +++ b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestProto3.cs @@ -85,70 +85,72 @@ namespace Google.Protobuf.TestProtos { "ZXN0TXV0dWFsUmVjdXJzaW9uQRIzCgJiYhgBIAEoCzInLnByb3RvYnVmX3Vu", "aXR0ZXN0LlRlc3RNdXR1YWxSZWN1cnNpb25CImIKFFRlc3RNdXR1YWxSZWN1", "cnNpb25CEjIKAWEYASABKAsyJy5wcm90b2J1Zl91bml0dGVzdC5UZXN0TXV0", - "dWFsUmVjdXJzaW9uQRIWCg5vcHRpb25hbF9pbnQzMhgCIAEoBSLrAgoXVGVz", - "dENhbWVsQ2FzZUZpZWxkTmFtZXMSFgoOUHJpbWl0aXZlRmllbGQYASABKAUS", - "EwoLU3RyaW5nRmllbGQYAiABKAkSMQoJRW51bUZpZWxkGAMgASgOMh4ucHJv", - "dG9idWZfdW5pdHRlc3QuRm9yZWlnbkVudW0SNwoMTWVzc2FnZUZpZWxkGAQg", - "ASgLMiEucHJvdG9idWZfdW5pdHRlc3QuRm9yZWlnbk1lc3NhZ2USHgoWUmVw", - "ZWF0ZWRQcmltaXRpdmVGaWVsZBgHIAMoBRIbChNSZXBlYXRlZFN0cmluZ0Zp", - "ZWxkGAggAygJEjkKEVJlcGVhdGVkRW51bUZpZWxkGAkgAygOMh4ucHJvdG9i", - "dWZfdW5pdHRlc3QuRm9yZWlnbkVudW0SPwoUUmVwZWF0ZWRNZXNzYWdlRmll", - "bGQYCiADKAsyIS5wcm90b2J1Zl91bml0dGVzdC5Gb3JlaWduTWVzc2FnZSLH", - "AQoSVGVzdEZpZWxkT3JkZXJpbmdzEhEKCW15X3N0cmluZxgLIAEoCRIOCgZt", - "eV9pbnQYASABKAMSEAoIbXlfZmxvYXQYZSABKAISUwoVc2luZ2xlX25lc3Rl", - "ZF9tZXNzYWdlGMgBIAEoCzIzLnByb3RvYnVmX3VuaXR0ZXN0LlRlc3RGaWVs", - "ZE9yZGVyaW5ncy5OZXN0ZWRNZXNzYWdlGicKDU5lc3RlZE1lc3NhZ2USCgoC", - "b28YAiABKAMSCgoCYmIYASABKAUiSwoRU3BhcnNlRW51bU1lc3NhZ2USNgoL", - "c3BhcnNlX2VudW0YASABKA4yIS5wcm90b2J1Zl91bml0dGVzdC5UZXN0U3Bh", - "cnNlRW51bSIZCglPbmVTdHJpbmcSDAoEZGF0YRgBIAEoCSIaCgpNb3JlU3Ry", - "aW5nEgwKBGRhdGEYASADKAkiGAoIT25lQnl0ZXMSDAoEZGF0YRgBIAEoDCIZ", - "CglNb3JlQnl0ZXMSDAoEZGF0YRgBIAEoDCIcCgxJbnQzMk1lc3NhZ2USDAoE", - "ZGF0YRgBIAEoBSIdCg1VaW50MzJNZXNzYWdlEgwKBGRhdGEYASABKA0iHAoM", - "SW50NjRNZXNzYWdlEgwKBGRhdGEYASABKAMiHQoNVWludDY0TWVzc2FnZRIM", - "CgRkYXRhGAEgASgEIhsKC0Jvb2xNZXNzYWdlEgwKBGRhdGEYASABKAgicwoJ", - "VGVzdE9uZW9mEhEKB2Zvb19pbnQYASABKAVIABIUCgpmb29fc3RyaW5nGAIg", - "ASgJSAASNgoLZm9vX21lc3NhZ2UYAyABKAsyHy5wcm90b2J1Zl91bml0dGVz", - "dC5UZXN0QWxsVHlwZXNIAEIFCgNmb28iqgMKD1Rlc3RQYWNrZWRUeXBlcxIY", - "CgxwYWNrZWRfaW50MzIYWiADKAVCAhABEhgKDHBhY2tlZF9pbnQ2NBhbIAMo", - "A0ICEAESGQoNcGFja2VkX3VpbnQzMhhcIAMoDUICEAESGQoNcGFja2VkX3Vp", - "bnQ2NBhdIAMoBEICEAESGQoNcGFja2VkX3NpbnQzMhheIAMoEUICEAESGQoN", - "cGFja2VkX3NpbnQ2NBhfIAMoEkICEAESGgoOcGFja2VkX2ZpeGVkMzIYYCAD", - "KAdCAhABEhoKDnBhY2tlZF9maXhlZDY0GGEgAygGQgIQARIbCg9wYWNrZWRf", - "c2ZpeGVkMzIYYiADKA9CAhABEhsKD3BhY2tlZF9zZml4ZWQ2NBhjIAMoEEIC", - "EAESGAoMcGFja2VkX2Zsb2F0GGQgAygCQgIQARIZCg1wYWNrZWRfZG91Ymxl", - "GGUgAygBQgIQARIXCgtwYWNrZWRfYm9vbBhmIAMoCEICEAESNwoLcGFja2Vk", - "X2VudW0YZyADKA4yHi5wcm90b2J1Zl91bml0dGVzdC5Gb3JlaWduRW51bUIC", - "EAEiyAMKEVRlc3RVbnBhY2tlZFR5cGVzEhoKDnVucGFja2VkX2ludDMyGFog", - "AygFQgIQABIaCg51bnBhY2tlZF9pbnQ2NBhbIAMoA0ICEAASGwoPdW5wYWNr", - "ZWRfdWludDMyGFwgAygNQgIQABIbCg91bnBhY2tlZF91aW50NjQYXSADKARC", - "AhAAEhsKD3VucGFja2VkX3NpbnQzMhheIAMoEUICEAASGwoPdW5wYWNrZWRf", - "c2ludDY0GF8gAygSQgIQABIcChB1bnBhY2tlZF9maXhlZDMyGGAgAygHQgIQ", - "ABIcChB1bnBhY2tlZF9maXhlZDY0GGEgAygGQgIQABIdChF1bnBhY2tlZF9z", - "Zml4ZWQzMhhiIAMoD0ICEAASHQoRdW5wYWNrZWRfc2ZpeGVkNjQYYyADKBBC", - "AhAAEhoKDnVucGFja2VkX2Zsb2F0GGQgAygCQgIQABIbCg91bnBhY2tlZF9k", - "b3VibGUYZSADKAFCAhAAEhkKDXVucGFja2VkX2Jvb2wYZiADKAhCAhAAEjkK", - "DXVucGFja2VkX2VudW0YZyADKA4yHi5wcm90b2J1Zl91bml0dGVzdC5Gb3Jl", - "aWduRW51bUICEAAiwAEKI1Rlc3RSZXBlYXRlZFNjYWxhckRpZmZlcmVudFRh", - "Z1NpemVzEhgKEHJlcGVhdGVkX2ZpeGVkMzIYDCADKAcSFgoOcmVwZWF0ZWRf", - "aW50MzIYDSADKAUSGQoQcmVwZWF0ZWRfZml4ZWQ2NBj+DyADKAYSFwoOcmVw", - "ZWF0ZWRfaW50NjQY/w8gAygDEhgKDnJlcGVhdGVkX2Zsb2F0GP7/DyADKAIS", - "GQoPcmVwZWF0ZWRfdWludDY0GP//DyADKAQiKAobVGVzdENvbW1lbnRJbmpl", - "Y3Rpb25NZXNzYWdlEgkKAWEYASABKAkiDAoKRm9vUmVxdWVzdCINCgtGb29S", - "ZXNwb25zZSISChBGb29DbGllbnRNZXNzYWdlIhIKEEZvb1NlcnZlck1lc3Nh", - "Z2UiDAoKQmFyUmVxdWVzdCINCgtCYXJSZXNwb25zZSpZCgtGb3JlaWduRW51", - "bRIXChNGT1JFSUdOX1VOU1BFQ0lGSUVEEAASDwoLRk9SRUlHTl9GT08QBBIP", - "CgtGT1JFSUdOX0JBUhAFEg8KC0ZPUkVJR05fQkFaEAYqdQoUVGVzdEVudW1X", - "aXRoRHVwVmFsdWUSKAokVEVTVF9FTlVNX1dJVEhfRFVQX1ZBTFVFX1VOU1BF", - "Q0lGSUVEEAASCAoERk9PMRABEggKBEJBUjEQAhIHCgNCQVoQAxIICgRGT08y", - "EAESCAoEQkFSMhACGgIQASqdAQoOVGVzdFNwYXJzZUVudW0SIAocVEVTVF9T", - "UEFSU0VfRU5VTV9VTlNQRUNJRklFRBAAEgwKCFNQQVJTRV9BEHsSDgoIU1BB", - "UlNFX0IQpucDEg8KCFNQQVJTRV9DELKxgAYSFQoIU1BBUlNFX0QQ8f//////", - "////ARIVCghTUEFSU0VfRRC03vz///////8BEgwKCFNQQVJTRV9HEAIymQEK", - "C1Rlc3RTZXJ2aWNlEkQKA0ZvbxIdLnByb3RvYnVmX3VuaXR0ZXN0LkZvb1Jl", - "cXVlc3QaHi5wcm90b2J1Zl91bml0dGVzdC5Gb29SZXNwb25zZRJECgNCYXIS", - "HS5wcm90b2J1Zl91bml0dGVzdC5CYXJSZXF1ZXN0Gh4ucHJvdG9idWZfdW5p", - "dHRlc3QuQmFyUmVzcG9uc2VCOkINVW5pdHRlc3RQcm90b0gBgAEBiAEBkAEB", - "+AEBqgIaR29vZ2xlLlByb3RvYnVmLlRlc3RQcm90b3NiBnByb3RvMw==")); + "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==")); 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[] { @@ -162,6 +164,7 @@ namespace Google.Protobuf.TestProtos { new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestRecursiveMessage), global::Google.Protobuf.TestProtos.TestRecursiveMessage.Parser, new[]{ "A", "I" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestMutualRecursionA), global::Google.Protobuf.TestProtos.TestMutualRecursionA.Parser, new[]{ "Bb" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestMutualRecursionB), global::Google.Protobuf.TestProtos.TestMutualRecursionB.Parser, new[]{ "A", "OptionalInt32" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestEnumAllowAlias), global::Google.Protobuf.TestProtos.TestEnumAllowAlias.Parser, new[]{ "Value" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestCamelCaseFieldNames), global::Google.Protobuf.TestProtos.TestCamelCaseFieldNames.Parser, new[]{ "PrimitiveField", "StringField", "EnumField", "MessageField", "RepeatedPrimitiveField", "RepeatedStringField", "RepeatedEnumField", "RepeatedMessageField" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestFieldOrderings), global::Google.Protobuf.TestProtos.TestFieldOrderings.Parser, new[]{ "MyString", "MyInt", "MyFloat", "SingleNestedMessage" }, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestFieldOrderings.Types.NestedMessage), global::Google.Protobuf.TestProtos.TestFieldOrderings.Types.NestedMessage.Parser, new[]{ "Oo", "Bb" }, null, null, null)}), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.SparseEnumMessage), global::Google.Protobuf.TestProtos.SparseEnumMessage.Parser, new[]{ "SparseEnum" }, null, null, null), @@ -206,8 +209,8 @@ namespace Google.Protobuf.TestProtos { [pbr::OriginalName("FOO1")] Foo1 = 1, [pbr::OriginalName("BAR1")] Bar1 = 2, [pbr::OriginalName("BAZ")] Baz = 3, - [pbr::OriginalName("FOO2")] Foo2 = 1, - [pbr::OriginalName("BAR2")] Bar2 = 2, + [pbr::OriginalName("FOO2", PreferredAlias = false)] Foo2 = 1, + [pbr::OriginalName("BAR2", PreferredAlias = false)] Bar2 = 2, } /// <summary> @@ -2939,6 +2942,123 @@ namespace Google.Protobuf.TestProtos { } + public sealed partial class TestEnumAllowAlias : pb::IMessage<TestEnumAllowAlias> { + private static readonly pb::MessageParser<TestEnumAllowAlias> _parser = new pb::MessageParser<TestEnumAllowAlias>(() => new TestEnumAllowAlias()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser<TestEnumAllowAlias> Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[10]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public TestEnumAllowAlias() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public TestEnumAllowAlias(TestEnumAllowAlias other) : this() { + value_ = other.value_; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public TestEnumAllowAlias Clone() { + return new TestEnumAllowAlias(this); + } + + /// <summary>Field number for the "value" field.</summary> + public const int ValueFieldNumber = 1; + private global::Google.Protobuf.TestProtos.TestEnumWithDupValue value_ = 0; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.TestProtos.TestEnumWithDupValue Value { + get { return value_; } + set { + value_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as TestEnumAllowAlias); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(TestEnumAllowAlias other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Value != other.Value) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Value != 0) hash ^= Value.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 (Value != 0) { + output.WriteRawTag(8); + output.WriteEnum((int) Value); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Value != 0) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Value); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(TestEnumAllowAlias other) { + if (other == null) { + return; + } + if (other.Value != 0) { + Value = other.Value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 8: { + value_ = (global::Google.Protobuf.TestProtos.TestEnumWithDupValue) input.ReadEnum(); + break; + } + } + } + } + + } + /// <summary> /// Test message with CamelCase field names. This violates Protocol Buffer /// standard style. @@ -2950,7 +3070,7 @@ namespace Google.Protobuf.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[10]; } + get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[11]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3243,7 +3363,7 @@ namespace Google.Protobuf.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[11]; } + get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[12]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3607,7 +3727,7 @@ namespace Google.Protobuf.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[12]; } + get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[13]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3727,7 +3847,7 @@ namespace Google.Protobuf.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[13]; } + get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[14]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3844,7 +3964,7 @@ namespace Google.Protobuf.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[14]; } + get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[15]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3953,7 +4073,7 @@ namespace Google.Protobuf.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[15]; } + get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[16]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4070,7 +4190,7 @@ namespace Google.Protobuf.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[16]; } + get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[17]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4190,7 +4310,7 @@ namespace Google.Protobuf.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[17]; } + get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[18]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4307,7 +4427,7 @@ namespace Google.Protobuf.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[18]; } + get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[19]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4424,7 +4544,7 @@ namespace Google.Protobuf.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[19]; } + get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[20]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4541,7 +4661,7 @@ namespace Google.Protobuf.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[20]; } + get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[21]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4658,7 +4778,7 @@ namespace Google.Protobuf.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[21]; } + get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[22]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4778,7 +4898,7 @@ namespace Google.Protobuf.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[22]; } + get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[23]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4990,7 +5110,7 @@ namespace Google.Protobuf.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[23]; } + get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[24]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -5377,7 +5497,7 @@ namespace Google.Protobuf.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[24]; } + get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[25]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -5760,7 +5880,7 @@ namespace Google.Protobuf.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[25]; } + get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[26]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -5989,7 +6109,7 @@ namespace Google.Protobuf.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[26]; } + get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[27]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -6112,7 +6232,7 @@ namespace Google.Protobuf.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[27]; } + get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[28]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -6201,7 +6321,7 @@ namespace Google.Protobuf.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[28]; } + get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[29]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -6290,7 +6410,7 @@ namespace Google.Protobuf.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[29]; } + get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[30]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -6379,7 +6499,7 @@ namespace Google.Protobuf.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[30]; } + get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[31]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -6468,7 +6588,7 @@ namespace Google.Protobuf.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[31]; } + get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[32]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -6557,7 +6677,7 @@ namespace Google.Protobuf.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[32]; } + get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[33]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] diff --git a/csharp/src/Google.Protobuf/JsonFormatter.cs b/csharp/src/Google.Protobuf/JsonFormatter.cs index 05282775..90c2e937 100755 --- a/csharp/src/Google.Protobuf/JsonFormatter.cs +++ b/csharp/src/Google.Protobuf/JsonFormatter.cs @@ -835,6 +835,9 @@ namespace Google.Protobuf // TODO: Consider adding functionality to TypeExtensions to avoid this difference. private static Dictionary<object, string> GetNameMapping(System.Type enumType) => enumType.GetFields(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static) + .Where(f => (f.GetCustomAttributes(typeof(OriginalNameAttribute), false) + .FirstOrDefault() as OriginalNameAttribute) + ?.PreferredAlias ?? true) .ToDictionary(f => f.GetValue(null), f => (f.GetCustomAttributes(typeof(OriginalNameAttribute), false) .FirstOrDefault() as OriginalNameAttribute) @@ -844,6 +847,8 @@ namespace Google.Protobuf private static Dictionary<object, string> GetNameMapping(System.Type enumType) => enumType.GetTypeInfo().DeclaredFields .Where(f => f.IsStatic) + .Where(f => f.GetCustomAttributes<OriginalNameAttribute>() + .FirstOrDefault()?.PreferredAlias ?? true) .ToDictionary(f => f.GetValue(null), f => f.GetCustomAttributes<OriginalNameAttribute>() .FirstOrDefault() diff --git a/csharp/src/Google.Protobuf/Reflection/OriginalNameAttribute.cs b/csharp/src/Google.Protobuf/Reflection/OriginalNameAttribute.cs index 27f9ab98..07d0fd99 100644 --- a/csharp/src/Google.Protobuf/Reflection/OriginalNameAttribute.cs +++ b/csharp/src/Google.Protobuf/Reflection/OriginalNameAttribute.cs @@ -47,12 +47,19 @@ namespace Google.Protobuf.Reflection public string Name { get; set; } /// <summary> + /// If the name is preferred in the .proto file. + /// </summary> + public bool PreferredAlias { get; set; } + + /// <summary> /// Constructs a new attribute instance for the given name. /// </summary> /// <param name="name">The name of the element in the .proto file.</param> public OriginalNameAttribute(string name) { Name = ProtoPreconditions.CheckNotNull(name, nameof(name)); + PreferredAlias = true; } + } -}
\ No newline at end of file +} diff --git a/java/pom.xml b/java/pom.xml index 41c9b9da..f89e4422 100644 --- a/java/pom.xml +++ b/java/pom.xml @@ -39,8 +39,8 @@ <licenses> <license> - <name>New BSD license</name> - <url>http://www.opensource.org/licenses/bsd-license.php</url> + <name>3-Clause BSD License</name> + <url>https://opensource.org/licenses/BSD-3-Clause</url> <distribution>repo</distribution> </license> </licenses> diff --git a/javanano/pom.xml b/javanano/pom.xml index 6cb8c17d..0395e8f2 100644 --- a/javanano/pom.xml +++ b/javanano/pom.xml @@ -21,8 +21,8 @@ <url>https://developers.google.com/protocol-buffers/</url> <licenses> <license> - <name>New BSD license</name> - <url>http://www.opensource.org/licenses/bsd-license.php</url> + <name>3-Clause BSD License</name> + <url>https://opensource.org/licenses/BSD-3-Clause</url> <distribution>repo</distribution> </license> </licenses> diff --git a/js/binary/writer_test.js b/js/binary/writer_test.js index 54d37a21..83fcdf91 100644 --- a/js/binary/writer_test.js +++ b/js/binary/writer_test.js @@ -48,8 +48,6 @@ goog.require('jspb.BinaryWriter'); */ function assertFails(func) { var e = assertThrows(func); - console.log(e); - //assertNotNull(e.toString().match(/Error/)); } diff --git a/js/commonjs/export.js b/js/commonjs/export.js index 1eaab5d5..a93ee928 100644 --- a/js/commonjs/export.js +++ b/js/commonjs/export.js @@ -5,6 +5,10 @@ * the google-protobuf.js file that we build at distribution time. */ +// Include a dummy provide statement so that closurebuilder.py does not skip over this +// file. +goog.provide('jspb.Export'); + goog.require('goog.object'); goog.require('jspb.BinaryReader'); goog.require('jspb.BinaryWriter'); diff --git a/js/commonjs/export_asserts.js b/js/commonjs/export_asserts.js index 5219d120..ad9446c7 100644 --- a/js/commonjs/export_asserts.js +++ b/js/commonjs/export_asserts.js @@ -6,6 +6,10 @@ * closure_asserts_commonjs.js that is only used at testing time. */ +// Include a dummy provide statement so that closurebuilder.py does not skip over this +// file. +goog.provide('jspb.ExportAsserts'); + goog.require('goog.testing.asserts'); var global = Function('return this')(); diff --git a/js/commonjs/export_testdeps.js b/js/commonjs/export_testdeps.js index 174c61e6..6f5cd083 100644 --- a/js/commonjs/export_testdeps.js +++ b/js/commonjs/export_testdeps.js @@ -7,6 +7,10 @@ * export_asserts.js. */ +// Include a dummy provide statement so that closurebuilder.py does not skip over this +// file. +goog.provide('jspb.ExportTestDeps'); + goog.require('goog.crypt.base64'); goog.require('jspb.arith.Int64'); goog.require('jspb.arith.UInt64'); diff --git a/js/gulpfile.js b/js/gulpfile.js index 5f1b1d93..16c302ed 100644 --- a/js/gulpfile.js +++ b/js/gulpfile.js @@ -59,10 +59,21 @@ gulp.task('genproto_wellknowntypes', function (cb) { }); }); +function getClosureBuilderCommand(exportsFile, outputFile) { + return './node_modules/google-closure-library/closure/bin/build/closurebuilder.py ' + + '--root node_modules ' + + '-o compiled ' + + '--compiler_jar node_modules/google-closure-compiler/compiler.jar ' + + '-i ' + exportsFile + ' ' + + 'map.js message.js binary/arith.js binary/constants.js binary/decoder.js ' + + 'binary/encoder.js binary/reader.js binary/utils.js binary/writer.js ' + + exportsFile + ' > ' + outputFile; +} + gulp.task('dist', ['genproto_wellknowntypes'], function (cb) { // TODO(haberman): minify this more aggressively. // Will require proper externs/exports. - exec('./node_modules/google-closure-library/closure/bin/calcdeps.py -i message.js -i binary/reader.js -i binary/writer.js -i commonjs/export.js -p . -p node_modules/google-closure-library/closure -o compiled --compiler_jar node_modules/google-closure-compiler/compiler.jar > google-protobuf.js', + exec(getClosureBuilderCommand('commonjs/export.js', 'google-protobuf.js'), function (err, stdout, stderr) { console.log(stdout); console.log(stderr); @@ -71,7 +82,10 @@ gulp.task('dist', ['genproto_wellknowntypes'], function (cb) { }); gulp.task('commonjs_asserts', function (cb) { - exec('mkdir -p commonjs_out/test_node_modules && ./node_modules/google-closure-library/closure/bin/calcdeps.py -i commonjs/export_asserts.js -p . -p node_modules/google-closure-library/closure -o compiled --compiler_jar node_modules/google-closure-compiler/compiler.jar > commonjs_out/test_node_modules/closure_asserts_commonjs.js', + exec('mkdir -p commonjs_out/test_node_modules && ' + + getClosureBuilderCommand( + 'commonjs/export_asserts.js', + 'commonjs_out/test_node_modules/closure_asserts_commonjs.js'), function (err, stdout, stderr) { console.log(stdout); console.log(stderr); @@ -80,7 +94,10 @@ gulp.task('commonjs_asserts', function (cb) { }); gulp.task('commonjs_testdeps', function (cb) { - exec('mkdir -p commonjs_out/test_node_modules && ./node_modules/google-closure-library/closure/bin/calcdeps.py -i commonjs/export_testdeps.js -p . -p node_modules/google-closure-library/closure -o compiled --compiler_jar node_modules/google-closure-compiler/compiler.jar > commonjs_out/test_node_modules/testdeps_commonjs.js', + exec('mkdir -p commonjs_out/test_node_modules && ' + + getClosureBuilderCommand( + 'commonjs/export_testdeps.js', + 'commonjs_out/test_node_modules/testdeps_commonjs.js'), function (err, stdout, stderr) { console.log(stdout); console.log(stderr); diff --git a/objectivec/GPBMessage.m b/objectivec/GPBMessage.m index 9660f1ed..58a10fdb 100644 --- a/objectivec/GPBMessage.m +++ b/objectivec/GPBMessage.m @@ -3152,8 +3152,17 @@ static void ResolveIvarSet(GPBFieldDescriptor *field, if (result.impToAdd) { const char *encoding = GPBMessageEncodingForSelector(result.encodingSelector, YES); - BOOL methodAdded = class_addMethod(descriptor.messageClass, sel, - result.impToAdd, encoding); + Class msgClass = descriptor.messageClass; + BOOL methodAdded = class_addMethod(msgClass, sel, result.impToAdd, encoding); + // class_addMethod() is documented as also failing if the method was already + // added; so we check if the method is already there and return success so + // the method dispatch will still happen. Why would it already be added? + // Two threads could cause the same method to be bound at the same time, + // but only one will actually bind it; the other still needs to return true + // so things will dispatch. + if (!methodAdded) { + methodAdded = GPBClassHasSel(msgClass, sel); + } return methodAdded; } return [super resolveInstanceMethod:sel]; diff --git a/objectivec/GPBMessage_PackagePrivate.h b/objectivec/GPBMessage_PackagePrivate.h index 02d0e16e..9324cf8d 100644 --- a/objectivec/GPBMessage_PackagePrivate.h +++ b/objectivec/GPBMessage_PackagePrivate.h @@ -108,9 +108,17 @@ CF_EXTERN_C_BEGIN NS_INLINE void GPBPrepareReadOnlySemaphore(GPBMessage *self) { #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdirect-ivar-access" + +// Starting on Xcode 8.3, the static analyzer complains that the dispatch_once_t +// variable passed to dispatch_once should not be allocated on the heap or +// stack. Given that the semaphore is also an instance variable of the message, +// both variables are cleared at the same time, so this is safe. +#if !defined(__clang_analyzer__) dispatch_once(&self->readOnlySemaphoreCreationOnce_, ^{ self->readOnlySemaphore_ = dispatch_semaphore_create(1); }); +#endif // !defined(__clang_analyzer__) + #pragma clang diagnostic pop } diff --git a/objectivec/GPBRootObject.m b/objectivec/GPBRootObject.m index 4570716f..585d205a 100644 --- a/objectivec/GPBRootObject.m +++ b/objectivec/GPBRootObject.m @@ -184,11 +184,10 @@ static id ExtensionForName(id self, SEL _cmd) { dispatch_semaphore_wait(gExtensionSingletonDictionarySemaphore, DISPATCH_TIME_FOREVER); id extension = (id)CFDictionaryGetValue(gExtensionSingletonDictionary, key); - if (extension) { - // The method is getting wired in to the class, so no need to keep it in - // the dictionary. - CFDictionaryRemoveValue(gExtensionSingletonDictionary, key); - } + // We can't remove the key from the dictionary here (as an optimization), + // two threads could have gone into +resolveClassMethod: for the same method, + // and ended up here; there's no way to ensure both return YES without letting + // both try to wire in the method. dispatch_semaphore_signal(gExtensionSingletonDictionarySemaphore); return extension; } @@ -212,9 +211,17 @@ BOOL GPBResolveExtensionClassMethod(Class self, SEL sel) { #pragma unused(obj) return extension; }); - if (class_addMethod(metaClass, sel, imp, encoding)) { - return YES; + BOOL methodAdded = class_addMethod(metaClass, sel, imp, encoding); + // class_addMethod() is documented as also failing if the method was already + // added; so we check if the method is already there and return success so + // the method dispatch will still happen. Why would it already be added? + // Two threads could cause the same method to be bound at the same time, + // but only one will actually bind it; the other still needs to return true + // so things will dispatch. + if (!methodAdded) { + methodAdded = GPBClassHasSel(metaClass, sel); } + return methodAdded; } return NO; } diff --git a/objectivec/GPBUtilities.m b/objectivec/GPBUtilities.m index 1843478c..5029ec73 100644 --- a/objectivec/GPBUtilities.m +++ b/objectivec/GPBUtilities.m @@ -1893,6 +1893,25 @@ NSString *GPBDecodeTextFormatName(const uint8_t *decodeData, int32_t key, #pragma clang diagnostic pop +BOOL GPBClassHasSel(Class aClass, SEL sel) { + // NOTE: We have to use class_copyMethodList, all other runtime method + // lookups actually also resolve the method implementation and this + // is called from within those methods. + + BOOL result = NO; + unsigned int methodCount = 0; + Method *methodList = class_copyMethodList(aClass, &methodCount); + for (unsigned int i = 0; i < methodCount; ++i) { + SEL methodSelector = method_getName(methodList[i]); + if (methodSelector == sel) { + result = YES; + break; + } + } + free(methodList); + return result; +} + #pragma mark - GPBMessageSignatureProtocol // A series of selectors that are used solely to get @encoding values diff --git a/objectivec/GPBUtilities_PackagePrivate.h b/objectivec/GPBUtilities_PackagePrivate.h index 274351b7..16859d48 100644 --- a/objectivec/GPBUtilities_PackagePrivate.h +++ b/objectivec/GPBUtilities_PackagePrivate.h @@ -345,4 +345,6 @@ GPB_MESSAGE_SIGNATURE_ENTRY(int32_t, Enum) + (id)getClassValue; @end +BOOL GPBClassHasSel(Class aClass, SEL sel); + CF_EXTERN_C_END diff --git a/php/ext/google/protobuf/array.c b/php/ext/google/protobuf/array.c index e4a88c39..63bb6d0a 100644 --- a/php/ext/google/protobuf/array.c +++ b/php/ext/google/protobuf/array.c @@ -106,6 +106,7 @@ void repeated_field_init(TSRMLS_D) { repeated_field_handlers = PEMALLOC(zend_object_handlers); memcpy(repeated_field_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); + repeated_field_handlers->write_dimension = repeated_field_write_dimension; repeated_field_handlers->get_gc = repeated_field_get_gc; } diff --git a/php/ext/google/protobuf/encode_decode.c b/php/ext/google/protobuf/encode_decode.c index 57fc81d3..78b12a06 100644 --- a/php/ext/google/protobuf/encode_decode.c +++ b/php/ext/google/protobuf/encode_decode.c @@ -434,7 +434,7 @@ static void map_slot_key(upb_fieldtype_t type, const void* from, } static void map_slot_value(upb_fieldtype_t type, const void* from, - upb_value* v) { + upb_value* v) { size_t len; void* to = upb_value_memory(v); #ifndef NDEBUG diff --git a/php/ext/google/protobuf/map.c b/php/ext/google/protobuf/map.c index 35747b05..ab98879d 100644 --- a/php/ext/google/protobuf/map.c +++ b/php/ext/google/protobuf/map.c @@ -310,8 +310,8 @@ static bool map_field_write_dimension(zval *object, zval *key, mem = upb_value_memory(&v); memset(mem, 0, native_slot_size(intern->value_type)); - if (!native_slot_set(intern->value_type, intern->msg_ce, mem, value - TSRMLS_CC)) { + if (!native_slot_set(intern->value_type, intern->msg_ce, mem, + value TSRMLS_CC)) { return false; } #ifndef NDEBUG diff --git a/php/ext/google/protobuf/message.c b/php/ext/google/protobuf/message.c index 46da9024..b35df311 100644 --- a/php/ext/google/protobuf/message.c +++ b/php/ext/google/protobuf/message.c @@ -43,6 +43,7 @@ static zend_function_entry message_methods[] = { PHP_ME(Message, decode, NULL, ZEND_ACC_PUBLIC) PHP_ME(Message, jsonEncode, NULL, ZEND_ACC_PUBLIC) PHP_ME(Message, jsonDecode, NULL, ZEND_ACC_PUBLIC) + PHP_ME(Message, mergeFrom, NULL, ZEND_ACC_PUBLIC) PHP_ME(Message, readOneof, NULL, ZEND_ACC_PROTECTED) PHP_ME(Message, writeOneof, NULL, ZEND_ACC_PROTECTED) PHP_ME(Message, whichOneof, NULL, ZEND_ACC_PROTECTED) @@ -209,6 +210,13 @@ static zend_object_value message_create(zend_class_entry* ce TSRMLS_DC) { return return_value; } +void message_create_with_type(zend_class_entry* ce, zval** message TSRMLS_DC) { + MAKE_STD_ZVAL(*message); + Z_TYPE_PP(message) = IS_OBJECT; + Z_OBJVAL_PP(message) = ce->create_object(ce TSRMLS_CC); + Z_DELREF_PP(message); +} + void build_class_from_descriptor(zval* php_descriptor TSRMLS_DC) { Descriptor* desc = UNBOX(Descriptor, php_descriptor); @@ -260,6 +268,26 @@ PHP_METHOD(Message, clear) { msg->std.properties_table TSRMLS_CC); } +PHP_METHOD(Message, mergeFrom) { + zval* value; + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &value, + message_type) == FAILURE) { + return; + } + + MessageHeader* from = + (MessageHeader*)zend_object_store_get_object(value TSRMLS_CC); + MessageHeader* to = + (MessageHeader*)zend_object_store_get_object(getThis() TSRMLS_CC); + + if(from->descriptor != to->descriptor) { + zend_error(E_USER_ERROR, "Cannot merge messages with different class."); + return; + } + + layout_merge(from->descriptor->layout, from, to TSRMLS_CC); +} + PHP_METHOD(Message, readOneof) { long index; diff --git a/php/ext/google/protobuf/package.xml b/php/ext/google/protobuf/package.xml index 3067bdbb..aac73d05 100644 --- a/php/ext/google/protobuf/package.xml +++ b/php/ext/google/protobuf/package.xml @@ -20,7 +20,7 @@ <release>alpha</release> <api>alpha</api> </stability> - <license uri="http://www.opensource.org/licenses/bsd-license.php">New BSD License</license> + <license uri="https://opensource.org/licenses/BSD-3-Clause">3-Clause BSD License</license> <notes> Second alpha release. </notes> @@ -66,7 +66,7 @@ Second alpha release. </stability> <date>2016-09-23</date> <time>16:06:07</time> - <license uri="http://www.opensource.org/licenses/bsd-license.php">New BSD License</license> + <license uri="https://opensource.org/licenses/BSD-3-Clause">3-Clause BSD License</license> <notes> First alpha release </notes> @@ -82,7 +82,7 @@ First alpha release </stability> <date>2017-01-13</date> <time>16:06:07</time> - <license uri="http://www.opensource.org/licenses/bsd-license.php">New BSD License</license> + <license uri="https://opensource.org/licenses/BSD-3-Clause">3-Clause BSD License</license> <notes> Second alpha release. </notes> diff --git a/php/ext/google/protobuf/protobuf.h b/php/ext/google/protobuf/protobuf.h index d4737fb9..1562bbaf 100644 --- a/php/ext/google/protobuf/protobuf.h +++ b/php/ext/google/protobuf/protobuf.h @@ -151,6 +151,7 @@ extern zend_class_entry* enum_descriptor_type; // ----------------------------------------------------------------------------- void* message_data(void* msg); +void message_create_with_type(zend_class_entry* ce, zval** message TSRMLS_DC); // Build PHP class for given descriptor. Instead of building from scratch, this // function modifies existing class which has been partially defined in PHP @@ -240,11 +241,14 @@ zval* layout_get(MessageLayout* layout, const void* storage, const upb_fielddef* field, zval** cache TSRMLS_DC); void layout_set(MessageLayout* layout, MessageHeader* header, const upb_fielddef* field, zval* val TSRMLS_DC); +void layout_merge(MessageLayout* layout, MessageHeader* from, + MessageHeader* to TSRMLS_DC); const char* layout_get_oneof_case(MessageLayout* layout, const void* storage, const upb_oneofdef* oneof TSRMLS_DC); void free_layout(MessageLayout* layout); PHP_METHOD(Message, clear); +PHP_METHOD(Message, mergeFrom); PHP_METHOD(Message, readOneof); PHP_METHOD(Message, writeOneof); PHP_METHOD(Message, whichOneof); diff --git a/php/ext/google/protobuf/storage.c b/php/ext/google/protobuf/storage.c index 5e05b935..1b239ee3 100644 --- a/php/ext/google/protobuf/storage.c +++ b/php/ext/google/protobuf/storage.c @@ -57,6 +57,31 @@ size_t native_slot_size(upb_fieldtype_t type) { } } +static bool native_slot_is_default(upb_fieldtype_t type, void* memory) { + switch (type) { +#define CASE_TYPE(upb_type, c_type) \ + case UPB_TYPE_##upb_type: { \ + return DEREF(memory, c_type) == 0; \ + } + CASE_TYPE(INT32, int32_t ) + CASE_TYPE(UINT32, uint32_t) + CASE_TYPE(ENUM, int32_t ) + CASE_TYPE(INT64, int64_t ) + CASE_TYPE(UINT64, uint64_t) + CASE_TYPE(FLOAT, float ) + CASE_TYPE(DOUBLE, double ) + CASE_TYPE(BOOL, int8_t ) + +#undef CASE_TYPE + case UPB_TYPE_STRING: + case UPB_TYPE_BYTES: + return Z_STRLEN_PP(DEREF(memory, zval**)) == 0; + case UPB_TYPE_MESSAGE: + return Z_TYPE_PP(DEREF(memory, zval**)) == IS_NULL; + default: return false; + } +} + bool native_slot_set(upb_fieldtype_t type, const zend_class_entry* klass, void* memory, zval* value TSRMLS_DC) { switch (type) { @@ -499,7 +524,6 @@ void layout_init(MessageLayout* layout, void* storage, repeated_field_create_with_type(repeated_field_type, field, property_ptr TSRMLS_CC); DEREF(memory, zval**) = property_ptr; - property_ptr = NULL; } else { native_slot_init(upb_fielddef_type(field), memory, property_ptr); } @@ -601,6 +625,196 @@ void layout_set(MessageLayout* layout, MessageHeader* header, } } +void layout_merge(MessageLayout* layout, MessageHeader* from, + MessageHeader* to TSRMLS_DC) { + int i, j; + upb_msg_field_iter it; + + for (upb_msg_field_begin(&it, layout->msgdef), i = 0; !upb_msg_field_done(&it); + upb_msg_field_next(&it), i++) { + const upb_fielddef* field = upb_msg_iter_field(&it); + + void* to_memory = slot_memory(layout, message_data(to), field); + void* from_memory = slot_memory(layout, message_data(from), field); + + if (upb_fielddef_containingoneof(field)) { + uint32_t oneof_case_offset = + layout->fields[upb_fielddef_index(field)].case_offset + + sizeof(MessageHeader); + // For a oneof, check that this field is actually present -- skip all the + // below if not. + if (DEREF(((uint8_t*)from + oneof_case_offset), uint32_t) != + upb_fielddef_number(field)) { + continue; + } + uint32_t* from_oneof_case = slot_oneof_case(layout, message_data(from), field); + uint32_t* to_oneof_case = slot_oneof_case(layout, message_data(to), field); + + // For non-singular fields, the related memory needs to point to the + // actual zval in properties table first. + switch (upb_fielddef_type(field)) { + case UPB_TYPE_MESSAGE: + case UPB_TYPE_STRING: + case UPB_TYPE_BYTES: { + int property_cache_index = + layout->fields[upb_fielddef_index(field)].cache_index; + DEREF(to_memory, zval**) = + &(to->std.properties_table)[property_cache_index]; + break; + } + default: + break; + } + + *to_oneof_case = *from_oneof_case; + + // Otherwise, fall through to the appropriate singular-field handler + // below. + } + + if (is_map_field(field)) { + int size, key_length, value_length; + MapIter map_it; + + zval* to_map_php = *DEREF(to_memory, zval**); + zval* from_map_php = *DEREF(from_memory, zval**); + Map* to_map = zend_object_store_get_object(to_map_php TSRMLS_CC); + Map* from_map = zend_object_store_get_object(from_map_php TSRMLS_CC); + + size = upb_strtable_count(&from_map->table); + if (size == 0) continue; + + for (map_begin(from_map_php, &map_it TSRMLS_CC); !map_done(&map_it); + map_next(&map_it)) { + const char* key = map_iter_key(&map_it, &key_length); + upb_value value = map_iter_value(&map_it, &value_length); + void* mem = upb_value_memory(&value); + switch (to_map->value_type) { + case UPB_TYPE_MESSAGE: { + zval* new_message; + message_create_with_type(to_map->msg_ce, &new_message TSRMLS_CC); + Z_ADDREF_P(new_message); + + zval* subdesc_php = get_ce_obj(to_map->msg_ce); + Descriptor* subdesc = + zend_object_store_get_object(subdesc_php TSRMLS_CC); + MessageHeader* sub_from = + (MessageHeader*)zend_object_store_get_object(DEREF(mem, zval*) + TSRMLS_CC); + MessageHeader* sub_to = + (MessageHeader*)zend_object_store_get_object( + new_message TSRMLS_CC); + layout_merge(subdesc->layout, sub_from, sub_to TSRMLS_CC); + DEREF(mem, zval*) = new_message; + break; + } + case UPB_TYPE_BYTES: + case UPB_TYPE_STRING: + Z_ADDREF_PP((zval**)mem); + break; + default: + break; + } + map_index_set(to_map, key, key_length, value); + } + + } else if (upb_fielddef_label(field) == UPB_LABEL_REPEATED) { + zval* to_array_php = *DEREF(to_memory, zval**); + zval* from_array_php = *DEREF(from_memory, zval**); + RepeatedField* to_array = + zend_object_store_get_object(to_array_php TSRMLS_CC); + RepeatedField* from_array = + zend_object_store_get_object(from_array_php TSRMLS_CC); + + int size = zend_hash_num_elements(HASH_OF(from_array->array)); + if (size > 0) { + for (j = 0; j < size; j++) { + void* memory = NULL; + zend_hash_index_find(HASH_OF(from_array->array), j, (void**)&memory); + switch (to_array->type) { + case UPB_TYPE_STRING: + case UPB_TYPE_BYTES: { + zval* str; + MAKE_STD_ZVAL(str); + ZVAL_STRINGL(str, Z_STRVAL_PP((zval**)memory), + Z_STRLEN_PP((zval**)memory), 1); + memory = &str; + break; + } + case UPB_TYPE_MESSAGE: { + zval* new_message; + message_create_with_type(from_array->msg_ce, &new_message TSRMLS_CC); + Z_ADDREF_P(new_message); + + zval* subdesc_php = get_ce_obj(from_array->msg_ce); + Descriptor* subdesc = + zend_object_store_get_object(subdesc_php TSRMLS_CC); + MessageHeader* sub_from = + (MessageHeader*)zend_object_store_get_object( + DEREF(memory, zval*) TSRMLS_CC); + MessageHeader* sub_to = + (MessageHeader*)zend_object_store_get_object( + new_message TSRMLS_CC); + layout_merge(subdesc->layout, sub_from, sub_to TSRMLS_CC); + + memory = &new_message; + } + default: + break; + } + repeated_field_push_native(to_array, memory TSRMLS_CC); + } + } + } else { + upb_fieldtype_t type = upb_fielddef_type(field); + zend_class_entry *ce = NULL; + if (!native_slot_is_default(type, from_memory)) { + switch (type) { +#define CASE_TYPE(upb_type, c_type) \ + case UPB_TYPE_##upb_type: { \ + DEREF(to_memory, c_type) = DEREF(from_memory, c_type); \ + break; \ + } + CASE_TYPE(INT32, int32_t) + CASE_TYPE(UINT32, uint32_t) + CASE_TYPE(ENUM, int32_t) + CASE_TYPE(INT64, int64_t) + CASE_TYPE(UINT64, uint64_t) + CASE_TYPE(FLOAT, float) + CASE_TYPE(DOUBLE, double) + CASE_TYPE(BOOL, int8_t) + +#undef CASE_TYPE + case UPB_TYPE_STRING: + case UPB_TYPE_BYTES: + native_slot_set(type, NULL, value_memory(field, to_memory), + *DEREF(from_memory, zval**) TSRMLS_CC); + break; + case UPB_TYPE_MESSAGE: { + const upb_msgdef* msg = upb_fielddef_msgsubdef(field); + zval* desc_php = get_def_obj(msg); + Descriptor* desc = zend_object_store_get_object(desc_php TSRMLS_CC); + ce = desc->klass; + if (native_slot_is_default(type, to_memory)) { + zval* new_message = NULL; + message_create_with_type(ce, &new_message TSRMLS_CC); + native_slot_set(type, ce, value_memory(field, to_memory), + new_message TSRMLS_CC); + } + MessageHeader* sub_from = + (MessageHeader*)zend_object_store_get_object( + *DEREF(from_memory, zval**) TSRMLS_CC); + MessageHeader* sub_to = + (MessageHeader*)zend_object_store_get_object( + *DEREF(to_memory, zval**) TSRMLS_CC); + layout_merge(desc->layout, sub_from, sub_to TSRMLS_CC); + } + } + } + } + } +} + const char* layout_get_oneof_case(MessageLayout* layout, const void* storage, const upb_oneofdef* oneof TSRMLS_DC) { upb_oneof_iter i; diff --git a/php/src/Google/Protobuf/Internal/Message.php b/php/src/Google/Protobuf/Internal/Message.php index 9e162a22..17ef8536 100644 --- a/php/src/Google/Protobuf/Internal/Message.php +++ b/php/src/Google/Protobuf/Internal/Message.php @@ -491,6 +491,74 @@ class Message } /** + * Merges the contents of the specified message into current message. + * + * This method merges the contents of the specified message into the + * current message. Singular fields that are set in the specified message + * overwrite the corresponding fields in the current message. Repeated + * fields are appended. Map fields key-value pairs are overritten. + * Singular/Oneof sub-messages are recursively merged. All overritten + * sub-messages are deep-copied. + * + * @param object $msg Protobuf message to be merged from. + * @return null. + */ + public function mergeFrom($msg) + { + if (get_class($this) !== get_class($msg)) { + user_error("Cannot merge messages with different class."); + return; + } + + foreach ($this->desc->getField() as $field) { + $setter = $field->getSetter(); + $getter = $field->getGetter(); + if ($field->isMap()) { + if (count($msg->$getter()) != 0) { + $value_field = $field->getMessageType()->getFieldByNumber(2); + foreach ($msg->$getter() as $key => $value) { + if ($value_field->getType() == GPBType::MESSAGE) { + $klass = $value_field->getMessageType()->getClass(); + $copy = new $klass; + $copy->mergeFrom($value); + $this->$getter()[$key] = $copy; + } else { + $this->$getter()[$key] = $value; + } + } + } + } else if ($field->getLabel() === GPBLabel::REPEATED) { + if (count($msg->$getter()) != 0) { + foreach ($msg->$getter() as $tmp) { + if ($field->getType() == GPBType::MESSAGE) { + $klass = $field->getMessageType()->getClass(); + $copy = new $klass; + $copy->mergeFrom($tmp); + $this->$getter()[] = $copy; + } else { + $this->$getter()[] = $tmp; + } + } + } + } else if ($field->getLabel() === GPBLabel::OPTIONAL) { + if($msg->$getter() !== $this->defaultValue($field)) { + $tmp = $msg->$getter(); + if ($field->getType() == GPBType::MESSAGE) { + if (is_null($this->$getter())) { + $klass = $field->getMessageType()->getClass(); + $new_msg = new $klass; + $this->$setter($new_msg); + } + $this->$getter()->mergeFrom($tmp); + } else { + $this->$setter($tmp); + } + } + } + } + } + + /** * Parses a protocol buffer contained in a string. * * This function takes a string in the (non-human-readable) binary wire diff --git a/php/tests/generated_class_test.php b/php/tests/generated_class_test.php index 83ce1139..7f8567b8 100644 --- a/php/tests/generated_class_test.php +++ b/php/tests/generated_class_test.php @@ -622,6 +622,115 @@ class GeneratedClassTest extends TestBase } ######################################################### + # Test mergeFrom method. + ######################################################### + + public function testMessageMergeFrom() + { + $m = new TestMessage(); + $this->setFields($m); + $this->expectFields($m); + $arr = $m->getOptionalMessage()->getB(); + $arr[] = 1; + + $n = new TestMessage(); + + // Singular + $n->setOptionalInt32(100); + $sub1 = new TestMessage_Sub(); + $sub1->setA(101); + $sub1->getB()[] = 102; + $n->setOptionalMessage($sub1); + + // Repeated + $n->getRepeatedInt32()[] = 200; + $n->getRepeatedString()[] = 'abc'; + $sub2 = new TestMessage_Sub(); + $sub2->setA(201); + $n->getRepeatedMessage()[] = $sub2; + + // Map + $n->getMapInt32Int32()[1] = 300; + $n->getMapInt32Int32()[-62] = 301; + $n->getMapStringString()['def'] = 'def'; + $n->getMapInt32Message()[1] = new TestMessage_Sub(); + $n->getMapInt32Message()[1]->setA(302); + $n->getMapInt32Message()[2] = new TestMessage_Sub(); + $n->getMapInt32Message()[2]->setA(303); + + $m->mergeFrom($n); + + $this->assertSame(100, $m->getOptionalInt32()); + $this->assertSame(42, $m->getOptionalUint32()); + $this->assertSame(101, $m->getOptionalMessage()->getA()); + $this->assertSame(2, count($m->getOptionalMessage()->getB())); + $this->assertSame(1, $m->getOptionalMessage()->getB()[0]); + $this->assertSame(102, $m->getOptionalMessage()->getB()[1]); + + $this->assertSame(3, count($m->getRepeatedInt32())); + $this->assertSame(200, $m->getRepeatedInt32()[2]); + $this->assertSame(2, count($m->getRepeatedUint32())); + $this->assertSame(3, count($m->getRepeatedString())); + $this->assertSame('abc', $m->getRepeatedString()[2]); + $this->assertSame(3, count($m->getRepeatedMessage())); + $this->assertSame(201, $m->getRepeatedMessage()[2]->getA()); + + $this->assertSame(2, count($m->getMapInt32Int32())); + $this->assertSame(300, $m->getMapInt32Int32()[1]); + $this->assertSame(301, $m->getMapInt32Int32()[-62]); + $this->assertSame(1, count($m->getMapUint32Uint32())); + $this->assertSame(2, count($m->getMapStringString())); + $this->assertSame('def', $m->getMapStringString()['def']); + + $this->assertSame(2, count($m->getMapInt32Message())); + $this->assertSame(302, $m->getMapInt32Message()[1]->getA()); + $this->assertSame(303, $m->getMapInt32Message()[2]->getA()); + + $this->assertSame("", $m->getMyOneof()); + + // Check sub-messages are copied by value. + $n->getOptionalMessage()->setA(-101); + $this->assertSame(101, $m->getOptionalMessage()->getA()); + $n->getRepeatedMessage()[0]->setA(-201); + $this->assertSame(201, $m->getRepeatedMessage()[2]->getA()); + $n->getMapInt32Message()[1]->setA(-302); + $this->assertSame(302, $m->getMapInt32Message()[1]->getA()); + + // Test merge oneof. + $m = new TestMessage(); + + $n = new TestMessage(); + $n->setOneofInt32(1); + $m->mergeFrom($n); + $this->assertSame(1, $m->getOneofInt32()); + + $sub = new TestMessage_Sub(); + $n->setOneofMessage($sub); + $n->getOneofMessage()->setA(400); + $m->mergeFrom($n); + $this->assertSame(400, $m->getOneofMessage()->getA()); + $n->getOneofMessage()->setA(-400); + $this->assertSame(400, $m->getOneofMessage()->getA()); + + // Test all fields + $m = new TestMessage(); + $n = new TestMessage(); + $this->setFields($m); + $n->mergeFrom($m); + $this->expectFields($n); + } + + /** + * @expectedException PHPUnit_Framework_Error + */ + public function testMessageMergeFromInvalidTypeFail() + { + $m = new TestMessage(); + $n = new TestMessage_Sub(); + $m->mergeFrom($n); + } + + ######################################################### # Test message/enum without namespace. ######################################################### diff --git a/php/tests/memory_leak_test.php b/php/tests/memory_leak_test.php index af327273..d4776d6f 100644 --- a/php/tests/memory_leak_test.php +++ b/php/tests/memory_leak_test.php @@ -79,3 +79,8 @@ $data = $m->encode(); $n = new TestMessage(); $n->decode($data); assert(1 === $n->getOneofMessage()->getA()); + +$from = new TestMessage(); +$to = new TestMessage(); +TestUtil::setTestMessage($from); +$to->mergeFrom($from); diff --git a/php/tests/proto/test.proto b/php/tests/proto/test.proto index 594aee4d..c971df21 100644 --- a/php/tests/proto/test.proto +++ b/php/tests/proto/test.proto @@ -90,6 +90,7 @@ message TestMessage { message Sub { int32 a = 1; + repeated int32 b = 2; } // Reserved for non-existing field test. diff --git a/php/tests/test.sh b/php/tests/test.sh index 3635d86c..fc3f0186 100755 --- a/php/tests/test.sh +++ b/php/tests/test.sh @@ -19,7 +19,9 @@ do echo "" done -# Make sure to run the memory test in debug mode. -php -dextension=../ext/google/protobuf/modules/protobuf.so memory_leak_test.php +# # Make sure to run the memory test in debug mode. +# php -dextension=../ext/google/protobuf/modules/protobuf.so memory_leak_test.php -USE_ZEND_ALLOC=0 valgrind --leak-check=yes php -dextension=../ext/google/protobuf/modules/protobuf.so memory_leak_test.php +export ZEND_DONT_UNLOAD_MODULES=1 +export USE_ZEND_ALLOC=0 +valgrind --leak-check=yes php -dextension=../ext/google/protobuf/modules/protobuf.so memory_leak_test.php diff --git a/protoc-artifacts/pom.xml b/protoc-artifacts/pom.xml index 19c68629..28a25119 100644 --- a/protoc-artifacts/pom.xml +++ b/protoc-artifacts/pom.xml @@ -21,8 +21,8 @@ <url>https://developers.google.com/protocol-buffers/</url> <licenses> <license> - <name>New BSD license</name> - <url>http://www.opensource.org/licenses/bsd-license.php</url> + <name>3-Clause BSD License</name> + <url>https://opensource.org/licenses/BSD-3-Clause</url> <distribution>repo</distribution> </license> </licenses> diff --git a/python/compatibility_tests/v2.5.0/setup.py b/python/compatibility_tests/v2.5.0/setup.py index d8e34bc0..b41d54d4 100755 --- a/python/compatibility_tests/v2.5.0/setup.py +++ b/python/compatibility_tests/v2.5.0/setup.py @@ -64,7 +64,7 @@ if __name__ == '__main__': url='https://developers.google.com/protocol-buffers/', maintainer='protobuf@googlegroups.com', maintainer_email='protobuf@googlegroups.com', - license='New BSD License', + license='3-Clause BSD License', classifiers=[ "Programming Language :: Python", "Programming Language :: Python :: 2", diff --git a/python/setup.py b/python/setup.py index 64e318f1..a2026706 100755 --- a/python/setup.py +++ b/python/setup.py @@ -234,7 +234,7 @@ if __name__ == '__main__': url='https://developers.google.com/protocol-buffers/', maintainer='protobuf@googlegroups.com', maintainer_email='protobuf@googlegroups.com', - license='New BSD License', + license='3-Clause BSD License', classifiers=[ "Programming Language :: Python", "Programming Language :: Python :: 2", diff --git a/ruby/pom.xml b/ruby/pom.xml index 7b896137..adf6ff20 100644 --- a/ruby/pom.xml +++ b/ruby/pom.xml @@ -21,8 +21,8 @@ <url>https://developers.google.com/protocol-buffers/</url> <licenses> <license> - <name>New BSD license</name> - <url>http://www.opensource.org/licenses/bsd-license.php</url> + <name>3-Clause BSD License</name> + <url>https://opensource.org/licenses/BSD-3-Clause</url> <distribution>repo</distribution> </license> </licenses> diff --git a/src/google/protobuf/any.pb.cc b/src/google/protobuf/any.pb.cc index 407dc0ad..94c9539f 100644 --- a/src/google/protobuf/any.pb.cc +++ b/src/google/protobuf/any.pb.cc @@ -220,8 +220,8 @@ bool Any::MergePartialFromCodedStream( switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // string type_url = 1; case 1: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(10u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(10u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_type_url())); DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( @@ -236,8 +236,8 @@ bool Any::MergePartialFromCodedStream( // bytes value = 2; case 2: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(18u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(18u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadBytes( input, this->mutable_value())); } else { diff --git a/src/google/protobuf/api.pb.cc b/src/google/protobuf/api.pb.cc index 7965d1ce..6518e518 100644 --- a/src/google/protobuf/api.pb.cc +++ b/src/google/protobuf/api.pb.cc @@ -288,8 +288,8 @@ bool Api::MergePartialFromCodedStream( switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // string name = 1; case 1: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(10u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(10u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_name())); DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( @@ -304,8 +304,8 @@ bool Api::MergePartialFromCodedStream( // repeated .google.protobuf.Method methods = 2; case 2: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(18u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(18u)) { DO_(input->IncrementRecursionDepth()); DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtualNoRecursionDepth( input, add_methods())); @@ -318,8 +318,8 @@ bool Api::MergePartialFromCodedStream( // repeated .google.protobuf.Option options = 3; case 3: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(26u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(26u)) { DO_(input->IncrementRecursionDepth()); DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtualNoRecursionDepth( input, add_options())); @@ -332,8 +332,8 @@ bool Api::MergePartialFromCodedStream( // string version = 4; case 4: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(34u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(34u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_version())); DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( @@ -348,8 +348,8 @@ bool Api::MergePartialFromCodedStream( // .google.protobuf.SourceContext source_context = 5; case 5: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(42u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(42u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( input, mutable_source_context())); } else { @@ -360,8 +360,8 @@ bool Api::MergePartialFromCodedStream( // repeated .google.protobuf.Mixin mixins = 6; case 6: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(50u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(50u)) { DO_(input->IncrementRecursionDepth()); DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtualNoRecursionDepth( input, add_mixins())); @@ -374,8 +374,8 @@ bool Api::MergePartialFromCodedStream( // .google.protobuf.Syntax syntax = 7; case 7: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(56u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(56u)) { int value; DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>( @@ -1036,8 +1036,8 @@ bool Method::MergePartialFromCodedStream( switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // string name = 1; case 1: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(10u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(10u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_name())); DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( @@ -1052,8 +1052,8 @@ bool Method::MergePartialFromCodedStream( // string request_type_url = 2; case 2: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(18u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(18u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_request_type_url())); DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( @@ -1068,8 +1068,8 @@ bool Method::MergePartialFromCodedStream( // bool request_streaming = 3; case 3: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(24u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(24u)) { DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( @@ -1082,8 +1082,8 @@ bool Method::MergePartialFromCodedStream( // string response_type_url = 4; case 4: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(34u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(34u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_response_type_url())); DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( @@ -1098,8 +1098,8 @@ bool Method::MergePartialFromCodedStream( // bool response_streaming = 5; case 5: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(40u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(40u)) { DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( @@ -1112,8 +1112,8 @@ bool Method::MergePartialFromCodedStream( // repeated .google.protobuf.Option options = 6; case 6: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(50u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(50u)) { DO_(input->IncrementRecursionDepth()); DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtualNoRecursionDepth( input, add_options())); @@ -1126,8 +1126,8 @@ bool Method::MergePartialFromCodedStream( // .google.protobuf.Syntax syntax = 7; case 7: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(56u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(56u)) { int value; DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>( @@ -1743,8 +1743,8 @@ bool Mixin::MergePartialFromCodedStream( switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // string name = 1; case 1: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(10u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(10u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_name())); DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( @@ -1759,8 +1759,8 @@ bool Mixin::MergePartialFromCodedStream( // string root = 2; case 2: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(18u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(18u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_root())); DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( diff --git a/src/google/protobuf/compiler/command_line_interface.cc b/src/google/protobuf/compiler/command_line_interface.cc index 0c9b1fb5..1914fc48 100644 --- a/src/google/protobuf/compiler/command_line_interface.cc +++ b/src/google/protobuf/compiler/command_line_interface.cc @@ -1038,8 +1038,8 @@ CommandLineInterface::ParseArguments(int argc, const char* const argv[]) { continue; } bool foundImplicitPlugin = false; - for (std::vector<OutputDirective>::const_iterator j = output_directives_.cbegin(); - j != output_directives_.cend(); ++j) { + for (std::vector<OutputDirective>::const_iterator j = output_directives_.begin(); + j != output_directives_.end(); ++j) { if (j->generator == NULL) { string plugin_name = PluginName(plugin_prefix_ , j->name); if (plugin_name == i->first) { diff --git a/src/google/protobuf/compiler/cpp/cpp_message.cc b/src/google/protobuf/compiler/cpp/cpp_message.cc index b4f1adfd..6274ba29 100644 --- a/src/google/protobuf/compiler/cpp/cpp_message.cc +++ b/src/google/protobuf/compiler/cpp/cpp_message.cc @@ -3028,8 +3028,8 @@ GenerateMergeFromCodedStream(io::Printer* printer) { const FieldGenerator& field_generator = field_generators_.get(field); // Emit code to parse the common, expected case. - printer->Print("if (static_cast<::google::protobuf::uint8>(tag) ==\n" - " static_cast<::google::protobuf::uint8>($commontag$u)) {\n", + printer->Print("if (static_cast< ::google::protobuf::uint8>(tag) ==\n" + " static_cast< ::google::protobuf::uint8>($commontag$u)) {\n", "commontag", SimpleItoa(WireFormat::MakeTag(field))); if (loops) { @@ -3048,8 +3048,8 @@ GenerateMergeFromCodedStream(io::Printer* printer) { if (field->is_packed()) { internal::WireFormatLite::WireType wiretype = WireFormat::WireTypeForFieldType(field->type()); - printer->Print("} else if (static_cast<::google::protobuf::uint8>(tag) ==\n" - " static_cast<::google::protobuf::uint8>($uncommontag$u)) {\n", + printer->Print("} else if (static_cast< ::google::protobuf::uint8>(tag) ==\n" + " static_cast< ::google::protobuf::uint8>($uncommontag$u)) {\n", "uncommontag", SimpleItoa( internal::WireFormatLite::MakeTag( field->number(), wiretype))); @@ -3059,8 +3059,8 @@ GenerateMergeFromCodedStream(io::Printer* printer) { } else if (field->is_packable() && !field->is_packed()) { internal::WireFormatLite::WireType wiretype = internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED; - printer->Print("} else if (static_cast<::google::protobuf::uint8>(tag) ==\n" - " static_cast<::google::protobuf::uint8>($uncommontag$u)) {\n", + printer->Print("} else if (static_cast< ::google::protobuf::uint8>(tag) ==\n" + " static_cast< ::google::protobuf::uint8>($uncommontag$u)) {\n", "uncommontag", SimpleItoa( internal::WireFormatLite::MakeTag( field->number(), wiretype))); diff --git a/src/google/protobuf/compiler/csharp/csharp_enum.cc b/src/google/protobuf/compiler/csharp/csharp_enum.cc index 9e4da1ed..9759e3ef 100644 --- a/src/google/protobuf/compiler/csharp/csharp_enum.cc +++ b/src/google/protobuf/compiler/csharp/csharp_enum.cc @@ -65,6 +65,7 @@ void EnumGenerator::Generate(io::Printer* printer) { "name", descriptor_->name()); printer->Indent(); std::set<string> used_names; + std::set<int> used_number; for (int i = 0; i < descriptor_->value_count(); i++) { WriteEnumValueDocComment(printer, descriptor_->value(i)); string original_name = descriptor_->value(i)->name(); @@ -76,10 +77,18 @@ void EnumGenerator::Generate(io::Printer* printer) { << ") in " << descriptor_->name() << "; adding underscore to distinguish"; name += "_"; } - printer->Print("[pbr::OriginalName(\"$original_name$\")] $name$ = $number$,\n", - "original_name", original_name, - "name", name, - "number", SimpleItoa(descriptor_->value(i)->number())); + int number = descriptor_->value(i)->number(); + if (!used_number.insert(number).second) { + printer->Print("[pbr::OriginalName(\"$original_name$\", PreferredAlias = false)] $name$ = $number$,\n", + "original_name", original_name, + "name", name, + "number", SimpleItoa(number)); + } else { + printer->Print("[pbr::OriginalName(\"$original_name$\")] $name$ = $number$,\n", + "original_name", original_name, + "name", name, + "number", SimpleItoa(number)); + } } printer->Outdent(); printer->Print("}\n"); diff --git a/src/google/protobuf/compiler/java/java_file.cc b/src/google/protobuf/compiler/java/java_file.cc index cb4503f6..86719f70 100644 --- a/src/google/protobuf/compiler/java/java_file.cc +++ b/src/google/protobuf/compiler/java/java_file.cc @@ -65,7 +65,7 @@ namespace java { namespace { struct FieldDescriptorCompare { - bool operator ()(const FieldDescriptor* f1, const FieldDescriptor* f2) { + bool operator ()(const FieldDescriptor* f1, const FieldDescriptor* f2) const { if(f1 == NULL) { return false; } diff --git a/src/google/protobuf/compiler/plugin.pb.cc b/src/google/protobuf/compiler/plugin.pb.cc index 686ee477..4310ff1e 100644 --- a/src/google/protobuf/compiler/plugin.pb.cc +++ b/src/google/protobuf/compiler/plugin.pb.cc @@ -287,8 +287,8 @@ bool Version::MergePartialFromCodedStream( switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // optional int32 major = 1; case 1: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(8u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(8u)) { set_has_major(); DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( @@ -301,8 +301,8 @@ bool Version::MergePartialFromCodedStream( // optional int32 minor = 2; case 2: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(16u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(16u)) { set_has_minor(); DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( @@ -315,8 +315,8 @@ bool Version::MergePartialFromCodedStream( // optional int32 patch = 3; case 3: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(24u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(24u)) { set_has_patch(); DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( @@ -329,8 +329,8 @@ bool Version::MergePartialFromCodedStream( // optional string suffix = 4; case 4: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(34u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(34u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_suffix())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( @@ -804,8 +804,8 @@ bool CodeGeneratorRequest::MergePartialFromCodedStream( switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // repeated string file_to_generate = 1; case 1: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(10u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(10u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->add_file_to_generate())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( @@ -821,8 +821,8 @@ bool CodeGeneratorRequest::MergePartialFromCodedStream( // optional string parameter = 2; case 2: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(18u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(18u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_parameter())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( @@ -837,8 +837,8 @@ bool CodeGeneratorRequest::MergePartialFromCodedStream( // optional .google.protobuf.compiler.Version compiler_version = 3; case 3: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(26u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(26u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( input, mutable_compiler_version())); } else { @@ -849,8 +849,8 @@ bool CodeGeneratorRequest::MergePartialFromCodedStream( // repeated .google.protobuf.FileDescriptorProto proto_file = 15; case 15: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(122u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(122u)) { DO_(input->IncrementRecursionDepth()); DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtualNoRecursionDepth( input, add_proto_file())); @@ -1412,8 +1412,8 @@ bool CodeGeneratorResponse_File::MergePartialFromCodedStream( switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // optional string name = 1; case 1: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(10u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(10u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_name())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( @@ -1428,8 +1428,8 @@ bool CodeGeneratorResponse_File::MergePartialFromCodedStream( // optional string insertion_point = 2; case 2: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(18u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(18u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_insertion_point())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( @@ -1444,8 +1444,8 @@ bool CodeGeneratorResponse_File::MergePartialFromCodedStream( // optional string content = 15; case 15: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(122u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(122u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_content())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( @@ -1955,8 +1955,8 @@ bool CodeGeneratorResponse::MergePartialFromCodedStream( switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // optional string error = 1; case 1: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(10u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(10u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_error())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( @@ -1971,8 +1971,8 @@ bool CodeGeneratorResponse::MergePartialFromCodedStream( // repeated .google.protobuf.compiler.CodeGeneratorResponse.File file = 15; case 15: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(122u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(122u)) { DO_(input->IncrementRecursionDepth()); DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtualNoRecursionDepth( input, add_file())); diff --git a/src/google/protobuf/descriptor.pb.cc b/src/google/protobuf/descriptor.pb.cc index 15c97d0b..2a270d65 100644 --- a/src/google/protobuf/descriptor.pb.cc +++ b/src/google/protobuf/descriptor.pb.cc @@ -1004,8 +1004,8 @@ bool FileDescriptorSet::MergePartialFromCodedStream( switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // repeated .google.protobuf.FileDescriptorProto file = 1; case 1: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(10u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(10u)) { DO_(input->IncrementRecursionDepth()); DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtualNoRecursionDepth( input, add_file())); @@ -1351,8 +1351,8 @@ bool FileDescriptorProto::MergePartialFromCodedStream( switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // optional string name = 1; case 1: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(10u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(10u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_name())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( @@ -1367,8 +1367,8 @@ bool FileDescriptorProto::MergePartialFromCodedStream( // optional string package = 2; case 2: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(18u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(18u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_package())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( @@ -1383,8 +1383,8 @@ bool FileDescriptorProto::MergePartialFromCodedStream( // repeated string dependency = 3; case 3: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(26u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(26u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->add_dependency())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( @@ -1400,8 +1400,8 @@ bool FileDescriptorProto::MergePartialFromCodedStream( // repeated .google.protobuf.DescriptorProto message_type = 4; case 4: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(34u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(34u)) { DO_(input->IncrementRecursionDepth()); DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtualNoRecursionDepth( input, add_message_type())); @@ -1414,8 +1414,8 @@ bool FileDescriptorProto::MergePartialFromCodedStream( // repeated .google.protobuf.EnumDescriptorProto enum_type = 5; case 5: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(42u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(42u)) { DO_(input->IncrementRecursionDepth()); DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtualNoRecursionDepth( input, add_enum_type())); @@ -1428,8 +1428,8 @@ bool FileDescriptorProto::MergePartialFromCodedStream( // repeated .google.protobuf.ServiceDescriptorProto service = 6; case 6: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(50u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(50u)) { DO_(input->IncrementRecursionDepth()); DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtualNoRecursionDepth( input, add_service())); @@ -1442,8 +1442,8 @@ bool FileDescriptorProto::MergePartialFromCodedStream( // repeated .google.protobuf.FieldDescriptorProto extension = 7; case 7: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(58u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(58u)) { DO_(input->IncrementRecursionDepth()); DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtualNoRecursionDepth( input, add_extension())); @@ -1456,8 +1456,8 @@ bool FileDescriptorProto::MergePartialFromCodedStream( // optional .google.protobuf.FileOptions options = 8; case 8: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(66u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(66u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( input, mutable_options())); } else { @@ -1468,8 +1468,8 @@ bool FileDescriptorProto::MergePartialFromCodedStream( // optional .google.protobuf.SourceCodeInfo source_code_info = 9; case 9: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(74u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(74u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( input, mutable_source_code_info())); } else { @@ -1480,13 +1480,13 @@ bool FileDescriptorProto::MergePartialFromCodedStream( // repeated int32 public_dependency = 10; case 10: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(80u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(80u)) { DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitive< ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( 1, 80u, input, this->mutable_public_dependency()))); - } else if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(82u)) { + } else if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(82u)) { DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitiveNoInline< ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( input, this->mutable_public_dependency()))); @@ -1498,13 +1498,13 @@ bool FileDescriptorProto::MergePartialFromCodedStream( // repeated int32 weak_dependency = 11; case 11: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(88u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(88u)) { DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitive< ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( 1, 88u, input, this->mutable_weak_dependency()))); - } else if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(90u)) { + } else if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(90u)) { DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitiveNoInline< ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( input, this->mutable_weak_dependency()))); @@ -1516,8 +1516,8 @@ bool FileDescriptorProto::MergePartialFromCodedStream( // optional string syntax = 12; case 12: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(98u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(98u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_syntax())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( @@ -2596,8 +2596,8 @@ bool DescriptorProto_ExtensionRange::MergePartialFromCodedStream( switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // optional int32 start = 1; case 1: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(8u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(8u)) { set_has_start(); DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( @@ -2610,8 +2610,8 @@ bool DescriptorProto_ExtensionRange::MergePartialFromCodedStream( // optional int32 end = 2; case 2: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(16u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(16u)) { set_has_end(); DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( @@ -2921,8 +2921,8 @@ bool DescriptorProto_ReservedRange::MergePartialFromCodedStream( switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // optional int32 start = 1; case 1: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(8u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(8u)) { set_has_start(); DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( @@ -2935,8 +2935,8 @@ bool DescriptorProto_ReservedRange::MergePartialFromCodedStream( // optional int32 end = 2; case 2: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(16u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(16u)) { set_has_end(); DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( @@ -3286,8 +3286,8 @@ bool DescriptorProto::MergePartialFromCodedStream( switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // optional string name = 1; case 1: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(10u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(10u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_name())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( @@ -3302,8 +3302,8 @@ bool DescriptorProto::MergePartialFromCodedStream( // repeated .google.protobuf.FieldDescriptorProto field = 2; case 2: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(18u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(18u)) { DO_(input->IncrementRecursionDepth()); DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtualNoRecursionDepth( input, add_field())); @@ -3316,8 +3316,8 @@ bool DescriptorProto::MergePartialFromCodedStream( // repeated .google.protobuf.DescriptorProto nested_type = 3; case 3: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(26u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(26u)) { DO_(input->IncrementRecursionDepth()); DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtualNoRecursionDepth( input, add_nested_type())); @@ -3330,8 +3330,8 @@ bool DescriptorProto::MergePartialFromCodedStream( // repeated .google.protobuf.EnumDescriptorProto enum_type = 4; case 4: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(34u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(34u)) { DO_(input->IncrementRecursionDepth()); DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtualNoRecursionDepth( input, add_enum_type())); @@ -3344,8 +3344,8 @@ bool DescriptorProto::MergePartialFromCodedStream( // repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5; case 5: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(42u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(42u)) { DO_(input->IncrementRecursionDepth()); DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtualNoRecursionDepth( input, add_extension_range())); @@ -3358,8 +3358,8 @@ bool DescriptorProto::MergePartialFromCodedStream( // repeated .google.protobuf.FieldDescriptorProto extension = 6; case 6: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(50u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(50u)) { DO_(input->IncrementRecursionDepth()); DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtualNoRecursionDepth( input, add_extension())); @@ -3372,8 +3372,8 @@ bool DescriptorProto::MergePartialFromCodedStream( // optional .google.protobuf.MessageOptions options = 7; case 7: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(58u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(58u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( input, mutable_options())); } else { @@ -3384,8 +3384,8 @@ bool DescriptorProto::MergePartialFromCodedStream( // repeated .google.protobuf.OneofDescriptorProto oneof_decl = 8; case 8: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(66u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(66u)) { DO_(input->IncrementRecursionDepth()); DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtualNoRecursionDepth( input, add_oneof_decl())); @@ -3398,8 +3398,8 @@ bool DescriptorProto::MergePartialFromCodedStream( // repeated .google.protobuf.DescriptorProto.ReservedRange reserved_range = 9; case 9: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(74u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(74u)) { DO_(input->IncrementRecursionDepth()); DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtualNoRecursionDepth( input, add_reserved_range())); @@ -3412,8 +3412,8 @@ bool DescriptorProto::MergePartialFromCodedStream( // repeated string reserved_name = 10; case 10: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(82u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(82u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->add_reserved_name())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( @@ -4375,8 +4375,8 @@ bool FieldDescriptorProto::MergePartialFromCodedStream( switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // optional string name = 1; case 1: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(10u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(10u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_name())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( @@ -4391,8 +4391,8 @@ bool FieldDescriptorProto::MergePartialFromCodedStream( // optional string extendee = 2; case 2: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(18u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(18u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_extendee())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( @@ -4407,8 +4407,8 @@ bool FieldDescriptorProto::MergePartialFromCodedStream( // optional int32 number = 3; case 3: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(24u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(24u)) { set_has_number(); DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( @@ -4421,8 +4421,8 @@ bool FieldDescriptorProto::MergePartialFromCodedStream( // optional .google.protobuf.FieldDescriptorProto.Label label = 4; case 4: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(32u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(32u)) { int value; DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>( @@ -4440,8 +4440,8 @@ bool FieldDescriptorProto::MergePartialFromCodedStream( // optional .google.protobuf.FieldDescriptorProto.Type type = 5; case 5: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(40u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(40u)) { int value; DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>( @@ -4459,8 +4459,8 @@ bool FieldDescriptorProto::MergePartialFromCodedStream( // optional string type_name = 6; case 6: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(50u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(50u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_type_name())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( @@ -4475,8 +4475,8 @@ bool FieldDescriptorProto::MergePartialFromCodedStream( // optional string default_value = 7; case 7: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(58u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(58u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_default_value())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( @@ -4491,8 +4491,8 @@ bool FieldDescriptorProto::MergePartialFromCodedStream( // optional .google.protobuf.FieldOptions options = 8; case 8: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(66u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(66u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( input, mutable_options())); } else { @@ -4503,8 +4503,8 @@ bool FieldDescriptorProto::MergePartialFromCodedStream( // optional int32 oneof_index = 9; case 9: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(72u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(72u)) { set_has_oneof_index(); DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( @@ -4517,8 +4517,8 @@ bool FieldDescriptorProto::MergePartialFromCodedStream( // optional string json_name = 10; case 10: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(82u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(82u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_json_name())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( @@ -5491,8 +5491,8 @@ bool OneofDescriptorProto::MergePartialFromCodedStream( switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // optional string name = 1; case 1: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(10u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(10u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_name())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( @@ -5507,8 +5507,8 @@ bool OneofDescriptorProto::MergePartialFromCodedStream( // optional .google.protobuf.OneofOptions options = 2; case 2: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(18u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(18u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( input, mutable_options())); } else { @@ -5912,8 +5912,8 @@ bool EnumDescriptorProto::MergePartialFromCodedStream( switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // optional string name = 1; case 1: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(10u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(10u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_name())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( @@ -5928,8 +5928,8 @@ bool EnumDescriptorProto::MergePartialFromCodedStream( // repeated .google.protobuf.EnumValueDescriptorProto value = 2; case 2: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(18u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(18u)) { DO_(input->IncrementRecursionDepth()); DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtualNoRecursionDepth( input, add_value())); @@ -5942,8 +5942,8 @@ bool EnumDescriptorProto::MergePartialFromCodedStream( // optional .google.protobuf.EnumOptions options = 3; case 3: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(26u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(26u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( input, mutable_options())); } else { @@ -6405,8 +6405,8 @@ bool EnumValueDescriptorProto::MergePartialFromCodedStream( switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // optional string name = 1; case 1: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(10u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(10u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_name())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( @@ -6421,8 +6421,8 @@ bool EnumValueDescriptorProto::MergePartialFromCodedStream( // optional int32 number = 2; case 2: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(16u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(16u)) { set_has_number(); DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( @@ -6435,8 +6435,8 @@ bool EnumValueDescriptorProto::MergePartialFromCodedStream( // optional .google.protobuf.EnumValueOptions options = 3; case 3: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(26u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(26u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( input, mutable_options())); } else { @@ -6885,8 +6885,8 @@ bool ServiceDescriptorProto::MergePartialFromCodedStream( switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // optional string name = 1; case 1: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(10u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(10u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_name())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( @@ -6901,8 +6901,8 @@ bool ServiceDescriptorProto::MergePartialFromCodedStream( // repeated .google.protobuf.MethodDescriptorProto method = 2; case 2: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(18u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(18u)) { DO_(input->IncrementRecursionDepth()); DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtualNoRecursionDepth( input, add_method())); @@ -6915,8 +6915,8 @@ bool ServiceDescriptorProto::MergePartialFromCodedStream( // optional .google.protobuf.ServiceOptions options = 3; case 3: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(26u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(26u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( input, mutable_options())); } else { @@ -7406,8 +7406,8 @@ bool MethodDescriptorProto::MergePartialFromCodedStream( switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // optional string name = 1; case 1: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(10u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(10u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_name())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( @@ -7422,8 +7422,8 @@ bool MethodDescriptorProto::MergePartialFromCodedStream( // optional string input_type = 2; case 2: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(18u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(18u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_input_type())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( @@ -7438,8 +7438,8 @@ bool MethodDescriptorProto::MergePartialFromCodedStream( // optional string output_type = 3; case 3: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(26u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(26u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_output_type())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( @@ -7454,8 +7454,8 @@ bool MethodDescriptorProto::MergePartialFromCodedStream( // optional .google.protobuf.MethodOptions options = 4; case 4: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(34u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(34u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( input, mutable_options())); } else { @@ -7466,8 +7466,8 @@ bool MethodDescriptorProto::MergePartialFromCodedStream( // optional bool client_streaming = 5 [default = false]; case 5: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(40u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(40u)) { set_has_client_streaming(); DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( @@ -7480,8 +7480,8 @@ bool MethodDescriptorProto::MergePartialFromCodedStream( // optional bool server_streaming = 6 [default = false]; case 6: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(48u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(48u)) { set_has_server_streaming(); DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( @@ -8230,8 +8230,8 @@ bool FileOptions::MergePartialFromCodedStream( switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // optional string java_package = 1; case 1: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(10u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(10u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_java_package())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( @@ -8246,8 +8246,8 @@ bool FileOptions::MergePartialFromCodedStream( // optional string java_outer_classname = 8; case 8: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(66u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(66u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_java_outer_classname())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( @@ -8262,8 +8262,8 @@ bool FileOptions::MergePartialFromCodedStream( // optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 [default = SPEED]; case 9: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(72u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(72u)) { int value; DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>( @@ -8281,8 +8281,8 @@ bool FileOptions::MergePartialFromCodedStream( // optional bool java_multiple_files = 10 [default = false]; case 10: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(80u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(80u)) { set_has_java_multiple_files(); DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( @@ -8295,8 +8295,8 @@ bool FileOptions::MergePartialFromCodedStream( // optional string go_package = 11; case 11: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(90u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(90u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_go_package())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( @@ -8311,8 +8311,8 @@ bool FileOptions::MergePartialFromCodedStream( // optional bool cc_generic_services = 16 [default = false]; case 16: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(128u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(128u)) { set_has_cc_generic_services(); DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( @@ -8325,8 +8325,8 @@ bool FileOptions::MergePartialFromCodedStream( // optional bool java_generic_services = 17 [default = false]; case 17: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(136u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(136u)) { set_has_java_generic_services(); DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( @@ -8339,8 +8339,8 @@ bool FileOptions::MergePartialFromCodedStream( // optional bool py_generic_services = 18 [default = false]; case 18: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(144u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(144u)) { set_has_py_generic_services(); DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( @@ -8353,8 +8353,8 @@ bool FileOptions::MergePartialFromCodedStream( // optional bool java_generate_equals_and_hash = 20 [deprecated = true]; case 20: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(160u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(160u)) { set_has_java_generate_equals_and_hash(); DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( @@ -8367,8 +8367,8 @@ bool FileOptions::MergePartialFromCodedStream( // optional bool deprecated = 23 [default = false]; case 23: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(184u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(184u)) { set_has_deprecated(); DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( @@ -8381,8 +8381,8 @@ bool FileOptions::MergePartialFromCodedStream( // optional bool java_string_check_utf8 = 27 [default = false]; case 27: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(216u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(216u)) { set_has_java_string_check_utf8(); DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( @@ -8395,8 +8395,8 @@ bool FileOptions::MergePartialFromCodedStream( // optional bool cc_enable_arenas = 31 [default = false]; case 31: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(248u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(248u)) { set_has_cc_enable_arenas(); DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( @@ -8409,8 +8409,8 @@ bool FileOptions::MergePartialFromCodedStream( // optional string objc_class_prefix = 36; case 36: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(290u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(290u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_objc_class_prefix())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( @@ -8425,8 +8425,8 @@ bool FileOptions::MergePartialFromCodedStream( // optional string csharp_namespace = 37; case 37: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(298u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(298u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_csharp_namespace())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( @@ -8441,8 +8441,8 @@ bool FileOptions::MergePartialFromCodedStream( // optional string swift_prefix = 39; case 39: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(314u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(314u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_swift_prefix())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( @@ -8457,8 +8457,8 @@ bool FileOptions::MergePartialFromCodedStream( // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; case 999: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(7994u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(7994u)) { DO_(input->IncrementRecursionDepth()); DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtualNoRecursionDepth( input, add_uninterpreted_option())); @@ -9728,8 +9728,8 @@ bool MessageOptions::MergePartialFromCodedStream( switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // optional bool message_set_wire_format = 1 [default = false]; case 1: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(8u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(8u)) { set_has_message_set_wire_format(); DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( @@ -9742,8 +9742,8 @@ bool MessageOptions::MergePartialFromCodedStream( // optional bool no_standard_descriptor_accessor = 2 [default = false]; case 2: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(16u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(16u)) { set_has_no_standard_descriptor_accessor(); DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( @@ -9756,8 +9756,8 @@ bool MessageOptions::MergePartialFromCodedStream( // optional bool deprecated = 3 [default = false]; case 3: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(24u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(24u)) { set_has_deprecated(); DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( @@ -9770,8 +9770,8 @@ bool MessageOptions::MergePartialFromCodedStream( // optional bool map_entry = 7; case 7: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(56u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(56u)) { set_has_map_entry(); DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( @@ -9784,8 +9784,8 @@ bool MessageOptions::MergePartialFromCodedStream( // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; case 999: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(7994u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(7994u)) { DO_(input->IncrementRecursionDepth()); DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtualNoRecursionDepth( input, add_uninterpreted_option())); @@ -10264,8 +10264,8 @@ bool FieldOptions::MergePartialFromCodedStream( switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // optional .google.protobuf.FieldOptions.CType ctype = 1 [default = STRING]; case 1: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(8u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(8u)) { int value; DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>( @@ -10283,8 +10283,8 @@ bool FieldOptions::MergePartialFromCodedStream( // optional bool packed = 2; case 2: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(16u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(16u)) { set_has_packed(); DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( @@ -10297,8 +10297,8 @@ bool FieldOptions::MergePartialFromCodedStream( // optional bool deprecated = 3 [default = false]; case 3: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(24u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(24u)) { set_has_deprecated(); DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( @@ -10311,8 +10311,8 @@ bool FieldOptions::MergePartialFromCodedStream( // optional bool lazy = 5 [default = false]; case 5: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(40u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(40u)) { set_has_lazy(); DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( @@ -10325,8 +10325,8 @@ bool FieldOptions::MergePartialFromCodedStream( // optional .google.protobuf.FieldOptions.JSType jstype = 6 [default = JS_NORMAL]; case 6: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(48u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(48u)) { int value; DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>( @@ -10344,8 +10344,8 @@ bool FieldOptions::MergePartialFromCodedStream( // optional bool weak = 10 [default = false]; case 10: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(80u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(80u)) { set_has_weak(); DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( @@ -10358,8 +10358,8 @@ bool FieldOptions::MergePartialFromCodedStream( // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; case 999: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(7994u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(7994u)) { DO_(input->IncrementRecursionDepth()); DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtualNoRecursionDepth( input, add_uninterpreted_option())); @@ -10917,8 +10917,8 @@ bool OneofOptions::MergePartialFromCodedStream( switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; case 999: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(7994u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(7994u)) { DO_(input->IncrementRecursionDepth()); DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtualNoRecursionDepth( input, add_uninterpreted_option())); @@ -11217,8 +11217,8 @@ bool EnumOptions::MergePartialFromCodedStream( switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // optional bool allow_alias = 2; case 2: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(16u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(16u)) { set_has_allow_alias(); DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( @@ -11231,8 +11231,8 @@ bool EnumOptions::MergePartialFromCodedStream( // optional bool deprecated = 3 [default = false]; case 3: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(24u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(24u)) { set_has_deprecated(); DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( @@ -11245,8 +11245,8 @@ bool EnumOptions::MergePartialFromCodedStream( // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; case 999: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(7994u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(7994u)) { DO_(input->IncrementRecursionDepth()); DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtualNoRecursionDepth( input, add_uninterpreted_option())); @@ -11628,8 +11628,8 @@ bool EnumValueOptions::MergePartialFromCodedStream( switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // optional bool deprecated = 1 [default = false]; case 1: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(8u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(8u)) { set_has_deprecated(); DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( @@ -11642,8 +11642,8 @@ bool EnumValueOptions::MergePartialFromCodedStream( // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; case 999: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(7994u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(7994u)) { DO_(input->IncrementRecursionDepth()); DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtualNoRecursionDepth( input, add_uninterpreted_option())); @@ -11978,8 +11978,8 @@ bool ServiceOptions::MergePartialFromCodedStream( switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // optional bool deprecated = 33 [default = false]; case 33: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(264u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(264u)) { set_has_deprecated(); DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( @@ -11992,8 +11992,8 @@ bool ServiceOptions::MergePartialFromCodedStream( // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; case 999: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(7994u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(7994u)) { DO_(input->IncrementRecursionDepth()); DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtualNoRecursionDepth( input, add_uninterpreted_option())); @@ -12335,8 +12335,8 @@ bool MethodOptions::MergePartialFromCodedStream( switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // optional bool deprecated = 33 [default = false]; case 33: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(264u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(264u)) { set_has_deprecated(); DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( @@ -12349,8 +12349,8 @@ bool MethodOptions::MergePartialFromCodedStream( // optional .google.protobuf.MethodOptions.IdempotencyLevel idempotency_level = 34 [default = IDEMPOTENCY_UNKNOWN]; case 34: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(272u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(272u)) { int value; DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>( @@ -12368,8 +12368,8 @@ bool MethodOptions::MergePartialFromCodedStream( // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; case 999: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(7994u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(7994u)) { DO_(input->IncrementRecursionDepth()); DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtualNoRecursionDepth( input, add_uninterpreted_option())); @@ -12761,8 +12761,8 @@ bool UninterpretedOption_NamePart::MergePartialFromCodedStream( switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // required string name_part = 1; case 1: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(10u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(10u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_name_part())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( @@ -12777,8 +12777,8 @@ bool UninterpretedOption_NamePart::MergePartialFromCodedStream( // required bool is_extension = 2; case 2: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(16u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(16u)) { set_has_is_extension(); DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( @@ -13192,8 +13192,8 @@ bool UninterpretedOption::MergePartialFromCodedStream( switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // repeated .google.protobuf.UninterpretedOption.NamePart name = 2; case 2: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(18u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(18u)) { DO_(input->IncrementRecursionDepth()); DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtualNoRecursionDepth( input, add_name())); @@ -13206,8 +13206,8 @@ bool UninterpretedOption::MergePartialFromCodedStream( // optional string identifier_value = 3; case 3: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(26u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(26u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_identifier_value())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( @@ -13222,8 +13222,8 @@ bool UninterpretedOption::MergePartialFromCodedStream( // optional uint64 positive_int_value = 4; case 4: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(32u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(32u)) { set_has_positive_int_value(); DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< ::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>( @@ -13236,8 +13236,8 @@ bool UninterpretedOption::MergePartialFromCodedStream( // optional int64 negative_int_value = 5; case 5: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(40u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(40u)) { set_has_negative_int_value(); DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< ::google::protobuf::int64, ::google::protobuf::internal::WireFormatLite::TYPE_INT64>( @@ -13250,8 +13250,8 @@ bool UninterpretedOption::MergePartialFromCodedStream( // optional double double_value = 6; case 6: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(49u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(49u)) { set_has_double_value(); DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< double, ::google::protobuf::internal::WireFormatLite::TYPE_DOUBLE>( @@ -13264,8 +13264,8 @@ bool UninterpretedOption::MergePartialFromCodedStream( // optional bytes string_value = 7; case 7: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(58u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(58u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadBytes( input, this->mutable_string_value())); } else { @@ -13276,8 +13276,8 @@ bool UninterpretedOption::MergePartialFromCodedStream( // optional string aggregate_value = 8; case 8: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(66u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(66u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_aggregate_value())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( @@ -13988,13 +13988,13 @@ bool SourceCodeInfo_Location::MergePartialFromCodedStream( switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // repeated int32 path = 1 [packed = true]; case 1: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(10u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(10u)) { DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitive< ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( input, this->mutable_path()))); - } else if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(8u)) { + } else if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(8u)) { DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitiveNoInline< ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( 1, 10u, input, this->mutable_path()))); @@ -14006,13 +14006,13 @@ bool SourceCodeInfo_Location::MergePartialFromCodedStream( // repeated int32 span = 2 [packed = true]; case 2: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(18u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(18u)) { DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitive< ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( input, this->mutable_span()))); - } else if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(16u)) { + } else if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(16u)) { DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitiveNoInline< ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( 1, 18u, input, this->mutable_span()))); @@ -14024,8 +14024,8 @@ bool SourceCodeInfo_Location::MergePartialFromCodedStream( // optional string leading_comments = 3; case 3: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(26u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(26u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_leading_comments())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( @@ -14040,8 +14040,8 @@ bool SourceCodeInfo_Location::MergePartialFromCodedStream( // optional string trailing_comments = 4; case 4: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(34u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(34u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_trailing_comments())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( @@ -14056,8 +14056,8 @@ bool SourceCodeInfo_Location::MergePartialFromCodedStream( // repeated string leading_detached_comments = 6; case 6: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(50u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(50u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->add_leading_detached_comments())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( @@ -14701,8 +14701,8 @@ bool SourceCodeInfo::MergePartialFromCodedStream( switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // repeated .google.protobuf.SourceCodeInfo.Location location = 1; case 1: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(10u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(10u)) { DO_(input->IncrementRecursionDepth()); DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtualNoRecursionDepth( input, add_location())); @@ -14988,13 +14988,13 @@ bool GeneratedCodeInfo_Annotation::MergePartialFromCodedStream( switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // repeated int32 path = 1 [packed = true]; case 1: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(10u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(10u)) { DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitive< ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( input, this->mutable_path()))); - } else if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(8u)) { + } else if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(8u)) { DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitiveNoInline< ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( 1, 10u, input, this->mutable_path()))); @@ -15006,8 +15006,8 @@ bool GeneratedCodeInfo_Annotation::MergePartialFromCodedStream( // optional string source_file = 2; case 2: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(18u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(18u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_source_file())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( @@ -15022,8 +15022,8 @@ bool GeneratedCodeInfo_Annotation::MergePartialFromCodedStream( // optional int32 begin = 3; case 3: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(24u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(24u)) { set_has_begin(); DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( @@ -15036,8 +15036,8 @@ bool GeneratedCodeInfo_Annotation::MergePartialFromCodedStream( // optional int32 end = 4; case 4: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(32u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(32u)) { set_has_end(); DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( @@ -15505,8 +15505,8 @@ bool GeneratedCodeInfo::MergePartialFromCodedStream( switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // repeated .google.protobuf.GeneratedCodeInfo.Annotation annotation = 1; case 1: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(10u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(10u)) { DO_(input->IncrementRecursionDepth()); DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtualNoRecursionDepth( input, add_annotation())); diff --git a/src/google/protobuf/duration.pb.cc b/src/google/protobuf/duration.pb.cc index d9b4fb1f..e046cc5a 100644 --- a/src/google/protobuf/duration.pb.cc +++ b/src/google/protobuf/duration.pb.cc @@ -216,8 +216,8 @@ bool Duration::MergePartialFromCodedStream( switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // int64 seconds = 1; case 1: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(8u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(8u)) { DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< ::google::protobuf::int64, ::google::protobuf::internal::WireFormatLite::TYPE_INT64>( @@ -230,8 +230,8 @@ bool Duration::MergePartialFromCodedStream( // int32 nanos = 2; case 2: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(16u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(16u)) { DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( diff --git a/src/google/protobuf/field_mask.pb.cc b/src/google/protobuf/field_mask.pb.cc index c9409fe5..b054dffd 100644 --- a/src/google/protobuf/field_mask.pb.cc +++ b/src/google/protobuf/field_mask.pb.cc @@ -192,8 +192,8 @@ bool FieldMask::MergePartialFromCodedStream( switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // repeated string paths = 1; case 1: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(10u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(10u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->add_paths())); DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( diff --git a/src/google/protobuf/generated_message_reflection.h b/src/google/protobuf/generated_message_reflection.h index 2e65787f..8b1362a2 100644 --- a/src/google/protobuf/generated_message_reflection.h +++ b/src/google/protobuf/generated_message_reflection.h @@ -674,6 +674,8 @@ class LIBPROTOBUF_EXPORT GeneratedMessageReflection PROTOBUF_FINAL template<typename To, typename From> inline To dynamic_cast_if_available(From from) { #if defined(GOOGLE_PROTOBUF_NO_RTTI) || (defined(_MSC_VER)&&!defined(_CPPRTTI)) + // Avoid the compiler warning about unused variables. + (void)from; return NULL; #else return dynamic_cast<To>(from); diff --git a/src/google/protobuf/map.h b/src/google/protobuf/map.h index 6458714e..61a23897 100644 --- a/src/google/protobuf/map.h +++ b/src/google/protobuf/map.h @@ -592,7 +592,7 @@ class Map { MapAllocator(const MapAllocator<X>& allocator) : arena_(allocator.arena()) {} - pointer allocate(size_type n, const_pointer hint = 0) { + pointer allocate(size_type n, const void* hint = 0) { // If arena is not given, malloc needs to be called which doesn't // construct element object. if (arena_ == NULL) { @@ -1726,12 +1726,19 @@ struct hash<google::protobuf::MapKey> { break; case google::protobuf::FieldDescriptor::CPPTYPE_STRING: return hash<string>()(map_key.GetStringValue()); +#if defined(GOOGLE_PROTOBUF_HAVE_64BIT_HASH) case google::protobuf::FieldDescriptor::CPPTYPE_INT64: return hash< ::google::protobuf::int64>()(map_key.GetInt64Value()); - case google::protobuf::FieldDescriptor::CPPTYPE_INT32: - return hash< ::google::protobuf::int32>()(map_key.GetInt32Value()); case google::protobuf::FieldDescriptor::CPPTYPE_UINT64: return hash< ::google::protobuf::uint64>()(map_key.GetUInt64Value()); +#else + case google::protobuf::FieldDescriptor::CPPTYPE_INT64: + case google::protobuf::FieldDescriptor::CPPTYPE_UINT64: + GOOGLE_LOG(FATAL) << "Unsupported on this platform."; + break; +#endif + case google::protobuf::FieldDescriptor::CPPTYPE_INT32: + return hash< ::google::protobuf::int32>()(map_key.GetInt32Value()); case google::protobuf::FieldDescriptor::CPPTYPE_UINT32: return hash< ::google::protobuf::uint32>()(map_key.GetUInt32Value()); case google::protobuf::FieldDescriptor::CPPTYPE_BOOL: diff --git a/src/google/protobuf/map_field_inl.h b/src/google/protobuf/map_field_inl.h index 01c9b89a..2d84b0a3 100644 --- a/src/google/protobuf/map_field_inl.h +++ b/src/google/protobuf/map_field_inl.h @@ -339,9 +339,9 @@ MapField<Key, T, kKeyFieldType, kValueFieldType, default_enum_value>::Swap( MapFieldLiteType* other) { MapField* down_other = down_cast<MapField*>(other); - std::swap(MapFieldBase::repeated_field_, down_other->repeated_field_); + std::swap(this->MapFieldBase::repeated_field_, down_other->repeated_field_); MapFieldLiteType::Swap(other); - std::swap(MapFieldBase::state_, down_other->state_); + std::swap(this->MapFieldBase::state_, down_other->state_); } template <typename Key, typename T, @@ -352,7 +352,7 @@ void MapField<Key, T, kKeyFieldType, kValueFieldType, default_enum_value>::SetEntryDescriptor( const Descriptor** descriptor) { - MapFieldBase::entry_descriptor_ = descriptor; + this->MapFieldBase::entry_descriptor_ = descriptor; } template <typename Key, typename T, @@ -362,7 +362,7 @@ template <typename Key, typename T, void MapField<Key, T, kKeyFieldType, kValueFieldType, default_enum_value>::SetAssignDescriptorCallback(void (*callback)()) { - MapFieldBase::assign_descriptor_callback_ = callback; + this->MapFieldBase::assign_descriptor_callback_ = callback; } template <typename Key, typename T, @@ -392,19 +392,19 @@ template <typename Key, typename T, void MapField<Key, T, kKeyFieldType, kValueFieldType, default_enum_value>::SyncRepeatedFieldWithMapNoLock() const { - if (MapFieldBase::repeated_field_ == NULL) { - if (MapFieldBase::arena_ == NULL) { - MapFieldBase::repeated_field_ = new RepeatedPtrField<Message>(); + if (this->MapFieldBase::repeated_field_ == NULL) { + if (this->MapFieldBase::arena_ == NULL) { + this->MapFieldBase::repeated_field_ = new RepeatedPtrField<Message>(); } else { - MapFieldBase::repeated_field_ = + this->MapFieldBase::repeated_field_ = Arena::CreateMessage<RepeatedPtrField<Message> >( - MapFieldBase::arena_); + this->MapFieldBase::arena_); } } const Map<Key, T>& map = GetInternalMap(); RepeatedPtrField<EntryType>* repeated_field = reinterpret_cast<RepeatedPtrField<EntryType>*>( - MapFieldBase::repeated_field_); + this->MapFieldBase::repeated_field_); repeated_field->Clear(); @@ -413,7 +413,7 @@ MapField<Key, T, kKeyFieldType, kValueFieldType, InitDefaultEntryOnce(); GOOGLE_CHECK(default_entry_ != NULL); EntryType* new_entry = - down_cast<EntryType*>(default_entry_->New(MapFieldBase::arena_)); + down_cast<EntryType*>(default_entry_->New(this->MapFieldBase::arena_)); repeated_field->AddAllocated(new_entry); (*new_entry->mutable_key()) = it->first; (*new_entry->mutable_value()) = it->second; @@ -430,8 +430,8 @@ MapField<Key, T, kKeyFieldType, kValueFieldType, Map<Key, T>* map = const_cast<MapField*>(this)->MutableInternalMap(); RepeatedPtrField<EntryType>* repeated_field = reinterpret_cast<RepeatedPtrField<EntryType>*>( - MapFieldBase::repeated_field_); - GOOGLE_CHECK(MapFieldBase::repeated_field_ != NULL); + this->MapFieldBase::repeated_field_); + GOOGLE_CHECK(this->MapFieldBase::repeated_field_ != NULL); map->clear(); for (typename RepeatedPtrField<EntryType>::iterator it = repeated_field->begin(); it != repeated_field->end(); ++it) { @@ -452,8 +452,8 @@ int MapField<Key, T, kKeyFieldType, kValueFieldType, default_enum_value>::SpaceUsedExcludingSelfNoLock() const { int size = 0; - if (MapFieldBase::repeated_field_ != NULL) { - size += MapFieldBase::repeated_field_->SpaceUsedExcludingSelf(); + if (this->MapFieldBase::repeated_field_ != NULL) { + size += this->MapFieldBase::repeated_field_->SpaceUsedExcludingSelf(); } Map<Key, T>* map = const_cast<MapField*>(this)->MutableInternalMap(); size += sizeof(*map); @@ -475,10 +475,10 @@ MapField<Key, T, kKeyFieldType, kValueFieldType, const { if (default_entry_ == NULL) { MapFieldBase::InitMetadataOnce(); - GOOGLE_CHECK(*MapFieldBase::entry_descriptor_ != NULL); + GOOGLE_CHECK(*this->MapFieldBase::entry_descriptor_ != NULL); default_entry_ = down_cast<const EntryType*>( MessageFactory::generated_factory()->GetPrototype( - *MapFieldBase::entry_descriptor_)); + *this->MapFieldBase::entry_descriptor_)); } } diff --git a/src/google/protobuf/message.cc b/src/google/protobuf/message.cc index b799dead..6800e4cd 100644 --- a/src/google/protobuf/message.cc +++ b/src/google/protobuf/message.cc @@ -451,8 +451,8 @@ struct ShutdownRepeatedFieldRegister { namespace internal { template<> -#if defined(_MSC_VER) && (_MSC_VER >= 1900) -// Note: force noinline to workaround MSVC 2015 compiler bug, issue #240 +#if defined(_MSC_VER) && (_MSC_VER >= 1800) +// Note: force noinline to workaround MSVC compiler bug with /Zc:inline, issue #240 GOOGLE_ATTRIBUTE_NOINLINE #endif Message* GenericTypeHandler<Message>::NewFromPrototype( @@ -460,8 +460,8 @@ Message* GenericTypeHandler<Message>::NewFromPrototype( return prototype->New(arena); } template<> -#if defined(_MSC_VER) && (_MSC_VER >= 1900) -// Note: force noinline to workaround MSVC 2015 compiler bug, issue #240 +#if defined(_MSC_VER) && (_MSC_VER >= 1800) +// Note: force noinline to workaround MSVC compiler bug with /Zc:inline, issue #240 GOOGLE_ATTRIBUTE_NOINLINE #endif google::protobuf::Arena* GenericTypeHandler<Message>::GetArena( @@ -469,8 +469,8 @@ google::protobuf::Arena* GenericTypeHandler<Message>::GetArena( return value->GetArena(); } template<> -#if defined(_MSC_VER) && (_MSC_VER >= 1900) -// Note: force noinline to workaround MSVC 2015 compiler bug, issue #240 +#if defined(_MSC_VER) && (_MSC_VER >= 1800) +// Note: force noinline to workaround MSVC compiler bug with /Zc:inline, issue #240 GOOGLE_ATTRIBUTE_NOINLINE #endif void* GenericTypeHandler<Message>::GetMaybeArenaPointer( diff --git a/src/google/protobuf/source_context.pb.cc b/src/google/protobuf/source_context.pb.cc index b6f5cfce..50e17da1 100644 --- a/src/google/protobuf/source_context.pb.cc +++ b/src/google/protobuf/source_context.pb.cc @@ -198,8 +198,8 @@ bool SourceContext::MergePartialFromCodedStream( switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // string file_name = 1; case 1: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(10u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(10u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_file_name())); DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( diff --git a/src/google/protobuf/struct.pb.cc b/src/google/protobuf/struct.pb.cc index 1350085c..a1aa51ec 100644 --- a/src/google/protobuf/struct.pb.cc +++ b/src/google/protobuf/struct.pb.cc @@ -306,8 +306,8 @@ bool Struct::MergePartialFromCodedStream( switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // map<string, .google.protobuf.Value> fields = 1; case 1: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(10u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(10u)) { DO_(input->IncrementRecursionDepth()); Struct_FieldsEntry::Parser< ::google::protobuf::internal::MapField< ::std::string, ::google::protobuf::Value, @@ -770,8 +770,8 @@ bool Value::MergePartialFromCodedStream( switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // .google.protobuf.NullValue null_value = 1; case 1: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(8u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(8u)) { int value; DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>( @@ -785,8 +785,8 @@ bool Value::MergePartialFromCodedStream( // double number_value = 2; case 2: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(17u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(17u)) { clear_kind(); DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< double, ::google::protobuf::internal::WireFormatLite::TYPE_DOUBLE>( @@ -800,8 +800,8 @@ bool Value::MergePartialFromCodedStream( // string string_value = 3; case 3: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(26u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(26u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_string_value())); DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( @@ -816,8 +816,8 @@ bool Value::MergePartialFromCodedStream( // bool bool_value = 4; case 4: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(32u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(32u)) { clear_kind(); DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( @@ -831,8 +831,8 @@ bool Value::MergePartialFromCodedStream( // .google.protobuf.Struct struct_value = 5; case 5: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(42u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(42u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( input, mutable_struct_value())); } else { @@ -843,8 +843,8 @@ bool Value::MergePartialFromCodedStream( // .google.protobuf.ListValue list_value = 6; case 6: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(50u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(50u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( input, mutable_list_value())); } else { @@ -1597,8 +1597,8 @@ bool ListValue::MergePartialFromCodedStream( switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // repeated .google.protobuf.Value values = 1; case 1: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(10u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(10u)) { DO_(input->IncrementRecursionDepth()); DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtualNoRecursionDepth( input, add_values())); diff --git a/src/google/protobuf/stubs/hash.h b/src/google/protobuf/stubs/hash.h index bf0b88b4..be998b29 100644 --- a/src/google/protobuf/stubs/hash.h +++ b/src/google/protobuf/stubs/hash.h @@ -40,6 +40,7 @@ #define GOOGLE_PROTOBUF_HAVE_HASH_MAP 1 #define GOOGLE_PROTOBUF_HAVE_HASH_SET 1 +#define GOOGLE_PROTOBUF_HAVE_64BIT_HASH 1 // Use C++11 unordered_{map|set} if available. #if ((_LIBCPP_STD_VER >= 11) || \ @@ -92,6 +93,10 @@ # define GOOGLE_PROTOBUF_HASH_SET_CLASS hash_set # endif +# if __GNUC__ == 4 && __GNUC__MINOR__ <= 1 +# undef GOOGLE_PROTOBUF_HAVE_64BIT_HASH +# endif + // Version checks for MSC. // Apparently Microsoft decided to move hash_map *back* to the std namespace in // MSVC 2010: diff --git a/src/google/protobuf/timestamp.pb.cc b/src/google/protobuf/timestamp.pb.cc index e21117b6..c1865d93 100644 --- a/src/google/protobuf/timestamp.pb.cc +++ b/src/google/protobuf/timestamp.pb.cc @@ -216,8 +216,8 @@ bool Timestamp::MergePartialFromCodedStream( switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // int64 seconds = 1; case 1: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(8u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(8u)) { DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< ::google::protobuf::int64, ::google::protobuf::internal::WireFormatLite::TYPE_INT64>( @@ -230,8 +230,8 @@ bool Timestamp::MergePartialFromCodedStream( // int32 nanos = 2; case 2: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(16u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(16u)) { DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( diff --git a/src/google/protobuf/type.pb.cc b/src/google/protobuf/type.pb.cc index 8bf57ecf..017392c9 100644 --- a/src/google/protobuf/type.pb.cc +++ b/src/google/protobuf/type.pb.cc @@ -486,8 +486,8 @@ bool Type::MergePartialFromCodedStream( switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // string name = 1; case 1: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(10u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(10u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_name())); DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( @@ -502,8 +502,8 @@ bool Type::MergePartialFromCodedStream( // repeated .google.protobuf.Field fields = 2; case 2: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(18u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(18u)) { DO_(input->IncrementRecursionDepth()); DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtualNoRecursionDepth( input, add_fields())); @@ -516,8 +516,8 @@ bool Type::MergePartialFromCodedStream( // repeated string oneofs = 3; case 3: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(26u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(26u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->add_oneofs())); DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( @@ -533,8 +533,8 @@ bool Type::MergePartialFromCodedStream( // repeated .google.protobuf.Option options = 4; case 4: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(34u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(34u)) { DO_(input->IncrementRecursionDepth()); DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtualNoRecursionDepth( input, add_options())); @@ -547,8 +547,8 @@ bool Type::MergePartialFromCodedStream( // .google.protobuf.SourceContext source_context = 5; case 5: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(42u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(42u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( input, mutable_source_context())); } else { @@ -559,8 +559,8 @@ bool Type::MergePartialFromCodedStream( // .google.protobuf.Syntax syntax = 6; case 6: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(48u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(48u)) { int value; DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>( @@ -1249,8 +1249,8 @@ bool Field::MergePartialFromCodedStream( switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // .google.protobuf.Field.Kind kind = 1; case 1: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(8u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(8u)) { int value; DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>( @@ -1264,8 +1264,8 @@ bool Field::MergePartialFromCodedStream( // .google.protobuf.Field.Cardinality cardinality = 2; case 2: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(16u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(16u)) { int value; DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>( @@ -1279,8 +1279,8 @@ bool Field::MergePartialFromCodedStream( // int32 number = 3; case 3: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(24u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(24u)) { DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( @@ -1293,8 +1293,8 @@ bool Field::MergePartialFromCodedStream( // string name = 4; case 4: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(34u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(34u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_name())); DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( @@ -1309,8 +1309,8 @@ bool Field::MergePartialFromCodedStream( // string type_url = 6; case 6: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(50u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(50u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_type_url())); DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( @@ -1325,8 +1325,8 @@ bool Field::MergePartialFromCodedStream( // int32 oneof_index = 7; case 7: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(56u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(56u)) { DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( @@ -1339,8 +1339,8 @@ bool Field::MergePartialFromCodedStream( // bool packed = 8; case 8: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(64u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(64u)) { DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( @@ -1353,8 +1353,8 @@ bool Field::MergePartialFromCodedStream( // repeated .google.protobuf.Option options = 9; case 9: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(74u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(74u)) { DO_(input->IncrementRecursionDepth()); DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtualNoRecursionDepth( input, add_options())); @@ -1367,8 +1367,8 @@ bool Field::MergePartialFromCodedStream( // string json_name = 10; case 10: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(82u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(82u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_json_name())); DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( @@ -1383,8 +1383,8 @@ bool Field::MergePartialFromCodedStream( // string default_value = 11; case 11: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(90u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(90u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_default_value())); DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( @@ -2295,8 +2295,8 @@ bool Enum::MergePartialFromCodedStream( switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // string name = 1; case 1: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(10u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(10u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_name())); DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( @@ -2311,8 +2311,8 @@ bool Enum::MergePartialFromCodedStream( // repeated .google.protobuf.EnumValue enumvalue = 2; case 2: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(18u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(18u)) { DO_(input->IncrementRecursionDepth()); DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtualNoRecursionDepth( input, add_enumvalue())); @@ -2325,8 +2325,8 @@ bool Enum::MergePartialFromCodedStream( // repeated .google.protobuf.Option options = 3; case 3: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(26u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(26u)) { DO_(input->IncrementRecursionDepth()); DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtualNoRecursionDepth( input, add_options())); @@ -2339,8 +2339,8 @@ bool Enum::MergePartialFromCodedStream( // .google.protobuf.SourceContext source_context = 4; case 4: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(34u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(34u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( input, mutable_source_context())); } else { @@ -2351,8 +2351,8 @@ bool Enum::MergePartialFromCodedStream( // .google.protobuf.Syntax syntax = 5; case 5: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(40u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(40u)) { int value; DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>( @@ -2909,8 +2909,8 @@ bool EnumValue::MergePartialFromCodedStream( switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // string name = 1; case 1: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(10u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(10u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_name())); DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( @@ -2925,8 +2925,8 @@ bool EnumValue::MergePartialFromCodedStream( // int32 number = 2; case 2: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(16u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(16u)) { DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( @@ -2939,8 +2939,8 @@ bool EnumValue::MergePartialFromCodedStream( // repeated .google.protobuf.Option options = 3; case 3: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(26u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(26u)) { DO_(input->IncrementRecursionDepth()); DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtualNoRecursionDepth( input, add_options())); @@ -3403,8 +3403,8 @@ bool Option::MergePartialFromCodedStream( switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // string name = 1; case 1: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(10u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(10u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_name())); DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( @@ -3419,8 +3419,8 @@ bool Option::MergePartialFromCodedStream( // .google.protobuf.Any value = 2; case 2: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(18u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(18u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( input, mutable_value())); } else { diff --git a/src/google/protobuf/unittest_proto3.proto b/src/google/protobuf/unittest_proto3.proto index f59d2178..a27b1b26 100644 --- a/src/google/protobuf/unittest_proto3.proto +++ b/src/google/protobuf/unittest_proto3.proto @@ -200,6 +200,9 @@ message TestMutualRecursionB { int32 optional_int32 = 2; } +message TestEnumAllowAlias { + TestEnumWithDupValue value = 1; +} // Test an enum that has multiple values with the same number. enum TestEnumWithDupValue { diff --git a/src/google/protobuf/util/json_util.cc b/src/google/protobuf/util/json_util.cc index c65e5323..129b6eaf 100644 --- a/src/google/protobuf/util/json_util.cc +++ b/src/google/protobuf/util/json_util.cc @@ -49,22 +49,25 @@ namespace protobuf { namespace util { namespace internal { +ZeroCopyStreamByteSink::~ZeroCopyStreamByteSink() { + stream_->BackUp(buffer_size_); +} + void ZeroCopyStreamByteSink::Append(const char* bytes, size_t len) { - while (len > 0) { - void* buffer; - int length; - if (!stream_->Next(&buffer, &length)) { - // There isn't a way for ByteSink to report errors. + while (true) { + if (len <= buffer_size_) { + memcpy(buffer_, bytes, len); + buffer_ = static_cast<char*>(buffer_) + len; + buffer_size_ -= len; return; } - if (len < length) { - memcpy(buffer, bytes, len); - stream_->BackUp(length - len); - break; - } else { - memcpy(buffer, bytes, length); - bytes += length; - len -= length; + memcpy(buffer_, bytes, buffer_size_); + bytes += buffer_size_; + len -= buffer_size_; + if (!stream_->Next(&buffer_, &buffer_size_)) { + // There isn't a way for ByteSink to report errors. + buffer_size_ = 0; + return; } } } diff --git a/src/google/protobuf/util/json_util.h b/src/google/protobuf/util/json_util.h index 8dda70c3..53b1d1ba 100644 --- a/src/google/protobuf/util/json_util.h +++ b/src/google/protobuf/util/json_util.h @@ -176,12 +176,15 @@ namespace internal { class LIBPROTOBUF_EXPORT ZeroCopyStreamByteSink : public strings::ByteSink { public: explicit ZeroCopyStreamByteSink(io::ZeroCopyOutputStream* stream) - : stream_(stream) {} + : stream_(stream), buffer_size_(0) {} + ~ZeroCopyStreamByteSink(); virtual void Append(const char* bytes, size_t len); private: io::ZeroCopyOutputStream* stream_; + void* buffer_; + int buffer_size_; GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ZeroCopyStreamByteSink); }; diff --git a/src/google/protobuf/util/json_util_test.cc b/src/google/protobuf/util/json_util_test.cc index 796718d5..b0c2f494 100644 --- a/src/google/protobuf/util/json_util_test.cc +++ b/src/google/protobuf/util/json_util_test.cc @@ -162,9 +162,9 @@ TEST_F(JsonUtilTest, TestDefaultValues) { TEST_F(JsonUtilTest, TestAlwaysPrintEnumsAsInts) { TestMessage orig; - orig.set_enum_value(proto3::EnumType::BAR); - orig.add_repeated_enum_value(proto3::EnumType::FOO); - orig.add_repeated_enum_value(proto3::EnumType::BAR); + orig.set_enum_value(proto3::BAR); + orig.add_repeated_enum_value(proto3::FOO); + orig.add_repeated_enum_value(proto3::BAR); JsonPrintOptions print_options; print_options.always_print_enums_as_ints = true; @@ -177,10 +177,10 @@ TEST_F(JsonUtilTest, TestAlwaysPrintEnumsAsInts) { JsonParseOptions parse_options; ASSERT_TRUE(FromJson(expected_json, &parsed, parse_options)); - EXPECT_EQ(proto3::EnumType::BAR, parsed.enum_value()); + EXPECT_EQ(proto3::BAR, parsed.enum_value()); EXPECT_EQ(2, parsed.repeated_enum_value_size()); - EXPECT_EQ(proto3::EnumType::FOO, parsed.repeated_enum_value(0)); - EXPECT_EQ(proto3::EnumType::BAR, parsed.repeated_enum_value(1)); + EXPECT_EQ(proto3::FOO, parsed.repeated_enum_value(0)); + EXPECT_EQ(proto3::BAR, parsed.repeated_enum_value(1)); } TEST_F(JsonUtilTest, ParseMessage) { diff --git a/src/google/protobuf/wrappers.pb.cc b/src/google/protobuf/wrappers.pb.cc index 0dad64a4..d614de9d 100644 --- a/src/google/protobuf/wrappers.pb.cc +++ b/src/google/protobuf/wrappers.pb.cc @@ -312,8 +312,8 @@ bool DoubleValue::MergePartialFromCodedStream( switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // double value = 1; case 1: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(9u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(9u)) { DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< double, ::google::protobuf::internal::WireFormatLite::TYPE_DOUBLE>( @@ -568,8 +568,8 @@ bool FloatValue::MergePartialFromCodedStream( switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // float value = 1; case 1: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(13u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(13u)) { DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< float, ::google::protobuf::internal::WireFormatLite::TYPE_FLOAT>( @@ -824,8 +824,8 @@ bool Int64Value::MergePartialFromCodedStream( switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // int64 value = 1; case 1: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(8u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(8u)) { DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< ::google::protobuf::int64, ::google::protobuf::internal::WireFormatLite::TYPE_INT64>( @@ -1082,8 +1082,8 @@ bool UInt64Value::MergePartialFromCodedStream( switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // uint64 value = 1; case 1: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(8u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(8u)) { DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< ::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>( @@ -1340,8 +1340,8 @@ bool Int32Value::MergePartialFromCodedStream( switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // int32 value = 1; case 1: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(8u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(8u)) { DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( @@ -1598,8 +1598,8 @@ bool UInt32Value::MergePartialFromCodedStream( switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // uint32 value = 1; case 1: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(8u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(8u)) { DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< ::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>( @@ -1856,8 +1856,8 @@ bool BoolValue::MergePartialFromCodedStream( switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // bool value = 1; case 1: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(8u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(8u)) { DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( @@ -2117,8 +2117,8 @@ bool StringValue::MergePartialFromCodedStream( switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // string value = 1; case 1: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(10u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(10u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_value())); DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( @@ -2445,8 +2445,8 @@ bool BytesValue::MergePartialFromCodedStream( switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // bytes value = 1; case 1: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(10u)) { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(10u)) { DO_(::google::protobuf::internal::WireFormatLite::ReadBytes( input, this->mutable_value())); } else { |