sync master with lastest vba changes
[ooovba.git] / hunspell / hunspell-1.2.8.patch
blob9b14f9b86fe3885e3636301bfc4376e45ef698f0
1 --- misc/hunspell-1.2.8/intl/localename.c 2007-04-06 10:05:34.000000000 +0200
2 +++ misc/build/hunspell-1.2.8/intl/localename.c 2008-11-01 16:30:49.000000000 +0100
3 @@ -140,6 +140,9 @@
4 # ifndef LANG_SINDHI
5 # define LANG_SINDHI 0x59
6 # endif
7 +# ifndef LANG_SORBIAN
8 +# define LANG_SORBIAN 0x2e
9 +# endif
10 # ifndef LANG_SLOVAK
11 # define LANG_SLOVAK 0x1b
12 # endif
13 --- misc/hunspell-1.2.8/src/hunspell/affixmgr.cxx 2008-11-01 08:00:41.000000000 +0100
14 +++ misc/build/hunspell-1.2.8/src/hunspell/affixmgr.cxx 2008-11-01 16:30:49.000000000 +0100
15 @@ -25,6 +25,10 @@
16 #endif
17 #endif
19 +#ifdef OS2
20 +#undef DEBUG
21 +#endif
23 AffixMgr::AffixMgr(const char * affpath, HashMgr** ptr, int * md, const char * key)
25 // register hash manager and load affix data from aff file
26 @@ -2133,7 +2137,7 @@
27 while ((rv) && ((needaffix && TESTAFF(rv->astr, needaffix, rv->alen)) ||
28 !((compoundflag && !words && TESTAFF(rv->astr, compoundflag, rv->alen)) ||
29 (compoundend && !words && TESTAFF(rv->astr, compoundend, rv->alen)) ||
30 - (numdefcpd && defcpd_check(&words, wnum + 1, rv, NULL,1))))) {
31 + (numdefcpd && words && defcpd_check(&words, wnum + 1, rv, NULL,1))))) {
32 rv = rv->next_homonym;
35 --- misc/hunspell-1.2.8/src/hunspell/affixmgr.hxx 2008-10-30 21:28:59.000000000 +0100
36 +++ misc/build/hunspell-1.2.8/src/hunspell/affixmgr.hxx 2008-11-01 16:30:49.000000000 +0100
37 @@ -2,9 +2,6 @@
38 #define _AFFIXMGR_HXX_
40 #ifdef MOZILLA_CLIENT
41 -#ifdef __SUNPRO_CC // for SunONE Studio compiler
42 -using namespace std;
43 -#endif
44 #include <stdio.h>
45 #else
46 #include <cstdio>
47 --- misc/hunspell-1.2.8/src/hunspell/atypes.hxx 2008-10-29 15:30:51.000000000 +0100
48 +++ misc/build/hunspell-1.2.8/src/hunspell/atypes.hxx 2008-11-01 16:30:49.000000000 +0100
49 @@ -1,6 +1,8 @@
50 #ifndef _ATYPES_HXX_
51 #define _ATYPES_HXX_
53 +#include <stdio.h>
55 #ifndef HUNSPELL_WARNING
56 #ifdef HUNSPELL_WARNING_ON
57 #define HUNSPELL_WARNING fprintf
58 --- misc/hunspell-1.2.8/src/hunspell/csutil.cxx Wed Oct 22 12:15:28 2008
59 +++ misc/build/hunspell-1.2.8/src/hunspell/csutil.cxx Thu Feb 19 18:13:34 2009
60 @@ -18,13 +18,13 @@
61 #include "langnum.hxx"
63 #ifdef OPENOFFICEORG
64 -# include <unicode/uchar.h>
65 +#include <unicode/uchar.h>
66 #else
67 -# ifndef MOZILLA_CLIENT
68 -# include "utf_info.cxx"
69 -# define UTF_LST_LEN (sizeof(utf_lst) / (sizeof(unicode_info)))
70 -# endif
71 +#ifndef MOZILLA_CLIENT
72 +#include "utf_info.cxx"
73 +#define UTF_LST_LEN (sizeof(utf_lst) / (sizeof(unicode_info)))
74 #endif
75 +#endif
77 #ifdef MOZILLA_CLIENT
78 #include "nsCOMPtr.h"
79 --- misc/hunspell-1.2.8/src/hunspell/filemgr.cxx Sat Nov 1 15:09:41 2008
80 +++ misc/build/hunspell-1.2.8/src/hunspell/filemgr.cxx Thu Feb 19 17:28:35 2009
81 @@ -11,6 +11,7 @@
82 #include <stdio.h>
83 #endif
85 +using namespace std;
86 #include "filemgr.hxx"
88 int FileMgr::fail(const char * err, const char * par) {
89 --- misc/hunspell-1.2.8/src/hunspell/filemgr.hxx Mon Aug 11 11:32:02 2008
90 +++ misc/build/hunspell-1.2.8/src/hunspell/filemgr.hxx Thu Feb 19 13:58:01 2009
91 @@ -6,7 +6,7 @@
92 class FileMgr
94 protected:
95 - FILE * fin;
96 + std::FILE * fin;
97 Hunzip * hin;
98 char in[BUFSIZE + 50]; // input buffer
99 int fail(const char * err, const char * par);
100 --- misc/hunspell-1.2.8/src/hunspell/hashmgr.cxx Thu Aug 14 16:49:33 2008
101 +++ misc/build/hunspell-1.2.8/src/hunspell/hashmgr.cxx Thu Feb 19 17:25:33 2009
102 @@ -6,6 +6,9 @@
103 #include <cstring>
104 #include <cstdio>
105 #include <cctype>
106 +//#ifdef __SUNPRO_CC // for SunONE Studio compiler
107 +//using namespace std;
108 +//#endif
109 #else
110 #include <stdlib.h>
111 #include <string.h>
112 @@ -13,10 +16,6 @@
113 #include <ctype.h>
114 #endif
116 -#include "hashmgr.hxx"
117 -#include "csutil.hxx"
118 -#include "atypes.hxx"
120 #ifdef MOZILLA_CLIENT
121 #ifdef __SUNPRO_CC // for SunONE Studio compiler
122 using namespace std;
123 @@ -27,6 +26,10 @@
124 #endif
125 #endif
127 +#include "hashmgr.hxx"
128 +#include "csutil.hxx"
129 +#include "atypes.hxx"
131 // build a hash table from a munched word list
133 HashMgr::HashMgr(const char * tpath, const char * apath, const char * key)
134 @@ -459,6 +462,10 @@
136 } else {
137 al = decode_flags(&flags, ap + 1, dict);
138 + if (al == -1) {
139 + HUNSPELL_WARNING(stderr, "Can't allocate memory.\n");
140 + return 6;
142 flag_qsort(flags, 0, al);
144 } else {
145 @@ -499,6 +506,11 @@
147 int HashMgr::decode_flags(unsigned short ** result, char * flags, FileMgr * af) {
148 int len;
149 + if (*flags == '\0') {
150 + HUNSPELL_WARNING(stderr, "error: line %d: bad flagvector\n", af->getlinenum());
151 + *result = NULL;
152 + return 0;
154 switch (flag_mode) {
155 case FLAG_LONG: { // two-character flags (1x2yZz -> 1x 2y Zz)
156 len = strlen(flags);
157 --- misc/hunspell-1.2.8/src/hunspell/hashmgr.hxx 2008-08-12 12:22:54.000000000 +0200
158 +++ misc/build/hunspell-1.2.8/src/hunspell/hashmgr.hxx 2009-02-19 12:57:11.780108100 +0100
159 @@ -3,6 +3,7 @@
161 #ifndef MOZILLA_CLIENT
162 #include <cstdio>
163 +/* using namespace std; */
164 #else
165 #include <stdio.h>
166 #endif
167 --- misc/hunspell-1.2.8/src/hunspell/hunspell.cxx Thu Oct 30 20:15:53 2008
168 +++ misc/build/hunspell-1.2.8/src/hunspell/hunspell.cxx Thu Feb 19 18:13:35 2009
169 @@ -1,3 +1,7 @@
170 +#ifdef _MSC_VER
171 +#pragma setlocale("C")
172 +#endif
174 #include "license.hunspell"
175 #include "license.myspell"
177 @@ -11,11 +15,6 @@
178 #include <stdio.h>
179 #endif
181 -#include "hunspell.hxx"
182 -#include "hunspell.h"
183 -#include "config.h"
184 -#include "csutil.hxx"
186 #ifndef MOZILLA_CLIENT
187 #ifndef WIN32
188 using namespace std;
189 @@ -22,6 +21,9 @@
190 #endif
191 #endif
193 +#include "hunspell.hxx"
194 +#include "csutil.hxx"
196 Hunspell::Hunspell(const char * affpath, const char * dpath, const char * key)
198 encoding = NULL;
199 @@ -338,7 +340,11 @@
200 char wspace[MAXWORDUTF8LEN];
201 w_char unicw[MAXWORDLEN];
202 // Hunspell supports XML input of the simplified API (see manual)
203 - if (strcmp(word, SPELL_XML) == 0) return 1;
204 + if (strncmp(word, SPELL_XML, sizeof(SPELL_XML) - 3) == 0) {
205 + if (strcmp(word, SPELL_XML) == 0) return 1; // query XML interface support
206 + return 0;
209 int nc = strlen(word);
210 int wl2 = 0;
211 if (utf8) {
212 @@ -1854,89 +1860,3 @@
215 #endif // END OF HUNSPELL_EXPERIMENTAL CODE
217 -Hunhandle *Hunspell_create(const char * affpath, const char * dpath)
219 - return (Hunhandle*)(new Hunspell(affpath, dpath));
222 -Hunhandle *Hunspell_create_key(const char * affpath, const char * dpath,
223 - const char * key)
225 - return (Hunhandle*)(new Hunspell(affpath, dpath, key));
228 -void Hunspell_destroy(Hunhandle *pHunspell)
230 - delete (Hunspell*)(pHunspell);
233 -int Hunspell_spell(Hunhandle *pHunspell, const char *word)
235 - return ((Hunspell*)pHunspell)->spell(word);
238 -char *Hunspell_get_dic_encoding(Hunhandle *pHunspell)
240 - return ((Hunspell*)pHunspell)->get_dic_encoding();
243 -int Hunspell_suggest(Hunhandle *pHunspell, char*** slst, const char * word)
245 - return ((Hunspell*)pHunspell)->suggest(slst, word);
248 -int Hunspell_analyze(Hunhandle *pHunspell, char*** slst, const char * word)
250 - return ((Hunspell*)pHunspell)->analyze(slst, word);
253 -int Hunspell_stem(Hunhandle *pHunspell, char*** slst, const char * word)
255 - return ((Hunspell*)pHunspell)->stem(slst, word);
258 -int Hunspell_stem(Hunhandle *pHunspell, char*** slst, char** desc, int n)
260 - return ((Hunspell*)pHunspell)->stem(slst, desc, n);
263 -int Hunspell_generate(Hunhandle *pHunspell, char*** slst, const char * word,
264 - const char * word2)
266 - return ((Hunspell*)pHunspell)->generate(slst, word, word2);
269 -int Hunspell_generate(Hunhandle *pHunspell, char*** slst, const char * word,
270 - char** desc, int n)
272 - return ((Hunspell*)pHunspell)->generate(slst, word, desc, n);
275 - /* functions for run-time modification of the dictionary */
277 - /* add word to the run-time dictionary */
279 -int Hunspell_add(Hunhandle *pHunspell, const char * word) {
280 - return ((Hunspell*)pHunspell)->add(word);
283 - /* add word to the run-time dictionary with affix flags of
284 - * the example (a dictionary word): Hunspell will recognize
285 - * affixed forms of the new word, too.
286 - */
288 -int Hunspell_add_with_affix(Hunhandle *pHunspell, const char * word,
289 - const char * example) {
290 - return ((Hunspell*)pHunspell)->add_with_affix(word, example);
293 - /* remove word from the run-time dictionary */
295 -int Hunspell_remove(Hunhandle *pHunspell, const char * word) {
296 - return ((Hunspell*)pHunspell)->remove(word);
299 -void Hunspell_free_list(Hunhandle *pHunspell, char *** slst, int n) {
300 - freelist(slst, n);
302 --- misc/hunspell-1.2.8/src/hunspell/hunspell.hxx 2008-07-09 16:14:39.000000000 +0200
303 +++ misc/build/hunspell-1.2.8/src/hunspell/hunspell.hxx 2008-11-26 18:32:58.765625000 +0100
304 @@ -28,11 +28,7 @@
305 #endif
306 #endif
308 -#ifdef WIN32
309 -class DLLEXPORT Hunspell
310 -#else
311 class Hunspell
312 -#endif
314 AffixMgr* pAMgr;
315 HashMgr* pHMgr[MAXDIC];
316 --- misc/hunspell-1.2.8/src/hunspell/hunzip.cxx Tue Jun 17 10:57:55 2008
317 +++ misc/build/hunspell-1.2.8/src/hunspell/hunzip.cxx Thu Feb 19 17:29:19 2009
318 @@ -8,6 +8,7 @@
319 #include <stdio.h>
320 #endif
322 +using namespace std;
323 #include "hunzip.hxx"
325 #define CODELEN 65536
326 --- misc/hunspell-1.2.8/src/hunspell/hunzip.hxx Thu Feb 19 15:59:42 2009
327 +++ misc/build/hunspell-1.2.8/src/hunspell/hunzip.hxx Thu Feb 19 18:13:35 2009
328 @@ -18,6 +18,8 @@
329 #define MSG_MEMORY "error: %s: missing memory\n"
330 #define MSG_KEY "error: %s: missing or bad password\n"
332 +#include <stdlib.h>
334 struct bit {
335 unsigned char c[2];
336 int v[2];
337 --- misc/hunspell-1.2.8/src/hunspell/license.hunspell 2008-06-17 10:57:55.000000000 +0200
338 +++ misc/build/hunspell-1.2.8/src/hunspell/license.hunspell 2008-11-01 16:30:49.000000000 +0100
339 @@ -56,4 +56,3 @@
341 * ***** END LICENSE BLOCK ***** */
343 -#include "config.h"
344 --- misc/hunspell-1.2.8/src/hunspell/makefile.mk Tue Jun 17 10:57:55 2008
345 +++ misc/build/hunspell-1.2.8/src/hunspell/makefile.mk Thu Feb 19 18:13:52 2009
346 @@ -60,11 +60,12 @@
348 #*************************************************************************
350 -PRJ = ..
351 +PRJ = ../../../../../..
353 PRJNAME = hunspell
354 TARGET = hunspell
355 -LIBTARGET=NO
356 +LIBTARGET=YES
357 +EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
359 #----- Settings ---------------------------------------------------------
361 @@ -73,7 +74,7 @@
362 # --- Files --------------------------------------------------------
364 # all_target: ALLTAR DICTIONARY
365 -all_target: ALLTAR
366 +#all_target: ALLTAR
368 ##CXXFLAGS += -I..$/..$/lingutil
369 ##CFLAGSCXX += -I..$/..$/lingutil
370 @@ -89,6 +90,10 @@
371 $(SLO)$/utf_info.obj \
372 $(SLO)$/hashmgr.obj \
373 $(SLO)$/suggestmgr.obj \
374 + $(SLO)$/phonet.obj \
375 + $(SLO)$/hunzip.obj \
376 + $(SLO)$/filemgr.obj \
377 + $(SLO)$/replist.obj \
378 $(SLO)$/hunspell.obj
380 LIB1TARGET= $(SLB)$/lib$(TARGET).lib
381 --- misc/hunspell-1.2.8/src/hunspell/phonet.cxx 2008-08-13 15:29:08.000000000 +0200
382 +++ misc/build/hunspell-1.2.8/src/hunspell/phonet.cxx 2008-11-01 16:30:49.000000000 +0100
383 @@ -32,6 +32,7 @@
384 #include <cstring>
385 #include <cstdio>
386 #include <cctype>
387 +using namespace std;
388 #else
389 #include <stdlib.h>
390 #include <string.h>
391 --- misc/hunspell-1.2.8/src/hunspell/replist.cxx Sat Nov 1 15:09:51 2008
392 +++ misc/build/hunspell-1.2.8/src/hunspell/replist.cxx Thu Feb 19 14:02:51 2009
393 @@ -13,6 +13,7 @@
395 #include "replist.hxx"
396 #include "csutil.hxx"
397 +using namespace std;
399 RepList::RepList(int n) {
400 dat = (replentry **) malloc(sizeof(replentry *) * n);
401 --- misc/hunspell-1.2.8/src/tools/analyze.cxx Tue Jun 17 13:44:50 2008
402 +++ misc/build/hunspell-1.2.8/src/tools/analyze.cxx Thu Feb 19 18:13:35 2009
403 @@ -3,13 +3,13 @@
404 #include <cstdlib>
405 #include <cstdio>
407 -#include "hunspell.hxx"
409 #ifndef WIN32
410 using namespace std;
411 #endif
413 +#include "hunspell.hxx"
417 int main(int argc, char **argv)
419 --- misc/hunspell-1.2.8/src/tools/chmorph.cxx Tue Jun 17 12:15:34 2008
420 +++ misc/build/hunspell-1.2.8/src/tools/chmorph.cxx Thu Feb 19 17:36:46 2009
421 @@ -2,13 +2,13 @@
422 #include <cstdlib>
423 #include <cstdio>
425 -#include "hunspell.hxx"
426 -#include "textparser.hxx"
428 #ifndef W32
429 using namespace std;
430 #endif
432 +#include "hunspell.hxx"
433 +#include "textparser.hxx"
435 int
436 main(int argc, char** argv)
438 --- misc/hunspell-1.2.8/src/tools/example.cxx Tue Jun 17 13:07:24 2008
439 +++ misc/build/hunspell-1.2.8/src/tools/example.cxx Thu Feb 19 17:38:12 2009
440 @@ -2,12 +2,12 @@
441 #include <cstdlib>
442 #include <cstdio>
444 +using namespace std;
446 #include "hunspell.hxx"
448 extern char * mystrdup(const char * s);
450 -using namespace std;
452 int
453 main(int argc, char** argv)
455 --- misc/hunspell-1.2.8/src/tools/hunspell.cxx 2008-09-04 15:44:19.000000000 +0200
456 +++ misc/build/hunspell-1.2.8/src/tools/hunspell.cxx 2008-11-01 16:31:24.000000000 +0100
457 @@ -7,10 +7,20 @@
459 #include <cstdlib>
460 #include <cstdio>
462 +#ifdef __SUNPRO_CC
463 +using namespace std;
464 +#include <string.h>
465 +#include <malloc.h>
466 +#endif
468 #include "config.h"
469 #include "hunspell.hxx"
470 #include "csutil.hxx"
472 +// switch off iconv support for tests (fixing Solaris problems)
473 +#undef HAVE_ICONV
475 #ifndef HUNSPELL_EXTRA
476 #define suggest_auto suggest
477 #endif
478 @@ -98,8 +108,10 @@
479 #if ENABLE_NLS
480 #ifdef HAVE_LOCALE_H
481 #include <locale.h>
482 +#ifdef HAVE_LANGINFO_CODESET
483 #include <langinfo.h>
484 #endif
485 +#endif
487 #ifdef HAVE_LIBINTL_H
488 #include <libintl.h>
489 @@ -1385,9 +1397,11 @@
490 #ifdef HAVE_LOCALE_H
491 ui_lang = setlocale(LC_ALL, "");
492 textdomain("hunspell");
493 +#ifdef HAVE_LANGINFO_CODESET
494 ui_enc = nl_langinfo(CODESET);
495 #endif
496 #endif
497 +#endif
499 #ifdef HAVE_READLINE
500 rl_set_key("\e\e", rl_escape, rl_get_keymap());
501 --- misc/hunspell-1.2.8/src/tools/hunzip.cxx Tue Jan 15 11:10:04 2008
502 +++ misc/build/hunspell-1.2.8/src/tools/hunzip.cxx Thu Feb 19 17:38:12 2009
503 @@ -2,6 +2,8 @@
504 #include <stdlib.h>
505 #include <string.h>
507 +using namespace std;
509 #include "hunzip.hxx"
511 #define DESC "hunzip - decompress a hzip file to the standard output\n" \
512 --- misc/hunspell-1.2.8/src/tools/hzip.c Fri Apr 4 15:20:10 2008
513 +++ misc/build/hunspell-1.2.8/src/tools/hzip.c Thu Feb 19 18:13:35 2009
514 @@ -44,7 +44,7 @@
515 if (tree->type != code_NODE) {
516 int i = tree->word;
517 code[deep] = '\0';
518 - if (tree->type == code_TERM) i = CODELEN; // terminal code
519 + if (tree->type == code_TERM) i = CODELEN;
520 table[i] = malloc((deep + 1) * sizeof(char));
521 strcpy(table[i], code);
523 @@ -63,7 +63,7 @@
524 return ni;
527 -// return length of the freq array
529 int get_freqdata(struct item *** dest, FILE * f, unsigned short * termword) {
530 int freq[CODELEN];
531 int i, j, k, n;
532 @@ -88,7 +88,7 @@
533 (*dest)[n]->word = i;
534 n++;
536 - // terminal sequence (also contains the last odd byte of the file)
538 (*dest)[n] = newitem(1, NULL, NULL, code_TERM);
539 *termword = *((unsigned short *) c);
540 return n + 1;
541 @@ -134,20 +134,20 @@
542 char c[2];
543 char * enc = key;
545 - // header and codes
546 - fprintf(f2, "%s", (key ? MAGIC_ENCRYPTED : MAGIC)); // 3-byte HEADER
548 + fprintf(f2, "%s", (key ? MAGIC_ENCRYPTED : MAGIC));
549 cl = (unsigned char) (n & 0x00ff);
550 ch = (unsigned char) (n >> 8);
551 if (key) {
552 unsigned char cs;
553 for (cs = 0; *enc; enc++) cs ^= *enc;
554 - fprintf(f2, "%c", cs); // 1-byte check sum
555 + fprintf(f2, "%c", cs);
556 enc = key;
557 ch ^= *enc;
558 if ((*(++enc)) == '\0') enc = key;
559 cl ^= *enc;
561 - fprintf(f2, "%c%c", ch, cl); // upper and lower byte of record count
562 + fprintf(f2, "%c%c", ch, cl);
563 for (i = 0; i < BUFSIZE; i++) bitbuf[i] = '\0';
564 for (i = 0; i < CODELEN + 1; i++) if (table[i]) {
565 unsigned short * d = (unsigned short *) &c;
566 @@ -159,7 +159,7 @@
567 if (*(++enc) == '\0') enc = key;
568 c[1] ^= *enc;
570 - fprintf(f2, "%c%c", c[0], c[1]); // 2-character code id
571 + fprintf(f2, "%c%c", c[0], c[1]);
572 bits = 0;
573 write_bits(f2, bitbuf, &bits, table[i]);
574 if (key) {
575 @@ -169,11 +169,11 @@
576 if (*(++enc) == '\0') enc = key;
577 bitbuf[cl] ^= *enc;
579 - } else fprintf(f2, "%c", (unsigned char) bits); // 1-byte code length
580 - fwrite(bitbuf, sizeof(char), bits/8 + 1, f2); // x-byte code
581 + } else fprintf(f2, "%c", (unsigned char) bits);
582 + fwrite(bitbuf, sizeof(char), bits/8 + 1, f2);
585 - // file encoding
587 bits = 0;
588 while((cx[0] = getc(f)) != -1 && (cx[1] = getc(f)) != -1) {
589 c[0] = cx[0];
590 @@ -180,7 +180,7 @@
591 c[1] = cx[1];
592 write_bits(f2, bitbuf, &bits, table[*((unsigned short *) c)]);
594 - // terminal suffixes
596 write_bits(f2, bitbuf, &bits, table[CODELEN]);
597 if (bits > 0) fwrite(bitbuf, sizeof(char), bits/8 + 1, f2);
599 @@ -201,11 +201,11 @@
600 } else pfx = 0;
602 if (i > 0 && buf[i - 1] == '\n') {
603 - if (j == i) j--; // line duplicate
604 + if (j == i) j--;
605 if (j > 29) j = 29;
606 c = j;
607 if (c == '\t') c = 30;
608 - // common suffix
610 for (; buf[i - m - 2] == prev[prevlen - m - 2] &&
611 m < i - j - 1 && m < 15; m++);
612 if (m == 1) m = 0;
613 @@ -221,7 +221,7 @@
614 *p = buf[k];
616 if (m > 0) {
617 - *p = m + 31; // 33-46
618 + *p = m + 31;
619 p++;
621 if (i > 0 && buf[i - 1] == '\n') {