Commit 7acc0f83 authored by Brian Duff's avatar Brian Duff

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
parent 2a5f3f97
...@@ -336,14 +336,14 @@ string PrimitiveTypeName(JavaType type) { ...@@ -336,14 +336,14 @@ string PrimitiveTypeName(JavaType type) {
case JAVATYPE_STRING : return "java.lang.String"; case JAVATYPE_STRING : return "java.lang.String";
case JAVATYPE_BYTES : return "byte[]"; case JAVATYPE_BYTES : return "byte[]";
case JAVATYPE_ENUM : return "int"; 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 // No default because we want the compiler to complain if any new
// JavaTypes are added. // JavaTypes are added.
} }
GOOGLE_LOG(FATAL) << "Can't get here."; GOOGLE_LOG(FATAL) << "Can't get here.";
return NULL; return "";
} }
string BoxedPrimitiveTypeName(JavaType type) { string BoxedPrimitiveTypeName(JavaType type) {
...@@ -356,14 +356,14 @@ string BoxedPrimitiveTypeName(JavaType type) { ...@@ -356,14 +356,14 @@ string BoxedPrimitiveTypeName(JavaType type) {
case JAVATYPE_STRING : return "java.lang.String"; case JAVATYPE_STRING : return "java.lang.String";
case JAVATYPE_BYTES : return "byte[]"; case JAVATYPE_BYTES : return "byte[]";
case JAVATYPE_ENUM : return "java.lang.Integer"; 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 // No default because we want the compiler to complain if any new
// JavaTypes are added. // JavaTypes are added.
} }
GOOGLE_LOG(FATAL) << "Can't get here."; GOOGLE_LOG(FATAL) << "Can't get here.";
return NULL; return "";
} }
string EmptyArrayName(const Params& params, const FieldDescriptor* field) { string EmptyArrayName(const Params& params, const FieldDescriptor* field) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment