fix problem with converting dicts

This commit is contained in:
ehouse 2004-05-01 13:23:00 +00:00
parent 67c69ca278
commit 6111d15406

View file

@ -52,7 +52,8 @@ struct PalmDictList {
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// Prototypes // Prototypes
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
static PalmDictList* dictListMakePriv( MPFORMAL XP_U32 creatorSought ); static PalmDictList* dictListMakePriv( MPFORMAL XP_U32 creatorSought,
XP_U16 versSought );
XP_Bool XP_Bool
@ -183,7 +184,7 @@ searchDir( MPFORMAL PalmDictList** dlp, UInt16 volNum, unsigned char separator,
fit.nameP = (char*)path + pathLen; fit.nameP = (char*)path + pathLen;
while ( dEnum != vfsIteratorStop ) { while ( dEnum != vfsIteratorStop ) {
XP_UCHAR* ext; XP_UCHAR* ext;
fit.nameBufLen = pathSize - pathLen; fit.nameBufLen = pathSize - pathLen;
err = VFSDirEntryEnumerate( dirRef, &dEnum, &fit ); err = VFSDirEntryEnumerate( dirRef, &dEnum, &fit );
@ -282,11 +283,11 @@ cleanList( PalmDictList** dl )
PalmDictList* PalmDictList*
DictListMake( MPFORMAL_NOCOMMA ) DictListMake( MPFORMAL_NOCOMMA )
{ {
return dictListMakePriv( MPPARM(mpool) TYPE_XWRDICT ); return dictListMakePriv( MPPARM(mpool) TYPE_XWRDICT, 1 );
} }
static PalmDictList* static PalmDictList*
dictListMakePriv( MPFORMAL XP_U32 creatorSought ) dictListMakePriv( MPFORMAL XP_U32 creatorSought, XP_U16 versSought )
{ {
Err err; Err err;
DmSearchStateType stateType; DmSearchStateType stateType;
@ -311,9 +312,10 @@ dictListMakePriv( MPFORMAL XP_U32 creatorSought )
DictListEntry dle; DictListEntry dle;
XP_U16 vers; XP_U16 vers;
err = DmDatabaseInfo( cardNo, dbID, (char*)nameBuf, NULL, &vers, NULL, err = DmDatabaseInfo( cardNo, dbID, (char*)nameBuf, NULL, &vers,
NULL, NULL, NULL, NULL, NULL, NULL, NULL ); NULL, NULL, NULL, NULL, NULL, NULL, NULL,
if ( (err == errNone) && (vers == 1) ) { NULL );
if ( (err == errNone) && (vers == versSought) ) {
nameLen = XP_STRLEN( (const char*)nameBuf ) + 1; nameLen = XP_STRLEN( (const char*)nameBuf ) + 1;
dle.location = DL_STORAGE; dle.location = DL_STORAGE;
@ -486,9 +488,10 @@ convertOneDict( UInt16 cardNo, LocalID dbID )
XP_ASSERT( err == errNone ); XP_ASSERT( err == errNone );
if ( err == errNone ) { if ( err == errNone ) {
XP_U16 newVers = 1;
creator = TYPE_XWRDICT; creator = TYPE_XWRDICT;
err = DmSetDatabaseInfo( cardNo, dbID, NULL, err = DmSetDatabaseInfo( cardNo, dbID, NULL,
NULL, NULL, NULL, NULL, &newVers, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
@ -511,7 +514,7 @@ confirmDictConvert( PalmAppGlobals* globals, const XP_UCHAR* name )
void void
offerConvertOldDicts( PalmAppGlobals* globals ) offerConvertOldDicts( PalmAppGlobals* globals )
{ {
PalmDictList* dl = dictListMakePriv( MPPARM(globals->mpool) 'Xwr3' ); PalmDictList* dl = dictListMakePriv( MPPARM(globals->mpool) 'Xwr3', 0 );
XP_U16 count = DictListCount(dl); XP_U16 count = DictListCount(dl);
Err err; Err err;