Attempt to fix collateral action of function LoadCharset() which called from schecker.Load(). Bugreport from Vladimir Fyodorov 2:50/15@fidonet

This commit is contained in:
Stas Degteff 2012-05-15 17:02:39 +00:00
parent c21c518165
commit 4b33543f42
3 changed files with 29 additions and 1 deletions

View File

@ -2851,6 +2851,7 @@ int IEclass::Start(int __mode, uint* __position, GMsg* __msg) {
#if defined(GCFG_SPELL_INCLUDED)
if (CFG->scheckerenabled)
{
int save_chartableno = LoadCharset(NULL,NULL,1); // Workaround: internal for LoadCharset() charset table number changed in the schecker.Load()
schecker.Init(CFG->xlatlocalset, CFG->scheckerdicpath);
char *str = strdup(AA->adat->scheckerdeflang);
char *token = strtok(str, " ");
@ -2861,6 +2862,11 @@ int IEclass::Start(int __mode, uint* __position, GMsg* __msg) {
token = strtok(NULL, " ");
}
free(str);
if(save_chartableno != -1) // restore value of the default chaset table // workaround: internal for LoadCharset() charset table number changed in the schecker.Load()
LoadCharset(CFG->xlatcharset[save_chartableno].imp, CFG->xlatcharset[save_chartableno].exp);
else
LoadCharset("N/A","N/A");
}
#endif

View File

@ -1242,7 +1242,12 @@ int GMenuSChecker::Run(CSpellChecker &schecker, const char *word)
{
if (!schecker.IsLoaded(langs[finaltag-TAG_LANG-1]->GetLangCode()))
{
int save_chartableno = LoadCharset(NULL,NULL,1); // Workaround: internal for LoadCharset() charset table number changed in the schecker.Load()
schecker.Load(langs[finaltag-TAG_LANG-1]->GetLangCode(), CFG->scheckeruserdic);
if(save_chartableno != -1) // restore value of the default chaset table // workaround: internal for LoadCharset() charset table number changed in the schecker.Load()
LoadCharset(CFG->xlatcharset[save_chartableno].imp, CFG->xlatcharset[save_chartableno].exp);
else
LoadCharset("N/A","N/A");
}
else
{

View File

@ -359,7 +359,9 @@ void CMSSpellLang::BuildRTable(const char *codeset)
}
strcpy(codeset2, "CP");
GetLocaleInfo(mLIDC, LOCALE_IDEFAULTANSICODEPAGE, &codeset2[2], sizeof(codeset2)-2);
/*
int save_chartableno = LoadCharset(NULL,NULL,1);
*/
LoadCharset(codeset, codeset2);
mToDicTable = new Chs;
memset(mToDicTable, 0, sizeof(Chs));
@ -369,6 +371,12 @@ void CMSSpellLang::BuildRTable(const char *codeset)
mToLocTable = new Chs;
memset(mToLocTable, 0, sizeof(Chs));
if (CharTable ) *mToLocTable = *CharTable;
/*
if(save_chartableno != -1) // restore value of the default chaset table
LoadCharset(CFG->xlatcharset[save_chartableno].imp, CFG->xlatcharset[save_chartableno].exp);
else
LoadCharset("N/A","N/A");
*/
}
@ -588,6 +596,9 @@ void CMYSpellLang::BuildRTable(const char *codeset)
"This is bug in program, please make report to developers." );
return;
}
/*
int save_chartableno = LoadCharset(NULL,NULL,1);
*/
LoadCharset(codeset, mMSpell->get_dic_encoding());
mToDicTable = new Chs;
memset(mToDicTable, 0, sizeof(Chs));
@ -597,6 +608,12 @@ void CMYSpellLang::BuildRTable(const char *codeset)
mToLocTable = new Chs;
memset(mToLocTable, 0, sizeof(Chs));
if (CharTable ) *mToLocTable = *CharTable;
/*
if(save_chartableno != -1) // restore value of the default chaset table
LoadCharset(CFG->xlatcharset[save_chartableno].imp, CFG->xlatcharset[save_chartableno].exp);
else
LoadCharset("N/A","N/A");
*/
}