From 5460ea389d83722ac98abaef8a2bb9900fb571e7 Mon Sep 17 00:00:00 2001
From: Ken Wakasa <kwakasa@google.com>
Date: Mon, 30 Jul 2012 16:27:44 +0900
Subject: [PATCH] Misc cleanups

Change-Id: I28308f12c3064299acefc346b72279036c3726a7
---
 ...com_android_inputmethod_keyboard_ProximityInfo.cpp |  3 +--
 .../com_android_inputmethod_keyboard_ProximityInfo.h  |  3 +--
 ...com_android_inputmethod_latin_BinaryDictionary.cpp |  3 +--
 .../com_android_inputmethod_latin_BinaryDictionary.h  |  3 +--
 .../jni/com_android_inputmethod_latin_NativeUtils.cpp |  3 +--
 .../jni/com_android_inputmethod_latin_NativeUtils.h   |  3 +--
 native/jni/jni_common.cpp                             | 11 +++++------
 native/jni/jni_common.h                               |  3 +--
 native/jni/src/bigram_dictionary.cpp                  |  3 +--
 native/jni/src/debug.h                                |  3 +--
 native/jni/src/defines.h                              |  5 ++---
 native/jni/src/dictionary.cpp                         |  1 -
 native/jni/src/unigram_dictionary.cpp                 |  3 +--
 13 files changed, 17 insertions(+), 30 deletions(-)

diff --git a/native/jni/com_android_inputmethod_keyboard_ProximityInfo.cpp b/native/jni/com_android_inputmethod_keyboard_ProximityInfo.cpp
index 0a8aabf4f5..42284edd14 100644
--- a/native/jni/com_android_inputmethod_keyboard_ProximityInfo.cpp
+++ b/native/jni/com_android_inputmethod_keyboard_ProximityInfo.cpp
@@ -1,6 +1,5 @@
 /*
- *
- * Copyright 2011, The Android Open Source Project
+ * Copyright (C) 2011, The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/native/jni/com_android_inputmethod_keyboard_ProximityInfo.h b/native/jni/com_android_inputmethod_keyboard_ProximityInfo.h
index f5ccf20536..51fa895d3c 100644
--- a/native/jni/com_android_inputmethod_keyboard_ProximityInfo.h
+++ b/native/jni/com_android_inputmethod_keyboard_ProximityInfo.h
@@ -1,6 +1,5 @@
 /*
- *
- * Copyright 2011, The Android Open Source Project
+ * Copyright (C) 2011, The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/native/jni/com_android_inputmethod_latin_BinaryDictionary.cpp b/native/jni/com_android_inputmethod_latin_BinaryDictionary.cpp
index 8725b0c9d2..71bef937d1 100644
--- a/native/jni/com_android_inputmethod_latin_BinaryDictionary.cpp
+++ b/native/jni/com_android_inputmethod_latin_BinaryDictionary.cpp
@@ -1,6 +1,5 @@
 /*
- *
- * Copyright 2009, The Android Open Source Project
+ * Copyright (C) 2009, The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/native/jni/com_android_inputmethod_latin_BinaryDictionary.h b/native/jni/com_android_inputmethod_latin_BinaryDictionary.h
index 0b67e6b952..b9e944f070 100644
--- a/native/jni/com_android_inputmethod_latin_BinaryDictionary.h
+++ b/native/jni/com_android_inputmethod_latin_BinaryDictionary.h
@@ -1,6 +1,5 @@
 /*
- *
- * Copyright 2011, The Android Open Source Project
+ * Copyright (C) 2011, The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/native/jni/com_android_inputmethod_latin_NativeUtils.cpp b/native/jni/com_android_inputmethod_latin_NativeUtils.cpp
index 32d895405b..9aae817166 100644
--- a/native/jni/com_android_inputmethod_latin_NativeUtils.cpp
+++ b/native/jni/com_android_inputmethod_latin_NativeUtils.cpp
@@ -1,6 +1,5 @@
 /*
- *
- * Copyright 2012, The Android Open Source Project
+ * Copyright (C) 2012, The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/native/jni/com_android_inputmethod_latin_NativeUtils.h b/native/jni/com_android_inputmethod_latin_NativeUtils.h
index 4d29d7d472..d1ffb8f4a4 100644
--- a/native/jni/com_android_inputmethod_latin_NativeUtils.h
+++ b/native/jni/com_android_inputmethod_latin_NativeUtils.h
@@ -1,6 +1,5 @@
 /*
- *
- * Copyright 2012, The Android Open Source Project
+ * Copyright (C) 2012, The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/native/jni/jni_common.cpp b/native/jni/jni_common.cpp
index 8d7bce79e8..4eeda1d4e0 100644
--- a/native/jni/jni_common.cpp
+++ b/native/jni/jni_common.cpp
@@ -1,6 +1,5 @@
 /*
- *
- * Copyright 2011, The Android Open Source Project
+ * Copyright (C) 2011, The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -37,11 +36,11 @@ jint JNI_OnLoad(JavaVM *vm, void *reserved) {
     JNIEnv *env = 0;
     jint result = -1;
 
-    if (vm->GetEnv((void**) &env, JNI_VERSION_1_4) != JNI_OK) {
+    if (vm->GetEnv(reinterpret_cast<void**>(&env), JNI_VERSION_1_6) != JNI_OK) {
         AKLOGE("ERROR: GetEnv failed");
         goto bail;
     }
-    assert(env != 0);
+    assert(env);
 
     if (!register_BinaryDictionary(env)) {
         AKLOGE("ERROR: BinaryDictionary native registration failed");
@@ -59,7 +58,7 @@ jint JNI_OnLoad(JavaVM *vm, void *reserved) {
     }
 
     /* success -- return valid version number */
