This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Re: [PATCH] New wcwidth/wcswidth implementation
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