summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2022-10-15 12:10:09 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2022-10-15 12:10:09 -0700
commit43532f210bd0d5fbb89cbcae5989ce6c1cf2b7d6 (patch)
treec18ab6b4b6afb84dcfa2e9b025097ebc42798709
parent98c9bf1a07a342ffd86e8a96b9f6c8a24966816f (diff)
Handle -Wsign-compare warnings
xsetroot.c: In function ‘CreateCursorFromFiles’: xsetroot.c:426:31: warning: comparison of integer expressions of different signedness: ‘int’ and ‘unsigned int’ [-Wsign-compare] 426 | if ((x_hot < 0) || (x_hot >= width) || | ^~ xsetroot.c:427:31: warning: comparison of integer expressions of different signedness: ‘int’ and ‘unsigned int’ [-Wsign-compare] 427 | (y_hot < 0) || (y_hot >= height)) { | ^~ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--xsetroot.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/xsetroot.c b/xsetroot.c
index 21e8244..6b5d5c0 100644
--- a/xsetroot.c
+++ b/xsetroot.c
@@ -423,8 +423,8 @@ CreateCursorFromFiles(char *cursor_file, char *mask_file)
x_hot = BITMAP_HOT_DEFAULT;
y_hot = BITMAP_HOT_DEFAULT;
}
- if ((x_hot < 0) || (x_hot >= width) ||
- (y_hot < 0) || (y_hot >= height)) {
+ if ((x_hot < 0) || ((unsigned int)x_hot >= width) ||
+ (y_hot < 0) || ((unsigned int)y_hot >= height)) {
fprintf(stderr, "%s: hotspot is outside cursor bounds\n", program_name);
exit(1);
/*NOTREACHED*/