aboutsummaryrefslogtreecommitdiff
path: root/key-string.c
diff options
context:
space:
mode:
authorThomas Adam <thomas@xteddy.org>2015-11-14 12:01:09 +0000
committerThomas Adam <thomas@xteddy.org>2015-11-14 12:01:09 +0000
commitf12d7f0d4b4a474acbdec0023156a6a647aa7763 (patch)
tree3b82cd796b067638932a9f2432b8a64ecf55f7f7 /key-string.c
parent7b4b78b41943082663ba75c7dcfb4e2efa86f4c7 (diff)
parent205d15e82d9e4aa90c7980b509d3489ad8eb6c2a (diff)
downloadrtmux-f12d7f0d4b4a474acbdec0023156a6a647aa7763.tar.gz
rtmux-f12d7f0d4b4a474acbdec0023156a6a647aa7763.tar.bz2
rtmux-f12d7f0d4b4a474acbdec0023156a6a647aa7763.zip
Merge branch 'obsd-master'
Diffstat (limited to 'key-string.c')
-rw-r--r--key-string.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/key-string.c b/key-string.c
index ad7cbf50..9a44892d 100644
--- a/key-string.c
+++ b/key-string.c
@@ -144,10 +144,11 @@ key_string_lookup_string(const char *string)
static const char *other = "!#()+,-.0123456789:;<=>?'\r\t";
key_code key;
u_short u;
- int size, more;
+ int size;
key_code modifiers;
struct utf8_data ud;
u_int i;
+ enum utf8_state more;
/* Is this a hexadecimal value? */
if (string[0] == '0' && string[1] == 'x') {
@@ -173,13 +174,12 @@ key_string_lookup_string(const char *string)
return (KEYC_NONE);
} else {
/* Try as a UTF-8 key. */
- if (utf8_open(&ud, (u_char)*string)) {
+ if ((more = utf8_open(&ud, (u_char)*string)) == UTF8_MORE) {
if (strlen(string) != ud.size)
return (KEYC_NONE);
- more = 1;
for (i = 1; i < ud.size; i++)
more = utf8_append(&ud, (u_char)string[i]);
- if (more != 0)
+ if (more != UTF8_DONE)
return (KEYC_NONE);
key = utf8_combine(&ud);
return (key | modifiers);
@@ -256,7 +256,7 @@ key_string_lookup_key(key_code key)
/* Is this a UTF-8 key? */
if (key > 127 && key < KEYC_BASE) {
- if (utf8_split(key, &ud) == 0) {
+ if (utf8_split(key, &ud) == UTF8_DONE) {
memcpy(out, ud.data, ud.size);
out[ud.size] = '\0';
return (out);