Fixes for a few bugs caught by linux.

git-svn-id: svn://10.0.0.236/branches/DISKCACHE2_BRANCH@94894 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
gordon%netscape.com
2001-05-14 20:23:17 +00:00
parent 8a22ddce2f
commit f8cf79b055
5 changed files with 13 additions and 13 deletions

View File

@@ -179,4 +179,4 @@ private:
PRBool initialized;
};
#endif /* _nsDiskCacheBindData_h_ */
#endif /* _nsDiskCacheBindData_h_ */

View File

@@ -65,11 +65,11 @@ public:
nsresult WriteBlocks( char * buffer, PRInt32 startBlock, PRInt32 numBlocks);
nsresult ReadBlocks( char * buffer, PRInt32 startBlock, PRInt32 numBlocks);
// private:
virtual nsresult FlushBitMap();
virtual nsresult ValidateFile(); // called by Open()
virtual nsresult VerifyAllocation( PRInt32 startBlock, PRInt32 numBLocks);
virtual PRInt32 LastBlock();
private:
nsresult FlushBitMap();
nsresult ValidateFile(); // called by Open()
nsresult VerifyAllocation( PRInt32 startBlock, PRInt32 numBLocks);
PRInt32 LastBlock();
/**
* Data members

View File

@@ -77,7 +77,7 @@ struct nsDiskCacheEntry {
void Unswap() // network to host (disk to memory)
{
#if defined(IS_LITTLE_ENDIAN)
mHeaderVersion = ::PR_ntohl(mHeaderSize);
mHeaderVersion = ::PR_ntohl(mHeaderVersion);
mMetaLocation = ::PR_ntohl(mMetaLocation);
mFetchCount = ::PR_ntohl(mFetchCount);
mLastFetched = ::PR_ntohl(mLastFetched);

View File

@@ -349,7 +349,7 @@ nsDiskCacheMap::DeleteRecord( nsDiskCacheRecord * mapRecord)
if (NS_FAILED(rv)) return rv;
PRUint32 count = bucket->CountRecords();
for (int i = 0; i < count; ++i) {
for (PRUint32 i = 0; i < count; ++i) {
if (bucket->mRecords[i].HashNumber() == mapRecord->HashNumber()) {
// found it, now delete it.
if (i != (count - 1)) { // if not the last record, shift last record into opening
@@ -419,8 +419,6 @@ nsDiskCacheMap::ReadDiskCacheEntry(nsDiskCacheRecord * record, nsDiskCacheEntry
{
nsresult rv;
nsDiskCacheEntry * diskEntry = nsnull;
PRUint16 generation = record->Generation();
PRUint32 hashNumber = record->HashNumber();
PRUint32 metaFile = record->MetaFile();
PRFileDesc * fd = nsnull;
*result = nsnull;

View File

@@ -25,6 +25,8 @@
#ifndef _nsDiskCacheMap_h_
#define _nsDiskCacheMap_h_
#include <limits.h>
#include "prtypes.h"
#include "prnetdb.h"
#include "nsDebug.h"
@@ -218,7 +220,7 @@ public:
if (DataFile() == 0) return DataGeneration();
else if (MetaFile() == 0) return MetaGeneration();
return -1; // no generation
return SHRT_MAX; // no generation
}
@@ -228,7 +230,7 @@ public:
#if defined(IS_LITTLE_ENDIAN)
mHashNumber = ::PR_htonl(mHashNumber);
mEvictionRank = ::PR_htonl(mEvictionRank);
mLocation = ::PR_htonl(mLocation);
mDataLocation = ::PR_htonl(mDataLocation);
mMetaLocation = ::PR_htonl(mMetaLocation);
#endif
}
@@ -238,7 +240,7 @@ public:
#if defined(IS_LITTLE_ENDIAN)
mHashNumber = ::PR_ntohl(mHashNumber);
mEvictionRank = ::PR_ntohl(mEvictionRank);
mLocation = ::PR_ntohl(mLocation);
mDataLocation = ::PR_ntohl(mDataLocation);
mMetaLocation = ::PR_ntohl(mMetaLocation);
#endif
}