Bug 915312 - Followup: Replace NULL with nullptr. r=glandium
authorMichael Comella <michael.l.comella@gmail.com>
Tue, 23 Sep 2014 13:47:35 -0700
changeset 206860 b18a55eb6d3c2a0087ff0cc489c7f7b9700ecb7b
parent 206859 04f0821da005de73228c19481f65d974661a0b86
child 206861 213c8b42fc880f710102fb7464e3a848a2c4a8cb
push id27543
push userryanvm@gmail.com
push dateWed, 24 Sep 2014 20:02:22 +0000
treeherdermozilla-central@435732392989 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs915312
milestone35.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 915312 - Followup: Replace NULL with nullptr. r=glandium
mozglue/android/NativeCrypto.cpp
--- a/mozglue/android/NativeCrypto.cpp
+++ b/mozglue/android/NativeCrypto.cpp
@@ -17,58 +17,58 @@
  * Helper function to invoke native PBKDF2 function with JNI
  * arguments.
  */
 extern "C" JNIEXPORT jbyteArray JNICALL Java_org_mozilla_gecko_background_nativecode_NativeCrypto_pbkdf2SHA256
     (JNIEnv *env, jclass jc, jbyteArray jpassword, jbyteArray jsalt, jint c, jint dkLen) {
   if (dkLen < 0) {
     env->ThrowNew(env->FindClass("java/lang/IllegalArgumentException"),
                   "dkLen should not be less than 0");
-    return NULL;
+    return nullptr;
   }
 
-  jbyte *password = env->GetByteArrayElements(jpassword, NULL);
+  jbyte *password = env->GetByteArrayElements(jpassword, nullptr);
   size_t passwordLen = env->GetArrayLength(jpassword);
 
-  jbyte *salt = env->GetByteArrayElements(jsalt, NULL);
+  jbyte *salt = env->GetByteArrayElements(jsalt, nullptr);
   size_t saltLen = env->GetArrayLength(jsalt);
 
   uint8_t hashResult[dkLen];
   PBKDF2_SHA256((uint8_t *) password, passwordLen, (uint8_t *) salt, saltLen,
       (uint64_t) c, hashResult, (size_t) dkLen);
 
   env->ReleaseByteArrayElements(jpassword, password, JNI_ABORT);
   env->ReleaseByteArrayElements(jsalt, salt, JNI_ABORT);
 
   jbyteArray out = env->NewByteArray(dkLen);
-  if (out == NULL) {
-    return NULL;
+  if (out == nullptr) {
+    return nullptr;
   }
   env->SetByteArrayRegion(out, 0, dkLen, (jbyte *) hashResult);
 
   return out;
 }
 
 using namespace mozilla;
 
 /**
  * Helper function to invoke native SHA-1 function with JNI arguments.
  */
 extern "C" JNIEXPORT jbyteArray JNICALL Java_org_mozilla_gecko_background_nativecode_NativeCrypto_sha1
     (JNIEnv *env, jclass jc, jbyteArray jstr) {
-  jbyte *str = env->GetByteArrayElements(jstr, NULL);
+  jbyte *str = env->GetByteArrayElements(jstr, nullptr);
   size_t strLen = env->GetArrayLength(jstr);
 
   SHA1Sum sha1;
   SHA1Sum::Hash hashResult;
   sha1.update((void *) str, (uint32_t) strLen);
   sha1.finish(hashResult);
 
   env->ReleaseByteArrayElements(jstr, str, JNI_ABORT);
 
   jbyteArray out = env->NewByteArray(SHA1Sum::kHashSize);
-  if (out == NULL) {
-    return NULL;
+  if (out == nullptr) {
+    return nullptr;
   }
   env->SetByteArrayRegion(out, 0, SHA1Sum::kHashSize, (jbyte *) hashResult);
 
   return out;
 }