Resolves: rhbz#509882 ignore an empty LANGUAGE variable

This commit is contained in:
Caolan McNamara 2009-07-07 14:05:41 +00:00
parent 4e9f8bd1be
commit f7c186ff87
2 changed files with 7 additions and 7 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,26 @@ @@ -1557,13 +1556,26 @@
if (! dicname) { if (! dicname) {
if (! (dicname=getenv("DICTIONARY"))) { if (! (dicname=getenv("DICTIONARY"))) {
@ -63,8 +63,8 @@ diff -ru hunspell-1.2.8.orig/src/tools/hunspell.cxx hunspell-1.2.8/src/tools/hun
+ * LANG + * LANG
+ */ + */
+ const char *tests[] = { "LANGUAGE", "LC_ALL", "LC_MESSAGES", "LANG" }; + const char *tests[] = { "LANGUAGE", "LC_ALL", "LC_MESSAGES", "LANG" };
+ for (int i = 0; i < sizeof(tests) / sizeof(const char*); ++i) { + for (size_t i = 0; i < sizeof(tests) / sizeof(const char*); ++i) {
+ if ((dicname=getenv(tests[i]))) { + if ((dicname=getenv(tests[i])) && strcmp(dicname, "") != 0) {
+ dicname = mystrdup(dicname); + dicname = mystrdup(dicname);
+ char * dot = strchr(dicname, '.'); + char * dot = strchr(dicname, '.');
+ if (dot) *dot = '\0'; + if (dot) *dot = '\0';
@ -81,7 +81,7 @@ diff -ru hunspell-1.2.8.orig/src/tools/hunspell.cxx hunspell-1.2.8/src/tools/hun
dicname=mystrdup(DEFAULTDICNAME); dicname=mystrdup(DEFAULTDICNAME);
} }
} else { } else {
@@ -1535,6 +1544,12 @@ @@ -1577,6 +1589,12 @@
path = add(add(add(add(path, HOME), DIRSEP), USEROOODIR), PATHSEP); path = add(add(add(add(path, HOME), DIRSEP), USEROOODIR), PATHSEP);
path = add(path, OOODIR); path = add(path, OOODIR);
@ -94,7 +94,7 @@ diff -ru hunspell-1.2.8.orig/src/tools/hunspell.cxx hunspell-1.2.8/src/tools/hun
if (!privdicname) privdicname = mystrdup(getenv("WORDLIST")); if (!privdicname) privdicname = mystrdup(getenv("WORDLIST"));
int diclen = strlen(dicname); int diclen = strlen(dicname);
@@ -1544,9 +1559,6 @@ @@ -1586,9 +1604,6 @@
char * dic = search(path, dicname, ".dic"); char * dic = search(path, dicname, ".dic");
if (aff && dic) { if (aff && dic) {
if (showpath) { if (showpath) {
@ -104,7 +104,7 @@ diff -ru hunspell-1.2.8.orig/src/tools/hunspell.cxx hunspell-1.2.8/src/tools/hun
fprintf(stderr, gettext("LOADED DICTIONARY:\n%s\n%s\n"), aff, dic); fprintf(stderr, gettext("LOADED DICTIONARY:\n%s\n%s\n"), aff, dic);
} }
pMS[0] = new Hunspell(aff, dic, key); pMS[0] = new Hunspell(aff, dic, key);
@@ -1569,7 +1581,7 @@ @@ -1611,7 +1626,7 @@
} else if (dic) pMS[dmax-1]->add_dic(dic); } else if (dic) pMS[dmax-1]->add_dic(dic);
} }
} else { } else {

View File

@ -109,7 +109,7 @@ rm -rf $RPM_BUILD_ROOT
%{_mandir}/man3/hunspell.3.gz %{_mandir}/man3/hunspell.3.gz
%changelog %changelog
- Tue Jul 07 2009 Caolan McNamara <caolanm@redhat.com> - 1.2.8-8 * Tue Jul 07 2009 Caolan McNamara <caolanm@redhat.com> - 1.2.8-8
- Resolves: rhbz#509882 ignore an empty LANGUAGE variable - Resolves: rhbz#509882 ignore an empty LANGUAGE variable
* Fri Jun 26 2009 Caolan McNamara <caolanm@redhat.com> - 1.2.8-7 * Fri Jun 26 2009 Caolan McNamara <caolanm@redhat.com> - 1.2.8-7