diff options
Diffstat (limited to 'iconv')
-rw-r--r-- | iconv/gconv_charset.h | 8 | ||||
-rw-r--r-- | iconv/gconv_conf.c | 33 | ||||
-rw-r--r-- | iconv/gconv_int.h | 2 | ||||
-rw-r--r-- | iconv/gconv_open.c | 12 |
4 files changed, 30 insertions, 25 deletions
diff --git a/iconv/gconv_charset.h b/iconv/gconv_charset.h index 278bccc..76a92a1 100644 --- a/iconv/gconv_charset.h +++ b/iconv/gconv_charset.h @@ -19,6 +19,7 @@ 02111-1307 USA. */ #include <ctype.h> +#include <locale.h> static inline void @@ -28,8 +29,9 @@ strip (char *wp, const char *s) while (*s != '\0') { - if (isalnum (*s) || *s == '_' || *s == '-' || *s == '.') - *wp++ = toupper (*s); + if (__isalnum_l (*s, &_nl_C_locobj) + || *s == '_' || *s == '-' || *s == '.') + *wp++ = __toupper_l (*s, &_nl_C_locobj); else if (*s == '/') { if (++slash_count == 3) @@ -50,7 +52,7 @@ static char * __attribute__ ((unused)) upstr (char *dst, const char *str) { char *cp = dst; - while ((*cp++ = toupper (*str++)) != '\0') + while ((*cp++ = __toupper_l (*str++, &_nl_C_locobj)) != '\0') /* nothing */; return dst; } diff --git a/iconv/gconv_conf.c b/iconv/gconv_conf.c index db5bb47..99519d0 100644 --- a/iconv/gconv_conf.c +++ b/iconv/gconv_conf.c @@ -22,6 +22,7 @@ #include <ctype.h> #include <errno.h> #include <limits.h> +#include <locale.h> #include <search.h> #include <stddef.h> #include <stdio.h> @@ -129,20 +130,20 @@ add_alias (char *rp, void *modules) struct gconv_alias *new_alias; char *from, *to, *wp; - while (isspace (*rp)) + while (__isspace_l (*rp, &_nl_C_locobj)) ++rp; from = wp = rp; - while (*rp != '\0' && !isspace (*rp)) - *wp++ = toupper (*rp++); + while (*rp != '\0' && !__isspace_l (*rp, &_nl_C_locobj)) + *wp++ = __toupper_l (*rp++, &_nl_C_locobj); if (*rp == '\0') /* There is no `to' string on the line. Ignore it. */ return; *wp++ = '\0'; to = ++rp; - while (isspace (*rp)) + while (__isspace_l (*rp, &_nl_C_locobj)) ++rp; - while (*rp != '\0' && !isspace (*rp)) - *wp++ = toupper (*rp++); + while (*rp != '\0' && !__isspace_l (*rp, &_nl_C_locobj)) + *wp++ = __toupper_l (*rp++, &_nl_C_locobj); if (to == wp) /* No `to' string, ignore the line. */ return; @@ -250,30 +251,30 @@ add_module (char *rp, const char *directory, size_t dir_len, void **modules, int need_ext; int cost_hi; - while (isspace (*rp)) + while (__isspace_l (*rp, &_nl_C_locobj)) ++rp; from = rp; - while (*rp != '\0' && !isspace (*rp)) + while (*rp != '\0' && !__isspace_l (*rp, &_nl_C_locobj)) { - *rp = toupper (*rp); + *rp = __toupper_l (*rp, &_nl_C_locobj); ++rp; } if (*rp == '\0') return; *rp++ = '\0'; to = wp = rp; - while (isspace (*rp)) + while (__isspace_l (*rp, &_nl_C_locobj)) ++rp; - while (*rp != '\0' && !isspace (*rp)) - *wp++ = toupper (*rp++); + while (*rp != '\0' && !__isspace_l (*rp, &_nl_C_locobj)) + *wp++ = __toupper_l (*rp++, &_nl_C_locobj); if (*rp == '\0') return; *wp++ = '\0'; do ++rp; - while (isspace (*rp)); + while (__isspace_l (*rp, &_nl_C_locobj)); module = wp; - while (*rp != '\0' && !isspace (*rp)) + while (*rp != '\0' && !__isspace_l (*rp, &_nl_C_locobj)) *wp++ = *rp++; if (*rp == '\0') { @@ -386,7 +387,7 @@ read_conf_file (const char *filename, const char *directory, size_t dir_len, if (rp[n - 1] == '\n') rp[n - 1] = '\0'; - while (isspace (*rp)) + while (__isspace_l (*rp, &_nl_C_locobj)) ++rp; /* If this is an empty line go on with the next one. */ @@ -394,7 +395,7 @@ read_conf_file (const char *filename, const char *directory, size_t dir_len, continue; word = rp; - while (*rp != '\0' && !isspace (*rp)) + while (*rp != '\0' && !__isspace_l (*rp, &_nl_C_locobj)) ++rp; if (rp - word == sizeof ("alias") - 1 diff --git a/iconv/gconv_int.h b/iconv/gconv_int.h index 3b5f195..d9edcb0 100644 --- a/iconv/gconv_int.h +++ b/iconv/gconv_int.h @@ -141,7 +141,7 @@ extern const char *__gconv_path_envvar; tmp = result = alloca (cp - (str) + 3 + suffix_len); \ cp = (str); \ while (*cp != '\0') \ - *tmp++ = _toupper (*cp++); \ + *tmp++ = __toupper_l (*cp++, &_nl_C_locobj); \ if (cnt < 2) \ { \ *tmp++ = '/'; \ diff --git a/iconv/gconv_open.c b/iconv/gconv_open.c index 0bf343d..dfcd7b7 100644 --- a/iconv/gconv_open.c +++ b/iconv/gconv_open.c @@ -19,6 +19,7 @@ 02111-1307 USA. */ #include <errno.h> +#include <locale.h> #include <stdlib.h> #include <string.h> @@ -64,7 +65,7 @@ __gconv_open (const char *toset, const char *fromset, __gconv_t *handle, tok = __strtok_r (tok, ",", &ptr); while (tok != NULL) { - if (__strcasecmp (tok, "TRANSLIT") == 0) + if (__strcasecmp_l (tok, "TRANSLIT", &_nl_C_locobj) == 0) { /* It's the builtin transliteration handling. We only support it for working on the internal encoding. */ @@ -97,7 +98,7 @@ __gconv_open (const char *toset, const char *fromset, __gconv_t *handle, lastp->next = newp; } } - else if (__strcasecmp (tok, "IGNORE") == 0) + else if (__strcasecmp_l (tok, "IGNORE", &_nl_C_locobj) == 0) /* Set the flag to ignore all errors. */ conv_flags |= __GCONV_IGNORE_ERRORS; else @@ -110,7 +111,8 @@ __gconv_open (const char *toset, const char *fromset, __gconv_t *handle, for (runp = trans; runp != NULL; runp = runp->next) if (runp->name != NULL - && __strcasecmp (tok, runp->name) == 0) + && __strcasecmp_l (tok, runp->name, + &_nl_C_locobj) == 0) break; else lastp = runp; @@ -205,8 +207,8 @@ __gconv_open (const char *toset, const char *fromset, __gconv_t *handle, modules for this step. */ for (runp = trans; runp != NULL; runp = runp->next) for (n = 0; n < runp->ncsnames; ++n) - if (__strcasecmp (steps[cnt].__from_name, - runp->csnames[n]) == 0) + if (__strcasecmp_l (steps[cnt].__from_name, + runp->csnames[n], &_nl_C_locobj) == 0) { void *data = NULL; |