diff options
author | Rob Landley <rob@landley.net> | 2021-05-15 11:14:03 -0500 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2021-05-15 11:14:03 -0500 |
commit | d3025b14b9c13286b79f256d019a99da9425ea0e (patch) | |
tree | 02a40c59346677cb5f6a51137f4a39d16ae6b743 /toys/posix/wc.c | |
parent | 08481ee37ad5070ff1033d57351c3fa456d0729d (diff) | |
download | toybox-d3025b14b9c13286b79f256d019a99da9425ea0e.tar.gz |
Convert utf8towc from wchar_t to unsigned (to match wctoutf8).
The maximum unicode code point is 0x10ffff which is 21 bits.
Diffstat (limited to 'toys/posix/wc.c')
-rw-r--r-- | toys/posix/wc.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/toys/posix/wc.c b/toys/posix/wc.c index 910e4690..118e7750 100644 --- a/toys/posix/wc.c +++ b/toys/posix/wc.c @@ -74,6 +74,7 @@ static void do_wc(int fd, char *name) for (;;) { int pos, done = 0, len2 = read(fd, toybuf+len, sizeof(toybuf)-len); + unsigned wchar; if (len2<0) perror_msg_raw(name); else len += len2; @@ -85,8 +86,6 @@ static void do_wc(int fd, char *name) if (FLAG(m)) { // If we've consumed next wide char if (--clen<1) { - wchar_t wchar; - // next wide size, don't count invalid, fetch more data if necessary clen = utf8towc(&wchar, toybuf+pos, len-pos); if (clen == -1) continue; |