summaryrefslogtreecommitdiff
path: root/plugins/SpellChecker/src/hunspell
diff options
context:
space:
mode:
authorRozhuk Ivan <rozhuk.im@gmail.com>2014-11-26 23:48:18 +0000
committerRozhuk Ivan <rozhuk.im@gmail.com>2014-11-26 23:48:18 +0000
commitf19ed36b66a807420c771a467a954114f027384c (patch)
tree1c61894875576ee9cae4b37d448a6a671585fa9d /plugins/SpellChecker/src/hunspell
parent08e744c5f087a8e693d160c527097a9f6a5bf712 (diff)
SpellChecker: code cleanup
git-svn-id: http://svn.miranda-ng.org/main/trunk@11110 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/SpellChecker/src/hunspell')
-rw-r--r--plugins/SpellChecker/src/hunspell/csutil.cxx3
-rw-r--r--plugins/SpellChecker/src/hunspell/suggestmgr.cxx5
2 files changed, 6 insertions, 2 deletions
diff --git a/plugins/SpellChecker/src/hunspell/csutil.cxx b/plugins/SpellChecker/src/hunspell/csutil.cxx
index cf24bc06dd..ee78edbc40 100644
--- a/plugins/SpellChecker/src/hunspell/csutil.cxx
+++ b/plugins/SpellChecker/src/hunspell/csutil.cxx
@@ -343,6 +343,9 @@ char * line_uniq(char * text, char breakchar) {
char ** lines;
int linenum = line_tok(text, &lines, breakchar);
int i;
+
+ if (linenum == 0)
+ return NULL;
strcpy(text, lines[0]);
for ( i = 1; i < linenum; i++ ) {
int dup = 0;
diff --git a/plugins/SpellChecker/src/hunspell/suggestmgr.cxx b/plugins/SpellChecker/src/hunspell/suggestmgr.cxx
index d89630849c..843075e62f 100644
--- a/plugins/SpellChecker/src/hunspell/suggestmgr.cxx
+++ b/plugins/SpellChecker/src/hunspell/suggestmgr.cxx
@@ -1578,7 +1578,8 @@ char * SuggestMgr::suggest_morph_for_spelling_error(const char * word)
{
char * p = NULL;
char ** wlst = (char **) calloc(maxSug, sizeof(char *));
- if (!**wlst) return NULL;
+ if (!wlst)
+ return NULL;
// we will use only the first suggestion
for (int i = 0; i < maxSug - 1; i++) wlst[i] = "";
int ns = suggest(&wlst, word, maxSug - 1, NULL);
@@ -1586,7 +1587,7 @@ char * SuggestMgr::suggest_morph_for_spelling_error(const char * word)
p = suggest_morph(wlst[maxSug - 1]);
free(wlst[maxSug - 1]);
}
- if (wlst) free(wlst);
+ free(wlst);
return p;
}
#endif // END OF HUNSPELL_EXPERIMENTAL CODE