fixes bug 161417 - recent netwerk checkin upped warning count by 4

r=dougt sr=alecf
This commit is contained in:
darin%netscape.com 2002-08-12 14:25:40 +00:00
Родитель 67c2c5b3c0
Коммит bb68f622b7
3 изменённых файлов: 8 добавлений и 8 удалений

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

@ -688,7 +688,7 @@ nsDiskCacheDevice::OnDataSizeChange(nsCacheEntry * entry, PRInt32 deltaSize)
if (newSize > mCacheCapacity) {
nsresult rv = nsCacheService::DoomEntry(entry);
NS_ASSERTION(NS_SUCCEEDED(rv),"DoomEntry() failed.");
return NS_ERROR_ABORT;
return rv;
}
PRUint32 sizeK = ((entry->DataSize() + 0x03FF) >> 10); // round up to next 1k

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

@ -107,6 +107,7 @@ CreateDiskCacheEntry(nsDiskCacheBinding * binding)
if (size <= 1024) pad = (((size-1)/ 256) + 1) * 256;
else if (size <= 4096) pad = (((size-1)/1024) + 1) * 1024;
else if (size <= 16384) pad = (((size-1)/4096) + 1) * 4096;
else return nsnull; // unexpected size!
nsDiskCacheEntry * diskEntry = (nsDiskCacheEntry *)new char[pad];
if (!diskEntry) return nsnull;

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

@ -711,7 +711,7 @@ nsDiskCacheStreamIO::FlushBufferToFile(PRBool clearBuffer)
// write buffer
PRInt32 bytesWritten = PR_Write(mFD, mBuffer, mBufEnd);
if (bytesWritten != mBufEnd) {
if (PRUint32(bytesWritten) != mBufEnd) {
NS_WARNING("failed to flush all data");
return NS_ERROR_UNEXPECTED; // NS_ErrorAccordingToNSPR()
}
@ -776,7 +776,7 @@ nsDiskCacheStreamIO::Seek(PRInt32 whence, PRInt32 offset)
nsAutoLock lock(mDeviceLock->GetPRLock()); // grab device lock
if (!mBinding) return NS_ERROR_NOT_AVAILABLE;
if (offset > mStreamEnd) return NS_ERROR_FAILURE;
if (PRUint32(offset) > mStreamEnd) return NS_ERROR_FAILURE;
if (mFD) {
@ -848,7 +848,7 @@ nsDiskCacheStreamIO::Seek(PRInt32 whence, PRInt32 offset)
return NS_ERROR_INVALID_ARG;
}
if ((newPos < 0) || (newPos > mBufEnd)) {
if ((newPos < 0) || (PRUint32(newPos) > mBufEnd)) {
NS_WARNING("seek offset out of range");
return NS_ERROR_INVALID_ARG;
}
@ -898,13 +898,12 @@ nsDiskCacheStreamIO::SetEOF()
}
}
PRUint32 oldSizeK = (mStreamEnd + 0x03FF) >> 10;
PRUint32 newSizeK = (mStreamPos + 0x03FF) >> 10;
if (mFD) {
rv = nsDiskCache::Truncate(mFD, mStreamPos);
#ifdef DEBUG
PRUint32 oldSizeK = (mStreamEnd + 0x03FF) >> 10;
NS_ASSERTION(mBinding->mRecord.DataFileSize() == oldSizeK, "bad disk cache entry size");
#endif
} else {
// data stored in buffer.
NS_ASSERTION(mStreamEnd < (16 * 1024), "buffer truncation inadequate");