--- sourceforge.net/trunk/rdesktop/orders.c 2003/03/28 09:09:17 355 +++ sourceforge.net/trunk/rdesktop/orders.c 2003/07/28 18:13:30 436 @@ -22,7 +22,7 @@ #include "orders.h" extern uint8 *next_packet; -static RDP_ORDER_STATE order_state; +static RDP_ORDER_STATE g_order_state; extern BOOL use_rdp5; /* Read field indicating which parameters are present */ @@ -55,7 +55,7 @@ /* Read a co-ordinate (16-bit, or 8-bit delta) */ static void -rdp_in_coord(STREAM s, uint16 * coord, BOOL delta) +rdp_in_coord(STREAM s, sint16 * coord, BOOL delta) { sint8 change; @@ -661,7 +661,7 @@ 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,6 +684,8 @@ uint16 bufsize, pad2, row_size, final_size; uint8 pad1; + pad2 = row_size = final_size = 0xffff; /* Shut the compiler up */ + in_uint8(s, cache_id); in_uint8(s, pad1); /* pad */ in_uint8(s, width); @@ -693,26 +695,26 @@ in_uint16_le(s, bufsize); /* bufsize */ in_uint16_le(s, cache_idx); - if (!use_rdp5) { + if (!use_rdp5) + { /* Begin compressedBitmapData */ in_uint16_le(s, pad2); /* pad */ in_uint16_le(s, size); - // in_uint8s(s, 4); /* row_size, final_size */ + // in_uint8s(s, 4); /* row_size, final_size */ in_uint16_le(s, row_size); in_uint16_le(s, final_size); - } else { + } + else + { size = bufsize; } 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, - cache_id, cache_idx, - bpp, size, pad1, bufsize, pad2, row_size, final_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, 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)) { @@ -740,7 +742,7 @@ in_uint8(s, cache_id); in_uint16_le(s, map.ncolours); - map.colours = xmalloc(3 * map.ncolours); + map.colours = (COLOURENTRY *) xmalloc(sizeof(COLOURENTRY) * map.ncolours); for (i = 0; i < map.ncolours; i++) { @@ -833,7 +835,7 @@ void process_orders(STREAM s, uint16 num_orders) { - RDP_ORDER_STATE *os = &order_state; + RDP_ORDER_STATE *os = &g_order_state; uint32 present; uint8 order_flags; int size, processed = 0; @@ -955,6 +957,6 @@ void reset_order_state(void) { - memset(&order_state, 0, sizeof(order_state)); - order_state.order_type = RDP_ORDER_PATBLT; + memset(&g_order_state, 0, sizeof(g_order_state)); + g_order_state.order_type = RDP_ORDER_PATBLT; }