Skip to content
This repository has been archived by the owner on Mar 17, 2022. It is now read-only.

Commit

Permalink
Fix 64-bit issues. Closes #197.
Browse files Browse the repository at this point in the history
  • Loading branch information
rmtheis committed Apr 20, 2018
1 parent 229906e commit 3b7e544
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 29 deletions.
2 changes: 1 addition & 1 deletion eyes-two/src/main/jni/Application.mk
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
APP_ABI := armeabi-v7a # x86 arm64-v8a x86_64 mips64
APP_ABI := armeabi-v7a x86 arm64-v8a x86_64
APP_OPTIM := release
NDK_TOOLCHAIN_VERSION := clang
2 changes: 1 addition & 1 deletion tess-two/jni/Application.mk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
APP_STL := gnustl_static
APP_ABI := armeabi-v7a # x86 arm64-v8a x86_64 mips64
APP_ABI := armeabi-v7a x86 arm64-v8a x86_64
APP_OPTIM := release
APP_PLATFORM := android-9
APP_CPPFLAGS += -fexceptions -frtti
Expand Down
35 changes: 17 additions & 18 deletions tess-two/jni/com_googlecode_leptonica_android/utilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jlong Java_com_googlecode_leptonica_android_AdaptiveMap_nativeBackgroundNormMorp
PIX *pixd = pixBackgroundNormMorph(pixs, NULL, (l_int32) reduction, (l_int32) size,
(l_int32) bgval);

return (jlong) pixd;
return jlong(pixd);
}

