Browse Source

Replace ZEROPTR() with memset.

Darryl Pogue 13 years ago committed by Adam Johnson
parent
commit
30430d3024
  1. 2
      Sources/Plasma/CoreLib/hsMalloc.h
  2. 4
      Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/Nt/pnAceNtSocket.cpp
  3. 4
      Sources/Plasma/NucleusLib/pnCrashExe/Win32/pnCreTools.cpp
  4. 2
      Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Db/pnNpSrv2Db.cpp
  5. 2
      Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Log/pnNpSrv2Log.cpp
  6. 2
      Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Mcp/pnNpSrv2Mcp.cpp
  7. 2
      Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Score/pnNpSrv2Score.cpp
  8. 2
      Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2State/pnNpSrv2State.cpp
  9. 2
      Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Vault/pnNpSrv2Vault.cpp
  10. 4
      Sources/Plasma/NucleusLib/pnUtils/Private/Win32/pnUtW32Addr.cpp

2
Sources/Plasma/CoreLib/hsMalloc.h

@ -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

4
Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/Nt/pnAceNtSocket.cpp

@ -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

4
Sources/Plasma/NucleusLib/pnCrashExe/Win32/pnCreTools.cpp

@ -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;
}

2
Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Db/pnNpSrv2Db.cpp

@ -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;

2
Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Log/pnNpSrv2Log.cpp

@ -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;

2
Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Mcp/pnNpSrv2Mcp.cpp

@ -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;

2
Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Score/pnNpSrv2Score.cpp

@ -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;

2
Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2State/pnNpSrv2State.cpp

@ -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;

2
Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Vault/pnNpSrv2Vault.cpp

@ -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;

4
Sources/Plasma/NucleusLib/pnUtils/Private/Win32/pnUtW32Addr.cpp

@ -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);

Loading…
Cancel
Save