diff options
| author | Ulrich Drepper <drepper@redhat.com> | 2000-06-16 23:04:41 +0000 |
|---|---|---|
| committer | Ulrich Drepper <drepper@redhat.com> | 2000-06-16 23:04:41 +0000 |
| commit | 323fb88dac799cddfaa33cb80f7fc3395c2297e5 (patch) | |
| tree | f853cfdf9b5bcde5a90324bb2115b225bb405ebd | |
| parent | f1d5c60ddef851078544e6b8456b18534b9a2a95 (diff) | |
| download | glibc-323fb88dac799cddfaa33cb80f7fc3395c2297e5.tar.xz 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.
45 files changed, 161 insertions, 61 deletions
@@ -1,3 +1,36 @@ +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. + 2000-06-15 Ulrich Drepper <drepper@redhat.com> * iconv/gconv.h (__gconv_fct): Change type of fifth parameter to diff --git a/iconv/gconv_int.h b/iconv/gconv_int.h index 34dff7d522..5bdf7143e6 100644 --- a/iconv/gconv_int.h +++ b/iconv/gconv_int.h @@ -102,18 +102,19 @@ extern struct gconv_module *__gconv_modules_db; /* The gconv functions expects the name to be in upper case and complete, including the trailing slashes if necessary. */ -#define norm_add_slashes(str) \ +#define norm_add_slashes(str,suffix) \ ({ \ const char *cp = (str); \ char *result; \ char *tmp; \ size_t cnt = 0; \ + size_t suffix_len = suffix == NULL ? 0 : strlen (suffix); \ \ while (*cp != '\0') \ if (*cp++ == '/') \ ++cnt; \ \ - tmp = result = alloca (cp - (str) + 3); \ + tmp = result = alloca (cp - (str) + 3 + suffix_len); \ cp = (str); \ while (*cp != '\0') \ *tmp++ = _toupper (*cp++); \ @@ -121,7 +122,11 @@ extern struct gconv_module *__gconv_modules_db; { \ *tmp++ = '/'; \ if (cnt < 1) \ - *tmp++ = '/'; \ + { \ + *tmp++ = '/'; \ + if (suffix != NULL) \ + tmp = __mempcpy (tmp, suffix, suffix_len); \ + } \ } \ *tmp = '\0'; \ result; \ 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 diff --git a/iconvdata/8bit-gap.c b/iconvdata/8bit-gap.c index 6394065c56..a4a32d3eae 100644 --- a/iconvdata/8bit-gap.c +++ b/iconvdata/8bit-gap.c @@ -89,7 +89,7 @@ struct gap { \ result = DL_CALL_FCT (step_data->__trans.__trans_fct, \ (step, step_data, *inptrp, &inptr, inend, \ - &outbuf, irreversible)); \ + &outptr, irreversible)); \ if (result != __GCONV_OK) \ break; \ } \ @@ -112,7 +112,7 @@ struct gap { \ result = DL_CALL_FCT (step_data->__trans.__trans_fct, \ (step, step_data, *inptrp, &inptr, inend, \ - &outbuf, irreversible)); \ + &outptr, irreversible)); \ if (result != __GCONV_OK) \ break; \ } \ @@ -137,7 +137,7 @@ struct gap { \ result = DL_CALL_FCT (step_data->__trans.__trans_fct, \ (step, step_data, *inptrp, &inptr, inend, \ - &outbuf, irreversible)); \ + &outptr, irreversible)); \ if (result != __GCONV_OK) \ break; \ } \ diff --git a/iconvdata/8bit-generic.c b/iconvdata/8bit-generic.c index 1478c5be59..02d972e21c 100644 --- a/iconvdata/8bit-generic.c +++ b/iconvdata/8bit-generic.c @@ -72,7 +72,7 @@ { \ result = DL_CALL_FCT (step_data->__trans.__trans_fct, \ (step, step_data, *inptrp, &inptr, inend, \ - &outbuf, irreversible)); \ + &outptr, irreversible)); \ if (result != __GCONV_OK) \ break; \ } \ diff --git a/iconvdata/ansi_x3.110.c b/iconvdata/ansi_x3.110.c index f338055f39..6ec09c3c5c 100644 --- a/iconvdata/ansi_x3.110.c +++ b/iconvdata/ansi_x3.110.c @@ -501,7 +501,7 @@ static const char from_ucs4[][2] = { \ result = DL_CALL_FCT (step_data->__trans.__trans_fct, \ (step, step_data, *inptrp, &inptr, \ - inend, &outbuf, irreversible)); \ + inend, &outptr, irreversible)); \ if (result != __GCONV_OK) \ break; \ } \ @@ -559,7 +559,7 @@ static const char from_ucs4[][2] = { \ result = DL_CALL_FCT (step_data->__trans.__trans_fct, \ (step, step_data, *inptrp, &inptr, \ - inend, &outbuf, irreversible)); \ + inend, &outptr, irreversible)); \ if (result != __GCONV_OK) \ break; \ } \ @@ -587,7 +587,7 @@ static const char from_ucs4[][2] = { \ result = DL_CALL_FCT (step_data->__trans.__trans_fct, \ (step, step_data, *inptrp, &inptr, \ - inend, &outbuf, irreversible)); \ + inend, &outptr, irreversible)); \ if (result != __GCONV_OK) \ break; \ } \ diff --git a/iconvdata/big5.c b/iconvdata/big5.c index 8cad304c7a..947a92a341 100644 --- a/iconvdata/big5.c +++ b/iconvdata/big5.c @@ -8589,7 +8589,7 @@ static const char from_ucs4_tab13[][2] = { \ result = DL_CALL_FCT (step_data->__trans.__trans_fct, \ (step, step_data, *inptrp, &inptr, inend, \ - &outbuf, irreversible)); \ + &outptr, irreversible)); \ if (result != __GCONV_OK) \ break; \ } \ diff --git a/iconvdata/big5hkscs.c b/iconvdata/big5hkscs.c index 0859dd8f09..64923d42af 100644 --- a/iconvdata/big5hkscs.c +++ b/iconvdata/big5hkscs.c @@ -12746,7 +12746,7 @@ static const char from_ucs4_tab14[][2] = { \ result = DL_CALL_FCT (step_data->__trans.__trans_fct, \ (step, step_data, *inptrp, &inptr, inend, \ - &outbuf, irreversible)); \ + &outptr, irreversible)); \ if (result != __GCONV_OK) \ break; \ } \ diff --git a/iconvdata/euc-cn.c b/iconvdata/euc-cn.c index 075970ce96..18e73fda6c 100644 --- a/iconvdata/euc-cn.c +++ b/iconvdata/euc-cn.c @@ -145,7 +145,7 @@ { \ result = DL_CALL_FCT (step_data->__trans.__trans_fct, \ (step, step_data, *inptrp, &inptr, \ - inend, &outbuf, irreversible)); \ + inend, &outptr, irreversible)); \ if (result != __GCONV_OK) \ break; \ } \ diff --git a/iconvdata/euc-jp.c b/iconvdata/euc-jp.c index 771dc069e8..3e21d55f12 100644 --- a/iconvdata/euc-jp.c +++ b/iconvdata/euc-jp.c @@ -222,7 +222,7 @@ { \ result = DL_CALL_FCT (step_data->__trans.__trans_fct, \ (step, step_data, *inptrp, \ - &inptr, inend, &outbuf, \ + &inptr, inend, &outptr, \ irreversible)); \ if (result != __GCONV_OK) \ break; \ diff --git a/iconvdata/euc-kr.c b/iconvdata/euc-kr.c index e953df5dc9..c32b9b3537 100644 --- a/iconvdata/euc-kr.c +++ b/iconvdata/euc-kr.c @@ -150,7 +150,7 @@ euckr_from_ucs4 (uint32_t ch, unsigned char *cp) { \ result = DL_CALL_FCT (step_data->__trans.__trans_fct, \ (step, step_data, *inptrp, &inptr, inend, \ - &outbuf, irreversible)); \ + &outptr, irreversible)); \ if (result != __GCONV_OK) \ break; \ } \ diff --git a/iconvdata/euc-tw.c b/iconvdata/euc-tw.c index f3152478e2..b4cf21ba97 100644 --- a/iconvdata/euc-tw.c +++ b/ |
