From 70de4fa1f9b7cd74c8280aad0fee1db5616edd1c Mon Sep 17 00:00:00 2001 From: Jay Sorg Date: Mon, 19 May 2003 21:36:33 +0000 Subject: [PATCH] changes so it compiles with g++(mainly for ports) git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@375 423420c4-83ab-492f-b58f-81f9feb106b5 --- orders.c | 12 ++++++------ proto.h | 6 +++--- rdesktop.c | 13 ++++++------- rdp.c | 8 ++++---- secure.c | 2 +- tcp.c | 18 +++++++++--------- xkeymap.c | 4 ++-- xwin.c | 14 +++++++------- 8 files changed, 38 insertions(+), 39 deletions(-) diff --git a/orders.c b/orders.c index 6ba7e3e..65c432e 100644 --- a/orders.c +++ b/orders.c @@ -661,7 +661,7 @@ process_raw_bmpcache(STREAM s) in_uint8p(s, data, bufsize); DEBUG(("RAW_BMPCACHE(cx=%d,cy=%d,id=%d,idx=%d)\n", width, height, cache_id, cache_idx)); - inverted = xmalloc(width * height * Bpp); + inverted = (uint8*)xmalloc(width * height * Bpp); for (y = 0; y < height; y++) { memcpy(&inverted[(height - y - 1) * (width * Bpp)], &data[y * (width * Bpp)], @@ -684,7 +684,7 @@ process_bmpcache(STREAM s) uint16 bufsize, pad2, row_size, final_size; uint8 pad1; - pad2 = row_size = final_size = -1; /* Shut the compiler up */ + pad2 = row_size = final_size = 0xffff; /* Shut the compiler up */ in_uint8(s, cache_id); in_uint8(s, pad1); /* pad */ @@ -709,12 +709,12 @@ process_bmpcache(STREAM s) } in_uint8p(s, data, size); - DEBUG(("BMPCACHE(cx=%d,cy=%d,id=%d,idx=%d,bpp=%d,size=%d,pad1=%d,bufsize=%d,pad2=%d,rs=%d,fs=%d)\n", - width, height, + DEBUG(("BMPCACHE(cx=%d,cy=%d,id=%d,idx=%d,bpp=%d,size=%d,pad1=%d,bufsize=%d,pad2=%d,rs=%d,fs=%d)\n", + width, height, cache_id, cache_idx, bpp, size, pad1, bufsize, pad2, row_size, final_size)); - bmpdata = xmalloc(width * height * Bpp); + bmpdata = (uint8*)xmalloc(width * height * Bpp); if (bitmap_decompress(bmpdata, width, height, data, size, Bpp)) { @@ -742,7 +742,7 @@ process_colcache(STREAM s) in_uint8(s, cache_id); in_uint16_le(s, map.ncolours); - map.colours = xmalloc(3 * map.ncolours); + map.colours = (COLOURENTRY*)xmalloc(3 * map.ncolours); for (i = 0; i < map.ncolours; i++) { diff --git a/proto.h b/proto.h index 0d29ec7..b9d9c44 100644 --- a/proto.h +++ b/proto.h @@ -42,7 +42,7 @@ void xfree(void *mem); void error(char *format, ...); void warning(char *format, ...); void unimpl(char *format, ...); -void hexdump(unsigned char *p, unsigned int len); +void hexdump(unsigned char *p, int len); int load_licence(unsigned char **data); void save_licence(unsigned char *data, int length); /* rdp.c */ @@ -75,9 +75,9 @@ void sec_disconnect(void); void sec_process_mcs_data(STREAM s); void sec_decrypt(uint8 * data, int length); /* tcp.c */ -STREAM tcp_init(int maxlen); +STREAM tcp_init(uint32 maxlen); void tcp_send(STREAM s); -STREAM tcp_recv(int length); +STREAM tcp_recv(uint32 length); BOOL tcp_connect(char *server); void tcp_disconnect(void); /* xkeymap.c */ diff --git a/rdesktop.c b/rdesktop.c index c8c3148..343e2af 100644 --- a/rdesktop.c +++ b/rdesktop.c @@ -549,11 +549,10 @@ unimpl(char *format, ...) /* produce a hex dump */ void -hexdump(unsigned char *p, unsigned int len) +hexdump(unsigned char *p, int len) { unsigned char *line = p; - unsigned int thisline, offset = 0; - int i; + int i, thisline, offset = 0; while (offset < len) { @@ -589,7 +588,7 @@ load_licence(unsigned char **data) if (home == NULL) return -1; - path = xmalloc(strlen(home) + strlen(hostname) + sizeof("/.rdesktop/licence.")); + path = (char*)xmalloc(strlen(home) + strlen(hostname) + sizeof("/.rdesktop/licence.")); sprintf(path, "%s/.rdesktop/licence.%s", home, hostname); fd = open(path, O_RDONLY); @@ -599,7 +598,7 @@ load_licence(unsigned char **data) if (fstat(fd, &st)) return -1; - *data = xmalloc(st.st_size); + *data = (uint8*)xmalloc(st.st_size); length = read(fd, *data, st.st_size); close(fd); xfree(path); @@ -616,7 +615,7 @@ save_licence(unsigned char *data, int length) if (home == NULL) return; - path = xmalloc(strlen(home) + strlen(hostname) + sizeof("/.rdesktop/licence.")); + path = (char*)xmalloc(strlen(home) + strlen(hostname) + sizeof("/.rdesktop/licence.")); sprintf(path, "%s/.rdesktop", home); if ((mkdir(path, 0700) == -1) && errno != EEXIST) @@ -628,7 +627,7 @@ save_licence(unsigned char *data, int length) /* write licence to licence.hostname.new, then atomically rename to licence.hostname */ sprintf(path, "%s/.rdesktop/licence.%s", home, hostname); - tmppath = xmalloc(strlen(path) + sizeof(".new")); + tmppath = (char*)xmalloc(strlen(path) + sizeof(".new")); strcpy(tmppath, path); strcat(tmppath, ".new"); diff --git a/rdp.c b/rdp.c index eef0275..8049ce6 100644 --- a/rdp.c +++ b/rdp.c @@ -236,7 +236,7 @@ rdp_send_logon_info(uint32 flags, char *domain, char *user, rdp_out_unistr(s, directory, len_directory); } else { out_uint16_le(s, 0); - } + } out_uint16_le(s, 2); out_uint16_le(s, len_ip+2); // Length of client ip rdp_out_unistr(s, "127.0.0.1", len_ip); @@ -710,7 +710,7 @@ process_bitmap_updates(STREAM s) if (!compress) { int y; - bmpdata = xmalloc(width * height * Bpp); + bmpdata = (uint8*)xmalloc(width * height * Bpp); for (y = 0; y < height; y++) { in_uint8a(s, &bmpdata[(height - y - 1) * (width * Bpp)], @@ -733,7 +733,7 @@ process_bitmap_updates(STREAM s) in_uint8s(s, 4); /* line_size, final_size */ } in_uint8p(s, data, size); - bmpdata = xmalloc(width * height * Bpp); + bmpdata = (uint8*)xmalloc(width * height * Bpp); if (bitmap_decompress(bmpdata, width, height, data, size, Bpp)) { ui_paint_bitmap(left, top, cx, cy, width, height, bmpdata); @@ -760,7 +760,7 @@ process_palette(STREAM s) in_uint16_le(s, map.ncolours); in_uint8s(s, 2); /* pad */ - map.colours = xmalloc(3 * map.ncolours); + map.colours = (COLOURENTRY*)xmalloc(3 * map.ncolours); DEBUG(("PALETTE(c=%d)\n", map.ncolours)); diff --git a/secure.c b/secure.c index 1ef98c0..9d2d205 100644 --- a/secure.c +++ b/secure.c @@ -804,7 +804,7 @@ sec_connect(char *server, char *username) /* We exchange some RDP data during the MCS-Connect */ mcs_data.size = 512; - mcs_data.p = mcs_data.data = xmalloc(mcs_data.size); + mcs_data.p = mcs_data.data = (uint8*)xmalloc(mcs_data.size); sec_out_mcs_data(&mcs_data); if (!mcs_connect(server, &mcs_data, username)) diff --git a/tcp.c b/tcp.c index c6acec1..aa7a951 100644 --- a/tcp.c +++ b/tcp.c @@ -12,7 +12,7 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. @@ -39,11 +39,11 @@ extern int tcp_port_rdp; /* Initialise TCP transport data packet */ STREAM -tcp_init(int maxlen) +tcp_init(uint32 maxlen) { if (maxlen > out.size) { - out.data = xrealloc(out.data, maxlen); + out.data = (uint8*)xrealloc(out.data, maxlen); out.size = maxlen; } @@ -74,13 +74,13 @@ tcp_send(STREAM s) /* Receive a message on the TCP layer */ STREAM -tcp_recv(int length) +tcp_recv(uint32 length) { int rcvd = 0; if (length > in.size) { - in.data = xrealloc(in.data, length); + in.data = (uint8*)xrealloc(in.data, length); in.size = length; } @@ -112,7 +112,7 @@ tcp_connect(char *server) { struct hostent *nslookup; struct sockaddr_in servaddr; - int true = 1; + int true_value = 1; if ((nslookup = gethostbyname(server)) != NULL) { @@ -140,13 +140,13 @@ tcp_connect(char *server) return False; } - setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, (void *) &true, sizeof(true)); + setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, (void *) &true_value, sizeof(true_value)); in.size = 4096; - in.data = xmalloc(in.size); + in.data = (uint8*)xmalloc(in.size); out.size = 4096; - out.data = xmalloc(out.size); + out.data = (uint8*)xmalloc(out.size); return True; } diff --git a/xkeymap.c b/xkeymap.c index 37b3b46..eac8872 100644 --- a/xkeymap.c +++ b/xkeymap.c @@ -12,7 +12,7 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. @@ -359,7 +359,7 @@ xkeymap_translate_key(uint32 keysym, unsigned int keycode, unsigned int state) warning("No translation for (keysym 0x%lx, %s)\n", keysym, get_ksname(keysym)); /* not in keymap, try to interpret the raw scancode */ - if ((keycode >= min_keycode) && (keycode <= 0x60)) + if (((int)keycode >= min_keycode) && (keycode <= 0x60)) { tr.scancode = keycode - min_keycode; diff --git a/xwin.c b/xwin.c index c9a8e72..29d5e75 100644 --- a/xwin.c +++ b/xwin.c @@ -413,7 +413,7 @@ static uint8 * translate_image(int width, int height, uint8 * data) { int size = width * height * bpp / 8; - uint8 *out = xmalloc(size); + uint8 *out = (uint8*)xmalloc(size); uint8 *end = out + size; switch (server_bpp) @@ -787,7 +787,7 @@ xwin_process_events(void) case ClientMessage: /* the window manager told us to quit */ if ((xevent.xclient.message_type == protocol_atom) - && (xevent.xclient.data.l[0] == kill_atom)) + && ((Atom)xevent.xclient.data.l[0] == kill_atom)) /* Quit */ return 0; break; @@ -1137,10 +1137,10 @@ ui_create_cursor(unsigned int x, unsigned int y, int width, int height, scanline = (width + 7) / 8; offset = scanline * height; - cursor = xmalloc(offset); + cursor = (uint8*)xmalloc(offset); memset(cursor, 0, offset); - mask = xmalloc(offset); + mask = (uint8*)xmalloc(offset); memset(mask, 0, offset); /* approximate AND and XOR masks with a monochrome X pointer */ @@ -1219,7 +1219,7 @@ ui_create_colourmap(COLOURMAP * colours) int i, ncolours = colours->ncolours; if (!owncolmap) { - uint32 *map = xmalloc(sizeof(*colmap) * ncolours); + uint32 *map = (uint32*)xmalloc(sizeof(*colmap) * ncolours); XColor xentry; XColor xc_cache[256]; uint32 colour; @@ -1297,7 +1297,7 @@ ui_create_colourmap(COLOURMAP * colours) XColor *xcolours, *xentry; Colormap map; - xcolours = xmalloc(sizeof(XColor) * ncolours); + xcolours = (XColor*)xmalloc(sizeof(XColor) * ncolours); for (i = 0; i < ncolours; i++) { entry = &colours->colours[i]; @@ -1327,7 +1327,7 @@ void ui_set_colourmap(HCOLOURMAP map) { if (!owncolmap) - colmap = map; + colmap = (uint32*)map; else XSetWindowColormap(display, wnd, (Colormap) map); }