diff options
author | Stefan Sperling <stsp@cvs.openbsd.org> | 2011-04-15 16:11:24 +0000 |
---|---|---|
committer | Stefan Sperling <stsp@cvs.openbsd.org> | 2011-04-15 16:11:24 +0000 |
commit | b36a9bc6cf702ad5f5f043755f100e39d0db2a83 (patch) | |
tree | 38dcbf8245175aedd084ad01e15e394d3ab655eb /lib/libc/locale | |
parent | 641a661e8e1a3e27e3f2358960f2d55599f6e791 (diff) |
wcwidth() must return -1 if the character is not printable.
Diff from Alexander Polakov.
OK phessler@
Diffstat (limited to 'lib/libc/locale')
-rw-r--r-- | lib/libc/locale/iswctype.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/libc/locale/iswctype.c b/lib/libc/locale/iswctype.c index 0f2aa34729a..1ffb655e1b8 100644 --- a/lib/libc/locale/iswctype.c +++ b/lib/libc/locale/iswctype.c @@ -1,4 +1,4 @@ -/* $OpenBSD: iswctype.c,v 1.1 2005/08/07 10:16:23 espie Exp $ */ +/* $OpenBSD: iswctype.c,v 1.2 2011/04/15 16:11:23 stsp Exp $ */ /* $NetBSD: iswctype.c,v 1.15 2005/02/09 21:35:46 kleink Exp $ */ /* @@ -170,7 +170,9 @@ towlower(wint_t c) 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 |