aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/google/protobuf/util/internal/type_info.cc
diff options
context:
space:
mode:
authorGravatar Feng Xiao <xfxyjwf@gmail.com>2017-03-29 14:32:48 -0700
committerGravatar Feng Xiao <xfxyjwf@gmail.com>2017-03-29 14:33:05 -0700
commitd36c0c538a545fac5d9db6ba65c525246d4efa95 (patch)
tree3fd29af0f137dfaf5df892723e60600f674392b3 /src/google/protobuf/util/internal/type_info.cc
parent4a0dd03e52e09332c8fd0f8f26a8e0ae9f911182 (diff)
Down-integrate from google3.
Diffstat (limited to 'src/google/protobuf/util/internal/type_info.cc')
-rw-r--r--src/google/protobuf/util/internal/type_info.cc18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/google/protobuf/util/internal/type_info.cc b/src/google/protobuf/util/internal/type_info.cc
index a5d903f1..85d0d5c9 100644
--- a/src/google/protobuf/util/internal/type_info.cc
+++ b/src/google/protobuf/util/internal/type_info.cc
@@ -107,10 +107,12 @@ class TypeInfoForTypeResolver : public TypeInfo {
virtual const google::protobuf::Field* FindField(
const google::protobuf::Type* type, StringPiece camel_case_name) const {
- std::map<const google::protobuf::Type*,
- CamelCaseNameTable>::const_iterator it = indexed_types_.find(type);
- const CamelCaseNameTable& camel_case_name_table = (it == indexed_types_.end())
- ? PopulateNameLookupTable(type, &indexed_types_[type]) : it->second;
+ std::map<const google::protobuf::Type*, CamelCaseNameTable>::const_iterator
+ it = indexed_types_.find(type);
+ const CamelCaseNameTable& camel_case_name_table =
+ (it == indexed_types_.end())
+ ? PopulateNameLookupTable(type, &indexed_types_[type])
+ : it->second;
StringPiece name =
FindWithDefault(camel_case_name_table, camel_case_name, StringPiece());
if (name.empty()) {
@@ -142,8 +144,8 @@ class TypeInfoForTypeResolver : public TypeInfo {
const google::protobuf::Field& field = type->fields(i);
StringPiece name = field.name();
StringPiece camel_case_name = field.json_name();
- const StringPiece* existing = InsertOrReturnExisting(
- camel_case_name_table, camel_case_name, name);
+ const StringPiece* existing =
+ InsertOrReturnExisting(camel_case_name_table, camel_case_name, name);
if (existing && *existing != name) {
GOOGLE_LOG(WARNING) << "Field '" << name << "' and '" << *existing
<< "' map to the same camel case name '" << camel_case_name
@@ -162,8 +164,8 @@ class TypeInfoForTypeResolver : public TypeInfo {
mutable std::map<StringPiece, StatusOrType> cached_types_;
mutable std::map<StringPiece, StatusOrEnum> cached_enums_;
- mutable std::map<const google::protobuf::Type*,
- CamelCaseNameTable> indexed_types_;
+ mutable std::map<const google::protobuf::Type*, CamelCaseNameTable>
+ indexed_types_;
};
} // namespace