mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-14 10:37:41 -04:00
Replace ZEROPTR() with memset.
This commit is contained in:
@ -166,8 +166,6 @@ inline void CDECL operator delete (void *, void *) {}
|
||||
|
||||
#define ALLOCZERO(b) MemAlloc(b, kMemZero, __FILE__, __LINE__)
|
||||
#define ZERO(s) MemSet(&s, 0, sizeof(s))
|
||||
#define ZEROPTR(p) MemSet(p, 0, sizeof(*p))
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
|
@ -196,8 +196,8 @@ static void SocketGetAddresses (
|
||||
NetAddress * remoteAddr
|
||||
) {
|
||||
// NetAddress may be bigger than sockaddr_in so start by zeroing the whole thing
|
||||
ZEROPTR(localAddr);
|
||||
ZEROPTR(remoteAddr);
|
||||
memset(localAddr, 0, sizeof(*localAddr));
|
||||
memset(remoteAddr, 0, sizeof(*remoteAddr));
|
||||
|
||||
// don't have to enter critsect or validate socket before referencing it
|
||||
// because this routine is called before the user has a chance to close it
|
||||
|
@ -66,7 +66,7 @@ static BOOL MYIMAGEAPI iSymGetModuleInfo (
|
||||
DWORD,
|
||||
IMAGEHLP_MODULE * ModuleInfo
|
||||
) {
|
||||
ZEROPTR(ModuleInfo);
|
||||
memset(ModuleInfo, 0, sizeof(*ModuleInfo));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -109,7 +109,7 @@ static BOOL MYIMAGEAPI iSymGetSymFromAddr (
|
||||
PIMAGEHLP_SYMBOL Symbol
|
||||
) {
|
||||
*Displacement = 0;
|
||||
ZEROPTR(Symbol);
|
||||
memset(Symbol, 0, sizeof(*Symbol));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,7 @@ bool Srv2DbValidateConnect (
|
||||
return false;
|
||||
}
|
||||
|
||||
ZEROPTR(connectPtr);
|
||||
memset(connectPtr, 0, sizeof(*connectPtr));
|
||||
MemCopy(connectPtr, &connect, min(sizeof(*connectPtr), connect.dataBytes));
|
||||
|
||||
listen->bytesProcessed += connect.dataBytes;
|
||||
|
@ -79,7 +79,7 @@ bool Srv2LogValidateConnect (
|
||||
connect.srvType == kSrvTypeMcp || connect.srvType == kSrvTypeState || connect.srvType == kSrvTypeFile || connect.srvType == kSrvTypeDll))
|
||||
return false;
|
||||
|
||||
ZEROPTR(connectPtr);
|
||||
memset(connectPtr, 0, sizeof(*connectPtr));
|
||||
MemCopy(connectPtr, &connect, min(sizeof(*connectPtr), connect.dataBytes));
|
||||
|
||||
listen->bytesProcessed += connect.dataBytes;
|
||||
|
@ -77,7 +77,7 @@ bool Srv2McpValidateConnect (
|
||||
if (!(connect.srvType == kSrvTypeAuth || connect.srvType == kSrvTypeGame))
|
||||
return false;
|
||||
|
||||
ZEROPTR(connectPtr);
|
||||
memset(connectPtr, 0, sizeof(*connectPtr));
|
||||
MemCopy(connectPtr, &connect, min(sizeof(*connectPtr), connect.dataBytes));
|
||||
|
||||
listen->bytesProcessed += connect.dataBytes;
|
||||
|
@ -78,7 +78,7 @@ bool Srv2ScoreValidateConnect (
|
||||
if (!(connect.srvType == kSrvTypeAuth || connect.srvType == kSrvTypeGame))
|
||||
return false;
|
||||
|
||||
ZEROPTR(connectPtr);
|
||||
memset(connectPtr, 0, sizeof(*connectPtr));
|
||||
MemCopy(connectPtr, &connect, min(sizeof(*connectPtr), connect.dataBytes));
|
||||
|
||||
listen->bytesProcessed += connect.dataBytes;
|
||||
|
@ -78,7 +78,7 @@ bool Srv2StateValidateConnect (
|
||||
if (!(connect.srvType == kSrvTypeAuth || connect.srvType == kSrvTypeGame))
|
||||
return false;
|
||||
|
||||
ZEROPTR(connectPtr);
|
||||
memset(connectPtr, 0, sizeof(*connectPtr));
|
||||
MemCopy(connectPtr, &connect, min(sizeof(*connectPtr), connect.dataBytes));
|
||||
|
||||
listen->bytesProcessed += connect.dataBytes;
|
||||
|
@ -77,7 +77,7 @@ bool Srv2VaultValidateConnect (
|
||||
if (!(connect.srvType == kSrvTypeAuth || connect.srvType == kSrvTypeGame || connect.srvType == kSrvTypeMcp))
|
||||
return false;
|
||||
|
||||
ZEROPTR(connectPtr);
|
||||
memset(connectPtr, 0, sizeof(*connectPtr));
|
||||
MemCopy(connectPtr, &connect, min(sizeof(*connectPtr), connect.dataBytes));
|
||||
|
||||
listen->bytesProcessed += connect.dataBytes;
|
||||
|
@ -229,7 +229,7 @@ bool NetAddressFromString (NetAddress * addr, const wchar_t str[], unsigned defa
|
||||
ASSERT(str);
|
||||
|
||||
// NetAddress is bigger than sockaddr_in so start by zeroing the whole thing
|
||||
ZEROPTR(addr);
|
||||
memset(addr, 0, sizeof(*addr));
|
||||
|
||||
for (;;) {
|
||||
NetAddressNode node = NodeFromString(&str);
|
||||
@ -278,7 +278,7 @@ void NetAddressFromNode (
|
||||
unsigned port,
|
||||
NetAddress * addr
|
||||
) {
|
||||
ZEROPTR(addr);
|
||||
memset(addr, 0, sizeof(*addr));
|
||||
sockaddr_in * inetaddr = (sockaddr_in *) addr;
|
||||
inetaddr->sin_family = AF_INET;
|
||||
inetaddr->sin_addr.S_un.S_addr = htonl(node);
|
||||
|
Reference in New Issue
Block a user