aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/google/protobuf/util/internal/utility.cc
diff options
context:
space:
mode:
authorGravatar guptasu <guptasu@google.com>2016-11-10 10:23:00 -0800
committerGravatar guptasu <guptasu@google.com>2016-11-10 10:23:00 -0800
commitfce8b6b9245ee597a689d6985cd2f41e3bc7b0c1 (patch)
tree43f61d00fb3bdb2f40eb736849350750f3d9dfb1 /src/google/protobuf/util/internal/utility.cc
parentce5160b83b03c29fd27fc9f58370092b321bf2bc (diff)
Made helper code also consider package name 'proto2' when dealing with MessageOptions.
This is done so that the same library can be used irrespective of whether MessageOptions belong to package name 'proto2' or 'google.protobuf'
Diffstat (limited to 'src/google/protobuf/util/internal/utility.cc')
-rw-r--r--src/google/protobuf/util/internal/utility.cc21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/google/protobuf/util/internal/utility.cc b/src/google/protobuf/util/internal/utility.cc
index 9aab3481..05328255 100644
--- a/src/google/protobuf/util/internal/utility.cc
+++ b/src/google/protobuf/util/internal/utility.cc
@@ -356,15 +356,23 @@ bool IsValidBoolString(const string& bool_string) {
bool IsMap(const google::protobuf::Field& field,
const google::protobuf::Type& type) {
- return (field.cardinality() ==
- google::protobuf::Field_Cardinality_CARDINALITY_REPEATED &&
- GetBoolOptionOrDefault(type.options(),
- "google.protobuf.MessageOptions.map_entry", false));
+ return (
+ field.cardinality() ==
+ google::protobuf::Field_Cardinality_CARDINALITY_REPEATED &&
+ (GetBoolOptionOrDefault(
+ type.options(), "google.protobuf.MessageOptions.map_entry", false) ||
+ GetBoolOptionOrDefault(type.options(), "proto2.MessageOptions.map_entry",
+ false)));
}
bool IsMessageSetWireFormat(const google::protobuf::Type& type) {
- return GetBoolOptionOrDefault(
- type.options(), "google.protobuf.MessageOptions.message_set_wire_format", false);
+ return (
+ GetBoolOptionOrDefault(
+ type.options(),
+ "google.protobuf.MessageOptions.message_set_wire_format", false) ||
+ GetBoolOptionOrDefault(type.options(),
+ "proto2.MessageOptions.message_set_wire_format",
+ false));
}
string DoubleAsString(double value) {
@@ -404,3 +412,4 @@ bool SafeStrToFloat(StringPiece str, float* value) {
} // namespace util
} // namespace protobuf
} // namespace google
+