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

Commit 3b7e544

Browse files
committed
Fix 64-bit issues. Closes #197.
1 parent 229906e commit 3b7e544

File tree

6 files changed

+28
-29
lines changed

6 files changed

+28
-29
lines changed

eyes-two/src/main/jni/Application.mk

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
APP_ABI := armeabi-v7a # x86 arm64-v8a x86_64 mips64
1+
APP_ABI := armeabi-v7a x86 arm64-v8a x86_64
22
APP_OPTIM := release
33
NDK_TOOLCHAIN_VERSION := clang

tess-two/jni/Application.mk

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
APP_STL := gnustl_static
2-
APP_ABI := armeabi-v7a # x86 arm64-v8a x86_64 mips64
2+
APP_ABI := armeabi-v7a x86 arm64-v8a x86_64
33
APP_OPTIM := release
44
APP_PLATFORM := android-9
55
APP_CPPFLAGS += -fexceptions -frtti

tess-two/jni/com_googlecode_leptonica_android/utilities.cpp

+17-18
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jlong Java_com_googlecode_leptonica_android_AdaptiveMap_nativeBackgroundNormMorp
3939
PIX *pixd = pixBackgroundNormMorph(pixs, NULL, (l_int32) reduction, (l_int32) size,
4040
(l_int32) bgval);
4141

42-
return (jlong) pixd;
42+
return jlong(pixd);
4343
}
4444

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

58-
return (jlong) pixd;
58+
return jlong(pixd);
5959
}
6060

