Bug 443067 - Disk Cache overflow when downloading large files. r=bz

--HG--
extra : rebase_source : 23492fb28c073b676d193703bb9bb6a2976a462a
This commit is contained in:
Michal Novotny 2010-04-15 02:19:00 -04:00
parent ee6e9661b7
commit 009289b688
2 changed files with 4 additions and 4 deletions

View File

@ -784,8 +784,8 @@ nsDiskCacheDevice::OnDataSizeChange(nsCacheEntry * entry, PRInt32 deltaSize)
PRUint32 sizeK = ((entry->DataSize() + 0x03FF) >> 10); // round up to next 1k
NS_ASSERTION(sizeK < USHRT_MAX, "data size out of range");
NS_ASSERTION(newSizeK < USHRT_MAX, "data size out of range");
NS_ASSERTION(sizeK <= USHRT_MAX, "data size out of range");
NS_ASSERTION(newSizeK <= USHRT_MAX, "data size out of range");
// pre-evict entries to make space for new data
PRUint32 targetCapacity = mCacheCapacity > (newSizeK - sizeK)

View File

@ -90,7 +90,7 @@ struct nsDiskCacheEntry;
#define kMinRecordCount 512
#define kSeparateFile 0
#define kMaxDataFileSize 0x4000000 // 64 MiB
#define kMaxDataFileSize 0x3FFFC00 // 65535 KiB (see bug #443067)
#define kBuckets (1 << 5) // must be a power of 2!
class nsDiskCacheRecord {
@ -334,7 +334,7 @@ class nsDiskCacheRecordVisitor {
struct nsDiskCacheHeader {
PRUint32 mVersion; // cache version.
PRUint32 mDataSize; // size of cache in units of 256bytes.
PRUint32 mDataSize; // size of cache in units of 1024bytes.
PRInt32 mEntryCount; // number of entries stored in cache.
PRUint32 mIsDirty; // dirty flag.
PRInt32 mRecordCount; // Number of records