Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Unified Diff: third_party/hunspell/src/hunspell/affixmgr.hxx

Issue 2239005: Merges our hunspell change to hunspell 1.2.10.... (Closed) Base URL: svn://chrome-svn.corp.google.com/chrome/trunk/deps/
Patch Set: '' Created 10 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/hunspell/hunspell.gyp ('k') | third_party/hunspell/src/hunspell/affixmgr.cxx » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/hunspell/src/hunspell/affixmgr.hxx
===================================================================
--- third_party/hunspell/src/hunspell/affixmgr.hxx (revision 50428)
+++ third_party/hunspell/src/hunspell/affixmgr.hxx (working copy)
@@ -18,6 +18,40 @@
class PfxEntry;
class SfxEntry;
+#ifdef HUNSPELL_CHROME_CLIENT
+
+#include <vector>
+
+// This class provides an implementation of the contclasses array in AffixMgr
+// that is normally a large static array. We should almost never need more than
+// 256 elements, so this class only allocates that much to start off with. If
+// elements higher than that are actually used, we'll automatically expand.
+class ContClasses {
+ public:
+ ContClasses() {
+ // Pre-allocate a buffer so that typically, we'll never have to resize.
+ EnsureSizeIs(256);
+ }
+
+ char& operator[](size_t index) {
+ EnsureSizeIs(index + 1);
+ return data[index];
+ }
+
+ void EnsureSizeIs(size_t new_size) {
+ if (data.size() >= new_size)
+ return; // Nothing to do.
+
+ size_t old_size = data.size();
+ data.resize(new_size);
+ memset(&data[old_size], 0, new_size - old_size);
+ }
+
+ std::vector<char> data;
+};
+
+#endif // HUNSPELL_CHROME_CLIENT
+
class LIBHUNSPELL_DLL_EXPORTED AffixMgr
{
@@ -98,12 +132,20 @@
int fullstrip;
int havecontclass; // boolean variable
+#ifdef HUNSPELL_CHROME_CLIENT
+ ContClasses contclasses;
+#else
char contclasses[CONTSIZE]; // flags of possible continuing classes (twofold affix)
+#endif
public:
+#ifdef HUNSPELL_CHROME_CLIENT
+ AffixMgr(hunspell::BDictReader* reader, HashMgr** ptr, int * md);
+#else
AffixMgr(const char * affpath, HashMgr** ptr, int * md,
const char * key = NULL);
+#endif
~AffixMgr();
struct hentry * affix_check(const char * word, int len,
const unsigned short needflag = (unsigned short) 0,
@@ -202,6 +244,10 @@
int get_fullstrip() const;
private:
+#ifdef HUNSPELL_CHROME_CLIENT
+ // Not owned by us, owned by the Hunspell object.
+ hunspell::BDictReader* bdict_reader;
+#endif
int parse_file(const char * affpath, const char * key);
int parse_flag(char * line, unsigned short * out, FileMgr * af);
int parse_num(char * line, int * out, FileMgr * af);
« no previous file with comments | « third_party/hunspell/hunspell.gyp ('k') | third_party/hunspell/src/hunspell/affixmgr.cxx » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698