1
0
Fork 0
mirror of https://git.freebsd.org/ports.git synced 2025-06-26 07:00:31 -04:00
ports/textproc/hunspell/files/patch-add-const
Jan Beich 24bce6e056 textproc/hunspell: update to 1.6.0
- Restore DIST_SUBDIR from r305651
- Adjust license for "or later" clause
- Restore GPLv2+/LGPL21+ license files removed upstream as
  GPLv3+/LGPL3+ only affects Hunspell 2.0 (not currently built)
- Unbreak |make makepatch|

Changes:	https://github.com/hunspell/hunspell/releases/tag/v1.6.0
PR:		215714
Submitted by:	sunpoet (based on)
Exp-run by:	antoine
MFH:		2017Q1
Differential Revision:	https://reviews.freebsd.org/D8887
2017-01-07 14:43:11 +00:00

68 lines
2.5 KiB
Text

Add back `const` keyword to keep consumers forward compatible by
reverting https://github.com/hunspell/hunspell/commit/dd4b14899bfb
--- src/hunspell/hunspell.cxx.orig 2016-11-28 10:34:55 UTC
+++ src/hunspell/hunspell.cxx
@@ -110,7 +110,7 @@ public:
int remove(const std::string& word);
const std::string& get_version() const;
struct cs_info* get_csconv();
- std::vector<char> dic_encoding_vec;
+
private:
AffixMgr* pAMgr;
@@ -181,9 +181,6 @@ HunspellImpl::HunspellImpl(const char* a
complexprefixes = pAMgr->get_complexprefixes();
wordbreak = pAMgr->get_breaktable();
- dic_encoding_vec.resize(encoding.size()+1);
- strcpy(&dic_encoding_vec[0], encoding.c_str());
-
/* and finally set up the suggestion manager */
pSMgr = new SuggestMgr(try_string, MAXSUGGESTION, pAMgr);
if (try_string)
@@ -1850,8 +1847,8 @@ int Hunspell::suffix_suggest(char*** sls
return munge_vector(slst, stems);
}
-char* Hunspell::get_dic_encoding() {
- return &(m_Impl->dic_encoding_vec[0]);
+const char* Hunspell::get_dic_encoding() const {
+ return Hunspell_get_dic_encoding((Hunhandle*)(this));
}
int Hunspell::stem(char*** slst, char** desc, int n) {
@@ -1896,8 +1893,8 @@ int Hunspell_spell(Hunhandle* pHunspell,
return reinterpret_cast<Hunspell*>(pHunspell)->spell(std::string(word));
}
-char* Hunspell_get_dic_encoding(Hunhandle* pHunspell) {
- return reinterpret_cast<Hunspell*>(pHunspell)->get_dic_encoding();
+const char* Hunspell_get_dic_encoding(Hunhandle* pHunspell) {
+ return (reinterpret_cast<Hunspell*>(pHunspell)->get_dict_encoding()).c_str();
}
int Hunspell_suggest(Hunhandle* pHunspell, char*** slst, const char* word) {
--- src/hunspell/hunspell.h.orig 2016-11-28 10:34:55 UTC
+++ src/hunspell/hunspell.h
@@ -68,7 +68,7 @@ LIBHUNSPELL_DLL_EXPORTED int Hunspell_ad
*/
LIBHUNSPELL_DLL_EXPORTED int Hunspell_spell(Hunhandle* pHunspell, const char*);
-LIBHUNSPELL_DLL_EXPORTED char* Hunspell_get_dic_encoding(Hunhandle* pHunspell);
+LIBHUNSPELL_DLL_EXPORTED const char* Hunspell_get_dic_encoding(Hunhandle* pHunspell);
/* suggest(suggestions, word) - search suggestions
* input: pointer to an array of strings pointer and the (bad) word
--- src/hunspell/hunspell.hxx.orig 2016-11-28 10:34:55 UTC
+++ src/hunspell/hunspell.hxx
@@ -155,7 +155,7 @@ class LIBHUNSPELL_DLL_EXPORTED Hunspell
H_DEPRECATED void free_list(char*** slst, int n);
const std::string& get_dict_encoding() const;
- char* get_dic_encoding();
+ H_DEPRECATED const char* get_dic_encoding() const;
/* morphological functions */