This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch master
in repository legacy-imlib2.
View the commit online.
commit 207cffb20700cfc909fa1dc4822592e3ff294594
Author: Kim Woelders <k...@woelders.dk>
AuthorDate: Fri Jan 13 10:54:16 2023 +0100
Avoid some more undefined behaviors with shifts
---
src/lib/Imlib2_Loader.h | 2 +-
src/lib/common.h | 2 +-
src/modules/loaders/loader_ico.c | 7 ++++---
3 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/src/lib/Imlib2_Loader.h b/src/lib/Imlib2_Loader.h
index fe01dfa..6bd4c36 100644
--- a/src/lib/Imlib2_Loader.h
+++ b/src/lib/Imlib2_Loader.h
@@ -58,7 +58,7 @@ typedef struct _ImlibImage ImlibImage;
#define SWAP_LE_32_INPLACE(x)
#endif
-#define PIXEL_ARGB(a, r, g, b) ((a) << 24) | ((r) << 16) | ((g) << 8) | (b)
+#define PIXEL_ARGB(a, r, g, b) ((uint32_t)(a) << 24) | ((r) << 16) | ((g) << 8) | (b)
#define PIXEL_A(argb) (((argb) >> 24) & 0xff)
#define PIXEL_R(argb) (((argb) >> 16) & 0xff)
diff --git a/src/lib/common.h b/src/lib/common.h
index 6e4a236..86c9b03 100644
--- a/src/lib/common.h
+++ b/src/lib/common.h
@@ -36,7 +36,7 @@
#define SWAP_LE_32_INPLACE(x)
#endif
-#define PIXEL_ARGB(a, r, g, b) ((a) << 24) | ((r) << 16) | ((g) << 8) | (b)
+#define PIXEL_ARGB(a, r, g, b) ((uint32_t)(a) << 24) | ((r) << 16) | ((g) << 8) | (b)
#define PIXEL_A(argb) (((argb) >> 24) & 0xff)
#define PIXEL_R(argb) (((argb) >> 16) & 0xff)
diff --git a/src/modules/loaders/loader_ico.c b/src/modules/loaders/loader_ico.c
index 13df3e2..7301e49 100644
--- a/src/modules/loaders/loader_ico.c
+++ b/src/modules/loaders/loader_ico.c
@@ -414,11 +414,12 @@ _load(ImlibImage * im, int load_data)
{
psrc = &pxls[(y * w + x) * ie->bih.bpp / 8];
- pixel = PIXEL_ARGB(0, psrc[2], psrc[1], psrc[0]);
+ i = 0;
if (ie->bih.bpp == 32)
- pixel |= psrc[3] << 24;
+ i = psrc[3];
else if (ico_data_get_bit(mask, w, x, y) == 0)
- pixel |= 0xff000000;
+ i = 0xff;
+ pixel = PIXEL_ARGB(i, psrc[2], psrc[1], psrc[0]);
*pdst++ = pixel;
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.