aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Sibiller <uli42@gmx.de>2019-06-21 11:38:39 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2019-06-22 11:30:54 +0200
commit2bb498a4c767b7d12db84e59b77020bcd70a057c (patch)
tree44e7421deede421b3e672b85729cc5e12d5f2b7c
parent5be6d271ba4f4c48d0441cf0ed3d8909a6ffd774 (diff)
downloadnx-libs-2bb498a4c767b7d12db84e59b77020bcd70a057c.tar.gz
nx-libs-2bb498a4c767b7d12db84e59b77020bcd70a057c.tar.bz2
nx-libs-2bb498a4c767b7d12db84e59b77020bcd70a057c.zip
Keyboard.c: fix another cppcheck finding
[Keyboard.c:559]: (error) Shifting signed 32-bit value by 31 bits is undefined behaviour
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Keyboard.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c
index 7330784de..8ff4528a1 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c
@@ -555,8 +555,9 @@ void nxagentChangeKeyboardControl(DeviceIntPtr pDev, KeybdCtrl *ctrl)
for (int i = 1; i <= 32; i++)
{
+ unsigned int mask = (unsigned int)1 << (i - 1);
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);
}