mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-14 02:27:40 -04:00
Replace MemZero with memset.
This commit is contained in:
@ -84,8 +84,6 @@ unsigned MemSize (void * ptr);
|
||||
int MemCmp (const void * buf1, const void * buf2, unsigned bytes);
|
||||
void MemCopy (void * dest, const void * source, unsigned bytes);
|
||||
void MemMove (void * dest, const void * source, unsigned bytes);
|
||||
void MemSet (void * dest, unsigned value, unsigned bytes);
|
||||
void MemZero (void * dest, unsigned bytes);
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
|
@ -487,7 +487,7 @@ void * MemAlloc (unsigned bytes, unsigned flags, const char file[], int line) {
|
||||
// In debug mode ensure that memory is initialized to some freaky value
|
||||
#ifdef HS_DEBUGGING
|
||||
if (! (flags & kMemZero))
|
||||
MemSet(ptr, (uint8_t) ((uintptr_t)ptr >> 4), bytes);
|
||||
memset(ptr, (uint8_t) ((uintptr_t)ptr >> 4), bytes);
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
@ -620,16 +620,6 @@ void MemMove (void * dest, const void * source, unsigned bytes) {
|
||||
memmove(dest, source, bytes);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
void MemSet (void * dest, unsigned value, unsigned bytes) {
|
||||
memset(dest, value, bytes);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
void MemZero (void * dest, unsigned bytes) {
|
||||
memset(dest, 0, bytes);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
void * MemDup (const void * ptr, unsigned bytes, unsigned flags, const char file[], int line) {
|
||||
void * dst = MemAlloc(bytes, flags, file, line);
|
||||
|
@ -178,7 +178,7 @@ ENetError pfGameScoreMgr::CreateScore(
|
||||
pfGameScore& score
|
||||
) {
|
||||
CreateScoreOp param;
|
||||
MemZero(¶m, sizeof(CreateScoreOp));
|
||||
memset(¶m, 0, sizeof(CreateScoreOp));
|
||||
param.score = &score;
|
||||
|
||||
NetCliAuthScoreCreate(
|
||||
@ -205,7 +205,7 @@ ENetError pfGameScoreMgr::DeleteScore(
|
||||
unsigned scoreId
|
||||
) {
|
||||
NetWaitOp param;
|
||||
MemZero(¶m, sizeof(NetWaitOp));
|
||||
memset(¶m, 0, sizeof(NetWaitOp));
|
||||
|
||||
NetCliAuthScoreDelete(
|
||||
scoreId,
|
||||
@ -277,7 +277,7 @@ ENetError pfGameScoreMgr::GetScoresIncRef(
|
||||
int& outScoreListCount
|
||||
) {
|
||||
GetScoresOp param;
|
||||
MemZero(¶m, sizeof(GetScoresOp));
|
||||
memset(¶m, 0, sizeof(GetScoresOp));
|
||||
param.scores = &outScoreList;
|
||||
param.scoreCount = &outScoreListCount;
|
||||
|
||||
@ -304,7 +304,7 @@ ENetError pfGameScoreMgr::AddPoints(
|
||||
int numPoints
|
||||
) {
|
||||
NetWaitOp param;
|
||||
MemZero(¶m, sizeof(NetWaitOp));
|
||||
memset(¶m, 0, sizeof(NetWaitOp));
|
||||
|
||||
NetCliAuthScoreAddPoints(
|
||||
scoreId,
|
||||
@ -336,7 +336,7 @@ ENetError pfGameScoreMgr::TransferPoints(
|
||||
int numPoints
|
||||
) {
|
||||
NetWaitOp param;
|
||||
MemZero(¶m, sizeof(NetWaitOp));
|
||||
memset(¶m, 0, sizeof(NetWaitOp));
|
||||
|
||||
NetCliAuthScoreTransferPoints(
|
||||
srcScoreId,
|
||||
@ -371,7 +371,7 @@ ENetError pfGameScoreMgr::SetPoints(
|
||||
int numPoints
|
||||
) {
|
||||
NetWaitOp param;
|
||||
MemZero(¶m, sizeof(NetWaitOp));
|
||||
memset(¶m, 0, sizeof(NetWaitOp));
|
||||
|
||||
NetCliAuthScoreSetPoints(
|
||||
scoreId,
|
||||
@ -448,7 +448,7 @@ ENetError pfGameScoreMgr::GetRankList(
|
||||
int& outRankListCount
|
||||
) {
|
||||
GetRanksOp param;
|
||||
MemZero(¶m, sizeof(GetRanksOp));
|
||||
memset(¶m, 0, sizeof(GetRanksOp));
|
||||
param.ranks = &outRankList;
|
||||
param.rankCount = &outRankListCount;
|
||||
|
||||
|
@ -448,7 +448,7 @@ bool INtFileOpCompleteReadWrite (
|
||||
if (!file->sectorSizeMask)
|
||||
ErrorFatal(__LINE__, __FILE__, "Disk %s failed", op->opType == kOpFileRead ? "read" : "write");
|
||||
if (op->opType == kOpFileRead)
|
||||
MemZero(op->rw.buffer + bytes, op->win32Bytes - bytes);
|
||||
memset(op->rw.buffer + bytes, 0, op->win32Bytes - bytes);
|
||||
}
|
||||
|
||||
if (op->masterOp) {
|
||||
|
@ -548,7 +548,7 @@ static SOCKET ListenSocket (NetAddress * listenAddr) {
|
||||
addr.sin_family = AF_INET;
|
||||
addr.sin_port = htons((uint16_t)port);
|
||||
addr.sin_addr.S_un.S_addr = htonl(node);
|
||||
MemZero(addr.sin_zero, sizeof(addr.sin_zero));
|
||||
memset(addr.sin_zero, 0, sizeof(addr.sin_zero));
|
||||
if (bind(s, (sockaddr *) &addr, sizeof(addr))) {
|
||||
wchar_t str[32];
|
||||
NetAddressToString(*listenAddr, str, arrsize(str), kNetAddressFormatAll);
|
||||
@ -632,7 +632,7 @@ static SOCKET ConnectSocket (unsigned localPort, const NetAddress & addr) {
|
||||
addr.sin_family = AF_INET;
|
||||
addr.sin_port = htons((uint16_t) localPort);
|
||||
addr.sin_addr.S_un.S_addr = INADDR_ANY;
|
||||
MemZero(addr.sin_zero, sizeof(addr.sin_zero));
|
||||
memset(addr.sin_zero, 0, sizeof(addr.sin_zero));
|
||||
if (bind(s, (sockaddr *) &addr, sizeof(addr))) {
|
||||
LogMsg(kLogError, "bind(port %u) failed (%u)", localPort, WSAGetLastError());
|
||||
break;
|
||||
|
@ -215,7 +215,7 @@ void CFile::Read (
|
||||
|
||||
// Handle errors
|
||||
if (bytesRead != bytes)
|
||||
MemZero((uint8_t *)buffer + bytesRead, bytes - bytesRead);
|
||||
memset((uint8_t *)buffer + bytesRead, 0, bytes - bytesRead);
|
||||
if ( (!result && (GetLastError() != ERROR_IO_PENDING)) ||
|
||||
(bytesRead != bytes) )
|
||||
LogMsg(kLogFatal, "failed: ReadFile");
|
||||
|
@ -110,7 +110,7 @@ static void LookupProcess (Lookup * lookup, unsigned error) {
|
||||
|
||||
// allocate a buffer large enough to hold all the addresses
|
||||
addrs = (NetAddress *)malloc(sizeof(*addrs) * count);
|
||||
MemZero(addrs, sizeof(*addrs) * count);
|
||||
memset(addrs, 0, sizeof(*addrs) * count);
|
||||
|
||||
// fill in address data
|
||||
const uint16_t port = htons((uint16_t) lookup->port);
|
||||
|
@ -260,7 +260,7 @@ void TBuffer<T>::SetCount (unsigned count) {
|
||||
template<class T>
|
||||
void TBuffer<T>::Zero () {
|
||||
if (m_data)
|
||||
MemZero(m_data, Bytes());
|
||||
memset(m_data, 0, Bytes());
|
||||
}
|
||||
|
||||
typedef TBuffer<uint8_t> CBuffer;
|
||||
@ -678,7 +678,7 @@ const T * TFArray<T,C>::Top () const {
|
||||
template<class T, class C>
|
||||
void TFArray<T,C>::Zero () {
|
||||
C::Destruct(m_data, m_count);
|
||||
MemZero(m_data, m_count * sizeof(T));
|
||||
memset(m_data, 0, m_count * sizeof(T));
|
||||
C::Construct(m_data, m_count);
|
||||
}
|
||||
|
||||
@ -694,7 +694,7 @@ template<class T, class C>
|
||||
void TFArray<T,C>::ZeroRange (unsigned index, unsigned count) {
|
||||
ASSERT(index + count <= m_count);
|
||||
C::Destruct(m_data + index, count);
|
||||
MemZero(m_data + index, count * sizeof(T));
|
||||
memset(m_data + index, 0, count * sizeof(T));
|
||||
C::Construct(m_data + index, count);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user