libobs: Fix XCB keyboard mapping size calculation

This commit is contained in:
Tatsuyuki Ishi 2017-08-07 17:43:50 +09:00
parent 91c292d394
commit 7d1fde3529

View File

@ -594,7 +594,7 @@ static inline bool fill_keycodes(struct obs_core_hotkeys *hotkeys)
context->min_keycode = setup->min_keycode;
cookie = xcb_get_keyboard_mapping(connection,
mincode, maxcode - mincode - 1);
mincode, maxcode - mincode + 1);
reply = xcb_get_keyboard_mapping_reply(connection, cookie, &error);
@ -606,7 +606,7 @@ static inline bool fill_keycodes(struct obs_core_hotkeys *hotkeys)
const xcb_keysym_t *keysyms = xcb_get_keyboard_mapping_keysyms(reply);
int syms_per_code = (int)reply->keysyms_per_keycode;
context->num_keysyms = (maxcode - mincode) * syms_per_code;
context->num_keysyms = (maxcode - mincode + 1) * syms_per_code;
context->syms_per_code = syms_per_code;
context->keysyms = bmemdup(keysyms,
sizeof(xcb_keysym_t) * context->num_keysyms);