diff --git a/xwords4/android/jni/anddict.c b/xwords4/android/jni/anddict.c index f6bd9608b..56227d1a5 100644 --- a/xwords4/android/jni/anddict.c +++ b/xwords4/android/jni/anddict.c @@ -236,7 +236,7 @@ splitFaces_via_java( JNIEnv* env, AndDictionaryCtxt* ctxt, const XP_U8* ptr, int offsets[nFaces]; int nBytes; - jobject jstrarr = and_util_splitFaces( ctxt->jniutil, ptr, nFaceBytes, + jobject jstrarr = and_util_splitFaces( ctxt->jniutil, env, ptr, nFaceBytes, isUTF8 ); XP_ASSERT( (*env)->GetArrayLength( env, jstrarr ) == nFaces ); @@ -367,7 +367,7 @@ parseDict( AndDictionaryCtxt* ctxt, XWEnv xwe, XP_U8 const* ptr, || XP_TRUE #endif ) { - jstring jsum = and_util_getMD5SumForDict( ctxt->jniutil, + jstring jsum = and_util_getMD5SumForDict( ctxt->jniutil, env, ctxt->super.name, NULL, 0 ); XP_UCHAR* md5Sum = NULL; /* If we have a cached sum, check that it's correct. */ @@ -382,8 +382,8 @@ parseDict( AndDictionaryCtxt* ctxt, XWEnv xwe, XP_U8 const* ptr, } if ( NULL == jsum ) { - jsum = and_util_getMD5SumForDict( ctxt->jniutil, ctxt->super.name, - ptr, end - ptr ); + jsum = and_util_getMD5SumForDict( ctxt->jniutil, env, + ctxt->super.name, ptr, end - ptr ); } if ( NULL == md5Sum ) { md5Sum = getStringCopy( MPPARM(ctxt->super.mpool) env, jsum ); diff --git a/xwords4/android/jni/jniutlswrapper.c b/xwords4/android/jni/jniutlswrapper.c index fbb54f202..cff99544f 100644 --- a/xwords4/android/jni/jniutlswrapper.c +++ b/xwords4/android/jni/jniutlswrapper.c @@ -57,7 +57,6 @@ and_util_makeJBitmap( JNIUtilCtxt* jniutil, int nCols, int nRows, const jboolean* colors ) { jobject bitmap; - JNIEnv* env = ENVFORME( jniutil->ti ); jmethodID mid = getMethodID( env, jniutil->jjniutil, "makeBitmap", "(II[Z)Landroid/graphics/drawable/BitmapDrawable;" ); @@ -73,11 +72,10 @@ and_util_makeJBitmap( JNIUtilCtxt* jniutil, int nCols, int nRows, #endif jobject -and_util_splitFaces( JNIUtilCtxt* jniutil, const XP_U8* bytes, jsize len, - XP_Bool isUTF8 ) +and_util_splitFaces( JNIUtilCtxt* jniutil, JNIEnv* env, const XP_U8* bytes, + jsize len, XP_Bool isUTF8 ) { jobject strarray = NULL; - JNIEnv* env = ENVFORME( jniutil->ti ); jmethodID mid = getMethodID( env, jniutil->jjniutil, "splitFaces", "([BZ)[[Ljava/lang/String;" ); @@ -91,10 +89,9 @@ and_util_splitFaces( JNIUtilCtxt* jniutil, const XP_U8* bytes, jsize len, } jstring -and_util_getMD5SumForDict( JNIUtilCtxt* jniutil, const XP_UCHAR* name, +and_util_getMD5SumForDict( JNIUtilCtxt* jniutil, JNIEnv* env, const XP_UCHAR* name, const XP_U8* bytes, jsize len ) { - JNIEnv* env = ENVFORME( jniutil->ti ); jmethodID mid = getMethodID( env, jniutil->jjniutil, "getMD5SumFor", "(Ljava/lang/String;[B)Ljava/lang/String;" ); jstring jname = (*env)->NewStringUTF( env, name ); @@ -117,9 +114,9 @@ and_util_getMD5SumForDict( JNIUtilCtxt* jniutil, const XP_UCHAR* name, #ifdef COMMS_CHECKSUM jstring -and_util_getMD5SumForBytes( JNIUtilCtxt* jniutil, const XP_U8* bytes, jsize len ) +and_util_getMD5SumForBytes( JNIUtilCtxt* jniutil, JNIEnv* env, + const XP_U8* bytes, jsize len ) { - JNIEnv* env = ENVFORME( jniutil->ti ); jmethodID mid = getMethodID( env, jniutil->jjniutil, "getMD5SumFor", "([B)Ljava/lang/String;" ); diff --git a/xwords4/android/jni/jniutlswrapper.h b/xwords4/android/jni/jniutlswrapper.h index 653d3b6c1..9f7cec91f 100644 --- a/xwords4/android/jni/jniutlswrapper.h +++ b/xwords4/android/jni/jniutlswrapper.h @@ -34,14 +34,14 @@ void destroyJNIUtil( JNIEnv* env, JNIUtilCtxt** jniu ); jobject and_util_makeJBitmap( JNIUtilCtxt* jniu, int nCols, int nRows, const jboolean* colors ); -jobject and_util_splitFaces( JNIUtilCtxt* jniu, const XP_U8* bytes, int len, - XP_Bool isUTF8 ); +jobject and_util_splitFaces( JNIUtilCtxt* jniu, JNIEnv* env, const XP_U8* bytes, + int len, XP_Bool isUTF8 ); -jstring and_util_getMD5SumForDict( JNIUtilCtxt* jniutil, const XP_UCHAR* name, - const XP_U8* bytes, jsize len ); +jstring and_util_getMD5SumForDict( JNIUtilCtxt* jniutil, JNIEnv* env, + const XP_UCHAR* name, const XP_U8* bytes, jsize len ); #ifdef COMMS_CHECKSUM -jstring and_util_getMD5SumForBytes( JNIUtilCtxt* jniutil, const XP_U8* bytes, - jsize len ); +jstring and_util_getMD5SumForBytes( JNIUtilCtxt* jniutil, JNIEnv* env, + const XP_U8* bytes, jsize len ); #endif #endif diff --git a/xwords4/android/jni/utilwrapper.c b/xwords4/android/jni/utilwrapper.c index be1d21d83..c3aeb03a5 100644 --- a/xwords4/android/jni/utilwrapper.c +++ b/xwords4/android/jni/utilwrapper.c @@ -811,7 +811,7 @@ and_dutil_md5sum( XW_DUtilCtxt* duc, const XP_U8* ptr, XP_U16 len ) AndDUtil* dutil = (AndDUtil*)duc; JNIEnv* env = ENVFORME( dutil->ti ); struct JNIUtilCtxt* jniutil = dutil->jniutil; - jstring jsum = and_util_getMD5SumForBytes( jniutil, ptr, len ); + jstring jsum = and_util_getMD5SumForBytes( jniutil, env, ptr, len ); XP_UCHAR* result = getStringCopy( MPPARM(duc->mpool) env, jsum ); deleteLocalRef( env, jsum ); return result;