From 0d85d4585707587bb59be8b935e1c006c88818ec Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Mon, 17 Nov 2025 21:48:40 +0000 Subject: [PATCH] Use "unsigned long" when we need an unsigned Unicode type On 16-bit systems, "unsigned int" won't get us beyond the Basic Multilingual Plane. --- bedstead.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bedstead.c b/bedstead.c index 2dea36b..e333594 100644 --- a/bedstead.c +++ b/bedstead.c @@ -3502,8 +3502,8 @@ compare_glyphs_by_ffid(const void *va, const void *vb) if (strcmp(a->name, ".notdef") == 0) return -1; if (strcmp(b->name, ".notdef") == 0) return +1; /* Then characters with Unicode code-points in order. */ - if ((unsigned int)a->unicode < (unsigned int)b->unicode) return -1; - if ((unsigned int)a->unicode > (unsigned int)b->unicode) return +1; + if ((unsigned long)a->unicode < (unsigned long)b->unicode) return -1; + if ((unsigned long)a->unicode > (unsigned long)b->unicode) return +1; /* Finally sort by glyph name for an arbitrary stable order. */ return namecmp(a->name, b->name); } @@ -5159,9 +5159,9 @@ byunicode(const void *va, const void *vb) struct glyph const *a = *(struct glyph const **)va, *b = *(struct glyph const **)vb; - /* Cast to unsigned int so -1 sorts last. */ - if ((unsigned int)a->unicode < (unsigned int)b->unicode) return -1; - if ((unsigned int)a->unicode > (unsigned int)b->unicode) return +1; + /* Cast to unsigned long so -1 sorts last. */ + if ((unsigned long)a->unicode < (unsigned long)b->unicode) return -1; + if ((unsigned long)a->unicode > (unsigned long)b->unicode) return +1; return namecmp(a->name, b->name); } -- 2.30.2