summaryrefslogtreecommitdiff
path: root/plugins/SpellChecker/src/hunspell
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-12-18 12:02:05 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-12-18 12:02:05 +0000
commite2ed49605db24d54949f603f0e79800796a6b59f (patch)
tree0ba1abbe3b178cdd43d4c40fa83fc88d3174c1d3 /plugins/SpellChecker/src/hunspell
parentc554ec47dca508a085c4206aea5cc5cadc1311fb (diff)
warning fix
git-svn-id: http://svn.miranda-ng.org/main/trunk@11508 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/SpellChecker/src/hunspell')
-rw-r--r--plugins/SpellChecker/src/hunspell/suggestmgr.cxx84
1 files changed, 40 insertions, 44 deletions
diff --git a/plugins/SpellChecker/src/hunspell/suggestmgr.cxx b/plugins/SpellChecker/src/hunspell/suggestmgr.cxx
index 843075e62f..9dfc049a99 100644
--- a/plugins/SpellChecker/src/hunspell/suggestmgr.cxx
+++ b/plugins/SpellChecker/src/hunspell/suggestmgr.cxx
@@ -253,59 +253,55 @@ int SuggestMgr::suggest(char*** slst, const char * w, int nsug,
#ifdef HUNSPELL_EXPERIMENTAL
int SuggestMgr::suggest_auto(char*** slst, const char * w, int nsug)
{
- int nocompoundtwowords = 0;
- char ** wlst;
- int oldSug;
-
- char w2[MAXWORDUTF8LEN];
- const char * word = w;
-
- // word reversing wrapper for complex prefixes
- if (complexprefixes) {
- strcpy(w2, w);
- if (utf8) reverseword_utf(w2); else reverseword(w2);
- word = w2;
- }
-
- if (*slst) {
- wlst = *slst;
- } else {
- wlst = (char **) malloc(maxSug * sizeof(char *));
- if (wlst == NULL) return -1;
- }
+ char w2[MAXWORDUTF8LEN];
+ const char *word = w;
+
+ // word reversing wrapper for complex prefixes
+ if (complexprefixes) {
+ strcpy(w2, w);
+ if (utf8) reverseword_utf(w2); else reverseword(w2);
+ word = w2;
+ }
- for (int cpdsuggest=0; (cpdsuggest<2) && (nocompoundtwowords==0); cpdsuggest++) {
+ char **wlst;
+ if (*slst)
+ wlst = *slst;
+ else {
+ wlst = (char **)malloc(maxSug * sizeof(char *));
+ if (wlst == NULL) return -1;
+ }
- // limit compound suggestion
- if (cpdsuggest > 0) oldSug = nsug;
+ int oldSug = 0, nocompoundtwowords = 0;
+ for (int cpdsuggest = 0; (cpdsuggest < 2) && (nocompoundtwowords == 0); cpdsuggest++) {
+ // limit compound suggestion
+ if (cpdsuggest > 0) oldSug = nsug;
- // perhaps we made a typical fault of spelling
- if ((nsug < maxSug) && (nsug > -1))
- nsug = replchars(wlst, word, nsug, cpdsuggest);
+ // perhaps we made a typical fault of spelling
+ if ((nsug < maxSug) && (nsug > -1))
+ nsug = replchars(wlst, word, nsug, cpdsuggest);
- // perhaps we made chose the wrong char from a related set
- if ((nsug < maxSug) && (nsug > -1) && (!cpdsuggest || (nsug < oldSug + maxcpdsugs)))
- nsug = mapchars(wlst, word, nsug, cpdsuggest);
+ // perhaps we made chose the wrong char from a related set
+ if ((nsug < maxSug) && (nsug > -1) && (!cpdsuggest || (nsug < oldSug + maxcpdsugs)))
+ nsug = mapchars(wlst, word, nsug, cpdsuggest);
- if ((cpdsuggest==0) && (nsug>0)) nocompoundtwowords=1;
+ if ((cpdsuggest == 0) && (nsug > 0))
+ nocompoundtwowords = 1;
- // perhaps we forgot to hit space and two words ran together
+ // perhaps we forgot to hit space and two words ran together
- if ((nsug < maxSug) && (nsug > -1) && (!cpdsuggest || (nsug < oldSug + maxcpdsugs)) && check_forbidden(word, strlen(word))) {
- nsug = twowords(wlst, word, nsug, cpdsuggest);
- }
-
- } // repeating ``for'' statement compounding support
+ if ((nsug < maxSug) && (nsug > -1) && (!cpdsuggest || (nsug < oldSug + maxcpdsugs)) && check_forbidden(word, strlen(word)))
+ nsug = twowords(wlst, word, nsug, cpdsuggest);
+ } // repeating ``for'' statement compounding support
- if (nsug < 0) {
- for (int i=0;i<maxSug; i++)
- if (wlst[i] != NULL) free(wlst[i]);
- free(wlst);
- return -1;
- }
+ if (nsug < 0) {
+ for (int i = 0; i < maxSug; i++)
+ if (wlst[i] != NULL) free(wlst[i]);
+ free(wlst);
+ return -1;
+ }
- *slst = wlst;
- return nsug;
+ *slst = wlst;
+ return nsug;
}
#endif // END OF HUNSPELL_EXPERIMENTAL CODE