rdpegfx: rename MaxCacheSlot to MaxCacheSlots
authorNorbert Federa <norbert.federa@thincast.com>
Mon, 2 Mar 2020 08:54:35 +0000 (09:54 +0100)
committerNorbert Federa <norbert.federa@thincast.com>
Mon, 2 Mar 2020 08:55:25 +0000 (09:55 +0100)
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.

channels/rdpgfx/client/rdpgfx_main.c
channels/rdpgfx/client/rdpgfx_main.h

index 4979820..fcace21 100644 (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)
        {
index 3f58f2d..362f409 100644 (file)
@@ -78,7 +78,7 @@ struct _RDPGFX_PLUGIN
 
        wHashTable* SurfaceTable;
 
-       UINT16 MaxCacheSlot;
+       UINT16 MaxCacheSlots;
        void* CacheSlots[25600];
        rdpContext* rdpcontext;