зеркало из https://github.com/mozilla/pjs.git
eliminate nsCRT::zero() to use memset to zero instead, bug 118135, r=dp sr=waterson
This commit is contained in:
Родитель
a150c8ccad
Коммит
370959ffe2
|
@ -117,7 +117,7 @@ nsDOMEvent::operator new(size_t aSize)
|
|||
}
|
||||
|
||||
if (result) {
|
||||
nsCRT::zero(result, aSize);
|
||||
memset(result, 0, aSize);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
Загрузка…
Ссылка в новой задаче