--- sourceforge.net/trunk/rdesktop/cache.c 2000/09/28 05:27:25 15 +++ sourceforge.net/trunk/rdesktop/cache.c 2000/09/28 07:04:14 16 @@ -154,8 +154,10 @@ static uint8 deskcache[0x38400]; /* Retrieve desktop data from the cache */ -uint8 *cache_get_desktop(uint32 offset, uint32 length) +uint8 *cache_get_desktop(uint32 offset, int cx, int cy) { + int length = cx * cy; + if ((offset + length) <= sizeof(deskcache)) { return &deskcache[offset]; @@ -166,11 +168,18 @@ } /* Store desktop data in the cache */ -void cache_put_desktop(uint32 offset, uint32 length, uint8 *data) +void cache_put_desktop(uint32 offset, int cx, int cy, int scanline, uint8 *data) { + int length = cx * cy; + if ((offset + length) <= sizeof(deskcache)) { - memcpy(&deskcache[offset], data, length); + while (cy--) + { + memcpy(&deskcache[offset], data, cx); + data += scanline; + offset += cx; + } } else {