From fe69c7830bee4e06021b5c1421abe417575cacf5 Mon Sep 17 00:00:00 2001 From: Felix Palmen Date: Fri, 9 Aug 2024 11:53:16 +0200 Subject: [PATCH] Font: Explicitly use uint32_t to calculate bitmask Calculating the bitmask for the glyph id, explicitly use uint32_t which avoids signed/unsigned comparisons that might occur depending on the integer sizes of the target ABI when implicit conversions are applied. Relates: #5 --- src/bin/xmoji/font.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/bin/xmoji/font.c b/src/bin/xmoji/font.c index 2d61313..5da399c 100644 --- a/src/bin/xmoji/font.c +++ b/src/bin/xmoji/font.c @@ -226,7 +226,8 @@ static Font *createFromFile(const char *file, int index, char *id, } uint8_t glyphidbits = 1; uint32_t glyphidmask = 1; - while ((face->num_glyphs & glyphidmask) != face->num_glyphs) + while (((uint32_t)face->num_glyphs & glyphidmask) + != (uint32_t)face->num_glyphs) { ++glyphidbits; glyphidmask <<= 1;