Skip to content

Commit

Permalink
Bug 956783 - Stop using NULL in Fennec's JNI code; r=jchen
Browse files Browse the repository at this point in the history
  • Loading branch information
ehsan committed Jan 6, 2014
1 parent 6f5b258 commit b6f3a34
Show file tree
Hide file tree
Showing 4 changed files with 229 additions and 229 deletions.
10 changes: 5 additions & 5 deletions build/annotationProcessors/CodeGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ private void generateWrapperMethod() {
" JNIEnv *env = GetJNIForThread();\n\n" +
" if (!env) {\n" +
" ALOG_BRIDGE(\"Aborted: No env - %s\", __PRETTY_FUNCTION__);\n" +
" return NULL;\n" +
" return nullptr;\n" +
" }\n\n" +
" ").append(mCClassName).append("* ret = new ").append(mCClassName).append("(obj, env);\n" +
" env->DeleteLocalRef(obj);\n" +
Expand Down Expand Up @@ -407,7 +407,7 @@ private void writeCtorBody(String implementationSignature, Constructor theCtor,
// Tack on the arguments, if any..
.append(argumentContent)
.append("), env);\n" +
" env->PopLocalFrame(NULL);\n" +
" env->PopLocalFrame(nullptr);\n" +
"}\n");
}

Expand Down Expand Up @@ -484,7 +484,7 @@ private void writeMethodBody(String methodSignature, String aCMethodName, Method
" ALOG_BRIDGE(\"Exceptional exit of: %s\", __PRETTY_FUNCTION__);\n" +
" env->ExceptionDescribe();\n" +
" env->ExceptionClear();\n" +
" env->PopLocalFrame(NULL);\n" +
" env->PopLocalFrame(nullptr);\n" +
" return").append(Utils.getFailureReturnForType(returnType)).append(";\n" +
" }\n\n");

Expand All @@ -498,11 +498,11 @@ private void writeMethodBody(String methodSignature, String aCMethodName, Method
} else if (!returnType.getCanonicalName().equals("void")) {
// If we're a primitive-returning function, just return the directly-obtained primative
// from the call to Java.
wrapperMethodBodies.append(" env->PopLocalFrame(NULL);\n" +
wrapperMethodBodies.append(" env->PopLocalFrame(nullptr);\n" +
" return temp;\n");
} else {
// If we don't return anything, just pop the stack frame and move on with life.
wrapperMethodBodies.append(" env->PopLocalFrame(NULL);\n");
wrapperMethodBodies.append(" env->PopLocalFrame(nullptr);\n");
}
wrapperMethodBodies.append("}\n");
}
Expand Down
2 changes: 1 addition & 1 deletion mobile/android/base/jni-generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def process(self, inputfile):
if returnType == 'void':
returnValue = ''
elif returnType in ('jobject', 'jstring'):
returnValue = 'NULL'
returnValue = 'nullptr'
elif returnType in ('jint', 'jfloat', 'jdouble', 'jlong'):
returnValue = '0'
elif returnType == 'jboolean':
Expand Down
6 changes: 3 additions & 3 deletions mozglue/android/jni-stubs.inc
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Java_org_mozilla_gecko_GeckoAppShell_getNextMessageFromQueue(JNIEnv * arg0, jcla
if (!f_Java_org_mozilla_gecko_GeckoAppShell_getNextMessageFromQueue) {
arg0->ThrowNew(arg0->FindClass("java/lang/UnsupportedOperationException"),
"JNI Function called before it was loaded");
return NULL;
return nullptr;
}
return f_Java_org_mozilla_gecko_GeckoAppShell_getNextMessageFromQueue(arg0, arg1, arg2);
}
Expand Down Expand Up @@ -236,7 +236,7 @@ Java_org_mozilla_gecko_GeckoAppShell_getSurfaceBits(JNIEnv * arg0, jclass arg1,
if (!f_Java_org_mozilla_gecko_GeckoAppShell_getSurfaceBits) {
arg0->ThrowNew(arg0->FindClass("java/lang/UnsupportedOperationException"),
"JNI Function called before it was loaded");
return NULL;
return nullptr;
}
return f_Java_org_mozilla_gecko_GeckoAppShell_getSurfaceBits(arg0, arg1, arg2);
}
Expand Down Expand Up @@ -559,7 +559,7 @@ Java_org_mozilla_gecko_ANRReporter_getNativeStack(JNIEnv * arg0, jclass arg1) {
if (!f_Java_org_mozilla_gecko_ANRReporter_getNativeStack) {
arg0->ThrowNew(arg0->FindClass("java/lang/UnsupportedOperationException"),
"JNI Function called before it was loaded");
return NULL;
return nullptr;
}
return f_Java_org_mozilla_gecko_ANRReporter_getNativeStack(arg0, arg1);
}
Expand Down
Loading

0 comments on commit b6f3a34

Please sign in to comment.