eliminate nsCRT::zero() to use memset to zero instead, bug 118135, r=dp sr=waterson

This commit is contained in:
cathleen%netscape.com 2002-01-30 02:55:57 +00:00
parent 49f7429098
commit 8605704b12
21 changed files with 46 additions and 46 deletions

View File

@ -117,7 +117,7 @@ nsDOMEvent::operator new(size_t aSize)
}
if (result) {
nsCRT::zero(result, aSize);
memset(result, 0, aSize);
}
return result;

View File

@ -238,7 +238,7 @@ nsStyleFont::operator new(size_t sz, nsIPresContext* aContext) {
void* result = nsnull;
aContext->AllocateFromShell(sz, &result);
if (result)
nsCRT::zero(result, sz);
memset(result, 0, sz);
return result;
}
@ -319,7 +319,7 @@ nsStyleMargin::operator new(size_t sz, nsIPresContext* aContext) {
void* result = nsnull;
aContext->AllocateFromShell(sz, &result);
if (result)
nsCRT::zero(result, sz);
memset(result, 0, sz);
return result;
}
@ -378,7 +378,7 @@ nsStylePadding::operator new(size_t sz, nsIPresContext* aContext) {
void* result = nsnull;
aContext->AllocateFromShell(sz, &result);
if (result)
nsCRT::zero(result, sz);
memset(result, 0, sz);
return result;
}
@ -478,7 +478,7 @@ nsStyleBorder::operator new(size_t sz, nsIPresContext* aContext) {
void* result = nsnull;
aContext->AllocateFromShell(sz, &result);
if (result)
nsCRT::zero(result, sz);
memset(result, 0, sz);
return result;
}

View File

