Piotr Caban : wininet: Update used blocks count when block is allocated or freed.

Alexandre Julliard julliard at winehq.org
Fri Sep 21 14:22:41 CDT 2012


Module: wine
Branch: master
Commit: 8bb1af84f465cbe5b802a7b0c98a712c3a1042d3
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=8bb1af84f465cbe5b802a7b0c98a712c3a1042d3

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Fri Sep 21 14:54:15 2012 +0200

wininet: Update used blocks count when block is allocated or freed.

---

 dlls/wininet/urlcache.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/dlls/wininet/urlcache.c b/dlls/wininet/urlcache.c
index 8a221a8..87789fe 100644
--- a/dlls/wininet/urlcache.c
+++ b/dlls/wininet/urlcache.c
@@ -781,6 +781,9 @@ static inline BYTE URLCache_Allocation_BlockIsFree(BYTE * AllocationTable, DWORD
  *
  *  Marks the specified block as free
  *
+ * CAUTION
+ *    this function is not updating used blocks count
+ *
  * RETURNS
  *    nothing
  *
@@ -796,6 +799,9 @@ static inline void URLCache_Allocation_BlockFree(BYTE * AllocationTable, DWORD d
  *
  *  Marks the specified block as allocated
  *
+ * CAUTION
+ *     this function is not updating used blocks count
+ *
  * RETURNS
  *    nothing
  *
@@ -840,6 +846,7 @@ static DWORD URLCache_FindFirstFreeEntry(URLCACHE_HEADER * pHeader, DWORD dwBloc
             for (index = 0; index < dwBlocksNeeded * BLOCKSIZE / sizeof(DWORD); index++)
                 ((DWORD*)*ppEntry)[index] = 0xdeadbeef;
             (*ppEntry)->dwBlocksUsed = dwBlocksNeeded;
+            pHeader->dwBlocksInUse += dwBlocksNeeded;
             return ERROR_SUCCESS;
         }
     }
@@ -867,6 +874,7 @@ static BOOL URLCache_DeleteEntry(LPURLCACHE_HEADER pHeader, CACHEFILE_ENTRY * pE
     for (dwBlock = dwStartBlock; dwBlock < dwStartBlock + pEntry->dwBlocksUsed; dwBlock++)
         URLCache_Allocation_BlockFree(pHeader->allocation_table, dwBlock);
 
+    pHeader->dwBlocksInUse -= pEntry->dwBlocksUsed;
     return TRUE;
 }
 




More information about the wine-cvs mailing list