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.
This commit is contained in:
Ben Harris 2025-11-17 21:48:40 +00:00
parent 51ffa3eb33
commit 0d85d45857

View File

@ -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);
}