mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-02 07:36:17 +01:00
Bug 554790 - g_convert() misbehaves with winiconv versions
2008-10-08 Tor Lillqvist <tml@novell.com> Bug 554790 - g_convert() misbehaves with winiconv versions * glib/win_iconv.c (kernel_mbtowc): If converting from ASCII, explicitly check for and reject 8bit chars. MultiByteToWideChar() doesn't, at least not on XP. svn path=/trunk/; revision=7578
This commit is contained in:
parent
57d48592db
commit
c7501c8223
@ -1,3 +1,11 @@
|
||||
2008-10-08 Tor Lillqvist <tml@novell.com>
|
||||
|
||||
Bug 554790 - g_convert() misbehaves with winiconv versions
|
||||
|
||||
* glib/win_iconv.c (kernel_mbtowc): If converting from ASCII,
|
||||
explicitly check for and reject 8bit chars. MultiByteToWideChar()
|
||||
doesn't, at least not on XP.
|
||||
|
||||
2008-10-06 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* glib/gtypes.h: Properly include gmacros.h
|
||||
|
@ -1362,6 +1362,12 @@ kernel_mbtowc(csconv_t *cv, const uchar *buf, int bufsize, ushort *wbuf, int *wb
|
||||
len = cv->mblen(cv, buf, bufsize);
|
||||
if (len == -1)
|
||||
return -1;
|
||||
/* If converting from ASCII, reject 8bit
|
||||
* chars. MultiByteToWideChar() doesn't. Note that for ASCII we
|
||||
* know that the mblen function is sbcs_mblen() so len is 1.
|
||||
*/
|
||||
if (cv->codepage == 20127 && buf[0] >= 0x80)
|
||||
return_error(EILSEQ);
|
||||
*wbufsize = MultiByteToWideChar(cv->codepage, mbtowc_flags (cv->codepage),
|
||||
(const char *)buf, len, (wchar_t *)wbuf, *wbufsize);
|
||||
if (*wbufsize == 0)
|
||||
|
Loading…
Reference in New Issue
Block a user