mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 23:31:56 +00:00
No bug - add proper casts so EMX builds
This commit is contained in:
parent
5814356f05
commit
7a6bb4f98a
@ -43,8 +43,8 @@ class RgnRectMemoryAllocator
|
||||
void* AllocChunk (PRUint32 aEntries, void* aNextChunk, nsRegion::RgnRect* aTailDest)
|
||||
{
|
||||
PRUint8* pBuf = new PRUint8 [aEntries * sizeof (nsRegion::RgnRect) + sizeof (void*)];
|
||||
*NS_STATIC_CAST (void**, pBuf) = aNextChunk;
|
||||
nsRegion::RgnRect* pRect = NS_STATIC_CAST (nsRegion::RgnRect*, pBuf + sizeof (void*));
|
||||
*NS_REINTERPRET_CAST (void**, pBuf) = aNextChunk;
|
||||
nsRegion::RgnRect* pRect = NS_REINTERPRET_CAST (nsRegion::RgnRect*, pBuf + sizeof (void*));
|
||||
|
||||
for (PRUint32 cnt = 0 ; cnt < aEntries - 1 ; cnt++)
|
||||
pRect [cnt].next = &pRect [cnt + 1];
|
||||
@ -58,7 +58,7 @@ class RgnRectMemoryAllocator
|
||||
void* NextChunk (const void* aThisChunk) const { return *NS_STATIC_CAST (void**, aThisChunk); }
|
||||
|
||||
nsRegion::RgnRect* ChunkHead (const void* aThisChunk) const
|
||||
{ return NS_STATIC_CAST (nsRegion::RgnRect*, NS_STATIC_CAST (PRUint8*, aThisChunk) + sizeof (void*)); }
|
||||
{ return NS_REINTERPRET_CAST (nsRegion::RgnRect*, NS_STATIC_CAST (PRUint8*, aThisChunk) + sizeof (void*)); }
|
||||
|
||||
public:
|
||||
RgnRectMemoryAllocator (PRUint32 aNumOfEntries);
|
||||
|
@ -116,15 +116,15 @@ nsresult nsRegionImpl::GetRects (nsRegionRectSet **aRects)
|
||||
if (pRegionSet == nsnull) // Not yet allocated
|
||||
{
|
||||
PRUint8* pBuf = new PRUint8 [sizeof (nsRegionRectSet) + NumRects * sizeof (nsRegionRect)];
|
||||
pRegionSet = NS_STATIC_CAST (nsRegionRectSet*, pBuf);
|
||||
pRegionSet = NS_REINTERPRET_CAST (nsRegionRectSet*, pBuf);
|
||||
pRegionSet->mRectsLen = NumRects + 1;
|
||||
} else // Already allocated in previous call
|
||||
{
|
||||
if (NumRects > pRegionSet->mRectsLen) // passed array is not big enough - reallocate it.
|
||||
{
|
||||
delete [] NS_STATIC_CAST (PRUint8*, pRegionSet);
|
||||
delete [] NS_REINTERPRET_CAST (PRUint8*, pRegionSet);
|
||||
PRUint8* pBuf = new PRUint8 [sizeof (nsRegionRectSet) + NumRects * sizeof (nsRegionRect)];
|
||||
pRegionSet = NS_STATIC_CAST (nsRegionRectSet*, pBuf);
|
||||
pRegionSet = NS_REINTERPRET_CAST (nsRegionRectSet*, pBuf);
|
||||
pRegionSet->mRectsLen = NumRects + 1;
|
||||
}
|
||||
}
|
||||
@ -154,7 +154,7 @@ nsresult nsRegionImpl::FreeRects (nsRegionRectSet *aRects)
|
||||
if (!aRects)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
delete [] NS_STATIC_CAST (PRUint8*, aRects);
|
||||
delete [] NS_REINTERPRET_CAST (PRUint8*, aRects);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user