mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 746920 - Uninitialised value use in nsDiskCacheMap::FlushRecords, r=hurley
This commit is contained in:
parent
c87d5c927f
commit
b691df5799
10
netwerk/cache/nsDiskCacheMap.cpp
vendored
10
netwerk/cache/nsDiskCacheMap.cpp
vendored
@ -369,16 +369,18 @@ nsDiskCacheMap::ShrinkRecords()
|
||||
PRUint32 newRecordsPerBucket = oldRecordsPerBucket;
|
||||
while (maxUsage < (newRecordsPerBucket >> 1))
|
||||
newRecordsPerBucket >>= 1;
|
||||
if (newRecordsPerBucket < kMinRecordCount)
|
||||
newRecordsPerBucket = kMinRecordCount;
|
||||
if (newRecordsPerBucket < (kMinRecordCount / kBuckets))
|
||||
newRecordsPerBucket = (kMinRecordCount / kBuckets);
|
||||
NS_ASSERTION(newRecordsPerBucket <= oldRecordsPerBucket,
|
||||
"ShrinkRecords() can't grow records!");
|
||||
if (newRecordsPerBucket == oldRecordsPerBucket)
|
||||
return NS_OK;
|
||||
// Move the buckets close to each other
|
||||
for (bucketIndex = 0; bucketIndex < kBuckets; ++bucketIndex) {
|
||||
for (bucketIndex = 1; bucketIndex < kBuckets; ++bucketIndex) {
|
||||
// Move bucket
|
||||
memmove(mRecordArray + bucketIndex * newRecordsPerBucket,
|
||||
mRecordArray + bucketIndex * oldRecordsPerBucket,
|
||||
mHeader.mBucketUsage[bucketIndex] * sizeof(nsDiskCacheRecord));
|
||||
newRecordsPerBucket * sizeof(nsDiskCacheRecord));
|
||||
}
|
||||
|
||||
// Shrink the record array memory block itself
|
||||
|
Loading…
Reference in New Issue
Block a user