HADOOP-13504. Refactor jni_common to conform to C89 restrictions imposed by Visual Studio 2010. Contributed by Sammi Chen
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/dbcaf999 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/dbcaf999 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/dbcaf999 Branch: refs/heads/HADOOP-13345 Commit: dbcaf999d9ea7a7c6c090903d1982e5b61200c8b Parents: c5c3e81 Author: Kai Zheng <kai.zh...@intel.com> Authored: Fri Aug 19 11:18:15 2016 +0800 Committer: Kai Zheng <kai.zh...@intel.com> Committed: Fri Aug 19 11:18:15 2016 +0800 ---------------------------------------------------------------------- .../org/apache/hadoop/io/erasurecode/jni_common.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/dbcaf999/hadoop-common-project/hadoop-common/src/main/native/src/org/apache/hadoop/io/erasurecode/jni_common.c ---------------------------------------------------------------------- diff --git a/hadoop-common-project/hadoop-common/src/main/native/src/org/apache/hadoop/io/erasurecode/jni_common.c b/hadoop-common-project/hadoop-common/src/main/native/src/org/apache/hadoop/io/erasurecode/jni_common.c index 17e05db..2b1d9ea 100644 --- a/hadoop-common-project/hadoop-common/src/main/native/src/org/apache/hadoop/io/erasurecode/jni_common.c +++ b/hadoop-common-project/hadoop-common/src/main/native/src/org/apache/hadoop/io/erasurecode/jni_common.c @@ -43,21 +43,26 @@ void setCoder(JNIEnv* env, jobject thiz, IsalCoder* pCoder) { } IsalCoder* getCoder(JNIEnv* env, jobject thiz) { - jclass clazz = (*env)->GetObjectClass(env, thiz); + jclass clazz; + jmethodID mid; + jboolean verbose; + jfieldID fid; + IsalCoder* pCoder; - jmethodID mid = (*env)->GetMethodID(env, clazz, "allowVerboseDump", "()Z"); + clazz = (*env)->GetObjectClass(env, thiz); + mid = (*env)->GetMethodID(env, clazz, "allowVerboseDump", "()Z"); if (mid == NULL) { THROW(env, "java/lang/UnsatisfiedLinkError", "Method allowVerboseDump not found"); } - jboolean verbose = (*env)->CallBooleanMethod(env, thiz, mid); + verbose = (*env)->CallBooleanMethod(env, thiz, mid); - jfieldID fid = (*env)->GetFieldID(env, clazz, "nativeCoder", "J"); + fid = (*env)->GetFieldID(env, clazz, "nativeCoder", "J"); if (fid == NULL) { THROW(env, "java/lang/UnsatisfiedLinkError", "Field nativeCoder not found"); } - IsalCoder* pCoder = (IsalCoder*)(*env)->GetLongField(env, thiz, fid); + pCoder = (IsalCoder*)(*env)->GetLongField(env, thiz, fid); pCoder->verbose = (verbose == JNI_TRUE) ? 1 : 0; return pCoder; --------------------------------------------------------------------- To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-commits-h...@hadoop.apache.org