summaryrefslogtreecommitdiff
path: root/console-client
diff options
context:
space:
mode:
Diffstat (limited to 'console-client')
-rw-r--r--console-client/xkb/kstoucs.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/console-client/xkb/kstoucs.c b/console-client/xkb/kstoucs.c
index fb62445e..eb47bdeb 100644
--- a/console-client/xkb/kstoucs.c
+++ b/console-client/xkb/kstoucs.c
@@ -17,15 +17,15 @@ find_ucs (int keysym, struct ksmap *first, struct ksmap *last)
if (middle->keysym == keysym)
return middle->ucs; /* base case: needle found. */
- else if (first == last /* empty search space */
- || keysym < first->keysym /* lookup failure */
- || keysym > last->keysym) /* lookup failure */
+ else if (first == last) /* empty search space */
return 0;
/* recursive cases: halve search space. */
else if (middle->keysym < keysym)
return find_ucs (keysym, middle+1, last);
else if (middle->keysym > keysym)
- return find_ucs (keysym, first, middle-1);
+ /* don't remove middle from the range to compensate
+ for rounding down in it's calculation */
+ return find_ucs (keysym, first, middle);
return 0;
}