summaryrefslogtreecommitdiff
path: root/usr/src/lib
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@nexenta.com>2010-08-06 22:33:35 -0700
committerGarrett D'Amore <garrett@nexenta.com>2010-08-06 22:33:35 -0700
commit5ffb5900142c1e9cc0b98d96ab527fea6af5f80d (patch)
tree67f1f9c8d6c5b4199c938eec36e5ee3d6849097d /usr/src/lib
parenteda71b4a8fb1d0b34d0f08c47b43af49428d24c3 (diff)
downloadillumos-joyent-5ffb5900142c1e9cc0b98d96ab527fea6af5f80d.tar.gz
12 libc breaks lex
Reviewed by: matt@greenviolet.net Approved by: garrett@nexenta.com
Diffstat (limited to 'usr/src/lib')
-rw-r--r--usr/src/lib/libc/port/locale/iswctype.c4
-rw-r--r--usr/src/lib/libc/port/locale/wcwidth.c10
2 files changed, 7 insertions, 7 deletions
diff --git a/usr/src/lib/libc/port/locale/iswctype.c b/usr/src/lib/libc/port/locale/iswctype.c
index c50f356f9a..03d90aa86e 100644
--- a/usr/src/lib/libc/port/locale/iswctype.c
+++ b/usr/src/lib/libc/port/locale/iswctype.c
@@ -66,7 +66,7 @@ __istype(wint_t c, unsigned int f)
rt = ___runetype(c);
else
rt = _CurrentRuneLocale->__runetype[c];
- return (!!(rt & f));
+ return (rt & f);
}
static int
@@ -79,7 +79,7 @@ __isctype(wint_t c, unsigned int f)
return (0);
else
rt = _CurrentRuneLocale->__runetype[c];
- return (!!(rt & f));
+ return (rt & f);
}
#undef iswctype
diff --git a/usr/src/lib/libc/port/locale/wcwidth.c b/usr/src/lib/libc/port/locale/wcwidth.c
index fb63c723c1..a6ff73b357 100644
--- a/usr/src/lib/libc/port/locale/wcwidth.c
+++ b/usr/src/lib/libc/port/locale/wcwidth.c
@@ -66,13 +66,13 @@ wcwidth(wchar_t wc)
#pragma weak _scrwidth = scrwidth
/*
- * This is a Solaris extension. I don't really understand why a different
- * function was needed. Anecdotally, it appears that perhaps some versions
- * of the Sun wcwidth didn't handle illegal encodings well, and scrwidth
- * seems to have been better. Its not an issue for our implementation.
+ * This is a Solaris extension. It never returns a negative width, even for
+ * non-printable characters. It is used internally by the printf
+ * implementation for %ws.
*/
int
scrwidth(wchar_t wc)
{
- return (wcwidth(wc));
+ int v = wcwidth(wc);
+ return (v > 0 ? v : 0);
}