Commit 2bb498a4 authored by Ulrich Sibiller's avatar Ulrich Sibiller Committed by Mike Gabriel

Keyboard.c: fix another cppcheck finding

[Keyboard.c:559]: (error) Shifting signed 32-bit value by 31 bits is undefined behaviour
parent 5be6d271
...@@ -555,8 +555,9 @@ void nxagentChangeKeyboardControl(DeviceIntPtr pDev, KeybdCtrl *ctrl) ...@@ -555,8 +555,9 @@ void nxagentChangeKeyboardControl(DeviceIntPtr pDev, KeybdCtrl *ctrl)
for (int i = 1; i <= 32; i++) for (int i = 1; i <= 32; i++)
{ {
unsigned int mask = (unsigned int)1 << (i - 1);
values.led = i; values.led = i;
values.led_mode = (ctrl->leds & (1 << (i - 1))) ? LedModeOn : LedModeOff; values.led_mode = (ctrl->leds & mask) ? LedModeOn : LedModeOff;
XChangeKeyboardControl(nxagentDisplay, value_mask, &values); XChangeKeyboardControl(nxagentDisplay, value_mask, &values);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment