X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Flocale%2Ficonv.c;h=1eeea94e0a38753691269b978f105b5e65ee33b8;hb=bd275378d35b3535bc8b8321780b00e486c36d96;hp=e6121aea1ac0c306234a7f0220d59931b6684e68;hpb=3b0e83264d156f9e496ab32badd89e4447b807aa;p=musl diff --git a/src/locale/iconv.c b/src/locale/iconv.c index e6121aea..1eeea94e 100644 --- a/src/locale/iconv.c +++ b/src/locale/iconv.c @@ -5,6 +5,7 @@ #include #include #include +#include "locale_impl.h" #define UTF_32BE 0300 #define UTF_16LE 0301 @@ -165,9 +166,12 @@ size_t iconv(iconv_t cd0, char **restrict in, size_t *restrict inb, char **restr int err; unsigned char type = map[-1]; unsigned char totype = tomap[-1]; + locale_t *ploc = &CURRENT_LOCALE, loc = *ploc; if (!in || !*in || !*inb) return 0; + *ploc = UTF8_LOCALE; + for (; *inb; *in+=l, *inb-=l) { c = *(unsigned char *)*in; l = 1; @@ -431,6 +435,7 @@ size_t iconv(iconv_t cd0, char **restrict in, size_t *restrict inb, char **restr break; } } + *ploc = loc; return x; ilseq: err = EILSEQ; @@ -445,5 +450,6 @@ starved: x = -1; end: errno = err; + *ploc = loc; return x; }