diff options
author | 2020-06-02 17:17:44 +0000 | |
---|---|---|
committer | 2020-06-02 17:17:44 +0000 | |
commit | 4169f666156b44a759c31449e1dec4f81bfcbbb4 (patch) | |
tree | bc15349ead626e5b843f94d2f23fef90ec369792 | |
parent | fix SEE ALSO; (diff) | |
download | wireguard-openbsd-4169f666156b44a759c31449e1dec4f81bfcbbb4.tar.xz wireguard-openbsd-4169f666156b44a759c31449e1dec4f81bfcbbb4.zip |
UTF-8 keys need to be big endian so the size bits are at the top.
-rw-r--r-- | usr.bin/tmux/utf8.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/usr.bin/tmux/utf8.c b/usr.bin/tmux/utf8.c index 7c0f1eb8456..9dd149ace13 100644 --- a/usr.bin/tmux/utf8.c +++ b/usr.bin/tmux/utf8.c @@ -1,4 +1,4 @@ -/* $OpenBSD: utf8.c,v 1.50 2020/06/02 11:29:00 nicm Exp $ */ +/* $OpenBSD: utf8.c,v 1.51 2020/06/02 17:17:44 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -162,14 +162,14 @@ utf8_from_data(const struct utf8_data *ud, utf8_char *uc) m.data[1] = (offset >> 8) & 0xff; m.data[2] = (offset >> 16); } - *uc = m.uc; + *uc = htonl(m.uc); return (UTF8_DONE); fail: if (ud->width == 1) - *uc = utf8_space1.uc; + *uc = htonl(utf8_space1.uc); else - *uc = utf8_space2.uc; + *uc = htonl(utf8_space2.uc); return (UTF8_ERROR); } @@ -177,7 +177,7 @@ fail: void utf8_to_data(utf8_char uc, struct utf8_data *ud) { - union utf8_map m = { .uc = uc }; + union utf8_map m = { .uc = ntohl(uc) }; struct utf8_item *ui; u_int offset; @@ -210,7 +210,7 @@ utf8_build_one(char c, u_int width) if (width == 2) m.flags |= UTF8_FLAG_WIDTH2; - return (m.uc); + return (htonl(m.uc)); } /* Set a single character. */ |