diff options
author | chenxiajian <chenxiajian1985@gmail.com> | 2011-08-20 03:40:18 +0000 |
---|---|---|
committer | chenxiajian <chenxiajian1985@gmail.com> | 2011-08-20 03:40:18 +0000 |
commit | c19d21e225a39c6c026a6d4c3ec7bc78dc911d99 (patch) | |
tree | decbc44063e8dcce1c99d48baf9c75bc1486841a | |
parent | 0fb01c7e0966143cd77650e8403eed6c4cea6a24 (diff) | |
download | enchant-c19d21e225a39c6c026a6d4c3ec7bc78dc911d99.tar.gz |
deal with some exception
git-svn-id: svn+ssh://svn.abisource.com/svnroot/enchant/branches/gsoc2011hyphenation@30259 bcba8976-2d24-0410-9c9c-aab3bd5fdfd6
-rw-r--r-- | src/myspell/hunspell.cxx | 50 | ||||
-rw-r--r-- | src/myspell/replist.hxx | 12 |
2 files changed, 31 insertions, 31 deletions
diff --git a/src/myspell/hunspell.cxx b/src/myspell/hunspell.cxx index dcb03ff..9ea0595 100644 --- a/src/myspell/hunspell.cxx +++ b/src/myspell/hunspell.cxx @@ -8,10 +8,10 @@ #include "hunspell.hxx"
#include "hunspell.h"
-#include "csutil.hxx" - -#include <ctype.h> - +#include "csutil.hxx"
+
+#include <ctype.h>
+
#include "hyphen.h"
Hunspell::Hunspell(const char * affpath, const char * dpath, const char * key)
@@ -678,29 +678,29 @@ struct hentry * Hunspell::checkword(const char * w, int * info, char ** root) using namespace std;
void Hunspell::hyphenate( const char* const word, char* result, char* tag )
{
- HyphenDict *dict; - char buf[BUFSIZE + 1]; - char *hyphens=new char[BUFSIZE + 1]; - char ** rep; - int * pos; + HyphenDict *dict;
+ char buf[BUFSIZE + 1];
+ char *hyphens=new char[BUFSIZE + 1];
+ char ** rep;
+ int * pos;
int * cut;
- /* load the hyphenation dictionary */ - string filePath="hyph_"; - filePath+=tag; - filePath+=".dic"; - if ((dict = hnj_hyphen_load(filePath.c_str())) == NULL) { - fprintf(stderr, "Couldn't find file %s\n",tag); - fflush(stderr); - exit(1); + /* load the hyphenation dictionary */
+ string filePath="hyph_";
+ filePath+=tag;
+ filePath+=".dic";
+ if ((dict = hnj_hyphen_load(filePath.c_str())) == NULL) {
+ fprintf(stderr, "Couldn't find file %s\n",tag);
+ fflush(stderr);
+ exit(1);
}
- int len=strlen(word); - if (hnj_hyphen_hyphenate2(dict, word, len-1, hyphens, NULL, &rep, &pos, &cut)) { - free(hyphens); - fprintf(stderr, "hyphenation error\n"); - exit(1); - } - - hnj_hyphen_free(dict); + int len=strlen(word);
+ if (hnj_hyphen_hyphenate2(dict, word, len-1, hyphens, NULL, &rep, &pos, &cut)) {
+ free(hyphens);
+ fprintf(stderr, "hyphenation error\n");
+ exit(1);
+ }
+
+ hnj_hyphen_free(dict);
result=hyphens;
}
diff --git a/src/myspell/replist.hxx b/src/myspell/replist.hxx index 9c37e29..d3bbaf6 100644 --- a/src/myspell/replist.hxx +++ b/src/myspell/replist.hxx @@ -14,14 +14,14 @@ protected: int pos; public: - RepList(int n); - ~RepList(); + RepList(int n=0); + virtual ~RepList(); int get_pos(); - int add(char * pat1, char * pat2); + virtual int add(char * pat1, char * pat2); replentry * item(int n); - int near(const char * word); - int match(const char * word, int n); - int conv(const char * word, char * dest); + virtual int near(const char * word); + virtual int match(const char * word, int n); + virtual int conv(const char * word, char * dest); }; #endif |