Replace ZeroMemory(p,l) with memset(p,0,l)

Günther Brammer 2011-03-12 14:59:41 +01:00
parent 2820716057
commit 040ebfa612
11 changed files with 12 additions and 13 deletions

View File

@ -575,7 +575,7 @@ void C4TeamList::CompileFunc(StdCompiler *pComp)
if ((iTeamCapacity = iTeamCount))
{
ppList = new C4Team *[iTeamCapacity];
ZeroMemory(ppList, sizeof(C4Team *)*iTeamCapacity);
memset(ppList, 0, sizeof(C4Team *)*iTeamCapacity);
}
else
ppList = NULL;

View File

@ -116,7 +116,7 @@ void C4MCCallbackArray::EnablePixel(int32_t iX, int32_t iY)
// create bitmap
int32_t iSize=(iWdt*iHgt+7)/8;
pMap = new BYTE[iSize];
ZeroMemory(pMap, iSize);
memset(pMap, 0, iSize);
// done
}
// safety: do not set outside map!

View File

@ -246,7 +246,7 @@ void C4ParticleChunk::Clear()
{
// note that this method is called in ctor with uninitialized data!
// simply clear mem - this won't adjust any counts!
ZeroMemory(Data, sizeof(Data));
memset(Data, 0, sizeof(Data));
// init list
C4Particle *particle=Data;
for (int32_t i=0; i < C4Px_BufSize; ++i)

View File

@ -422,7 +422,7 @@ C4SolidMask::C4SolidMask(C4Object *pForObject) : pForObject(pForObject)
// the upper left corner is here the [objpos]+rot([shapexy]+[targetxy]+[realWH]/2)-maxWH/2
MatBuffPitch = (int) sqrt(double(pForObject->SolidMask.Wdt * pForObject->SolidMask.Wdt + pForObject->SolidMask.Hgt * pForObject->SolidMask.Hgt))+1;
if (!(pSolidMaskMatBuff= new BYTE [MatBuffPitch * MatBuffPitch] )) return;
ZeroMemory(pSolidMaskMatBuff, MatBuffPitch * MatBuffPitch);
memset(pSolidMaskMatBuff, 0, MatBuffPitch * MatBuffPitch);
sfcBitmap->Unlock();
}

View File

@ -165,7 +165,7 @@ void C4Weather::SetSeasonGamma()
// get season num and offset
int32_t iSeason1=(Season/25)%4; int32_t iSeason2=(iSeason1+1)%4;
int32_t iSeasonOff1=BoundBy(Season%25, 5, 19)-5; int32_t iSeasonOff2=15-iSeasonOff1;
DWORD dwClr[3]; ZeroMemory(dwClr, sizeof(DWORD)*3);
DWORD dwClr[3]; memset(dwClr, 0, sizeof(DWORD)*3);
// interpolate between season colors
for (int32_t i=0; i<3; ++i)
for (int32_t iChan=0; iChan<24; iChan+=8)

View File

@ -210,7 +210,7 @@ void C4MapFolderData::CompileFunc(StdCompiler *pComp)
if (iScenCount)
{
ppScenList = new Scenario *[iScenCount];
ZeroMemory(ppScenList, sizeof(Scenario *)*iScenCount);
memset(ppScenList, 0, sizeof(Scenario *)*iScenCount);
}
else
ppScenList = NULL;
@ -230,7 +230,7 @@ void C4MapFolderData::CompileFunc(StdCompiler *pComp)
if (iAccessGfxCount)
{
ppAccessGfxList = new AccessGfx *[iAccessGfxCount];
ZeroMemory(ppAccessGfxList, sizeof(AccessGfx *)*iAccessGfxCount);
memset(ppAccessGfxList, 0, sizeof(AccessGfx *)*iAccessGfxCount);
}
else
ppAccessGfxList = NULL;

View File

@ -1345,7 +1345,7 @@ bool C4NetIOSimpleUDP::Init(uint16_t inPort)
naddr.sin_family = AF_INET;
naddr.sin_port = (iPort == P_NONE ? 0 : htons(iPort));
naddr.sin_addr.s_addr = INADDR_ANY;
ZeroMemory(naddr.sin_zero, sizeof naddr.sin_zero);
memset(naddr.sin_zero, 0, sizeof naddr.sin_zero);
if (::bind(sock, reinterpret_cast<sockaddr *>(&naddr), sizeof naddr) == SOCKET_ERROR)
{
SetError("could not bind socket", true);
@ -1863,7 +1863,7 @@ bool C4NetIOUDP::InitBroadcast(addr_t *pBroadcastAddr)
// set up adress
MCAddr.sin_family = AF_INET;
MCAddr.sin_port = htons(iPort);
ZeroMemory(&MCAddr.sin_zero, sizeof MCAddr.sin_zero);
memset(&MCAddr.sin_zero, 0, sizeof MCAddr.sin_zero);
// search for a free one
for (int iRetries = 1000; iRetries; iRetries--)
{

View File

@ -195,7 +195,6 @@ inline int stricmp(const char *s1, const char *s2)
return strcasecmp(s1, s2);
}
#define ZeroMemory(d,l) memset((d), 0, (l))
#endif //_WIN32

View File

@ -1199,7 +1199,7 @@ void CStdDDraw::ApplyGamma()
// calc offset for curve points
for (int32_t iCurve=0; iCurve<3; ++iCurve)
{
ZeroMemory(ChanOff, sizeof(int32_t)*3);
memset(ChanOff, 0, sizeof(int32_t)*3);
// ...channels...
for (int32_t iChan=0; iChan<3; ++iChan)
// ...ramps...

View File

@ -260,7 +260,7 @@ bool CSurface::CreateTextures(int MaxTextureSize)
iTexY=(Hgt-1)/iTexSize +1;
// get mem for texture array
ppTex = new CTexRef * [iTexX*iTexY];
ZeroMemory(ppTex, iTexX*iTexY*sizeof(CTexRef *));
memset(ppTex, 0, iTexX*iTexY*sizeof(CTexRef *));
// cvan't be render target if it's not a single surface
if (!IsSingleSurface()) fIsRenderTarget = false;
// create textures

View File

@ -94,7 +94,7 @@ bool CSurface8::Create(int iWdt, int iHgt)
Bits=new BYTE[Wdt*Hgt];
if (!Bits) return false;
ZeroMemory(Bits, Wdt*Hgt);
memset(Bits, 0, Wdt*Hgt);
Pitch=Wdt;
// update clipping
NoClip();