tools: Get rid of -Wno-sign-compare

Fix the sign comparison warnings by changing some types, and
using a few casts.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
This commit is contained in:
Ville Syrjälä 2019-09-16 16:20:44 +03:00
parent 97058e38d8
commit bfeeae4de9
3 changed files with 10 additions and 12 deletions

View File

@ -51,7 +51,7 @@ int main(int argc, char *argv[])
if (snprintf(buf, sizeof(buf), if (snprintf(buf, sizeof(buf),
"/sys/class/backlight/%s/brightness", "/sys/class/backlight/%s/brightness",
argv[1]) >= sizeof(buf)) argv[1]) >= (int)sizeof(buf))
die("Invalid interface '%s': name too long\n", argv[1]); die("Invalid interface '%s': name too long\n", argv[1]);
fd = open(buf, O_RDWR); fd = open(buf, O_RDWR);

View File

@ -17,7 +17,6 @@ if with_tools
], ],
c_args : [ c_args : [
'-Wno-unused-parameter', '-Wno-unused-parameter',
'-Wno-sign-compare',
], ],
install : true) install : true)
@ -81,7 +80,6 @@ if with_backlight_helper
install_mode : [ 'rws--x--x', 'root', 'root' ], install_mode : [ 'rws--x--x', 'root', 'root' ],
c_args : [ c_args : [
'-DMAJOR_IN_SYSMACROS', '-DMAJOR_IN_SYSMACROS',
'-Wno-sign-compare',
], ],
install : true) install : true)

View File

@ -121,7 +121,7 @@ struct display {
int cursor_y; int cursor_y;
int cursor_moved; int cursor_moved;
int cursor_visible; int cursor_visible;
int cursor; Cursor cursor;
int flush; int flush;
int send; int send;
@ -148,7 +148,7 @@ struct output {
Pixmap pixmap; Pixmap pixmap;
GC gc; GC gc;
long serial; unsigned long serial;
int use_shm; int use_shm;
int use_shm_pixmap; int use_shm_pixmap;
XShmSegmentInfo shm; XShmSegmentInfo shm;
@ -166,7 +166,7 @@ struct clone {
struct clone *active; struct clone *active;
struct output src, dst; struct output src, dst;
long timestamp; Time timestamp;
XShmSegmentInfo shm; XShmSegmentInfo shm;
XImage image; XImage image;
@ -194,8 +194,8 @@ struct context {
int timer_active; int timer_active;
long timestamp; Time timestamp;
long configTimestamp; Time configTimestamp;
Atom singleton; Atom singleton;
char command[1024]; char command[1024];
@ -597,7 +597,7 @@ static int mode_equal(const XRRModeInfo *a, const XRRModeInfo *b)
a->modeFlags == b->modeFlags); a->modeFlags == b->modeFlags);
} }
static XRRModeInfo *lookup_mode(XRRScreenResources *res, int id) static XRRModeInfo *lookup_mode(XRRScreenResources *res, RRMode id)
{ {
int i; int i;
@ -3055,7 +3055,7 @@ static int first_display_send_command(struct context *ctx, int timeout,
va_start(va, format); va_start(va, format);
len = vsnprintf(buf+4, sizeof(buf)-4, format, va)+5; len = vsnprintf(buf+4, sizeof(buf)-4, format, va)+5;
va_end(va); va_end(va);
assert(len < sizeof(buf)); assert(len < (int)sizeof(buf));
DBG(X11, ("%s: send command '%s'\n", DisplayString(display->dpy), buf)); DBG(X11, ("%s: send command '%s'\n", DisplayString(display->dpy), buf));
@ -3063,7 +3063,7 @@ static int first_display_send_command(struct context *ctx, int timeout,
while (len) { while (len) {
XClientMessageEvent msg; XClientMessageEvent msg;
int n = len; int n = len;
if (n > sizeof(msg.data.b)) if (n > (int)sizeof(msg.data.b))
n = sizeof(msg.data.b); n = sizeof(msg.data.b);
len -= n; len -= n;
@ -3113,7 +3113,7 @@ static void first_display_handle_command(struct context *ctx,
for (len = 0; len < 20 && msg[len]; len++) for (len = 0; len < 20 && msg[len]; len++)
; ;
if (ctx->command_continuation + len > sizeof(ctx->command)) { if (ctx->command_continuation + len > (int)sizeof(ctx->command)) {
ctx->command_continuation = 0; ctx->command_continuation = 0;
return; return;
} }