summaryrefslogtreecommitdiff
path: root/plugins/SpellChecker/src/hunspell/affixmgr.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/SpellChecker/src/hunspell/affixmgr.cxx')
-rw-r--r--plugins/SpellChecker/src/hunspell/affixmgr.cxx153
1 files changed, 85 insertions, 68 deletions
diff --git a/plugins/SpellChecker/src/hunspell/affixmgr.cxx b/plugins/SpellChecker/src/hunspell/affixmgr.cxx
index 59313bfba0..bd998f6369 100644
--- a/plugins/SpellChecker/src/hunspell/affixmgr.cxx
+++ b/plugins/SpellChecker/src/hunspell/affixmgr.cxx
@@ -1,4 +1,4 @@
-#include "..\commons.h"
+#include "..\commons.h"
AffixMgr::AffixMgr(const char * affpath, HashMgr** ptr, int * md, const char * key)
{
@@ -34,6 +34,7 @@ AffixMgr::AffixMgr(const char * affpath, HashMgr** ptr, int * md, const char * k
compoundroot = FLAG_NULL; // compound word signing flag
compoundpermitflag = FLAG_NULL; // compound permitting flag for suffixed word
compoundforbidflag = FLAG_NULL; // compound fordidden flag for suffixed word
+ compoundmoresuffixes = 0; // allow more suffixes within compound words
checkcompounddup = 0; // forbid double words in compounds
checkcompoundrep = 0; // forbid bad compounds (may be non compound word with a REP substitution)
checkcompoundcase = 0; // forbid upper and lowercase combinations at word bounds
@@ -239,6 +240,14 @@ AffixMgr::~AffixMgr()
#endif
}
+void AffixMgr::finishFileMgr(FileMgr *afflst)
+{
+ delete afflst;
+
+ // convert affix trees to sorted list
+ process_pfx_tree_to_list();
+ process_sfx_tree_to_list();
+}
// read in aff file and build up prefix and suffix entry objects
int AffixMgr::parse_file(const char * affpath, const char * key)
@@ -265,7 +274,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
// read in each line ignoring any that do not
// start with a known line type indicator
- while ((line = afflst->getline())) {
+ while ((line = afflst->getline()) != NULL) {
mychomp(line);
/* remove byte order mark */
@@ -280,7 +289,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
/* parse in the keyboard string */
if (strncmp(line,"KEY",3) == 0) {
if (parse_string(line, &keystring, afflst->getlinenum())) {
- delete afflst;
+ finishFileMgr(afflst);
return 1;
}
}
@@ -288,7 +297,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
/* parse in the try string */
if (strncmp(line,"TRY",3) == 0) {
if (parse_string(line, &trystring, afflst->getlinenum())) {
- delete afflst;
+ finishFileMgr(afflst);
return 1;
}
}
@@ -296,7 +305,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
/* parse in the name of the character set used by the .dict and .aff */
if (strncmp(line,"SET",3) == 0) {
if (parse_string(line, &encoding, afflst->getlinenum())) {
- delete afflst;
+ finishFileMgr(afflst);
return 1;
}
if (strcmp(encoding, "UTF-8") == 0) {
@@ -316,7 +325,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
/* parse in the flag used by the controlled compound words */
if (strncmp(line,"COMPOUNDFLAG",12) == 0) {
if (parse_flag(line, &compoundflag, afflst)) {
- delete afflst;
+ finishFileMgr(afflst);
return 1;
}
}
@@ -325,12 +334,12 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
if (strncmp(line,"COMPOUNDBEGIN",13) == 0) {
if (complexprefixes) {
if (parse_flag(line, &compoundend, afflst)) {
- delete afflst;
+ finishFileMgr(afflst);
return 1;
}
} else {
if (parse_flag(line, &compoundbegin, afflst)) {
- delete afflst;
+ finishFileMgr(afflst);
return 1;
}
}
@@ -339,7 +348,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
/* parse in the flag used by compound words */
if (strncmp(line,"COMPOUNDMIDDLE",14) == 0) {
if (parse_flag(line, &compoundmiddle, afflst)) {
- delete afflst;
+ finishFileMgr(afflst);
return 1;
}
}
@@ -347,12 +356,12 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
if (strncmp(line,"COMPOUNDEND",11) == 0) {
if (complexprefixes) {
if (parse_flag(line, &compoundbegin, afflst)) {
- delete afflst;
+ finishFileMgr(afflst);
return 1;
}
} else {
if (parse_flag(line, &compoundend, afflst)) {
- delete afflst;
+ finishFileMgr(afflst);
return 1;
}
}
@@ -361,7 +370,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
/* parse in the data used by compound_check() method */
if (strncmp(line,"COMPOUNDWORDMAX",15) == 0) {
if (parse_num(line, &cpdwordmax, afflst)) {
- delete afflst;
+ finishFileMgr(afflst);
return 1;
}
}
@@ -369,7 +378,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
/* parse in the flag sign compounds in dictionary */
if (strncmp(line,"COMPOUNDROOT",12) == 0) {
if (parse_flag(line, &compoundroot, afflst)) {
- delete afflst;
+ finishFileMgr(afflst);
return 1;
}
}
@@ -377,7 +386,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
/* parse in the flag used by compound_check() method */
if (strncmp(line,"COMPOUNDPERMITFLAG",18) == 0) {
if (parse_flag(line, &compoundpermitflag, afflst)) {
- delete afflst;
+ finishFileMgr(afflst);
return 1;
}
}
@@ -385,11 +394,15 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
/* parse in the flag used by compound_check() method */
if (strncmp(line,"COMPOUNDFORBIDFLAG",18) == 0) {
if (parse_flag(line, &compoundforbidflag, afflst)) {
- delete afflst;
+ finishFileMgr(afflst);
return 1;
}
}
+ if (strncmp(line,"COMPOUNDMORESUFFIXES",20) == 0) {
+ compoundmoresuffixes = 1;
+ }
+
if (strncmp(line,"CHECKCOMPOUNDDUP",16) == 0) {
checkcompounddup = 1;
}
@@ -412,14 +425,14 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
if (strncmp(line,"NOSUGGEST",9) == 0) {
if (parse_flag(line, &nosuggest, afflst)) {
- delete afflst;
+ finishFileMgr(afflst);
return 1;
}
}
if (strncmp(line,"NONGRAMSUGGEST",14) == 0) {
if (parse_flag(line, &nongramsuggest, afflst)) {
- delete afflst;
+ finishFileMgr(afflst);
return 1;
}
}
@@ -427,7 +440,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
/* parse in the flag used by forbidden words */
if (strncmp(line,"FORBIDDENWORD",13) == 0) {
if (parse_flag(line, &forbiddenword, afflst)) {
- delete afflst;
+ finishFileMgr(afflst);
return 1;
}
}
@@ -435,7 +448,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
/* parse in the flag used by forbidden words */
if (strncmp(line,"LEMMA_PRESENT",13) == 0) {
if (parse_flag(line, &lemma_present, afflst)) {
- delete afflst;
+ finishFileMgr(afflst);
return 1;
}
}
@@ -443,7 +456,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
/* parse in the flag used by circumfixes */
if (strncmp(line,"CIRCUMFIX",9) == 0) {
if (parse_flag(line, &circumfix, afflst)) {
- delete afflst;
+ finishFileMgr(afflst);
return 1;
}
}
@@ -451,7 +464,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
/* parse in the flag used by fogemorphemes */
if (strncmp(line,"ONLYINCOMPOUND",14) == 0) {
if (parse_flag(line, &onlyincompound, afflst)) {
- delete afflst;
+ finishFileMgr(afflst);
return 1;
}
}
@@ -459,7 +472,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
/* parse in the flag used by `needaffixs' */
if (strncmp(line,"PSEUDOROOT",10) == 0) {
if (parse_flag(line, &needaffix, afflst)) {
- delete afflst;
+ finishFileMgr(afflst);
return 1;
}
}
@@ -467,7 +480,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
/* parse in the flag used by `needaffixs' */
if (strncmp(line,"NEEDAFFIX",9) == 0) {
if (parse_flag(line, &needaffix, afflst)) {
- delete afflst;
+ finishFileMgr(afflst);
return 1;
}
}
@@ -475,7 +488,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
/* parse in the minimal length for words in compounds */
if (strncmp(line,"COMPOUNDMIN",11) == 0) {
if (parse_num(line, &cpdmin, afflst)) {
- delete afflst;
+ finishFileMgr(afflst);
return 1;
}
if (cpdmin < 1) cpdmin = 1;
@@ -484,7 +497,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
/* parse in the max. words and syllables in compounds */
if (strncmp(line,"COMPOUNDSYLLABLE",16) == 0) {
if (parse_cpdsyllable(line, afflst)) {
- delete afflst;
+ finishFileMgr(afflst);
return 1;
}
}
@@ -492,7 +505,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
/* parse in the flag used by compound_check() method */
if (strncmp(line,"SYLLABLENUM",11) == 0) {
if (parse_string(line, &cpdsyllablenum, afflst->getlinenum())) {
- delete afflst;
+ finishFileMgr(afflst);
return 1;
}
}
@@ -505,7 +518,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
/* parse in the extra word characters */
if (strncmp(line,"WORDCHARS",9) == 0) {
if (parse_array(line, &wordchars, &wordchars_utf16, &wordchars_utf16_len, utf8, afflst->getlinenum())) {
- delete afflst;
+ finishFileMgr(afflst);
return 1;
}
}
@@ -513,7 +526,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
/* parse in the ignored characters (for example, Arabic optional diacretics charachters */
if (strncmp(line,"IGNORE",6) == 0) {
if (parse_array(line, &ignorechars, &ignorechars_utf16, &ignorechars_utf16_len, utf8, afflst->getlinenum())) {
- delete afflst;
+ finishFileMgr(afflst);
return 1;
}
}
@@ -521,7 +534,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
/* parse in the typical fault correcting table */
if (strncmp(line,"REP",3) == 0) {
if (parse_reptable(line, afflst)) {
- delete afflst;
+ finishFileMgr(afflst);
return 1;
}
}
@@ -529,7 +542,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
/* parse in the input conversion table */
if (strncmp(line,"ICONV",5) == 0) {
if (parse_convtable(line, afflst, &iconvtable, "ICONV")) {
- delete afflst;
+ finishFileMgr(afflst);
return 1;
}
}
@@ -537,7 +550,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
/* parse in the input conversion table */
if (strncmp(line,"OCONV",5) == 0) {
if (parse_convtable(line, afflst, &oconvtable, "OCONV")) {
- delete afflst;
+ finishFileMgr(afflst);
return 1;
}
}
@@ -545,7 +558,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
/* parse in the phonetic translation table */
if (strncmp(line,"PHONE",5) == 0) {
if (parse_phonetable(line, afflst)) {
- delete afflst;
+ finishFileMgr(afflst);
return 1;
}
}
@@ -553,7 +566,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
/* parse in the checkcompoundpattern table */
if (strncmp(line,"CHECKCOMPOUNDPATTERN",20) == 0) {
if (parse_checkcpdtable(line, afflst)) {
- delete afflst;
+ finishFileMgr(afflst);
return 1;
}
}
@@ -561,7 +574,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
/* parse in the defcompound table */
if (strncmp(line,"COMPOUNDRULE",12) == 0) {
if (parse_defcpdtable(line, afflst)) {
- delete afflst;
+ finishFileMgr(afflst);
return 1;
}
}
@@ -569,7 +582,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
/* parse in the related character map table */
if (strncmp(line,"MAP",3) == 0) {
if (parse_maptable(line, afflst)) {
- delete afflst;
+ finishFileMgr(afflst);
return 1;
}
}
@@ -577,7 +590,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
/* parse in the word breakpoints table */
if (strncmp(line,"BREAK",5) == 0) {
if (parse_breaktable(line, afflst)) {
- delete afflst;
+ finishFileMgr(afflst);
return 1;
}
}
@@ -585,7 +598,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
/* parse in the language for language specific codes */
if (strncmp(line,"LANG",4) == 0) {
if (parse_string(line, &lang, afflst->getlinenum())) {
- delete afflst;
+ finishFileMgr(afflst);
return 1;
}
langnum = get_lang_num(lang);
@@ -598,7 +611,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
if (strncmp(line,"MAXNGRAMSUGS",12) == 0) {
if (parse_num(line, &maxngramsugs, afflst)) {
- delete afflst;
+ finishFileMgr(afflst);
return 1;
}
}
@@ -608,14 +621,14 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
if (strncmp(line,"MAXDIFF",7) == 0) {
if (parse_num(line, &maxdiff, afflst)) {
- delete afflst;
+ finishFileMgr(afflst);
return 1;
}
}
if (strncmp(line,"MAXCPDSUGS",10) == 0) {
if (parse_num(line, &maxcpdsugs, afflst)) {
- delete afflst;
+ finishFileMgr(afflst);
return 1;
}
}
@@ -635,7 +648,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
/* parse in the flag used by forbidden words */
if (strncmp(line,"KEEPCASE",8) == 0) {
if (parse_flag(line, &keepcase, afflst)) {
- delete afflst;
+ finishFileMgr(afflst);
return 1;
}
}
@@ -643,7 +656,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
/* parse in the flag used by `forceucase' */
if (strncmp(line,"FORCEUCASE",10) == 0) {
if (parse_flag(line, &forceucase, afflst)) {
- delete afflst;
+ finishFileMgr(afflst);
return 1;
}
}
@@ -651,7 +664,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
/* parse in the flag used by `warn' */
if (strncmp(line,"WARN",4) == 0) {
if (parse_flag(line, &warn, afflst)) {
- delete afflst;
+ finishFileMgr(afflst);
return 1;
}
}
@@ -663,7 +676,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
/* parse in the flag used by the affix generator */
if (strncmp(line,"SUBSTANDARD",11) == 0) {
if (parse_flag(line, &substandard, afflst)) {
- delete afflst;
+ finishFileMgr(afflst);
return 1;
}
}
@@ -682,19 +695,14 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
dupflags_ini = 0;
}
if (parse_affix(line, ft, afflst, dupflags)) {
- delete afflst;
- process_pfx_tree_to_list();
- process_sfx_tree_to_list();
+ finishFileMgr(afflst);
return 1;
}
}
-
}
- delete afflst;
- // convert affix trees to sorted list
- process_pfx_tree_to_list();
- process_sfx_tree_to_list();
+ finishFileMgr(afflst);
+ // affix trees are sorted now
// now we can speed up performance greatly taking advantage of the
// relationship between the affixes and the idea of "subsets".
@@ -807,7 +815,7 @@ int AffixMgr::build_pfxtree(PfxEntry* pfxptr)
pptr = NULL;
for (;;) {
pptr = ptr;
- if (strcmp(ep->getKey(), ptr->getKey()) <= 0) {
+ if (strcmp(ep->getKey(), ptr->getKey() ) <= 0) {
ptr = ptr->getNextEQ();
if (!ptr) {
pptr->setNextEQ(ep);
@@ -871,7 +879,7 @@ int AffixMgr::build_sfxtree(SfxEntry* sfxptr)
pptr = NULL;
for (;;) {
pptr = ptr;
- if (strcmp(ep->getKey(), ptr->getKey()) <= 0) {
+ if (strcmp(ep->getKey(), ptr->getKey() ) <= 0) {
ptr = ptr->getNextEQ();
if (!ptr) {
pptr->setNextEQ(ep);
@@ -951,7 +959,7 @@ int AffixMgr::process_pfx_order()
PfxEntry * nptr = ptr->getNext();
for (; nptr != NULL; nptr = nptr->getNext()) {
- if (! isSubset( ptr->getKey() , nptr->getKey())) break;
+ if (! isSubset( ptr->getKey() , nptr->getKey() )) break;
}
ptr->setNextNE(nptr);
ptr->setNextEQ(NULL);
@@ -1305,7 +1313,7 @@ int AffixMgr::cpdrep_check(const char * word, int wl)
}
// forbid compoundings when there are special patterns at word bound
-int AffixMgr::cpdpat_check(const char * word, int pos, hentry * r1, hentry * r2, const char affixed)
+int AffixMgr::cpdpat_check(const char * word, int pos, hentry * r1, hentry * r2, const char /*affixed*/)
{
int len;
for (int i = 0; i < numcheckcpd; i++) {
@@ -1318,7 +1326,7 @@ int AffixMgr::cpdpat_check(const char * word, int pos, hentry * r1, hentry * r2,
// zero pattern (0/flag) => unmodified stem (zero affixes allowed)
(!*(checkcpdtable[i].pattern) || (
(*(checkcpdtable[i].pattern)=='0' && r1->blen <= pos && strncmp(word + pos - r1->blen, r1->word, r1->blen) == 0) ||
- (*(checkcpdtable[i].pattern)!='0' && (len = strlen(checkcpdtable[i].pattern)) &&
+ (*(checkcpdtable[i].pattern)!='0' && ((len = strlen(checkcpdtable[i].pattern)) != 0) &&
strncmp(word + pos - len, checkcpdtable[i].pattern, len) == 0)))) {
return 1;
}
@@ -1379,7 +1387,10 @@ int AffixMgr::defcpd_check(hentry *** words, short wnum, hentry * rv, hentry **
for (i = 0; i < numdefcpd; i++) {
for (j = 0; j < defcpdtable[i].len; j++) {
if (defcpdtable[i].def[j] != '*' && defcpdtable[i].def[j] != '?' &&
- TESTAFF(rv->astr, defcpdtable[i].def[j], rv->alen)) ok = 1;
+ TESTAFF(rv->astr, defcpdtable[i].def[j], rv->alen)) {
+ ok = 1;
+ break;
+ }
}
}
if (ok == 0) {
@@ -1530,7 +1541,7 @@ struct hentry * AffixMgr::compound_check(const char * word, int len,
int oldlen = 0;
int checkedstriple = 0;
int onlycpdrule;
- int affixed = 0;
+ char affixed = 0;
hentry ** oldwords = words;
int checked_prefix;
@@ -1612,8 +1623,9 @@ struct hentry * AffixMgr::compound_check(const char * word, int len,
if (onlycpdrule) break;
if (compoundflag &&
!(rv = prefix_check(st, i, hu_mov_rule ? IN_CPD_OTHER : IN_CPD_BEGIN, compoundflag))) {
- if ((rv = suffix_check(st, i, 0, NULL, NULL, 0, NULL,
- FLAG_NULL, compoundflag, hu_mov_rule ? IN_CPD_OTHER : IN_CPD_BEGIN)) && !hu_mov_rule &&
+ if (((rv = suffix_check(st, i, 0, NULL, NULL, 0, NULL,
+ FLAG_NULL, compoundflag, hu_mov_rule ? IN_CPD_OTHER : IN_CPD_BEGIN)) ||
+ (compoundmoresuffixes && (rv = suffix_check_twosfx(st, i, 0, NULL, compoundflag)))) && !hu_mov_rule &&
sfx->getCont() &&
((compoundforbidflag && TESTAFF(sfx->getCont(), compoundforbidflag,
sfx->getContLen())) || (compoundend &&
@@ -1626,9 +1638,11 @@ struct hentry * AffixMgr::compound_check(const char * word, int len,
if (rv ||
(((wordnum == 0) && compoundbegin &&
((rv = suffix_check(st, i, 0, NULL, NULL, 0, NULL, FLAG_NULL, compoundbegin, hu_mov_rule ? IN_CPD_OTHER : IN_CPD_BEGIN)) ||
+ (compoundmoresuffixes && (rv = suffix_check_twosfx(st, i, 0, NULL, compoundbegin))) || // twofold suffixes + compound
(rv = prefix_check(st, i, hu_mov_rule ? IN_CPD_OTHER : IN_CPD_BEGIN, compoundbegin)))) ||
((wordnum > 0) && compoundmiddle &&
((rv = suffix_check(st, i, 0, NULL, NULL, 0, NULL, FLAG_NULL, compoundmiddle, hu_mov_rule ? IN_CPD_OTHER : IN_CPD_BEGIN)) ||
+ (compoundmoresuffixes && (rv = suffix_check_twosfx(st, i, 0, NULL, compoundmiddle))) || // twofold suffixes + compound
(rv = prefix_check(st, i, hu_mov_rule ? IN_CPD_OTHER : IN_CPD_BEGIN, compoundmiddle)))))
) checked_prefix = 1;
// else check forbiddenwords and needaffix
@@ -2031,7 +2045,7 @@ int AffixMgr::compound_check_morph(const char * word, int len,
int cmax;
int onlycpdrule;
- int affixed = 0;
+ char affixed = 0;
hentry ** oldwords = words;
setcminmax(&cmin, &cmax, word, len);
@@ -2101,11 +2115,12 @@ int AffixMgr::compound_check_morph(const char * word, int len,
}
if (!rv) {
- if (onlycpdrule) break;
+ if (onlycpdrule && strlen(*result) > MAXLNLEN/10) break;
if (compoundflag &&
!(rv = prefix_check(st, i, hu_mov_rule ? IN_CPD_OTHER : IN_CPD_BEGIN, compoundflag))) {
- if ((rv = suffix_check(st, i, 0, NULL, NULL, 0, NULL,
- FLAG_NULL, compoundflag, hu_mov_rule ? IN_CPD_OTHER : IN_CPD_BEGIN)) && !hu_mov_rule &&
+ if (((rv = suffix_check(st, i, 0, NULL, NULL, 0, NULL,
+ FLAG_NULL, compoundflag, hu_mov_rule ? IN_CPD_OTHER : IN_CPD_BEGIN)) ||
+ (compoundmoresuffixes && (rv = suffix_check_twosfx(st, i, 0, NULL, compoundflag)))) && !hu_mov_rule &&
sfx->getCont() &&
((compoundforbidflag && TESTAFF(sfx->getCont(), compoundforbidflag,
sfx->getContLen())) || (compoundend &&
@@ -2118,9 +2133,11 @@ int AffixMgr::compound_check_morph(const char * word, int len,
if (rv ||
(((wordnum == 0) && compoundbegin &&
((rv = suffix_check(st, i, 0, NULL, NULL, 0, NULL, FLAG_NULL, compoundbegin, hu_mov_rule ? IN_CPD_OTHER : IN_CPD_BEGIN)) ||
+ (compoundmoresuffixes && (rv = suffix_check_twosfx(st, i, 0, NULL, compoundbegin))) || // twofold suffix+compound
(rv = prefix_check(st, i, hu_mov_rule ? IN_CPD_OTHER : IN_CPD_BEGIN, compoundbegin)))) ||
((wordnum > 0) && compoundmiddle &&
((rv = suffix_check(st, i, 0, NULL, NULL, 0, NULL, FLAG_NULL, compoundmiddle, hu_mov_rule ? IN_CPD_OTHER : IN_CPD_BEGIN)) ||
+ (compoundmoresuffixes && (rv = suffix_check_twosfx(st, i, 0, NULL, compoundmiddle))) || // twofold suffix+compound
(rv = prefix_check(st, i, hu_mov_rule ? IN_CPD_OTHER : IN_CPD_BEGIN, compoundmiddle)))))
) {
// char * p = prefix_check_morph(st, i, 0, compound);
@@ -3540,7 +3557,7 @@ int AffixMgr::parse_reptable(char * line, FileMgr * af)
/* now parse the numrep lines to read in the remainder of the table */
char * nl;
for (int j=0; j < numrep; j++) {
- if (!(nl = af->getline())) return 1;
+ if ((nl = af->getline()) == NULL) return 1;
mychomp(nl);
tp = nl;
i = 0;
@@ -3637,7 +3654,7 @@ int AffixMgr::parse_convtable(char * line, FileMgr * af, RepList ** rl, const c
if (*piece != '\0') {
switch(i) {
case 0: {
- if (strncmp(piece, keyword, sizeof(keyword)) != 0) {
+ if (strncmp(piece, keyword, strlen(keyword)) != 0) {
HUNSPELL_WARNING(stderr, "error: line %d: table is corrupt\n", af->getlinenum());
delete *rl;
*rl = NULL;
@@ -4244,7 +4261,7 @@ int AffixMgr::parse_affix(char * line, const char at, FileMgr * af, char * dupf
std::vector<affentry>::iterator start = affentries.begin();
std::vector<affentry>::iterator end = affentries.end();
for (std::vector<affentry>::iterator entry = start; entry != end; ++entry) {
- if (!(nl = af->getline())) return 1;
+ if ((nl = af->getline()) == NULL) return 1;
mychomp(nl);
tp = nl;
i = 0;