rdpegfx: rename MaxCacheSlot to MaxCacheSlots

Although Microsoft uses 1-based numbering on the wire for indexing the
GFX bitmap cache entries, the code in FreeRDP uses 0-based numbering and
therefore the name MaxCacheSlots is less confusing.
This commit is contained in:
Norbert Federa 2020-03-02 09:54:35 +01:00
parent f4d5ec776f
commit 39e12990e8
2 changed files with 12 additions and 12 deletions

View File

@ -75,11 +75,11 @@ static void free_surfaces(RdpgfxClientContext* context, wHashTable* SurfaceTable
free(pKeys);
}
static void evict_cache_slots(RdpgfxClientContext* context, UINT16 MaxCacheSlot, void** CacheSlots)
static void evict_cache_slots(RdpgfxClientContext* context, UINT16 MaxCacheSlots, void** CacheSlots)
{
UINT16 index;
for (index = 0; index < MaxCacheSlot; index++)
for (index = 0; index < MaxCacheSlots; index++)
{
if (CacheSlots[index])
{
@ -1819,7 +1819,7 @@ static UINT rdpgfx_on_close(IWTSVirtualChannelCallback* pChannelCallback)
DEBUG_RDPGFX(gfx->log, "OnClose");
free_surfaces(context, gfx->SurfaceTable);
evict_cache_slots(context, gfx->MaxCacheSlot, gfx->CacheSlots);
evict_cache_slots(context, gfx->MaxCacheSlots, gfx->CacheSlots);
if (gfx->listener_callback)
{
@ -1992,10 +1992,10 @@ static UINT rdpgfx_set_cache_slot_data(RdpgfxClientContext* context, UINT16 cach
RDPGFX_PLUGIN* gfx = (RDPGFX_PLUGIN*)context->handle;
/* Microsoft uses 1-based indexing for the egfx bitmap cache ! */
if (cacheSlot == 0 || cacheSlot > gfx->MaxCacheSlot)
if (cacheSlot == 0 || cacheSlot > gfx->MaxCacheSlots)
{
WLog_ERR(TAG, "%s: invalid cache slot %" PRIu16 ", must be between 1 and %" PRIu16 "", __FUNCTION__,
cacheSlot, gfx->MaxCacheSlot);
WLog_ERR(TAG, "%s: invalid cache slot %" PRIu16 ", must be between 1 and %" PRIu16 "",
__FUNCTION__, cacheSlot, gfx->MaxCacheSlots);
return ERROR_INVALID_INDEX;
}
@ -2009,10 +2009,10 @@ static void* rdpgfx_get_cache_slot_data(RdpgfxClientContext* context, UINT16 cac
RDPGFX_PLUGIN* gfx = (RDPGFX_PLUGIN*)context->handle;
/* Microsoft uses 1-based indexing for the egfx bitmap cache ! */
if (cacheSlot == 0 || cacheSlot > gfx->MaxCacheSlot)
if (cacheSlot == 0 || cacheSlot > gfx->MaxCacheSlots)
{
WLog_ERR(TAG, "%s: invalid cache slot %" PRIu16 ", must be between 1 and %" PRIu16 "", __FUNCTION__,
cacheSlot, gfx->MaxCacheSlot);
WLog_ERR(TAG, "%s: invalid cache slot %" PRIu16 ", must be between 1 and %" PRIu16 "",
__FUNCTION__, cacheSlot, gfx->MaxCacheSlots);
return NULL;
}
@ -2071,7 +2071,7 @@ RdpgfxClientContext* rdpgfx_client_context_new(rdpSettings* settings)
if (gfx->H264)
gfx->SmallCache = TRUE;
gfx->MaxCacheSlot = gfx->SmallCache ? 4096 : 25600;
gfx->MaxCacheSlots = gfx->SmallCache ? 4096 : 25600;
context = (RdpgfxClientContext*)calloc(1, sizeof(RdpgfxClientContext));
if (!context)
@ -2117,7 +2117,7 @@ void rdpgfx_client_context_free(RdpgfxClientContext* context)
gfx = (RDPGFX_PLUGIN*)context->handle;
free_surfaces(context, gfx->SurfaceTable);
evict_cache_slots(context, gfx->MaxCacheSlot, gfx->CacheSlots);
evict_cache_slots(context, gfx->MaxCacheSlots, gfx->CacheSlots);
if (gfx->listener_callback)
{

View File

@ -78,7 +78,7 @@ struct _RDPGFX_PLUGIN
wHashTable* SurfaceTable;
UINT16 MaxCacheSlot;
UINT16 MaxCacheSlots;
void* CacheSlots[25600];
rdpContext* rdpcontext;