aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--newlib/libc/ctype/jp2uc.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/newlib/libc/ctype/jp2uc.c b/newlib/libc/ctype/jp2uc.c
index 5e30f09be..a32561eb7 100644
--- a/newlib/libc/ctype/jp2uc.c
+++ b/newlib/libc/ctype/jp2uc.c
@@ -166,7 +166,8 @@ __uc2jp (wint_t c, int type)
wint_t
_jp2uc_l (wint_t c, struct __locale_t * l)
{
- const char * cs = l ? __locale_charset(l) : __current_locale_charset();
+ const char *cs = (l && l != LC_GLOBAL_LOCALE)
+ ? __locale_charset(l) : __current_locale_charset();
if (0 == strcmp (cs, "JIS"))
c = __jp2uc (c, JP_JIS);
else if (0 == strcmp (cs, "SJIS"))
@@ -179,14 +180,15 @@ _jp2uc_l (wint_t c, struct __locale_t * l)
wint_t
_jp2uc (wint_t c)
{
- return _jp2uc_l (c, 0);
+ return _jp2uc_l (c, NULL);
}
/* Unicode to Japanese conversion interface */
wint_t
_uc2jp_l (wint_t c, struct __locale_t * l)
{
- const char * cs = l ? __locale_charset(l) : __current_locale_charset();
+ const char *cs = (l && l != LC_GLOBAL_LOCALE)
+ ? __locale_charset(l) : __current_locale_charset();
if (0 == strcmp (cs, "JIS"))
c = __uc2jp (c, JP_JIS);
else if (0 == strcmp (cs, "SJIS"))