diff options
author | Sebastian Rasmussen <sebras@gmail.com> | 2016-09-05 12:54:47 +0800 |
---|---|---|
committer | Sebastian Rasmussen <sebras@gmail.com> | 2016-09-08 18:53:00 +0800 |
commit | b49db07c48afbea5d576bcf7a55f2c0825ad2108 (patch) | |
tree | bc697bb4d73733591ef5da3803d9aefbc500ff64 /platform | |
parent | f4961c39e43132663bfa13b456c7d1a08d0be386 (diff) | |
download | mupdf-b49db07c48afbea5d576bcf7a55f2c0825ad2108.tar.xz |
JNI: Use Android enum for detecting failure.
Diffstat (limited to 'platform')
-rw-r--r-- | platform/java/mupdf_native.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/platform/java/mupdf_native.c b/platform/java/mupdf_native.c index 94731810..3cf18f7a 100644 --- a/platform/java/mupdf_native.c +++ b/platform/java/mupdf_native.c @@ -2316,7 +2316,7 @@ static void androidDrawDevice_lock(JNIEnv *env, NativeDeviceInfo *info) assert(info); assert(info->object); - if (AndroidBitmap_lockPixels(env, info->object, (void **)&pixels) < 0) + if (AndroidBitmap_lockPixels(env, info->object, (void **)&pixels) != ANDROID_BITMAP_RESULT_SUCCESS) { jni_throw(env, FZ_ERROR_GENERIC, "bitmap lock failed in DrawDevice call"); return; @@ -2333,10 +2333,8 @@ static void androidDrawDevice_unlock(JNIEnv *env, NativeDeviceInfo *info) assert(info); assert(info->object); - if (AndroidBitmap_unlockPixels(env, info->object) < 0) - { + if (AndroidBitmap_unlockPixels(env, info->object) != ANDROID_BITMAP_RESULT_SUCCESS) jni_throw(env, FZ_ERROR_GENERIC, "bitmap unlock failed in DrawDevice call"); - } } JNIEXPORT jlong JNICALL @@ -2352,7 +2350,7 @@ FUN(android_AndroidDrawDevice_newNative)(JNIEnv *env, jclass self, jobject jbitm fz_try(ctx) { - if ((ret = AndroidBitmap_getInfo(env, jbitmap, &info)) < 0) + if ((ret = AndroidBitmap_getInfo(env, jbitmap, &info)) != ANDROID_BITMAP_RESULT_SUCCESS) fz_throw(ctx, FZ_ERROR_GENERIC, "new DrawDevice failed to get bitmap info"); if (info.format != ANDROID_BITMAP_FORMAT_RGBA_8888) @@ -2393,7 +2391,7 @@ FUN(Image_newImageFromBitmap)(JNIEnv *env, jobject self, jobject jbitmap, jlong if (mask && mask->mask) fz_throw(ctx, FZ_ERROR_GENERIC, "new Image failed as mask cannot be masked"); - if ((ret = AndroidBitmap_getInfo(env, jbitmap, &info)) < 0) + if ((ret = AndroidBitmap_getInfo(env, jbitmap, &info)) != ANDROID_BITMAP_RESULT_SUCCESS) fz_throw(ctx, FZ_ERROR_GENERIC, "new Image failed to get bitmap info"); if (info.format != ANDROID_BITMAP_FORMAT_RGBA_8888) @@ -2403,7 +2401,7 @@ FUN(Image_newImageFromBitmap)(JNIEnv *env, jobject self, jobject jbitmap, jlong fz_throw(ctx, FZ_ERROR_GENERIC, "new Image failed as bitmap width != stride"); pixmap = fz_new_pixmap(ctx, fz_device_rgb(ctx), info.width, info.height, 1); - if (AndroidBitmap_lockPixels(env, jbitmap, &pixels) < 0) + if (AndroidBitmap_lockPixels(env, jbitmap, &pixels) != ANDROID_BITMAP_RESULT_SUCCESS) fz_throw(ctx, FZ_ERROR_GENERIC, "bitmap lock failed in new Image"); memcpy(pixmap->samples, pixels, info.width * info.height * 4); (void)AndroidBitmap_unlockPixels(env, jbitmap); |