chiark / gitweb /
Replace bare "unsigned" as a type name with "unsigned int"
authorBen Harris <bjh21@bjh21.me.uk>
Mon, 17 Nov 2025 21:41:00 +0000 (21:41 +0000)
committerBen Harris <bjh21@bjh21.me.uk>
Tue, 13 Jan 2026 21:55:10 +0000 (21:55 +0000)
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.

bedstead.c

index ce1e1e15ff3c1cc5c6f8c4816ed22bac7487c541..2dea36bb754897993dd55ce95140fb8bde7155ce 100644 (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);
 }