Replace NULL with nullptr

Also fixed some lines that were too long, and a few other minor
details.

Change-Id: I6efba5fb6e03eb5d0a300fddb2a75bf8e2f175cb
diff --git a/dalvikvm/dalvikvm.cc b/dalvikvm/dalvikvm.cc
index fd03002..85debe4 100644
--- a/dalvikvm/dalvikvm.cc
+++ b/dalvikvm/dalvikvm.cc
@@ -31,19 +31,19 @@
 // Determine whether or not the specified method is public.
 static bool IsMethodPublic(JNIEnv* env, jclass c, jmethodID method_id) {
   ScopedLocalRef<jobject> reflected(env, env->ToReflectedMethod(c, method_id, JNI_FALSE));
-  if (reflected.get() == NULL) {
+  if (reflected.get() == nullptr) {
     fprintf(stderr, "Failed to get reflected method\n");
     return false;
   }
   // We now have a Method instance.  We need to call its
   // getModifiers() method.
   jclass method_class = env->FindClass("java/lang/reflect/Method");
-  if (method_class == NULL) {
+  if (method_class == nullptr) {
     fprintf(stderr, "Failed to find class java.lang.reflect.Method\n");
     return false;
   }
   jmethodID mid = env->GetMethodID(method_class, "getModifiers", "()I");
-  if (mid == NULL) {
+  if (mid == nullptr) {
     fprintf(stderr, "Failed to find java.lang.reflect.Method.getModifiers\n");
     return false;
   }
@@ -61,7 +61,7 @@
   // it.  Create an array and populate it.  Note argv[0] is not
   // included.
   ScopedLocalRef<jobjectArray> args(env, toStringArray(env, argv + 1));
-  if (args.get() == NULL) {
+  if (args.get() == nullptr) {
     env->ExceptionDescribe();
     return EXIT_FAILURE;
   }
@@ -73,14 +73,14 @@
   std::replace(class_name.begin(), class_name.end(), '.', '/');
 
   ScopedLocalRef<jclass> klass(env, env->FindClass(class_name.c_str()));
-  if (klass.get() == NULL) {
+  if (klass.get() == nullptr) {
     fprintf(stderr, "Unable to locate class '%s'\n", class_name.c_str());
     env->ExceptionDescribe();
     return EXIT_FAILURE;
   }
 
   jmethodID method = env->GetStaticMethodID(klass.get(), "main", "([Ljava/lang/String;)V");
-  if (method == NULL) {
+  if (method == nullptr) {
     fprintf(stderr, "Unable to find static main(String[]) in '%s'\n", class_name.c_str());
     env->ExceptionDescribe();
     return EXIT_FAILURE;
@@ -106,7 +106,7 @@
 // Parse arguments.  Most of it just gets passed through to the runtime.
 // The JNI spec defines a handful of standard arguments.
 static int dalvikvm(int argc, char** argv) {
-  setvbuf(stdout, NULL, _IONBF, 0);
+  setvbuf(stdout, nullptr, _IONBF, 0);
 
   // Skip over argv[0].
   argv++;
@@ -125,8 +125,8 @@
   //
   // [Do we need to catch & handle "-jar" here?]
   bool need_extra = false;
-  const char* lib = NULL;
-  const char* what = NULL;
+  const char* lib = nullptr;
+  const char* what = nullptr;
   int curr_opt, arg_idx;
   for (curr_opt = arg_idx = 0; arg_idx < argc; arg_idx++) {
     if (argv[arg_idx][0] != '-' && !need_extra) {
@@ -172,8 +172,8 @@
   init_args.ignoreUnrecognized = JNI_FALSE;
 
   // Start the runtime. The current thread becomes the main thread.
-  JavaVM* vm = NULL;
-  JNIEnv* env = NULL;
+  JavaVM* vm = nullptr;
+  JNIEnv* env = nullptr;
   if (JNI_CreateJavaVM(&vm, &env, &init_args) != JNI_OK) {
     fprintf(stderr, "Failed to initialize runtime (check log for details)\n");
     return EXIT_FAILURE;