325765 Cache causes crash crossing architecture [@ nsDiskCacheRecord::HashNumber].[@ nsDiskCacheMap::FindRecord]. Disk cache is not endian-neutral as was intended. Byte-swap the entire cache header. r=darin sr=smfr a/1.8=darin

git-svn-id: svn://10.0.0.236/trunk@188939 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
mark%moxienet.com
2006-02-04 22:01:22 +00:00
parent b713fe94c2
commit c99943c271
2 changed files with 11 additions and 1 deletions

View File

@@ -53,7 +53,7 @@
class nsDiskCache {
public:
enum {
kCurrentVersion = 0x00010007 // format = 16 bits major version/16 bits minor version
kCurrentVersion = 0x00010009 // format = 16 bits major version/16 bits minor version
};
enum { kData, kMetaData };

View File

@@ -358,6 +358,11 @@ struct nsDiskCacheHeader {
mEntryCount = htonl(mEntryCount);
mIsDirty = htonl(mIsDirty);
mRecordCount = htonl(mRecordCount);
for (PRUint32 i = 0; i < kBuckets ; i++) {
mEvictionRank[i] = htonl(mEvictionRank[i]);
mBucketUsage[i] = htonl(mBucketUsage[i]);
}
#endif
}
@@ -369,6 +374,11 @@ struct nsDiskCacheHeader {
mEntryCount = ntohl(mEntryCount);
mIsDirty = ntohl(mIsDirty);
mRecordCount = ntohl(mRecordCount);
for (PRUint32 i = 0; i < kBuckets ; i++) {
mEvictionRank[i] = ntohl(mEvictionRank[i]);
mBucketUsage[i] = ntohl(mBucketUsage[i]);
}
#endif
}
};