set new dict variable

This commit is contained in:
ehouse 2003-12-14 17:55:45 +00:00
parent a188a0f98b
commit 5cb1aea0f9
2 changed files with 10 additions and 5 deletions

View file

@ -161,6 +161,7 @@ initFromDictFile( LinuxDictionaryCtxt* dctx, char* fileName )
unsigned short xloc; unsigned short xloc;
XP_U16 flags; XP_U16 flags;
XP_U16 facesSize; XP_U16 facesSize;
XP_U16 charSize;
XP_ASSERT( dictF ); XP_ASSERT( dictF );
(void)fread( &flags, sizeof(flags), 1, dictF ); (void)fread( &flags, sizeof(flags), 1, dictF );
@ -169,13 +170,16 @@ initFromDictFile( LinuxDictionaryCtxt* dctx, char* fileName )
#ifdef NODE_CAN_4 #ifdef NODE_CAN_4
if ( flags == 0x0001 ) { if ( flags == 0x0001 ) {
dctx->super.nodeSize = 3; dctx->super.nodeSize = 3;
dctx->super.charSize = 1; charSize = 1;
dctx->super.is_4_byte = XP_FALSE;
} else if ( flags == 0x0002 ) { } else if ( flags == 0x0002 ) {
dctx->super.nodeSize = 3; dctx->super.nodeSize = 3;
dctx->super.charSize = 2; charSize = 2;
dctx->super.is_4_byte = XP_FALSE;
} else if ( flags == 0x0003 ) { } else if ( flags == 0x0003 ) {
dctx->super.nodeSize = 4; dctx->super.nodeSize = 4;
dctx->super.charSize = 2; charSize = 2;
dctx->super.is_4_byte = XP_TRUE;
} else { } else {
/* case I don't know how to deal with */ /* case I don't know how to deal with */
formatOk = XP_FALSE; formatOk = XP_FALSE;
@ -196,9 +200,9 @@ initFromDictFile( LinuxDictionaryCtxt* dctx, char* fileName )
dctx->super.faces16 = XP_MALLOC( dctx->super.mpool, facesSize ); dctx->super.faces16 = XP_MALLOC( dctx->super.mpool, facesSize );
XP_MEMSET( dctx->super.faces16, 0, facesSize ); XP_MEMSET( dctx->super.faces16, 0, facesSize );
fread( dctx->super.faces16, numFaces * dctx->super.charSize, fread( dctx->super.faces16, numFaces * charSize,
1, dictF ); 1, dictF );
if ( dctx->super.charSize == sizeof(dctx->super.faces16[0]) ) { if ( charSize == sizeof(dctx->super.faces16[0]) ) {
/* fix endianness */ /* fix endianness */
XP_U16 i; XP_U16 i;
for ( i = 0; i < numFaces; ++i ) { for ( i = 0; i < numFaces; ++i ) {

View file

@ -192,6 +192,7 @@ palm_dictionary_make( MPFORMAL XP_UCHAR* dictName, PalmDictList* dl )
ctxt->nRecords = nRecords; ctxt->nRecords = nRecords;
#ifdef NODE_CAN_4 #ifdef NODE_CAN_4
ctxt->super.nodeSize = (XP_U8)nodeSize; ctxt->super.nodeSize = (XP_U8)nodeSize;
ctxt->super.is_4_byte = nodeSize == 4;
#endif #endif
for ( index = 0; index < nRecords; ++index ) { for ( index = 0; index < nRecords; ++index ) {