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

Side by Side Diff: google.patch

Issue 11442040: Fix array-out-of-bounds error in hunspell (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/hunspell.git@master
Patch Set: Merge with master Created 8 years 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 unified diff | Download patch
« no previous file with comments | « README.chromium ('k') | src/hunspell/hunspell.cxx » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 Index: src/hunspell/affixmgr.cxx 1 Index: src/hunspell/affixmgr.cxx
2 =================================================================== 2 ===================================================================
3 RCS file: /cvsroot/hunspell/hunspell/src/hunspell/affixmgr.cxx,v 3 RCS file: /cvsroot/hunspell/hunspell/src/hunspell/affixmgr.cxx,v
4 retrieving revision 1.41 4 retrieving revision 1.41
5 diff -u -r1.41 affixmgr.cxx 5 diff -u -r1.41 affixmgr.cxx
6 --- src/hunspell/affixmgr.cxx 16 Dec 2011 09:15:34 -0000 1.41 6 --- src/hunspell/affixmgr.cxx 16 Dec 2011 09:15:34 -0000 1.41
7 +++ src/hunspell/affixmgr.cxx» 20 Dec 2012 23:40:03 -0000 7 +++ src/hunspell/affixmgr.cxx» 21 Dec 2012 02:19:35 -0000
8 @@ -14,8 +14,14 @@ 8 @@ -14,8 +14,14 @@
9 9
10 #include "csutil.hxx" 10 #include "csutil.hxx"
11 11
12 +#ifdef HUNSPELL_CHROME_CLIENT 12 +#ifdef HUNSPELL_CHROME_CLIENT
13 +AffixMgr::AffixMgr(hunspell::BDictReader* reader, HashMgr** ptr, int * md) 13 +AffixMgr::AffixMgr(hunspell::BDictReader* reader, HashMgr** ptr, int * md)
14 +{ 14 +{
15 + bdict_reader = reader; 15 + bdict_reader = reader;
16 +#else 16 +#else
17 AffixMgr::AffixMgr(const char * affpath, HashMgr** ptr, int * md, const char * key) 17 AffixMgr::AffixMgr(const char * affpath, HashMgr** ptr, int * md, const char * key)
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 +#endif 188 +#endif
189 break; 189 break;
190 } 190 }
191 // piece 3 - is cross product indicator 191 // piece 3 - is cross product indicator
192 Index: src/hunspell/affixmgr.hxx 192 Index: src/hunspell/affixmgr.hxx
193 =================================================================== 193 ===================================================================
194 RCS file: /cvsroot/hunspell/hunspell/src/hunspell/affixmgr.hxx,v 194 RCS file: /cvsroot/hunspell/hunspell/src/hunspell/affixmgr.hxx,v
195 retrieving revision 1.15 195 retrieving revision 1.15
196 diff -u -r1.15 affixmgr.hxx 196 diff -u -r1.15 affixmgr.hxx
197 --- src/hunspell/affixmgr.hxx 13 Oct 2011 13:41:54 -0000 1.15 197 --- src/hunspell/affixmgr.hxx 13 Oct 2011 13:41:54 -0000 1.15
198 +++ src/hunspell/affixmgr.hxx» 20 Dec 2012 23:40:03 -0000 198 +++ src/hunspell/affixmgr.hxx» 21 Dec 2012 02:19:35 -0000
199 @@ -18,6 +18,40 @@ 199 @@ -18,6 +18,40 @@
200 class PfxEntry; 200 class PfxEntry;
201 class SfxEntry; 201 class SfxEntry;
202 202
203 +#ifdef HUNSPELL_CHROME_CLIENT 203 +#ifdef HUNSPELL_CHROME_CLIENT
204 + 204 +
205 +#include <vector> 205 +#include <vector>
206 + 206 +
207 +// This class provides an implementation of the contclasses array in AffixMgr 207 +// This class provides an implementation of the contclasses array in AffixMgr
208 +// that is normally a large static array. We should almost never need more than 208 +// that is normally a large static array. We should almost never need more than
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 }; 273 };
274 274
275 #endif 275 #endif
276 - 276 -
277 Index: src/hunspell/filemgr.cxx 277 Index: src/hunspell/filemgr.cxx
278 =================================================================== 278 ===================================================================
279 RCS file: /cvsroot/hunspell/hunspell/src/hunspell/filemgr.cxx,v 279 RCS file: /cvsroot/hunspell/hunspell/src/hunspell/filemgr.cxx,v
280 retrieving revision 1.5 280 retrieving revision 1.5
281 diff -u -r1.5 filemgr.cxx 281 diff -u -r1.5 filemgr.cxx
282 --- src/hunspell/filemgr.cxx 23 Jun 2011 09:21:50 -0000 1.5 282 --- src/hunspell/filemgr.cxx 23 Jun 2011 09:21:50 -0000 1.5
283 +++ src/hunspell/filemgr.cxx» 20 Dec 2012 23:40:03 -0000 283 +++ src/hunspell/filemgr.cxx» 21 Dec 2012 02:19:35 -0000
284 @@ -7,6 +7,32 @@ 284 @@ -7,6 +7,32 @@
285 285
286 #include "filemgr.hxx" 286 #include "filemgr.hxx"
287 287
288 +#ifdef HUNSPELL_CHROME_CLIENT 288 +#ifdef HUNSPELL_CHROME_CLIENT
289 +#include "third_party/hunspell/google/bdict_reader.h" 289 +#include "third_party/hunspell/google/bdict_reader.h"
290 + 290 +
291 +FileMgr::FileMgr(hunspell::LineIterator* iterator) : iterator_(iterator) { 291 +FileMgr::FileMgr(hunspell::LineIterator* iterator) : iterator_(iterator) {
292 +} 292 +}
293 + 293 +
(...skipping 24 matching lines...) Expand all
318 int FileMgr::getlinenum() { 318 int FileMgr::getlinenum() {
319 return linenum; 319 return linenum;
320 } 320 }
321 +#endif 321 +#endif
322 Index: src/hunspell/filemgr.hxx 322 Index: src/hunspell/filemgr.hxx
323 =================================================================== 323 ===================================================================
324 RCS file: /cvsroot/hunspell/hunspell/src/hunspell/filemgr.hxx,v 324 RCS file: /cvsroot/hunspell/hunspell/src/hunspell/filemgr.hxx,v
325 retrieving revision 1.3 325 retrieving revision 1.3
326 diff -u -r1.3 filemgr.hxx 326 diff -u -r1.3 filemgr.hxx
327 --- src/hunspell/filemgr.hxx 15 Apr 2010 11:22:08 -0000 1.3 327 --- src/hunspell/filemgr.hxx 15 Apr 2010 11:22:08 -0000 1.3
328 +++ src/hunspell/filemgr.hxx» 20 Dec 2012 23:40:03 -0000 328 +++ src/hunspell/filemgr.hxx» 21 Dec 2012 02:19:35 -0000
329 @@ -7,6 +7,30 @@ 329 @@ -7,6 +7,30 @@
330 #include "hunzip.hxx" 330 #include "hunzip.hxx"
331 #include <stdio.h> 331 #include <stdio.h>
332 332
333 +#ifdef HUNSPELL_CHROME_CLIENT 333 +#ifdef HUNSPELL_CHROME_CLIENT
334 +namespace hunspell { 334 +namespace hunspell {
335 +class LineIterator; 335 +class LineIterator;
336 +} // namespace hunspell 336 +} // namespace hunspell
337 + 337 +
338 +// A class which encapsulates operations of reading a BDICT file. 338 +// A class which encapsulates operations of reading a BDICT file.
(...skipping 22 matching lines...) Expand all
361 int getlinenum(); 361 int getlinenum();
362 }; 362 };
363 #endif 363 #endif
364 +#endif 364 +#endif
365 Index: src/hunspell/hashmgr.cxx 365 Index: src/hunspell/hashmgr.cxx
366 =================================================================== 366 ===================================================================
367 RCS file: /cvsroot/hunspell/hunspell/src/hunspell/hashmgr.cxx,v 367 RCS file: /cvsroot/hunspell/hunspell/src/hunspell/hashmgr.cxx,v
368 retrieving revision 1.12 368 retrieving revision 1.12
369 diff -u -r1.12 hashmgr.cxx 369 diff -u -r1.12 hashmgr.cxx
370 --- src/hunspell/hashmgr.cxx 23 Jun 2011 09:21:50 -0000 1.12 370 --- src/hunspell/hashmgr.cxx 23 Jun 2011 09:21:50 -0000 1.12
371 +++ src/hunspell/hashmgr.cxx» 20 Dec 2012 23:40:03 -0000 371 +++ src/hunspell/hashmgr.cxx» 21 Dec 2012 02:19:35 -0000
372 @@ -12,8 +12,14 @@ 372 @@ -12,8 +12,14 @@
373 373
374 // build a hash table from a munched word list 374 // build a hash table from a munched word list
375 375
376 +#ifdef HUNSPELL_CHROME_CLIENT 376 +#ifdef HUNSPELL_CHROME_CLIENT
377 +HashMgr::HashMgr(hunspell::BDictReader* reader) 377 +HashMgr::HashMgr(hunspell::BDictReader* reader)
378 +{ 378 +{
379 + bdict_reader = reader; 379 + bdict_reader = reader;
380 +#else 380 +#else
381 HashMgr::HashMgr(const char * tpath, const char * apath, const char * key) 381 HashMgr::HashMgr(const char * tpath, const char * apath, const char * key)
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 + 731 +
732 int HashMgr::is_aliasf() { 732 int HashMgr::is_aliasf() {
733 return (aliasf != NULL); 733 return (aliasf != NULL);
734 } 734 }
735 Index: src/hunspell/hashmgr.hxx 735 Index: src/hunspell/hashmgr.hxx
736 =================================================================== 736 ===================================================================
737 RCS file: /cvsroot/hunspell/hunspell/src/hunspell/hashmgr.hxx,v 737 RCS file: /cvsroot/hunspell/hunspell/src/hunspell/hashmgr.hxx,v
738 retrieving revision 1.3 738 retrieving revision 1.3
739 diff -u -r1.3 hashmgr.hxx 739 diff -u -r1.3 hashmgr.hxx
740 --- src/hunspell/hashmgr.hxx 15 Apr 2010 11:22:08 -0000 1.3 740 --- src/hunspell/hashmgr.hxx 15 Apr 2010 11:22:08 -0000 1.3
741 +++ src/hunspell/hashmgr.hxx» 20 Dec 2012 23:40:03 -0000 741 +++ src/hunspell/hashmgr.hxx» 21 Dec 2012 02:19:35 -0000
742 @@ -8,10 +8,25 @@ 742 @@ -8,10 +8,25 @@
743 #include "htypes.hxx" 743 #include "htypes.hxx"
744 #include "filemgr.hxx" 744 #include "filemgr.hxx"
745 745
746 +#ifdef HUNSPELL_CHROME_CLIENT 746 +#ifdef HUNSPELL_CHROME_CLIENT
747 +#include <string> 747 +#include <string>
748 +#include <map> 748 +#include <map>
749 + 749 +
750 +#include "base/stl_util.h" 750 +#include "base/stl_util.h"
751 +#include "base/string_piece.h" 751 +#include "base/string_piece.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
829 + 829 +
830 int add_hidden_capitalized_word(char * word, int wbl, int wcl, 830 int add_hidden_capitalized_word(char * word, int wbl, int wcl,
831 unsigned short * flags, int al, char * dp, int captype); 831 unsigned short * flags, int al, char * dp, int captype);
832 int parse_aliasm(char * line, FileMgr * af); 832 int parse_aliasm(char * line, FileMgr * af);
833 Index: src/hunspell/htypes.hxx 833 Index: src/hunspell/htypes.hxx
834 =================================================================== 834 ===================================================================
835 RCS file: /cvsroot/hunspell/hunspell/src/hunspell/htypes.hxx,v 835 RCS file: /cvsroot/hunspell/hunspell/src/hunspell/htypes.hxx,v
836 retrieving revision 1.3 836 retrieving revision 1.3
837 diff -u -r1.3 htypes.hxx 837 diff -u -r1.3 htypes.hxx
838 --- src/hunspell/htypes.hxx 6 Sep 2010 07:58:53 -0000 1.3 838 --- src/hunspell/htypes.hxx 6 Sep 2010 07:58:53 -0000 1.3
839 +++ src/hunspell/htypes.hxx» 20 Dec 2012 23:40:03 -0000 839 +++ src/hunspell/htypes.hxx» 21 Dec 2012 02:19:35 -0000
840 @@ -1,6 +1,16 @@ 840 @@ -1,6 +1,16 @@
841 #ifndef _HTYPES_HXX_ 841 #ifndef _HTYPES_HXX_
842 #define _HTYPES_HXX_ 842 #define _HTYPES_HXX_
843 843
844 +#ifdef HUNSPELL_CHROME_CLIENT 844 +#ifdef HUNSPELL_CHROME_CLIENT
845 +// This is a workaround for preventing errors in parsing Turkish BDICs, which 845 +// This is a workaround for preventing errors in parsing Turkish BDICs, which
846 +// contain very long AF lines (~ 12,000 chars). 846 +// contain very long AF lines (~ 12,000 chars).
847 +// TODO(hbono) change the HashMgr::parse_aliasf() function to be able to parse 847 +// TODO(hbono) change the HashMgr::parse_aliasf() function to be able to parse
848 +// longer lines than MAXDELEN. 848 +// longer lines than MAXDELEN.
849 +#define MAXDELEN (8192 * 2) 849 +#define MAXDELEN (8192 * 2)
850 +#else 850 +#else
851 +#define MAXDELEN 8192 851 +#define MAXDELEN 8192
852 +#endif // HUNSPELL_CHROME_CLIENT 852 +#endif // HUNSPELL_CHROME_CLIENT
853 + 853 +
854 #define ROTATE_LEN 5 854 #define ROTATE_LEN 5
855 855
856 #define ROTATE(v,q) \ 856 #define ROTATE(v,q) \
857 Index: src/hunspell/hunspell.cxx 857 Index: src/hunspell/hunspell.cxx
858 =================================================================== 858 ===================================================================
859 RCS file: /cvsroot/hunspell/hunspell/src/hunspell/hunspell.cxx,v 859 RCS file: /cvsroot/hunspell/hunspell/src/hunspell/hunspell.cxx,v
860 retrieving revision 1.29 860 retrieving revision 1.29
861 diff -u -r1.29 hunspell.cxx 861 diff -u -r1.29 hunspell.cxx
862 --- src/hunspell/hunspell.cxx 23 Jun 2011 09:21:50 -0000 1.29 862 --- src/hunspell/hunspell.cxx 23 Jun 2011 09:21:50 -0000 1.29
863 +++ src/hunspell/hunspell.cxx» 20 Dec 2012 23:40:03 -0000 863 +++ src/hunspell/hunspell.cxx» 21 Dec 2012 02:19:35 -0000
864 @@ -7,20 +7,37 @@ 864 @@ -7,20 +7,37 @@
865 865
866 #include "hunspell.hxx" 866 #include "hunspell.hxx"
867 #include "hunspell.h" 867 #include "hunspell.h"
868 +#ifndef HUNSPELL_CHROME_CLIENT 868 +#ifndef HUNSPELL_CHROME_CLIENT
869 #ifndef MOZILLA_CLIENT 869 #ifndef MOZILLA_CLIENT
870 # include "config.h" 870 # include "config.h"
871 #endif 871 #endif
872 +#endif 872 +#endif
873 #include "csutil.hxx" 873 #include "csutil.hxx"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
937 int Hunspell::add_dic(const char * dpath, const char * key) { 937 int Hunspell::add_dic(const char * dpath, const char * key) {
938 if (maxdic == MAXDIC || !affixpath) return 1; 938 if (maxdic == MAXDIC || !affixpath) return 1;
939 @@ -70,6 +98,7 @@ 939 @@ -70,6 +98,7 @@
940 if (pHMgr[maxdic]) maxdic++; else return 1; 940 if (pHMgr[maxdic]) maxdic++; else return 1;
941 return 0; 941 return 0;
942 } 942 }
943 +#endif 943 +#endif
944 944
945 // make a copy of src at destination while removing all leading 945 // make a copy of src at destination while removing all leading
946 // blanks and removing any trailing periods after recording 946 // blanks and removing any trailing periods after recording
947 @@ -322,6 +351,9 @@ 947 @@ -108,7 +137,9 @@
948 if (utf8) {
949 *nc = u8_u16(dest_utf, MAXWORDLEN, dest);
950 // don't check too long words
951 - if (*nc >= MAXWORDLEN) return 0;
952 + // TODO(rouslan): Remove the interim change below when this patch lands:
953 + // http://sf.net/tracker/?func=detail&aid=3595024&group_id=143754&atid=75 6395.
954 + if (*nc >= MAXWORDLEN - 1) return 0;
955 if (*nc == -1) { // big Unicode character (non BMP area)
956 *pcaptype = NOCAP;
957 return nl;
958 @@ -322,6 +353,9 @@
948 959
949 int Hunspell::spell(const char * word, int * info, char ** root) 960 int Hunspell::spell(const char * word, int * info, char ** root)
950 { 961 {
951 +#ifdef HUNSPELL_CHROME_CLIENT 962 +#ifdef HUNSPELL_CHROME_CLIENT
952 + if (pHMgr) pHMgr[0]->EmptyHentryCache(); 963 + if (pHMgr) pHMgr[0]->EmptyHentryCache();
953 +#endif 964 +#endif
954 struct hentry * rv=NULL; 965 struct hentry * rv=NULL;
955 // need larger vector. For example, Turkish capital letter I converted a 966 // need larger vector. For example, Turkish capital letter I converted a
956 // 2-byte UTF-8 character (dotless i) by mkallsmall. 967 // 2-byte UTF-8 character (dotless i) by mkallsmall.
957 @@ -586,6 +618,13 @@ 968 @@ -586,6 +620,13 @@
958 if (!len) 969 if (!len)
959 return NULL; 970 return NULL;
960 971
961 +#ifdef HUNSPELL_CHROME_CLIENT 972 +#ifdef HUNSPELL_CHROME_CLIENT
962 + // We need to check if the word length is valid to make coverity (Event 973 + // We need to check if the word length is valid to make coverity (Event
963 + // fixed_size_dest: Possible overrun of N byte fixed size buffer) happy. 974 + // fixed_size_dest: Possible overrun of N byte fixed size buffer) happy.
964 + if ((utf8 && strlen(word) >= MAXWORDUTF8LEN) || (!utf8 && strlen(word) >= MAX WORDLEN)) 975 + if ((utf8 && strlen(word) >= MAXWORDUTF8LEN) || (!utf8 && strlen(word) >= MAX WORDLEN))
965 + return NULL; 976 + return NULL;
966 +#endif 977 +#endif
967 + 978 +
968 // word reversing wrapper for complex prefixes 979 // word reversing wrapper for complex prefixes
969 if (complexprefixes) { 980 if (complexprefixes) {
970 if (word != w2) { 981 if (word != w2) {
971 @@ -675,6 +714,9 @@ 982 @@ -675,6 +716,9 @@
972 983
973 int Hunspell::suggest(char*** slst, const char * word) 984 int Hunspell::suggest(char*** slst, const char * word)
974 { 985 {
975 +#ifdef HUNSPELL_CHROME_CLIENT 986 +#ifdef HUNSPELL_CHROME_CLIENT
976 + if (pHMgr) pHMgr[0]->EmptyHentryCache(); 987 + if (pHMgr) pHMgr[0]->EmptyHentryCache();
977 +#endif 988 +#endif
978 int onlycmpdsug = 0; 989 int onlycmpdsug = 0;
979 char cw[MAXWORDUTF8LEN]; 990 char cw[MAXWORDUTF8LEN];
980 char wspace[MAXWORDUTF8LEN]; 991 char wspace[MAXWORDUTF8LEN];
981 @@ -1921,13 +1963,21 @@ 992 @@ -1921,13 +1965,21 @@
982 993
983 Hunhandle *Hunspell_create(const char * affpath, const char * dpath) 994 Hunhandle *Hunspell_create(const char * affpath, const char * dpath)
984 { 995 {
985 +#ifdef HUNSPELL_CHROME_CLIENT 996 +#ifdef HUNSPELL_CHROME_CLIENT
986 + return NULL; 997 + return NULL;
987 +#else 998 +#else
988 return (Hunhandle*)(new Hunspell(affpath, dpath)); 999 return (Hunhandle*)(new Hunspell(affpath, dpath));
989 +#endif 1000 +#endif
990 } 1001 }
991 1002
992 Hunhandle *Hunspell_create_key(const char * affpath, const char * dpath, 1003 Hunhandle *Hunspell_create_key(const char * affpath, const char * dpath,
993 const char * key) 1004 const char * key)
994 { 1005 {
995 +#ifdef HUNSPELL_CHROME_CLIENT 1006 +#ifdef HUNSPELL_CHROME_CLIENT
996 + return NULL; 1007 + return NULL;
997 +#else 1008 +#else
998 return (Hunhandle*)(new Hunspell(affpath, dpath, key)); 1009 return (Hunhandle*)(new Hunspell(affpath, dpath, key));
999 +#endif 1010 +#endif
1000 } 1011 }
1001 1012
1002 void Hunspell_destroy(Hunhandle *pHunspell) 1013 void Hunspell_destroy(Hunhandle *pHunspell)
1003 Index: src/hunspell/hunspell.hxx 1014 Index: src/hunspell/hunspell.hxx
1004 =================================================================== 1015 ===================================================================
1005 RCS file: /cvsroot/hunspell/hunspell/src/hunspell/hunspell.hxx,v 1016 RCS file: /cvsroot/hunspell/hunspell/src/hunspell/hunspell.hxx,v
1006 retrieving revision 1.6 1017 retrieving revision 1.6
1007 diff -u -r1.6 hunspell.hxx 1018 diff -u -r1.6 hunspell.hxx
1008 --- src/hunspell/hunspell.hxx 21 Jan 2011 17:30:41 -0000 1.6 1019 --- src/hunspell/hunspell.hxx 21 Jan 2011 17:30:41 -0000 1.6
1009 +++ src/hunspell/hunspell.hxx» 20 Dec 2012 23:40:03 -0000 1020 +++ src/hunspell/hunspell.hxx» 21 Dec 2012 02:19:35 -0000
1010 @@ -5,6 +5,10 @@ 1021 @@ -5,6 +5,10 @@
1011 #include "suggestmgr.hxx" 1022 #include "suggestmgr.hxx"
1012 #include "langnum.hxx" 1023 #include "langnum.hxx"
1013 1024
1014 +#ifdef HUNSPELL_CHROME_CLIENT 1025 +#ifdef HUNSPELL_CHROME_CLIENT
1015 +#include "third_party/hunspell/google/bdict_reader.h" 1026 +#include "third_party/hunspell/google/bdict_reader.h"
1016 +#endif 1027 +#endif
1017 + 1028 +
1018 #define SPELL_XML "<?xml?>" 1029 #define SPELL_XML "<?xml?>"
1019 1030
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1056 +#endif 1067 +#endif
1057 1068
1058 /* spell(word) - spellcheck word 1069 /* spell(word) - spellcheck word
1059 * output: 0 = bad word, not 0 = good word 1070 * output: 0 = bad word, not 0 = good word
1060 Index: src/hunspell/replist.hxx 1071 Index: src/hunspell/replist.hxx
1061 =================================================================== 1072 ===================================================================
1062 RCS file: /cvsroot/hunspell/hunspell/src/hunspell/replist.hxx,v 1073 RCS file: /cvsroot/hunspell/hunspell/src/hunspell/replist.hxx,v
1063 retrieving revision 1.2 1074 retrieving revision 1.2
1064 diff -u -r1.2 replist.hxx 1075 diff -u -r1.2 replist.hxx
1065 --- src/hunspell/replist.hxx 15 Apr 2010 11:22:09 -0000 1.2 1076 --- src/hunspell/replist.hxx 15 Apr 2010 11:22:09 -0000 1.2
1066 +++ src/hunspell/replist.hxx» 20 Dec 2012 23:40:03 -0000 1077 +++ src/hunspell/replist.hxx» 21 Dec 2012 02:19:35 -0000
1067 @@ -2,6 +2,12 @@ 1078 @@ -2,6 +2,12 @@
1068 #ifndef _REPLIST_HXX_ 1079 #ifndef _REPLIST_HXX_
1069 #define _REPLIST_HXX_ 1080 #define _REPLIST_HXX_
1070 1081
1071 +#ifdef HUNSPELL_CHROME_CLIENT 1082 +#ifdef HUNSPELL_CHROME_CLIENT
1072 +// Compilation issues in spellchecker.cc think near is a macro, therefore 1083 +// Compilation issues in spellchecker.cc think near is a macro, therefore
1073 +// removing it here solves that problem. 1084 +// removing it here solves that problem.
1074 +#undef near 1085 +#undef near
1075 +#endif 1086 +#endif
1076 + 1087 +
1077 #include "hunvisapi.h" 1088 #include "hunvisapi.h"
1078 1089
1079 #include "w_char.hxx" 1090 #include "w_char.hxx"
1080 Index: src/hunspell/suggestmgr.cxx 1091 Index: src/hunspell/suggestmgr.cxx
1081 =================================================================== 1092 ===================================================================
1082 RCS file: /cvsroot/hunspell/hunspell/src/hunspell/suggestmgr.cxx,v 1093 RCS file: /cvsroot/hunspell/hunspell/src/hunspell/suggestmgr.cxx,v
1083 retrieving revision 1.24 1094 retrieving revision 1.24
1084 diff -u -r1.24 suggestmgr.cxx 1095 diff -u -r1.24 suggestmgr.cxx
1085 --- src/hunspell/suggestmgr.cxx 14 Feb 2011 21:47:24 -0000 1.24 1096 --- src/hunspell/suggestmgr.cxx 14 Feb 2011 21:47:24 -0000 1.24
1086 +++ src/hunspell/suggestmgr.cxx»20 Dec 2012 23:40:03 -0000 1097 +++ src/hunspell/suggestmgr.cxx»21 Dec 2012 02:19:35 -0000
1087 @@ -12,9 +12,110 @@ 1098 @@ -12,9 +12,110 @@
1088 1099
1089 const w_char W_VLINE = { '\0', '|' }; 1100 const w_char W_VLINE = { '\0', '|' };
1090 1101
1091 +#ifdef HUNSPELL_CHROME_CLIENT 1102 +#ifdef HUNSPELL_CHROME_CLIENT
1092 +namespace { 1103 +namespace {
1093 +// A simple class which creates temporary hentry objects which are available 1104 +// A simple class which creates temporary hentry objects which are available
1094 +// only in a scope. To conceal memory operations from SuggestMgr functions, 1105 +// only in a scope. To conceal memory operations from SuggestMgr functions,
1095 +// this object automatically deletes all hentry objects created through 1106 +// this object automatically deletes all hentry objects created through
1096 +// CreateScopedHashEntry() calls in its destructor. So, the following snippet 1107 +// CreateScopedHashEntry() calls in its destructor. So, the following snippet
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
1274 +#endif 1285 +#endif
1275 lval = sc; 1286 lval = sc;
1276 for (j=0; j < MAX_ROOTS; j++) 1287 for (j=0; j < MAX_ROOTS; j++)
1277 if (scores[j] < lval) { 1288 if (scores[j] < lval) {
1278 Index: src/hunspell/suggestmgr.hxx 1289 Index: src/hunspell/suggestmgr.hxx
1279 =================================================================== 1290 ===================================================================
1280 RCS file: /cvsroot/hunspell/hunspell/src/hunspell/suggestmgr.hxx,v 1291 RCS file: /cvsroot/hunspell/hunspell/src/hunspell/suggestmgr.hxx,v
1281 retrieving revision 1.5 1292 retrieving revision 1.5
1282 diff -u -r1.5 suggestmgr.hxx 1293 diff -u -r1.5 suggestmgr.hxx
1283 --- src/hunspell/suggestmgr.hxx 21 Jan 2011 22:10:24 -0000 1.5 1294 --- src/hunspell/suggestmgr.hxx 21 Jan 2011 22:10:24 -0000 1.5
1284 +++ src/hunspell/suggestmgr.hxx»20 Dec 2012 23:40:03 -0000 1295 +++ src/hunspell/suggestmgr.hxx»21 Dec 2012 02:19:35 -0000
1285 @@ -52,7 +52,11 @@ 1296 @@ -52,7 +52,11 @@
1286 1297
1287 1298
1288 public: 1299 public:
1289 +#ifdef HUNSPELL_CHROME_CLIENT 1300 +#ifdef HUNSPELL_CHROME_CLIENT
1290 + SuggestMgr(hunspell::BDictReader* reader, const char * tryme, int maxn, Affix Mgr *aptr); 1301 + SuggestMgr(hunspell::BDictReader* reader, const char * tryme, int maxn, Affix Mgr *aptr);
1291 +#else 1302 +#else
1292 SuggestMgr(const char * tryme, int maxn, AffixMgr *aptr); 1303 SuggestMgr(const char * tryme, int maxn, AffixMgr *aptr);
1293 +#endif 1304 +#endif
1294 ~SuggestMgr(); 1305 ~SuggestMgr();
1295 1306
1296 int suggest(char*** slst, const char * word, int nsug, int * onlycmpdsug); 1307 int suggest(char*** slst, const char * word, int nsug, int * onlycmpdsug);
1297 @@ -66,6 +70,10 @@ 1308 @@ -66,6 +70,10 @@
1298 char * suggest_morph_for_spelling_error(const char * word); 1309 char * suggest_morph_for_spelling_error(const char * word);
1299 1310
1300 private: 1311 private:
1301 +#ifdef HUNSPELL_CHROME_CLIENT 1312 +#ifdef HUNSPELL_CHROME_CLIENT
1302 + // Not owned by us, owned by the Hunspell object. 1313 + // Not owned by us, owned by the Hunspell object.
1303 + hunspell::BDictReader* bdict_reader; 1314 + hunspell::BDictReader* bdict_reader;
1304 +#endif 1315 +#endif
1305 int testsug(char** wlst, const char * candidate, int wl, int ns, int cpdsugg est, 1316 int testsug(char** wlst, const char * candidate, int wl, int ns, int cpdsugg est,
1306 int * timer, clock_t * timelimit); 1317 int * timer, clock_t * timelimit);
1307 int checkword(const char *, int, int, int *, clock_t *); 1318 int checkword(const char *, int, int, int *, clock_t *);
OLDNEW
« no previous file with comments | « README.chromium ('k') | src/hunspell/hunspell.cxx » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698