summaryrefslogtreecommitdiffstats
path: root/third_party
diff options
context:
space:
mode:
authoragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-12 20:44:05 +0000
committeragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-12 20:44:05 +0000
commitb0ccb8c5811d2c666659a3e80097dddc84b24ba3 (patch)
tree8f6d4d97425c525e005a73649a1fb375140e4055 /third_party
parent1bbb76e872c1dd6284a244b76d81d49650b43a4f (diff)
downloadchromium_src-b0ccb8c5811d2c666659a3e80097dddc84b24ba3.zip
chromium_src-b0ccb8c5811d2c666659a3e80097dddc84b24ba3.tar.gz
chromium_src-b0ccb8c5811d2c666659a3e80097dddc84b24ba3.tar.bz2
protobuf: add unknown field retention to protobuf-lite.
BUG=56579 TEST=sync_unit_tests Review URL: http://codereview.chromium.org/3544012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@62331 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'third_party')
-rw-r--r--third_party/protobuf/protobuf.gyp2
-rw-r--r--third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_file.cc5
-rw-r--r--third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.h3
-rw-r--r--third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_message.cc19
-rw-r--r--third_party/protobuf/src/google/protobuf/compiler/java/java_helpers.h3
-rw-r--r--third_party/protobuf/src/google/protobuf/compiler/plugin.pb.cc27
-rw-r--r--third_party/protobuf/src/google/protobuf/descriptor.cc2
-rw-r--r--third_party/protobuf/src/google/protobuf/descriptor.pb.cc307
-rw-r--r--third_party/protobuf/src/google/protobuf/descriptor.pb.h50
-rw-r--r--third_party/protobuf/src/google/protobuf/descriptor.proto6
-rw-r--r--third_party/protobuf/src/google/protobuf/extension_set.cc22
-rw-r--r--third_party/protobuf/src/google/protobuf/extension_set.h14
-rw-r--r--third_party/protobuf/src/google/protobuf/extension_set_heavy.cc16
-rw-r--r--third_party/protobuf/src/google/protobuf/generated_message_reflection.cc12
-rw-r--r--third_party/protobuf/src/google/protobuf/unknown_field_set.cc20
-rw-r--r--third_party/protobuf/src/google/protobuf/wire_format.cc316
-rw-r--r--third_party/protobuf/src/google/protobuf/wire_format.h64
-rw-r--r--third_party/protobuf/src/google/protobuf/wire_format_lite.cc253
-rw-r--r--third_party/protobuf/src/google/protobuf/wire_format_lite.h70
19 files changed, 589 insertions, 622 deletions
diff --git a/third_party/protobuf/protobuf.gyp b/third_party/protobuf/protobuf.gyp
index 923ba77..ed81fd9 100644
--- a/third_party/protobuf/protobuf.gyp
+++ b/third_party/protobuf/protobuf.gyp
@@ -46,6 +46,8 @@
'src/google/protobuf/generated_message_util.h',
'src/google/protobuf/message_lite.h',
'src/google/protobuf/repeated_field.h',
+ 'src/google/protobuf/unknown_field_set.cc',
+ 'src/google/protobuf/unknown_field_set.h',
'src/google/protobuf/wire_format_lite.h',
'src/google/protobuf/wire_format_lite_inl.h',
'src/google/protobuf/io/coded_stream.h',
diff --git a/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_file.cc b/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_file.cc
index e31cb42..c24ae05 100644
--- a/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_file.cc
+++ b/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_file.cc
@@ -132,6 +132,11 @@ void FileGenerator::GenerateHeader(io::Printer* printer) {
"#include <google/protobuf/repeated_field.h>\n"
"#include <google/protobuf/extension_set.h>\n");
+ if (HasUnknownFields(file_)) {
+ printer->Print(
+ "#include <google/protobuf/unknown_field_set.h>\n");
+ }
+
if (HasDescriptorMethods(file_)) {
printer->Print(
"#include <google/protobuf/generated_message_reflection.h>\n");
diff --git a/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.h b/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.h
index f99b5fe..6a3a523 100644
--- a/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.h
+++ b/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.h
@@ -114,7 +114,8 @@ string GlobalShutdownFileName(const string& filename);
// Do message classes in this file keep track of unknown fields?
inline bool HasUnknownFields(const FileDescriptor *file) {
- return file->options().optimize_for() != FileOptions::LITE_RUNTIME;
+ return file->options().optimize_for() != FileOptions::LITE_RUNTIME ||
+ file->options().retain_unknown_fields();
}
// Does this file have generated parsing, serialization, and other
diff --git a/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_message.cc b/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_message.cc
index cbdcce8..02b6d20 100644
--- a/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_message.cc
+++ b/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_message.cc
@@ -1383,7 +1383,7 @@ GenerateMergeFromCodedStream(io::Printer* printer) {
" mutable_unknown_fields()));\n");
} else {
printer->Print(
- " DO_(_extensions_.ParseField(tag, input, default_instance_));\n");
+ " DO_(_extensions_.ParseField(tag, input, default_instance_, NULL));\n");
}
printer->Print(
" continue;\n"
@@ -1393,11 +1393,10 @@ GenerateMergeFromCodedStream(io::Printer* printer) {
// We really don't recognize this tag. Skip it.
if (HasUnknownFields(descriptor_->file())) {
printer->Print(
- "DO_(::google::protobuf::internal::WireFormat::SkipField(\n"
- " input, tag, mutable_unknown_fields()));\n");
+ "DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag, mutable_unknown_fields()));\n");
} else {
printer->Print(
- "DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));\n");
+ "DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag, NULL));\n");
}
if (descriptor_->field_count() > 0) {
@@ -1472,7 +1471,7 @@ GenerateSerializeWithCachedSizes(io::Printer* printer) {
"classname", classname_);
if (HasUnknownFields(descriptor_->file())) {
printer->Print(
- " ::google::protobuf::internal::WireFormat::SerializeUnknownMessageSetItems(\n"
+ " ::google::protobuf::internal::WireFormatLite::SerializeUnknownMessageSetItems(\n"
" unknown_fields(), output);\n");
}
printer->Print(
@@ -1505,7 +1504,7 @@ GenerateSerializeWithCachedSizesToArray(io::Printer* printer) {
"classname", classname_);
if (HasUnknownFields(descriptor_->file())) {
printer->Print(
- " target = ::google::protobuf::internal::WireFormat::\n"
+ " target = ::google::protobuf::internal::WireFormatLite::\n"
" SerializeUnknownMessageSetItemsToArray(\n"
" unknown_fields(), target);\n");
}
@@ -1567,11 +1566,11 @@ GenerateSerializeWithCachedSizesBody(io::Printer* printer, bool to_array) {
if (to_array) {
printer->Print(
"target = "
- "::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(\n"
+ "::google::protobuf::internal::WireFormatLite::SerializeUnknownFieldsToArray(\n"
" unknown_fields(), target);\n");
} else {
printer->Print(
- "::google::protobuf::internal::WireFormat::SerializeUnknownFields(\n"
+ "::google::protobuf::internal::WireFormatLite::SerializeUnknownFields(\n"
" unknown_fields(), output);\n");
}
printer->Outdent();
@@ -1591,7 +1590,7 @@ GenerateByteSize(io::Printer* printer) {
"classname", classname_);
if (HasUnknownFields(descriptor_->file())) {
printer->Print(
- " total_size += ::google::protobuf::internal::WireFormat::\n"
+ " total_size += ::google::protobuf::internal::WireFormatLite::\n"
" ComputeUnknownMessageSetItemsSize(unknown_fields());\n");
}
printer->Print(
@@ -1677,7 +1676,7 @@ GenerateByteSize(io::Printer* printer) {
printer->Indent();
printer->Print(
"total_size +=\n"
- " ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(\n"
+ " ::google::protobuf::internal::WireFormatLite::ComputeUnknownFieldsSize(\n"
" unknown_fields());\n");
printer->Outdent();
printer->Print("}\n");
diff --git a/third_party/protobuf/src/google/protobuf/compiler/java/java_helpers.h b/third_party/protobuf/src/google/protobuf/compiler/java/java_helpers.h
index 3c8974c..002e177 100644
--- a/third_party/protobuf/src/google/protobuf/compiler/java/java_helpers.h
+++ b/third_party/protobuf/src/google/protobuf/compiler/java/java_helpers.h
@@ -122,7 +122,8 @@ string DefaultValue(const FieldDescriptor* field);
// Does this message class keep track of unknown fields?
inline bool HasUnknownFields(const Descriptor* descriptor) {
return descriptor->file()->options().optimize_for() !=
- FileOptions::LITE_RUNTIME;
+ FileOptions::LITE_RUNTIME ||
+ descriptor->file()->options().retain_unknown_fields();
}
// Does this message class have generated parsing, serialization, and other
diff --git a/third_party/protobuf/src/google/protobuf/compiler/plugin.pb.cc b/third_party/protobuf/src/google/protobuf/compiler/plugin.pb.cc
index 13d35c6..62e7829f 100644
--- a/third_party/protobuf/src/google/protobuf/compiler/plugin.pb.cc
+++ b/third_party/protobuf/src/google/protobuf/compiler/plugin.pb.cc
@@ -293,8 +293,7 @@ bool CodeGeneratorRequest::MergePartialFromCodedStream(
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
return true;
}
- DO_(::google::protobuf::internal::WireFormat::SkipField(
- input, tag, mutable_unknown_fields()));
+ DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag, mutable_unknown_fields()));
break;
}
}
@@ -330,7 +329,7 @@ void CodeGeneratorRequest::SerializeWithCachedSizes(
}
if (!unknown_fields().empty()) {
- ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
+ ::google::protobuf::internal::WireFormatLite::SerializeUnknownFields(
unknown_fields(), output);
}
}
@@ -364,7 +363,7 @@ void CodeGeneratorRequest::SerializeWithCachedSizes(
}
if (!unknown_fields().empty()) {
- target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
+ target = ::google::protobuf::internal::WireFormatLite::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
return target;
@@ -399,7 +398,7 @@ int CodeGeneratorRequest::ByteSize() const {
if (!unknown_fields().empty()) {
total_size +=
- ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
+ ::google::protobuf::internal::WireFormatLite::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
@@ -627,8 +626,7 @@ bool CodeGeneratorResponse_File::MergePartialFromCodedStream(
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
return true;
}
- DO_(::google::protobuf::internal::WireFormat::SkipField(
- input, tag, mutable_unknown_fields()));
+ DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag, mutable_unknown_fields()));
break;
}
}
@@ -667,7 +665,7 @@ void CodeGeneratorResponse_File::SerializeWithCachedSizes(
}
if (!unknown_fields().empty()) {
- ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
+ ::google::protobuf::internal::WireFormatLite::SerializeUnknownFields(
unknown_fields(), output);
}
}
@@ -705,7 +703,7 @@ void CodeGeneratorResponse_File::SerializeWithCachedSizes(
}
if (!unknown_fields().empty()) {
- target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
+ target = ::google::protobuf::internal::WireFormatLite::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
return target;
@@ -739,7 +737,7 @@ int CodeGeneratorResponse_File::ByteSize() const {
}
if (!unknown_fields().empty()) {
total_size +=
- ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
+ ::google::protobuf::internal::WireFormatLite::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
@@ -929,8 +927,7 @@ bool CodeGeneratorResponse::MergePartialFromCodedStream(
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
return true;
}
- DO_(::google::protobuf::internal::WireFormat::SkipField(
- input, tag, mutable_unknown_fields()));
+ DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag, mutable_unknown_fields()));
break;
}
}
@@ -957,7 +954,7 @@ void CodeGeneratorResponse::SerializeWithCachedSizes(
}
if (!unknown_fields().empty()) {
- ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
+ ::google::protobuf::internal::WireFormatLite::SerializeUnknownFields(
unknown_fields(), output);
}
}
@@ -982,7 +979,7 @@ void CodeGeneratorResponse::SerializeWithCachedSizes(
}
if (!unknown_fields().empty()) {
- target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
+ target = ::google::protobuf::internal::WireFormatLite::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
return target;
@@ -1010,7 +1007,7 @@ int CodeGeneratorResponse::ByteSize() const {
if (!unknown_fields().empty()) {
total_size +=
- ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
+ ::google::protobuf::internal::WireFormatLite::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
diff --git a/third_party/protobuf/src/google/protobuf/descriptor.cc b/third_party/protobuf/src/google/protobuf/descriptor.cc
index 9226dfb..6c9648b 100644
--- a/third_party/protobuf/src/google/protobuf/descriptor.cc
+++ b/third_party/protobuf/src/google/protobuf/descriptor.cc
@@ -4014,7 +4014,7 @@ bool DescriptorBuilder::OptionInterpreter::InterpretSingleOption(
io::StringOutputStream outstr(
parent_unknown_fields->AddLengthDelimited((*iter)->number()));
io::CodedOutputStream out(&outstr);
- internal::WireFormat::SerializeUnknownFields(*unknown_fields, &out);
+ internal::WireFormatLite::SerializeUnknownFields(*unknown_fields, &out);
GOOGLE_CHECK(!out.HadError())
<< "Unexpected failure while serializing option submessage "
<< debug_msg_name << "\".";
diff --git a/third_party/protobuf/src/google/protobuf/descriptor.pb.cc b/third_party/protobuf/src/google/protobuf/descriptor.pb.cc
index 922237f..c9f1079 100644
--- a/third_party/protobuf/src/google/protobuf/descriptor.pb.cc
+++ b/third_party/protobuf/src/google/protobuf/descriptor.pb.cc
@@ -254,10 +254,11 @@ void protobuf_AssignDesc_google_2fprotobuf_2fdescriptor_2eproto() {
::google::protobuf::MessageFactory::generated_factory(),
sizeof(MethodDescriptorProto));
FileOptions_descriptor_ = file->message_type(8);
- static const int FileOptions_offsets_[8] = {
+ static const int FileOptions_offsets_[9] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, java_package_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, java_outer_classname_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, java_multiple_files_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, retain_unknown_fields_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, optimize_for_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, cc_generic_services_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, java_generic_services_),
@@ -559,47 +560,47 @@ void protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto() {
"ptions\"\177\n\025MethodDescriptorProto\022\014\n\004name\030"
"\001 \001(\t\022\022\n\ninput_type\030\002 \001(\t\022\023\n\013output_type"
"\030\003 \001(\t\022/\n\007options\030\004 \001(\0132\036.google.protobu"
- "f.MethodOptions\"\244\003\n\013FileOptions\022\024\n\014java_"
+ "f.MethodOptions\"\312\003\n\013FileOptions\022\024\n\014java_"
"package\030\001 \001(\t\022\034\n\024java_outer_classname\030\010 "
"\001(\t\022\"\n\023java_multiple_files\030\n \001(\010:\005false\022"
- "F\n\014optimize_for\030\t \001(\0162).google.protobuf."
- "FileOptions.OptimizeMode:\005SPEED\022!\n\023cc_ge"
- "neric_services\030\020 \001(\010:\004true\022#\n\025java_gener"
- "ic_services\030\021 \001(\010:\004true\022!\n\023py_generic_se"
- "rvices\030\022 \001(\010:\004true\022C\n\024uninterpreted_opti"
- "on\030\347\007 \003(\0132$.google.protobuf.Uninterprete"
- "dOption\":\n\014OptimizeMode\022\t\n\005SPEED\020\001\022\r\n\tCO"
- "DE_SIZE\020\002\022\020\n\014LITE_RUNTIME\020\003*\t\010\350\007\020\200\200\200\200\002\"\270"
- "\001\n\016MessageOptions\022&\n\027message_set_wire_fo"
- "rmat\030\001 \001(\010:\005false\022.\n\037no_standard_descrip"
- "tor_accessor\030\002 \001(\010:\005false\022C\n\024uninterpret"
- "ed_option\030\347\007 \003(\0132$.google.protobuf.Unint"
- "erpretedOption*\t\010\350\007\020\200\200\200\200\002\"\224\002\n\014FieldOptio"
- "ns\022:\n\005ctype\030\001 \001(\0162#.google.protobuf.Fiel"
- "dOptions.CType:\006STRING\022\016\n\006packed\030\002 \001(\010\022\031"
- "\n\ndeprecated\030\003 \001(\010:\005false\022\034\n\024experimenta"
- "l_map_key\030\t \001(\t\022C\n\024uninterpreted_option\030"
- "\347\007 \003(\0132$.google.protobuf.UninterpretedOp"
- "tion\"/\n\005CType\022\n\n\006STRING\020\000\022\010\n\004CORD\020\001\022\020\n\014S"
- "TRING_PIECE\020\002*\t\010\350\007\020\200\200\200\200\002\"]\n\013EnumOptions\022"
- "C\n\024uninterpreted_option\030\347\007 \003(\0132$.google."
- "protobuf.UninterpretedOption*\t\010\350\007\020\200\200\200\200\002\""
- "b\n\020EnumValueOptions\022C\n\024uninterpreted_opt"
- "ion\030\347\007 \003(\0132$.google.protobuf.Uninterpret"
- "edOption*\t\010\350\007\020\200\200\200\200\002\"`\n\016ServiceOptions\022C\n"
+ "$\n\025retain_unknown_fields\030\013 \001(\010:\005false\022F\n"
+ "\014optimize_for\030\t \001(\0162).google.protobuf.Fi"
+ "leOptions.OptimizeMode:\005SPEED\022!\n\023cc_gene"
+ "ric_services\030\020 \001(\010:\004true\022#\n\025java_generic"
+ "_services\030\021 \001(\010:\004true\022!\n\023py_generic_serv"
+ "ices\030\022 \001(\010:\004true\022C\n\024uninterpreted_option"
+ "\030\347\007 \003(\0132$.google.protobuf.UninterpretedO"
+ "ption\":\n\014OptimizeMode\022\t\n\005SPEED\020\001\022\r\n\tCODE"
+ "_SIZE\020\002\022\020\n\014LITE_RUNTIME\020\003*\t\010\350\007\020\200\200\200\200\002\"\270\001\n"
+ "\016MessageOptions\022&\n\027message_set_wire_form"
+ "at\030\001 \001(\010:\005false\022.\n\037no_standard_descripto"
+ "r_accessor\030\002 \001(\010:\005false\022C\n\024uninterpreted"
+ "_option\030\347\007 \003(\0132$.google.protobuf.Uninter"
+ "pretedOption*\t\010\350\007\020\200\200\200\200\002\"\224\002\n\014FieldOptions"
+ "\022:\n\005ctype\030\001 \001(\0162#.google.protobuf.FieldO"
+ "ptions.CType:\006STRING\022\016\n\006packed\030\002 \001(\010\022\031\n\n"
+ "deprecated\030\003 \001(\010:\005false\022\034\n\024experimental_"
+ "map_key\030\t \001(\t\022C\n\024uninterpreted_option\030\347\007"
+ " \003(\0132$.google.protobuf.UninterpretedOpti"
+ "on\"/\n\005CType\022\n\n\006STRING\020\000\022\010\n\004CORD\020\001\022\020\n\014STR"
+ "ING_PIECE\020\002*\t\010\350\007\020\200\200\200\200\002\"]\n\013EnumOptions\022C\n"
"\024uninterpreted_option\030\347\007 \003(\0132$.google.pr"
- "otobuf.UninterpretedOption*\t\010\350\007\020\200\200\200\200\002\"_\n"
- "\rMethodOptions\022C\n\024uninterpreted_option\030\347"
- "\007 \003(\0132$.google.protobuf.UninterpretedOpt"
- "ion*\t\010\350\007\020\200\200\200\200\002\"\205\002\n\023UninterpretedOption\022;"
- "\n\004name\030\002 \003(\0132-.google.protobuf.Uninterpr"
- "etedOption.NamePart\022\030\n\020identifier_value\030"
- "\003 \001(\t\022\032\n\022positive_int_value\030\004 \001(\004\022\032\n\022neg"
- "ative_int_value\030\005 \001(\003\022\024\n\014double_value\030\006 "
- "\001(\001\022\024\n\014string_value\030\007 \001(\014\0323\n\010NamePart\022\021\n"
- "\tname_part\030\001 \002(\t\022\024\n\014is_extension\030\002 \002(\010B)"
- "\n\023com.google.protobufB\020DescriptorProtosH"
- "\001", 3681);
+ "otobuf.UninterpretedOption*\t\010\350\007\020\200\200\200\200\002\"b\n"
+ "\020EnumValueOptions\022C\n\024uninterpreted_optio"
+ "n\030\347\007 \003(\0132$.google.protobuf.Uninterpreted"
+ "Option*\t\010\350\007\020\200\200\200\200\002\"`\n\016ServiceOptions\022C\n\024u"
+ "ninterpreted_option\030\347\007 \003(\0132$.google.prot"
+ "obuf.UninterpretedOption*\t\010\350\007\020\200\200\200\200\002\"_\n\rM"
+ "ethodOptions\022C\n\024uninterpreted_option\030\347\007 "
+ "\003(\0132$.google.protobuf.UninterpretedOptio"
+ "n*\t\010\350\007\020\200\200\200\200\002\"\205\002\n\023UninterpretedOption\022;\n\004"
+ "name\030\002 \003(\0132-.google.protobuf.Uninterpret"
+ "edOption.NamePart\022\030\n\020identifier_value\030\003 "
+ "\001(\t\022\032\n\022positive_int_value\030\004 \001(\004\022\032\n\022negat"
+ "ive_int_value\030\005 \001(\003\022\024\n\014double_value\030\006 \001("
+ "\001\022\024\n\014string_value\030\007 \001(\014\0323\n\010NamePart\022\021\n\tn"
+ "ame_part\030\001 \002(\t\022\024\n\014is_extension\030\002 \002(\010B)\n\023"
+ "com.google.protobufB\020DescriptorProtosH\001", 3719);
::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
"google/protobuf/descriptor.proto", &protobuf_RegisterTypes);
FileDescriptorSet::default_instance_ = new FileDescriptorSet();
@@ -736,8 +737,7 @@ bool FileDescriptorSet::MergePartialFromCodedStream(
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
return true;
}
- DO_(::google::protobuf::internal::WireFormat::SkipField(
- input, tag, mutable_unknown_fields()));
+ DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag, mutable_unknown_fields()));
break;
}
}
@@ -755,7 +755,7 @@ void FileDescriptorSet::SerializeWithCachedSizes(
}
if (!unknown_fields().empty()) {
- ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
+ ::google::protobuf::internal::WireFormatLite::SerializeUnknownFields(
unknown_fields(), output);
}
}
@@ -770,7 +770,7 @@ void FileDescriptorSet::SerializeWithCachedSizes(
}
if (!unknown_fields().empty()) {
- target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
+ target = ::google::protobuf::internal::WireFormatLite::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
return target;
@@ -789,7 +789,7 @@ int FileDescriptorSet::ByteSize() const {
if (!unknown_fields().empty()) {
total_size +=
- ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
+ ::google::protobuf::internal::WireFormatLite::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
@@ -1090,8 +1090,7 @@ bool FileDescriptorProto::MergePartialFromCodedStream(
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
return true;
}
- DO_(::google::protobuf::internal::WireFormat::SkipField(
- input, tag, mutable_unknown_fields()));
+ DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag, mutable_unknown_fields()));
break;
}
}
@@ -1160,7 +1159,7 @@ void FileDescriptorProto::SerializeWithCachedSizes(
}
if (!unknown_fields().empty()) {
- ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
+ ::google::protobuf::internal::WireFormatLite::SerializeUnknownFields(
unknown_fields(), output);
}
}
@@ -1232,7 +1231,7 @@ void FileDescriptorProto::SerializeWithCachedSizes(
}
if (!unknown_fields().empty()) {
- target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
+ target = ::google::protobuf::internal::WireFormatLite::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
return target;
@@ -1305,7 +1304,7 @@ int FileDescriptorProto::ByteSize() const {
if (!unknown_fields().empty()) {
total_size +=
- ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
+ ::google::protobuf::internal::WireFormatLite::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
@@ -1513,8 +1512,7 @@ bool DescriptorProto_ExtensionRange::MergePartialFromCodedStream(
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
return true;
}
- DO_(::google::protobuf::internal::WireFormat::SkipField(
- input, tag, mutable_unknown_fields()));
+ DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag, mutable_unknown_fields()));
break;
}
}
@@ -1536,7 +1534,7 @@ void DescriptorProto_ExtensionRange::SerializeWithCachedSizes(
}
if (!unknown_fields().empty()) {
- ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
+ ::google::protobuf::internal::WireFormatLite::SerializeUnknownFields(
unknown_fields(), output);
}
}
@@ -1554,7 +1552,7 @@ void DescriptorProto_ExtensionRange::SerializeWithCachedSizes(
}
if (!unknown_fields().empty()) {
- target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
+ target = ::google::protobuf::internal::WireFormatLite::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
return target;
@@ -1581,7 +1579,7 @@ int DescriptorProto_ExtensionRange::ByteSize() const {
}
if (!unknown_fields().empty()) {
total_size +=
- ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
+ ::google::protobuf::internal::WireFormatLite::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
@@ -1856,8 +1854,7 @@ bool DescriptorProto::MergePartialFromCodedStream(
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
return true;
}
- DO_(::google::protobuf::internal::WireFormat::SkipField(
- input, tag, mutable_unknown_fields()));
+ DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag, mutable_unknown_fields()));
break;
}
}
@@ -1914,7 +1911,7 @@ void DescriptorProto::SerializeWithCachedSizes(
}
if (!unknown_fields().empty()) {
- ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
+ ::google::protobuf::internal::WireFormatLite::SerializeUnknownFields(
unknown_fields(), output);
}
}
@@ -1974,7 +1971,7 @@ void DescriptorProto::SerializeWithCachedSizes(
}
if (!unknown_fields().empty()) {
- target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
+ target = ::google::protobuf::internal::WireFormatLite::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
return target;
@@ -2041,7 +2038,7 @@ int DescriptorProto::ByteSize() const {
if (!unknown_fields().empty()) {
total_size +=
- ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
+ ::google::protobuf::internal::WireFormatLite::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
@@ -2483,8 +2480,7 @@ bool FieldDescriptorProto::MergePartialFromCodedStream(
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
return true;
}
- DO_(::google::protobuf::internal::WireFormat::SkipField(
- input, tag, mutable_unknown_fields()));
+ DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag, mutable_unknown_fields()));
break;
}
}
@@ -2555,7 +2551,7 @@ void FieldDescriptorProto::SerializeWithCachedSizes(
}
if (!unknown_fields().empty()) {
- ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
+ ::google::protobuf::internal::WireFormatLite::SerializeUnknownFields(
unknown_fields(), output);
}
}
@@ -2627,7 +2623,7 @@ void FieldDescriptorProto::SerializeWithCachedSizes(
}
if (!unknown_fields().empty()) {
- target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
+ target = ::google::protobuf::internal::WireFormatLite::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
return target;
@@ -2694,7 +2690,7 @@ int FieldDescriptorProto::ByteSize() const {
}
if (!unknown_fields().empty()) {
total_size +=
- ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
+ ::google::protobuf::internal::WireFormatLite::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
@@ -2928,8 +2924,7 @@ bool EnumDescriptorProto::MergePartialFromCodedStream(
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
return true;
}
- DO_(::google::protobuf::internal::WireFormat::SkipField(
- input, tag, mutable_unknown_fields()));
+ DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag, mutable_unknown_fields()));
break;
}
}
@@ -2962,7 +2957,7 @@ void EnumDescriptorProto::SerializeWithCachedSizes(
}
if (!unknown_fields().empty()) {
- ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
+ ::google::protobuf::internal::WireFormatLite::SerializeUnknownFields(
unknown_fields(), output);
}
}
@@ -2994,7 +2989,7 @@ void EnumDescriptorProto::SerializeWithCachedSizes(
}
if (!unknown_fields().empty()) {
- target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
+ target = ::google::protobuf::internal::WireFormatLite::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
return target;
@@ -3029,7 +3024,7 @@ int EnumDescriptorProto::ByteSize() const {
if (!unknown_fields().empty()) {
total_size +=
- ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
+ ::google::protobuf::internal::WireFormatLite::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
@@ -3246,8 +3241,7 @@ bool EnumValueDescriptorProto::MergePartialFromCodedStream(
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
return true;
}
- DO_(::google::protobuf::internal::WireFormat::SkipField(
- input, tag, mutable_unknown_fields()));
+ DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag, mutable_unknown_fields()));
break;
}
}
@@ -3279,7 +3273,7 @@ void EnumValueDescriptorProto::SerializeWithCachedSizes(
}
if (!unknown_fields().empty()) {
- ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
+ ::google::protobuf::internal::WireFormatLite::SerializeUnknownFields(
unknown_fields(), output);
}
}
@@ -3309,7 +3303,7 @@ void EnumValueDescriptorProto::SerializeWithCachedSizes(
}
if (!unknown_fields().empty()) {
- target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
+ target = ::google::protobuf::internal::WireFormatLite::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
return target;
@@ -3343,7 +3337,7 @@ int EnumValueDescriptorProto::ByteSize() const {
}
if (!unknown_fields().empty()) {
total_size +=
- ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
+ ::google::protobuf::internal::WireFormatLite::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
@@ -3557,8 +3551,7 @@ bool ServiceDescriptorProto::MergePartialFromCodedStream(
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
return true;
}
- DO_(::google::protobuf::internal::WireFormat::SkipField(
- input, tag, mutable_unknown_fields()));
+ DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag, mutable_unknown_fields()));
break;
}
}
@@ -3591,7 +3584,7 @@ void ServiceDescriptorProto::SerializeWithCachedSizes(
}
if (!unknown_fields().empty()) {
- ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
+ ::google::protobuf::internal::WireFormatLite::SerializeUnknownFields(
unknown_fields(), output);
}
}
@@ -3623,7 +3616,7 @@ void ServiceDescriptorProto::SerializeWithCachedSizes(
}
if (!unknown_fields().empty()) {
- target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
+ target = ::google::protobuf::internal::WireFormatLite::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
return target;
@@ -3658,7 +3651,7 @@ int ServiceDescriptorProto::ByteSize() const {
if (!unknown_fields().empty()) {
total_size +=
- ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
+ ::google::protobuf::internal::WireFormatLite::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
@@ -3912,8 +3905,7 @@ bool MethodDescriptorProto::MergePartialFromCodedStream(
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
return true;
}
- DO_(::google::protobuf::internal::WireFormat::SkipField(
- input, tag, mutable_unknown_fields()));
+ DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag, mutable_unknown_fields()));
break;
}
}
@@ -3958,7 +3950,7 @@ void MethodDescriptorProto::SerializeWithCachedSizes(
}
if (!unknown_fields().empty()) {
- ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
+ ::google::protobuf::internal::WireFormatLite::SerializeUnknownFields(
unknown_fields(), output);
}
}
@@ -4003,7 +3995,7 @@ void MethodDescriptorProto::SerializeWithCachedSizes(
}
if (!unknown_fields().empty()) {
- target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
+ target = ::google::protobuf::internal::WireFormatLite::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
return target;
@@ -4044,7 +4036,7 @@ int MethodDescriptorProto::ByteSize() const {
}
if (!unknown_fields().empty()) {
total_size +=
- ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
+ ::google::protobuf::internal::WireFormatLite::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
@@ -4156,6 +4148,7 @@ const ::std::string FileOptions::_default_java_outer_classname_;
const int FileOptions::kJavaPackageFieldNumber;
const int FileOptions::kJavaOuterClassnameFieldNumber;
const int FileOptions::kJavaMultipleFilesFieldNumber;
+const int FileOptions::kRetainUnknownFieldsFieldNumber;
const int FileOptions::kOptimizeForFieldNumber;
const int FileOptions::kCcGenericServicesFieldNumber;
const int FileOptions::kJavaGenericServicesFieldNumber;
@@ -4182,6 +4175,7 @@ void FileOptions::SharedCtor() {
java_package_ = const_cast< ::std::string*>(&_default_java_package_);
java_outer_classname_ = const_cast< ::std::string*>(&_default_java_outer_classname_);
java_multiple_files_ = false;
+ retain_unknown_fields_ = false;
optimize_for_ = 1;
cc_generic_services_ = true;
java_generic_services_ = true;
@@ -4238,6 +4232,7 @@ void FileOptions::Clear() {
}
}
java_multiple_files_ = false;
+ retain_unknown_fields_ = false;
optimize_for_ = 1;
cc_generic_services_ = true;
java_generic_services_ = true;
@@ -4320,6 +4315,22 @@ bool FileOptions::MergePartialFromCodedStream(
} else {
goto handle_uninterpreted;
}
+ if (input->ExpectTag(88)) goto parse_retain_unknown_fields;
+ break;
+ }
+
+ // optional bool retain_unknown_fields = 11 [default = false];
+ case 11: {
+ if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+ ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
+ parse_retain_unknown_fields:
+ DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+ bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
+ input, &retain_unknown_fields_)));
+ _set_bit(3);
+ } else {
+ goto handle_uninterpreted;
+ }
if (input->ExpectTag(128)) goto parse_cc_generic_services;
break;
}
@@ -4332,7 +4343,7 @@ bool FileOptions::MergePartialFromCodedStream(
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
input, &cc_generic_services_)));
- _set_bit(4);
+ _set_bit(5);
} else {
goto handle_uninterpreted;
}
@@ -4348,7 +4359,7 @@ bool FileOptions::MergePartialFromCodedStream(
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
input, &java_generic_services_)));
- _set_bit(5);
+ _set_bit(6);
} else {
goto handle_uninterpreted;
}
@@ -4364,7 +4375,7 @@ bool FileOptions::MergePartialFromCodedStream(
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
input, &py_generic_services_)));
- _set_bit(6);
+ _set_bit(7);
} else {
goto handle_uninterpreted;
}
@@ -4398,8 +4409,7 @@ bool FileOptions::MergePartialFromCodedStream(
mutable_unknown_fields()));
continue;
}
- DO_(::google::protobuf::internal::WireFormat::SkipField(
- input, tag, mutable_unknown_fields()));
+ DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag, mutable_unknown_fields()));
break;
}
}
@@ -4429,7 +4439,7 @@ void FileOptions::SerializeWithCachedSizes(
}
// optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 [default = SPEED];
- if (_has_bit(3)) {
+ if (_has_bit(4)) {
::google::protobuf::internal::WireFormatLite::WriteEnum(
9, this->optimize_for(), output);
}
@@ -4439,18 +4449,23 @@ void FileOptions::SerializeWithCachedSizes(
::google::protobuf::internal::WireFormatLite::WriteBool(10, this->java_multiple_files(), output);
}
+ // optional bool retain_unknown_fields = 11 [default = false];
+ if (_has_bit(3)) {
+ ::google::protobuf::internal::WireFormatLite::WriteBool(11, this->retain_unknown_fields(), output);
+ }
+
// optional bool cc_generic_services = 16 [default = true];
- if (_has_bit(4)) {
+ if (_has_bit(5)) {
::google::protobuf::internal::WireFormatLite::WriteBool(16, this->cc_generic_services(), output);
}
// optional bool java_generic_services = 17 [default = true];
- if (_has_bit(5)) {
+ if (_has_bit(6)) {
::google::protobuf::internal::WireFormatLite::WriteBool(17, this->java_generic_services(), output);
}
// optional bool py_generic_services = 18 [default = true];
- if (_has_bit(6)) {
+ if (_has_bit(7)) {
::google::protobuf::internal::WireFormatLite::WriteBool(18, this->py_generic_services(), output);
}
@@ -4465,7 +4480,7 @@ void FileOptions::SerializeWithCachedSizes(
1000, 536870912, output);
if (!unknown_fields().empty()) {
- ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
+ ::google::protobuf::internal::WireFormatLite::SerializeUnknownFields(
unknown_fields(), output);
}
}
@@ -4493,7 +4508,7 @@ void FileOptions::SerializeWithCachedSizes(
}
// optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 [default = SPEED];
- if (_has_bit(3)) {
+ if (_has_bit(4)) {
target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
9, this->optimize_for(), target);
}
@@ -4503,18 +4518,23 @@ void FileOptions::SerializeWithCachedSizes(
target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(10, this->java_multiple_files(), target);
}
+ // optional bool retain_unknown_fields = 11 [default = false];
+ if (_has_bit(3)) {
+ target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(11, this->retain_unknown_fields(), target);
+ }
+
// optional bool cc_generic_services = 16 [default = true];
- if (_has_bit(4)) {
+ if (_has_bit(5)) {
target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(16, this->cc_generic_services(), target);
}
// optional bool java_generic_services = 17 [default = true];
- if (_has_bit(5)) {
+ if (_has_bit(6)) {
target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(17, this->java_generic_services(), target);
}
// optional bool py_generic_services = 18 [default = true];
- if (_has_bit(6)) {
+ if (_has_bit(7)) {
target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(18, this->py_generic_services(), target);
}
@@ -4530,7 +4550,7 @@ void FileOptions::SerializeWithCachedSizes(
1000, 536870912, target);
if (!unknown_fields().empty()) {
- target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
+ target = ::google::protobuf::internal::WireFormatLite::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
return target;
@@ -4559,6 +4579,11 @@ int FileOptions::ByteSize() const {
total_size += 1 + 1;
}
+ // optional bool retain_unknown_fields = 11 [default = false];
+ if (has_retain_unknown_fields()) {
+ total_size += 1 + 1;
+ }
+
// optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 [default = SPEED];
if (has_optimize_for()) {
total_size += 1 +
@@ -4593,7 +4618,7 @@ int FileOptions::ByteSize() const {
if (!unknown_fields().empty()) {
total_size +=
- ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
+ ::google::protobuf::internal::WireFormatLite::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
@@ -4628,15 +4653,18 @@ void FileOptions::MergeFrom(const FileOptions& from) {
set_java_multiple_files(from.java_multiple_files());
}
if (from._has_bit(3)) {
- set_optimize_for(from.optimize_for());
+ set_retain_unknown_fields(from.retain_unknown_fields());
}
if (from._has_bit(4)) {
- set_cc_generic_services(from.cc_generic_services());
+ set_optimize_for(from.optimize_for());
}
if (from._has_bit(5)) {
- set_java_generic_services(from.java_generic_services());
+ set_cc_generic_services(from.cc_generic_services());
}
if (from._has_bit(6)) {
+ set_java_generic_services(from.java_generic_services());
+ }
+ if (from._has_bit(7)) {
set_py_generic_services(from.py_generic_services());
}
}
@@ -4670,6 +4698,7 @@ void FileOptions::Swap(FileOptions* other) {
std::swap(java_package_, other->java_package_);
std::swap(java_outer_classname_, other->java_outer_classname_);
std::swap(java_multiple_files_, other->java_multiple_files_);
+ std::swap(retain_unknown_fields_, other->retain_unknown_fields_);
std::swap(optimize_for_, other->optimize_for_);
std::swap(cc_generic_services_, other->cc_generic_services_);
std::swap(java_generic_services_, other->java_generic_services_);
@@ -4823,8 +4852,7 @@ bool MessageOptions::MergePartialFromCodedStream(
mutable_unknown_fields()));
continue;
}
- DO_(::google::protobuf::internal::WireFormat::SkipField(
- input, tag, mutable_unknown_fields()));
+ DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag, mutable_unknown_fields()));
break;
}
}
@@ -4856,7 +4884,7 @@ void MessageOptions::SerializeWithCachedSizes(
1000, 536870912, output);
if (!unknown_fields().empty()) {
- ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
+ ::google::protobuf::internal::WireFormatLite::SerializeUnknownFields(
unknown_fields(), output);
}
}
@@ -4885,7 +4913,7 @@ void MessageOptions::SerializeWithCachedSizes(
1000, 536870912, target);
if (!unknown_fields().empty()) {
- target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
+ target = ::google::protobuf::internal::WireFormatLite::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
return target;
@@ -4918,7 +4946,7 @@ int MessageOptions::ByteSize() const {
if (!unknown_fields().empty()) {
total_size +=
- ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
+ ::google::protobuf::internal::WireFormatLite::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
@@ -5203,8 +5231,7 @@ bool FieldOptions::MergePartialFromCodedStream(
mutable_unknown_fields()));
continue;
}
- DO_(::google::protobuf::internal::WireFormat::SkipField(
- input, tag, mutable_unknown_fields()));
+ DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag, mutable_unknown_fields()));
break;
}
}
@@ -5251,7 +5278,7 @@ void FieldOptions::SerializeWithCachedSizes(
1000, 536870912, output);
if (!unknown_fields().empty()) {
- ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
+ ::google::protobuf::internal::WireFormatLite::SerializeUnknownFields(
unknown_fields(), output);
}
}
@@ -5296,7 +5323,7 @@ void FieldOptions::SerializeWithCachedSizes(
1000, 536870912, target);
if (!unknown_fields().empty()) {
- target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
+ target = ::google::protobuf::internal::WireFormatLite::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
return target;
@@ -5342,7 +5369,7 @@ int FieldOptions::ByteSize() const {
if (!unknown_fields().empty()) {
total_size +=
- ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
+ ::google::protobuf::internal::WireFormatLite::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
@@ -5521,8 +5548,7 @@ bool EnumOptions::MergePartialFromCodedStream(
mutable_unknown_fields()));
continue;
}
- DO_(::google::protobuf::internal::WireFormat::SkipField(
- input, tag, mutable_unknown_fields()));
+ DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag, mutable_unknown_fields()));
break;
}
}
@@ -5544,7 +5570,7 @@ void EnumOptions::SerializeWithCachedSizes(
1000, 536870912, output);
if (!unknown_fields().empty()) {
- ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
+ ::google::protobuf::internal::WireFormatLite::SerializeUnknownFields(
unknown_fields(), output);
}
}
@@ -5563,7 +5589,7 @@ void EnumOptions::SerializeWithCachedSizes(
1000, 536870912, target);
if (!unknown_fields().empty()) {
- target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
+ target = ::google::protobuf::internal::WireFormatLite::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
return target;
@@ -5584,7 +5610,7 @@ int EnumOptions::ByteSize() const {
if (!unknown_fields().empty()) {
total_size +=
- ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
+ ::google::protobuf::internal::WireFormatLite::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
@@ -5745,8 +5771,7 @@ bool EnumValueOptions::MergePartialFromCodedStream(
mutable_unknown_fields()));
continue;
}
- DO_(::google::protobuf::internal::WireFormat::SkipField(
- input, tag, mutable_unknown_fields()));
+ DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag, mutable_unknown_fields()));
break;
}
}
@@ -5768,7 +5793,7 @@ void EnumValueOptions::SerializeWithCachedSizes(
1000, 536870912, output);
if (!unknown_fields().empty()) {
- ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
+ ::google::protobuf::internal::WireFormatLite::SerializeUnknownFields(
unknown_fields(), output);
}
}
@@ -5787,7 +5812,7 @@ void EnumValueOptions::SerializeWithCachedSizes(
1000, 536870912, target);
if (!unknown_fields().empty()) {
- target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
+ target = ::google::protobuf::internal::WireFormatLite::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
return target;
@@ -5808,7 +5833,7 @@ int EnumValueOptions::ByteSize() const {
if (!unknown_fields().empty()) {
total_size +=
- ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
+ ::google::protobuf::internal::WireFormatLite::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
@@ -5969,8 +5994,7 @@ bool ServiceOptions::MergePartialFromCodedStream(
mutable_unknown_fields()));
continue;
}
- DO_(::google::protobuf::internal::WireFormat::SkipField(
- input, tag, mutable_unknown_fields()));
+ DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag, mutable_unknown_fields()));
break;
}
}
@@ -5992,7 +6016,7 @@ void ServiceOptions::SerializeWithCachedSizes(
1000, 536870912, output);
if (!unknown_fields().empty()) {
- ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
+ ::google::protobuf::internal::WireFormatLite::SerializeUnknownFields(
unknown_fields(), output);
}
}
@@ -6011,7 +6035,7 @@ void ServiceOptions::SerializeWithCachedSizes(
1000, 536870912, target);
if (!unknown_fields().empty()) {
- target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
+ target = ::google::protobuf::internal::WireFormatLite::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
return target;
@@ -6032,7 +6056,7 @@ int ServiceOptions::ByteSize() const {
if (!unknown_fields().empty()) {
total_size +=
- ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
+ ::google::protobuf::internal::WireFormatLite::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
@@ -6193,8 +6217,7 @@ bool MethodOptions::MergePartialFromCodedStream(
mutable_unknown_fields()));
continue;
}
- DO_(::google::protobuf::internal::WireFormat::SkipField(
- input, tag, mutable_unknown_fields()));
+ DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag, mutable_unknown_fields()));
break;
}
}
@@ -6216,7 +6239,7 @@ void MethodOptions::SerializeWithCachedSizes(
1000, 536870912, output);
if (!unknown_fields().empty()) {
- ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
+ ::google::protobuf::internal::WireFormatLite::SerializeUnknownFields(
unknown_fields(), output);
}
}
@@ -6235,7 +6258,7 @@ void MethodOptions::SerializeWithCachedSizes(
1000, 536870912, target);
if (!unknown_fields().empty()) {
- target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
+ target = ::google::protobuf::internal::WireFormatLite::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
return target;
@@ -6256,7 +6279,7 @@ int MethodOptions::ByteSize() const {
if (!unknown_fields().empty()) {
total_size +=
- ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
+ ::google::protobuf::internal::WireFormatLite::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
@@ -6442,8 +6465,7 @@ bool UninterpretedOption_NamePart::MergePartialFromCodedStream(
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
return true;
}
- DO_(::google::protobuf::internal::WireFormat::SkipField(
- input, tag, mutable_unknown_fields()));
+ DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag, mutable_unknown_fields()));
break;
}
}
@@ -6469,7 +6491,7 @@ void UninterpretedOption_NamePart::SerializeWithCachedSizes(
}
if (!unknown_fields().empty()) {
- ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
+ ::google::protobuf::internal::WireFormatLite::SerializeUnknownFields(
unknown_fields(), output);
}
}
@@ -6492,7 +6514,7 @@ void UninterpretedOption_NamePart::SerializeWithCachedSizes(
}
if (!unknown_fields().empty()) {
- target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
+ target = ::google::protobuf::internal::WireFormatLite::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
return target;
@@ -6517,7 +6539,7 @@ int UninterpretedOption_NamePart::ByteSize() const {
}
if (!unknown_fields().empty()) {
total_size +=
- ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
+ ::google::protobuf::internal::WireFormatLite::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
@@ -6787,8 +6809,7 @@ bool UninterpretedOption::MergePartialFromCodedStream(
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
return true;
}
- DO_(::google::protobuf::internal::WireFormat::SkipField(
- input, tag, mutable_unknown_fields()));
+ DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag, mutable_unknown_fields()));
break;
}
}
@@ -6836,7 +6857,7 @@ void UninterpretedOption::SerializeWithCachedSizes(
}
if (!unknown_fields().empty()) {
- ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
+ ::google::protobuf::internal::WireFormatLite::SerializeUnknownFields(
unknown_fields(), output);
}
}
@@ -6883,7 +6904,7 @@ void UninterpretedOption::SerializeWithCachedSizes(
}
if (!unknown_fields().empty()) {
- target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
+ target = ::google::protobuf::internal::WireFormatLite::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
return target;
@@ -6937,7 +6958,7 @@ int UninterpretedOption::ByteSize() const {
if (!unknown_fields().empty()) {
total_size +=
- ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
+ ::google::protobuf::internal::WireFormatLite::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
diff --git a/third_party/protobuf/src/google/protobuf/descriptor.pb.h b/third_party/protobuf/src/google/protobuf/descriptor.pb.h
index 205c547..217e588 100644
--- a/third_party/protobuf/src/google/protobuf/descriptor.pb.h
+++ b/third_party/protobuf/src/google/protobuf/descriptor.pb.h
@@ -1484,6 +1484,13 @@ class LIBPROTOBUF_EXPORT FileOptions : public ::google::protobuf::Message {
inline bool java_multiple_files() const;
inline void set_java_multiple_files(bool value);
+ // optional bool retain_unknown_fields = 11 [default = false];
+ inline bool has_retain_unknown_fields() const;
+ inline void clear_retain_unknown_fields();
+ static const int kRetainUnknownFieldsFieldNumber = 11;
+ inline bool retain_unknown_fields() const;
+ inline void set_retain_unknown_fields(bool value);
+
// optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 [default = SPEED];
inline bool has_optimize_for() const;
inline void clear_optimize_for();
@@ -1536,6 +1543,7 @@ class LIBPROTOBUF_EXPORT FileOptions : public ::google::protobuf::Message {
::std::string* java_outer_classname_;
static const ::std::string _default_java_outer_classname_;
bool java_multiple_files_;
+ bool retain_unknown_fields_;
int optimize_for_;
bool cc_generic_services_;
bool java_generic_services_;
@@ -1545,7 +1553,7 @@ class LIBPROTOBUF_EXPORT FileOptions : public ::google::protobuf::Message {
friend void protobuf_AssignDesc_google_2fprotobuf_2fdescriptor_2eproto();
friend void protobuf_ShutdownFile_google_2fprotobuf_2fdescriptor_2eproto();
- ::google::protobuf::uint32 _has_bits_[(8 + 31) / 32];
+ ::google::protobuf::uint32 _has_bits_[(9 + 31) / 32];
// WHY DOES & HAVE LOWER PRECEDENCE THAN != !?
inline bool _has_bit(int index) const {
@@ -3709,68 +3717,84 @@ inline void FileOptions::set_java_multiple_files(bool value) {
java_multiple_files_ = value;
}
+// optional bool retain_unknown_fields = 11 [default = false];
+inline bool FileOptions::has_retain_unknown_fields() const {
+ return _has_bit(3);
+}
+inline void FileOptions::clear_retain_unknown_fields() {
+ retain_unknown_fields_ = false;
+ _clear_bit(3);
+}
+inline bool FileOptions::retain_unknown_fields() const {
+ return retain_unknown_fields_;
+}
+inline void FileOptions::set_retain_unknown_fields(bool value) {
+ _set_bit(3);
+ retain_unknown_fields_ = value;
+}
+
// optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 [default = SPEED];
inline bool FileOptions::has_optimize_for() const {
- return _has_bit(3);
+ return _has_bit(4);
}
inline void FileOptions::clear_optimize_for() {
optimize_for_ = 1;
- _clear_bit(3);
+ _clear_bit(4);
}
inline ::google::protobuf::FileOptions_OptimizeMode FileOptions::optimize_for() const {
return static_cast< ::google::protobuf::FileOptions_OptimizeMode >(optimize_for_);
}
inline void FileOptions::set_optimize_for(::google::protobuf::FileOptions_OptimizeMode value) {
GOOGLE_DCHECK(::google::protobuf::FileOptions_OptimizeMode_IsValid(value));
- _set_bit(3);
+ _set_bit(4);
optimize_for_ = value;
}
// optional bool cc_generic_services = 16 [default = true];
inline bool FileOptions::has_cc_generic_services() const {
- return _has_bit(4);
+ return _has_bit(5);
}
inline void FileOptions::clear_cc_generic_services() {
cc_generic_services_ = true;
- _clear_bit(4);
+ _clear_bit(5);
}
inline bool FileOptions::cc_generic_services() const {
return cc_generic_services_;
}
inline void FileOptions::set_cc_generic_services(bool value) {
- _set_bit(4);
+ _set_bit(5);
cc_generic_services_ = value;
}
// optional bool java_generic_services = 17 [default = true];
inline bool FileOptions::has_java_generic_services() const {
- return _has_bit(5);
+ return _has_bit(6);
}
inline void FileOptions::clear_java_generic_services() {
java_generic_services_ = true;
- _clear_bit(5);
+ _clear_bit(6);
}
inline bool FileOptions::java_generic_services() const {
return java_generic_services_;
}
inline void FileOptions::set_java_generic_services(bool value) {
- _set_bit(5);
+ _set_bit(6);
java_generic_services_ = value;
}
// optional bool py_generic_services = 18 [default = true];
inline bool FileOptions::has_py_generic_services() const {
- return _has_bit(6);
+ return _has_bit(7);
}
inline void FileOptions::clear_py_generic_services() {
py_generic_services_ = true;
- _clear_bit(6);
+ _clear_bit(7);
}
inline bool FileOptions::py_generic_services() const {
return py_generic_services_;
}
inline void FileOptions::set_py_generic_services(bool value) {
- _set_bit(6);
+ _set_bit(7);
py_generic_services_ = value;
}
diff --git a/third_party/protobuf/src/google/protobuf/descriptor.proto b/third_party/protobuf/src/google/protobuf/descriptor.proto
index cc04aa8..c07815b 100644
--- a/third_party/protobuf/src/google/protobuf/descriptor.proto
+++ b/third_party/protobuf/src/google/protobuf/descriptor.proto
@@ -245,6 +245,12 @@ message FileOptions {
// top-level extensions defined in the file.
optional bool java_multiple_files = 10 [default=false];
+ // If set true, then code generators will store unknown fields so that
+ // reserializing a message will retain them. This is the default behaviour
+ // unless LITE_RUNTIME is specified. Therefore, this option only makes sense
+ // when LITE_RUNTIME is in use.
+ optional bool retain_unknown_fields = 11 [default=false];
+
// Generated classes can be optimized for speed or code size.
enum OptimizeMode {
SPEED = 1; // Generate complete code for parsing, serialization,
diff --git a/third_party/protobuf/src/google/protobuf/extension_set.cc b/third_party/protobuf/src/google/protobuf/extension_set.cc
index 6084885b..c1b59e8 100644
--- a/third_party/protobuf/src/google/protobuf/extension_set.cc
+++ b/third_party/protobuf/src/google/protobuf/extension_set.cc
@@ -873,16 +873,17 @@ bool ExtensionSet::ParseField(uint32 tag, io::CodedInputStream* input,
}
bool ExtensionSet::ParseField(uint32 tag, io::CodedInputStream* input,
- const MessageLite* containing_type) {
- FieldSkipper skipper;
+ const MessageLite* containing_type,
+ UnknownFieldSet* unknown_fields) {
+ FieldSkipper skipper(unknown_fields);
GeneratedExtensionFinder finder(containing_type);
return ParseField(tag, input, &finder, &skipper);
}
// Defined in extension_set_heavy.cc.
-// bool ExtensionSet::ParseField(uint32 tag, io::CodedInputStream* input,
-// const MessageLite* containing_type,
-// UnknownFieldSet* unknown_fields)
+// bool ExtensionSet::ParseFieldHeavy(uint32 tag, io::CodedInputStream* input,
+// const Message* containing_type,
+// UnknownFieldSet* unknown_fields)
bool ExtensionSet::ParseMessageSet(io::CodedInputStream* input,
ExtensionFinder* extension_finder,
@@ -907,16 +908,17 @@ bool ExtensionSet::ParseMessageSet(io::CodedInputStream* input,
}
bool ExtensionSet::ParseMessageSet(io::CodedInputStream* input,
- const MessageLite* containing_type) {
- FieldSkipper skipper;
+ const MessageLite* containing_type,
+ UnknownFieldSet* unknown_fields) {
+ FieldSkipper skipper(unknown_fields);
GeneratedExtensionFinder finder(containing_type);
return ParseMessageSet(input, &finder, &skipper);
}
// Defined in extension_set_heavy.cc.
-// bool ExtensionSet::ParseMessageSet(io::CodedInputStream* input,
-// const MessageLite* containing_type,
-// UnknownFieldSet* unknown_fields);
+// bool ExtensionSet::ParseMessageSetHeavy(io::CodedInputStream* input,
+// const Message* containing_type,
+// UnknownFieldSet* unknown_fields);
bool ExtensionSet::ParseMessageSetItem(io::CodedInputStream* input,
ExtensionFinder* extension_finder,
diff --git a/third_party/protobuf/src/google/protobuf/extension_set.h b/third_party/protobuf/src/google/protobuf/extension_set.h
index 14d5d15..1ca9de7 100644
--- a/third_party/protobuf/src/google/protobuf/extension_set.h
+++ b/third_party/protobuf/src/google/protobuf/extension_set.h
@@ -324,10 +324,11 @@ class LIBPROTOBUF_EXPORT ExtensionSet {
// Specific versions for lite or full messages (constructs the appropriate
// FieldSkipper automatically).
bool ParseField(uint32 tag, io::CodedInputStream* input,
- const MessageLite* containing_type);
- bool ParseField(uint32 tag, io::CodedInputStream* input,
- const Message* containing_type,
+ const MessageLite* containing_type,
UnknownFieldSet* unknown_fields);
+ bool ParseFieldHeavy(uint32 tag, io::CodedInputStream* input,
+ const Message* containing_type,
+ UnknownFieldSet* unknown_fields);
// Parse an entire message in MessageSet format. Such messages have no
// fields, only extensions.
@@ -338,10 +339,11 @@ class LIBPROTOBUF_EXPORT ExtensionSet {
// Specific versions for lite or full messages (constructs the appropriate
// FieldSkipper automatically).
bool ParseMessageSet(io::CodedInputStream* input,
- const MessageLite* containing_type);
- bool ParseMessageSet(io::CodedInputStream* input,
- const Message* containing_type,
+ const MessageLite* containing_type,
UnknownFieldSet* unknown_fields);
+ bool ParseMessageSetHeavy(io::CodedInputStream* input,
+ const Message* containing_type,
+ UnknownFieldSet* unknown_fields);
// Write all extension fields with field numbers in the range
// [start_field_number, end_field_number)
diff --git a/third_party/protobuf/src/google/protobuf/extension_set_heavy.cc b/third_party/protobuf/src/google/protobuf/extension_set_heavy.cc
index 2721f15..e00fd4d 100644
--- a/third_party/protobuf/src/google/protobuf/extension_set_heavy.cc
+++ b/third_party/protobuf/src/google/protobuf/extension_set_heavy.cc
@@ -202,10 +202,10 @@ bool DescriptorPoolExtensionFinder::Find(int number, ExtensionInfo* output) {
}
}
-bool ExtensionSet::ParseField(uint32 tag, io::CodedInputStream* input,
- const Message* containing_type,
- UnknownFieldSet* unknown_fields) {
- UnknownFieldSetFieldSkipper skipper(unknown_fields);
+bool ExtensionSet::ParseFieldHeavy(uint32 tag, io::CodedInputStream* input,
+ const Message* containing_type,
+ UnknownFieldSet* unknown_fields) {
+ FieldSkipper skipper(unknown_fields);
if (input->GetExtensionPool() == NULL) {
GeneratedExtensionFinder finder(containing_type);
return ParseField(tag, input, &finder, &skipper);
@@ -217,10 +217,10 @@ bool ExtensionSet::ParseField(uint32 tag, io::CodedInputStream* input,
}
}
-bool ExtensionSet::ParseMessageSet(io::CodedInputStream* input,
- const Message* containing_type,
- UnknownFieldSet* unknown_fields) {
- UnknownFieldSetFieldSkipper skipper(unknown_fields);
+bool ExtensionSet::ParseMessageSetHeavy(io::CodedInputStream* input,
+ const Message* containing_type,
+ UnknownFieldSet* unknown_fields) {
+ FieldSkipper skipper(unknown_fields);
if (input->GetExtensionPool() == NULL) {
GeneratedExtensionFinder finder(containing_type);
return ParseMessageSet(input, &finder, &skipper);
diff --git a/third_party/protobuf/src/google/protobuf/generated_message_reflection.cc b/third_party/protobuf/src/google/protobuf/generated_message_reflection.cc
index 0f065ff..9c933fe 100644
--- a/third_party/protobuf/src/google/protobuf/generated_message_reflection.cc
+++ b/third_party/protobuf/src/google/protobuf/generated_message_reflection.cc
@@ -47,18 +47,6 @@ namespace internal {
namespace { const string kEmptyString; }
-int StringSpaceUsedExcludingSelf(const string& str) {
- const void* start = &str;
- const void* end = &str + 1;
-
- if (start <= str.data() && str.data() <= end) {
- // The string's data is stored inside the string object itself.
- return 0;
- } else {
- return str.capacity();
- }
-}
-
bool ParseNamedEnum(const EnumDescriptor* descriptor,
const string& name,
int* value) {
diff --git a/third_party/protobuf/src/google/protobuf/unknown_field_set.cc b/third_party/protobuf/src/google/protobuf/unknown_field_set.cc
index e1f8b83..15498ef 100644
--- a/third_party/protobuf/src/google/protobuf/unknown_field_set.cc
+++ b/third_party/protobuf/src/google/protobuf/unknown_field_set.cc
@@ -43,6 +43,22 @@
namespace google {
namespace protobuf {
+namespace internal {
+
+int StringSpaceUsedExcludingSelf(const string& str) {
+ const void* start = &str;
+ const void* end = &str + 1;
+
+ if (start <= str.data() && str.data() <= end) {
+ // The string's data is stored inside the string object itself.
+ return 0;
+ } else {
+ return str.capacity();
+ }
+}
+
+}
+
UnknownFieldSet::UnknownFieldSet()
: fields_(NULL) {}
@@ -146,8 +162,8 @@ void UnknownFieldSet::AddField(const UnknownField& field) {
bool UnknownFieldSet::MergeFromCodedStream(io::CodedInputStream* input) {
UnknownFieldSet other;
- if (internal::WireFormat::SkipMessage(input, &other) &&
- input->ConsumedEntireMessage()) {
+ if (internal::WireFormatLite::SkipMessage(input, &other) &&
+ input->ConsumedEntireMessage()) {
MergeFrom(other);
return true;
} else {
diff --git a/third_party/protobuf/src/google/protobuf/wire_format.cc b/third_party/protobuf/src/google/protobuf/wire_format.cc
index 831a579..d07f633 100644
--- a/third_party/protobuf/src/google/protobuf/wire_format.cc
+++ b/third_party/protobuf/src/google/protobuf/wire_format.cc
@@ -63,308 +63,6 @@ inline int GetEnumNumber(const EnumValueDescriptor* descriptor) {
} // anonymous namespace
-// ===================================================================
-
-bool UnknownFieldSetFieldSkipper::SkipField(
- io::CodedInputStream* input, uint32 tag) {
- return WireFormat::SkipField(input, tag, unknown_fields_);
-}
-
-bool UnknownFieldSetFieldSkipper::SkipMessage(io::CodedInputStream* input) {
- return WireFormat::SkipMessage(input, unknown_fields_);
-}
-
-void UnknownFieldSetFieldSkipper::SkipUnknownEnum(
- int field_number, int value) {
- unknown_fields_->AddVarint(field_number, value);
-}
-
-bool WireFormat::SkipField(io::CodedInputStream* input, uint32 tag,
- UnknownFieldSet* unknown_fields) {
- int number = WireFormatLite::GetTagFieldNumber(tag);
-
- switch (WireFormatLite::GetTagWireType(tag)) {
- case WireFormatLite::WIRETYPE_VARINT: {
- uint64 value;
- if (!input->ReadVarint64(&value)) return false;
- if (unknown_fields != NULL) unknown_fields->AddVarint(number, value);
- return true;
- }
- case WireFormatLite::WIRETYPE_FIXED64: {
- uint64 value;
- if (!input->ReadLittleEndian64(&value)) return false;
- if (unknown_fields != NULL) unknown_fields->AddFixed64(number, value);
- return true;
- }
- case WireFormatLite::WIRETYPE_LENGTH_DELIMITED: {
- uint32 length;
- if (!input->ReadVarint32(&length)) return false;
- if (unknown_fields == NULL) {
- if (!input->Skip(length)) return false;
- } else {
- if (!input->ReadString(unknown_fields->AddLengthDelimited(number),
- length)) {
- return false;
- }
- }
- return true;
- }
- case WireFormatLite::WIRETYPE_START_GROUP: {
- if (!input->IncrementRecursionDepth()) return false;
- if (!SkipMessage(input, (unknown_fields == NULL) ?
- NULL : unknown_fields->AddGroup(number))) {
- return false;
- }
- input->DecrementRecursionDepth();
- // Check that the ending tag matched the starting tag.
- if (!input->LastTagWas(WireFormatLite::MakeTag(
- WireFormatLite::GetTagFieldNumber(tag),
- WireFormatLite::WIRETYPE_END_GROUP))) {
- return false;
- }
- return true;
- }
- case WireFormatLite::WIRETYPE_END_GROUP: {
- return false;
- }
- case WireFormatLite::WIRETYPE_FIXED32: {
- uint32 value;
- if (!input->ReadLittleEndian32(&value)) return false;
- if (unknown_fields != NULL) unknown_fields->AddFixed32(number, value);
- return true;
- }
- default: {
- return false;
- }
- }
-}
-
-bool WireFormat::SkipMessage(io::CodedInputStream* input,
- UnknownFieldSet* unknown_fields) {
- while(true) {
- uint32 tag = input->ReadTag();
- if (tag == 0) {
- // End of input. This is a valid place to end, so return true.
- return true;
- }
-
- WireFormatLite::WireType wire_type = WireFormatLite::GetTagWireType(tag);
-
- if (wire_type == WireFormatLite::WIRETYPE_END_GROUP) {
- // Must be the end of the message.
- return true;
- }
-
- if (!SkipField(input, tag, unknown_fields)) return false;
- }
-}
-
-void WireFormat::SerializeUnknownFields(const UnknownFieldSet& unknown_fields,
- io::CodedOutputStream* output) {
- for (int i = 0; i < unknown_fields.field_count(); i++) {
- const UnknownField& field = unknown_fields.field(i);
- switch (field.type()) {
- case UnknownField::TYPE_VARINT:
- output->WriteVarint32(WireFormatLite::MakeTag(field.number(),
- WireFormatLite::WIRETYPE_VARINT));
- output->WriteVarint64(field.varint());
- break;
- case UnknownField::TYPE_FIXED32:
- output->WriteVarint32(WireFormatLite::MakeTag(field.number(),
- WireFormatLite::WIRETYPE_FIXED32));
- output->WriteLittleEndian32(field.fixed32());
- break;
- case UnknownField::TYPE_FIXED64:
- output->WriteVarint32(WireFormatLite::MakeTag(field.number(),
- WireFormatLite::WIRETYPE_FIXED64));
- output->WriteLittleEndian64(field.fixed64());
- break;
- case UnknownField::TYPE_LENGTH_DELIMITED:
- output->WriteVarint32(WireFormatLite::MakeTag(field.number(),
- WireFormatLite::WIRETYPE_LENGTH_DELIMITED));
- output->WriteVarint32(field.length_delimited().size());
- output->WriteString(field.length_delimited());
- break;
- case UnknownField::TYPE_GROUP:
- output->WriteVarint32(WireFormatLite::MakeTag(field.number(),
- WireFormatLite::WIRETYPE_START_GROUP));
- SerializeUnknownFields(field.group(), output);
- output->WriteVarint32(WireFormatLite::MakeTag(field.number(),
- WireFormatLite::WIRETYPE_END_GROUP));
- break;
- }
- }
-}
-
-uint8* WireFormat::SerializeUnknownFieldsToArray(
- const UnknownFieldSet& unknown_fields,
- uint8* target) {
- for (int i = 0; i < unknown_fields.field_count(); i++) {
- const UnknownField& field = unknown_fields.field(i);
-
- switch (field.type()) {
- case UnknownField::TYPE_VARINT:
- target = WireFormatLite::WriteInt64ToArray(
- field.number(), field.varint(), target);
- break;
- case UnknownField::TYPE_FIXED32:
- target = WireFormatLite::WriteFixed32ToArray(
- field.number(), field.fixed32(), target);
- break;
- case UnknownField::TYPE_FIXED64:
- target = WireFormatLite::WriteFixed64ToArray(
- field.number(), field.fixed64(), target);
- break;
- case UnknownField::TYPE_LENGTH_DELIMITED:
- target = WireFormatLite::WriteBytesToArray(
- field.number(), field.length_delimited(), target);
- break;
- case UnknownField::TYPE_GROUP:
- target = WireFormatLite::WriteTagToArray(
- field.number(), WireFormatLite::WIRETYPE_START_GROUP, target);
- target = SerializeUnknownFieldsToArray(field.group(), target);
- target = WireFormatLite::WriteTagToArray(
- field.number(), WireFormatLite::WIRETYPE_END_GROUP, target);
- break;
- }
- }
- return target;
-}
-
-void WireFormat::SerializeUnknownMessageSetItems(
- const UnknownFieldSet& unknown_fields,
- io::CodedOutputStream* output) {
- for (int i = 0; i < unknown_fields.field_count(); i++) {
- const UnknownField& field = unknown_fields.field(i);
- // The only unknown fields that are allowed to exist in a MessageSet are
- // messages, which are length-delimited.
- if (field.type() == UnknownField::TYPE_LENGTH_DELIMITED) {
- const string& data = field.length_delimited();
-
- // Start group.
- output->WriteVarint32(WireFormatLite::kMessageSetItemStartTag);
-
- // Write type ID.
- output->WriteVarint32(WireFormatLite::kMessageSetTypeIdTag);
- output->WriteVarint32(field.number());
-
- // Write message.
- output->WriteVarint32(WireFormatLite::kMessageSetMessageTag);
- output->WriteVarint32(data.size());
- output->WriteString(data);
-
- // End group.
- output->WriteVarint32(WireFormatLite::kMessageSetItemEndTag);
- }
- }
-}
-
-uint8* WireFormat::SerializeUnknownMessageSetItemsToArray(
- const UnknownFieldSet& unknown_fields,
- uint8* target) {
- for (int i = 0; i < unknown_fields.field_count(); i++) {
- const UnknownField& field = unknown_fields.field(i);
-
- // The only unknown fields that are allowed to exist in a MessageSet are
- // messages, which are length-delimited.
- if (field.type() == UnknownField::TYPE_LENGTH_DELIMITED) {
- const string& data = field.length_delimited();
-
- // Start group.
- target = io::CodedOutputStream::WriteTagToArray(
- WireFormatLite::kMessageSetItemStartTag, target);
-
- // Write type ID.
- target = io::CodedOutputStream::WriteTagToArray(
- WireFormatLite::kMessageSetTypeIdTag, target);
- target = io::CodedOutputStream::WriteVarint32ToArray(
- field.number(), target);
-
- // Write message.
- target = io::CodedOutputStream::WriteTagToArray(
- WireFormatLite::kMessageSetMessageTag, target);
- target = io::CodedOutputStream::WriteVarint32ToArray(data.size(), target);
- target = io::CodedOutputStream::WriteStringToArray(data, target);
-
- // End group.
- target = io::CodedOutputStream::WriteTagToArray(
- WireFormatLite::kMessageSetItemEndTag, target);
- }
- }
-
- return target;
-}
-
-int WireFormat::ComputeUnknownFieldsSize(
- const UnknownFieldSet& unknown_fields) {
- int size = 0;
- for (int i = 0; i < unknown_fields.field_count(); i++) {
- const UnknownField& field = unknown_fields.field(i);
-
- switch (field.type()) {
- case UnknownField::TYPE_VARINT:
- size += io::CodedOutputStream::VarintSize32(
- WireFormatLite::MakeTag(field.number(),
- WireFormatLite::WIRETYPE_VARINT));
- size += io::CodedOutputStream::VarintSize64(field.varint());
- break;
- case UnknownField::TYPE_FIXED32:
- size += io::CodedOutputStream::VarintSize32(
- WireFormatLite::MakeTag(field.number(),
- WireFormatLite::WIRETYPE_FIXED32));
- size += sizeof(int32);
- break;
- case UnknownField::TYPE_FIXED64:
- size += io::CodedOutputStream::VarintSize32(
- WireFormatLite::MakeTag(field.number(),
- WireFormatLite::WIRETYPE_FIXED64));
- size += sizeof(int64);
- break;
- case UnknownField::TYPE_LENGTH_DELIMITED:
- size += io::CodedOutputStream::VarintSize32(
- WireFormatLite::MakeTag(field.number(),
- WireFormatLite::WIRETYPE_LENGTH_DELIMITED));
- size += io::CodedOutputStream::VarintSize32(
- field.length_delimited().size());
- size += field.length_delimited().size();
- break;
- case UnknownField::TYPE_GROUP:
- size += io::CodedOutputStream::VarintSize32(
- WireFormatLite::MakeTag(field.number(),
- WireFormatLite::WIRETYPE_START_GROUP));
- size += ComputeUnknownFieldsSize(field.group());
- size += io::CodedOutputStream::VarintSize32(
- WireFormatLite::MakeTag(field.number(),
- WireFormatLite::WIRETYPE_END_GROUP));
- break;
- }
- }
-
- return size;
-}
-
-int WireFormat::ComputeUnknownMessageSetItemsSize(
- const UnknownFieldSet& unknown_fields) {
- int size = 0;
- for (int i = 0; i < unknown_fields.field_count(); i++) {
- const UnknownField& field = unknown_fields.field(i);
-
- // The only unknown fields that are allowed to exist in a MessageSet are
- // messages, which are length-delimited.
- if (field.type() == UnknownField::TYPE_LENGTH_DELIMITED) {
- size += WireFormatLite::kMessageSetItemTagsSize;
- size += io::CodedOutputStream::VarintSize32(field.number());
- size += io::CodedOutputStream::VarintSize32(
- field.length_delimited().size());
- size += field.length_delimited().size();
- }
- }
-
- return size;
-}
-
-// ===================================================================
-
bool WireFormat::ParseAndMergePartial(io::CodedInputStream* input,
Message* message) {
const Descriptor* descriptor = message->GetDescriptor();
@@ -442,8 +140,8 @@ bool WireFormat::ParseAndMergeField(
}
if (value_format == UNKNOWN) {
- return SkipField(input, tag,
- message_reflection->MutableUnknownFields(message));
+ return WireFormatLite::SkipField(
+ input, tag, message_reflection->MutableUnknownFields(message));
} else if (value_format == PACKED_FORMAT) {
uint32 length;
if (!input->ReadVarint32(&length)) return false;
@@ -699,7 +397,7 @@ bool WireFormat::ParseAndMergeMessageSetItem(
}
default: {
- if (!SkipField(input, tag, NULL)) return false;
+ if (!WireFormatLite::SkipField(input, tag, NULL)) return false;
}
}
}
@@ -721,10 +419,10 @@ void WireFormat::SerializeWithCachedSizes(
}
if (descriptor->options().message_set_wire_format()) {
- SerializeUnknownMessageSetItems(
+ WireFormatLite::SerializeUnknownMessageSetItems(
message_reflection->GetUnknownFields(message), output);
} else {
- SerializeUnknownFields(
+ WireFormatLite::SerializeUnknownFields(
message_reflection->GetUnknownFields(message), output);
}
@@ -891,10 +589,10 @@ int WireFormat::ByteSize(const Message& message) {
}
if (descriptor->options().message_set_wire_format()) {
- our_size += ComputeUnknownMessageSetItemsSize(
+ our_size += WireFormatLite::ComputeUnknownMessageSetItemsSize(
message_reflection->GetUnknownFields(message));
} else {
- our_size += ComputeUnknownFieldsSize(
+ our_size += WireFormatLite::ComputeUnknownFieldsSize(
message_reflection->GetUnknownFields(message));
}
diff --git a/third_party/protobuf/src/google/protobuf/wire_format.h b/third_party/protobuf/src/google/protobuf/wire_format.h
index c753925..d52bc4a 100644
--- a/third_party/protobuf/src/google/protobuf/wire_format.h
+++ b/third_party/protobuf/src/google/protobuf/wire_format.h
@@ -123,54 +123,6 @@ class LIBPROTOBUF_EXPORT WireFormat {
// WireFormat::SerializeWithCachedSizes() on the same object.
static int ByteSize(const Message& message);
- // -----------------------------------------------------------------
- // Helpers for dealing with unknown fields
-
- // Skips a field value of the given WireType. The input should start
- // positioned immediately after the tag. If unknown_fields is non-NULL,
- // the contents of the field will be added to it.
- static bool SkipField(io::CodedInputStream* input, uint32 tag,
- UnknownFieldSet* unknown_fields);
-
- // Reads and ignores a message from the input. If unknown_fields is non-NULL,
- // the contents will be added to it.
- static bool SkipMessage(io::CodedInputStream* input,
- UnknownFieldSet* unknown_fields);
-
- // Write the contents of an UnknownFieldSet to the output.
- static void SerializeUnknownFields(const UnknownFieldSet& unknown_fields,
- io::CodedOutputStream* output);
- // Same as above, except writing directly to the provided buffer.
- // Requires that the buffer have sufficient capacity for
- // ComputeUnknownFieldsSize(unknown_fields).
- //
- // Returns a pointer past the last written byte.
- static uint8* SerializeUnknownFieldsToArray(
- const UnknownFieldSet& unknown_fields,
- uint8* target);
-
- // Same thing except for messages that have the message_set_wire_format
- // option.
- static void SerializeUnknownMessageSetItems(
- const UnknownFieldSet& unknown_fields,
- io::CodedOutputStream* output);
- // Same as above, except writing directly to the provided buffer.
- // Requires that the buffer have sufficient capacity for
- // ComputeUnknownMessageSetItemsSize(unknown_fields).
- //
- // Returns a pointer past the last written byte.
- static uint8* SerializeUnknownMessageSetItemsToArray(
- const UnknownFieldSet& unknown_fields,
- uint8* target);
-
- // Compute the size of the UnknownFieldSet on the wire.
- static int ComputeUnknownFieldsSize(const UnknownFieldSet& unknown_fields);
-
- // Same thing except for messages that have the message_set_wire_format
- // option.
- static int ComputeUnknownMessageSetItemsSize(
- const UnknownFieldSet& unknown_fields);
-
// Helper functions for encoding and decoding tags. (Inlined below and in
// _inl.h)
@@ -241,22 +193,6 @@ class LIBPROTOBUF_EXPORT WireFormat {
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(WireFormat);
};
-// Subclass of FieldSkipper which saves skipped fields to an UnknownFieldSet.
-class LIBPROTOBUF_EXPORT UnknownFieldSetFieldSkipper : public FieldSkipper {
- public:
- UnknownFieldSetFieldSkipper(UnknownFieldSet* unknown_fields)
- : unknown_fields_(unknown_fields) {}
- virtual ~UnknownFieldSetFieldSkipper() {}
-
- // implements FieldSkipper -----------------------------------------
- virtual bool SkipField(io::CodedInputStream* input, uint32 tag);
- virtual bool SkipMessage(io::CodedInputStream* input);
- virtual void SkipUnknownEnum(int field_number, int value);
-
- private:
- UnknownFieldSet* unknown_fields_;
-};
-
// inline methods ====================================================
inline WireFormatLite::WireType WireFormat::WireTypeForField(
diff --git a/third_party/protobuf/src/google/protobuf/wire_format_lite.cc b/third_party/protobuf/src/google/protobuf/wire_format_lite.cc
index d347d11..1dd6164 100644
--- a/third_party/protobuf/src/google/protobuf/wire_format_lite.cc
+++ b/third_party/protobuf/src/google/protobuf/wire_format_lite.cc
@@ -41,6 +41,7 @@
#include <google/protobuf/io/coded_stream_inl.h>
#include <google/protobuf/io/zero_copy_stream.h>
#include <google/protobuf/io/zero_copy_stream_impl.h>
+#include <google/protobuf/unknown_field_set.h>
namespace google {
namespace protobuf {
@@ -55,6 +56,24 @@ const int WireFormatLite::kMessageSetMessageTag;
#endif
+// ===================================================================
+
+bool FieldSkipper::SkipField(
+ io::CodedInputStream* input, uint32 tag) {
+ return WireFormatLite::SkipField(input, tag, unknown_fields_);
+}
+
+bool FieldSkipper::SkipMessage(io::CodedInputStream* input) {
+ return WireFormatLite::SkipMessage(input, unknown_fields_);
+}
+
+void FieldSkipper::SkipUnknownEnum(
+ int field_number, int value) {
+ unknown_fields_->AddVarint(field_number, value);
+}
+
+// ===================================================================
+
const int WireFormatLite::kMessageSetItemTagsSize =
io::CodedOutputStream::VarintSize32(kMessageSetItemStartTag) +
io::CodedOutputStream::VarintSize32(kMessageSetItemEndTag) +
@@ -108,28 +127,42 @@ WireFormatLite::kWireTypeForFieldType[MAX_FIELD_TYPE + 1] = {
WireFormatLite::WIRETYPE_VARINT, // TYPE_SINT64
};
-bool WireFormatLite::SkipField(
- io::CodedInputStream* input, uint32 tag) {
+bool WireFormatLite::SkipField(io::CodedInputStream* input, uint32 tag,
+ UnknownFieldSet* unknown_fields) {
+ int number = WireFormatLite::GetTagFieldNumber(tag);
+
switch (WireFormatLite::GetTagWireType(tag)) {
case WireFormatLite::WIRETYPE_VARINT: {
uint64 value;
if (!input->ReadVarint64(&value)) return false;
+ if (unknown_fields != NULL) unknown_fields->AddVarint(number, value);
return true;
}
case WireFormatLite::WIRETYPE_FIXED64: {
uint64 value;
if (!input->ReadLittleEndian64(&value)) return false;
+ if (unknown_fields != NULL) unknown_fields->AddFixed64(number, value);
return true;
}
case WireFormatLite::WIRETYPE_LENGTH_DELIMITED: {
uint32 length;
if (!input->ReadVarint32(&length)) return false;
- if (!input->Skip(length)) return false;
+ if (unknown_fields == NULL) {
+ if (!input->Skip(length)) return false;
+ } else {
+ if (!input->ReadString(unknown_fields->AddLengthDelimited(number),
+ length)) {
+ return false;
+ }
+ }
return true;
}
case WireFormatLite::WIRETYPE_START_GROUP: {
if (!input->IncrementRecursionDepth()) return false;
- if (!SkipMessage(input)) return false;
+ if (!SkipMessage(input, (unknown_fields == NULL) ?
+ NULL : unknown_fields->AddGroup(number))) {
+ return false;
+ }
input->DecrementRecursionDepth();
// Check that the ending tag matched the starting tag.
if (!input->LastTagWas(WireFormatLite::MakeTag(
@@ -145,6 +178,7 @@ bool WireFormatLite::SkipField(
case WireFormatLite::WIRETYPE_FIXED32: {
uint32 value;
if (!input->ReadLittleEndian32(&value)) return false;
+ if (unknown_fields != NULL) unknown_fields->AddFixed32(number, value);
return true;
}
default: {
@@ -153,7 +187,8 @@ bool WireFormatLite::SkipField(
}
}
-bool WireFormatLite::SkipMessage(io::CodedInputStream* input) {
+bool WireFormatLite::SkipMessage(io::CodedInputStream* input,
+ UnknownFieldSet* unknown_fields) {
while(true) {
uint32 tag = input->ReadTag();
if (tag == 0) {
@@ -168,22 +203,212 @@ bool WireFormatLite::SkipMessage(io::CodedInputStream* input) {
return true;
}
- if (!SkipField(input, tag)) return false;
+ if (!SkipField(input, tag, unknown_fields)) return false;
}
}
-bool FieldSkipper::SkipField(
- io::CodedInputStream* input, uint32 tag) {
- return WireFormatLite::SkipField(input, tag);
+void WireFormatLite::SerializeUnknownFields(const UnknownFieldSet& unknown_fields,
+ io::CodedOutputStream* output) {
+ for (int i = 0; i < unknown_fields.field_count(); i++) {
+ const UnknownField& field = unknown_fields.field(i);
+ switch (field.type()) {
+ case UnknownField::TYPE_VARINT:
+ output->WriteVarint32(WireFormatLite::MakeTag(field.number(),
+ WireFormatLite::WIRETYPE_VARINT));
+ output->WriteVarint64(field.varint());
+ break;
+ case UnknownField::TYPE_FIXED32:
+ output->WriteVarint32(WireFormatLite::MakeTag(field.number(),
+ WireFormatLite::WIRETYPE_FIXED32));
+ output->WriteLittleEndian32(field.fixed32());
+ break;
+ case UnknownField::TYPE_FIXED64:
+ output->WriteVarint32(WireFormatLite::MakeTag(field.number(),
+ WireFormatLite::WIRETYPE_FIXED64));
+ output->WriteLittleEndian64(field.fixed64());
+ break;
+ case UnknownField::TYPE_LENGTH_DELIMITED:
+ output->WriteVarint32(WireFormatLite::MakeTag(field.number(),
+ WireFormatLite::WIRETYPE_LENGTH_DELIMITED));
+ output->WriteVarint32(field.length_delimited().size());
+ output->WriteString(field.length_delimited());
+ break;
+ case UnknownField::TYPE_GROUP:
+ output->WriteVarint32(WireFormatLite::MakeTag(field.number(),
+ WireFormatLite::WIRETYPE_START_GROUP));
+ SerializeUnknownFields(field.group(), output);
+ output->WriteVarint32(WireFormatLite::MakeTag(field.number(),
+ WireFormatLite::WIRETYPE_END_GROUP));
+ break;
+ }
+ }
}
-bool FieldSkipper::SkipMessage(io::CodedInputStream* input) {
- return WireFormatLite::SkipMessage(input);
+uint8* WireFormatLite::SerializeUnknownFieldsToArray(
+ const UnknownFieldSet& unknown_fields,
+ uint8* target) {
+ for (int i = 0; i < unknown_fields.field_count(); i++) {
+ const UnknownField& field = unknown_fields.field(i);
+
+ switch (field.type()) {
+ case UnknownField::TYPE_VARINT:
+ target = WireFormatLite::WriteInt64ToArray(
+ field.number(), field.varint(), target);
+ break;
+ case UnknownField::TYPE_FIXED32:
+ target = WireFormatLite::WriteFixed32ToArray(
+ field.number(), field.fixed32(), target);
+ break;
+ case UnknownField::TYPE_FIXED64:
+ target = WireFormatLite::WriteFixed64ToArray(
+ field.number(), field.fixed64(), target);
+ break;
+ case UnknownField::TYPE_LENGTH_DELIMITED:
+ target = WireFormatLite::WriteBytesToArray(
+ field.number(), field.length_delimited(), target);
+ break;
+ case UnknownField::TYPE_GROUP:
+ target = WireFormatLite::WriteTagToArray(
+ field.number(), WireFormatLite::WIRETYPE_START_GROUP, target);
+ target = SerializeUnknownFieldsToArray(field.group(), target);
+ target = WireFormatLite::WriteTagToArray(
+ field.number(), WireFormatLite::WIRETYPE_END_GROUP, target);
+ break;
+ }
+ }
+ return target;
}
-void FieldSkipper::SkipUnknownEnum(
- int field_number, int value) {
- // Nothing.
+void WireFormatLite::SerializeUnknownMessageSetItems(
+ const UnknownFieldSet& unknown_fields,
+ io::CodedOutputStream* output) {
+ for (int i = 0; i < unknown_fields.field_count(); i++) {
+ const UnknownField& field = unknown_fields.field(i);
+ // The only unknown fields that are allowed to exist in a MessageSet are
+ // messages, which are length-delimited.
+ if (field.type() == UnknownField::TYPE_LENGTH_DELIMITED) {
+ const string& data = field.length_delimited();
+
+ // Start group.
+ output->WriteVarint32(WireFormatLite::kMessageSetItemStartTag);
+
+ // Write type ID.
+ output->WriteVarint32(WireFormatLite::kMessageSetTypeIdTag);
+ output->WriteVarint32(field.number());
+
+ // Write message.
+ output->WriteVarint32(WireFormatLite::kMessageSetMessageTag);
+ output->WriteVarint32(data.size());
+ output->WriteString(data);
+
+ // End group.
+ output->WriteVarint32(WireFormatLite::kMessageSetItemEndTag);
+ }
+ }
+}
+
+uint8* WireFormatLite::SerializeUnknownMessageSetItemsToArray(
+ const UnknownFieldSet& unknown_fields,
+ uint8* target) {
+ for (int i = 0; i < unknown_fields.field_count(); i++) {
+ const UnknownField& field = unknown_fields.field(i);
+
+ // The only unknown fields that are allowed to exist in a MessageSet are
+ // messages, which are length-delimited.
+ if (field.type() == UnknownField::TYPE_LENGTH_DELIMITED) {
+ const string& data = field.length_delimited();
+
+ // Start group.
+ target = io::CodedOutputStream::WriteTagToArray(
+ WireFormatLite::kMessageSetItemStartTag, target);
+
+ // Write type ID.
+ target = io::CodedOutputStream::WriteTagToArray(
+ WireFormatLite::kMessageSetTypeIdTag, target);
+ target = io::CodedOutputStream::WriteVarint32ToArray(
+ field.number(), target);
+
+ // Write message.
+ target = io::CodedOutputStream::WriteTagToArray(
+ WireFormatLite::kMessageSetMessageTag, target);
+ target = io::CodedOutputStream::WriteVarint32ToArray(data.size(), target);
+ target = io::CodedOutputStream::WriteStringToArray(data, target);
+
+ // End group.
+ target = io::CodedOutputStream::WriteTagToArray(
+ WireFormatLite::kMessageSetItemEndTag, target);
+ }
+ }
+
+ return target;
+}
+
+int WireFormatLite::ComputeUnknownFieldsSize(
+ const UnknownFieldSet& unknown_fields) {
+ int size = 0;
+ for (int i = 0; i < unknown_fields.field_count(); i++) {
+ const UnknownField& field = unknown_fields.field(i);
+
+ switch (field.type()) {
+ case UnknownField::TYPE_VARINT:
+ size += io::CodedOutputStream::VarintSize32(
+ WireFormatLite::MakeTag(field.number(),
+ WireFormatLite::WIRETYPE_VARINT));
+ size += io::CodedOutputStream::VarintSize64(field.varint());
+ break;
+ case UnknownField::TYPE_FIXED32:
+ size += io::CodedOutputStream::VarintSize32(
+ WireFormatLite::MakeTag(field.number(),
+ WireFormatLite::WIRETYPE_FIXED32));
+ size += sizeof(int32);
+ break;
+ case UnknownField::TYPE_FIXED64:
+ size += io::CodedOutputStream::VarintSize32(
+ WireFormatLite::MakeTag(field.number(),
+ WireFormatLite::WIRETYPE_FIXED64));
+ size += sizeof(int64);
+ break;
+ case UnknownField::TYPE_LENGTH_DELIMITED:
+ size += io::CodedOutputStream::VarintSize32(
+ WireFormatLite::MakeTag(field.number(),
+ WireFormatLite::WIRETYPE_LENGTH_DELIMITED));
+ size += io::CodedOutputStream::VarintSize32(
+ field.length_delimited().size());
+ size += field.length_delimited().size();
+ break;
+ case UnknownField::TYPE_GROUP:
+ size += io::CodedOutputStream::VarintSize32(
+ WireFormatLite::MakeTag(field.number(),
+ WireFormatLite::WIRETYPE_START_GROUP));
+ size += ComputeUnknownFieldsSize(field.group());
+ size += io::CodedOutputStream::VarintSize32(
+ WireFormatLite::MakeTag(field.number(),
+ WireFormatLite::WIRETYPE_END_GROUP));
+ break;
+ }
+ }
+
+ return size;
+}
+
+int WireFormatLite::ComputeUnknownMessageSetItemsSize(
+ const UnknownFieldSet& unknown_fields) {
+ int size = 0;
+ for (int i = 0; i < unknown_fields.field_count(); i++) {
+ const UnknownField& field = unknown_fields.field(i);
+
+ // The only unknown fields that are allowed to exist in a MessageSet are
+ // messages, which are length-delimited.
+ if (field.type() == UnknownField::TYPE_LENGTH_DELIMITED) {
+ size += WireFormatLite::kMessageSetItemTagsSize;
+ size += io::CodedOutputStream::VarintSize32(field.number());
+ size += io::CodedOutputStream::VarintSize32(
+ field.length_delimited().size());
+ size += field.length_delimited().size();
+ }
+ }
+
+ return size;
}
bool WireFormatLite::ReadPackedEnumNoInline(io::CodedInputStream* input,
diff --git a/third_party/protobuf/src/google/protobuf/wire_format_lite.h b/third_party/protobuf/src/google/protobuf/wire_format_lite.h
index e3d5b2d..5f9f2a3 100644
--- a/third_party/protobuf/src/google/protobuf/wire_format_lite.h
+++ b/third_party/protobuf/src/google/protobuf/wire_format_lite.h
@@ -51,6 +51,7 @@ namespace protobuf {
class CodedInputStream; // coded_stream.h
class CodedOutputStream; // coded_stream.h
}
+ class UnknownFieldSet;
}
namespace protobuf {
@@ -159,15 +160,24 @@ class LIBPROTOBUF_EXPORT WireFormatLite {
// and end tags.
static inline int TagSize(int field_number, WireFormatLite::FieldType type);
+ // -----------------------------------------------------------------
+ // Helpers for dealing with unknown fields
+
// Skips a field value with the given tag. The input should start
// positioned immediately after the tag. Skipped values are simply discarded,
// not recorded anywhere. See WireFormat::SkipField() for a version that
// records to an UnknownFieldSet.
- static bool SkipField(io::CodedInputStream* input, uint32 tag);
+ static bool SkipField(io::CodedInputStream* input, uint32 tag,
+ UnknownFieldSet *unknown_fields);
+
+ // Reads and ignores a message from the input. If unknown_fields is non-NULL,
+ // the contents will be added to it.
+ static bool SkipMessage(io::CodedInputStream* input,
+ UnknownFieldSet* unknown_fields);
- // Reads and ignores a message from the input. Skipped values are simply
- // discarded, not recorded anywhere. See WireFormat::SkipMessage() for a
- // version that records to an UnknownFieldSet.
+
+ // Reads and ignores a message from the input. Skipped values may be stored
+ // in the UnknownFieldSet if it exists.
static bool SkipMessage(io::CodedInputStream* input);
// This macro does the same thing as WireFormatLite::MakeTag(), but the
@@ -224,6 +234,40 @@ class LIBPROTOBUF_EXPORT WireFormatLite {
static uint64 ZigZagEncode64(int64 n);
static int64 ZigZagDecode64(uint64 n);
+ // Write the contents of an UnknownFieldSet to the output.
+ static void SerializeUnknownFields(const UnknownFieldSet& unknown_fields,
+ io::CodedOutputStream* output);
+ // Same as above, except writing directly to the provided buffer.
+ // Requires that the buffer have sufficient capacity for
+ // ComputeUnknownFieldsSize(unknown_fields).
+ //
+ // Returns a pointer past the last written byte.
+ static uint8* SerializeUnknownFieldsToArray(
+ const UnknownFieldSet& unknown_fields,
+ uint8* target);
+
+ // Same thing except for messages that have the message_set_wire_format
+ // option.
+ static void SerializeUnknownMessageSetItems(
+ const UnknownFieldSet& unknown_fields,
+ io::CodedOutputStream* output);
+ // Same as above, except writing directly to the provided buffer.
+ // Requires that the buffer have sufficient capacity for
+ // ComputeUnknownMessageSetItemsSize(unknown_fields).
+ //
+ // Returns a pointer past the last written byte.
+ static uint8* SerializeUnknownMessageSetItemsToArray(
+ const UnknownFieldSet& unknown_fields,
+ uint8* target);
+
+ // Compute the size of the UnknownFieldSet on the wire.
+ static int ComputeUnknownFieldsSize(const UnknownFieldSet& unknown_fields);
+
+ // Same thing except for messages that have the message_set_wire_format
+ // option.
+ static int ComputeUnknownMessageSetItemsSize(
+ const UnknownFieldSet& unknown_fields);
+
// =================================================================
// Methods for reading/writing individual field. The implementations
// of these methods are defined in wire_format_lite_inl.h; you must #include
@@ -494,26 +538,26 @@ class LIBPROTOBUF_EXPORT WireFormatLite {
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(WireFormatLite);
};
-// A class which deals with unknown values. The default implementation just
-// discards them. WireFormat defines a subclass which writes to an
-// UnknownFieldSet. This class is used by ExtensionSet::ParseField(), since
-// ExtensionSet is part of the lite library but UnknownFieldSet is not.
+// A class which deals with unknown values by saving them to an UnknownFieldSet.
class LIBPROTOBUF_EXPORT FieldSkipper {
public:
- FieldSkipper() {}
- virtual ~FieldSkipper() {}
+ FieldSkipper(UnknownFieldSet* unknown_fields)
+ : unknown_fields_(unknown_fields) {}
// Skip a field whose tag has already been consumed.
- virtual bool SkipField(io::CodedInputStream* input, uint32 tag);
+ bool SkipField(io::CodedInputStream* input, uint32 tag);
// Skip an entire message or group, up to an end-group tag (which is consumed)
// or end-of-stream.
- virtual bool SkipMessage(io::CodedInputStream* input);
+ bool SkipMessage(io::CodedInputStream* input);
// Deal with an already-parsed unrecognized enum value. The default
// implementation does nothing, but the UnknownFieldSet-based implementation
// saves it as an unknown varint.
- virtual void SkipUnknownEnum(int field_number, int value);
+ void SkipUnknownEnum(int field_number, int value);
+
+ private:
+ UnknownFieldSet* unknown_fields_;
};
// inline methods ====================================================