Commit 0adb74c2 authored by Yilun Chong's avatar Yilun Chong Committed by Paul Yang

Down-integrate internal changes to github. (#5555)

* Down-integrate internal changes to github.

* fix python conformance test

* fix csharp conformance test

* add back java map_lite_test.proto's optimize for option

* fix php conformance test
parent 11c979b5
set(libprotobuf_lite_files
${protobuf_source_dir}/src/google/protobuf/arena.cc
${protobuf_source_dir}/src/google/protobuf/arenastring.cc
${protobuf_source_dir}/src/google/protobuf/extension_set.cc
${protobuf_source_dir}/src/google/protobuf/generated_message_table_driven_lite.cc
${protobuf_source_dir}/src/google/protobuf/generated_message_util.cc
......
......@@ -107,6 +107,7 @@ other_language_protoc_outputs = \
google/protobuf/wrappers_pb2.py \
Conformance/ConformanceRequest.php \
Conformance/ConformanceResponse.php \
Conformance/FailureSet.php \
Conformance/WireFormat.php \
GPBMetadata/Conformance.php \
GPBMetadata/Google/Protobuf/Any.php \
......
......@@ -61,7 +61,7 @@ enum WireFormat {
enum TestCategory {
UNSPECIFIED_TEST = 0;
BINARY_TEST = 1; // Test binary wire format.
JSON_TEST = 2; // Test json wire format.
JSON_TEST = 2; // Test json wire format.
// Similar to JSON_TEST. However, during parsing json, testee should ignore
// unknown fields. This feature is optional. Each implementation can descide
// whether to support it. See
......@@ -72,6 +72,10 @@ enum TestCategory {
// Opensource testees just skip it.
}
message FailureSet {
repeated string failure = 1;
}
// Represents a single test case's input. The testee should:
//
// 1. parse this proto (which should always succeed)
......
......@@ -57,6 +57,35 @@ using std::string;
static const char kTypeUrlPrefix[] = "type.googleapis.com";
const char* kFailures[] = {
#if !GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
"Required.Proto2.ProtobufInput."
"PrematureEofInDelimitedDataForKnownNonRepeatedValue.MESSAGE",
"Required.Proto2.ProtobufInput."
"PrematureEofInDelimitedDataForKnownRepeatedValue.MESSAGE",
"Required.Proto2.ProtobufInput.PrematureEofInPackedField.BOOL",
"Required.Proto2.ProtobufInput.PrematureEofInPackedField.ENUM",
"Required.Proto2.ProtobufInput.PrematureEofInPackedField.INT32",
"Required.Proto2.ProtobufInput.PrematureEofInPackedField.INT64",
"Required.Proto2.ProtobufInput.PrematureEofInPackedField.SINT32",
"Required.Proto2.ProtobufInput.PrematureEofInPackedField.SINT64",
"Required.Proto2.ProtobufInput.PrematureEofInPackedField.UINT32",
"Required.Proto2.ProtobufInput.PrematureEofInPackedField.UINT64",
"Required.Proto3.ProtobufInput."
"PrematureEofInDelimitedDataForKnownNonRepeatedValue.MESSAGE",
"Required.Proto3.ProtobufInput."
"PrematureEofInDelimitedDataForKnownRepeatedValue.MESSAGE",
"Required.Proto3.ProtobufInput.PrematureEofInPackedField.BOOL",
"Required.Proto3.ProtobufInput.PrematureEofInPackedField.ENUM",
"Required.Proto3.ProtobufInput.PrematureEofInPackedField.INT32",
"Required.Proto3.ProtobufInput.PrematureEofInPackedField.INT64",
"Required.Proto3.ProtobufInput.PrematureEofInPackedField.SINT32",
"Required.Proto3.ProtobufInput.PrematureEofInPackedField.SINT64",
"Required.Proto3.ProtobufInput.PrematureEofInPackedField.UINT32",
"Required.Proto3.ProtobufInput.PrematureEofInPackedField.UINT64",
#endif
};
static string GetTypeUrl(const Descriptor* message) {
return string(kTypeUrlPrefix) + "/" + message->full_name();
}
......@@ -144,6 +173,12 @@ void DoTest(const ConformanceRequest& request, ConformanceResponse* response) {
break;
}
conformance::FailureSet failures;
if (descriptor == failures.GetDescriptor()) {
for (const char* s : kFailures) failures.add_failure(s);
test_message = &failures;
}
switch (request.requested_output_format()) {
case conformance::UNSPECIFIED:
GOOGLE_LOG(FATAL) << "Unspecified output format";
......
......@@ -3,6 +3,7 @@
require_once("Conformance/WireFormat.php");
require_once("Conformance/ConformanceResponse.php");
require_once("Conformance/ConformanceRequest.php");
require_once("Conformance/FailureSet.php");
require_once("Conformance/JspbEncodingConfig.php");
require_once("Conformance/TestCategory.php");
require_once("Protobuf_test_messages/Proto3/ForeignMessage.php");
......@@ -29,7 +30,10 @@ function doTest($request)
$test_message = new \Protobuf_test_messages\Proto3\TestAllTypesProto3();
$response = new \Conformance\ConformanceResponse();
if ($request->getPayload() == "protobuf_payload") {
if ($request->getMessageType() == "protobuf_test_messages.proto3.TestAllTypesProto3") {
if ($request->getMessageType() == "conformance.FailureSet") {
$response->setProtobufPayload("");
return $response;
} elseif ($request->getMessageType() == "protobuf_test_messages.proto3.TestAllTypesProto3") {
try {
$test_message->mergeFromString($request->getProtobufPayload());
} catch (Exception $e) {
......
......@@ -56,26 +56,75 @@ class ProtocolError(Exception):
pass
def do_test(request):
response = conformance_pb2.ConformanceResponse()
if request.message_type == "conformance.FailureSet":
failure_set = conformance_pb2.FailureSet()
failures = []
# TODO(gerbens): Remove, this is a hack to detect if the old vs new
# parser is used by the cpp code. Relying on a bug in the old parser.
hack_proto = test_messages_proto2_pb2.TestAllTypesProto2()
if hack_proto.ParseFromString(b"\322\002\001"):
# the string above is one of the failing conformance test strings of the
# old parser. If we succeed the c++ implementation is using the old
# parser so we add the list of failing conformance tests.
failures = [
"Required.Proto3.ProtobufInput.PrematureEofInDelimitedDataForKnownNonRepeatedValue.MESSAGE",
"Required.Proto3.ProtobufInput.PrematureEofInDelimitedDataForKnownRepeatedValue.MESSAGE",
"Required.Proto3.ProtobufInput.PrematureEofInPackedField.BOOL",
"Required.Proto3.ProtobufInput.PrematureEofInPackedField.DOUBLE",
"Required.Proto3.ProtobufInput.PrematureEofInPackedField.ENUM",
"Required.Proto3.ProtobufInput.PrematureEofInPackedField.FIXED32",
"Required.Proto3.ProtobufInput.PrematureEofInPackedField.FIXED64",
"Required.Proto3.ProtobufInput.PrematureEofInPackedField.FLOAT",
"Required.Proto3.ProtobufInput.PrematureEofInPackedField.INT32",
"Required.Proto3.ProtobufInput.PrematureEofInPackedField.INT64",
"Required.Proto3.ProtobufInput.PrematureEofInPackedField.SFIXED32",
"Required.Proto3.ProtobufInput.PrematureEofInPackedField.SFIXED64",
"Required.Proto3.ProtobufInput.PrematureEofInPackedField.SINT32",
"Required.Proto3.ProtobufInput.PrematureEofInPackedField.SINT64",
"Required.Proto3.ProtobufInput.PrematureEofInPackedField.UINT32",
"Required.Proto3.ProtobufInput.PrematureEofInPackedField.UINT64",
"Required.Proto2.ProtobufInput.PrematureEofInDelimitedDataForKnownNonRepeatedValue.MESSAGE",
"Required.Proto2.ProtobufInput.PrematureEofInDelimitedDataForKnownRepeatedValue.MESSAGE",
"Required.Proto2.ProtobufInput.PrematureEofInPackedField.BOOL",
"Required.Proto2.ProtobufInput.PrematureEofInPackedField.DOUBLE",
"Required.Proto2.ProtobufInput.PrematureEofInPackedField.ENUM",
"Required.Proto2.ProtobufInput.PrematureEofInPackedField.FIXED32",
"Required.Proto2.ProtobufInput.PrematureEofInPackedField.FIXED64",
"Required.Proto2.ProtobufInput.PrematureEofInPackedField.FLOAT",
"Required.Proto2.ProtobufInput.PrematureEofInPackedField.INT32",
"Required.Proto2.ProtobufInput.PrematureEofInPackedField.INT64",
"Required.Proto2.ProtobufInput.PrematureEofInPackedField.SFIXED32",
"Required.Proto2.ProtobufInput.PrematureEofInPackedField.SFIXED64",
"Required.Proto2.ProtobufInput.PrematureEofInPackedField.SINT32",
"Required.Proto2.ProtobufInput.PrematureEofInPackedField.SINT64",
"Required.Proto2.ProtobufInput.PrematureEofInPackedField.UINT32",
"Required.Proto2.ProtobufInput.PrematureEofInPackedField.UINT64",
]
for x in failures:
failure_set.failure.append(x)
response.protobuf_payload = failure_set.SerializeToString()
return response
isProto3 = (request.message_type == "protobuf_test_messages.proto3.TestAllTypesProto3")
isJson = (request.WhichOneof('payload') == 'json_payload')
isProto2 = (request.message_type == "protobuf_test_messages.proto2.TestAllTypesProto2")
if (not isProto3) and (not isJson) and (not isProto2):
raise ProtocolError("Protobuf request doesn't have specific payload type")
test_message = test_messages_proto2_pb2.TestAllTypesProto2() if isProto2 else \
test_messages_proto3_pb2.TestAllTypesProto3()
response = conformance_pb2.ConformanceResponse()
try:
if request.WhichOneof('payload') == 'protobuf_payload':
try:
test_message.ParseFromString(request.protobuf_payload)
except message.DecodeError as e:
response.parse_error = str(e)
return response
return response
elif request.WhichOneof('payload') == 'json_payload':
try:
ignore_unknown_fields = \
......@@ -97,7 +146,7 @@ def do_test(request):
response.protobuf_payload = test_message.SerializeToString()
elif request.requested_output_format == conformance_pb2.JSON:
try:
try:
response.json_payload = json_format.MessageToJson(test_message)
except Exception as e:
response.serialize_error = str(e)
......
......@@ -150,15 +150,6 @@ string ConformanceTestSuite::ConformanceRequestSetting::
return "";
}
void ConformanceTestSuite::SetFailureList(
const string& filename,
const std::vector<string>& failure_list) {
failure_list_filename_ = filename;
expected_to_fail_.clear();
std::copy(failure_list.begin(), failure_list.end(),
std::inserter(expected_to_fail_, expected_to_fail_.end()));
}
void ConformanceTestSuite::ReportSuccess(const string& test_name) {
if (expected_to_fail_.erase(test_name) != 0) {
StringAppendF(&output_,
......@@ -359,8 +350,9 @@ string ConformanceTestSuite::WireFormatToString(
return "";
}
bool ConformanceTestSuite::RunSuite(
ConformanceTestRunner* runner, std::string* output) {
bool ConformanceTestSuite::RunSuite(ConformanceTestRunner* runner,
std::string* output, const string& filename,
conformance::FailureSet* failure_list) {
runner_ = runner;
successes_ = 0;
expected_failures_ = 0;
......@@ -371,6 +363,18 @@ bool ConformanceTestSuite::RunSuite(
output_ = "\nCONFORMANCE TEST BEGIN ====================================\n\n";
ConformanceRequest req;
ConformanceResponse res;
req.set_message_type(failure_list->GetTypeName());
req.set_protobuf_payload("");
req.set_requested_output_format(conformance::WireFormat::PROTOBUF);
RunTest("FindFailures", req, &res);
GOOGLE_CHECK(failure_list->MergeFromString(res.protobuf_payload()));
failure_list_filename_ = filename;
expected_to_fail_.clear();
for (const string& failure : failure_list->failure()) {
expected_to_fail_.insert(failure);
}
RunSuiteImpl();
bool ok = true;
......
......@@ -144,15 +144,6 @@ class ConformanceTestSuite {
void SetVerbose(bool verbose) { verbose_ = verbose; }
// Sets the list of tests that are expected to fail when RunSuite() is called.
// RunSuite() will fail unless the set of failing tests is exactly the same
// as this list.
//
// The filename here is *only* used to create/format useful error messages for
// how to update the failure list. We do NOT read this file at all.
void SetFailureList(const std::string& filename,
const std::vector<std::string>& failure_list);
// Whether to require the testee to pass RECOMMENDED tests. By default failing
// a RECOMMENDED test case will not fail the entire suite but will only
// generated a warning. If this flag is set to true, RECOMMENDED tests will
......@@ -169,9 +160,12 @@ class ConformanceTestSuite {
// Test output will be stored in "output".
//
// Returns true if the set of failing tests was exactly the same as the
// failure list. If SetFailureList() was not called, returns true if all
// tests passed.
bool RunSuite(ConformanceTestRunner* runner, std::string* output);
// failure list.
// The filename here is *only* used to create/format useful error messages for
// how to update the failure list. We do NOT read this file at all.
bool RunSuite(ConformanceTestRunner* runner, std::string* output,
const std::string& filename,
conformance::FailureSet* failure_list);
protected:
// Test cases are classified into a few categories:
......
......@@ -84,7 +84,7 @@ namespace google {
namespace protobuf {
void ParseFailureList(const char *filename,
std::vector<string>* failure_list) {
conformance::FailureSet *failure_list) {
std::ifstream infile(filename);
if (!infile.is_open()) {
......@@ -101,7 +101,7 @@ void ParseFailureList(const char *filename,
line = line.substr(0, line.find("#"));
if (!line.empty()) {
failure_list->push_back(line);
failure_list->add_failure(line);
}
}
}
......@@ -178,7 +178,7 @@ int ForkPipeRunner::Run(
int argc, char *argv[], ConformanceTestSuite* suite) {
char *program;
string failure_list_filename;
std::vector<string> failure_list;
conformance::FailureSet failure_list;
for (int arg = 1; arg < argc; ++arg) {
if (strcmp(argv[arg], "--failure_list") == 0) {
......@@ -201,11 +201,11 @@ int ForkPipeRunner::Run(
}
}
suite->SetFailureList(failure_list_filename, failure_list);
ForkPipeRunner runner(program);
std::string output;
bool ok = suite->RunSuite(&runner, &output);
bool ok =
suite->RunSuite(&runner, &output, failure_list_filename, &failure_list);
fwrite(output.c_str(), 1, output.size(), stderr);
......
......@@ -34,23 +34,3 @@ Recommended.Proto3.JsonInput.TrailingCommaInAnObject
Recommended.Proto3.JsonInput.TrailingCommaInAnObjectWithNewlines
Recommended.Proto3.JsonInput.TrailingCommaInAnObjectWithSpace
Recommended.Proto3.JsonInput.TrailingCommaInAnObjectWithSpaceCommaSpace
Required.Proto3.ProtobufInput.PrematureEofInDelimitedDataForKnownNonRepeatedValue.MESSAGE
Required.Proto3.ProtobufInput.PrematureEofInDelimitedDataForKnownRepeatedValue.MESSAGE
Required.Proto3.ProtobufInput.PrematureEofInPackedField.BOOL
Required.Proto3.ProtobufInput.PrematureEofInPackedField.ENUM
Required.Proto3.ProtobufInput.PrematureEofInPackedField.INT32
Required.Proto3.ProtobufInput.PrematureEofInPackedField.INT64
Required.Proto3.ProtobufInput.PrematureEofInPackedField.SINT32
Required.Proto3.ProtobufInput.PrematureEofInPackedField.SINT64
Required.Proto3.ProtobufInput.PrematureEofInPackedField.UINT32
Required.Proto3.ProtobufInput.PrematureEofInPackedField.UINT64
Required.Proto2.ProtobufInput.PrematureEofInDelimitedDataForKnownNonRepeatedValue.MESSAGE
Required.Proto2.ProtobufInput.PrematureEofInDelimitedDataForKnownRepeatedValue.MESSAGE
Required.Proto2.ProtobufInput.PrematureEofInPackedField.BOOL
Required.Proto2.ProtobufInput.PrematureEofInPackedField.ENUM
Required.Proto2.ProtobufInput.PrematureEofInPackedField.INT32
Required.Proto2.ProtobufInput.PrematureEofInPackedField.INT64
Required.Proto2.ProtobufInput.PrematureEofInPackedField.SINT32
Required.Proto2.ProtobufInput.PrematureEofInPackedField.SINT64
Required.Proto2.ProtobufInput.PrematureEofInPackedField.UINT32
Required.Proto2.ProtobufInput.PrematureEofInPackedField.UINT64
......@@ -20,35 +20,3 @@ Required.Proto3.JsonInput.FloatFieldTooLarge
Required.Proto3.JsonInput.FloatFieldTooSmall
Required.Proto3.JsonInput.RepeatedFieldWrongElementTypeExpectingIntegersGotBool
Required.Proto3.JsonInput.TimestampJsonInputLowercaseT
Required.Proto3.ProtobufInput.PrematureEofInDelimitedDataForKnownNonRepeatedValue.MESSAGE
Required.Proto3.ProtobufInput.PrematureEofInDelimitedDataForKnownRepeatedValue.MESSAGE
Required.Proto3.ProtobufInput.PrematureEofInPackedField.BOOL
Required.Proto3.ProtobufInput.PrematureEofInPackedField.DOUBLE
Required.Proto3.ProtobufInput.PrematureEofInPackedField.ENUM
Required.Proto3.ProtobufInput.PrematureEofInPackedField.FIXED32
Required.Proto3.ProtobufInput.PrematureEofInPackedField.FIXED64
Required.Proto3.ProtobufInput.PrematureEofInPackedField.FLOAT
Required.Proto3.ProtobufInput.PrematureEofInPackedField.INT32
Required.Proto3.ProtobufInput.PrematureEofInPackedField.INT64
Required.Proto3.ProtobufInput.PrematureEofInPackedField.SFIXED32
Required.Proto3.ProtobufInput.PrematureEofInPackedField.SFIXED64
Required.Proto3.ProtobufInput.PrematureEofInPackedField.SINT32
Required.Proto3.ProtobufInput.PrematureEofInPackedField.SINT64
Required.Proto3.ProtobufInput.PrematureEofInPackedField.UINT32
Required.Proto3.ProtobufInput.PrematureEofInPackedField.UINT64
Required.Proto2.ProtobufInput.PrematureEofInDelimitedDataForKnownNonRepeatedValue.MESSAGE
Required.Proto2.ProtobufInput.PrematureEofInDelimitedDataForKnownRepeatedValue.MESSAGE
Required.Proto2.ProtobufInput.PrematureEofInPackedField.BOOL
Required.Proto2.ProtobufInput.PrematureEofInPackedField.DOUBLE
Required.Proto2.ProtobufInput.PrematureEofInPackedField.ENUM
Required.Proto2.ProtobufInput.PrematureEofInPackedField.FIXED32
Required.Proto2.ProtobufInput.PrematureEofInPackedField.FIXED64
Required.Proto2.ProtobufInput.PrematureEofInPackedField.FLOAT
Required.Proto2.ProtobufInput.PrematureEofInPackedField.INT32
Required.Proto2.ProtobufInput.PrematureEofInPackedField.INT64
Required.Proto2.ProtobufInput.PrematureEofInPackedField.SFIXED32
Required.Proto2.ProtobufInput.PrematureEofInPackedField.SFIXED64
Required.Proto2.ProtobufInput.PrematureEofInPackedField.SINT32
Required.Proto2.ProtobufInput.PrematureEofInPackedField.SINT64
Required.Proto2.ProtobufInput.PrematureEofInPackedField.UINT32
Required.Proto2.ProtobufInput.PrematureEofInPackedField.UINT64
......@@ -24,28 +24,30 @@ namespace Conformance {
static ConformanceReflection() {
byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat(
"ChFjb25mb3JtYW5jZS5wcm90bxILY29uZm9ybWFuY2UirQIKEkNvbmZvcm1h",
"bmNlUmVxdWVzdBIaChBwcm90b2J1Zl9wYXlsb2FkGAEgASgMSAASFgoManNv",
"bl9wYXlsb2FkGAIgASgJSAASFgoManNwYl9wYXlsb2FkGAcgASgJSAASOAoX",
"cmVxdWVzdGVkX291dHB1dF9mb3JtYXQYAyABKA4yFy5jb25mb3JtYW5jZS5X",
"aXJlRm9ybWF0EhQKDG1lc3NhZ2VfdHlwZRgEIAEoCRIwCg10ZXN0X2NhdGVn",
"b3J5GAUgASgOMhkuY29uZm9ybWFuY2UuVGVzdENhdGVnb3J5Ej4KFWpzcGJf",
"ZW5jb2Rpbmdfb3B0aW9ucxgGIAEoCzIfLmNvbmZvcm1hbmNlLkpzcGJFbmNv",
"ZGluZ0NvbmZpZ0IJCgdwYXlsb2FkIskBChNDb25mb3JtYW5jZVJlc3BvbnNl",
"EhUKC3BhcnNlX2Vycm9yGAEgASgJSAASGQoPc2VyaWFsaXplX2Vycm9yGAYg",
"ASgJSAASFwoNcnVudGltZV9lcnJvchgCIAEoCUgAEhoKEHByb3RvYnVmX3Bh",
"eWxvYWQYAyABKAxIABIWCgxqc29uX3BheWxvYWQYBCABKAlIABIRCgdza2lw",
"cGVkGAUgASgJSAASFgoManNwYl9wYXlsb2FkGAcgASgJSABCCAoGcmVzdWx0",
"IjcKEkpzcGJFbmNvZGluZ0NvbmZpZxIhChl1c2VfanNwYl9hcnJheV9hbnlf",
"Zm9ybWF0GAEgASgIKj8KCldpcmVGb3JtYXQSDwoLVU5TUEVDSUZJRUQQABIM",
"CghQUk9UT0JVRhABEggKBEpTT04QAhIICgRKU1BCEAMqeQoMVGVzdENhdGVn",
"b3J5EhQKEFVOU1BFQ0lGSUVEX1RFU1QQABIPCgtCSU5BUllfVEVTVBABEg0K",
"CUpTT05fVEVTVBACEiQKIEpTT05fSUdOT1JFX1VOS05PV05fUEFSU0lOR19U",
"RVNUEAMSDQoJSlNQQl9URVNUEARCIQofY29tLmdvb2dsZS5wcm90b2J1Zi5j",
"b25mb3JtYW5jZWIGcHJvdG8z"));
"ChFjb25mb3JtYW5jZS5wcm90bxILY29uZm9ybWFuY2UiHQoKRmFpbHVyZVNl",
"dBIPCgdmYWlsdXJlGAEgAygJIq0CChJDb25mb3JtYW5jZVJlcXVlc3QSGgoQ",
"cHJvdG9idWZfcGF5bG9hZBgBIAEoDEgAEhYKDGpzb25fcGF5bG9hZBgCIAEo",
"CUgAEhYKDGpzcGJfcGF5bG9hZBgHIAEoCUgAEjgKF3JlcXVlc3RlZF9vdXRw",
"dXRfZm9ybWF0GAMgASgOMhcuY29uZm9ybWFuY2UuV2lyZUZvcm1hdBIUCgxt",
"ZXNzYWdlX3R5cGUYBCABKAkSMAoNdGVzdF9jYXRlZ29yeRgFIAEoDjIZLmNv",
"bmZvcm1hbmNlLlRlc3RDYXRlZ29yeRI+ChVqc3BiX2VuY29kaW5nX29wdGlv",
"bnMYBiABKAsyHy5jb25mb3JtYW5jZS5Kc3BiRW5jb2RpbmdDb25maWdCCQoH",
"cGF5bG9hZCLJAQoTQ29uZm9ybWFuY2VSZXNwb25zZRIVCgtwYXJzZV9lcnJv",
"chgBIAEoCUgAEhkKD3NlcmlhbGl6ZV9lcnJvchgGIAEoCUgAEhcKDXJ1bnRp",
"bWVfZXJyb3IYAiABKAlIABIaChBwcm90b2J1Zl9wYXlsb2FkGAMgASgMSAAS",
"FgoManNvbl9wYXlsb2FkGAQgASgJSAASEQoHc2tpcHBlZBgFIAEoCUgAEhYK",
"DGpzcGJfcGF5bG9hZBgHIAEoCUgAQggKBnJlc3VsdCI3ChJKc3BiRW5jb2Rp",
"bmdDb25maWcSIQoZdXNlX2pzcGJfYXJyYXlfYW55X2Zvcm1hdBgBIAEoCCo/",
"CgpXaXJlRm9ybWF0Eg8KC1VOU1BFQ0lGSUVEEAASDAoIUFJPVE9CVUYQARII",
"CgRKU09OEAISCAoESlNQQhADKnkKDFRlc3RDYXRlZ29yeRIUChBVTlNQRUNJ",
"RklFRF9URVNUEAASDwoLQklOQVJZX1RFU1QQARINCglKU09OX1RFU1QQAhIk",
"CiBKU09OX0lHTk9SRV9VTktOT1dOX1BBUlNJTkdfVEVTVBADEg0KCUpTUEJf",
"VEVTVBAEQiEKH2NvbS5nb29nbGUucHJvdG9idWYuY29uZm9ybWFuY2ViBnBy",
"b3RvMw=="));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { },
new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Conformance.WireFormat), typeof(global::Conformance.TestCategory), }, new pbr::GeneratedClrTypeInfo[] {
new pbr::GeneratedClrTypeInfo(typeof(global::Conformance.FailureSet), global::Conformance.FailureSet.Parser, new[]{ "Failure" }, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Conformance.ConformanceRequest), global::Conformance.ConformanceRequest.Parser, new[]{ "ProtobufPayload", "JsonPayload", "JspbPayload", "RequestedOutputFormat", "MessageType", "TestCategory", "JspbEncodingOptions" }, new[]{ "Payload" }, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Conformance.ConformanceResponse), global::Conformance.ConformanceResponse.Parser, new[]{ "ParseError", "SerializeError", "RuntimeError", "ProtobufPayload", "JsonPayload", "Skipped", "JspbPayload" }, new[]{ "Result" }, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Conformance.JspbEncodingConfig), global::Conformance.JspbEncodingConfig.Parser, new[]{ "UseJspbArrayAnyFormat" }, null, null, null)
......@@ -92,6 +94,129 @@ namespace Conformance {
#endregion
#region Messages
public sealed partial class FailureSet : pb::IMessage<FailureSet> {
private static readonly pb::MessageParser<FailureSet> _parser = new pb::MessageParser<FailureSet>(() => new FailureSet());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<FailureSet> Parser { get { return _parser; } }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pbr::MessageDescriptor Descriptor {
get { return global::Conformance.ConformanceReflection.Descriptor.MessageTypes[0]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
pbr::MessageDescriptor pb::IMessage.Descriptor {
get { return Descriptor; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public FailureSet() {
OnConstruction();
}
partial void OnConstruction();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public FailureSet(FailureSet other) : this() {
failure_ = other.failure_.Clone();
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public FailureSet Clone() {
return new FailureSet(this);
}
/// <summary>Field number for the "failure" field.</summary>
public const int FailureFieldNumber = 1;
private static readonly pb::FieldCodec<string> _repeated_failure_codec
= pb::FieldCodec.ForString(10);
private readonly pbc::RepeatedField<string> failure_ = new pbc::RepeatedField<string>();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public pbc::RepeatedField<string> Failure {
get { return failure_; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override bool Equals(object other) {
return Equals(other as FailureSet);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public bool Equals(FailureSet other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
if(!failure_.Equals(other.failure_)) return false;
return Equals(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
hash ^= failure_.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
return hash;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override string ToString() {
return pb::JsonFormatter.ToDiagnosticString(this);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void WriteTo(pb::CodedOutputStream output) {
failure_.WriteTo(output, _repeated_failure_codec);
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int CalculateSize() {
int size = 0;
size += failure_.CalculateSize(_repeated_failure_codec);
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
return size;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(FailureSet other) {
if (other == null) {
return;
}
failure_.Add(other.failure_);
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
break;
case 10: {
failure_.AddEntriesFrom(input, _repeated_failure_codec);
break;
}
}
}
}
}
/// <summary>
/// Represents a single test case's input. The testee should:
///
......@@ -107,7 +232,7 @@ namespace Conformance {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pbr::MessageDescriptor Descriptor {
get { return global::Conformance.ConformanceReflection.Descriptor.MessageTypes[0]; }
get { return global::Conformance.ConformanceReflection.Descriptor.MessageTypes[1]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
......@@ -468,7 +593,7 @@ namespace Conformance {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pbr::MessageDescriptor Descriptor {
get { return global::Conformance.ConformanceReflection.Descriptor.MessageTypes[1]; }
get { return global::Conformance.ConformanceReflection.Descriptor.MessageTypes[2]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
......@@ -850,7 +975,7 @@ namespace Conformance {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pbr::MessageDescriptor Descriptor {
get { return global::Conformance.ConformanceReflection.Descriptor.MessageTypes[2]; }
get { return global::Conformance.ConformanceReflection.Descriptor.MessageTypes[3]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
......
No preview for this file type
......@@ -45,7 +45,8 @@ import java.util.RandomAccess;
final class BooleanArrayList extends AbstractProtobufList<Boolean>
implements BooleanList, RandomAccess, PrimitiveNonBoxingCollection {
private static final BooleanArrayList EMPTY_LIST = new BooleanArrayList();
private static final BooleanArrayList EMPTY_LIST = new BooleanArrayList(new boolean[0], 0);
static {
EMPTY_LIST.makeImmutable();
}
......
......@@ -377,7 +377,7 @@ public abstract class CodedInputStream {
/**
* Set the maximum message recursion depth. In order to prevent malicious messages from causing
* stack overflows, {@code CodedInputStream} limits how deeply messages may be nested. The default
* limit is 64.
* limit is 100.
*
* @return the old limit.
*/
......
......@@ -45,7 +45,8 @@ import java.util.RandomAccess;
final class DoubleArrayList extends AbstractProtobufList<Double>
implements DoubleList, RandomAccess, PrimitiveNonBoxingCollection {
private static final DoubleArrayList EMPTY_LIST = new DoubleArrayList();
private static final DoubleArrayList EMPTY_LIST = new DoubleArrayList(new double[0], 0);
static {
EMPTY_LIST.makeImmutable();
}
......
......@@ -45,7 +45,8 @@ import java.util.RandomAccess;
final class FloatArrayList extends AbstractProtobufList<Float>
implements FloatList, RandomAccess, PrimitiveNonBoxingCollection {
private static final FloatArrayList EMPTY_LIST = new FloatArrayList();
private static final FloatArrayList EMPTY_LIST = new FloatArrayList(new float[0], 0);
static {
EMPTY_LIST.makeImmutable();
}
......
......@@ -45,7 +45,8 @@ import java.util.RandomAccess;
final class IntArrayList extends AbstractProtobufList<Integer>
implements IntList, RandomAccess, PrimitiveNonBoxingCollection {
private static final IntArrayList EMPTY_LIST = new IntArrayList();
private static final IntArrayList EMPTY_LIST = new IntArrayList(new int[0], 0);
static {
EMPTY_LIST.makeImmutable();
}
......
......@@ -45,7 +45,8 @@ import java.util.RandomAccess;
final class LongArrayList extends AbstractProtobufList<Long>
implements LongList, RandomAccess, PrimitiveNonBoxingCollection {
private static final LongArrayList EMPTY_LIST = new LongArrayList();
private static final LongArrayList EMPTY_LIST = new LongArrayList(new long[0], 0);
static {
EMPTY_LIST.makeImmutable();
}
......
......@@ -37,7 +37,8 @@ import java.util.List;
/** Implements {@link ProtobufList} for non-primitive and {@link String} types. */
final class ProtobufArrayList<E> extends AbstractProtobufList<E> {
private static final ProtobufArrayList<Object> EMPTY_LIST = new ProtobufArrayList<Object>();
private static final ProtobufArrayList<Object> EMPTY_LIST =
new ProtobufArrayList<Object>(new ArrayList<Object>(0));
static {
EMPTY_LIST.makeImmutable();
......
......@@ -661,4 +661,5 @@ describe('protoBinaryTest', function() {
checkAllFields(msg, msg2);
});
});
......@@ -41,6 +41,8 @@ goog.provide('jspb.Message');
goog.require('goog.array');
goog.require('goog.asserts');
goog.require('goog.crypt.base64');
goog.require('jspb.BinaryConstants');
goog.require('jspb.BinaryReader');
goog.require('jspb.Map');
// Not needed in compilation units that have no protos with xids.
......@@ -622,10 +624,7 @@ jspb.Message.serializeBinaryExtensions = function(proto, writer, extensions,
* Reads an extension field from the given reader and, if a valid extension,
* sets the extension value.
* @param {!jspb.Message} msg A jspb proto.
* @param {{
* skipField:function(this:jspb.BinaryReader),
* getFieldNumber:function(this:jspb.BinaryReader):number
* }} reader
* @param {!jspb.BinaryReader} reader
* @param {!Object} extensions The extensions object.
* @param {function(this:jspb.Message,!jspb.ExtensionFieldInfo)} getExtensionFn
* @param {function(this:jspb.Message,!jspb.ExtensionFieldInfo, ?)} setExtensionFn
......
......@@ -242,3 +242,4 @@ enum MapValueEnum {
message MapValueMessage {
optional int32 foo = 1;
}
......@@ -172,6 +172,9 @@ class Message(object):
we *do* stop because of an END_GROUP tag, the number
of bytes returned does not include the bytes
for the END_GROUP tag information.
Raises:
message.DecodeError if the input cannot be parsed.
"""
raise NotImplementedError
......
......@@ -201,7 +201,6 @@ libprotobuf_lite_la_SOURCES = \
google/protobuf/stubs/time.cc \
google/protobuf/stubs/time.h \
google/protobuf/arena.cc \
google/protobuf/arenastring.cc \
google/protobuf/extension_set.cc \
google/protobuf/generated_message_util.cc \
google/protobuf/generated_message_table_driven_lite.h \
......
......@@ -195,7 +195,7 @@ void Any::Clear() {
const char* Any::_InternalParse(const char* begin, const char* end, void* object,
::google::protobuf::internal::ParseContext* ctx) {
auto msg = static_cast<Any*>(object);
::google::protobuf::uint32 size; (void)size;
::google::protobuf::int32 size; (void)size;
int depth; (void)depth;
::google::protobuf::uint32 tag;
::google::protobuf::internal::ParseFunc parser_till_end; (void)parser_till_end;
......@@ -207,7 +207,7 @@ const char* Any::_InternalParse(const char* begin, const char* end, void* object
// string type_url = 1;
case 1: {
if (static_cast<::google::protobuf::uint8>(tag) != 10) goto handle_unusual;
ptr = ::google::protobuf::io::Parse32(ptr, &size);
ptr = ::google::protobuf::io::ReadSize(ptr, &size);
GOOGLE_PROTOBUF_PARSER_ASSERT(ptr);
ctx->extra_parse_data().SetFieldName("google.protobuf.Any.type_url");
auto str = msg->mutable_type_url();
......@@ -226,7 +226,7 @@ const char* Any::_InternalParse(const char* begin, const char* end, void* object
// bytes value = 2;
case 2: {
if (static_cast<::google::protobuf::uint8>(tag) != 18) goto handle_unusual;
ptr = ::google::protobuf::io::Parse32(ptr, &size);
ptr = ::google::protobuf::io::ReadSize(ptr, &size);
GOOGLE_PROTOBUF_PARSER_ASSERT(ptr);
auto str = msg->mutable_value();
if (size > end - ptr + ::google::protobuf::internal::ParseContext::kSlopBytes) {
......
......@@ -62,7 +62,8 @@ namespace protobuf {
// ===================================================================
class PROTOBUF_EXPORT Any : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.Any) */ {
class PROTOBUF_EXPORT Any final :
public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.Any) */ {
public:
Any();
virtual ~Any();
......
......@@ -301,7 +301,7 @@ void Api::Clear() {
const char* Api::_InternalParse(const char* begin, const char* end, void* object,
::google::protobuf::internal::ParseContext* ctx) {
auto msg = static_cast<Api*>(object);
::google::protobuf::uint32 size; (void)size;
::google::protobuf::int32 size; (void)size;
int depth; (void)depth;
::google::protobuf::uint32 tag;
::google::protobuf::internal::ParseFunc parser_till_end; (void)parser_till_end;
......@@ -313,7 +313,7 @@ const char* Api::_InternalParse(const char* begin, const char* end, void* object
// string name = 1;
case 1: {
if (static_cast<::google::protobuf::uint8>(tag) != 10) goto handle_unusual;
ptr = ::google::protobuf::io::Parse32(ptr, &size);
ptr = ::google::protobuf::io::ReadSize(ptr, &size);
GOOGLE_PROTOBUF_PARSER_ASSERT(ptr);
ctx->extra_parse_data().SetFieldName("google.protobuf.Api.name");
auto str = msg->mutable_name();
......@@ -333,7 +333,7 @@ const char* Api::_InternalParse(const char* begin, const char* end, void* object
case 2: {
if (static_cast<::google::protobuf::uint8>(tag) != 18) goto handle_unusual;
do {
ptr = ::google::protobuf::io::Parse32(ptr, &size);
ptr = ::google::protobuf::io::ReadSize(ptr, &size);
GOOGLE_PROTOBUF_PARSER_ASSERT(ptr);
parser_till_end = ::google::protobuf::Method::_InternalParse;
object = msg->add_methods();
......@@ -351,7 +351,7 @@ const char* Api::_InternalParse(const char* begin, const char* end, void* object
case 3: {
if (static_cast<::google::protobuf::uint8>(tag) != 26) goto handle_unusual;
do {
ptr = ::google::protobuf::io::Parse32(ptr, &size);
ptr = ::google::protobuf::io::ReadSize(ptr, &size);
GOOGLE_PROTOBUF_PARSER_ASSERT(ptr);
parser_till_end = ::google::protobuf::Option::_InternalParse;
object = msg->add_options();
......@@ -368,7 +368,7 @@ const char* Api::_InternalParse(const char* begin, const char* end, void* object
// string version = 4;
case 4: {
if (static_cast<::google::protobuf::uint8>(tag) != 34) goto handle_unusual;
ptr = ::google::protobuf::io::Parse32(ptr, &size);
ptr = ::google::protobuf::io::ReadSize(ptr, &size);
GOOGLE_PROTOBUF_PARSER_ASSERT(ptr);
ctx->extra_parse_data().SetFieldName("google.protobuf.Api.version");
auto str = msg->mutable_version();
......@@ -387,7 +387,7 @@ const char* Api::_InternalParse(const char* begin, const char* end, void* object
// .google.protobuf.SourceContext source_context = 5;
case 5: {
if (static_cast<::google::protobuf::uint8>(tag) != 42) goto handle_unusual;
ptr = ::google::protobuf::io::Parse32(ptr, &size);
ptr = ::google::protobuf::io::ReadSize(ptr, &size);
GOOGLE_PROTOBUF_PARSER_ASSERT(ptr);
parser_till_end = ::google::protobuf::SourceContext::_InternalParse;
object = msg->mutable_source_context();
......@@ -403,7 +403,7 @@ const char* Api::_InternalParse(const char* begin, const char* end, void* object
case 6: {
if (static_cast<::google::protobuf::uint8>(tag) != 50) goto handle_unusual;
do {
ptr = ::google::protobuf::io::Parse32(ptr, &size);
ptr = ::google::protobuf::io::ReadSize(ptr, &size);
GOOGLE_PROTOBUF_PARSER_ASSERT(ptr);
parser_till_end = ::google::protobuf::Mixin::_InternalParse;
object = msg->add_mixins();
......@@ -972,7 +972,7 @@ void Method::Clear() {
const char* Method::_InternalParse(const char* begin, const char* end, void* object,
::google::protobuf::internal::ParseContext* ctx) {
auto msg = static_cast<Method*>(object);
::google::protobuf::uint32 size; (void)size;
::google::protobuf::int32 size; (void)size;
int depth; (void)depth;
::google::protobuf::uint32 tag;
::google::protobuf::internal::ParseFunc parser_till_end; (void)parser_till_end;
......@@ -984,7 +984,7 @@ const char* Method::_InternalParse(const char* begin, const char* end, void* obj
// string name = 1;
case 1: {
if (static_cast<::google::protobuf::uint8>(tag) != 10) goto handle_unusual;
ptr = ::google::protobuf::io::Parse32(ptr, &size);
ptr = ::google::protobuf::io::ReadSize(ptr, &size);
GOOGLE_PROTOBUF_PARSER_ASSERT(ptr);
ctx->extra_parse_data().SetFieldName("google.protobuf.Method.name");
auto str = msg->mutable_name();
......@@ -1003,7 +1003,7 @@ const char* Method::_InternalParse(const char* begin, const char* end, void* obj
// string request_type_url = 2;
case 2: {
if (static_cast<::google::protobuf::uint8>(tag) != 18) goto handle_unusual;
ptr = ::google::protobuf::io::Parse32(ptr, &size);
ptr = ::google::protobuf::io::ReadSize(ptr, &size);
GOOGLE_PROTOBUF_PARSER_ASSERT(ptr);
ctx->extra_parse_data().SetFieldName("google.protobuf.Method.request_type_url");
auto str = msg->mutable_request_type_url();
......@@ -1032,7 +1032,7 @@ const char* Method::_InternalParse(const char* begin, const char* end, void* obj
// string response_type_url = 4;
case 4: {
if (static_cast<::google::protobuf::uint8>(tag) != 34) goto handle_unusual;
ptr = ::google::protobuf::io::Parse32(ptr, &size);
ptr = ::google::protobuf::io::ReadSize(ptr, &size);
GOOGLE_PROTOBUF_PARSER_ASSERT(ptr);
ctx->extra_parse_data().SetFieldName("google.protobuf.Method.response_type_url");
auto str = msg->mutable_response_type_url();
......@@ -1062,7 +1062,7 @@ const char* Method::_InternalParse(const char* begin, const char* end, void* obj
case 6: {
if (static_cast<::google::protobuf::uint8>(tag) != 50) goto handle_unusual;
do {
ptr = ::google::protobuf::io::Parse32(ptr, &size);
ptr = ::google::protobuf::io::ReadSize(ptr, &size);
GOOGLE_PROTOBUF_PARSER_ASSERT(ptr);
parser_till_end = ::google::protobuf::Option::_InternalParse;
object = msg->add_options();
......@@ -1601,7 +1601,7 @@ void Mixin::Clear() {
const char* Mixin::_InternalParse(const char* begin, const char* end, void* object,
::google::protobuf::internal::ParseContext* ctx) {
auto msg = static_cast<Mixin*>(object);
::google::protobuf::uint32 size; (void)size;
::google::protobuf::int32 size; (void)size;
int depth; (void)depth;
::google::protobuf::uint32 tag;
::google::protobuf::internal::ParseFunc parser_till_end; (void)parser_till_end;
......@@ -1613,7 +1613,7 @@ const char* Mixin::_InternalParse(const char* begin, const char* end, void* obje
// string name = 1;
case 1: {
if (static_cast<::google::protobuf::uint8>(tag) != 10) goto handle_unusual;
ptr = ::google::protobuf::io::Parse32(ptr, &size);
ptr = ::google::protobuf::io::ReadSize(ptr, &size);
GOOGLE_PROTOBUF_PARSER_ASSERT(ptr);
ctx->extra_parse_data().SetFieldName("google.protobuf.Mixin.name");
auto str = msg->mutable_name();
......@@ -1632,7 +1632,7 @@ const char* Mixin::_InternalParse(const char* begin, const char* end, void* obje
// string root = 2;
case 2: {
if (static_cast<::google::protobuf::uint8>(tag) != 18) goto handle_unusual;
ptr = ::google::protobuf::io::Parse32(ptr, &size);
ptr = ::google::protobuf::io::ReadSize(ptr, &size);
GOOGLE_PROTOBUF_PARSER_ASSERT(ptr);
ctx->extra_parse_data().SetFieldName("google.protobuf.Mixin.root");
auto str = msg->mutable_root();
......
......@@ -71,7 +71,8 @@ namespace protobuf {
// ===================================================================
class PROTOBUF_EXPORT Api : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.Api) */ {
class PROTOBUF_EXPORT Api final :
public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.Api) */ {
public:
Api();
virtual ~Api();
......@@ -261,7 +262,8 @@ class PROTOBUF_EXPORT Api : public ::google::protobuf::Message /* @@protoc_inser
};
// -------------------------------------------------------------------
class PROTOBUF_EXPORT Method : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.Method) */ {
class PROTOBUF_EXPORT Method final :
public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.Method) */ {
public:
Method();
virtual ~Method();
......@@ -444,7 +446,8 @@ class PROTOBUF_EXPORT Method : public ::google::protobuf::Message /* @@protoc_in
};
// -------------------------------------------------------------------
class PROTOBUF_EXPORT Mixin : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.Mixin) */ {
class PROTOBUF_EXPORT Mixin final :
public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.Mixin) */ {
public:
Mixin();
virtual ~Mixin();
......
......@@ -1323,7 +1323,7 @@ class ParseLoopGenerator {
"end, void* object,\n"
" ::$proto_ns$::internal::ParseContext* ctx) {\n"
" auto msg = static_cast<$classname$*>(object);\n"
" $uint32$ size; (void)size;\n"
" $int32$ size; (void)size;\n"
" int depth; (void)depth;\n"
" $uint32$ tag;\n"
" ::$proto_ns$::internal::ParseFunc parser_till_end; "
......@@ -1548,7 +1548,7 @@ class ParseLoopGenerator {
void GenerateLengthDelim(const FieldDescriptor* field) {
format_(
"ptr = ::$proto_ns$::io::Parse32(ptr, &size);\n"
"ptr = ::$proto_ns$::io::ReadSize(ptr, &size);\n"
"$GOOGLE_PROTOBUF$_PARSER_ASSERT(ptr);\n");
if (!IsProto1(field->file(), options_) && field->is_packable()) {
if (!HasPreservingUnknownEnumSemantics(field->file()) &&
......
......@@ -244,6 +244,12 @@ bool HasPrivateHasMethod(const FieldDescriptor* field) {
// TODO(ckennelly): Cull these exclusions if/when these protos do not have
// their methods overriden by subclasses.
bool ShouldMarkClassAsFinal(const Descriptor* descriptor,
const Options& options) {
const string name = ClassName(descriptor, true);
return HasPrefixString(name, "::google::protobuf");
}
bool ShouldMarkClearAsFinal(const Descriptor* descriptor,
const Options& options) {
static std::set<string> exclusions{
......@@ -926,6 +932,9 @@ void MessageGenerator::GenerateFieldAccessorDefinitions(io::Printer* printer) {
void MessageGenerator::GenerateClassDefinition(io::Printer* printer) {
Formatter format(printer, variables_);
format.Set("class_final",
ShouldMarkClassAsFinal(descriptor_, options_) ? "final": "");
if (IsMapEntryMessage(descriptor_)) {
std::map<string, string> vars;
CollectMapInfo(options_, descriptor_, &vars);
......@@ -967,9 +976,9 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* printer) {
}
format(
"class $dllexport_decl $${1$$classname$$}$ : public $superclass$ "
"/* @@protoc_insertion_point(class_definition:$full_name$) */ "
"{\n",
"class $dllexport_decl $${1$$classname$$}$$ class_final$ :\n"
" public $superclass$ /* @@protoc_insertion_point("
"class_definition:$full_name$) */ {\n",
descriptor_);
format(" public:\n");
format.Indent();
......
......@@ -3064,38 +3064,42 @@ void Generator::GenerateClassDeserializeBinary(const GeneratorOptions& options,
" * @return {!$class$}\n"
" */\n"
"$class$.deserializeBinaryFromReader = function(msg, reader) {\n"
" while (reader.nextField()) {\n"
" if (reader.isEndGroup()) {\n"
" break;\n"
" }\n"
" var field = reader.getFieldNumber();\n"
" switch (field) {\n",
" while (reader.nextField()) {\n",
"class", GetMessagePath(options, desc));
printer->Print(
" if (reader.isEndGroup()) {\n"
" break;\n"
" }\n"
" var field = reader.getFieldNumber();\n"
" switch (field) {\n");
for (int i = 0; i < desc->field_count(); i++) {
if (!IgnoreField(desc->field(i))) {
GenerateClassDeserializeBinaryField(options, printer, desc->field(i));
for (int i = 0; i < desc->field_count(); i++) {
if (!IgnoreField(desc->field(i))) {
GenerateClassDeserializeBinaryField(options, printer, desc->field(i));
}
}
}
printer->Print(
" default:\n");
if (IsExtendable(desc)) {
printer->Print(
" jspb.Message.readBinaryExtension(msg, reader, $extobj$Binary,\n"
" $class$.prototype.getExtension,\n"
" $class$.prototype.setExtension);\n"
" break;\n",
"extobj", JSExtensionsObjectName(options, desc->file(), desc),
"class", GetMessagePath(options, desc));
} else {
printer->Print(
" reader.skipField();\n"
" break;\n");
}
" default:\n");
if (IsExtendable(desc)) {
printer->Print(
" jspb.Message.readBinaryExtension(msg, reader,\n"
" $extobj$Binary,\n"
" $class$.prototype.getExtension,\n"
" $class$.prototype.setExtension);\n"
" break;\n"
" }\n",
"extobj", JSExtensionsObjectName(options, desc->file(), desc),
"class", GetMessagePath(options, desc));
} else {
printer->Print(
" reader.skipField();\n"
" break;\n"
" }\n");
}
printer->Print(
" }\n"
" }\n"
" return msg;\n"
"};\n"
......
......@@ -314,7 +314,7 @@ void Version::Clear() {
const char* Version::_InternalParse(const char* begin, const char* end, void* object,
::google::protobuf::internal::ParseContext* ctx) {
auto msg = static_cast<Version*>(object);
::google::protobuf::uint32 size; (void)size;
::google::protobuf::int32 size; (void)size;
int depth; (void)depth;
::google::protobuf::uint32 tag;
::google::protobuf::internal::ParseFunc parser_till_end; (void)parser_till_end;
......@@ -356,7 +356,7 @@ const char* Version::_InternalParse(const char* begin, const char* end, void* ob
// optional string suffix = 4;
case 4: {
if (static_cast<::google::protobuf::uint8>(tag) != 34) goto handle_unusual;
ptr = ::google::protobuf::io::Parse32(ptr, &size);
ptr = ::google::protobuf::io::ReadSize(ptr, &size);
GOOGLE_PROTOBUF_PARSER_ASSERT(ptr);
ctx->extra_parse_data().SetFieldName("google.protobuf.compiler.Version.suffix");
auto str = msg->mutable_suffix();
......@@ -793,7 +793,7 @@ void CodeGeneratorRequest::Clear() {
const char* CodeGeneratorRequest::_InternalParse(const char* begin, const char* end, void* object,
::google::protobuf::internal::ParseContext* ctx) {
auto msg = static_cast<CodeGeneratorRequest*>(object);
::google::protobuf::uint32 size; (void)size;
::google::protobuf::int32 size; (void)size;
int depth; (void)depth;
::google::protobuf::uint32 tag;
::google::protobuf::internal::ParseFunc parser_till_end; (void)parser_till_end;
......@@ -806,7 +806,7 @@ const char* CodeGeneratorRequest::_InternalParse(const char* begin, const char*
case 1: {
if (static_cast<::google::protobuf::uint8>(tag) != 10) goto handle_unusual;
do {
ptr = ::google::protobuf::io::Parse32(ptr, &size);
ptr = ::google::protobuf::io::ReadSize(ptr, &size);
GOOGLE_PROTOBUF_PARSER_ASSERT(ptr);
ctx->extra_parse_data().SetFieldName("google.protobuf.compiler.CodeGeneratorRequest.file_to_generate");
auto str = msg->add_file_to_generate();
......@@ -827,7 +827,7 @@ const char* CodeGeneratorRequest::_InternalParse(const char* begin, const char*
// optional string parameter = 2;
case 2: {
if (static_cast<::google::protobuf::uint8>(tag) != 18) goto handle_unusual;
ptr = ::google::protobuf::io::Parse32(ptr, &size);
ptr = ::google::protobuf::io::ReadSize(ptr, &size);
GOOGLE_PROTOBUF_PARSER_ASSERT(ptr);
ctx->extra_parse_data().SetFieldName("google.protobuf.compiler.CodeGeneratorRequest.parameter");
auto str = msg->mutable_parameter();
......@@ -846,7 +846,7 @@ const char* CodeGeneratorRequest::_InternalParse(const char* begin, const char*
// optional .google.protobuf.compiler.Version compiler_version = 3;
case 3: {
if (static_cast<::google::protobuf::uint8>(tag) != 26) goto handle_unusual;
ptr = ::google::protobuf::io::Parse32(ptr, &size);
ptr = ::google::protobuf::io::ReadSize(ptr, &size);
GOOGLE_PROTOBUF_PARSER_ASSERT(ptr);
parser_till_end = ::google::protobuf::compiler::Version::_InternalParse;
object = msg->mutable_compiler_version();
......@@ -862,7 +862,7 @@ const char* CodeGeneratorRequest::_InternalParse(const char* begin, const char*
case 15: {
if (static_cast<::google::protobuf::uint8>(tag) != 122) goto handle_unusual;
do {
ptr = ::google::protobuf::io::Parse32(ptr, &size);
ptr = ::google::protobuf::io::ReadSize(ptr, &size);
GOOGLE_PROTOBUF_PARSER_ASSERT(ptr);
parser_till_end = ::google::protobuf::FileDescriptorProto::_InternalParse;
object = msg->add_proto_file();
......@@ -1312,7 +1312,7 @@ void CodeGeneratorResponse_File::Clear() {
const char* CodeGeneratorResponse_File::_InternalParse(const char* begin, const char* end, void* object,
::google::protobuf::internal::ParseContext* ctx) {
auto msg = static_cast<CodeGeneratorResponse_File*>(object);
::google::protobuf::uint32 size; (void)size;
::google::protobuf::int32 size; (void)size;
int depth; (void)depth;
::google::protobuf::uint32 tag;
::google::protobuf::internal::ParseFunc parser_till_end; (void)parser_till_end;
......@@ -1324,7 +1324,7 @@ const char* CodeGeneratorResponse_File::_InternalParse(const char* begin, const
// optional string name = 1;
case 1: {
if (static_cast<::google::protobuf::uint8>(tag) != 10) goto handle_unusual;
ptr = ::google::protobuf::io::Parse32(ptr, &size);
ptr = ::google::protobuf::io::ReadSize(ptr, &size);
GOOGLE_PROTOBUF_PARSER_ASSERT(ptr);
ctx->extra_parse_data().SetFieldName("google.protobuf.compiler.CodeGeneratorResponse.File.name");
auto str = msg->mutable_name();
......@@ -1343,7 +1343,7 @@ const char* CodeGeneratorResponse_File::_InternalParse(const char* begin, const
// optional string insertion_point = 2;
case 2: {
if (static_cast<::google::protobuf::uint8>(tag) != 18) goto handle_unusual;
ptr = ::google::protobuf::io::Parse32(ptr, &size);
ptr = ::google::protobuf::io::ReadSize(ptr, &size);
GOOGLE_PROTOBUF_PARSER_ASSERT(ptr);
ctx->extra_parse_data().SetFieldName("google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point");
auto str = msg->mutable_insertion_point();
......@@ -1362,7 +1362,7 @@ const char* CodeGeneratorResponse_File::_InternalParse(const char* begin, const
// optional string content = 15;
case 15: {
if (static_cast<::google::protobuf::uint8>(tag) != 122) goto handle_unusual;
ptr = ::google::protobuf::io::Parse32(ptr, &size);
ptr = ::google::protobuf::io::ReadSize(ptr, &size);
GOOGLE_PROTOBUF_PARSER_ASSERT(ptr);
ctx->extra_parse_data().SetFieldName("google.protobuf.compiler.CodeGeneratorResponse.File.content");
auto str = msg->mutable_content();
......@@ -1764,7 +1764,7 @@ void CodeGeneratorResponse::Clear() {
const char* CodeGeneratorResponse::_InternalParse(const char* begin, const char* end, void* object,
::google::protobuf::internal::ParseContext* ctx) {
auto msg = static_cast<CodeGeneratorResponse*>(object);
::google::protobuf::uint32 size; (void)size;
::google::protobuf::int32 size; (void)size;
int depth; (void)depth;
::google::protobuf::uint32 tag;
::google::protobuf::internal::ParseFunc parser_till_end; (void)parser_till_end;
......@@ -1776,7 +1776,7 @@ const char* CodeGeneratorResponse::_InternalParse(const char* begin, const char*
// optional string error = 1;
case 1: {
if (static_cast<::google::protobuf::uint8>(tag) != 10) goto handle_unusual;
ptr = ::google::protobuf::io::Parse32(ptr, &size);
ptr = ::google::protobuf::io::ReadSize(ptr, &size);
GOOGLE_PROTOBUF_PARSER_ASSERT(ptr);
ctx->extra_parse_data().SetFieldName("google.protobuf.compiler.CodeGeneratorResponse.error");
auto str = msg->mutable_error();
......@@ -1796,7 +1796,7 @@ const char* CodeGeneratorResponse::_InternalParse(const char* begin, const char*
case 15: {
if (static_cast<::google::protobuf::uint8>(tag) != 122) goto handle_unusual;
do {
ptr = ::google::protobuf::io::Parse32(ptr, &size);
ptr = ::google::protobuf::io::ReadSize(ptr, &size);
GOOGLE_PROTOBUF_PARSER_ASSERT(ptr);
parser_till_end = ::google::protobuf::compiler::CodeGeneratorResponse_File::_InternalParse;
object = msg->add_file();
......
......@@ -83,7 +83,8 @@ namespace compiler {
// ===================================================================
class PROTOC_EXPORT Version : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.compiler.Version) */ {
class PROTOC_EXPORT Version final :
public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.compiler.Version) */ {
public:
Version();
virtual ~Version();
......@@ -235,7 +236,8 @@ class PROTOC_EXPORT Version : public ::google::protobuf::Message /* @@protoc_ins
};
// -------------------------------------------------------------------
class PROTOC_EXPORT CodeGeneratorRequest : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.compiler.CodeGeneratorRequest) */ {
class PROTOC_EXPORT CodeGeneratorRequest final :
public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.compiler.CodeGeneratorRequest) */ {
public:
CodeGeneratorRequest();
virtual ~CodeGeneratorRequest();
......@@ -409,7 +411,8 @@ class PROTOC_EXPORT CodeGeneratorRequest : public ::google::protobuf::Message /*
};
// -------------------------------------------------------------------
class PROTOC_EXPORT CodeGeneratorResponse_File : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.compiler.CodeGeneratorResponse.File) */ {
class PROTOC_EXPORT CodeGeneratorResponse_File final :
public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.compiler.CodeGeneratorResponse.File) */ {
public:
CodeGeneratorResponse_File();
virtual ~CodeGeneratorResponse_File();
......@@ -569,7 +572,8 @@ class PROTOC_EXPORT CodeGeneratorResponse_File : public ::google::protobuf::Mess
};
// -------------------------------------------------------------------
class PROTOC_EXPORT CodeGeneratorResponse : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.compiler.CodeGeneratorResponse) */ {
class PROTOC_EXPORT CodeGeneratorResponse final :
public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.compiler.CodeGeneratorResponse) */ {
public:
CodeGeneratorResponse();
virtual ~CodeGeneratorResponse();
......
This diff is collapsed.
This diff is collapsed.
......@@ -176,7 +176,7 @@ void Duration::Clear() {
const char* Duration::_InternalParse(const char* begin, const char* end, void* object,
::google::protobuf::internal::ParseContext* ctx) {
auto msg = static_cast<Duration*>(object);
::google::protobuf::uint32 size; (void)size;
::google::protobuf::int32 size; (void)size;
int depth; (void)depth;
::google::protobuf::uint32 tag;
::google::protobuf::internal::ParseFunc parser_till_end; (void)parser_till_end;
......
......@@ -61,7 +61,8 @@ namespace protobuf {
// ===================================================================
class PROTOBUF_EXPORT Duration : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.Duration) */ {
class PROTOBUF_EXPORT Duration final :
public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.Duration) */ {
public:
Duration();
virtual ~Duration();
......
......@@ -162,7 +162,7 @@ void Empty::Clear() {
const char* Empty::_InternalParse(const char* begin, const char* end, void* object,
::google::protobuf::internal::ParseContext* ctx) {
auto msg = static_cast<Empty*>(object);
::google::protobuf::uint32 size; (void)size;
::google::protobuf::int32 size; (void)size;
int depth; (void)depth;
::google::protobuf::uint32 tag;
::google::protobuf::internal::ParseFunc parser_till_end; (void)parser_till_end;
......
......@@ -61,7 +61,8 @@ namespace protobuf {
// ===================================================================
class PROTOBUF_EXPORT Empty : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.Empty) */ {
class PROTOBUF_EXPORT Empty final :
public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.Empty) */ {
public:
Empty();
virtual ~Empty();
......
......@@ -36,6 +36,7 @@
#include <google/protobuf/stubs/strutil.h>
#include <google/protobuf/test_util.h>
#include <google/protobuf/test_util2.h>
#include <google/protobuf/unittest.pb.h>
#include <google/protobuf/unittest_mset.pb.h>
#include <google/protobuf/io/coded_stream.h>
......@@ -59,6 +60,8 @@ namespace protobuf {
namespace internal {
namespace {
using TestUtil::EqualsToSerialized;
// This test closely mirrors net/proto2/compiler/cpp/internal/unittest.cc
// except that it uses extensions rather than regular fields.
......@@ -660,7 +663,10 @@ TEST(ExtensionSetTest, PackedToUnpackedParsing) {
// Reserialize
unittest::TestUnpackedTypes unpacked;
TestUtil::SetUnpackedFields(&unpacked);
EXPECT_TRUE(unpacked.SerializeAsString() == destination.SerializeAsString());
// Serialized proto has to be the same size and parsed to the same message.
EXPECT_EQ(unpacked.SerializeAsString().size(),
destination.SerializeAsString().size());
EXPECT_TRUE(EqualsToSerialized(unpacked, destination.SerializeAsString()));
// Make sure we can add extensions.
destination.AddExtension(unittest::unpacked_int32_extension, 1);
......@@ -681,7 +687,10 @@ TEST(ExtensionSetTest, UnpackedToPackedParsing) {
// Reserialize
unittest::TestPackedTypes packed;
TestUtil::SetPackedFields(&packed);
EXPECT_TRUE(packed.SerializeAsString() == destination.SerializeAsString());
// Serialized proto has to be the same size and parsed to the same message.
EXPECT_EQ(packed.SerializeAsString().size(),
destination.SerializeAsString().size());
EXPECT_TRUE(EqualsToSerialized(packed, destination.SerializeAsString()));
// Make sure we can add extensions.
destination.AddExtension(unittest::packed_int32_extension, 1);
......@@ -1193,6 +1202,7 @@ TEST(ExtensionSetTest, DynamicExtensions) {
// Since the extensions were based off of the fields of TestDynamicExtensions,
// we can use that message to create this test message.
string data;
unittest::TestDynamicExtensions dynamic_extension;
{
unittest::TestDynamicExtensions message;
message.set_scalar_extension(123);
......@@ -1218,6 +1228,7 @@ TEST(ExtensionSetTest, DynamicExtensions) {
message.mutable_unknown_fields()->AddLengthDelimited(54321, "unknown");
message.SerializeToString(&data);
dynamic_extension = message;
}
// Now we can parse this using our dynamic extension definitions...
......@@ -1252,9 +1263,8 @@ TEST(ExtensionSetTest, DynamicExtensions) {
message.DebugString());
// Can we serialize it?
// (Don't use EXPECT_EQ because we don't want to dump raw binary data to the
// terminal on failure.)
EXPECT_TRUE(message.SerializeAsString() == data);
EXPECT_TRUE(
EqualsToSerialized(dynamic_extension, message.SerializeAsString()));
// What if we parse using the reflection-based parser?
{
......
......@@ -170,7 +170,7 @@ void FieldMask::Clear() {
const char* FieldMask::_InternalParse(const char* begin, const char* end, void* object,
::google::protobuf::internal::ParseContext* ctx) {
auto msg = static_cast<FieldMask*>(object);
::google::protobuf::uint32 size; (void)size;
::google::protobuf::int32 size; (void)size;
int depth; (void)depth;
::google::protobuf::uint32 tag;
::google::protobuf::internal::ParseFunc parser_till_end; (void)parser_till_end;
......@@ -183,7 +183,7 @@ const char* FieldMask::_InternalParse(const char* begin, const char* end, void*
case 1: {
if (static_cast<::google::protobuf::uint8>(tag) != 10) goto handle_unusual;
do {
ptr = ::google::protobuf::io::Parse32(ptr, &size);
ptr = ::google::protobuf::io::ReadSize(ptr, &size);
GOOGLE_PROTOBUF_PARSER_ASSERT(ptr);
ctx->extra_parse_data().SetFieldName("google.protobuf.FieldMask.paths");
auto str = msg->add_paths();
......
......@@ -61,7 +61,8 @@ namespace protobuf {
// ===================================================================
class PROTOBUF_EXPORT FieldMask : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.FieldMask) */ {
class PROTOBUF_EXPORT FieldMask final :
public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.FieldMask) */ {
public:
FieldMask();
virtual ~FieldMask();
......
......@@ -178,8 +178,8 @@ const char* VarintParse(const char* p, T* out) {
res += byte << (i * 7);
int j = i + 1;
if (PROTOBUF_PREDICT_TRUE(byte < 128)) {
*out = res - extra;
return p + j;
*out = res - extra;
return p + j;
}
extra += 128ull << (i * 7);
}
......@@ -193,6 +193,27 @@ inline const char* Parse64(const char* p, uint64* out) {
return VarintParse<10>(p, out);
}
inline const char* ReadSize(const char* p, int32* out) {
int32 res = 0;
int32 extra = 0;
for (int i = 0; i < 4; i++) {
uint32 byte = static_cast<uint8>(p[i]);
res += byte << (i * 7);
int j = i + 1;
if (PROTOBUF_PREDICT_TRUE(byte < 128)) {
*out = res - extra;
return p + j;
}
extra += 128ull << (i * 7);
}
uint32 byte = static_cast<uint8>(p[4]);
// size may not be negative, so only the lowest 3 bits can be set.
if (byte >= 8) return nullptr;
res += byte << (4 * 7);
*out = res - extra;
return p + 5;
}
// Class which reads and decodes binary data which is composed of varint-
// encoded integers and fixed-width pieces. Wraps a ZeroCopyInputStream.
// Most users will not need to deal with CodedInputStream.
......
......@@ -91,12 +91,6 @@ void MapFieldBase::SetRepeatedDirty() {
state_.store(STATE_MODIFIED_REPEATED, std::memory_order_relaxed);
}
void MapFieldBase::SetClean() {
// These are called by (non-const) mutator functions. So by our API it's the
// callers responsibility to have these calls properly ordered.
state_.store(CLEAN, std::memory_order_relaxed);
}
void* MapFieldBase::MutableRepeatedPtrField() const { return repeated_field_; }
void MapFieldBase::SyncRepeatedFieldWithMap() const {
......@@ -192,7 +186,9 @@ void DynamicMapField::Clear() {
if (MapFieldBase::repeated_field_ != nullptr) {
MapFieldBase::repeated_field_->Clear();
}
MapFieldBase::SetClean();
// Data in map and repeated field are both empty, but we can't set status
// CLEAN which will invalidate previous reference to map.
MapFieldBase::SetMapDirty();
}
bool DynamicMapField::ContainsMapKey(
......
......@@ -137,9 +137,6 @@ class PROTOBUF_EXPORT MapFieldBase {
// Tells MapFieldBase that there is new change to RepeatedPTrField.
void SetRepeatedDirty();
// Tells MapFieldBase that map and repeated are the same.
void SetClean();
// Provides derived class the access to repeated field.
void* MutableRepeatedPtrField() const;
......
......@@ -186,7 +186,10 @@ void MapField<Derived, Key, T, kKeyFieldType, kValueFieldType,
}
impl_.MutableMap()->clear();
MapFieldBase::SetClean();
// Data in map and repeated field are both empty, but we can't set status
// CLEAN. Because clear is a generated API, we cannot invalidate previous
// reference to map.
MapFieldBase::SetMapDirty();
}
template <typename Derived, typename Key, typename T,
......
......@@ -447,7 +447,7 @@ TEST_P(MapFieldStateTest, SwapRepeatedDirty) {
TEST_P(MapFieldStateTest, Clear) {
map_field_->Clear();
Expect(map_field_.get(), CLEAN, 0, 0, false);
Expect(map_field_.get(), MAP_DIRTY, 0, 0, false);
}
TEST_P(MapFieldStateTest, SpaceUsedExcludingSelf) {
......
......@@ -1584,8 +1584,6 @@ void MapReflectionTester::ExpectClearViaReflection(
EXPECT_EQ(0, reflection->FieldSize(message, F("map_int32_foreign_message")));
EXPECT_TRUE(reflection->GetMapData(
message, F("map_int32_foreign_message"))->IsMapValid());
EXPECT_TRUE(reflection->GetMapData(
message, F("map_int32_foreign_message"))->IsRepeatedFieldValid());
}
void MapReflectionTester::ExpectClearViaReflectionIterator(
......
......@@ -353,6 +353,10 @@ bool MessageLite::ParsePartialFromArray(const void* data, int size) {
return ParseFrom<kParsePartial>(as_string_view(data, size));
}
bool MessageLite::MergeFromString(const string& data) {
return ParseFrom<kMerge>(data);
}
// ===================================================================
......
......@@ -347,8 +347,6 @@ class PROTOBUF_EXPORT ParseContext {
const char* StoreAndTailCall(const char* ptr, const char* end,
ParseClosure current_parser,
ParseClosure child_parser, int32 size) {
// if size was bigger than 2GB we should fail
if (size < 0) return nullptr;
// At this point ptr could be past end. Hence a malicious size could
// overflow.
int64 safe_new_limit = size - static_cast<int64>(end - ptr);
......@@ -650,8 +648,8 @@ std::pair<const char*, bool> FieldParser(uint64 tag, ParseClosure parent,
break;
}
case WireType::WIRETYPE_LENGTH_DELIMITED: {
uint32 size;
ptr = io::Parse32(ptr, &size);
int32 size;
ptr = io::ReadSize(ptr, &size);
GOOGLE_PROTOBUF_ASSERT_RETURN(ptr != nullptr, {});
ParseClosure child = field_parser.AddLengthDelimited(number, size);
if (size > end - ptr) {
......
......@@ -161,7 +161,7 @@ void SourceContext::Clear() {
const char* SourceContext::_InternalParse(const char* begin, const char* end, void* object,
::google::protobuf::internal::ParseContext* ctx) {
auto msg = static_cast<SourceContext*>(object);
::google::protobuf::uint32 size; (void)size;
::google::protobuf::int32 size; (void)size;
int depth; (void)depth;
::google::protobuf::uint32 tag;
::google::protobuf::internal::ParseFunc parser_till_end; (void)parser_till_end;
......@@ -173,7 +173,7 @@ const char* SourceContext::_InternalParse(const char* begin, const char* end, vo
// string file_name = 1;
case 1: {
if (static_cast<::google::protobuf::uint8>(tag) != 10) goto handle_unusual;
ptr = ::google::protobuf::io::Parse32(ptr, &size);
ptr = ::google::protobuf::io::ReadSize(ptr, &size);
GOOGLE_PROTOBUF_PARSER_ASSERT(ptr);
ctx->extra_parse_data().SetFieldName("google.protobuf.SourceContext.file_name");
auto str = msg->mutable_file_name();
......
......@@ -61,7 +61,8 @@ namespace protobuf {
// ===================================================================
class PROTOBUF_EXPORT SourceContext : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.SourceContext) */ {
class PROTOBUF_EXPORT SourceContext final :
public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.SourceContext) */ {
public:
SourceContext();
virtual ~SourceContext();
......
......@@ -300,7 +300,7 @@ void Struct::Clear() {
const char* Struct::_InternalParse(const char* begin, const char* end, void* object,
::google::protobuf::internal::ParseContext* ctx) {
auto msg = static_cast<Struct*>(object);
::google::protobuf::uint32 size; (void)size;
::google::protobuf::int32 size; (void)size;
int depth; (void)depth;
::google::protobuf::uint32 tag;
::google::protobuf::internal::ParseFunc parser_till_end; (void)parser_till_end;
......@@ -313,7 +313,7 @@ const char* Struct::_InternalParse(const char* begin, const char* end, void* obj
case 1: {
if (static_cast<::google::protobuf::uint8>(tag) != 10) goto handle_unusual;
do {
ptr = ::google::protobuf::io::Parse32(ptr, &size);
ptr = ::google::protobuf::io::ReadSize(ptr, &size);
GOOGLE_PROTOBUF_PARSER_ASSERT(ptr);
parser_till_end = ::google::protobuf::internal::SlowMapEntryParser;
auto parse_map = ::google::protobuf::Struct_FieldsEntry_DoNotUse::_ParseMap;
......@@ -844,7 +844,7 @@ void Value::Clear() {
const char* Value::_InternalParse(const char* begin, const char* end, void* object,
::google::protobuf::internal::ParseContext* ctx) {
auto msg = static_cast<Value*>(object);
::google::protobuf::uint32 size; (void)size;
::google::protobuf::int32 size; (void)size;
int depth; (void)depth;
::google::protobuf::uint32 tag;
::google::protobuf::internal::ParseFunc parser_till_end; (void)parser_till_end;
......@@ -875,7 +875,7 @@ const char* Value::_InternalParse(const char* begin, const char* end, void* obje
// string string_value = 3;
case 3: {
if (static_cast<::google::protobuf::uint8>(tag) != 26) goto handle_unusual;
ptr = ::google::protobuf::io::Parse32(ptr, &size);
ptr = ::google::protobuf::io::ReadSize(ptr, &size);
GOOGLE_PROTOBUF_PARSER_ASSERT(ptr);
ctx->extra_parse_data().SetFieldName("google.protobuf.Value.string_value");
auto str = msg->mutable_string_value();
......@@ -904,7 +904,7 @@ const char* Value::_InternalParse(const char* begin, const char* end, void* obje
// .google.protobuf.Struct struct_value = 5;
case 5: {
if (static_cast<::google::protobuf::uint8>(tag) != 42) goto handle_unusual;
ptr = ::google::protobuf::io::Parse32(ptr, &size);
ptr = ::google::protobuf::io::ReadSize(ptr, &size);
GOOGLE_PROTOBUF_PARSER_ASSERT(ptr);
parser_till_end = ::google::protobuf::Struct::_InternalParse;
object = msg->mutable_struct_value();
......@@ -919,7 +919,7 @@ const char* Value::_InternalParse(const char* begin, const char* end, void* obje
// .google.protobuf.ListValue list_value = 6;
case 6: {
if (static_cast<::google::protobuf::uint8>(tag) != 50) goto handle_unusual;
ptr = ::google::protobuf::io::Parse32(ptr, &size);
ptr = ::google::protobuf::io::ReadSize(ptr, &size);
GOOGLE_PROTOBUF_PARSER_ASSERT(ptr);
parser_till_end = ::google::protobuf::ListValue::_InternalParse;
object = msg->mutable_list_value();
......@@ -1406,7 +1406,7 @@ void ListValue::Clear() {
const char* ListValue::_InternalParse(const char* begin, const char* end, void* object,
::google::protobuf::internal::ParseContext* ctx) {
auto msg = static_cast<ListValue*>(object);
::google::protobuf::uint32 size; (void)size;
::google::protobuf::int32 size; (void)size;
int depth; (void)depth;
::google::protobuf::uint32 tag;
::google::protobuf::internal::ParseFunc parser_till_end; (void)parser_till_end;
......@@ -1419,7 +1419,7 @@ const char* ListValue::_InternalParse(const char* begin, const char* end, void*
case 1: {
if (static_cast<::google::protobuf::uint8>(tag) != 10) goto handle_unusual;
do {
ptr = ::google::protobuf::io::Parse32(ptr, &size);
ptr = ::google::protobuf::io::ReadSize(ptr, &size);
GOOGLE_PROTOBUF_PARSER_ASSERT(ptr);
parser_till_end = ::google::protobuf::Value::_InternalParse;
object = msg->add_values();
......
......@@ -121,7 +121,8 @@ static bool _ParseMap(const char* begin, const char* end, void* object, ::google
// -------------------------------------------------------------------
class PROTOBUF_EXPORT Struct : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.Struct) */ {
class PROTOBUF_EXPORT Struct final :
public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.Struct) */ {
public:
Struct();
virtual ~Struct();
......@@ -256,7 +257,8 @@ class PROTOBUF_EXPORT Struct : public ::google::protobuf::Message /* @@protoc_in
};
// -------------------------------------------------------------------
class PROTOBUF_EXPORT Value : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.Value) */ {
class PROTOBUF_EXPORT Value final :
public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.Value) */ {
public:
Value();
virtual ~Value();
......@@ -484,7 +486,8 @@ class PROTOBUF_EXPORT Value : public ::google::protobuf::Message /* @@protoc_ins
};
// -------------------------------------------------------------------
class PROTOBUF_EXPORT ListValue : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.ListValue) */ {
class PROTOBUF_EXPORT ListValue final :
public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.ListValue) */ {
public:
ListValue();
virtual ~ListValue();
......
......@@ -620,16 +620,26 @@ struct PROTOBUF_EXPORT AlphaNum {
// No bool ctor -- bools convert to an integral type.
// A bool ctor would also convert incoming pointers (bletch).
AlphaNum(int32 i32)
AlphaNum(int i32)
: piece_data_(digits),
piece_size_(FastInt32ToBufferLeft(i32, digits) - &digits[0]) {}
AlphaNum(uint32 u32)
AlphaNum(unsigned int u32)
: piece_data_(digits),
piece_size_(FastUInt32ToBufferLeft(u32, digits) - &digits[0]) {}
AlphaNum(int64 i64)
AlphaNum(long long i64)
: piece_data_(digits),
piece_size_(FastInt64ToBufferLeft(i64, digits) - &digits[0]) {}
AlphaNum(uint64 u64)
AlphaNum(unsigned long long u64)
: piece_data_(digits),
piece_size_(FastUInt64ToBufferLeft(u64, digits) - &digits[0]) {}
// Note: on some architectures, "long" is only 32 bits, not 64, but the
// performance hit of using FastInt64ToBufferLeft to handle 32-bit values
// is quite minor.
AlphaNum(long i64)
: piece_data_(digits),
piece_size_(FastInt64ToBufferLeft(i64, digits) - &digits[0]) {}
AlphaNum(unsigned long u64)
: piece_data_(digits),
piece_size_(FastUInt64ToBufferLeft(u64, digits) - &digits[0]) {}
......
......@@ -805,6 +805,37 @@ TEST(Base64, EscapeAndUnescape) {
}
}
// Test StrCat of ints and longs of various sizes and signdedness.
TEST(StrCat, Ints) {
const short s = -1; // NOLINT(runtime/int)
const uint16_t us = 2;
const int i = -3;
const unsigned int ui = 4;
const long l = -5; // NOLINT(runtime/int)
const unsigned long ul = 6; // NOLINT(runtime/int)
const long long ll = -7; // NOLINT(runtime/int)
const unsigned long long ull = 8; // NOLINT(runtime/int)
const ptrdiff_t ptrdiff = -9;
const size_t size = 10;
const intptr_t intptr = -12;
const uintptr_t uintptr = 13;
string answer;
answer = StrCat(s, us);
EXPECT_EQ(answer, "-12");
answer = StrCat(i, ui);
EXPECT_EQ(answer, "-34");
answer = StrCat(l, ul);
EXPECT_EQ(answer, "-56");
answer = StrCat(ll, ull);
EXPECT_EQ(answer, "-78");
answer = StrCat(ptrdiff, size);
EXPECT_EQ(answer, "-910");
answer = StrCat(ptrdiff, intptr);
EXPECT_EQ(answer, "-9-12");
answer = StrCat(uintptr, 0);
EXPECT_EQ(answer, "130");
}
} // anonymous namespace
} // namespace protobuf
} // namespace google
......@@ -33,6 +33,7 @@
#include <google/protobuf/stubs/strutil.h>
#include <google/protobuf/util/message_differencer.h>
#include <google/protobuf/testing/googletest.h>
......@@ -66,6 +67,15 @@ inline ::std::string GetTestDataPath(const ::std::string& google3_path) {
return TestSourceDir() + "/" + MaybeTranslatePath(google3_path);
}
// Checks the equality of "message" and serialized proto of type "ProtoType".
// Do not directly compare two serialized protos.
template <typename ProtoType>
bool EqualsToSerialized(const ProtoType& message, const std::string& data) {
ProtoType other;
other.ParsePartialFromString(data);
return util::MessageDifferencer::Equals(message, other);
}
} // namespace TestUtil
} // namespace protobuf
} // namespace google
......
......@@ -176,7 +176,7 @@ void Timestamp::Clear() {
const char* Timestamp::_InternalParse(const char* begin, const char* end, void* object,
::google::protobuf::internal::ParseContext* ctx) {
auto msg = static_cast<Timestamp*>(object);
::google::protobuf::uint32 size; (void)size;
::google::protobuf::int32 size; (void)size;
int depth; (void)depth;
::google::protobuf::uint32 tag;
::google::protobuf::internal::ParseFunc parser_till_end; (void)parser_till_end;
......
......@@ -61,7 +61,8 @@ namespace protobuf {
// ===================================================================
class PROTOBUF_EXPORT Timestamp : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.Timestamp) */ {
class PROTOBUF_EXPORT Timestamp final :
public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.Timestamp) */ {
public:
Timestamp();
virtual ~Timestamp();
......
This diff is collapsed.
......@@ -162,7 +162,8 @@ inline bool Syntax_Parse(
}
// ===================================================================
class PROTOBUF_EXPORT Type : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.Type) */ {
class PROTOBUF_EXPORT Type final :
public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.Type) */ {
public:
Type();
virtual ~Type();
......@@ -374,7 +375,8 @@ class PROTOBUF_EXPORT Type : public ::google::protobuf::Message /* @@protoc_inse
};
// -------------------------------------------------------------------
class PROTOBUF_EXPORT Field : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.Field) */ {
class PROTOBUF_EXPORT Field final :
public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.Field) */ {
public:
Field();
virtual ~Field();
......@@ -727,7 +729,8 @@ class PROTOBUF_EXPORT Field : public ::google::protobuf::Message /* @@protoc_ins
};
// -------------------------------------------------------------------
class PROTOBUF_EXPORT Enum : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.Enum) */ {
class PROTOBUF_EXPORT Enum final :
public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.Enum) */ {
public:
Enum();
virtual ~Enum();
......@@ -916,7 +919,8 @@ class PROTOBUF_EXPORT Enum : public ::google::protobuf::Message /* @@protoc_inse
};
// -------------------------------------------------------------------
class PROTOBUF_EXPORT EnumValue : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.EnumValue) */ {
class PROTOBUF_EXPORT EnumValue final :
public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.EnumValue) */ {
public:
EnumValue();
virtual ~EnumValue();
......@@ -1079,7 +1083,8 @@ class PROTOBUF_EXPORT EnumValue : public ::google::protobuf::Message /* @@protoc
};
// -------------------------------------------------------------------
class PROTOBUF_EXPORT Option : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.Option) */ {
class PROTOBUF_EXPORT Option final :
public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.Option) */ {
public:
Option();
virtual ~Option();
......
......@@ -390,7 +390,7 @@ void DoubleValue::Clear() {
const char* DoubleValue::_InternalParse(const char* begin, const char* end, void* object,
::google::protobuf::internal::ParseContext* ctx) {
auto msg = static_cast<DoubleValue*>(object);
::google::protobuf::uint32 size; (void)size;
::google::protobuf::int32 size; (void)size;
int depth; (void)depth;
::google::protobuf::uint32 tag;
::google::protobuf::internal::ParseFunc parser_till_end; (void)parser_till_end;
......@@ -679,7 +679,7 @@ void FloatValue::Clear() {
const char* FloatValue::_InternalParse(const char* begin, const char* end, void* object,
::google::protobuf::internal::ParseContext* ctx) {
auto msg = static_cast<FloatValue*>(object);
::google::protobuf::uint32 size; (void)size;
::google::protobuf::int32 size; (void)size;
int depth; (void)depth;
::google::protobuf::uint32 tag;
::google::protobuf::internal::ParseFunc parser_till_end; (void)parser_till_end;
......@@ -968,7 +968,7 @@ void Int64Value::Clear() {
const char* Int64Value::_InternalParse(const char* begin, const char* end, void* object,
::google::protobuf::internal::ParseContext* ctx) {
auto msg = static_cast<Int64Value*>(object);
::google::protobuf::uint32 size; (void)size;
::google::protobuf::int32 size; (void)size;
int depth; (void)depth;
::google::protobuf::uint32 tag;
::google::protobuf::internal::ParseFunc parser_till_end; (void)parser_till_end;
......@@ -1260,7 +1260,7 @@ void UInt64Value::Clear() {
const char* UInt64Value::_InternalParse(const char* begin, const char* end, void* object,
::google::protobuf::internal::ParseContext* ctx) {
auto msg = static_cast<UInt64Value*>(object);
::google::protobuf::uint32 size; (void)size;
::google::protobuf::int32 size; (void)size;
int depth; (void)depth;
::google::protobuf::uint32 tag;
::google::protobuf::internal::ParseFunc parser_till_end; (void)parser_till_end;
......@@ -1552,7 +1552,7 @@ void Int32Value::Clear() {
const char* Int32Value::_InternalParse(const char* begin, const char* end, void* object,
::google::protobuf::internal::ParseContext* ctx) {
auto msg = static_cast<Int32Value*>(object);
::google::protobuf::uint32 size; (void)size;
::google::protobuf::int32 size; (void)size;
int depth; (void)depth;
::google::protobuf::uint32 tag;
::google::protobuf::internal::ParseFunc parser_till_end; (void)parser_till_end;
......@@ -1844,7 +1844,7 @@ void UInt32Value::Clear() {
const char* UInt32Value::_InternalParse(const char* begin, const char* end, void* object,
::google::protobuf::internal::ParseContext* ctx) {
auto msg = static_cast<UInt32Value*>(object);
::google::protobuf::uint32 size; (void)size;
::google::protobuf::int32 size; (void)size;
int depth; (void)depth;
::google::protobuf::uint32 tag;
::google::protobuf::internal::ParseFunc parser_till_end; (void)parser_till_end;
......@@ -2136,7 +2136,7 @@ void BoolValue::Clear() {
const char* BoolValue::_InternalParse(const char* begin, const char* end, void* object,
::google::protobuf::internal::ParseContext* ctx) {
auto msg = static_cast<BoolValue*>(object);
::google::protobuf::uint32 size; (void)size;
::google::protobuf::int32 size; (void)size;
int depth; (void)depth;
::google::protobuf::uint32 tag;
::google::protobuf::internal::ParseFunc parser_till_end; (void)parser_till_end;
......@@ -2433,7 +2433,7 @@ void StringValue::Clear() {
const char* StringValue::_InternalParse(const char* begin, const char* end, void* object,
::google::protobuf::internal::ParseContext* ctx) {
auto msg = static_cast<StringValue*>(object);
::google::protobuf::uint32 size; (void)size;
::google::protobuf::int32 size; (void)size;
int depth; (void)depth;
::google::protobuf::uint32 tag;
::google::protobuf::internal::ParseFunc parser_till_end; (void)parser_till_end;
......@@ -2445,7 +2445,7 @@ const char* StringValue::_InternalParse(const char* begin, const char* end, void
// string value = 1;
case 1: {
if (static_cast<::google::protobuf::uint8>(tag) != 10) goto handle_unusual;
ptr = ::google::protobuf::io::Parse32(ptr, &size);
ptr = ::google::protobuf::io::ReadSize(ptr, &size);
GOOGLE_PROTOBUF_PARSER_ASSERT(ptr);
ctx->extra_parse_data().SetFieldName("google.protobuf.StringValue.value");
auto str = msg->mutable_value();
......@@ -2758,7 +2758,7 @@ void BytesValue::Clear() {
const char* BytesValue::_InternalParse(const char* begin, const char* end, void* object,
::google::protobuf::internal::ParseContext* ctx) {
auto msg = static_cast<BytesValue*>(object);
::google::protobuf::uint32 size; (void)size;
::google::protobuf::int32 size; (void)size;
int depth; (void)depth;
::google::protobuf::uint32 tag;
::google::protobuf::internal::ParseFunc parser_till_end; (void)parser_till_end;
......@@ -2770,7 +2770,7 @@ const char* BytesValue::_InternalParse(const char* begin, const char* end, void*
// bytes value = 1;
case 1: {
if (static_cast<::google::protobuf::uint8>(tag) != 10) goto handle_unusual;
ptr = ::google::protobuf::io::Parse32(ptr, &size);
ptr = ::google::protobuf::io::ReadSize(ptr, &size);
GOOGLE_PROTOBUF_PARSER_ASSERT(ptr);
auto str = msg->mutable_value();
if (size > end - ptr + ::google::protobuf::internal::ParseContext::kSlopBytes) {
......
......@@ -93,7 +93,8 @@ namespace protobuf {
// ===================================================================
class PROTOBUF_EXPORT DoubleValue : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.DoubleValue) */ {
class PROTOBUF_EXPORT DoubleValue final :
public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.DoubleValue) */ {
public:
DoubleValue();
virtual ~DoubleValue();
......@@ -219,7 +220,8 @@ class PROTOBUF_EXPORT DoubleValue : public ::google::protobuf::Message /* @@prot
};
// -------------------------------------------------------------------
class PROTOBUF_EXPORT FloatValue : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.FloatValue) */ {
class PROTOBUF_EXPORT FloatValue final :
public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.FloatValue) */ {
public:
FloatValue();
virtual ~FloatValue();
......@@ -345,7 +347,8 @@ class PROTOBUF_EXPORT FloatValue : public ::google::protobuf::Message /* @@proto
};
// -------------------------------------------------------------------
class PROTOBUF_EXPORT Int64Value : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.Int64Value) */ {
class PROTOBUF_EXPORT Int64Value final :
public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.Int64Value) */ {
public:
Int64Value();
virtual ~Int64Value();
......@@ -471,7 +474,8 @@ class PROTOBUF_EXPORT Int64Value : public ::google::protobuf::Message /* @@proto
};
// -------------------------------------------------------------------
class PROTOBUF_EXPORT UInt64Value : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.UInt64Value) */ {
class PROTOBUF_EXPORT UInt64Value final :
public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.UInt64Value) */ {
public:
UInt64Value();
virtual ~UInt64Value();
......@@ -597,7 +601,8 @@ class PROTOBUF_EXPORT UInt64Value : public ::google::protobuf::Message /* @@prot
};
// -------------------------------------------------------------------
class PROTOBUF_EXPORT Int32Value : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.Int32Value) */ {
class PROTOBUF_EXPORT Int32Value final :
public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.Int32Value) */ {
public:
Int32Value();
virtual ~Int32Value();
......@@ -723,7 +728,8 @@ class PROTOBUF_EXPORT Int32Value : public ::google::protobuf::Message /* @@proto
};
// -------------------------------------------------------------------
class PROTOBUF_EXPORT UInt32Value : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.UInt32Value) */ {
class PROTOBUF_EXPORT UInt32Value final :
public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.UInt32Value) */ {
public:
UInt32Value();
virtual ~UInt32Value();
......@@ -849,7 +855,8 @@ class PROTOBUF_EXPORT UInt32Value : public ::google::protobuf::Message /* @@prot
};
// -------------------------------------------------------------------
class PROTOBUF_EXPORT BoolValue : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.BoolValue) */ {
class PROTOBUF_EXPORT BoolValue final :
public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.BoolValue) */ {
public:
BoolValue();
virtual ~BoolValue();
......@@ -975,7 +982,8 @@ class PROTOBUF_EXPORT BoolValue : public ::google::protobuf::Message /* @@protoc
};
// -------------------------------------------------------------------
class PROTOBUF_EXPORT StringValue : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.StringValue) */ {
class PROTOBUF_EXPORT StringValue final :
public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.StringValue) */ {
public:
StringValue();
virtual ~StringValue();
......@@ -1118,7 +1126,8 @@ class PROTOBUF_EXPORT StringValue : public ::google::protobuf::Message /* @@prot
};
// -------------------------------------------------------------------
class PROTOBUF_EXPORT BytesValue : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.BytesValue) */ {
class PROTOBUF_EXPORT BytesValue final :
public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.BytesValue) */ {
public:
BytesValue();
virtual ~BytesValue();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment