default to something sensible in C locale

This commit is contained in:
Caolan McNamara 2009-06-26 14:56:25 +00:00
parent c7101efecf
commit 34d3b3394b
3 changed files with 9 additions and 204 deletions

View File

@ -47,7 +47,7 @@ diff -ru hunspell-1.2.8.orig/src/tools/hunspell.cxx hunspell-1.2.8/src/tools/hun
textdomain("hunspell"); textdomain("hunspell");
ui_enc = nl_langinfo(CODESET); ui_enc = nl_langinfo(CODESET);
#endif #endif
@@ -1515,13 +1514,23 @@ @@ -1515,13 +1514,26 @@
if (! dicname) { if (! dicname) {
if (! (dicname=getenv("DICTIONARY"))) { if (! (dicname=getenv("DICTIONARY"))) {
@ -74,6 +74,9 @@ diff -ru hunspell-1.2.8.orig/src/tools/hunspell.cxx hunspell-1.2.8/src/tools/hun
+ } + }
+ } + }
+ +
+ if (strcmp(dicname, "C") == 0)
+ dicname=mystrdup("en_US");
+
+ if (! dicname) { + if (! dicname) {
dicname=mystrdup(DEFAULTDICNAME); dicname=mystrdup(DEFAULTDICNAME);
} }

View File

@ -1,202 +0,0 @@
diff -ru hunspell-1.2.8.orig/src/hunspell/affixmgr.cxx hunspell-1.2.8/src/hunspell/affixmgr.cxx
--- hunspell-1.2.8.orig/src/hunspell/affixmgr.cxx 2009-06-24 15:00:32.000000000 +0100
+++ hunspell-1.2.8/src/hunspell/affixmgr.cxx 2009-06-24 15:30:35.000000000 +0100
@@ -1866,8 +1866,8 @@
if (wordnum < maxwordnum) {
rv = compound_check((st+i),strlen(st+i), wordnum+1,
numsyllable, maxwordnum, wnum + 1, words, 0, is_sug);
- if (rv && numcheckcpd && (scpd == 0 && cpdpat_check(word, i, rv_first, rv) ||
- scpd != 0 && !cpdpat_check(word, i, rv_first, rv))) rv = NULL;
+ if (rv && numcheckcpd && ((scpd == 0 && cpdpat_check(word, i, rv_first, rv)) ||
+ (scpd != 0 && !cpdpat_check(word, i, rv_first, rv)))) rv = NULL;
} else {
rv=NULL;
}
@@ -4276,7 +4276,7 @@
if (strip[i] == cond[j]) in = 1;
} while ((j < (condl - 1)) && (cond[j] != ']'));
if (j == (condl - 1) && (cond[j] != ']')) {
- HUNSPELL_WARNING(stderr, "error: line %d: missing ] in condition:\n%s\n", linenum);
+ HUNSPELL_WARNING(stderr, "error: line %d: missing ] in condition:\n%s\n", linenum, cond);
return 0;
}
if ((!neg && !in) || (neg && in)) {
@@ -4304,7 +4304,7 @@
if (strip[i] == cond[j]) in = 1;
} while ((j > 0) && (cond[j] != '['));
if ((j == 0) && (cond[j] != '[')) {
- HUNSPELL_WARNING(stderr, "error: error: %d: missing ] in condition:\n%s\n", linenum);
+ HUNSPELL_WARNING(stderr, "error: line: %d: missing ] in condition:\n%s\n", linenum, cond);
return 0;
}
neg = (cond[j+1] == '^') ? 1 : 0;
diff -ru hunspell-1.2.8.orig/src/hunspell/csutil.cxx hunspell-1.2.8/src/hunspell/csutil.cxx
--- hunspell-1.2.8.orig/src/hunspell/csutil.cxx 2009-06-24 15:00:32.000000000 +0100
+++ hunspell-1.2.8/src/hunspell/csutil.cxx 2009-06-24 15:30:35.000000000 +0100
@@ -5313,7 +5313,7 @@
if (utf_tbl) return 0;
utf_tbl = (unicode_info2 *) malloc(CONTSIZE * sizeof(unicode_info2));
if (utf_tbl) {
- int j;
+ size_t j;
for (j = 0; j < CONTSIZE; j++) {
utf_tbl[j].cletter = 0;
utf_tbl[j].clower = (unsigned short) j;
diff -ru hunspell-1.2.8.orig/src/hunspell/csutil.hxx hunspell-1.2.8/src/hunspell/csutil.hxx
--- hunspell-1.2.8.orig/src/hunspell/csutil.hxx 2009-06-24 15:00:32.000000000 +0100
+++ hunspell-1.2.8/src/hunspell/csutil.hxx 2009-06-24 15:30:32.000000000 +0100
@@ -46,10 +46,10 @@
// hash entry macros
#define HENTRY_DATA(h) (h->var ? ((h->var & H_OPT_ALIASM) ? \
- get_stored_pointer(&(h->word) + h->blen + 1) : &(h->word) + h->blen + 1) : NULL)
+ get_stored_pointer(&(h->word[0]) + h->blen + 1) : &(h->word[0]) + h->blen + 1) : NULL)
// NULL-free version for warning-free OOo build
#define HENTRY_DATA2(h) (h->var ? ((h->var & H_OPT_ALIASM) ? \
- get_stored_pointer(&(h->word) + h->blen + 1) : &(h->word) + h->blen + 1) : "")
+ get_stored_pointer(&(h->word[0]) + h->blen + 1) : &(h->word[0]) + h->blen + 1) : "")
#define HENTRY_FIND(h,p) (HENTRY_DATA(h) ? strstr(HENTRY_DATA(h), p) : NULL)
#define w_char_eq(a,b) (((a).l == (b).l) && ((a).h == (b).h))
diff -ru hunspell-1.2.8.orig/src/hunspell/hashmgr.cxx hunspell-1.2.8/src/hunspell/hashmgr.cxx
--- hunspell-1.2.8.orig/src/hunspell/hashmgr.cxx 2009-06-24 15:00:32.000000000 +0100
+++ hunspell-1.2.8/src/hunspell/hashmgr.cxx 2009-06-24 15:30:35.000000000 +0100
@@ -118,7 +118,7 @@
dp = tableptr[hash(word)];
if (!dp) return NULL;
for ( ; dp != NULL; dp = dp->next) {
- if (strcmp(word,&(dp->word)) == 0) return dp;
+ if (strcmp(word, dp->word) == 0) return dp;
}
}
return NULL;
@@ -134,7 +134,7 @@
struct hentry* hp =
(struct hentry *) malloc (sizeof(struct hentry) + wbl + descl);
if (!hp) return 1;
- char * hpw = &(hp->word);
+ char * hpw = hp->word;
strcpy(hpw, word);
if (ignorechars != NULL) {
if (utf8) {
@@ -178,7 +178,7 @@
return 0;
}
while (dp->next != NULL) {
- if ((!dp->next_homonym) && (strcmp(&(hp->word), &(dp->word)) == 0)) {
+ if ((!dp->next_homonym) && (strcmp(hp->word, dp->word) == 0)) {
// remove hidden onlyupcase homonym
if (!onlyupcase) {
if ((dp->astr) && TESTAFF(dp->astr, ONLYUPCASEFLAG, dp->alen)) {
@@ -196,7 +196,7 @@
}
dp=dp->next;
}
- if (strcmp(&(hp->word), &(dp->word)) == 0) {
+ if (strcmp(hp->word, dp->word) == 0) {
// remove hidden onlyupcase homonym
if (!onlyupcase) {
if ((dp->astr) && TESTAFF(dp->astr, ONLYUPCASEFLAG, dp->alen)) {
diff -ru hunspell-1.2.8.orig/src/hunspell/htypes.hxx hunspell-1.2.8/src/hunspell/htypes.hxx
--- hunspell-1.2.8.orig/src/hunspell/htypes.hxx 2009-06-24 15:00:32.000000000 +0100
+++ hunspell-1.2.8/src/hunspell/htypes.hxx 2009-06-24 15:14:23.000000000 +0100
@@ -12,7 +12,7 @@
#define H_OPT_PHON (1 << 2)
// see also csutil.hxx
-#define HENTRY_WORD(h) &(h->word)
+#define HENTRY_WORD(h) (h->word)
// approx. number of user defined words
#define USERWORD 1000
@@ -26,7 +26,7 @@
struct hentry * next; // next word with same hash code
struct hentry * next_homonym; // next homonym word (with same hash code)
char var; // variable fields (only for special pronounciation yet)
- char word; // variable-length word (8-bit or UTF-8 encoding)
+ char word[1]; // variable-length word (8-bit or UTF-8 encoding)
};
#endif
diff -ru hunspell-1.2.8.orig/src/hunspell/hunspell.cxx hunspell-1.2.8/src/hunspell/hunspell.cxx
--- hunspell-1.2.8.orig/src/hunspell/hunspell.cxx 2009-06-24 15:00:32.000000000 +0100
+++ hunspell-1.2.8/src/hunspell/hunspell.cxx 2009-06-24 15:30:35.000000000 +0100
@@ -496,7 +496,6 @@
if (wordbreak) {
char * s;
char r;
- int corr = 0;
wl = strlen(cw);
int numbreak = pAMgr ? pAMgr->get_numbreak() : 0;
// check boundary patterns (^begin and end$)
@@ -515,7 +514,6 @@
}
// other patterns
for (int j = 0; j < numbreak; j++) {
- int result = 0;
int plen = strlen(wordbreak[j]);
s=(char *) strstr(cw, wordbreak[j]);
if (s && (s > cw) && (s < cw + wl - plen)) {
@@ -617,7 +615,7 @@
return NULL;
}
if (root) {
- *root = mystrdup(&(he->word));
+ *root = mystrdup(he->word);
if (*root && complexprefixes) {
if (utf8) reverseword_utf(*root); else reverseword(*root);
}
@@ -636,7 +634,7 @@
// end of LANG speficic region
if (he) {
if (root) {
- *root = mystrdup(&(he->word));
+ *root = mystrdup(he->word);
if (*root && complexprefixes) {
if (utf8) reverseword_utf(*root); else reverseword(*root);
}
diff -ru hunspell-1.2.8.orig/src/hunspell/Makefile.am hunspell-1.2.8/src/hunspell/Makefile.am
--- hunspell-1.2.8.orig/src/hunspell/Makefile.am 2009-06-24 15:00:32.000000000 +0100
+++ hunspell-1.2.8/src/hunspell/Makefile.am 2009-06-24 15:14:23.000000000 +0100
@@ -3,7 +3,7 @@
lib_LTLIBRARIES = libhunspell-1.2.la
libhunspell_1_2_includedir = $(includedir)/hunspell
libhunspell_1_2_la_SOURCES=affentry.cxx affixmgr.cxx csutil.cxx \
- dictmgr.cxx hashmgr.cxx hunspell.cxx utf_info.cxx \
+ dictmgr.cxx hashmgr.cxx hunspell.cxx \
suggestmgr.cxx license.myspell license.hunspell \
phonet.cxx filemgr.cxx hunzip.cxx replist.cxx
@@ -12,4 +12,6 @@
suggestmgr.hxx baseaffix.hxx hashmgr.hxx langnum.hxx \
phonet.hxx filemgr.hxx hunzip.hxx w_char.hxx replist.hxx
+libhunspell_1_2_la_DEPENDENCIES=utf_info.cxx
+
EXTRA_DIST=hunspell.dsp makefile.mk README
diff -ru hunspell-1.2.8.orig/src/hunspell/replist.cxx hunspell-1.2.8/src/hunspell/replist.cxx
--- hunspell-1.2.8.orig/src/hunspell/replist.cxx 2009-06-24 15:00:32.000000000 +0100
+++ hunspell-1.2.8/src/hunspell/replist.cxx 2009-06-24 15:30:35.000000000 +0100
@@ -79,7 +79,7 @@
int stl = 0;
int change = 0;
// for (int i = 0; i < pos; i++) fprintf(stderr, "%d. %s\n", i, dat[i]->pattern);
- for (int i = 0; i < strlen(word); i++) {
+ for (size_t i = 0; i < strlen(word); i++) {
int n = near(word + i);
int l = match(word + i, n);
if (l) {
diff -ru hunspell-1.2.8.orig/src/hunspell/suggestmgr.cxx hunspell-1.2.8/src/hunspell/suggestmgr.cxx
--- hunspell-1.2.8.orig/src/hunspell/suggestmgr.cxx 2009-06-24 15:00:32.000000000 +0100
+++ hunspell-1.2.8/src/hunspell/suggestmgr.cxx 2009-06-24 15:33:17.000000000 +0100
@@ -1924,8 +1924,8 @@
for (j = 0; j <= n; j++) c[j] = 0;
for (i = 1; i <= m; i++) {
for (j = 1; j <= n; j++) {
- if ((utf8) && (*((short *) su+i-1) == *((short *)su2+j-1))
- || (!utf8) && ((*(s+i-1)) == (*(s2+j-1)))) {
+ if ( ((utf8) && (*((short *) su+i-1) == *((short *)su2+j-1)))
+ || ((!utf8) && ((*(s+i-1)) == (*(s2+j-1))))) {
c[i*(n+1) + j] = c[(i-1)*(n+1) + j-1]+1;
b[i*(n+1) + j] = LCS_UPLEFT;
} else if (c[(i-1)*(n+1) + j] >= c[i*(n+1) + j-1]) {

View File

@ -1,7 +1,7 @@
Name: hunspell Name: hunspell
Summary: A spell checker and morphological analyzer library Summary: A spell checker and morphological analyzer library
Version: 1.2.8 Version: 1.2.8
Release: 6%{?dist} Release: 7%{?dist}
Source0: http://downloads.sourceforge.net/%{name}/hunspell-%{version}.tar.gz Source0: http://downloads.sourceforge.net/%{name}/hunspell-%{version}.tar.gz
Source1: http://people.debian.org/~agmartin/misc/ispellaff2myspell Source1: http://people.debian.org/~agmartin/misc/ispellaff2myspell
Source2: http://people.redhat.com/caolanm/hunspell/wordlist2hunspell Source2: http://people.redhat.com/caolanm/hunspell/wordlist2hunspell
@ -109,6 +109,10 @@ rm -rf $RPM_BUILD_ROOT
%{_mandir}/man3/hunspell.3.gz %{_mandir}/man3/hunspell.3.gz
%changelog %changelog
* Fri Jun 26 2009 Caolan McNamara <caolanm@redhat.com> - 1.2.8-7
- Related: rhbz#498556 default to something sensible in "C" locale
for language
* Wed Jun 24 2009 Caolan McNamara <caolanm@redhat.com> - 1.2.8-6 * Wed Jun 24 2009 Caolan McNamara <caolanm@redhat.com> - 1.2.8-6
- Resolves: rhbz#507829 fortify fixes - Resolves: rhbz#507829 fortify fixes