On Thu, Jan 06, 2011 at 07:52:19PM +0300, Alexander Polakov wrote: > * Alexander Polakov <polac...@gmail.com> [110105 17:20]: > > Hi, > > > > here's an updated version. > > > > 1) en_US.UTF-8.src updates from FreeBSD > > 2) wcwidth() changed to use the same code as iswprint() > > * maybe just use iswprint() itself?
Change number 2 is the only one that hasn't been committed yet. According to http://pubs.opengroup.org/onlinepubs/009695399/functions/wcwidth.html wcwidth() should return -1 for non-printable characters. So this change looks good to me. Anyone want to ok it? > > 3) _RUNETYPE_SW0 changed to be !0 (and match FreeBSD). 0 value is used in > > mklocale to perform additional checks required for MAPLOWER and > > MAPUPPER, but not SWIDTHx. > > 4) _RUNETYPE_SWM changed to make (r&_RUNETYPE_SWM) == _RUNETYPE_SW0 > work > > > Index: lib/libc/locale/iswctype.c > =================================================================== > RCS file: /OpenBSD/src/lib/libc/locale/iswctype.c,v > retrieving revision 1.1 > diff -u -r1.1 iswctype.c > --- lib/libc/locale/iswctype.c 7 Aug 2005 10:16:23 -0000 1.1 > +++ lib/libc/locale/iswctype.c 6 Jan 2011 16:24:20 -0000 > @@ -170,7 +170,9 @@ > int > wcwidth(wchar_t c) > { > - return (((unsigned)__runetype_w(c) & _CTYPE_SWM) >> _CTYPE_SWS); > + if (__isctype_w((c), _CTYPE_R)) > + return (((unsigned)__runetype_w(c) & _CTYPE_SWM) >> _CTYPE_SWS); > + return -1; > } > > wctrans_t