forked from Mirrors/openclonk
Replace ZeroMemory(p,l) with memset(p,0,l)
parent
2820716057
commit
040ebfa612
|
@ -575,7 +575,7 @@ void C4TeamList::CompileFunc(StdCompiler *pComp)
|
||||||
if ((iTeamCapacity = iTeamCount))
|
if ((iTeamCapacity = iTeamCount))
|
||||||
{
|
{
|
||||||
ppList = new C4Team *[iTeamCapacity];
|
ppList = new C4Team *[iTeamCapacity];
|
||||||
ZeroMemory(ppList, sizeof(C4Team *)*iTeamCapacity);
|
memset(ppList, 0, sizeof(C4Team *)*iTeamCapacity);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ppList = NULL;
|
ppList = NULL;
|
||||||
|
|
|
@ -116,7 +116,7 @@ void C4MCCallbackArray::EnablePixel(int32_t iX, int32_t iY)
|
||||||
// create bitmap
|
// create bitmap
|
||||||
int32_t iSize=(iWdt*iHgt+7)/8;
|
int32_t iSize=(iWdt*iHgt+7)/8;
|
||||||
pMap = new BYTE[iSize];
|
pMap = new BYTE[iSize];
|
||||||
ZeroMemory(pMap, iSize);
|
memset(pMap, 0, iSize);
|
||||||
// done
|
// done
|
||||||
}
|
}
|
||||||
// safety: do not set outside map!
|
// safety: do not set outside map!
|
||||||
|
|
|
@ -246,7 +246,7 @@ void C4ParticleChunk::Clear()
|
||||||
{
|
{
|
||||||
// note that this method is called in ctor with uninitialized data!
|
// note that this method is called in ctor with uninitialized data!
|
||||||
// simply clear mem - this won't adjust any counts!
|
// simply clear mem - this won't adjust any counts!
|
||||||
ZeroMemory(Data, sizeof(Data));
|
memset(Data, 0, sizeof(Data));
|
||||||
// init list
|
// init list
|
||||||
C4Particle *particle=Data;
|
C4Particle *particle=Data;
|
||||||
for (int32_t i=0; i < C4Px_BufSize; ++i)
|
for (int32_t i=0; i < C4Px_BufSize; ++i)
|
||||||
|
|
|
@ -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
|
// 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;
|
MatBuffPitch = (int) sqrt(double(pForObject->SolidMask.Wdt * pForObject->SolidMask.Wdt + pForObject->SolidMask.Hgt * pForObject->SolidMask.Hgt))+1;
|
||||||
if (!(pSolidMaskMatBuff= new BYTE [MatBuffPitch * MatBuffPitch] )) return;
|
if (!(pSolidMaskMatBuff= new BYTE [MatBuffPitch * MatBuffPitch] )) return;
|
||||||
ZeroMemory(pSolidMaskMatBuff, MatBuffPitch * MatBuffPitch);
|
memset(pSolidMaskMatBuff, 0, MatBuffPitch * MatBuffPitch);
|
||||||
sfcBitmap->Unlock();
|
sfcBitmap->Unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -165,7 +165,7 @@ void C4Weather::SetSeasonGamma()
|
||||||
// get season num and offset
|
// get season num and offset
|
||||||
int32_t iSeason1=(Season/25)%4; int32_t iSeason2=(iSeason1+1)%4;
|
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;
|
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
|
// interpolate between season colors
|
||||||
for (int32_t i=0; i<3; ++i)
|
for (int32_t i=0; i<3; ++i)
|
||||||
for (int32_t iChan=0; iChan<24; iChan+=8)
|
for (int32_t iChan=0; iChan<24; iChan+=8)
|
||||||
|
|
|
@ -210,7 +210,7 @@ void C4MapFolderData::CompileFunc(StdCompiler *pComp)
|
||||||
if (iScenCount)
|
if (iScenCount)
|
||||||
{
|
{
|
||||||
ppScenList = new Scenario *[iScenCount];
|
ppScenList = new Scenario *[iScenCount];
|
||||||
ZeroMemory(ppScenList, sizeof(Scenario *)*iScenCount);
|
memset(ppScenList, 0, sizeof(Scenario *)*iScenCount);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ppScenList = NULL;
|
ppScenList = NULL;
|
||||||
|
@ -230,7 +230,7 @@ void C4MapFolderData::CompileFunc(StdCompiler *pComp)
|
||||||
if (iAccessGfxCount)
|
if (iAccessGfxCount)
|
||||||
{
|
{
|
||||||
ppAccessGfxList = new AccessGfx *[iAccessGfxCount];
|
ppAccessGfxList = new AccessGfx *[iAccessGfxCount];
|
||||||
ZeroMemory(ppAccessGfxList, sizeof(AccessGfx *)*iAccessGfxCount);
|
memset(ppAccessGfxList, 0, sizeof(AccessGfx *)*iAccessGfxCount);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ppAccessGfxList = NULL;
|
ppAccessGfxList = NULL;
|
||||||
|
|
|
@ -1345,7 +1345,7 @@ bool C4NetIOSimpleUDP::Init(uint16_t inPort)
|
||||||
naddr.sin_family = AF_INET;
|
naddr.sin_family = AF_INET;
|
||||||
naddr.sin_port = (iPort == P_NONE ? 0 : htons(iPort));
|
naddr.sin_port = (iPort == P_NONE ? 0 : htons(iPort));
|
||||||
naddr.sin_addr.s_addr = INADDR_ANY;
|
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)
|
if (::bind(sock, reinterpret_cast<sockaddr *>(&naddr), sizeof naddr) == SOCKET_ERROR)
|
||||||
{
|
{
|
||||||
SetError("could not bind socket", true);
|
SetError("could not bind socket", true);
|
||||||
|
@ -1863,7 +1863,7 @@ bool C4NetIOUDP::InitBroadcast(addr_t *pBroadcastAddr)
|
||||||
// set up adress
|
// set up adress
|
||||||
MCAddr.sin_family = AF_INET;
|
MCAddr.sin_family = AF_INET;
|
||||||
MCAddr.sin_port = htons(iPort);
|
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
|
// search for a free one
|
||||||
for (int iRetries = 1000; iRetries; iRetries--)
|
for (int iRetries = 1000; iRetries; iRetries--)
|
||||||
{
|
{
|
||||||
|
|
|
@ -195,7 +195,6 @@ inline int stricmp(const char *s1, const char *s2)
|
||||||
return strcasecmp(s1, s2);
|
return strcasecmp(s1, s2);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define ZeroMemory(d,l) memset((d), 0, (l))
|
|
||||||
#endif //_WIN32
|
#endif //_WIN32
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1199,7 +1199,7 @@ void CStdDDraw::ApplyGamma()
|
||||||
// calc offset for curve points
|
// calc offset for curve points
|
||||||
for (int32_t iCurve=0; iCurve<3; ++iCurve)
|
for (int32_t iCurve=0; iCurve<3; ++iCurve)
|
||||||
{
|
{
|
||||||
ZeroMemory(ChanOff, sizeof(int32_t)*3);
|
memset(ChanOff, 0, sizeof(int32_t)*3);
|
||||||
// ...channels...
|
// ...channels...
|
||||||
for (int32_t iChan=0; iChan<3; ++iChan)
|
for (int32_t iChan=0; iChan<3; ++iChan)
|
||||||
// ...ramps...
|
// ...ramps...
|
||||||
|
|
|
@ -260,7 +260,7 @@ bool CSurface::CreateTextures(int MaxTextureSize)
|
||||||
iTexY=(Hgt-1)/iTexSize +1;
|
iTexY=(Hgt-1)/iTexSize +1;
|
||||||
// get mem for texture array
|
// get mem for texture array
|
||||||
ppTex = new CTexRef * [iTexX*iTexY];
|
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
|
// cvan't be render target if it's not a single surface
|
||||||
if (!IsSingleSurface()) fIsRenderTarget = false;
|
if (!IsSingleSurface()) fIsRenderTarget = false;
|
||||||
// create textures
|
// create textures
|
||||||
|
|
|
@ -94,7 +94,7 @@ bool CSurface8::Create(int iWdt, int iHgt)
|
||||||
|
|
||||||
Bits=new BYTE[Wdt*Hgt];
|
Bits=new BYTE[Wdt*Hgt];
|
||||||
if (!Bits) return false;
|
if (!Bits) return false;
|
||||||
ZeroMemory(Bits, Wdt*Hgt);
|
memset(Bits, 0, Wdt*Hgt);
|
||||||
Pitch=Wdt;
|
Pitch=Wdt;
|
||||||
// update clipping
|
// update clipping
|
||||||
NoClip();
|
NoClip();
|
||||||
|
|
Loading…
Reference in New Issue