diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2010-02-09 08:58:38 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2010-02-09 08:58:38 +0000 |
commit | 1cea6189a33dafcd77d5668a2a623ed01a4dfe1c (patch) | |
tree | 3dd1112dbd48f83637aa7ac13fddd746d6cf7b43 /newlib/libc/locale/lmessages.c | |
parent | 2f27950afb0fe1ffad9a2c25dcdbf282bbe4577b (diff) | |
download | cygnal-1cea6189a33dafcd77d5668a2a623ed01a4dfe1c.tar.gz cygnal-1cea6189a33dafcd77d5668a2a623ed01a4dfe1c.tar.bz2 cygnal-1cea6189a33dafcd77d5668a2a623ed01a4dfe1c.zip |
* libc/locale/lmessages.c (__messages_load_locale): Take additional
parameters for wide char to multibyte conversion. Call
__set_lc_messages_from_win on Cygwin.
* libc/locale/lmessages.h: Make C++-safe.
(__messages_load_locale): Change declaration.
* libc/locale/lmonetary.c (__monetary_load_locale): Use
_monetary_locale_buf as buffer pointer.
* libc/locale/lnumeric.c (__numeric_load_locale): Use
_numeric_locale_buf as buffer pointer.
* libc/locale/timelocal.c (__time_load_locale): Use time_locale_buf
as buffer pointer.
* libc/locale/locale.c (loadlocale): Enable loading LC_MESSAGES data
on Cygwin.
Diffstat (limited to 'newlib/libc/locale/lmessages.c')
-rw-r--r-- | newlib/libc/locale/lmessages.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/newlib/libc/locale/lmessages.c b/newlib/libc/locale/lmessages.c index 9a4bb799a..24e4858d5 100644 --- a/newlib/libc/locale/lmessages.c +++ b/newlib/libc/locale/lmessages.c @@ -49,8 +49,29 @@ static int _messages_using_locale; static char *_messages_locale_buf; int -__messages_load_locale(const char *name) { +__messages_load_locale (const char *name, void *f_wctomb, const char *charset) +{ +#ifdef __CYGWIN__ + extern int __set_lc_messages_from_win (const char *, + struct lc_messages_T *, char **, + void *, const char *); + int ret; + int old_messages_using_locale = _messages_using_locale; + _messages_using_locale = 0; + ret = __set_lc_messages_from_win (name, &_messages_locale, + &_messages_locale_buf, + f_wctomb, charset); + /* ret == -1: error, ret == 0: C/POSIX, ret > 0: valid */ + if (ret < 0) + _messages_using_locale = old_messages_using_locale; + else + { + _messages_using_locale = ret; + ret = 0; + } + return ret; +#else /* * Propose that we can have incomplete locale file (w/o "{yes,no}str"). * Initialize them before loading. In case of complete locale, they'll @@ -63,6 +84,7 @@ __messages_load_locale(const char *name) { _messages_locale_buf, "LC_MESSAGES", LCMESSAGES_SIZE_FULL, LCMESSAGES_SIZE_MIN, (const char **)&_messages_locale); +#endif } struct lc_messages_T * |