[hunspell] Spellcheck 99-character words.

Because of regression in
http://src.chromium.org/viewvc/chrome?view=rev&revision=174476, the browser does
not check spelling in 99-character words. This CL makes sure that the browser
checks the spelling of 99-character words by increasing one of the buffers by
one character instead of reducing the number of characters checked. This
approach is simpler than the one in revision 174476.

Unit test: https://codereview.chromium.org/11776032/.

Upstream bug report:
https://sourceforge.net/tracker/?func=detail&aid=3595024&group_id=143754&atid=756395

BUG=130128

Review URL: https://codereview.chromium.org/11778031

git-svn-id: http://src.chromium.org/svn/trunk/deps/third_party/hunspell@175968 4ff67af0-8c30-449e-8e8b-ad334ec8d88c
diff --git a/google.patch b/google.patch
index 5d21b98..55b726b 100644
--- a/google.patch
+++ b/google.patch
@@ -4,7 +4,7 @@
 retrieving revision 1.41
 diff -u -r1.41 affixmgr.cxx
 --- src/hunspell/affixmgr.cxx	16 Dec 2011 09:15:34 -0000	1.41
-+++ src/hunspell/affixmgr.cxx	21 Dec 2012 02:19:35 -0000
++++ src/hunspell/affixmgr.cxx	8 Jan 2013 00:30:25 -0000
 @@ -14,8 +14,14 @@
  
  #include "csutil.hxx"
@@ -195,7 +195,7 @@
 retrieving revision 1.15
 diff -u -r1.15 affixmgr.hxx
 --- src/hunspell/affixmgr.hxx	13 Oct 2011 13:41:54 -0000	1.15
-+++ src/hunspell/affixmgr.hxx	21 Dec 2012 02:19:35 -0000
++++ src/hunspell/affixmgr.hxx	8 Jan 2013 00:30:25 -0000
 @@ -18,6 +18,40 @@
  class PfxEntry;
  class SfxEntry;
@@ -280,7 +280,7 @@
 retrieving revision 1.5
 diff -u -r1.5 filemgr.cxx
 --- src/hunspell/filemgr.cxx	23 Jun 2011 09:21:50 -0000	1.5
-+++ src/hunspell/filemgr.cxx	21 Dec 2012 02:19:35 -0000
++++ src/hunspell/filemgr.cxx	8 Jan 2013 00:30:25 -0000
 @@ -7,6 +7,32 @@
  
  #include "filemgr.hxx"
@@ -325,7 +325,7 @@
 retrieving revision 1.3
 diff -u -r1.3 filemgr.hxx
 --- src/hunspell/filemgr.hxx	15 Apr 2010 11:22:08 -0000	1.3
-+++ src/hunspell/filemgr.hxx	21 Dec 2012 02:19:35 -0000
++++ src/hunspell/filemgr.hxx	8 Jan 2013 00:30:25 -0000
 @@ -7,6 +7,30 @@
  #include "hunzip.hxx"
  #include <stdio.h>
@@ -368,7 +368,7 @@
 retrieving revision 1.12
 diff -u -r1.12 hashmgr.cxx
 --- src/hunspell/hashmgr.cxx	23 Jun 2011 09:21:50 -0000	1.12
-+++ src/hunspell/hashmgr.cxx	21 Dec 2012 02:19:35 -0000
++++ src/hunspell/hashmgr.cxx	8 Jan 2013 00:30:25 -0000
 @@ -12,8 +12,14 @@
  
  // build a hash table from a munched word list
@@ -738,7 +738,7 @@
 retrieving revision 1.3
 diff -u -r1.3 hashmgr.hxx
 --- src/hunspell/hashmgr.hxx	15 Apr 2010 11:22:08 -0000	1.3
-+++ src/hunspell/hashmgr.hxx	21 Dec 2012 02:19:35 -0000
++++ src/hunspell/hashmgr.hxx	8 Jan 2013 00:30:25 -0000
 @@ -8,10 +8,25 @@
  #include "htypes.hxx"
  #include "filemgr.hxx"
@@ -836,7 +836,7 @@
 retrieving revision 1.3
 diff -u -r1.3 htypes.hxx
 --- src/hunspell/htypes.hxx	6 Sep 2010 07:58:53 -0000	1.3
-+++ src/hunspell/htypes.hxx	21 Dec 2012 02:19:35 -0000
++++ src/hunspell/htypes.hxx	8 Jan 2013 00:30:25 -0000
 @@ -1,6 +1,16 @@
  #ifndef _HTYPES_HXX_
  #define _HTYPES_HXX_
