aboutsummaryrefslogtreecommitdiff
path: root/libi3
diff options
context:
space:
mode:
authorAlan Barr <a.barr@outlook.com>2018-10-13 19:04:40 +0100
committerOrestis <orestisf1993@gmail.com>2018-10-13 21:04:40 +0300
commit7c0994dafc91944477e03700304b2308b0e3fdb1 (patch)
treec883c518b2c6f2c325caf09aafb4660ace39a337 /libi3
parentdfe89cc4f1706a6fae0ae3816787d0fb22dadd7d (diff)
downloadi3-7c0994dafc91944477e03700304b2308b0e3fdb1.tar.gz
i3-7c0994dafc91944477e03700304b2308b0e3fdb1.zip
Fixes for undefined behaviour on signed shift (#3453)
Fixes for undefined behaviour on signed shift Change literal 1 to unsigned to allow safe bitshift of 31. Caught by cppcheck. Make 0xFF unsigned to prevent a left shift into signed bit. Spotted by @orestisf1993
Diffstat (limited to 'libi3')
-rw-r--r--libi3/get_colorpixel.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libi3/get_colorpixel.c b/libi3/get_colorpixel.c
index afba202b..49a9e3b4 100644
--- a/libi3/get_colorpixel.c
+++ b/libi3/get_colorpixel.c
@@ -43,7 +43,7 @@ uint32_t get_colorpixel(const char *hex) {
/* Shortcut: if our screen is true color, no need to do a roundtrip to X11 */
if (root_screen == NULL || root_screen->root_depth == 24 || root_screen->root_depth == 32) {
- return (0xFF << 24) | (r << 16 | g << 8 | b);
+ return (0xFFUL << 24) | (r << 16 | g << 8 | b);
}
/* Lookup this colorpixel in the cache */