mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-03 23:04:08 +01:00
also load new desc field in android client, and add jni call to retrieve it
This commit is contained in:
parent
9d174601b9
commit
08aa9b66e8
3 changed files with 27 additions and 0 deletions
|
@ -292,6 +292,16 @@ parseDict( AndDictionaryCtxt* ctxt, XP_U8 const* ptr, XP_U32 dictLength,
|
|||
ctxt->super.nWords = n_ptr_tohl( &ptr );
|
||||
headerLen -= 4; /* don't skip it */
|
||||
}
|
||||
|
||||
if ( 1 <= headerLen ) { /* have description? */
|
||||
XP_U16 len = 1 + XP_STRLEN( ptr );
|
||||
ctxt->super.desc =
|
||||
(XP_UCHAR*)XP_MALLOC(ctxt->super.mpool, len);
|
||||
XP_MEMCPY( ctxt->super.desc, ptr, len );
|
||||
ptr += len;
|
||||
headerLen -= len;
|
||||
}
|
||||
|
||||
CHECK_PTR( ptr, headerLen, end );
|
||||
ptr += headerLen;
|
||||
}
|
||||
|
@ -430,6 +440,7 @@ and_dictionary_destroy( DictionaryCtxt* dict )
|
|||
XP_FREE( ctxt->super.mpool, ctxt->super.bitmaps );
|
||||
}
|
||||
|
||||
XP_FREEP( ctxt->super.mpool, &ctxt->super.desc );
|
||||
XP_FREEP( ctxt->super.mpool, &ctxt->super.faces );
|
||||
XP_FREEP( ctxt->super.mpool, &ctxt->super.facePtrs );
|
||||
XP_FREEP( ctxt->super.mpool, &ctxt->super.countsAndValues );
|
||||
|
|
|
@ -1581,6 +1581,21 @@ Java_org_eehouse_android_xw4_jni_XwJNI_dict_1iter_1getStartsWith
|
|||
return result;
|
||||
}
|
||||
|
||||
JNIEXPORT jstring JNICALL
|
||||
Java_org_eehouse_android_xw4_jni_XwJNI_dict_1iter_1getDesc
|
||||
( JNIEnv* env, jclass C, jint closure )
|
||||
{
|
||||
jstring result = NULL;
|
||||
DictIterData* data = (DictIterData*)closure;
|
||||
if ( NULL != data ) {
|
||||
const XP_UCHAR* disc = dict_getDesc( data->dict );
|
||||
if ( NULL != disc && '\0' != disc[0] ) {
|
||||
result = (*env)->NewStringUTF( env, disc );
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
#ifdef XWFEATURE_BASE64
|
||||
JNIEXPORT jstring JNICALL
|
||||
Java_org_eehouse_android_xw4_jni_XwJNI_base64Encode
|
||||
|
|
|
@ -257,6 +257,7 @@ public class XwJNI {
|
|||
public static native int[] dict_iter_getIndices( int closure );
|
||||
public static native int dict_iter_getStartsWith( int closure,
|
||||
String prefix );
|
||||
public static native String dict_iter_getDesc( int closure );
|
||||
|
||||
// base64 stuff since 2.1 doesn't support it in java
|
||||
public static native String base64Encode( byte[] in );
|
||||
|
|
Loading…
Reference in a new issue