diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2010-01-23 16:43:17 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2010-01-23 16:43:17 +0000 |
commit | 6b121156cdb80a937369625faa6abc6a87ea4d16 (patch) | |
tree | 41bed853e9c4b216e25183a19ca0b4f07df6380e | |
parent | b0466b3702ae3dacafafa0291815f115764d488c (diff) | |
download | cygnal-6b121156cdb80a937369625faa6abc6a87ea4d16.tar.gz cygnal-6b121156cdb80a937369625faa6abc6a87ea4d16.tar.bz2 cygnal-6b121156cdb80a937369625faa6abc6a87ea4d16.zip |
* strfuncs.cc (__sjis_wctomb): Special handling for characters which
differ between SJIS and Windows codepage 932, if charset is "SJIS".
(__sjis_mbtowc): Ditto.
(_jis_wctomb): Remove.
(__jis_mbtowc): Remove.
-rw-r--r-- | winsup/cygwin/ChangeLog | 8 | ||||
-rw-r--r-- | winsup/cygwin/strfuncs.cc | 45 |
2 files changed, 36 insertions, 17 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 45af01ab5..68bf818a6 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,5 +1,13 @@ 2010-01-23 Corinna Vinschen <corinna@vinschen.de> + * strfuncs.cc (__sjis_wctomb): Special handling for characters which + differ between SJIS and Windows codepage 932, if charset is "SJIS". + (__sjis_mbtowc): Ditto. + (_jis_wctomb): Remove. + (__jis_mbtowc): Remove. + +2010-01-23 Corinna Vinschen <corinna@vinschen.de> + * nlsfuncs.cc (wcsxfrm): Call LCMapStringW with LCMAP_BYTEREV flag to allow correct comparison using wcscmp. diff --git a/winsup/cygwin/strfuncs.cc b/winsup/cygwin/strfuncs.cc index 849bd5dc9..181cdb25b 100644 --- a/winsup/cygwin/strfuncs.cc +++ b/winsup/cygwin/strfuncs.cc @@ -108,18 +108,27 @@ extern "C" int __sjis_wctomb (struct _reent *r, char *s, wchar_t wchar, const char *charset, mbstate_t *state) { + if (*charset == 'S') + { + /* SJIS is not exactly CP932. Two ASCII code points are converted + differently. */ + if (wchar == L'\x00a5') /* SJIS has Yen sign in place of Backslash */ + { + if (s) + *s = '\x5c'; + return 1; + } + else if (wchar == L'\x203e') /* SJIS has Overline in place of Tilde */ + { + if (s) + *s = '\x7e'; + return 1; + } + } return __db_wctomb (r,s, wchar, 932); } extern "C" int -__jis_wctomb (struct _reent *r, char *s, wchar_t wchar, const char *charset, - mbstate_t *state) -{ - /* FIXME: See comment at start of file. */ - return __ascii_wctomb (r, s, wchar, charset, state); -} - -extern "C" int __eucjp_wctomb (struct _reent *r, char *s, wchar_t wchar, const char *charset, mbstate_t *state) { @@ -243,15 +252,17 @@ extern "C" int __sjis_mbtowc (struct _reent *r, wchar_t *pwc, const char *s, size_t n, const char *charset, mbstate_t *state) { - return __db_mbtowc (r, pwc, s, n, 932, state); -} - -extern "C" int -__jis_mbtowc (struct _reent *r, wchar_t *pwc, const char *s, size_t n, - const char *charset, mbstate_t *state) -{ - /* FIXME: See comment at start of file. */ - return __ascii_mbtowc (r, pwc, s, n, charset, state); + int ret = __db_mbtowc (r, pwc, s, n, 932, state); + if (*charset == 'S' && pwc && ret == 1) + { + /* CP932 is not exactly SJIS. Two ASCII code points are converted + differently. */ + if (*s == '\x5c') /* SJIS has Yen sign in place of Backslash */ + *pwc = L'\x00a5'; + else if (*s == '\x7e') /* SJIS has Overline in place of Tilde */ + *pwc = L'\x203e'; + } + return ret; } extern "C" int |