diff options
author | 2013-01-08 17:57:26 +0900 | |
---|---|---|
committer | 2013-01-08 17:57:26 +0900 | |
commit | aaefc4b30c2cfac105374eb2ae83cf34c975a0cc (patch) | |
tree | f2d94562170ac3fa1437936a2ab7bc35ea59d4df /native/jni/jni_common.cpp | |
parent | a10b1a88443a16bb1b5af1af63d0ed501b25f55d (diff) | |
download | latinime-aaefc4b30c2cfac105374eb2ae83cf34c975a0cc.tar.gz latinime-aaefc4b30c2cfac105374eb2ae83cf34c975a0cc.tar.xz latinime-aaefc4b30c2cfac105374eb2ae83cf34c975a0cc.zip |
Yet another small cleanups
Change-Id: Ie940c4d4d9d85c95e2f04ba23f00a54ba3dc53bf
Diffstat (limited to 'native/jni/jni_common.cpp')
-rw-r--r-- | native/jni/jni_common.cpp | 35 |
1 files changed, 14 insertions, 21 deletions
diff --git a/native/jni/jni_common.cpp b/native/jni/jni_common.cpp index 0da166903..7b97cf4db 100644 --- a/native/jni/jni_common.cpp +++ b/native/jni/jni_common.cpp @@ -1,11 +1,11 @@ /* - * Copyright (C) 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. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -25,45 +25,38 @@ #include "jni.h" #include "jni_common.h" -using namespace latinime; - /* * Returns the JNI version on success, -1 on failure. */ jint JNI_OnLoad(JavaVM *vm, void *reserved) { JNIEnv *env = 0; - jint result = -1; if (vm->GetEnv(reinterpret_cast<void **>(&env), JNI_VERSION_1_6) != JNI_OK) { AKLOGE("ERROR: GetEnv failed"); - goto bail; + return -1; } assert(env); - - if (!register_BinaryDictionary(env)) { + if (!env) { + AKLOGE("ERROR: JNIEnv is invalid"); + return -1; + } + if (!latinime::register_BinaryDictionary(env)) { AKLOGE("ERROR: BinaryDictionary native registration failed"); - goto bail; + return -1; } - - if (!register_DicTraverseSession(env)) { + if (!latinime::register_DicTraverseSession(env)) { AKLOGE("ERROR: DicTraverseSession native registration failed"); - goto bail; + return -1; } - - if (!register_ProximityInfo(env)) { + if (!latinime::register_ProximityInfo(env)) { AKLOGE("ERROR: ProximityInfo native registration failed"); - goto bail; + return -1; } - /* success -- return valid version number */ - result = JNI_VERSION_1_6; - -bail: - return result; + return JNI_VERSION_1_6; } namespace latinime { - int registerNativeMethods(JNIEnv *env, const char *className, JNINativeMethod *methods, int numMethods) { jclass clazz = env->FindClass(className); |