summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDom Lachowicz <domlachowicz@gmail.com>2006-03-31 20:43:05 +0000
committerDom Lachowicz <domlachowicz@gmail.com>2006-03-31 20:43:05 +0000
commit32fdb3552b87410e4a6e40ed5ddde89519f29006 (patch)
tree29ef5bc93fd9ffb3cd123a14ee8cce9bec054206
parent3c3dd302623ebd0e94fc2bf9d8780b7146d7253b (diff)
downloadenchant-32fdb3552b87410e4a6e40ed5ddde89519f29006.tar.gz
improve 'normalize_dictionary_tag()' a bit so that it can handle hyphens; null-terminate some stuff
git-svn-id: svn+ssh://svn.abisource.com/svnroot/enchant/trunk@21122 bcba8976-2d24-0410-9c9c-aab3bd5fdfd6
-rw-r--r--src/enchant.c4
-rw-r--r--src/ispell/ispell_checker.cpp2
-rw-r--r--src/uspell/uspell_provider.cpp2
3 files changed, 6 insertions, 2 deletions
diff --git a/src/enchant.c b/src/enchant.c
index 79096b7..47afb4c 100644
--- a/src/enchant.c
+++ b/src/enchant.c
@@ -277,6 +277,10 @@ enchant_normalize_dictionary_tag (const char * const dict_tag)
if ((needle = strchr (new_tag, '.')) != NULL)
*needle = '\0';
+ /* turn en-GB into en_GB */
+ if ((needle = strchr (new_tag, '-')) != NULL)
+ *needle = '_';
+
return new_tag;
}
diff --git a/src/ispell/ispell_checker.cpp b/src/ispell/ispell_checker.cpp
index 9d81339..e52d226 100644
--- a/src/ispell/ispell_checker.cpp
+++ b/src/ispell/ispell_checker.cpp
@@ -654,7 +654,7 @@ ispell_provider_list_dictionaries (EnchantProvider * me,
{
size_t i, nb;
- char ** out_dicts = g_new (char *, size_ispell_map + 1);
+ char ** out_dicts = g_new0 (char *, size_ispell_map + 1);
nb = 0;
for (i = 0; i < size_ispell_map; i++)
if (_ispell_provider_dictionary_exists (me, ispell_map[i].dict))
diff --git a/src/uspell/uspell_provider.cpp b/src/uspell/uspell_provider.cpp
index 713f0ef..ea93506 100644
--- a/src/uspell/uspell_provider.cpp
+++ b/src/uspell/uspell_provider.cpp
@@ -427,7 +427,7 @@ uspell_provider_list_dictionaries (EnchantProvider * me,
if (nb == 0)
return NULL;
- char ** out_dicts = g_new (char *, nb + 1);
+ char ** out_dicts = g_new0 (char *, nb + 1);
for (i = 0; i < n_mappings; i++)
if (uspell_provider_dictionary_exists (me, mapping[i].language_tag))
out_dicts[i] = g_strdup (mapping[i].language_tag);