Added
Link Here
|
1 |
Add back `const` keyword to keep consumers forward compatible by |
2 |
reverting https://github.com/hunspell/hunspell/commit/dd4b14899bfb |
3 |
|
4 |
--- src/hunspell/hunspell.cxx.orig 2016-11-28 10:34:55 UTC |
5 |
+++ src/hunspell/hunspell.cxx |
6 |
@@ -110,7 +110,7 @@ public: |
7 |
int remove(const std::string& word); |
8 |
const std::string& get_version() const; |
9 |
struct cs_info* get_csconv(); |
10 |
- std::vector<char> dic_encoding_vec; |
11 |
+ |
12 |
|
13 |
private: |
14 |
AffixMgr* pAMgr; |
15 |
@@ -181,9 +181,6 @@ HunspellImpl::HunspellImpl(const char* a |
16 |
complexprefixes = pAMgr->get_complexprefixes(); |
17 |
wordbreak = pAMgr->get_breaktable(); |
18 |
|
19 |
- dic_encoding_vec.resize(encoding.size()+1); |
20 |
- strcpy(&dic_encoding_vec[0], encoding.c_str()); |
21 |
- |
22 |
/* and finally set up the suggestion manager */ |
23 |
pSMgr = new SuggestMgr(try_string, MAXSUGGESTION, pAMgr); |
24 |
if (try_string) |
25 |
@@ -1850,8 +1847,8 @@ int Hunspell::suffix_suggest(char*** sls |
26 |
return munge_vector(slst, stems); |
27 |
} |
28 |
|
29 |
-char* Hunspell::get_dic_encoding() { |
30 |
- return &(m_Impl->dic_encoding_vec[0]); |
31 |
+const char* Hunspell::get_dic_encoding() const { |
32 |
+ return Hunspell_get_dic_encoding((Hunhandle*)(this)); |
33 |
} |
34 |
|
35 |
int Hunspell::stem(char*** slst, char** desc, int n) { |
36 |
@@ -1896,8 +1893,8 @@ int Hunspell_spell(Hunhandle* pHunspell, |
37 |
return reinterpret_cast<Hunspell*>(pHunspell)->spell(std::string(word)); |
38 |
} |
39 |
|
40 |
-char* Hunspell_get_dic_encoding(Hunhandle* pHunspell) { |
41 |
- return reinterpret_cast<Hunspell*>(pHunspell)->get_dic_encoding(); |
42 |
+const char* Hunspell_get_dic_encoding(Hunhandle* pHunspell) { |
43 |
+ return (reinterpret_cast<Hunspell*>(pHunspell)->get_dict_encoding()).c_str(); |
44 |
} |
45 |
|
46 |
int Hunspell_suggest(Hunhandle* pHunspell, char*** slst, const char* word) { |
47 |
--- src/hunspell/hunspell.h.orig 2016-11-28 10:34:55 UTC |
48 |
+++ src/hunspell/hunspell.h |
49 |
@@ -68,7 +68,7 @@ LIBHUNSPELL_DLL_EXPORTED int Hunspell_ad |
50 |
*/ |
51 |
LIBHUNSPELL_DLL_EXPORTED int Hunspell_spell(Hunhandle* pHunspell, const char*); |
52 |
|
53 |
-LIBHUNSPELL_DLL_EXPORTED char* Hunspell_get_dic_encoding(Hunhandle* pHunspell); |
54 |
+LIBHUNSPELL_DLL_EXPORTED const char* Hunspell_get_dic_encoding(Hunhandle* pHunspell); |
55 |
|
56 |
/* suggest(suggestions, word) - search suggestions |
57 |
* input: pointer to an array of strings pointer and the (bad) word |
58 |
--- src/hunspell/hunspell.hxx.orig 2016-11-28 10:34:55 UTC |
59 |
+++ src/hunspell/hunspell.hxx |
60 |
@@ -155,7 +155,7 @@ class LIBHUNSPELL_DLL_EXPORTED Hunspell |
61 |
H_DEPRECATED void free_list(char*** slst, int n); |
62 |
|
63 |
const std::string& get_dict_encoding() const; |
64 |
- char* get_dic_encoding(); |
65 |
+ H_DEPRECATED const char* get_dic_encoding() const; |
66 |
|
67 |
/* morphological functions */ |
68 |
|
69 |
--- src/win_api/hunspelldll.c.orig 2016-11-28 10:34:55 UTC |
70 |
+++ src/win_api/hunspelldll.c |
71 |
@@ -73,7 +73,7 @@ LIBHUNSPELL_DLL_EXPORTED void hunspell_f |
72 |
pMS->free_list(slst, len); |
73 |
} |
74 |
|
75 |
-LIBHUNSPELL_DLL_EXPORTED char* hunspell_get_dic_encoding(Hunspell* pMS) { |
76 |
+LIBHUNSPELL_DLL_EXPORTED const char* hunspell_get_dic_encoding(Hunspell* pMS) { |
77 |
return pMS->get_dic_encoding(); |
78 |
} |
79 |
|
80 |
--- src/win_api/hunspelldll.h.orig 2016-11-28 10:34:55 UTC |
81 |
+++ src/win_api/hunspelldll.h |
82 |
@@ -59,7 +59,7 @@ LIBHUNSPELL_DLL_EXPORTED void hunspell_f |
83 |
char*** slst, |
84 |
int len); |
85 |
// make local copy of returned string!! |
86 |
-LIBHUNSPELL_DLL_EXPORTED char* hunspell_get_dic_encoding(Hunspell* pMS); |
87 |
+LIBHUNSPELL_DLL_EXPORTED const char* hunspell_get_dic_encoding(Hunspell* pMS); |
88 |
|
89 |
// add word to dict (word is valid until spell object is not destroyed) |
90 |
LIBHUNSPELL_DLL_EXPORTED int hunspell_add(Hunspell* pMS, char* word); |