jlong Java_com_googlecode_leptonica_android_AdaptiveMap_nativePixContrastNorm(JNIEnv *env,
Expand All @@ -55,7 +55,7 @@ jlong Java_com_googlecode_leptonica_android_AdaptiveMap_nativePixContrastNorm(JN
PIX *pixd = pixContrastNorm(NULL, pixs, (l_int32) sizeX, (l_int32) sizeY,
(l_int32) minDiff, (l_int32) smoothX, (l_int32) smoothY);

return (jlong) pixd;
return jlong(pixd);
}

/************
Expand All @@ -79,7 +79,7 @@ jlong Java_com_googlecode_leptonica_android_Binarize_nativeOtsuAdaptiveThreshold
return (jlong) 0;
}

return (jlong) pixd;
return jlong(pixd);
}

jlong Java_com_googlecode_leptonica_android_Binarize_nativeSauvolaBinarizeTiled(JNIEnv *env,
Expand All @@ -98,7 +98,7 @@ jlong Java_com_googlecode_leptonica_android_Binarize_nativeSauvolaBinarizeTiled(
return (jlong) 0;
}

return (jlong) pixd;
return jlong(pixd);
}

/********
Expand All @@ -112,7 +112,7 @@ jlong Java_com_googlecode_leptonica_android_Clip_nativeClipRectangle(JNIEnv *env
BOX *box = (BOX *) nativeBox;
PIX *pixd;
pixd = pixClipRectangle(pixs,box,NULL);
return (jlong) pixd;
return jlong(pixd);
}

/***********
Expand All @@ -124,7 +124,7 @@ jlong Java_com_googlecode_leptonica_android_Convert_nativeConvertTo8(JNIEnv *env
PIX *pixs = (PIX *) nativePix;
PIX *pixd = pixConvertTo8(pixs, FALSE);

return (jlong) pixd;
return jlong(pixd);
}

/********
Expand All @@ -138,7 +138,7 @@ jlong Java_com_googlecode_leptonica_android_Edge_nativePixSobelEdgeFilter(JNIEnv
PIX *pixs = (PIX *) nativePix;
PIX *pixd = pixSobelEdgeFilter(pixs, (l_int32) orientFlag);

return (jlong) pixd;
return jlong(pixd);
}

/***********
Expand All @@ -152,7 +152,7 @@ jlong Java_com_googlecode_leptonica_android_Enhance_nativeUnsharpMasking(JNIEnv
PIX *pixs = (PIX *) nativePix;
PIX *pixd = pixUnsharpMasking(pixs, (l_int32) halfwidth, (l_float32) fract);

return (jlong) pixd;
return jlong(pixd);
}

/*************
Expand All @@ -164,7 +164,7 @@ jlong Java_com_googlecode_leptonica_android_GrayQuant_nativePixThresholdToBinary
PIX *pixs = (PIX *) nativePix;
PIX *pixd = pixThresholdToBinary(pixs, (l_int32) thresh);

return (jlong) pixd;
return jlong(pixd);
}

/**********
Expand Down Expand Up @@ -206,7 +206,7 @@ jlong Java_com_googlecode_leptonica_android_MorphApp_nativePixTophat(JNIEnv *env
PIX *pixs = (PIX *) nativePix;
PIX *pixd = pixTophat(pixs, (l_int32) hsize, (l_int32) vsize, (l_int32) type);

return (jlong) pixd;
return jlong(pixd);
}

jlong Java_com_googlecode_leptonica_android_MorphApp_nativePixFastTophat(JNIEnv *env, jclass clazz,
Expand All @@ -215,7 +215,7 @@ jlong Java_com_googlecode_leptonica_android_MorphApp_nativePixFastTophat(JNIEnv
PIX *pixs = (PIX *) nativePix;
PIX *pixd = pixFastTophat(pixs, (l_int32) xsize, (l_int32) ysize, (l_int32) type);

return (jlong) pixd;
return jlong(pixd);
}

/*********
Expand All @@ -225,18 +225,17 @@ jlong Java_com_googlecode_leptonica_android_MorphApp_nativePixFastTophat(JNIEnv
jlong Java_com_googlecode_leptonica_android_Scale_nativeScaleGeneral(JNIEnv *env, jclass clazz,
jlong nativePix, jfloat scaleX,
jfloat scaleY, jfloat sharpfract, jint sharpwidth) {
PIX *pixs = (PIX *) nativePix;
PIX *pixd = pixScaleGeneral(pixs, (l_float32) scaleX, (l_float32) scaleY,(l_float32) sharpfract, (l_int32) sharpwidth);
return (jlong) pixd;
PIX *pixs = (Pix *) nativePix;
return (jlong) pixScaleGeneral(pixs, (l_float32) scaleX, (l_float32) scaleY,(l_float32) sharpfract, (l_int32) sharpwidth);
}

jlong Java_com_googlecode_leptonica_android_Scale_nativeScale(JNIEnv *env, jclass clazz,
jlong nativePix, jfloat scaleX,
jfloat scaleY) {
PIX *pixs = (PIX *) nativePix;
PIX *pixs = (Pix *) nativePix;
PIX *pixd = pixScale(pixs, (l_float32) scaleX, (l_float32) scaleY);

return (jlong) pixd;
return jlong(pixd);
}

/********
Expand Down Expand Up @@ -291,7 +290,7 @@ jlong Java_com_googlecode_leptonica_android_Rotate_nativeRotate(JNIEnv *env, jcl
pixd = pixRotate(pixs, radians, type, L_BRING_IN_WHITE, w, h);
}

return (jlong) pixd;
return jlong(pixd);
}

jlong Java_com_googlecode_leptonica_android_Rotate_nativeRotateOrth(JNIEnv *env, jclass clazz,
Expand All @@ -300,7 +299,7 @@ jlong Java_com_googlecode_leptonica_android_Rotate_nativeRotateOrth(JNIEnv *env,
PIX *pixs = (PIX *) nativePix;
PIX *pixd;
pixd = pixRotateOrth(pixs,(int)quads);
return (jlong) pixd;
return jlong(pixd);
}

#ifdef __cplusplus
Expand Down
4 changes: 2 additions & 2 deletions tess-two/src/com/googlecode/leptonica/android/Clip.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public class Clip {
* @return clipped pix, or null if rectangle doesn't intersect source pix
*/
public static Pix clipRectangle(Pix source, Box box) {
int result = nativeClipRectangle(source.getNativePix(),
long result = nativeClipRectangle(source.getNativePix(),
box.getNativeBox());
if (result != 0) {
return new Pix(result);
Expand All @@ -67,5 +67,5 @@ public static Pix clipRectangle(Pix source, Box box) {
// * NATIVE CODE *
// ***************

private static native int nativeClipRectangle(long nativePix, long nativeBox);
private static native long nativeClipRectangle(long nativePix, long nativeBox);
}
10 changes: 5 additions & 5 deletions tess-two/src/com/googlecode/leptonica/android/Pixa.java
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public Pixa copy() {
if (mRecycled)
throw new IllegalStateException();

int nativePixa = nativeCopy(mNativePixa);
long nativePixa = nativeCopy(mNativePixa);

if (nativePixa == 0) {
throw new OutOfMemoryError();
Expand All @@ -143,7 +143,7 @@ public Pixa sort(@Constants.SortBy int field, @Constants.SortOrder int order) {
if (mRecycled)
throw new IllegalStateException();

int nativePixa = nativeSort(mNativePixa, field, order);
long nativePixa = nativeSort(mNativePixa, field, order);

if (nativePixa == 0) {
throw new OutOfMemoryError();
Expand Down Expand Up @@ -484,11 +484,11 @@ public void remove() {
// * NATIVE CODE *
// ***************

private static native int nativeCreate(int size);
private static native long nativeCreate(int size);

private static native int nativeCopy(long nativePixa);
private static native long nativeCopy(long nativePixa);

private static native int nativeSort(long nativePixa, int field, int order);
private static native long nativeSort(long nativePixa, int field, int order);

private static native boolean nativeJoin(long nativePixa, long otherPixa);

Expand Down
4 changes: 2 additions & 2 deletions tess-two/src/com/googlecode/leptonica/android/Rotate.java
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public static Pix rotateOrth(Pix pixs, @IntRange(from=0, to=3) int quads) {
if (quads < 0 || quads > 3)
throw new IllegalArgumentException("quads not in {0,1,2,3}");

int nativePix = nativeRotateOrth(pixs.getNativePix(), quads);
long nativePix = nativeRotateOrth(pixs.getNativePix(), quads);

if (nativePix == 0)
return null;
Expand All @@ -121,7 +121,7 @@ public static Pix rotateOrth(Pix pixs, @IntRange(from=0, to=3) int quads) {
// * NATIVE CODE *
// ***************

private static native int nativeRotateOrth(long nativePix, int quads);
private static native long nativeRotateOrth(long nativePix, int quads);

private static native long nativeRotate(long nativePix, float degrees, boolean quality,
boolean resize);
Expand Down

0 comments on commit 3b7e544

Please sign in to comment.