mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-30 08:34:16 +01:00
remove more use of thread->env mapping
This commit is contained in:
parent
b7b7da795a
commit
2343c34a44
4 changed files with 16 additions and 19 deletions
|
@ -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 );
|
||||
|
|
|
@ -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;" );
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue