Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(151)

Unified Diff: third_party/protobuf/src/google/protobuf/compiler/java/java_enum_field_lite.cc

Issue 2495533002: third_party/protobuf: Update to HEAD (83d681ee2c) (Closed)
Patch Set: Make chrome settings proto generated file a component Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/protobuf/src/google/protobuf/compiler/java/java_enum_field_lite.cc
diff --git a/third_party/protobuf/src/google/protobuf/compiler/java/java_enum_field_lite.cc b/third_party/protobuf/src/google/protobuf/compiler/java/java_enum_field_lite.cc
index 908d6db413144a22e7cd09a833bce5a07a14ef30..f1dc47fc3724f4d2da3b0c29f9e1934f892de081 100644
--- a/third_party/protobuf/src/google/protobuf/compiler/java/java_enum_field_lite.cc
+++ b/third_party/protobuf/src/google/protobuf/compiler/java/java_enum_field_lite.cc
@@ -58,7 +58,7 @@ void SetEnumVariables(const FieldDescriptor* descriptor,
int builderBitIndex,
const FieldGeneratorInfo* info,
ClassNameResolver* name_resolver,
- map<string, string>* variables) {
+ std::map<string, string>* variables) {
SetCommonFieldVariables(descriptor, info, variables);
(*variables)["type"] =
@@ -68,7 +68,8 @@ void SetEnumVariables(const FieldDescriptor* descriptor,
(*variables)["default"] = ImmutableDefaultValue(descriptor, name_resolver);
(*variables)["default_number"] = SimpleItoa(
descriptor->default_value_enum()->number());
- (*variables)["tag"] = SimpleItoa(internal::WireFormat::MakeTag(descriptor));
+ (*variables)["tag"] =
+ SimpleItoa(static_cast<int32>(internal::WireFormat::MakeTag(descriptor)));
(*variables)["tag_size"] = SimpleItoa(
internal::WireFormat::TagSize(descriptor->number(), GetType(descriptor)));
// TODO(birdo): Add @deprecated javadoc when generating javadoc is supported
@@ -258,7 +259,9 @@ GenerateFieldBuilderInitializationCode(io::Printer* printer) const {
void ImmutableEnumFieldLiteGenerator::
GenerateInitializationCode(io::Printer* printer) const {
- printer->Print(variables_, "$name$_ = $default_number$;\n");
+ if (!IsDefaultValueJavaDefault(descriptor_)) {
+ printer->Print(variables_, "$name$_ = $default_number$;\n");
+ }
}
void ImmutableEnumFieldLiteGenerator::
@@ -885,8 +888,8 @@ GenerateSerializationCode(io::Printer* printer) const {
if (descriptor_->options().packed()) {
printer->Print(variables_,
"if (get$capitalized_name$List().size() > 0) {\n"
- " output.writeRawVarint32($tag$);\n"
- " output.writeRawVarint32($name$MemoizedSerializedSize);\n"
+ " output.writeUInt32NoTag($tag$);\n"
+ " output.writeUInt32NoTag($name$MemoizedSerializedSize);\n"
"}\n"
"for (int i = 0; i < $name$_.size(); i++) {\n"
" output.writeEnumNoTag($name$_.getInt(i));\n"
@@ -918,7 +921,7 @@ GenerateSerializedSizeCode(io::Printer* printer) const {
"if (!get$capitalized_name$List().isEmpty()) {"
" size += $tag_size$;\n"
" size += com.google.protobuf.CodedOutputStream\n"
- " .computeRawVarint32Size(dataSize);\n"
+ " .computeUInt32SizeNoTag(dataSize);\n"
"}");
} else {
printer->Print(variables_,

Powered by Google App Engine
This is Rietveld 408576698