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

Side by Side Diff: src/hunspell/suggestmgr.cxx

Issue 11778031: [hunspell] Spellcheck 99-character words. (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/hunspell.git@master
Patch Set: Created 7 years, 11 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 unified diff | Download patch
« no previous file with comments | « src/hunspell/hunspell.cxx ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #include "license.hunspell" 1 #include "license.hunspell"
2 #include "license.myspell" 2 #include "license.myspell"
3 3
4 #include <stdlib.h> 4 #include <stdlib.h>
5 #include <string.h> 5 #include <string.h>
6 #include <stdio.h> 6 #include <stdio.h>
7 #include <ctype.h> 7 #include <ctype.h>
8 8
9 #include "suggestmgr.hxx" 9 #include "suggestmgr.hxx"
10 #include "htypes.hxx" 10 #include "htypes.hxx"
(...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after
816 ns = testsug(wlst, candidate, wl-1, ns, cpdsuggest, NULL, NULL); 816 ns = testsug(wlst, candidate, wl-1, ns, cpdsuggest, NULL, NULL);
817 if (ns == -1) return -1; 817 if (ns == -1) return -1;
818 tmpc = tmpc2; 818 tmpc = tmpc2;
819 } 819 }
820 return ns; 820 return ns;
821 } 821 }
822 822
823 // error is missing a letter it needs 823 // error is missing a letter it needs
824 int SuggestMgr::forgotchar(char ** wlst, const char * word, int ns, int cpdsugge st) 824 int SuggestMgr::forgotchar(char ** wlst, const char * word, int ns, int cpdsugge st)
825 { 825 {
826 char candidate[MAXSWUTF8L]; 826 // TODO(rouslan): Remove the interim change below when this patch lands:
827 // http://sf.net/tracker/?func=detail&aid=3595024&group_id=143754&atid=756395
828 char candidate[MAXSWUTF8L + 4];
827 char * p; 829 char * p;
828 clock_t timelimit = clock(); 830 clock_t timelimit = clock();
829 int timer = MINTIMER; 831 int timer = MINTIMER;
830 int wl = strlen(word); 832 int wl = strlen(word);
831 // try inserting a tryme character before every letter (and the null terminat or) 833 // try inserting a tryme character before every letter (and the null terminat or)
832 for (int i = 0; i < ctryl; i++) { 834 for (int i = 0; i < ctryl; i++) {
833 strcpy(candidate, word); 835 strcpy(candidate, word);
834 for (p = candidate + wl; p >= candidate; p--) { 836 for (p = candidate + wl; p >= candidate; p--) {
835 *(p+1) = *p; 837 *(p+1) = *p;
836 *p = ctry[i]; 838 *p = ctry[i];
837 ns = testsug(wlst, candidate, wl+1, ns, cpdsuggest, &timer, &timelimit) ; 839 ns = testsug(wlst, candidate, wl+1, ns, cpdsuggest, &timer, &timelimit) ;
838 if (ns == -1) return -1; 840 if (ns == -1) return -1;
839 if (!timer) return ns; 841 if (!timer) return ns;
840 } 842 }
841 } 843 }
842 return ns; 844 return ns;
843 } 845 }
844 846
845 // error is missing a letter it needs 847 // error is missing a letter it needs
846 int SuggestMgr::forgotchar_utf(char ** wlst, const w_char * word, int wl, int ns , int cpdsuggest) 848 int SuggestMgr::forgotchar_utf(char ** wlst, const w_char * word, int wl, int ns , int cpdsuggest)
847 { 849 {
848 w_char candidate_utf[MAXSWL]; 850 // TODO(rouslan): Remove the interim change below when this patch lands:
849 char candidate[MAXSWUTF8L]; 851 // http://sf.net/tracker/?func=detail&aid=3595024&group_id=143754&atid=756395
852 w_char candidate_utf[MAXSWL + 1];
853 char candidate[MAXSWUTF8L + 4];
850 w_char * p; 854 w_char * p;
851 clock_t timelimit = clock(); 855 clock_t timelimit = clock();
852 int timer = MINTIMER; 856 int timer = MINTIMER;
853 // try inserting a tryme character at the end of the word and before every le tter 857 // try inserting a tryme character at the end of the word and before every le tter
854 for (int i = 0; i < ctryl; i++) { 858 for (int i = 0; i < ctryl; i++) {
855 memcpy (candidate_utf, word, wl * sizeof(w_char)); 859 memcpy (candidate_utf, word, wl * sizeof(w_char));
856 for (p = candidate_utf + wl; p >= candidate_utf; p--) { 860 for (p = candidate_utf + wl; p >= candidate_utf; p--) {
857 *(p + 1) = *p; 861 *(p + 1) = *p;
858 *p = ctry_utf[i]; 862 *p = ctry_utf[i];
859 u16_u8(candidate, MAXSWUTF8L, candidate_utf, wl + 1); 863 u16_u8(candidate, MAXSWUTF8L, candidate_utf, wl + 1);
(...skipping 1287 matching lines...) Expand 10 before | Expand all | Expand 10 after
2147 len++; 2151 len++;
2148 i--; 2152 i--;
2149 j--; 2153 j--;
2150 } else if (result[i*(n+1) + j] == LCS_UP) { 2154 } else if (result[i*(n+1) + j] == LCS_UP) {
2151 i--; 2155 i--;
2152 } else j--; 2156 } else j--;
2153 } 2157 }
2154 free(result); 2158 free(result);
2155 return len; 2159 return len;
2156 } 2160 }
OLDNEW
« no previous file with comments | « src/hunspell/hunspell.cxx ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698