diff options
author | George Hazan <george.hazan@gmail.com> | 2023-10-01 13:24:29 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2023-10-01 13:24:29 +0300 |
commit | 93babaf1665bd2b706a096057fdd06572c159622 (patch) | |
tree | efa9da647497149233facb88a422d9d31564bb4b /libs/hunspell/src/affixmgr.hxx | |
parent | 13627600541c19643b96bd4c7b3a3d9fd92040f9 (diff) |
fixes #3696 (Update hunspell to 1.7.2)
Diffstat (limited to 'libs/hunspell/src/affixmgr.hxx')
-rw-r--r-- | libs/hunspell/src/affixmgr.hxx | 65 |
1 files changed, 37 insertions, 28 deletions
diff --git a/libs/hunspell/src/affixmgr.hxx b/libs/hunspell/src/affixmgr.hxx index 450f50a65c..0fc22a3d50 100644 --- a/libs/hunspell/src/affixmgr.hxx +++ b/libs/hunspell/src/affixmgr.hxx @@ -71,7 +71,7 @@ #ifndef AFFIXMGR_HXX_ #define AFFIXMGR_HXX_ -#include <stdio.h> +#include <cstdio> #include <string> #include <vector> @@ -176,42 +176,50 @@ class AffixMgr { public: AffixMgr(const char* affpath, const std::vector<HashMgr*>& ptr, const char* key = NULL); ~AffixMgr(); - struct hentry* affix_check(const char* word, + struct hentry* affix_check(const std::string& word, + int start, int len, const unsigned short needflag = (unsigned short)0, char in_compound = IN_CPD_NOT); - struct hentry* prefix_check(const char* word, + struct hentry* prefix_check(const std::string& word, + int start, int len, char in_compound, const FLAG needflag = FLAG_NULL); inline int isSubset(const char* s1, const char* s2); - struct hentry* prefix_check_twosfx(const char* word, + struct hentry* prefix_check_twosfx(const std::string& word, + int start, int len, char in_compound, const FLAG needflag = FLAG_NULL); inline int isRevSubset(const char* s1, const char* end_of_s2, int len); - struct hentry* suffix_check(const char* word, + struct hentry* suffix_check(const std::string& word, + int start, int len, int sfxopts, PfxEntry* ppfx, const FLAG cclass = FLAG_NULL, const FLAG needflag = FLAG_NULL, char in_compound = IN_CPD_NOT); - struct hentry* suffix_check_twosfx(const char* word, + struct hentry* suffix_check_twosfx(const std::string& word, + int start, int len, int sfxopts, PfxEntry* ppfx, const FLAG needflag = FLAG_NULL); - std::string affix_check_morph(const char* word, + std::string affix_check_morph(const std::string& word, + int start, int len, const FLAG needflag = FLAG_NULL, char in_compound = IN_CPD_NOT); - std::string prefix_check_morph(const char* word, + std::string prefix_check_morph(const std::string& word, + int start, int len, char in_compound, const FLAG needflag = FLAG_NULL); - std::string suffix_check_morph(const char* word, + std::string suffix_check_morph(const std::string& word, + int start, int len, int sfxopts, PfxEntry* ppfx, @@ -219,11 +227,13 @@ class AffixMgr { const FLAG needflag = FLAG_NULL, char in_compound = IN_CPD_NOT); - std::string prefix_check_twosfx_morph(const char* word, + std::string prefix_check_twosfx_morph(const std::string& word, + int start, int len, char in_compound, const FLAG needflag = FLAG_NULL); - std::string suffix_check_twosfx_morph(const char* word, + std::string suffix_check_twosfx_morph(const std::string& word, + int start, int len, int sfxopts, PfxEntry* ppfx, @@ -248,10 +258,10 @@ class AffixMgr { const char*); short get_syllable(const std::string& word); - int cpdrep_check(const char* word, int len); - int cpdwordpair_check(const char * word, int len); - int cpdpat_check(const char* word, - int len, + int cpdrep_check(const std::string& word, int len); + int cpdwordpair_check(const std::string& word, int len); + int cpdpat_check(const std::string& word, + size_t len, hentry* r1, hentry* r2, const char affixed); @@ -260,9 +270,9 @@ class AffixMgr { hentry* rv, hentry** rwords, char all); - int cpdcase_check(const char* word, int len); - inline int candidate_check(const char* word, int len); - void setcminmax(int* cmin, int* cmax, const char* word, int len); + int cpdcase_check(const std::string& word, int len); + inline int candidate_check(const std::string& word); + void setcminmax(size_t* cmin, size_t* cmax, const char* word, size_t len); struct hentry* compound_check(const std::string& word, short wordnum, short numsyllable, @@ -274,8 +284,7 @@ class AffixMgr { char is_sug, int* info); - int compound_check_morph(const char* word, - int len, + int compound_check_morph(const std::string& word, short wordnum, short numsyllable, short maxwordnum, @@ -288,9 +297,9 @@ class AffixMgr { std::vector<std::string> get_suffix_words(short unsigned* suff, int len, - const char* root_word); + const std::string& root_word); - struct hentry* lookup(const char* word); + struct hentry* lookup(const char* word, size_t len); const std::vector<replentry>& get_reptable() const; RepList* get_iconvtable() const; RepList* get_oconvtable() const; @@ -299,8 +308,8 @@ class AffixMgr { const std::vector<std::string>& get_breaktable() const; const std::string& get_encoding(); int get_langnum() const; - char* get_key_string(); - char* get_try_string() const; + const std::string& get_key_string(); + const std::string& get_try_string() const; const std::string& get_wordchars() const; const std::vector<w_char>& get_wordchars_utf16() const; const char* get_ignore() const; @@ -330,7 +339,7 @@ class AffixMgr { FLAG get_warn(void) const; int get_forbidwarn(void) const; int get_checksharps(void) const; - char* encode_flag(unsigned short aflag) const; + std::string encode_flag(unsigned short aflag) const; int get_fullstrip() const; private: @@ -351,8 +360,8 @@ class AffixMgr { void reverse_condition(std::string&); std::string& debugflag(std::string& result, unsigned short flag); - int condlen(const char*); - int encodeit(AffEntry& entry, const char* cs); + int condlen(const std::string& s); + int encodeit(AffEntry& entry, const std::string& cs); int build_pfxtree(PfxEntry* pfxptr); int build_sfxtree(SfxEntry* sfxptr); int process_pfx_order(); @@ -361,7 +370,7 @@ class AffixMgr { SfxEntry* process_sfx_in_order(SfxEntry* ptr, SfxEntry* nptr); int process_pfx_tree_to_list(); int process_sfx_tree_to_list(); - int redundant_condition(char, const char* strip, int stripl, const char* cond, int); + int redundant_condition(char, const std::string& strip, const std::string& cond, int); void finishFileMgr(FileMgr* afflst); }; |