From ad1b0d94073803719c7a62910cb85b04aa26b806 Mon Sep 17 00:00:00 2001 From: Sebastian Rasmussen Date: Thu, 15 Sep 2016 13:04:03 +0800 Subject: JNI: Check context in consistent way. Also there is no need to check self pointer since JVM does not even call the JNI binding for null pointers. --- platform/java/mupdf_native.c | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) (limited to 'platform') diff --git a/platform/java/mupdf_native.c b/platform/java/mupdf_native.c index ae213478..c1739680 100644 --- a/platform/java/mupdf_native.c +++ b/platform/java/mupdf_native.c @@ -3720,7 +3720,8 @@ FUN(Document_proofNative)(JNIEnv *env, jobject self, jstring jCurrentPath, jstri const char *printProfile = NULL; const char *displayProfile = NULL; - if (ctx == NULL || doc == NULL || jCurrentPath == NULL || jPrintProfile == NULL || jDisplayProfile == NULL) + if (!ctx) return NULL; + if (jCurrentPath == NULL || jPrintProfile == NULL || jDisplayProfile == NULL) return NULL; currentPath = (*env)->GetStringUTFChars(env, jCurrentPath, NULL); @@ -4057,11 +4058,7 @@ FUN(Page_countSeparations)(JNIEnv *env, jobject self) fz_page *page = from_Page(env, self); int nSep; - if (ctx==NULL || page==NULL) - { - LOGI("Page_countSeparations fail %x %x", (unsigned int)ctx, (unsigned int)page); - return 0; - } + if (!ctx) return 0; nSep = fz_count_separations_on_page(ctx, page); @@ -4076,11 +4073,7 @@ FUN(Page_enableSeparation)(JNIEnv *env, jobject self, int sep, jboolean enable) fz_context *ctx = get_context(env); fz_page *page = from_Page(env, self); - if (ctx==NULL || page==NULL) - { - LOGI("Page_enableSeparation fail %x %x", (unsigned int)ctx, (unsigned int)page); - return; - } + if (!ctx) return; fz_control_separation_on_page(ctx, page, sep, !enable); } @@ -4099,11 +4092,7 @@ FUN(Page_getSeparation)(JNIEnv *env, jobject self, int sep) jclass sepClass; jmethodID ctor; - if (ctx==NULL || page==NULL) - { - LOGI("Page_getSeparation fail %x %x", (unsigned int)ctx, (unsigned int)page); - return 0; - } + if (!ctx) return NULL; err = 0; sepClass = get_class(&err, env, PKG"Separation"); -- cgit v1.2.3