@ -398,7 +398,7 @@ static PRBool FillFontInfoFromCMAP(FMFont aFont, PRUint32 *aFontInfo, FourCharCo
static PRUint16* InitGlobalCCMap()
{
PRUint32 info[2048];
nsCRT::zero(info, sizeof(info));
memset(info, 0, sizeof(info));
#ifdef TRACK_INIT_PERFORMANCE
AbsoluteTime startTime;

View File

@ -629,7 +629,7 @@ BITMAPINFO * nsDrawingSurfaceWin :: CreateBitmapInfo(PRInt32 aWidth, PRInt32 aHe
if ((aDepth == 16) || (aDepth == 32))
memcpy(colortable, masks, sizeof(DWORD) * allocsize);
else
nsCRT::zero(colortable, sizeof(RGBQUAD) * palsize);
memset(colortable, 0, sizeof(RGBQUAD) * palsize);
if (nsnull != aBits)
*aBits = PR_Malloc(imagesize);

View File

@ -1489,7 +1489,7 @@ NS_IMPL_ISUPPORTS1(nsObserverEntry, nsIObserverEntry)
nsObserverEntry::nsObserverEntry(const nsAString& aTopic) : mTopic(aTopic)
{
NS_INIT_ISUPPORTS();
nsCRT::zero(mObservers,sizeof(mObservers));
memset(mObservers, 0, sizeof(mObservers));
}
nsObserverEntry::~nsObserverEntry() {

View File

@ -525,7 +525,7 @@ nsBidiPresUtils::Reorder(nsIPresContext* aPresContext,
return NS_ERROR_OUT_OF_MEMORY;
}
}
nsCRT::zero(mLevels, sizeof(PRUint8) * mArraySize);
memset(mLevels, 0, sizeof(PRUint8) * mArraySize);
nsIFrame* frame;
PRInt32 i;
@ -542,7 +542,7 @@ nsBidiPresUtils::Reorder(nsIPresContext* aPresContext,
mSuccess = NS_ERROR_OUT_OF_MEMORY;
}
else {
nsCRT::zero(mIndexMap, sizeof(PRUint32) * mArraySize);
memset(mIndexMap, 0, sizeof(PRUint32) * mArraySize);
mSuccess = mBidiEngine->ReorderVisual(mLevels, count, mIndexMap);

View File

@ -525,7 +525,7 @@ nsBidiPresUtils::Reorder(nsIPresContext* aPresContext,
return NS_ERROR_OUT_OF_MEMORY;
}
}
nsCRT::zero(mLevels, sizeof(PRUint8) * mArraySize);
memset(mLevels, 0, sizeof(PRUint8) * mArraySize);
nsIFrame* frame;
PRInt32 i;
@ -542,7 +542,7 @@ nsBidiPresUtils::Reorder(nsIPresContext* aPresContext,
mSuccess = NS_ERROR_OUT_OF_MEMORY;
}
else {
nsCRT::zero(mIndexMap, sizeof(PRUint32) * mArraySize);
memset(mIndexMap, 0, sizeof(PRUint32) * mArraySize);
mSuccess = mBidiEngine->ReorderVisual(mLevels, count, mIndexMap);

View File

@ -85,7 +85,7 @@ nsDirectionalFrame::operator new(size_t aSize)
{
void* frame = ::operator new(aSize);
if (frame) {
nsCRT::zero(frame, aSize);
memset(frame, 0, aSize);
}
return frame;
}

View File

@ -250,7 +250,7 @@ nsFrame::operator new(size_t sz, nsIPresShell* aPresShell)
aPresShell->AllocateFrame(sz, &result);
if (result) {
nsCRT::zero(result, sz);
memset(result, 0, sz);
}
return result;
@ -4090,7 +4090,7 @@ NS_IMETHODIMP nsFrame::GetBidiProperty(nsIPresContext* aPresContext,
return NS_ERROR_ILLEGAL_VALUE;
}
nsCRT::zero(aPropertyValue, aSize);
memset(aPropertyValue, 0, aSize);
void* val = nsnull;
nsCOMPtr<nsIPresShell> presShell;

View File

@ -85,7 +85,7 @@ nsDirectionalFrame::operator new(size_t aSize)
{
void* frame = ::operator new(aSize);
if (frame) {
nsCRT::zero(frame, aSize);
memset(frame, 0, aSize);
}
return frame;
}

View File

@ -250,7 +250,7 @@ nsFrame::operator new(size_t sz, nsIPresShell* aPresShell)
aPresShell->AllocateFrame(sz, &result);
if (result) {
nsCRT::zero(result, sz);
memset(result, 0, sz);
}
return result;
@ -4090,7 +4090,7 @@ NS_IMETHODIMP nsFrame::GetBidiProperty(nsIPresContext* aPresContext,
return NS_ERROR_ILLEGAL_VALUE;
}
nsCRT::zero(aPropertyValue, aSize);
memset(aPropertyValue, 0, aSize);
void* val = nsnull;
nsCOMPtr<nsIPresShell> presShell;

View File

@ -238,7 +238,7 @@ nsStyleFont::operator new(size_t sz, nsIPresContext* aContext) {
void* result = nsnull;
aContext->AllocateFromShell(sz, &result);
if (result)
nsCRT::zero(result, sz);
memset(result, 0, sz);
return result;
}
@ -319,7 +319,7 @@ nsStyleMargin::operator new(size_t sz, nsIPresContext* aContext) {
void* result = nsnull;
aContext->AllocateFromShell(sz, &result);
if (result)
nsCRT::zero(result, sz);
memset(result, 0, sz);
return result;
}
@ -378,7 +378,7 @@ nsStylePadding::operator new(size_t sz, nsIPresContext* aContext) {
void* result = nsnull;
aContext->AllocateFromShell(sz, &result);
if (result)
nsCRT::zero(result, sz);
memset(result, 0, sz);
return result;
}
@ -478,7 +478,7 @@ nsStyleBorder::operator new(size_t sz, nsIPresContext* aContext) {
void* result = nsnull;
aContext->AllocateFromShell(sz, &result);
if (result)
nsCRT::zero(result, sz);
memset(result, 0, sz);
return result;
}

View File

@ -404,7 +404,7 @@ nsBoxLayoutState::Allocate(size_t sz, nsIPresShell* aPresShell)
aPresShell->AllocateFrame(sz, &result);
if (result) {
nsCRT::zero(result, sz);
memset(result, 0, sz);
}
return result;

View File

@ -61,7 +61,7 @@ nsDiskCacheBlockFile::Open( nsILocalFile * blockFile, PRUint32 blockSize)
mEndOfFile = fileSize;
if (mEndOfFile == 0) {
// initialize bit map and write it
nsCRT::zero(mBitMap, kBitMapBytes);
memset(mBitMap, 0, kBitMapBytes);
PRInt32 bytesWritten = PR_Write(mFD, mBitMap, kBitMapBytes);
if (bytesWritten < kBitMapBytes) goto error_exit;
mEndOfFile = kBitMapBytes;

View File

@ -132,7 +132,7 @@ CreateDiskCacheEntry(nsDiskCacheBinding * binding)
pad -= diskEntry->Size();
NS_ASSERTION(pad >= 0, "under allocated buffer for diskEntry.");
if (pad > 0)
nsCRT::zero(&diskEntry->mKeyStart[keySize+metaSize], pad);
memset(&diskEntry->mKeyStart[keySize+metaSize], 0, pad);
return diskEntry;
}

View File

@ -173,8 +173,8 @@ nsDiskCacheMap::Open(nsILocalFile * cacheDirectory)
mHeader.mEvictionRank[i] = 0;
}
nsCRT::zero(mHeader.reserved, nsDiskCacheHeader::kReservedBytes);
nsCRT::zero(mBuckets, sizeof(nsDiskCacheBucket) * kBucketsPerTable);
memset(mHeader.reserved, 0, nsDiskCacheHeader::kReservedBytes);
memset(mBuckets, 0, sizeof(nsDiskCacheBucket) * kBucketsPerTable);
} else if (mapSize == kCacheMapSize) {
// read it in

View File

@ -57,9 +57,9 @@ nsAppleFileDecoder::nsAppleFileDecoder()
m_headerOk = PR_FALSE;
m_comment[0] = 0;
nsCRT::zero(&m_dates, sizeof(m_dates));
nsCRT::zero(&m_finderInfo, sizeof(m_dates));
nsCRT::zero(&m_finderExtraInfo, sizeof(m_dates));
memset(&m_dates, 0, sizeof(m_dates));
memset(&m_finderInfo, 0, sizeof(m_dates));
memset(&m_finderExtraInfo, 0, sizeof(m_dates));
}
nsAppleFileDecoder::~nsAppleFileDecoder()
@ -152,13 +152,13 @@ NS_IMETHODIMP nsAppleFileDecoder::Close(void)
GetVolParmsInfoBuffer vp;
DTPBRec dtp;
nsCRT::zero((void *) &vinfo, sizeof (vinfo));
memset((void *) &vinfo, 0, sizeof (vinfo));
vinfo.ioVRefNum = fpb->ioVRefNum;
vinfo.ioBuffer = (Ptr) &vp;
vinfo.ioReqCount = sizeof (vp);
if (PBHGetVolParmsSync((HParmBlkPtr) &vinfo) == noErr && ((vp.vMAttrib >> bHasDesktopMgr) & 1))
{
nsCRT::zero((void *) &dtp, sizeof (dtp));
memset((void *) &dtp, 0, sizeof (dtp));
dtp.ioVRefNum = fpb->ioVRefNum;
if (PBDTGetPath(&dtp) == noErr)
{

View File

@ -1489,7 +1489,7 @@ NS_IMPL_ISUPPORTS1(nsObserverEntry, nsIObserverEntry)
nsObserverEntry::nsObserverEntry(const nsAString& aTopic) : mTopic(aTopic)
{
NS_INIT_ISUPPORTS();
nsCRT::zero(mObservers,sizeof(mObservers));
memset(mObservers, 0, sizeof(mObservers));
}
nsObserverEntry::~nsObserverEntry() {

View File

@ -63,9 +63,9 @@ nsDecodeAppleFile::nsDecodeAppleFile()
m_headerOk = PR_FALSE;
m_comment[0] = 0;
nsCRT::zero(&m_dates, sizeof(m_dates));
nsCRT::zero(&m_finderInfo, sizeof(m_dates));
nsCRT::zero(&m_finderExtraInfo, sizeof(m_dates));
memset(&m_dates, 0, sizeof(m_dates));
memset(&m_finderInfo, 0, sizeof(m_dates));
memset(&m_finderExtraInfo, 0, sizeof(m_dates));
}
nsDecodeAppleFile::~nsDecodeAppleFile()
@ -152,13 +152,13 @@ NS_IMETHODIMP nsDecodeAppleFile::Close(void)
GetVolParmsInfoBuffer vp;
DTPBRec dtp;
nsCRT::zero((void *) &vinfo, sizeof (vinfo));
memset((void *) &vinfo, 0, sizeof (vinfo));
vinfo.ioVRefNum = fpb->ioVRefNum;
vinfo.ioBuffer = (Ptr) &vp;
vinfo.ioReqCount = sizeof (vp);
if (PBHGetVolParmsSync((HParmBlkPtr) &vinfo) == noErr && ((vp.vMAttrib >> bHasDesktopMgr) & 1))
{
nsCRT::zero((void *) &dtp, sizeof (dtp));
memset((void *) &dtp, 0, sizeof (dtp));
dtp.ioVRefNum = fpb->ioVRefNum;
if (PBDTGetPath(&dtp) == noErr)
{

View File

@ -67,7 +67,7 @@ extern const PRUnichar kIsoLatin1ToUCS2[256];
void* operator new(size_t sz) { \
void* rv = ::operator new(sz); \
if (rv) { \
nsCRT::zero(rv, sz); \
memset(rv, 0, sz); \
} \
return rv; \
} \
@ -85,7 +85,7 @@ extern const PRUnichar kIsoLatin1ToUCS2[256];
void* _class::operator new(size_t sz) { \
void* rv = ::operator new(sz); \
if (rv) { \
nsCRT::zero(rv, sz); \
memset(rv, 0, sz); \
} \
return rv; \
} \
@ -134,10 +134,10 @@ public:
::memset(aDest, aByte, aCount);
}
static void zero(void* aDest, PRUint32 aCount) {
NS_ASSERTION((aDest != NULL) || (aCount == 0), "Invalid NULL argument");
::memset(aDest, 0, (size_t)aCount);
}
/****
**** nsCRT::zero() is no longer supported.
**** Please use memset from standard C instead.
****/
/** Compute the string length of s
@param s the string in question

View File

@ -56,7 +56,7 @@ nsDeque::nsDeque(nsDequeFunctor* aDeallocator) {
mOrigin=mSize=0;
mData=mBuffer; // don't allocate space until you must
mCapacity=sizeof(mBuffer)/sizeof(mBuffer[0]);
nsCRT::zero(mData,mCapacity*sizeof(mBuffer[0]));
memset(mData, 0, mCapacity*sizeof(mBuffer[0]));
}
@ -122,7 +122,7 @@ void nsDeque::SetDeallocator(nsDequeFunctor* aDeallocator){
*/
nsDeque& nsDeque::Empty() {
if((0<mCapacity) && (mData)) {
nsCRT::zero(mData,mCapacity*sizeof(mData));
memset(mData, 0, mCapacity*sizeof(mData));
}
mSize=0;
mOrigin=0;