diff options
author | Henrik Andersson <hean01@cendio.com> | 2017-10-20 12:13:21 +0200 |
---|---|---|
committer | Henrik Andersson <hean01@cendio.com> | 2017-10-20 13:30:42 +0200 |
commit | 0d707ae103dc86db9a1c1c99bc709c24b373062b (patch) | |
tree | 410aa59e4433ae2bf5a0e924a67d6a7de41889aa | |
parent | 896a923f55f8d035eb20e517e743be1ce117fd5c (diff) | |
download | rdesktop-0d707ae103dc86db9a1c1c99bc709c24b373062b.zip |
Fix sign-compare compiler warnings
-rw-r--r-- | disk.c | 2 | ||||
-rw-r--r-- | ewmhints.c | 9 | ||||
-rw-r--r-- | printer.c | 2 | ||||
-rw-r--r-- | proto.h | 20 | ||||
-rw-r--r-- | rdpdr.c | 12 | ||||
-rw-r--r-- | rdpsnd_alsa.c | 6 | ||||
-rw-r--r-- | scard.c | 16 | ||||
-rw-r--r-- | serial.c | 4 | ||||
-rw-r--r-- | stream.c | 5 | ||||
-rw-r--r-- | utils.c | 5 | ||||
-rw-r--r-- | xclip.c | 4 | ||||
-rw-r--r-- | xwin.c | 28 |
12 files changed, 56 insertions, 57 deletions
@@ -349,7 +349,7 @@ static RD_NTSTATUS disk_create(uint32 device_id, uint32 accessmask, uint32 sharemode, uint32 create_disposition, uint32 flags_and_attributes, char *filename, RD_NTHANDLE * phandle) { - RD_NTHANDLE handle; + int handle; DIR *dirp; int flags, mode; char path[PATH_MAX]; @@ -246,7 +246,7 @@ ewmh_modify_state(Window wnd, int add, Atom atom1, Atom atom2) XEvent xevent; int result; - unsigned long nitems; + unsigned long i, nitems; unsigned char *props; uint32 state = WithdrawnState; @@ -281,7 +281,6 @@ ewmh_modify_state(Window wnd, int add, Atom atom1, Atom atom2) else { Atom *atoms; - int i; if (get_property_value(wnd, "_NET_WM_STATE", 64, &nitems, &props, 1) < 0) return 0; @@ -438,7 +437,7 @@ ewmh_set_window_modal(Window wnd) } void -ewmh_set_icon(Window wnd, int width, int height, const char *rgba_data) +ewmh_set_icon(Window wnd, uint32 width, uint32 height, const char *rgba_data) { unsigned long nitems, i; unsigned char *props; @@ -481,7 +480,7 @@ ewmh_set_icon(Window wnd, int width, int height, const char *rgba_data) icon[1] = height; /* Convert RGBA -> ARGB */ - for (i = 0; i < width * height; i++) + for (i = 0; i < (width * height); i++) { icon[i + 2] = rgba_data[i * 4 + 3] << 24 | @@ -500,7 +499,7 @@ ewmh_set_icon(Window wnd, int width, int height, const char *rgba_data) } void -ewmh_del_icon(Window wnd, int width, int height) +ewmh_del_icon(Window wnd, uint32 width, uint32 height) { unsigned long nitems, i, icon_size; unsigned char *props; @@ -40,7 +40,7 @@ printer_enum_devices(uint32 * id, char *optarg) char *pos = optarg; char *pos2; - int count = 0; + size_t count = 0; int already = 0; /* we need to know how many printers we've already set up @@ -271,7 +271,7 @@ void ui_paint_bitmap(int x, int y, int cx, int cy, int width, int height, uint8 void ui_destroy_bitmap(RD_HBITMAP bmp); RD_HGLYPH ui_create_glyph(int width, int height, uint8 * data); void ui_destroy_glyph(RD_HGLYPH glyph); -RD_HCURSOR ui_create_cursor(unsigned int x, unsigned int y, int width, int height, uint8 * andmask, +RD_HCURSOR ui_create_cursor(unsigned int x, unsigned int y, uint32 width, uint32 height, uint8 * andmask, uint8 * xormask, int bpp); void ui_set_cursor(RD_HCURSOR cursor); void ui_destroy_cursor(RD_HCURSOR cursor); @@ -284,24 +284,24 @@ void ui_set_clip(int x, int y, int cx, int cy); void ui_reset_clip(void); void ui_bell(void); void ui_destblt(uint8 opcode, int x, int y, int cx, int cy); -void ui_patblt(uint8 opcode, int x, int y, int cx, int cy, BRUSH * brush, int bgcolour, - int fgcolour); +void ui_patblt(uint8 opcode, int x, int y, int cx, int cy, BRUSH * brush, uint32 bgcolour, + uint32 fgcolour); void ui_screenblt(uint8 opcode, int x, int y, int cx, int cy, int srcx, int srcy); void ui_memblt(uint8 opcode, int x, int y, int cx, int cy, RD_HBITMAP src, int srcx, int srcy); void ui_triblt(uint8 opcode, int x, int y, int cx, int cy, RD_HBITMAP src, int srcx, int srcy, - BRUSH * brush, int bgcolour, int fgcolour); + BRUSH * brush, uint32 bgcolour, uint32 fgcolour); void ui_line(uint8 opcode, int startx, int starty, int endx, int endy, PEN * pen); -void ui_rect(int x, int y, int cx, int cy, int colour); +void ui_rect(int x, int y, int cx, int cy, uint32 colour); void ui_polygon(uint8 opcode, uint8 fillmode, RD_POINT * point, int npoints, BRUSH * brush, - int bgcolour, int fgcolour); + uint32 bgcolour, uint32 fgcolour); void ui_polyline(uint8 opcode, RD_POINT * points, int npoints, PEN * pen); void ui_ellipse(uint8 opcode, uint8 fillmode, int x, int y, int cx, int cy, BRUSH * brush, - int bgcolour, int fgcolour); + uint32 bgcolour, uint32 fgcolour); void ui_draw_glyph(int mixmode, int x, int y, int cx, int cy, RD_HGLYPH glyph, int srcx, int srcy, - int bgcolour, int fgcolour); + uint32 bgcolour, uint32 fgcolour); void ui_draw_text(uint8 font, uint8 flags, uint8 opcode, int mixmode, int x, int y, int clipx, int clipy, int clipcx, int clipcy, int boxx, int boxy, int boxcx, int boxcy, - BRUSH * brush, int bgcolour, int fgcolour, uint8 * text, uint8 length); + BRUSH * brush, uint32 bgcolour, uint32 fgcolour, uint8 * text, uint8 length); void ui_desktop_save(uint32 offset, int x, int y, int cx, int cy); void ui_desktop_restore(uint32 offset, int x, int y, int cx, int cy); void ui_begin_update(void); @@ -316,7 +316,7 @@ void ui_seamless_create_window(unsigned long id, unsigned long group, unsigned l void ui_seamless_destroy_window(unsigned long id, unsigned long flags); void ui_seamless_destroy_group(unsigned long id, unsigned long flags); void ui_seamless_seticon(unsigned long id, const char *format, int width, int height, int chunk, - const char *data, int chunk_len); + const char *data, size_t chunk_len); void ui_seamless_delicon(unsigned long id, const char *format, int width, int height); void ui_seamless_move_window(unsigned long id, int x, int y, int width, int height, unsigned long flags); @@ -123,7 +123,7 @@ convert_to_unix_filename(char *filename) } static RD_BOOL -rdpdr_handle_ok(int device, int handle) +rdpdr_handle_ok(uint32 device, RD_NTHANDLE handle) { switch (g_rdpdr_device[device].device_type) { @@ -234,10 +234,10 @@ rdpdr_send_client_name_request(void) } /* Returns the size of the payload of the announce packet */ -static int +static size_t announcedata_size() { - int size, i; + size_t size, i; PRINTER *printerinfo; DISK_DEVICE *diskinfo; @@ -280,7 +280,7 @@ rdpdr_send_client_device_list_announce(void) { /* DR_CORE_CLIENT_ANNOUNCE_RSP */ uint32 bloblen, disklen, flags; - int i; + size_t i; STREAM s; PRINTER *printerinfo; DISK_DEVICE *diskinfo; @@ -947,7 +947,7 @@ rdpdr_add_fds(int *n, fd_set * rfds, fd_set * wfds, struct timeval *tv, RD_BOOL support for reconnects. */ FD_SET(iorq->fd, rfds); - *n = MAX(*n, iorq->fd); + *n = MAX(*n, (int)iorq->fd); /* Check if io request timeout is smaller than current (but not 0). */ if (iorq->timeout @@ -982,7 +982,7 @@ rdpdr_add_fds(int *n, fd_set * rfds, fd_set * wfds, struct timeval *tv, RD_BOOL break; FD_SET(iorq->fd, wfds); - *n = MAX(*n, iorq->fd); + *n = MAX(*n, (int)iorq->fd); break; case IRP_MJ_DEVICE_CONTROL: diff --git a/rdpsnd_alsa.c b/rdpsnd_alsa.c index f5a0bcd..f68562a 100644 --- a/rdpsnd_alsa.c +++ b/rdpsnd_alsa.c @@ -33,10 +33,10 @@ #define MAX_FRAMES 32 static struct pollfd pfds_out[32]; -static int num_fds_out; +static size_t num_fds_out; static struct pollfd pfds_in[32]; -static int num_fds_in; +static size_t num_fds_in; static snd_pcm_t *out_handle = NULL; static snd_pcm_t *in_handle = NULL; @@ -359,7 +359,7 @@ alsa_play(void) STREAM out; int len; static long prev_s, prev_us; - unsigned int duration; + int duration; struct timeval tv; int next_tick; @@ -537,7 +537,7 @@ outBufferStart(STREAM out, int length) static void outBufferFinishWithLimit(STREAM out, char *buffer, unsigned int length, unsigned int highLimit) { - int header = (length < 0) ? (0) : ((length > highLimit) ? (highLimit) : (length)); + unsigned int header = (length > highLimit) ? (highLimit) : (length); out_uint32_le(out, header); if (length <= 0) @@ -579,7 +579,7 @@ inString(PMEM_HANDLE * handle, STREAM in, char **destination, SERVER_DWORD dataL if (wide) { - int i; + unsigned int i; in_uint8a(in, buffer, 2 * dataLength); for (i = 0; i < dataLength; i++) if ((buffer[2 * i] < 0) || (buffer[2 * i + 1] != 0)) @@ -613,7 +613,7 @@ outString(STREAM out, char *source, RD_BOOL wide) if (wide) { - int i; + unsigned int i; char *buffer = SC_xmalloc(&lcHandle, Result); for (i = 0; i < dataLength; i++) @@ -1320,7 +1320,7 @@ TS_SCardCancel(STREAM in, STREAM out) static MYPCSC_DWORD TS_SCardLocateCardsByATR(STREAM in, STREAM out, RD_BOOL wide) { - int i, j, k; + unsigned int i, j, k; MYPCSC_DWORD rv; SERVER_SCARDCONTEXT hContext; MYPCSC_SCARDCONTEXT myHContext; @@ -1752,9 +1752,9 @@ TS_SCardStatus(STREAM in, STREAM out, RD_BOOL wide) "TS_SCardStatus(), hcard: 0x%08x [0x%08lx], reader len: %d bytes, atr len: %d bytes", (unsigned) hCard, (unsigned long) myHCard, (int) dwReaderLen, (int) dwAtrLen); - if (dwReaderLen <= 0 || dwReaderLen == SCARD_AUTOALLOCATE || dwReaderLen > SCARD_MAX_MEM) + if (dwReaderLen == 0 || dwReaderLen == (SERVER_DWORD)SCARD_AUTOALLOCATE || dwReaderLen > SCARD_MAX_MEM) dwReaderLen = SCARD_MAX_MEM; - if (dwAtrLen <= 0 || dwAtrLen == SCARD_AUTOALLOCATE || dwAtrLen > SCARD_MAX_MEM) + if (dwAtrLen == 0 || dwAtrLen == (SERVER_DWORD)SCARD_AUTOALLOCATE || dwAtrLen > SCARD_MAX_MEM) dwAtrLen = SCARD_MAX_MEM; #if 1 @@ -1869,7 +1869,7 @@ TS_SCardState(STREAM in, STREAM out) (unsigned) hCard, (unsigned long) myHCard, (int) dwAtrLen); dwReaderLen = SCARD_MAX_MEM; - if (dwAtrLen <= 0 || dwAtrLen == SCARD_AUTOALLOCATE || dwAtrLen > SCARD_MAX_MEM) + if (dwAtrLen <= 0 || dwAtrLen == (SERVER_DWORD)SCARD_AUTOALLOCATE || dwAtrLen > SCARD_MAX_MEM) dwAtrLen = SCARD_MAX_MEM; readerName = SC_xmalloc(&lcHandle, dwReaderLen + 2); @@ -2244,7 +2244,7 @@ TS_SCardControl(STREAM in, STREAM out) #ifdef PCSCLITE_VERSION_NUMBER if (dwControlCode == SCARD_CTL_CODE(3400)) { - int i; + unsigned int i; SERVER_DWORD cc; for (i = 0; i < nBytesReturned / 6; i++) @@ -557,12 +557,12 @@ serial_create(uint32 device_id, uint32 access, uint32 share_mode, uint32 disposi UNUSED(disposition); UNUSED(flags_and_attributes); UNUSED(filename); - RD_NTHANDLE serial_fd; + int serial_fd; SERIAL_DEVICE *pser_inf; pser_inf = (SERIAL_DEVICE *) g_rdpdr_device[device_id].pdevice_data; - serial_fd = open(g_rdpdr_device[device_id].local_path, O_RDWR | O_NOCTTY | O_NONBLOCK); + serial_fd = open(g_rdpdr_device[device_id].local_path, O_RDWR | O_NOCTTY | O_NONBLOCK); if (serial_fd == -1) { logger(Core, Error, "serial_create(), open '%s' failed: %s", @@ -97,7 +97,7 @@ _out_utf16s(STREAM s, size_t maxlength, const char *string) } ibl = strlen(string); - obl = maxlength ? maxlength : s_left(s); + obl = maxlength ? maxlength : (size_t)s_left(s); pin = string; pout = (char *) s->p; @@ -122,8 +122,7 @@ _out_utf16s(STREAM s, size_t maxlength, const char *string) void out_utf16s_padded(STREAM s, const char *string, size_t length, unsigned char pad) { - int i; - size_t bl; + size_t i, bl; bl = _out_utf16s(s, length - 2, string); // append utf16 null termination @@ -77,7 +77,8 @@ utils_string_escape(const char *str) char * utils_string_unescape(const char *str) { - char *ns, *ps, *pd, c; + char *ns, *ps, *pd; + unsigned char c; ns = xmalloc(strlen(str) + 1); memcpy(ns, str, strlen(str) + 1); @@ -90,7 +91,7 @@ utils_string_unescape(const char *str) { if (sscanf(ps, "%%%2hhX", &c) == 1) { - pd[0] = c; + pd[0] = (char)c; ps += 3; pd++; continue; @@ -506,11 +506,11 @@ xclip_probe_selections() void xclip_handle_SelectionNotify(XSelectionEvent * event) { - unsigned long nitems, bytes_left; + unsigned long i, nitems, bytes_left; XWindowAttributes wa; Atom type; Atom *supported_targets; - int res, i, format; + int res, format; uint8 *data = NULL; if (event->property == None) @@ -2973,17 +2973,17 @@ xcursor_stencil(XcursorImage * src, XcursorImage * dst, int dx, int dy, uint32 a assert(src->width == dst->width); assert(src->height == dst->height); - for (y = 0; y < src->height; y++) + for (y = 0; y < (int)src->height; y++) { - for (x = 0; x < src->width; x++) + for (x = 0; x < (int)src->width; x++) { si = y * src->width + x; if (!src->pixels[si]) continue; - if ((y + dy) < 0 || (y + dy) >= dst->height) + if ((y + dy) < 0 || (y + dy) >= (int)dst->height) continue; - if ((x + dx) < 0 || (x + dx) >= dst->width) + if ((x + dx) < 0 || (x + dx) >= (int)dst->width) continue; di = (y + dy) * src->width + (x + dx); dst->pixels[di] = argb; @@ -3006,8 +3006,8 @@ xcursor_merge(XcursorImage * src, XcursorImage * dst) } RD_HCURSOR -ui_create_cursor(unsigned int xhot, unsigned int yhot, int width, - int height, uint8 * andmask, uint8 * xormask, int bpp) +ui_create_cursor(unsigned int xhot, unsigned int yhot, uint32 width, + uint32 height, uint8 * andmask, uint8 * xormask, int bpp) { Cursor cursor; XcursorPixel *out; @@ -3294,7 +3294,7 @@ static uint8 hatch_patterns[] = { void ui_patblt(uint8 opcode, /* dest */ int x, int y, int cx, int cy, - /* brush */ BRUSH * brush, int bgcolour, int fgcolour) + /* brush */ BRUSH * brush, uint32 bgcolour, uint32 fgcolour) { Pixmap fill; uint8 i, ipattern[8]; @@ -3421,7 +3421,7 @@ void ui_triblt(uint8 opcode, /* dest */ int x, int y, int cx, int cy, /* src */ RD_HBITMAP src, int srcx, int srcy, - /* brush */ BRUSH * brush, int bgcolour, int fgcolour) + /* brush */ BRUSH * brush, uint32 bgcolour, uint32 fgcolour) { /* This is potentially difficult to do in general. Until someone comes up with a more efficient way of doing it I am using cases. */ @@ -3469,7 +3469,7 @@ ui_line(uint8 opcode, void ui_rect( /* dest */ int x, int y, int cx, int cy, - /* brush */ int colour) + /* brush */ uint32 colour) { SET_FOREGROUND(colour); FILL_RECTANGLE(x, y, cx, cy); @@ -3479,7 +3479,7 @@ void ui_polygon(uint8 opcode, /* mode */ uint8 fillmode, /* dest */ RD_POINT * point, int npoints, - /* brush */ BRUSH * brush, int bgcolour, int fgcolour) + /* brush */ BRUSH * brush, uint32 bgcolour, uint32 fgcolour) { uint8 style, i, ipattern[8]; Pixmap fill; @@ -3596,7 +3596,7 @@ void ui_ellipse(uint8 opcode, /* mode */ uint8 fillmode, /* dest */ int x, int y, int cx, int cy, - /* brush */ BRUSH * brush, int bgcolour, int fgcolour) + /* brush */ BRUSH * brush, uint32 bgcolour, uint32 fgcolour) { uint8 style, i, ipattern[8]; Pixmap fill; @@ -3683,7 +3683,7 @@ void ui_draw_glyph(int mixmode, /* dest */ int x, int y, int cx, int cy, /* src */ RD_HGLYPH glyph, int srcx, int srcy, - int bgcolour, int fgcolour) + uint32 bgcolour, uint32 fgcolour) { UNUSED(srcx); UNUSED(srcy); @@ -3739,7 +3739,7 @@ void ui_draw_text(uint8 font, uint8 flags, uint8 opcode, int mixmode, int x, int y, int clipx, int clipy, int clipcx, int clipcy, int boxx, int boxy, int boxcx, int boxcy, BRUSH * brush, - int bgcolour, int fgcolour, uint8 * text, uint8 length) + uint32 bgcolour, uint32 fgcolour, uint8 * text, uint8 length) { UNUSED(opcode); UNUSED(brush); @@ -4217,7 +4217,7 @@ ui_seamless_destroy_group(unsigned long id, unsigned long flags) void ui_seamless_seticon(unsigned long id, const char *format, int width, int height, int chunk, - const char *data, int chunk_len) + const char *data, size_t chunk_len) { seamless_window *sw; |