wininet: Return error code in URLCache_FindFirstFreeEntry function.
This commit is contained in:
parent
4254bdbfb2
commit
dab1f7c38e
@ -786,11 +786,11 @@ static inline void URLCache_Allocation_BlockAllocate(BYTE * AllocationTable, DWO
|
|||||||
* sets ppEntry to point to it.
|
* sets ppEntry to point to it.
|
||||||
*
|
*
|
||||||
* RETURNS
|
* RETURNS
|
||||||
* TRUE if it had enough space
|
* ERROR_SUCCESS when free memory block was found
|
||||||
* FALSE if it couldn't find enough space
|
* Any other Win32 error code if the entry could not be added
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static BOOL URLCache_FindFirstFreeEntry(URLCACHE_HEADER * pHeader, DWORD dwBlocksNeeded, CACHEFILE_ENTRY ** ppEntry)
|
static DWORD URLCache_FindFirstFreeEntry(URLCACHE_HEADER * pHeader, DWORD dwBlocksNeeded, CACHEFILE_ENTRY ** ppEntry)
|
||||||
{
|
{
|
||||||
LPBYTE AllocationTable = (LPBYTE)pHeader + ALLOCATION_TABLE_OFFSET;
|
LPBYTE AllocationTable = (LPBYTE)pHeader + ALLOCATION_TABLE_OFFSET;
|
||||||
DWORD dwBlockNumber;
|
DWORD dwBlockNumber;
|
||||||
@ -814,11 +814,11 @@ static BOOL URLCache_FindFirstFreeEntry(URLCACHE_HEADER * pHeader, DWORD dwBlock
|
|||||||
for (index = 0; index < dwBlocksNeeded * BLOCKSIZE / sizeof(DWORD); index++)
|
for (index = 0; index < dwBlocksNeeded * BLOCKSIZE / sizeof(DWORD); index++)
|
||||||
((DWORD*)*ppEntry)[index] = 0xdeadbeef;
|
((DWORD*)*ppEntry)[index] = 0xdeadbeef;
|
||||||
(*ppEntry)->dwBlocksUsed = dwBlocksNeeded;
|
(*ppEntry)->dwBlocksUsed = dwBlocksNeeded;
|
||||||
return TRUE;
|
return ERROR_SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FIXME("Grow file\n");
|
|
||||||
return FALSE;
|
return ERROR_HANDLE_DISK_FULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
@ -1381,14 +1381,11 @@ static DWORD URLCache_AddEntryToHash(LPURLCACHE_HEADER pHeader, LPCSTR lpszUrl,
|
|||||||
*/
|
*/
|
||||||
static DWORD URLCache_CreateHashTable(LPURLCACHE_HEADER pHeader, HASH_CACHEFILE_ENTRY *pPrevHash, HASH_CACHEFILE_ENTRY **ppHash)
|
static DWORD URLCache_CreateHashTable(LPURLCACHE_HEADER pHeader, HASH_CACHEFILE_ENTRY *pPrevHash, HASH_CACHEFILE_ENTRY **ppHash)
|
||||||
{
|
{
|
||||||
DWORD dwOffset;
|
DWORD dwOffset, error;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (!URLCache_FindFirstFreeEntry(pHeader, 0x20, (CACHEFILE_ENTRY **)ppHash))
|
if ((error = URLCache_FindFirstFreeEntry(pHeader, 0x20, (CACHEFILE_ENTRY **)ppHash)) != ERROR_SUCCESS)
|
||||||
{
|
return error;
|
||||||
FIXME("no free space for hash table\n");
|
|
||||||
return ERROR_DISK_FULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
dwOffset = (BYTE *)*ppHash - (BYTE *)pHeader;
|
dwOffset = (BYTE *)*ppHash - (BYTE *)pHeader;
|
||||||
|
|
||||||
@ -2755,12 +2752,8 @@ static BOOL CommitUrlCacheEntryInternal(
|
|||||||
dwBytesNeeded += BLOCKSIZE;
|
dwBytesNeeded += BLOCKSIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!URLCache_FindFirstFreeEntry(pHeader, dwBytesNeeded / BLOCKSIZE, &pEntry))
|
if ((error = URLCache_FindFirstFreeEntry(pHeader, dwBytesNeeded / BLOCKSIZE, &pEntry)) != ERROR_SUCCESS)
|
||||||
{
|
|
||||||
ERR("no free entries\n");
|
|
||||||
error = ERROR_DISK_FULL;
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
/* FindFirstFreeEntry fills in blocks used */
|
/* FindFirstFreeEntry fills in blocks used */
|
||||||
pUrlEntry = (URL_CACHEFILE_ENTRY *)pEntry;
|
pUrlEntry = (URL_CACHEFILE_ENTRY *)pEntry;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user