| OLD | NEW |
| 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 2090 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2101 char * c; | 2101 char * c; |
| 2102 int i; | 2102 int i; |
| 2103 int j; | 2103 int j; |
| 2104 if (utf8) { | 2104 if (utf8) { |
| 2105 m = u8_u16(su, MAXSWL, s); | 2105 m = u8_u16(su, MAXSWL, s); |
| 2106 n = u8_u16(su2, MAXSWL, s2); | 2106 n = u8_u16(su2, MAXSWL, s2); |
| 2107 } else { | 2107 } else { |
| 2108 m = strlen(s); | 2108 m = strlen(s); |
| 2109 n = strlen(s2); | 2109 n = strlen(s2); |
| 2110 } | 2110 } |
| 2111 c = (char *) malloc((m + 1) * (n + 1)); | 2111 c = (char *) calloc(m + 1, n + 1); |
| 2112 b = (char *) malloc((m + 1) * (n + 1)); | 2112 b = (char *) calloc(m + 1, n + 1); |
| 2113 if (!c || !b) { | 2113 if (!c || !b) { |
| 2114 if (c) free(c); | 2114 if (c) free(c); |
| 2115 if (b) free(b); | 2115 if (b) free(b); |
| 2116 *result = NULL; | 2116 *result = NULL; |
| 2117 return; | 2117 return; |
| 2118 } | 2118 } |
| 2119 for (i = 1; i <= m; i++) c[i*(n+1)] = 0; | |
| 2120 for (j = 0; j <= n; j++) c[j] = 0; | |
| 2121 for (i = 1; i <= m; i++) { | 2119 for (i = 1; i <= m; i++) { |
| 2122 for (j = 1; j <= n; j++) { | 2120 for (j = 1; j <= n; j++) { |
| 2123 if ( ((utf8) && (*((short *) su+i-1) == *((short *)su2+j-1))) | 2121 if ( ((utf8) && (*((short *) su+i-1) == *((short *)su2+j-1))) |
| 2124 || ((!utf8) && ((*(s+i-1)) == (*(s2+j-1))))) { | 2122 || ((!utf8) && ((*(s+i-1)) == (*(s2+j-1))))) { |
| 2125 c[i*(n+1) + j] = c[(i-1)*(n+1) + j-1]+1; | 2123 c[i*(n+1) + j] = c[(i-1)*(n+1) + j-1]+1; |
| 2126 b[i*(n+1) + j] = LCS_UPLEFT; | 2124 b[i*(n+1) + j] = LCS_UPLEFT; |
| 2127 } else if (c[(i-1)*(n+1) + j] >= c[i*(n+1) + j-1]) { | 2125 } else if (c[(i-1)*(n+1) + j] >= c[i*(n+1) + j-1]) { |
| 2128 c[i*(n+1) + j] = c[(i-1)*(n+1) + j]; | 2126 c[i*(n+1) + j] = c[(i-1)*(n+1) + j]; |
| 2129 b[i*(n+1) + j] = LCS_UP; | 2127 b[i*(n+1) + j] = LCS_UP; |
| 2130 } else { | 2128 } else { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 2155 len++; | 2153 len++; |
| 2156 i--; | 2154 i--; |
| 2157 j--; | 2155 j--; |
| 2158 } else if (result[i*(n+1) + j] == LCS_UP) { | 2156 } else if (result[i*(n+1) + j] == LCS_UP) { |
| 2159 i--; | 2157 i--; |
| 2160 } else j--; | 2158 } else j--; |
| 2161 } | 2159 } |
| 2162 free(result); | 2160 free(result); |
| 2163 return len; | 2161 return len; |
| 2164 } | 2162 } |
| OLD | NEW |