Replace bare "unsigned" as a type name with "unsigned int"

I noticed some occasions where my attempts at 16-bit cleanliness had
failed because I hadn't noticed that "unsigned" was a species of "int"
and hence potentially only 16 bits.  So now I'm trying to be more
explicit and saying "unsigned int".

Next several of them will need to be replaced with something else.
This commit is contained in:
Ben Harris 2025-11-17 21:41:00 +00:00
parent 20d377ccb6
commit 51ffa3eb33

View File

@ -3280,7 +3280,7 @@ static void bdf_gen(int size);
static void doglyph(struct glyph *);
static bool
getpix(unsigned char const data[YSIZE - 1], int x, int y, unsigned flags)
getpix(unsigned char const data[YSIZE - 1], int x, int y, unsigned int flags)
{
/*
@ -3312,7 +3312,7 @@ get_fullname(void)
len = snprintf(fullname, sizeof(fullname),
FAMILY_NAME "%s%s", weight->suffix, width->suffix);
assert(len >= 0 && (unsigned)len < sizeof(fullname));
assert(len >= 0 && (unsigned int)len < sizeof(fullname));
return fullname;
}
@ -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)a->unicode < (unsigned)b->unicode) return -1;
if ((unsigned)a->unicode > (unsigned)b->unicode) return +1;
if ((unsigned int)a->unicode < (unsigned int)b->unicode) return -1;
if ((unsigned int)a->unicode > (unsigned int)b->unicode) return +1;
/* Finally sort by glyph name for an arbitrary stable order. */
return namecmp(a->name, b->name);
}
@ -5103,7 +5103,7 @@ tile(int x0, int y0, int x1, int y1)
static void
domosaic(struct glyph *g)
{
unsigned code = g->data[0];
unsigned int code = g->data[0];
bool sep = (g->flags & SEP) != 0;
clearpath();
@ -5121,7 +5121,7 @@ domosaic(struct glyph *g)
static void
domosaic4(struct glyph *g)
{
unsigned code = g->data[0];
unsigned int code = g->data[0];
bool sep = (g->flags & SEP) != 0;
clearpath();
@ -5137,7 +5137,7 @@ domosaic4(struct glyph *g)
static void
domosaic8(struct glyph *g)
{
unsigned code = g->data[0];
unsigned int code = g->data[0];
clearpath();
if (code & 1) tile(0, 7, 3, 10);
@ -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 so -1 sorts last. */
if ((unsigned)a->unicode < (unsigned)b->unicode) return -1;
if ((unsigned)a->unicode > (unsigned)b->unicode) return +1;
/* 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;
return namecmp(a->name, b->name);
}