aboutsummaryrefslogtreecommitdiff
path: root/iconv/gconv_open.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-06-16 23:04:41 +0000
committerUlrich Drepper <drepper@redhat.com>2000-06-16 23:04:41 +0000
commit323fb88dac799cddfaa33cb80f7fc3395c2297e5 (patch)
treef853cfdf9b5bcde5a90324bb2115b225bb405ebd /iconv/gconv_open.c
parentf1d5c60ddef851078544e6b8456b18534b9a2a95 (diff)
downloadglibc-323fb88dac799cddfaa33cb80f7fc3395c2297e5.tar
glibc-323fb88dac799cddfaa33cb80f7fc3395c2297e5.tar.gz
glibc-323fb88dac799cddfaa33cb80f7fc3395c2297e5.tar.bz2
glibc-323fb88dac799cddfaa33cb80f7fc3395c2297e5.zip
Update.
2000-06-16 Ulrich Drepper <drepper@redhat.com> * iconv/gconv_int.h (norm_add_slashes): Optionally add given suffix. * iconv/gconv_open.c: Remove error handling specification from `from' character set name. * intl/loadmsgcat.c (_nl_load_domain): Call norm_add_slashes with new parameter to always enable transliteration. * locale/localeinfo.h (LIMAGIC): Bump number because of incompatible change. (struct locale_data): Add new members use_translit and options. * locale/findlocale.c (_nl_find_locale): Set use_translit flag is character set name contained modifier TRANSLIT. * locale/loadlocale.c (_nl_load_locale): Initialize new use_translit and options fields. (_nl_unload_locale): Free options string if necessary. * wcsmbs/wcsmbsload.c (__wcsmbs_load_conv): Enable translation if the locale names suggested this. * locale/C-address.c: Add two new initialilzers to adjust data structure for new format. * locale/C-collate.c: Likewise. * locale/C-ctype.c: Likewise. * locale/C-identification.c: Likewise. * locale/C-measurement.c: Likewise. * locale/C-messages.c: Likewise. * locale/C-monetary.c: Likewise. * locale/C-name.c: Likewise. * locale/C-numeric.c: Likewise. * locale/C-paper.c: Likewise. * locale/C-telephone.c: Likewise. * locale/C-time.c: Likewise. * locale/setlocale.c: Add some more __builtin_expect.
Diffstat (limited to 'iconv/gconv_open.c')
-rw-r--r--iconv/gconv_open.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/iconv/gconv_open.c b/iconv/gconv_open.c
index 14f1d5e0f9..d2963fa8ee 100644
--- a/iconv/gconv_open.c
+++ b/iconv/gconv_open.c
@@ -37,6 +37,7 @@ __gconv_open (const char *toset, const char *fromset, __gconv_t *handle,
int res;
int conv_flags = 0;
const char *errhand;
+ const char *ignore;
/* Find out whether any error handling method is specified. */
errhand = strchr (toset, '/');
@@ -44,7 +45,7 @@ __gconv_open (const char *toset, const char *fromset, __gconv_t *handle,
errhand = strchr (errhand + 1, '/');
if (__builtin_expect (errhand != NULL, 1))
{
- if (errhand[1] == '\0')
+ if (*++errhand == '\0')
errhand = NULL;
else
{
@@ -56,7 +57,7 @@ __gconv_open (const char *toset, const char *fromset, __gconv_t *handle,
flags = __GCONV_IGNORE_ERRORS;
- if (strcasecmp (errhand, "IGNORE") == 0)
+ if (__strcasecmp (errhand, "IGNORE") == 0)
{
/* Found it. This means we should ignore conversion errors. */
flags = __GCONV_IGNORE_ERRORS;
@@ -65,6 +66,18 @@ __gconv_open (const char *toset, const char *fromset, __gconv_t *handle,
}
}
+ /* For the source character set we ignore the error handler specification.
+ XXX Is this really always the best? */
+ ignore = strchr (fromset, '/');
+ if (ignore != NULL && (ignore = strchr (ignore + 1, '/')) != NULL
+ && *++ignore != '\0')
+ {
+ char *newfromset = (char *) alloca (ignore - fromset + 1);
+
+ newfromset[ignore - fromset] = '\0';
+ fromset = memcpy (newfromset, fromset, ignore - fromset);
+ }
+
res = __gconv_find_transform (toset, fromset, &steps, &nsteps, flags);
if (res == __GCONV_OK)
{
@@ -78,7 +91,7 @@ __gconv_open (const char *toset, const char *fromset, __gconv_t *handle,
if (errhand != NULL)
{
/* Find the appropriate transliteration handling. */
- if (strcasecmp (errhand, "TRANSLIT") == 0)
+ if (__strcasecmp (errhand, "TRANSLIT") == 0)
{
/* It's the builtin transliteration handling. We only
suport for it working on the internal encoding. */
@@ -89,7 +102,7 @@ __gconv_open (const char *toset, const char *fromset, __gconv_t *handle,
trans_fct = __gconv_transliterate;
/* No context, init, or end function. */
}
- else if (strcasecmp (errhand, "WORK AROUND A GCC BUG") == 0)
+ else if (__strcasecmp (errhand, "WORK AROUND A GCC BUG") == 0)
{
trans_init_fct = (__gconv_trans_init_fct) 1;
}
@@ -151,7 +164,7 @@ __gconv_open (const char *toset, const char *fromset, __gconv_t *handle,
/* Now see whether we can use the transliteration module
for this step. */
for (n = 0; n < ncsnames; ++n)
- if (strcasecmp (steps[cnt].__from_name, csnames[n]) == 0)
+ if (__strcasecmp (steps[cnt].__from_name, csnames[n]) == 0)
{
/* Match! Now try the initializer. */
if (trans_init_fct == NULL
@@ -182,7 +195,7 @@ __gconv_open (const char *toset, const char *fromset, __gconv_t *handle,
/* Now see whether we can use the transliteration module
for this step. */
for (n = 0; n < ncsnames; ++n)
- if (strcasecmp (steps[cnt].__from_name, csnames[n]) == 0)
+ if (__strcasecmp (steps[cnt].__from_name, csnames[n]) == 0)
{
/* Match! Now try the initializer. */
if (trans_init_fct == NULL