6161
/************
@@ -79,7 +79,7 @@ jlong Java_com_googlecode_leptonica_android_Binarize_nativeOtsuAdaptiveThreshold
7979
return (jlong) 0;
8080
}
8181

82-
return (jlong) pixd;
82+
return jlong(pixd);
8383
}
8484

8585
jlong Java_com_googlecode_leptonica_android_Binarize_nativeSauvolaBinarizeTiled(JNIEnv *env,
@@ -98,7 +98,7 @@ jlong Java_com_googlecode_leptonica_android_Binarize_nativeSauvolaBinarizeTiled(
9898
return (jlong) 0;
9999
}
100100

101-
return (jlong) pixd;
101+
return jlong(pixd);
102102
}
103103

104104
/********
@@ -112,7 +112,7 @@ jlong Java_com_googlecode_leptonica_android_Clip_nativeClipRectangle(JNIEnv *env
112112
BOX *box = (BOX *) nativeBox;
113113
PIX *pixd;
114114
pixd = pixClipRectangle(pixs,box,NULL);
115-
return (jlong) pixd;
115+
return jlong(pixd);
116116
}
117117

118118
/***********
@@ -124,7 +124,7 @@ jlong Java_com_googlecode_leptonica_android_Convert_nativeConvertTo8(JNIEnv *env
124124
PIX *pixs = (PIX *) nativePix;
125125
PIX *pixd = pixConvertTo8(pixs, FALSE);
126126

127-
return (jlong) pixd;
127+
return jlong(pixd);
128128
}
129129

130130
/********
@@ -138,7 +138,7 @@ jlong Java_com_googlecode_leptonica_android_Edge_nativePixSobelEdgeFilter(JNIEnv
138138
PIX *pixs = (PIX *) nativePix;
139139
PIX *pixd = pixSobelEdgeFilter(pixs, (l_int32) orientFlag);
140140

141-
return (jlong) pixd;
141+
return jlong(pixd);
142142
}
143143

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

155-
return (jlong) pixd;
155+
return jlong(pixd);
156156
}
157157

158158
/*************
@@ -164,7 +164,7 @@ jlong Java_com_googlecode_leptonica_android_GrayQuant_nativePixThresholdToBinary
164164
PIX *pixs = (PIX *) nativePix;
165165
PIX *pixd = pixThresholdToBinary(pixs, (l_int32) thresh);
166166

167-
return (jlong) pixd;
167+
return jlong(pixd);
168168
}
169169

170170
/**********
@@ -206,7 +206,7 @@ jlong Java_com_googlecode_leptonica_android_MorphApp_nativePixTophat(JNIEnv *env
206206
PIX *pixs = (PIX *) nativePix;
207207
PIX *pixd = pixTophat(pixs, (l_int32) hsize, (l_int32) vsize, (l_int32) type);
208208

209-
return (jlong) pixd;
209+
return jlong(pixd);
210210
}
211211

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

218-
return (jlong) pixd;
218+
return jlong(pixd);
219219
}
220220

221221
/*********
@@ -225,18 +225,17 @@ jlong Java_com_googlecode_leptonica_android_MorphApp_nativePixFastTophat(JNIEnv
225225
jlong Java_com_googlecode_leptonica_android_Scale_nativeScaleGeneral(JNIEnv *env, jclass clazz,
226226
jlong nativePix, jfloat scaleX,
227227
jfloat scaleY, jfloat sharpfract, jint sharpwidth) {
228-
PIX *pixs = (PIX *) nativePix;
229-
PIX *pixd = pixScaleGeneral(pixs, (l_float32) scaleX, (l_float32) scaleY,(l_float32) sharpfract, (l_int32) sharpwidth);
230-
return (jlong) pixd;
228+
PIX *pixs = (Pix *) nativePix;
229+
return (jlong) pixScaleGeneral(pixs, (l_float32) scaleX, (l_float32) scaleY,(l_float32) sharpfract, (l_int32) sharpwidth);
231230
}
232231

233232
jlong Java_com_googlecode_leptonica_android_Scale_nativeScale(JNIEnv *env, jclass clazz,
234233
jlong nativePix, jfloat scaleX,
235234
jfloat scaleY) {
236-
PIX *pixs = (PIX *) nativePix;
235+
PIX *pixs = (Pix *) nativePix;
237236
PIX *pixd = pixScale(pixs, (l_float32) scaleX, (l_float32) scaleY);
238237

239-
return (jlong) pixd;
238+
return jlong(pixd);
240239
}
241240

242241
/********
@@ -291,7 +290,7 @@ jlong Java_com_googlecode_leptonica_android_Rotate_nativeRotate(JNIEnv *env, jcl
291290
pixd = pixRotate(pixs, radians, type, L_BRING_IN_WHITE, w, h);
292291
}
293292

294-
return (jlong) pixd;
293+
return jlong(pixd);
295294
}
296295

297296
jlong Java_com_googlecode_leptonica_android_Rotate_nativeRotateOrth(JNIEnv *env, jclass clazz,
@@ -300,7 +299,7 @@ jlong Java_com_googlecode_leptonica_android_Rotate_nativeRotateOrth(JNIEnv *env,
300299
PIX *pixs = (PIX *) nativePix;
301300
PIX *pixd;
302301
pixd = pixRotateOrth(pixs,(int)quads);
303-
return (jlong) pixd;
302+
return jlong(pixd);
304303
}
305304

306305
#ifdef __cplusplus

tess-two/src/com/googlecode/leptonica/android/Clip.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public class Clip {
5555
* @return clipped pix, or null if rectangle doesn't intersect source pix
5656
*/
5757
public static Pix clipRectangle(Pix source, Box box) {
58-
int result = nativeClipRectangle(source.getNativePix(),
58+
long result = nativeClipRectangle(source.getNativePix(),
5959
box.getNativeBox());
6060
if (result != 0) {
6161
return new Pix(result);
@@ -67,5 +67,5 @@ public static Pix clipRectangle(Pix source, Box box) {
6767
// * NATIVE CODE *
6868
// ***************
6969

70-
private static native int nativeClipRectangle(long nativePix, long nativeBox);
70+
private static native long nativeClipRectangle(long nativePix, long nativeBox);
7171
}

tess-two/src/com/googlecode/leptonica/android/Pixa.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public Pixa copy() {
120120
if (mRecycled)
121121
throw new IllegalStateException();
122122

123-
int nativePixa = nativeCopy(mNativePixa);
123+
long nativePixa = nativeCopy(mNativePixa);
124124

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

146-
int nativePixa = nativeSort(mNativePixa, field, order);
146+
long nativePixa = nativeSort(mNativePixa, field, order);
147147

148148
if (nativePixa == 0) {
149149
throw new OutOfMemoryError();
@@ -484,11 +484,11 @@ public void remove() {
484484
// * NATIVE CODE *
485485
// ***************
486486

487-
private static native int nativeCreate(int size);
487+
private static native long nativeCreate(int size);
488488

489-
private static native int nativeCopy(long nativePixa);
489+
private static native long nativeCopy(long nativePixa);
490490

491-
private static native int nativeSort(long nativePixa, int field, int order);
491+
private static native long nativeSort(long nativePixa, int field, int order);
492492

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

tess-two/src/com/googlecode/leptonica/android/Rotate.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public static Pix rotateOrth(Pix pixs, @IntRange(from=0, to=3) int quads) {
109109
if (quads < 0 || quads > 3)
110110
throw new IllegalArgumentException("quads not in {0,1,2,3}");
111111

112-
int nativePix = nativeRotateOrth(pixs.getNativePix(), quads);
112+
long nativePix = nativeRotateOrth(pixs.getNativePix(), quads);
113113

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

124-
private static native int nativeRotateOrth(long nativePix, int quads);
124+
private static native long nativeRotateOrth(long nativePix, int quads);
125125

126126
private static native long nativeRotate(long nativePix, float degrees, boolean quality,
127127
boolean resize);

0 commit comments

Comments
 (0)