[X2Go-Commits] [nx-libs] 113/219: Keyboard.c: fix another cppcheck finding

git-admin at x2go.org git-admin at x2go.org
Sat Sep 28 12:10:32 CEST 2019


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch 3.6.x
in repository nx-libs.

commit 2bb498a4c767b7d12db84e59b77020bcd70a057c
Author: Ulrich Sibiller <uli42 at gmx.de>
Date:   Fri Jun 21 11:38:39 2019 +0200

    Keyboard.c: fix another cppcheck finding
    
    [Keyboard.c:559]: (error) Shifting signed 32-bit value by 31 bits is undefined behaviour
---
 nx-X11/programs/Xserver/hw/nxagent/Keyboard.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

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);
     }

--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/nx-libs.git


More information about the x2go-commits mailing list