aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBrian Duff <bduff@google.com>2014-07-21 14:31:07 -0700
committerBrian Duff <bduff@google.com>2014-07-21 14:31:07 -0700
commit7acc0f831f6e99ec4b922dde9cede1b45bae5ce3 (patch)
tree27c5e66c7ee5e363757764323f001e6ad5dcdf9f /src
parent2a5f3f97a0e782878ac80d2b94f0fdae0733a821 (diff)
downloadprotobuf-7acc0f831f6e99ec4b922dde9cede1b45bae5ce3.tar.gz
protobuf-7acc0f831f6e99ec4b922dde9cede1b45bae5ce3.tar.bz2
protobuf-7acc0f831f6e99ec4b922dde9cede1b45bae5ce3.zip
Don't return NULL from {Boxed}PrimitiveTypeName.
The behavior of the string ctor is undefined when you pass NULL. This is checked strictly in C++11, so fails to compile. Change-Id: Id5e0984ad1d37f2d504f7c42ac23e52ed4a58903
Diffstat (limited to 'src')
-rw-r--r--src/google/protobuf/compiler/javanano/javanano_helpers.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/google/protobuf/compiler/javanano/javanano_helpers.cc b/src/google/protobuf/compiler/javanano/javanano_helpers.cc
index e8326a42..bf88f253 100644
--- a/src/google/protobuf/compiler/javanano/javanano_helpers.cc
+++ b/src/google/protobuf/compiler/javanano/javanano_helpers.cc
@@ -336,14 +336,14 @@ string PrimitiveTypeName(JavaType type) {
case JAVATYPE_STRING : return "java.lang.String";
case JAVATYPE_BYTES : return "byte[]";
case JAVATYPE_ENUM : return "int";
- case JAVATYPE_MESSAGE: return NULL;
+ case JAVATYPE_MESSAGE: return "";
// No default because we want the compiler to complain if any new
// JavaTypes are added.
}
GOOGLE_LOG(FATAL) << "Can't get here.";
- return NULL;
+ return "";
}
string BoxedPrimitiveTypeName(JavaType type) {
@@ -356,14 +356,14 @@ string BoxedPrimitiveTypeName(JavaType type) {
case JAVATYPE_STRING : return "java.lang.String";
case JAVATYPE_BYTES : return "byte[]";
case JAVATYPE_ENUM : return "java.lang.Integer";
- case JAVATYPE_MESSAGE: return NULL;
+ case JAVATYPE_MESSAGE: return "";
// No default because we want the compiler to complain if any new
// JavaTypes are added.
}
GOOGLE_LOG(FATAL) << "Can't get here.";
- return NULL;
+ return "";
}
string EmptyArrayName(const Params& params, const FieldDescriptor* field) {