@@ -860,7 +860,7 @@
 retrieving revision 1.29
 diff -u -r1.29 hunspell.cxx
 --- src/hunspell/hunspell.cxx	23 Jun 2011 09:21:50 -0000	1.29
-+++ src/hunspell/hunspell.cxx	21 Dec 2012 02:19:35 -0000
++++ src/hunspell/hunspell.cxx	8 Jan 2013 00:30:25 -0000
 @@ -7,20 +7,37 @@
  
  #include "hunspell.hxx"
@@ -944,18 +944,7 @@
  
  // make a copy of src at destination while removing all leading
  // blanks and removing any trailing periods after recording
-@@ -108,7 +137,9 @@
-    if (utf8) {
-       *nc = u8_u16(dest_utf, MAXWORDLEN, dest);
-       // don't check too long words
--      if (*nc >= MAXWORDLEN) return 0;
-+      // TODO(rouslan): Remove the interim change below when this patch lands:
-+      // http://sf.net/tracker/?func=detail&aid=3595024&group_id=143754&atid=756395.
-+      if (*nc >= MAXWORDLEN - 1) return 0;
-       if (*nc == -1) { // big Unicode character (non BMP area)
-          *pcaptype = NOCAP;
-          return nl;
-@@ -322,6 +353,9 @@
+@@ -322,6 +351,9 @@
  
  int Hunspell::spell(const char * word, int * info, char ** root)
  {
@@ -965,7 +954,7 @@
    struct hentry * rv=NULL;
    // need larger vector. For example, Turkish capital letter I converted a
    // 2-byte UTF-8 character (dotless i) by mkallsmall.
-@@ -586,6 +620,13 @@
+@@ -586,6 +618,13 @@
    if (!len)
        return NULL;
  
@@ -979,7 +968,7 @@
    // word reversing wrapper for complex prefixes
    if (complexprefixes) {
      if (word != w2) {
-@@ -675,6 +716,9 @@
+@@ -675,6 +714,9 @@
  
  int Hunspell::suggest(char*** slst, const char * word)
  {
@@ -989,7 +978,7 @@
    int onlycmpdsug = 0;
    char cw[MAXWORDUTF8LEN];
    char wspace[MAXWORDUTF8LEN];
-@@ -1921,13 +1965,21 @@
+@@ -1921,13 +1963,21 @@
  
  Hunhandle *Hunspell_create(const char * affpath, const char * dpath)
  {
@@ -1017,7 +1006,7 @@
 retrieving revision 1.6
 diff -u -r1.6 hunspell.hxx
 --- src/hunspell/hunspell.hxx	21 Jan 2011 17:30:41 -0000	1.6
-+++ src/hunspell/hunspell.hxx	21 Dec 2012 02:19:35 -0000
++++ src/hunspell/hunspell.hxx	8 Jan 2013 00:30:25 -0000
 @@ -5,6 +5,10 @@
  #include "suggestmgr.hxx"
  #include "langnum.hxx"
@@ -1074,7 +1063,7 @@
 retrieving revision 1.2
 diff -u -r1.2 replist.hxx
 --- src/hunspell/replist.hxx	15 Apr 2010 11:22:09 -0000	1.2
-+++ src/hunspell/replist.hxx	21 Dec 2012 02:19:35 -0000
++++ src/hunspell/replist.hxx	8 Jan 2013 00:30:25 -0000
 @@ -2,6 +2,12 @@
  #ifndef _REPLIST_HXX_
  #define _REPLIST_HXX_
@@ -1094,7 +1083,7 @@
 retrieving revision 1.24
 diff -u -r1.24 suggestmgr.cxx
 --- src/hunspell/suggestmgr.cxx	14 Feb 2011 21:47:24 -0000	1.24
-+++ src/hunspell/suggestmgr.cxx	21 Dec 2012 02:19:35 -0000
++++ src/hunspell/suggestmgr.cxx	8 Jan 2013 00:30:26 -0000
 @@ -12,9 +12,110 @@
  
  const w_char W_VLINE = { '\0', '|' };
@@ -1264,7 +1253,31 @@
     return ns;
  }
  
-@@ -1057,6 +1202,9 @@
+@@ -678,7 +823,9 @@
+ // error is missing a letter it needs
+ int SuggestMgr::forgotchar(char ** wlst, const char * word, int ns, int cpdsuggest)
+ {
+-   char candidate[MAXSWUTF8L];
++   // TODO(rouslan): Remove the interim change below when this patch lands:
++   // http://sf.net/tracker/?func=detail&aid=3595024&group_id=143754&atid=756395
++   char candidate[MAXSWUTF8L + 4];
+    char * p;
+    clock_t timelimit = clock();
+    int timer = MINTIMER;
+@@ -700,8 +847,10 @@
+ // error is missing a letter it needs
+ int SuggestMgr::forgotchar_utf(char ** wlst, const w_char * word, int wl, int ns, int cpdsuggest)
+ {
+-   w_char  candidate_utf[MAXSWL];
+-   char    candidate[MAXSWUTF8L];
++   // TODO(rouslan): Remove the interim change below when this patch lands:
++   // http://sf.net/tracker/?func=detail&aid=3595024&group_id=143754&atid=756395
++   w_char  candidate_utf[MAXSWL + 1];
++   char    candidate[MAXSWUTF8L + 4];
+    w_char * p;
+    clock_t timelimit = clock();
+    int timer = MINTIMER;
+@@ -1057,6 +1206,9 @@
  
    struct hentry* hp = NULL;
    int col = -1;
@@ -1274,7 +1287,7 @@
    phonetable * ph = (pAMgr) ? pAMgr->get_phonetable() : NULL;
    char target[MAXSWUTF8L];
    char candidate[MAXSWUTF8L];
-@@ -1115,7 +1263,11 @@
+@@ -1115,7 +1267,11 @@
  
      if (sc > scores[lp]) {
        scores[lp] = sc;  
@@ -1292,7 +1305,7 @@
 retrieving revision 1.5
 diff -u -r1.5 suggestmgr.hxx
 --- src/hunspell/suggestmgr.hxx	21 Jan 2011 22:10:24 -0000	1.5
-+++ src/hunspell/suggestmgr.hxx	21 Dec 2012 02:19:35 -0000
++++ src/hunspell/suggestmgr.hxx	8 Jan 2013 00:30:26 -0000
 @@ -52,7 +52,11 @@
  
  
diff --git a/src/hunspell/hunspell.cxx b/src/hunspell/hunspell.cxx
index b3f3739..0d606e0 100644
--- a/src/hunspell/hunspell.cxx
+++ b/src/hunspell/hunspell.cxx
@@ -137,9 +137,7 @@
    if (utf8) {
       *nc = u8_u16(dest_utf, MAXWORDLEN, dest);
       // don't check too long words
-      // TODO(rouslan): Remove the interim change below when this patch lands:
-      // http://sf.net/tracker/?func=detail&aid=3595024&group_id=143754&atid=756395.
-      if (*nc >= MAXWORDLEN - 1) return 0;
+      if (*nc >= MAXWORDLEN) return 0;
       if (*nc == -1) { // big Unicode character (non BMP area)
          *pcaptype = NOCAP;
          return nl;
diff --git a/src/hunspell/suggestmgr.cxx b/src/hunspell/suggestmgr.cxx
index 76ab203..cfec525 100644
--- a/src/hunspell/suggestmgr.cxx
+++ b/src/hunspell/suggestmgr.cxx
@@ -823,7 +823,9 @@
 // error is missing a letter it needs
 int SuggestMgr::forgotchar(char ** wlst, const char * word, int ns, int cpdsuggest)
 {
-   char candidate[MAXSWUTF8L];
+   // TODO(rouslan): Remove the interim change below when this patch lands:
+   // http://sf.net/tracker/?func=detail&aid=3595024&group_id=143754&atid=756395
+   char candidate[MAXSWUTF8L + 4];
    char * p;
    clock_t timelimit = clock();
    int timer = MINTIMER;
@@ -845,8 +847,10 @@
 // error is missing a letter it needs
 int SuggestMgr::forgotchar_utf(char ** wlst, const w_char * word, int wl, int ns, int cpdsuggest)
 {
-   w_char  candidate_utf[MAXSWL];
-   char    candidate[MAXSWUTF8L];
+   // TODO(rouslan): Remove the interim change below when this patch lands:
+   // http://sf.net/tracker/?func=detail&aid=3595024&group_id=143754&atid=756395
+   w_char  candidate_utf[MAXSWL + 1];
+   char    candidate[MAXSWUTF8L + 4];
    w_char * p;
    clock_t timelimit = clock();
    int timer = MINTIMER;