-    result = JNI_VERSION_1_4;
+    result = JNI_VERSION_1_6;
 
 bail:
     return result;
@@ -70,7 +69,7 @@ namespace latinime {
 int registerNativeMethods(JNIEnv *env, const char *className, JNINativeMethod *methods,
         int numMethods) {
     jclass clazz = env->FindClass(className);
-    if (clazz == 0) {
+    if (!clazz) {
         AKLOGE("Native registration unable to find class '%s'", className);
         return JNI_FALSE;
     }
diff --git a/native/jni/jni_common.h b/native/jni/jni_common.h
index 32f9fa9b8a..771361d5e9 100644
--- a/native/jni/jni_common.h
+++ b/native/jni/jni_common.h
@@ -1,6 +1,5 @@
 /*
- *
- * Copyright 2011, The Android Open Source Project
+ * Copyright (C) 2011, The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/native/jni/src/bigram_dictionary.cpp b/native/jni/src/bigram_dictionary.cpp
index 4f5493ad17..8dc212203b 100644
--- a/native/jni/src/bigram_dictionary.cpp
+++ b/native/jni/src/bigram_dictionary.cpp
@@ -1,6 +1,5 @@
 /*
- *
- * Copyright 2010, The Android Open Source Project
+ * Copyright (C) 2010, The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/native/jni/src/debug.h b/native/jni/src/debug.h
index 2fee6e83fe..2168d66723 100644
--- a/native/jni/src/debug.h
+++ b/native/jni/src/debug.h
@@ -1,6 +1,5 @@
 /*
- *
- * Copyright 2011, The Android Open Source Project
+ * Copyright (C) 2011, The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/native/jni/src/defines.h b/native/jni/src/defines.h
index 05b997d593..e172b0441d 100644
--- a/native/jni/src/defines.h
+++ b/native/jni/src/defines.h
@@ -1,6 +1,5 @@
 /*
- *
- * Copyright 2010, The Android Open Source Project
+ * Copyright (C) 2010, The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -96,7 +95,7 @@ static inline void prof_out(void) {
     }
     if (all == 0) all = 1;
     for (int i = 0; i < PROF_BUF_SIZE - 1; ++i) {
-        if (profile_buf[i] != 0) {
+        if (profile_buf[i]) {
             AKLOGI("(%d): Used %4.2f%%, %8.4f ms. Called %d times.",
                     i, (profile_buf[i] * 100 / all),
                     profile_buf[i] * 1000 / (float)CLOCKS_PER_SEC, profile_counter[i]);
diff --git a/native/jni/src/dictionary.cpp b/native/jni/src/dictionary.cpp
index 4703a38e8d..dabd98b5f1 100644
--- a/native/jni/src/dictionary.cpp
+++ b/native/jni/src/dictionary.cpp
@@ -1,5 +1,4 @@
 /*
- *
  * Copyright (C) 2009, The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/native/jni/src/unigram_dictionary.cpp b/native/jni/src/unigram_dictionary.cpp
index b121d08a8e..ce3108b3b0 100644
--- a/native/jni/src/unigram_dictionary.cpp
+++ b/native/jni/src/unigram_dictionary.cpp
@@ -1,6 +1,5 @@
 /*
- *
- * Copyright 2010, The Android Open Source Project
+ * Copyright (C) 2010, The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
-- 
GitLab