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:
Tor Lillqvist 2008-10-08 20:35:39 +00:00 committed by Tor Lillqvist
parent 57d48592db
commit c7501c8223
2 changed files with 14 additions and 0 deletions

View File

@ -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

View File

@ -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)