--- sourceforge.net/trunk/rdesktop/rdp.c 2003/02/04 05:32:13 309 +++ sourceforge.net/trunk/rdesktop/rdp.c 2003/02/07 23:43:37 314 @@ -552,7 +552,7 @@ { uint16 num_updates; uint16 left, top, right, bottom, width, height; - uint16 cx, cy, bpp, compress, bufsize, size; + uint16 cx, cy, bpp, Bpp, compress, bufsize, size; uint8 *data, *bmpdata; int i; @@ -567,6 +567,7 @@ in_uint16_le(s, width); in_uint16_le(s, height); in_uint16_le(s, bpp); + Bpp = (bpp + 7) / 8; in_uint16_le(s, compress); in_uint16_le(s, bufsize); @@ -579,10 +580,10 @@ if (!compress) { int y; - bmpdata = xmalloc(width * height * (bpp / 8)); + bmpdata = xmalloc(width * height * Bpp); for (y = 0; y < height; y++) { - in_uint8a(s, &bmpdata[(height - y - 1) * (width * (bpp / 8))], width * (bpp / 8)); + in_uint8a(s, &bmpdata[(height - y - 1) * (width * Bpp)], width * Bpp); } ui_paint_bitmap(left, top, cx, cy, width, height, bmpdata); xfree(bmpdata); @@ -593,8 +594,8 @@ in_uint16_le(s, size); in_uint8s(s, 4); /* line_size, final_size */ in_uint8p(s, data, size); - bmpdata = xmalloc(width * height * (bpp / 8)); - if (bitmap_decompress(bmpdata, width, height, data, size, bpp)) + bmpdata = xmalloc(width * height * Bpp); + if (bitmap_decompress(bmpdata, width, height, data, size, Bpp)) { ui_paint_bitmap(left, top, cx, cy, width, height, bmpdata); }