--- sourceforge.net/trunk/rdesktop/cache.c 2004/06/27 17:51:54 725 +++ sourceforge.net/trunk/rdesktop/cache.c 2004/10/02 00:40:13 774 @@ -2,17 +2,17 @@ rdesktop: A Remote Desktop Protocol client. Cache routines Copyright (C) Matthew Chapman 1999-2002 - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, 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. @@ -25,6 +25,7 @@ #define IS_PERSISTENT(id) (g_pstcache_fd[id] > 0) extern int g_pstcache_fd[]; +extern BOOL g_use_rdp5; uint32 g_stamp; int g_num_bitmaps_in_memory[3]; @@ -32,6 +33,7 @@ /* BITMAP CACHE */ static BMPCACHEENTRY g_bmpcache[3][0xa00]; +static HBITMAP g_volatile_bc[3]; /* Remove the least-recently used bitmap from the cache */ void @@ -39,7 +41,7 @@ { int i; uint16 cache_idx = 0; - uint32 m = -1; + uint32 m = (uint32) - 1; BMPCACHEENTRY *pbce; for (i = 0; i < NUM_ELEMENTS(g_bmpcache[cache_id]); i++) @@ -75,6 +77,10 @@ return *pbitmap; } } + else if ((cache_id < NUM_ELEMENTS(g_volatile_bc)) && (cache_idx == 0x7fff)) + { + return g_volatile_bc[cache_id]; + } error("get bitmap %d:%d\n", cache_id, cache_idx); return NULL; @@ -93,7 +99,7 @@ { ui_destroy_bitmap(old); } - else + else if (g_use_rdp5) { if (++g_num_bitmaps_in_memory[cache_id] > BMPCACHE2_C2_CELLS) cache_remove_lru_bitmap(cache_id); @@ -102,6 +108,13 @@ g_bmpcache[cache_id][cache_idx].bitmap = bitmap; g_bmpcache[cache_id][cache_idx].usage = stamp; } + else if ((cache_id < NUM_ELEMENTS(g_volatile_bc)) && (cache_idx == 0x7fff)) + { + old = g_volatile_bc[cache_id]; + if (old != NULL) + ui_destroy_bitmap(old); + g_volatile_bc[cache_id] = bitmap; + } else { error("put bitmap %d:%d\n", cache_id, cache_idx);