summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2022-08-13 18:04:41 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2022-08-13 18:04:41 -0700
commit7d35ec8371c7744359b9b63017e3851c46ad4c16 (patch)
tree68751cee52a43558f54c0eba3b1aea1e87edcba2
parent4618f9dbbcb93805b64d86fae3a1ec82f8f6849b (diff)
Take care of -Wsign-compare warnings
showfont.c: In function ‘show_glyphs’: showfont.c:218:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if (offset != offsets[ch].position) ^~ showfont.c:249:29: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if (offsets[ch].length != bottom * bpr) { ^~ showfont.c: In function ‘main’: showfont.c:456:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] ((unsigned)first_ch >= (first.low + (first.high << 8)))) { ^~ showfont.c:462:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] ((unsigned)end_ch <= (last.low + (last.high << 8)))) { ^~ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--showfont.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/showfont.c b/showfont.c
index 4e3b41f..7e7d7bb 100644
--- a/showfont.c
+++ b/showfont.c
@@ -167,7 +167,7 @@ show_glyphs(
FSChar2b last)
{
FSXCharInfo *extents;
- int offset = 0;
+ unsigned int offset = 0;
unsigned char *glyphs;
FSOffset *offsets;
int scanpad;
@@ -246,7 +246,7 @@ show_glyphs(
continue;
}
bpr = GLWIDTHBYTESPADDED(charwidth, scanpad);
- if (offsets[ch].length != bottom * bpr) {
+ if (offsets[ch].length != (unsigned)(bottom * bpr)) {
fprintf (stderr,
"length mismatch: expected %d (%dx%d), got %d\n",
bottom * bpr, bpr, bottom, offsets[ch].length);
@@ -453,13 +453,13 @@ main(int argc, char **argv)
printf("opened font %s\n", fontname);
show_info(fid, &hdr, &first, &last);
if (first_ch != 0 &&
- ((unsigned)first_ch >= (first.low + (first.high << 8)))) {
+ ((unsigned)first_ch >= (first.low + ((unsigned)first.high << 8)))) {
first.low = first_ch & 0xff;
first.high = first_ch >> 8;
show_all = False;
}
if (end_ch != ~0 &&
- ((unsigned)end_ch <= (last.low + (last.high << 8)))) {
+ ((unsigned)end_ch <= (last.low + ((unsigned)last.high << 8)))) {
last.low = end_ch & 0xff;
last.high = end_ch >> 8;
show_all = False;