Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2009-03-25 16:52:08 +0300
committerCorinna Vinschen <corinna@vinschen.de>2009-03-25 16:52:08 +0300
commit6396c8889f45e2c2454e4756812f4033e33b13f3 (patch)
tree92a9e009371491bb57739f7059114c77fa25b876 /newlib/libc/locale/locale.c
parent5354e13fe6ec71bcddd355b1a71fdde7c9067a72 (diff)
* libc/locale/locale.c (loadlocale): Only change __wctomb and __mbtowc
pointers if category is LC_CTYPE.
Diffstat (limited to 'newlib/libc/locale/locale.c')
-rw-r--r--newlib/libc/locale/locale.c55
1 files changed, 31 insertions, 24 deletions
diff --git a/newlib/libc/locale/locale.c b/newlib/libc/locale/locale.c
index 26379bef7..7dfa04ada 100644
--- a/newlib/libc/locale/locale.c
+++ b/newlib/libc/locale/locale.c
@@ -396,6 +396,9 @@ loadlocale(struct _reent *p, int category)
unsigned long val;
char *end;
int mbc_max;
+ int (*l_wctomb) (struct _reent *, char *, wchar_t, const char *, mbstate_t *);
+ int (*l_mbtowc) (struct _reent *, wchar_t *, const char *, size_t,
+ const char *, mbstate_t *);
/* "POSIX" is translated to "C", as on Linux. */
if (!strcmp (locale, "POSIX"))
@@ -450,8 +453,8 @@ loadlocale(struct _reent *p, int category)
return NULL;
mbc_max = 6;
#ifdef _MB_CAPABLE
- __wctomb = __utf8_wctomb;
- __mbtowc = __utf8_mbtowc;
+ l_wctomb = __utf8_wctomb;
+ l_mbtowc = __utf8_mbtowc;
#endif
break;
case 'J':
@@ -459,8 +462,8 @@ loadlocale(struct _reent *p, int category)
return NULL;
mbc_max = 8;
#ifdef _MB_CAPABLE
- __wctomb = __jis_wctomb;
- __mbtowc = __jis_mbtowc;
+ l_wctomb = __jis_wctomb;
+ l_mbtowc = __jis_mbtowc;
#endif
break;
case 'E':
@@ -470,8 +473,8 @@ loadlocale(struct _reent *p, int category)
strcpy (charset, "EUCJP");
mbc_max = 2;
#ifdef _MB_CAPABLE
- __wctomb = __eucjp_wctomb;
- __mbtowc = __eucjp_mbtowc;
+ l_wctomb = __eucjp_wctomb;
+ l_mbtowc = __eucjp_mbtowc;
#endif
}
#ifdef __CYGWIN__
@@ -480,8 +483,8 @@ loadlocale(struct _reent *p, int category)
strcpy (charset, "EUCKR");
mbc_max = 2;
#ifdef _MB_CAPABLE
- __wctomb = __kr_wctomb;
- __mbtowc = __kr_mbtowc;
+ l_wctomb = __kr_wctomb;
+ l_mbtowc = __kr_mbtowc;
#endif
}
#endif
@@ -493,8 +496,8 @@ loadlocale(struct _reent *p, int category)
return NULL;
mbc_max = 2;
#ifdef _MB_CAPABLE
- __wctomb = __sjis_wctomb;
- __mbtowc = __sjis_mbtowc;
+ l_wctomb = __sjis_wctomb;
+ l_mbtowc = __sjis_mbtowc;
#endif
break;
case 'I':
@@ -508,11 +511,11 @@ loadlocale(struct _reent *p, int category)
mbc_max = 1;
#ifdef _MB_CAPABLE
#ifdef _MB_EXTENDED_CHARSETS_ISO
- __wctomb = __iso_wctomb;
- __mbtowc = __iso_mbtowc;
+ l_wctomb = __iso_wctomb;
+ l_mbtowc = __iso_mbtowc;
#else /* !_MB_EXTENDED_CHARSETS_ISO */
- __wctomb = __ascii_wctomb;
- __mbtowc = __ascii_mbtowc;
+ l_wctomb = __ascii_wctomb;
+ l_mbtowc = __ascii_mbtowc;
#endif /* _MB_EXTENDED_CHARSETS_ISO */
#endif
break;
@@ -549,11 +552,11 @@ loadlocale(struct _reent *p, int category)
mbc_max = 1;
#ifdef _MB_CAPABLE
#ifdef _MB_EXTENDED_CHARSETS_WINDOWS
- __wctomb = __cp_wctomb;
- __mbtowc = __cp_mbtowc;
+ l_wctomb = __cp_wctomb;
+ l_mbtowc = __cp_mbtowc;
#else /* !_MB_EXTENDED_CHARSETS_WINDOWS */
- __wctomb = __ascii_wctomb;
- __mbtowc = __ascii_mbtowc;
+ l_wctomb = __ascii_wctomb;
+ l_mbtowc = __ascii_mbtowc;
#endif /* _MB_EXTENDED_CHARSETS_WINDOWS */
#endif
break;
@@ -566,8 +569,8 @@ loadlocale(struct _reent *p, int category)
return NULL;
mbc_max = 1;
#ifdef _MB_CAPABLE
- __wctomb = __ascii_wctomb;
- __mbtowc = __ascii_mbtowc;
+ l_wctomb = __ascii_wctomb;
+ l_mbtowc = __ascii_mbtowc;
#endif
break;
#ifdef __CYGWIN__
@@ -576,8 +579,8 @@ loadlocale(struct _reent *p, int category)
return NULL;
mbc_max = 2;
#ifdef _MB_CAPABLE
- __wctomb = __gbk_wctomb;
- __mbtowc = __gbk_mbtowc;
+ l_wctomb = __gbk_wctomb;
+ l_mbtowc = __gbk_mbtowc;
#endif
break;
case 'B':
@@ -586,8 +589,8 @@ loadlocale(struct _reent *p, int category)
strcpy (charset, "BIG5");
mbc_max = 2;
#ifdef _MB_CAPABLE
- __wctomb = __big5_wctomb;
- __mbtowc = __big5_mbtowc;
+ l_wctomb = __big5_wctomb;
+ l_mbtowc = __big5_mbtowc;
#endif
break;
#endif /* __CYGWIN__ */
@@ -598,9 +601,13 @@ loadlocale(struct _reent *p, int category)
{
strcpy (lc_ctype_charset, charset);
__mb_cur_max = mbc_max;
+#ifdef _MB_CAPABLE
+ __wctomb = l_wctomb;
+ __mbtowc = l_mbtowc;
#ifdef __CYGWIN__
__set_ctype (charset);
#endif
+#endif
}
else if (category == LC_MESSAGES)
strcpy (lc_message_charset, charset);