diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2015-11-14 11:45:44 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2015-11-14 11:45:44 +0000 |
commit | 74acbd778e5459d25327e0d15cbc4e4f623082fd (patch) | |
tree | dd4fa093bfd29dfd18dcdb44ec18c5f89cb3ed15 /usr.bin/tmux/screen-write.c | |
parent | cf9f5099983fb07aa006a7f8073a26a8796082a0 (diff) |
All these return values from utf8_* are confusing, use an enum.
Diffstat (limited to 'usr.bin/tmux/screen-write.c')
-rw-r--r-- | usr.bin/tmux/screen-write.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/usr.bin/tmux/screen-write.c b/usr.bin/tmux/screen-write.c index d0a833ade8b..c49e9b433ec 100644 --- a/usr.bin/tmux/screen-write.c +++ b/usr.bin/tmux/screen-write.c @@ -1,4 +1,4 @@ -/* $OpenBSD: screen-write.c,v 1.78 2015/11/14 10:56:31 nicm Exp $ */ +/* $OpenBSD: screen-write.c,v 1.79 2015/11/14 11:45:43 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -115,7 +115,7 @@ screen_write_strlen(const char *fmt, ...) struct utf8_data ud; u_char *ptr; size_t left, size = 0; - int more; + enum utf8_state more; va_start(ap, fmt); xvasprintf(&msg, fmt, ap); @@ -123,17 +123,17 @@ screen_write_strlen(const char *fmt, ...) ptr = msg; while (*ptr != '\0') { - if (*ptr > 0x7f && utf8_open(&ud, *ptr)) { + if (*ptr > 0x7f && utf8_open(&ud, *ptr) == UTF8_MORE) { ptr++; left = strlen(ptr); if (left < (size_t)ud.size - 1) break; - while ((more = utf8_append(&ud, *ptr)) == 1) + while ((more = utf8_append(&ud, *ptr)) == UTF8_MORE) ptr++; ptr++; - if (more == 0) + if (more == UTF8_DONE) size += ud.width; } else { if (*ptr > 0x1f && *ptr < 0x7f) @@ -178,23 +178,23 @@ screen_write_vnputs(struct screen_write_ctx *ctx, ssize_t maxlen, struct utf8_data ud; u_char *ptr; size_t left, size = 0; - int more; + enum utf8_state more; xvasprintf(&msg, fmt, ap); ptr = msg; while (*ptr != '\0') { - if (*ptr > 0x7f && utf8_open(&ud, *ptr)) { + if (*ptr > 0x7f && utf8_open(&ud, *ptr) == UTF8_MORE) { ptr++; left = strlen(ptr); if (left < (size_t)ud.size - 1) break; - while ((more = utf8_append(&ud, *ptr)) == 1) + while ((more = utf8_append(&ud, *ptr)) == UTF8_MORE) ptr++; ptr++; - if (more == 0) { + if (more == UTF8_DONE) { if (maxlen > 0 && size + ud.width > (size_t) maxlen) { while (size < (size_t) maxlen) { @@ -236,7 +236,7 @@ screen_write_cnputs(struct screen_write_ctx *ctx, ssize_t maxlen, char *msg; u_char *ptr, *last; size_t left, size = 0; - int more; + enum utf8_state more; va_start(ap, fmt); xvasprintf(&msg, fmt, ap); @@ -260,17 +260,17 @@ screen_write_cnputs(struct screen_write_ctx *ctx, ssize_t maxlen, continue; } - if (*ptr > 0x7f && utf8_open(&ud, *ptr)) { + if (*ptr > 0x7f && utf8_open(&ud, *ptr) == UTF8_MORE) { ptr++; left = strlen(ptr); if (left < (size_t)ud.size - 1) break; - while ((more = utf8_append(&ud, *ptr)) == 1) + while ((more = utf8_append(&ud, *ptr)) == UTF8_MORE) ptr++; ptr++; - if (more == 0) { + if (more == UTF8_DONE) { if (maxlen > 0 && size + ud.width > (size_t) maxlen) { while (size < (size_t) maxlen) { |