fixes bug 229984 "HTTP download of over 64MB causes disk cache to break" r=gordon sr=bzbarsky

This commit is contained in:
darin%meer.net 2004-02-25 23:01:08 +00:00
Родитель 6c9f42d9fa
Коммит 9bac57d8f3
2 изменённых файлов: 7 добавлений и 5 удалений

5
netwerk/cache/src/nsDiskCacheDevice.cpp поставляемый
Просмотреть файл

@ -676,10 +676,11 @@ nsDiskCacheDevice::OnDataSizeChange(nsCacheEntry * entry, PRInt32 deltaSize)
NS_ASSERTION(binding->mRecord.ValidRecord(), "bad record");
PRUint32 newSize = entry->DataSize() + deltaSize;
if (newSize > mCacheCapacity) {
PRUint32 maxSize = PR_MIN(mCacheCapacity / 2, kMaxDataFileSize);
if (newSize > maxSize) {
nsresult rv = nsCacheService::DoomEntry(entry);
NS_ASSERTION(NS_SUCCEEDED(rv),"DoomEntry() failed.");
return rv;
return NS_ERROR_ABORT;
}
PRUint32 sizeK = ((entry->DataSize() + 0x03FF) >> 10); // round up to next 1k

7
netwerk/cache/src/nsDiskCacheMap.h поставляемый
Просмотреть файл

@ -61,14 +61,15 @@ struct nsDiskCacheEntry;
* 2 = 1k block file
* 3 = 4k block file
*
* eFileSizeMask note: Files larger than 64 Mb have zero size stored in the
* eFileSizeMask note: Files larger than 64 MiB have zero size stored in the
* location. The file itself must be examined to determine
* its actual size.
* its actual size. (XXX This is broken in places -darin)
*
*****************************************************************************/
#define BLOCK_SIZE_FOR_INDEX(index) ((index) ? (256 << (2 * ((index) - 1))) : 0)
#define kSeparateFile 0
#define kSeparateFile 0
#define kMaxDataFileSize 0x4000000 // 64 MiB
class nsDiskCacheRecord {