From 5cb1aea0f984c78f15d269539dbc793ecba19b1a Mon Sep 17 00:00:00 2001 From: ehouse Date: Sun, 14 Dec 2003 17:55:45 +0000 Subject: [PATCH] set new dict variable --- linux/linuxdict.c | 14 +++++++++----- palm/palmdict.c | 1 + 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/linux/linuxdict.c b/linux/linuxdict.c index 118ef8da8..fdcdf9e7d 100644 --- a/linux/linuxdict.c +++ b/linux/linuxdict.c @@ -161,6 +161,7 @@ initFromDictFile( LinuxDictionaryCtxt* dctx, char* fileName ) unsigned short xloc; XP_U16 flags; XP_U16 facesSize; + XP_U16 charSize; XP_ASSERT( dictF ); (void)fread( &flags, sizeof(flags), 1, dictF ); @@ -169,13 +170,16 @@ initFromDictFile( LinuxDictionaryCtxt* dctx, char* fileName ) #ifdef NODE_CAN_4 if ( flags == 0x0001 ) { dctx->super.nodeSize = 3; - dctx->super.charSize = 1; + charSize = 1; + dctx->super.is_4_byte = XP_FALSE; } else if ( flags == 0x0002 ) { dctx->super.nodeSize = 3; - dctx->super.charSize = 2; + charSize = 2; + dctx->super.is_4_byte = XP_FALSE; } else if ( flags == 0x0003 ) { dctx->super.nodeSize = 4; - dctx->super.charSize = 2; + charSize = 2; + dctx->super.is_4_byte = XP_TRUE; } else { /* case I don't know how to deal with */ formatOk = XP_FALSE; @@ -196,9 +200,9 @@ initFromDictFile( LinuxDictionaryCtxt* dctx, char* fileName ) dctx->super.faces16 = XP_MALLOC( dctx->super.mpool, facesSize ); XP_MEMSET( dctx->super.faces16, 0, facesSize ); - fread( dctx->super.faces16, numFaces * dctx->super.charSize, + fread( dctx->super.faces16, numFaces * charSize, 1, dictF ); - if ( dctx->super.charSize == sizeof(dctx->super.faces16[0]) ) { + if ( charSize == sizeof(dctx->super.faces16[0]) ) { /* fix endianness */ XP_U16 i; for ( i = 0; i < numFaces; ++i ) { diff --git a/palm/palmdict.c b/palm/palmdict.c index 12a88814b..f12c90243 100644 --- a/palm/palmdict.c +++ b/palm/palmdict.c @@ -192,6 +192,7 @@ palm_dictionary_make( MPFORMAL XP_UCHAR* dictName, PalmDictList* dl ) ctxt->nRecords = nRecords; #ifdef NODE_CAN_4 ctxt->super.nodeSize = (XP_U8)nodeSize; + ctxt->super.is_4_byte = nodeSize == 4; #endif for ( index = 0; index < nRecords; ++index ) {