diff options
author | Carmelo Amoroso <carmelo.amoroso@st.com> | 2008-12-02 17:14:36 +0000 |
---|---|---|
committer | Carmelo Amoroso <carmelo.amoroso@st.com> | 2008-12-02 17:14:36 +0000 |
commit | 329ef3196b396a70eecd5a4789845d368b488ab7 (patch) | |
tree | b061e067dc2493c9952d9a3c3df2bb7cb7484ae4 /libc/misc/wchar/wchar.c | |
parent | 9c936bc66adc1d437671d9a6ecc06f15614b1942 (diff) | |
download | uClibc-alpine-329ef3196b396a70eecd5a4789845d368b488ab7.tar.bz2 uClibc-alpine-329ef3196b396a70eecd5a4789845d368b488ab7.tar.xz |
Fix wcswidth function when LOCALE support is disabled
while keeping WCHAR support enabled. This solves two
testcases: tst_wcwidth and tst_wcswidth.
Fix dat_iswctype.c fiinput file: character 0x80 is not
a control character: it fixes tst_iswctype test.
Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com>
Diffstat (limited to 'libc/misc/wchar/wchar.c')
-rw-r--r-- | libc/misc/wchar/wchar.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/libc/misc/wchar/wchar.c b/libc/misc/wchar/wchar.c index 23638ea8f..a28cd8f94 100644 --- a/libc/misc/wchar/wchar.c +++ b/libc/misc/wchar/wchar.c @@ -1143,6 +1143,13 @@ int wcswidth(const wchar_t *pwcs, size_t n) { int count; wchar_t wc; + size_t i; + + for (i = 0 ; (i < n) && pwcs[i] ; i++) { + if (pwcs[i] != (pwcs[i] & 0x7f)) { + return -1; + } + } for (count = 0 ; n && (wc = *pwcs++) ; n--) { if (wc <= 0xff) { |