From: Ben Harris Date: Mon, 17 Nov 2025 21:48:40 +0000 (+0000) Subject: Use "unsigned long" when we need an unsigned Unicode type X-Git-Tag: bedstead-3.261~16 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~bjharris/git?a=commitdiff_plain;h=0d85d4585707587bb59be8b935e1c006c88818ec;p=bedstead.git 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. --- 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); }