[PATCH] New wcwidth/wcswidth implementation
Corinna Vinschen
vinschen@redhat.com
Wed May 13 18:31:00 GMT 2009
On May 13 06:02, Eric Blake wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> According to Corinna Vinschen on 5/13/2009 3:03 AM:
> > + /* First half of a surrogate pair? */
> > + if (sizeof (wchar_t) == 2 && wi >= 0xd800 && wi <= 0xdbff)
> > + {
> > + wint_t wi2;
> > +
> > + /* Extract second half and check for validity. */
> > + if (--n == 0 || (wi2 = *++pwcs) < 0xdc00 || wi2 > 0xdfff)
> > + return -1;
>
> Should we also set errno = EILSEQ here? Although POSIX doesn't require
> it, it also doesn't forbid it (after all, using UTF16 is already a POSIX
> violation).
Fine with me. I guess __wcwidth should set EILSEQ as well if it
encounters an (invalid) surrogate value.
Corinna
--
Corinna Vinschen
Cygwin Project Co-Leader
Red Hat
More information about the Newlib
mailing list