add field, and getter, for new dict header description string, and

load it in linux client.
This commit is contained in:
Eric House 2012-08-26 20:58:28 -07:00
parent f3b289f4be
commit 9d174601b9
3 changed files with 17 additions and 3 deletions

View file

@ -489,6 +489,12 @@ dict_getWordCount( const DictionaryCtxt* dict )
return nWords;
}
const XP_UCHAR*
dict_getDesc( const DictionaryCtxt* dict )
{
return dict->desc;
}
#ifdef STUBBED_DICT
#define BLANK_FACE '\0'

View file

@ -73,6 +73,7 @@ struct DictionaryCtxt {
XP_UCHAR* name;
XP_UCHAR* langName;
XP_UCHAR* faces;
XP_UCHAR* desc;
const XP_UCHAR** facePtrs;
XP_U8* countsAndValues;
@ -163,6 +164,8 @@ void dict_getFaceBitmaps( const DictionaryCtxt* dict, Tile tile,
XP_LangCode dict_getLangCode( const DictionaryCtxt* dict );
XP_U32 dict_getWordCount( const DictionaryCtxt* dict );
const XP_UCHAR* dict_getDesc( const DictionaryCtxt* dict );
void dict_writeToStream( const DictionaryCtxt* ctxt, XWStreamCtxt* stream );
void dict_loadFromStream( DictionaryCtxt* dict, XWStreamCtxt* stream );

View file

@ -298,9 +298,13 @@ initFromDictFile( LinuxDictionaryCtxt* dctx, const char* fileName )
XP_DEBUGF( "dict contains %ld words", dctx->super.nWords );
if ( 0 < headerLen ) {
XP_UCHAR buf[headerLen];
XP_MEMCPY( buf, ptr, headerLen );
XP_LOGF( "%s: got note of len %d: \"%s\"", __func__, headerLen-1, buf );
XP_U16 len = 1 + XP_STRLEN( (XP_UCHAR*)ptr );
dctx->super.desc = XP_MALLOC( dctx->super.mpool, len );
XP_MEMCPY( dctx->super.desc, ptr, len );
XP_LOGF( "%s: got note of len %d: \"%s\"", __func__,
headerLen-1, dctx->super.desc );
ptr += len;
headerLen -= len;
} else {
XP_LOGF( "%s: no note", __func__ );
}
@ -430,6 +434,7 @@ linux_dictionary_destroy( DictionaryCtxt* dict )
}
}
XP_FREEP( dict->mpool, &ctxt->super.desc );
XP_FREE( dict->mpool, ctxt->super.countsAndValues );
XP_FREE( dict->mpool, ctxt->super.faces );
XP_FREE( dict->mpool, ctxt->super.facePtrs );