Now *really* check in what should have been checked in 12 hours ago.

This commit is contained in:
Corinna Vinschen 2010-02-08 21:33:59 +00:00
parent 95fc66f6cb
commit 2f27950afb
1 changed files with 10 additions and 2 deletions

View File

@ -294,7 +294,8 @@ lc_mbstowcs (mbtowc_p f_mbtowc, const char *charset,
n = 1; n = 1;
while (n > 0) while (n > 0)
{ {
bytes = f_mbtowc (_REENT, pwcs, t, n, charset, &state); bytes = f_mbtowc (_REENT, pwcs, t, 6 /* fake, always enough */,
charset, &state);
if (bytes == (size_t) -1) if (bytes == (size_t) -1)
{ {
state.__count = 0; state.__count = 0;
@ -956,6 +957,7 @@ __set_locale_from_locale_alias (const char *locale, char *new_locale)
wchar_t walias[ENCODING_LEN + 1]; wchar_t walias[ENCODING_LEN + 1];
#define LOCALE_ALIAS_LINE_LEN 255 #define LOCALE_ALIAS_LINE_LEN 255
char alias_buf[LOCALE_ALIAS_LINE_LEN + 1], *c; char alias_buf[LOCALE_ALIAS_LINE_LEN + 1], *c;
wchar_t *wc;
const char *alias, *replace; const char *alias, *replace;
char *ret = NULL; char *ret = NULL;
@ -967,6 +969,10 @@ __set_locale_from_locale_alias (const char *locale, char *new_locale)
if (mbstowcs (wlocale, locale, ENCODING_LEN + 1) == (size_t) -1) if (mbstowcs (wlocale, locale, ENCODING_LEN + 1) == (size_t) -1)
sys_mbstowcs (wlocale, ENCODING_LEN + 1, locale); sys_mbstowcs (wlocale, ENCODING_LEN + 1, locale);
wlocale[ENCODING_LEN] = L'\0'; wlocale[ENCODING_LEN] = L'\0';
/* Ignore @cjknarrow modifier since it's a very personal thing between
Cygwin and newlib... */
if ((wc = wcschr (wlocale, L'@')) && !wcscmp (wc + 1, L"cjknarrow"))
*wc = L'\0';
while (fgets (alias_buf, LOCALE_ALIAS_LINE_LEN + 1, fp)) while (fgets (alias_buf, LOCALE_ALIAS_LINE_LEN + 1, fp))
{ {
alias_buf[LOCALE_ALIAS_LINE_LEN] = '\0'; alias_buf[LOCALE_ALIAS_LINE_LEN] = '\0';
@ -1030,7 +1036,9 @@ check_codepage (char *ret)
return ret; return ret;
} }
static void /* Can be called via cygwin_internal (CW_INTERNAL_SETLOCALE) for application
which really (think they) know what they are doing. */
extern "C" void
internal_setlocale () internal_setlocale ()
{ {
/* Each setlocale from the environment potentially changes the /* Each setlocale from the environment potentially changes the