Browse Source

Replace MemMove, MemCopy, and MemCmp.

Darryl Pogue 13 years ago committed by Adam Johnson
parent
commit
a14a171774
  1. 2
      Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIMultiLineEditCtrl.cpp
  2. 8
      Sources/Plasma/FeatureLib/pfGameMgr/pfGameMgr.cpp
  3. 8
      Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/Nt/pnAceNtSocket.cpp
  4. 4
      Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/W9x/pnAceW9xSocket.cpp
  5. 2
      Sources/Plasma/NucleusLib/pnAsyncCoreExe/pnAceLog.cpp
  6. 16
      Sources/Plasma/NucleusLib/pnNetCli/pnNcCli.cpp
  7. 2
      Sources/Plasma/NucleusLib/pnNetCli/pnNcUtils.cpp
  8. 2
      Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Db/pnNpSrv2Db.cpp
  9. 2
      Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Log/pnNpSrv2Log.cpp
  10. 2
      Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Mcp/pnNpSrv2Mcp.cpp
  11. 2
      Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Score/pnNpSrv2Score.cpp
  12. 2
      Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2State/pnNpSrv2State.cpp
  13. 2
      Sources/Plasma/NucleusLib/pnNetProtocol/Private/Protocols/Srv2Vault/pnNpSrv2Vault.cpp
  14. 6
      Sources/Plasma/NucleusLib/pnNetProtocol/Private/pnNpCommon.cpp
  15. 6
      Sources/Plasma/NucleusLib/pnUUID/pnUUID_Win32.cpp
  16. 2
      Sources/Plasma/NucleusLib/pnUtils/Private/Win32/pnUtW32Misc.cpp
  17. 4
      Sources/Plasma/NucleusLib/pnUtils/Private/pnUtArray.h
  18. 2
      Sources/Plasma/NucleusLib/pnUtils/Private/pnUtCrypt.cpp
  19. 6
      Sources/Plasma/NucleusLib/pnUtils/Private/pnUtSubst.cpp
  20. 2
      Sources/Plasma/NucleusLib/pnUtils/Private/pnUtUuid.cpp
  21. 2
      Sources/Plasma/PubUtilLib/plAudio/plDSoundBuffer.cpp
  22. 6
      Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglAuth.cpp
  23. 2
      Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglFile.cpp
  24. 4
      Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglGame.cpp
  25. 16
      Sources/Plasma/PubUtilLib/plVault/plVaultNodeAccess.cpp

2
Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIMultiLineEditCtrl.cpp

@ -1927,7 +1927,7 @@ void pfGUIMultiLineEditCtrl::DeleteLinesFromTop(int numLines)
hitEnd = false; hitEnd = false;
uint32_t newBufferStart = curChar + 1; // +1 so we eat the newline as well uint32_t newBufferStart = curChar + 1; // +1 so we eat the newline as well
uint32_t newBufferLen = bufferLen - newBufferStart; uint32_t newBufferLen = bufferLen - newBufferStart;
MemCopy(buffer, buffer + newBufferStart, newBufferLen * sizeof(uint16_t)); // copy all bytes after the newline to the beginning memcpy(buffer, buffer + newBufferStart, newBufferLen * sizeof(uint16_t)); // copy all bytes after the newline to the beginning
memset(buffer + newBufferLen, 0, (bufferLen - newBufferLen) * sizeof(uint16_t)); // fill out the rest of the buffer with null chars memset(buffer + newBufferLen, 0, (bufferLen - newBufferLen) * sizeof(uint16_t)); // fill out the rest of the buffer with null chars
bufferLen = newBufferLen; bufferLen = newBufferLen;
break; break;

8
Sources/Plasma/FeatureLib/pfGameMgr/pfGameMgr.cpp

@ -287,7 +287,7 @@ pfGameMgrMsg::~pfGameMgrMsg () {
void pfGameMgrMsg::Set (const GameMsgHeader & msg) { void pfGameMgrMsg::Set (const GameMsgHeader & msg) {
netMsg = (GameMsgHeader *)malloc(msg.messageBytes); netMsg = (GameMsgHeader *)malloc(msg.messageBytes);
MemCopy(netMsg, &msg, msg.messageBytes); memcpy(netMsg, &msg, msg.messageBytes);
} }
@ -314,7 +314,7 @@ pfGameCliMsg::~pfGameCliMsg () {
void pfGameCliMsg::Set (pfGameCli * cli, const GameMsgHeader & msg) { void pfGameCliMsg::Set (pfGameCli * cli, const GameMsgHeader & msg) {
netMsg = (GameMsgHeader *)malloc(msg.messageBytes); netMsg = (GameMsgHeader *)malloc(msg.messageBytes);
MemCopy(netMsg, &msg, msg.messageBytes); memcpy(netMsg, &msg, msg.messageBytes);
gameCli = cli; gameCli = cli;
} }
@ -423,7 +423,7 @@ void pfGameMgr::CreateGame (
msg->createOptions = createOptions; msg->createOptions = createOptions;
msg->messageBytes = msgBytes; msg->messageBytes = msgBytes;
msg->createDataBytes = initBytes; msg->createDataBytes = initBytes;
MemCopy(msg->createData, initData, initBytes); memcpy(msg->createData, initData, initBytes);
GameMgrSend(msg, NEWZERO(JoinTransState)(receiver)); GameMgrSend(msg, NEWZERO(JoinTransState)(receiver));
@ -454,7 +454,7 @@ void pfGameMgr::JoinCommonGame (
msg->createOptions = kGameJoinCommon; msg->createOptions = kGameJoinCommon;
msg->messageBytes = msgBytes; msg->messageBytes = msgBytes;
msg->createDataBytes = initBytes; msg->createDataBytes = initBytes;
MemCopy(msg->createData, initData, initBytes); memcpy(msg->createData, initData, initBytes);
GameMgrSend(msg, NEWZERO(JoinTransState)(receiver)); GameMgrSend(msg, NEWZERO(JoinTransState)(receiver));

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

@ -334,7 +334,7 @@ static NtOpSocketWrite * SocketQueueAsyncWrite (
bytesLeft = min(bytesLeft, bytes); bytesLeft = min(bytesLeft, bytes);
if (bytesLeft) { if (bytesLeft) {
PerfAddCounter(kAsyncPerfSocketBytesWaitQueued, bytesLeft); PerfAddCounter(kAsyncPerfSocketBytesWaitQueued, bytesLeft);
MemCopy(lastQueuedWrite->write.buffer + lastQueuedWrite->write.bytes, data, bytesLeft); memcpy(lastQueuedWrite->write.buffer + lastQueuedWrite->write.bytes, data, bytesLeft);
lastQueuedWrite->write.bytes += bytesLeft; lastQueuedWrite->write.bytes += bytesLeft;
data += bytesLeft; data += bytesLeft;
if (0 == (bytes -= bytesLeft)) if (0 == (bytes -= bytesLeft))
@ -370,7 +370,7 @@ static NtOpSocketWrite * SocketQueueAsyncWrite (
op->write.buffer = (uint8_t *) (op + 1); op->write.buffer = (uint8_t *) (op + 1);
op->write.bytes = bytes; op->write.bytes = bytes;
op->write.bytesProcessed = bytes; op->write.bytesProcessed = bytes;
MemCopy(op->write.buffer, data, bytes); memcpy(op->write.buffer, data, bytes);
InterlockedIncrement(&sock->ioCount); InterlockedIncrement(&sock->ioCount);
PerfAddCounter(kAsyncPerfSocketBytesWaitQueued, bytes); PerfAddCounter(kAsyncPerfSocketBytesWaitQueued, bytes);
@ -1050,7 +1050,7 @@ void INtSocketOpCompleteSocketRead (
} }
if (sock->opRead.read.bytesProcessed) { if (sock->opRead.read.bytesProcessed) {
MemMove( memmove(
sock->buffer, sock->buffer,
sock->buffer + sock->opRead.read.bytesProcessed, sock->buffer + sock->opRead.read.bytesProcessed,
sock->bytesLeft sock->bytesLeft
@ -1209,7 +1209,7 @@ void NtSocketConnect (
op->hSocket = INVALID_SOCKET; op->hSocket = INVALID_SOCKET;
op->failTimeMs = connectMs ? connectMs : kConnectTimeMs; op->failTimeMs = connectMs ? connectMs : kConnectTimeMs;
if (0 != (op->sendBytes = sendBytes)) if (0 != (op->sendBytes = sendBytes))
MemCopy(op->sendData, sendData, sendBytes); memcpy(op->sendData, sendData, sendBytes);
else else
op->sendData[0] = kConnTypeNil; op->sendData[0] = kConnTypeNil;

4
Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/W9x/pnAceW9xSocket.cpp

@ -528,7 +528,7 @@ void CSocket::OnReadReady () {
if (notify.bytesProcessed >= m_readBytes) if (notify.bytesProcessed >= m_readBytes)
m_readBytes = 0; m_readBytes = 0;
else if (notify.bytesProcessed) { else if (notify.bytesProcessed) {
MemMove( memmove(
&m_readBuffer[0], &m_readBuffer[0],
&m_readBuffer[notify.bytesProcessed], &m_readBuffer[notify.bytesProcessed],
m_readBytes - notify.bytesProcessed m_readBytes - notify.bytesProcessed
@ -578,7 +578,7 @@ void CSocket::OnWriteReady () {
if ((unsigned)result == m_sendQueue.Bytes()) if ((unsigned)result == m_sendQueue.Bytes())
m_sendQueue.Clear(); m_sendQueue.Clear();
else if (result) { else if (result) {
MemMove( memmove(
&m_sendQueue[0], &m_sendQueue[0],
&m_sendQueue[result], &m_sendQueue[result],
m_sendQueue.Bytes() - result m_sendQueue.Bytes() - result

2
Sources/Plasma/NucleusLib/pnAsyncCoreExe/pnAceLog.cpp

@ -453,7 +453,7 @@ void AsyncLogWriteMsg (
AllocLogBuffer_CS(index); AllocLogBuffer_CS(index);
// Add new data to the log buffer // Add new data to the log buffer
MemCopy(s_logBuf[index] + s_logPos[index], buffer, chars); memcpy(s_logBuf[index] + s_logPos[index], buffer, chars);
s_logPos[index] += chars; s_logPos[index] += chars;
// Write, flush and close file immediately if this is a fatal error // Write, flush and close file immediately if this is a fatal error

16
Sources/Plasma/NucleusLib/pnNetCli/pnNcCli.cpp

@ -191,7 +191,7 @@ static void PutBufferOnWire (NetCli * cli, void * data, unsigned bytes) {
if (cli->mode == kNetCliModeEncrypted && cli->cryptOut) { if (cli->mode == kNetCliModeEncrypted && cli->cryptOut) {
temp = (uint8_t *)malloc(bytes); temp = (uint8_t *)malloc(bytes);
MemCopy(temp, data, bytes); memcpy(temp, data, bytes);
CryptEncrypt(cli->cryptOut, bytes, temp); CryptEncrypt(cli->cryptOut, bytes, temp);
data = temp; data = temp;
} }
@ -222,7 +222,7 @@ static void AddToSendBuffer (
// Let the OS fragment oversize buffers // Let the OS fragment oversize buffers
FlushSendBuffer(cli); FlushSendBuffer(cli);
void * heap = malloc(bytes); void * heap = malloc(bytes);
MemCopy(heap, data, bytes); memcpy(heap, data, bytes);
PutBufferOnWire(cli, heap, bytes); PutBufferOnWire(cli, heap, bytes);
free(heap); free(heap);
} }
@ -665,7 +665,7 @@ static void ClientConnect (NetCli * cli) {
memset(&cli->seed, 0, sizeof(cli->seed)); memset(&cli->seed, 0, sizeof(cli->seed));
unsigned bytes; unsigned bytes;
unsigned char * data = clientSeed.GetData_LE(&bytes); unsigned char * data = clientSeed.GetData_LE(&bytes);
MemCopy(cli->seed, data, min(bytes, sizeof(cli->seed))); memcpy(cli->seed, data, min(bytes, sizeof(cli->seed)));
delete [] data; delete [] data;
} }
@ -677,7 +677,7 @@ static void ClientConnect (NetCli * cli) {
ASSERTMSG(bytes <= sizeof(msg.dh_y_data), "4"); ASSERTMSG(bytes <= sizeof(msg.dh_y_data), "4");
msg.message = kNetCliCli2SrvConnect; msg.message = kNetCliCli2SrvConnect;
msg.length = (uint8_t) (sizeof(msg) - sizeof(msg.dh_y_data) + bytes); msg.length = (uint8_t) (sizeof(msg) - sizeof(msg.dh_y_data) + bytes);
MemCopy(msg.dh_y_data, data, bytes); memcpy(msg.dh_y_data, data, bytes);
AsyncSocketSend(cli->sock, &msg, msg.length); AsyncSocketSend(cli->sock, &msg, msg.length);
delete [] data; delete [] data;
} }
@ -704,7 +704,7 @@ static bool ServerRecvConnect (
NetCli_Srv2Cli_Encrypt reply; NetCli_Srv2Cli_Encrypt reply;
reply.message = kNetCliSrv2CliEncrypt; reply.message = kNetCliSrv2CliEncrypt;
reply.length = seedLength == 0 ? 0 : sizeof(reply); // reply with empty seed if we got empty seed (this means: no encryption) reply.length = seedLength == 0 ? 0 : sizeof(reply); // reply with empty seed if we got empty seed (this means: no encryption)
MemCopy(reply.serverSeed, cli->seed, sizeof(reply.serverSeed)); memcpy(reply.serverSeed, cli->seed, sizeof(reply.serverSeed));
AsyncSocketSend(cli->sock, &reply, reply.length); AsyncSocketSend(cli->sock, &reply, reply.length);
} }
@ -727,7 +727,7 @@ static bool ServerRecvConnect (
memset(&clientSeed, 0, sizeof(clientSeed)); memset(&clientSeed, 0, sizeof(clientSeed));
unsigned bytes; unsigned bytes;
unsigned char * data = clientSeedValue.GetData_LE(&bytes); unsigned char * data = clientSeedValue.GetData_LE(&bytes);
MemCopy(clientSeed, data, min(bytes, sizeof(clientSeed))); memcpy(clientSeed, data, min(bytes, sizeof(clientSeed)));
delete [] data; delete [] data;
} }
@ -952,7 +952,7 @@ static void SetConnSeed (
const uint8_t seedData[] const uint8_t seedData[]
) { ) {
if (seedBytes) if (seedBytes)
MemCopy(cli->seed, seedData, min(sizeof(cli->seed), seedBytes)); memcpy(cli->seed, seedData, min(sizeof(cli->seed), seedBytes));
else else
CryptCreateRandomSeed(sizeof(cli->seed), cli->seed); CryptCreateRandomSeed(sizeof(cli->seed), cli->seed);
} }
@ -1113,7 +1113,7 @@ bool NetCliDispatch (
if (cli->cryptIn) { if (cli->cryptIn) {
temp = (uint8_t *)malloc(bytes); temp = (uint8_t *)malloc(bytes);
MemCopy(temp, data, bytes); memcpy(temp, data, bytes);
CryptDecrypt(cli->cryptIn, bytes, temp); CryptDecrypt(cli->cryptIn, bytes, temp);
data = temp; data = temp;
} }

2
Sources/Plasma/NucleusLib/pnNetCli/pnNcUtils.cpp

@ -74,7 +74,7 @@ bool CInputAccumulator::Get (unsigned count, void * dest) {
if (curr + count > buffer.Term()) if (curr + count > buffer.Term())
return false; return false;
// LogMsg(kLogPerf, L"Removing %u bytes from accumulator %p", count, this); // LogMsg(kLogPerf, L"Removing %u bytes from accumulator %p", count, this);
MemCopy(dest, curr, count); memcpy(dest, curr, count);
curr += count; curr += count;
return true; return true;
} }

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

@ -84,7 +84,7 @@ bool Srv2DbValidateConnect (
} }
memset(connectPtr, 0, sizeof(*connectPtr)); memset(connectPtr, 0, sizeof(*connectPtr));
MemCopy(connectPtr, &connect, min(sizeof(*connectPtr), connect.dataBytes)); memcpy(connectPtr, &connect, min(sizeof(*connectPtr), connect.dataBytes));
listen->bytesProcessed += connect.dataBytes; listen->bytesProcessed += connect.dataBytes;
return true; return true;

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

@ -80,7 +80,7 @@ bool Srv2LogValidateConnect (
return false; return false;
memset(connectPtr, 0, sizeof(*connectPtr)); memset(connectPtr, 0, sizeof(*connectPtr));
MemCopy(connectPtr, &connect, min(sizeof(*connectPtr), connect.dataBytes)); memcpy(connectPtr, &connect, min(sizeof(*connectPtr), connect.dataBytes));
listen->bytesProcessed += connect.dataBytes; listen->bytesProcessed += connect.dataBytes;
return true; return true;

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

@ -78,7 +78,7 @@ bool Srv2McpValidateConnect (
return false; return false;
memset(connectPtr, 0, sizeof(*connectPtr)); memset(connectPtr, 0, sizeof(*connectPtr));
MemCopy(connectPtr, &connect, min(sizeof(*connectPtr), connect.dataBytes)); memcpy(connectPtr, &connect, min(sizeof(*connectPtr), connect.dataBytes));
listen->bytesProcessed += connect.dataBytes; listen->bytesProcessed += connect.dataBytes;
return true; return true;

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

@ -79,7 +79,7 @@ bool Srv2ScoreValidateConnect (
return false; return false;
memset(connectPtr, 0, sizeof(*connectPtr)); memset(connectPtr, 0, sizeof(*connectPtr));
MemCopy(connectPtr, &connect, min(sizeof(*connectPtr), connect.dataBytes)); memcpy(connectPtr, &connect, min(sizeof(*connectPtr), connect.dataBytes));
listen->bytesProcessed += connect.dataBytes; listen->bytesProcessed += connect.dataBytes;
return true; return true;

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

@ -79,7 +79,7 @@ bool Srv2StateValidateConnect (
return false; return false;
memset(connectPtr, 0, sizeof(*connectPtr)); memset(connectPtr, 0, sizeof(*connectPtr));
MemCopy(connectPtr, &connect, min(sizeof(*connectPtr), connect.dataBytes)); memcpy(connectPtr, &connect, min(sizeof(*connectPtr), connect.dataBytes));
listen->bytesProcessed += connect.dataBytes; listen->bytesProcessed += connect.dataBytes;
return true; return true;

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

@ -78,7 +78,7 @@ bool Srv2VaultValidateConnect (
return false; return false;
memset(connectPtr, 0, sizeof(*connectPtr)); memset(connectPtr, 0, sizeof(*connectPtr));
MemCopy(connectPtr, &connect, min(sizeof(*connectPtr), connect.dataBytes)); memcpy(connectPtr, &connect, min(sizeof(*connectPtr), connect.dataBytes));
listen->bytesProcessed += connect.dataBytes; listen->bytesProcessed += connect.dataBytes;
return true; return true;

6
Sources/Plasma/NucleusLib/pnNetProtocol/Private/pnNpCommon.cpp

@ -91,7 +91,7 @@ static inline void IReadArray (T ** buf, unsigned * elems, uint8_t ** buffer, un
T * src = (T *)*buffer; T * src = (T *)*buffer;
delete *buf; delete *buf;
*buf = (T *)malloc(bytes); *buf = (T *)malloc(bytes);
MemCopy(*buf, src, bytes); memcpy(*buf, src, bytes);
*buffer += bytes; *buffer += bytes;
*bufsz -= bytes; *bufsz -= bytes;
} }
@ -119,7 +119,7 @@ static inline void IWriteArray (const T buf[], unsigned elems, ARRAY(uint8_t) *
unsigned bytes = elems * sizeof(T); unsigned bytes = elems * sizeof(T);
IWriteValue(bytes, buffer); IWriteValue(bytes, buffer);
T * dst = (T *) buffer->New(bytes); T * dst = (T *) buffer->New(bytes);
MemCopy(dst, buf, bytes); memcpy(dst, buf, bytes);
} }
//============================================================================ //============================================================================
@ -1117,7 +1117,7 @@ void * CSrvPackBuffer::Alloc (unsigned bytes) {
//============================================================================ //============================================================================
void CSrvPackBuffer::AddData (const void * ptr, unsigned bytes) { void CSrvPackBuffer::AddData (const void * ptr, unsigned bytes) {
MemCopy(Alloc(bytes), ptr, bytes); memcpy(Alloc(bytes), ptr, bytes);
} }
//============================================================================ //============================================================================

6
Sources/Plasma/NucleusLib/pnUUID/pnUUID_Win32.cpp

@ -51,7 +51,7 @@ COMPILER_ASSERT(msizeof(Uuid, data) == msizeof(plUUID, fData));
plUUID::plUUID( const Uuid & uuid ) plUUID::plUUID( const Uuid & uuid )
{ {
MemCopy(fData, uuid.data, sizeof(fData)); memcpy(fData, uuid.data, sizeof(fData));
} }
void plUUID::Clear() void plUUID::Clear()
@ -84,12 +84,12 @@ void plUUID::CopyFrom( const plUUID * v ) {
} }
void plUUID::CopyFrom( const plUUID & v ) { void plUUID::CopyFrom( const plUUID & v ) {
MemCopy(fData, v.fData, sizeof(fData)); memcpy(fData, v.fData, sizeof(fData));
} }
plUUID::operator Uuid () const { plUUID::operator Uuid () const {
Uuid uuid; Uuid uuid;
MemCopy(uuid.data, fData, sizeof(uuid.data)); memcpy(uuid.data, fData, sizeof(uuid.data));
return uuid; return uuid;
} }

2
Sources/Plasma/NucleusLib/pnUtils/Private/Win32/pnUtW32Misc.cpp

@ -218,7 +218,7 @@ DONE:
// If this is an AMD CPU, check for 3DNow support // If this is an AMD CPU, check for 3DNow support
const char * vendorAmd = "AuthenticAMD"; const char * vendorAmd = "AuthenticAMD";
if (!MemCmp(vendorAmd, cpuVendor, 12)) { if (!memcmp(vendorAmd, cpuVendor, 12)) {
if (extended & (1 << 31)) if (extended & (1 << 31))
*cpuCaps |= kCpuCap3dNow; *cpuCaps |= kCpuCap3dNow;
} }

4
Sources/Plasma/NucleusLib/pnUtils/Private/pnUtArray.h

@ -158,7 +158,7 @@ TBuffer<T> & TBuffer<T>::operator= (const TBuffer<T> & source) {
template<class T> template<class T>
bool TBuffer<T>::operator== (const TBuffer<T> & source) const { bool TBuffer<T>::operator== (const TBuffer<T> & source) const {
unsigned size = MemSize(m_data); unsigned size = MemSize(m_data);
return (size == MemSize(source.m_data)) && !MemCmp(m_data, source.m_data, size); return (size == MemSize(source.m_data)) && !memcmp(m_data, source.m_data, size);
} }
//=========================================================================== //===========================================================================
@ -300,7 +300,7 @@ public:
//=========================================================================== //===========================================================================
template<class T> template<class T>
void TArrayCopyBits<T>::Assign (T * dest, const T source[], unsigned count) { void TArrayCopyBits<T>::Assign (T * dest, const T source[], unsigned count) {
MemMove(dest, source, count * sizeof(T)); memmove(dest, source, count * sizeof(T));
} }
//=========================================================================== //===========================================================================

2
Sources/Plasma/NucleusLib/pnUtils/Private/pnUtCrypt.cpp

@ -168,7 +168,7 @@ static void Rc4Codec (
// RC4 uses the same algorithm to both encrypt and decrypt // RC4 uses the same algorithm to both encrypt and decrypt
uint8_t * temp = (uint8_t *)malloc(bytes); uint8_t * temp = (uint8_t *)malloc(bytes);
RC4((RC4_KEY *)key->handle, bytes, (const unsigned char *)data, temp); RC4((RC4_KEY *)key->handle, bytes, (const unsigned char *)data, temp);
MemCopy(data, temp, bytes); memcpy(data, temp, bytes);
free(temp); free(temp);
} }

6
Sources/Plasma/NucleusLib/pnUtils/Private/pnUtSubst.cpp

@ -151,7 +151,7 @@ bool IParseForSubst (
block->isVar = false; block->isVar = false;
block->strLen = strLen; block->strLen = strLen;
block->data = (chartype*)calloc((strLen + 1), sizeof(chartype)); block->data = (chartype*)calloc((strLen + 1), sizeof(chartype));
MemCopy(block->data, src, strLen * sizeof(chartype)); memcpy(block->data, src, strLen * sizeof(chartype));
dest->blocks.Add(block); dest->blocks.Add(block);
} }
@ -170,7 +170,7 @@ bool IParseForSubst (
block->isVar = true; block->isVar = true;
block->strLen = strLen; block->strLen = strLen;
block->data = (chartype*)calloc((strLen + 1), sizeof(chartype)); block->data = (chartype*)calloc((strLen + 1), sizeof(chartype));
MemCopy(block->data, varStart, strLen * sizeof(chartype)); memcpy(block->data, varStart, strLen * sizeof(chartype));
dest->blocks.Add(block); dest->blocks.Add(block);
@ -184,7 +184,7 @@ bool IParseForSubst (
block->isVar = false; block->isVar = false;
block->strLen = strLen; block->strLen = strLen;
block->data = (chartype*)calloc((strLen + 1), sizeof(chartype)); block->data = (chartype*)calloc((strLen + 1), sizeof(chartype));
MemCopy(block->data, src, strLen * sizeof(chartype)); memcpy(block->data, src, strLen * sizeof(chartype));
dest->blocks.Add(block); dest->blocks.Add(block);
} }

2
Sources/Plasma/NucleusLib/pnUtils/Private/pnUtUuid.cpp

@ -100,6 +100,6 @@ const wchar_t * GuidToHex (const Uuid & uuid, wchar_t * dst, unsigned chars) {
bool GuidFromHex (const uint8_t buf[], unsigned length, Uuid * uuid) { bool GuidFromHex (const uint8_t buf[], unsigned length, Uuid * uuid) {
ASSERT(length == msizeof(Uuid, data)); ASSERT(length == msizeof(Uuid, data));
MemCopy(uuid->data, buf, msizeof(Uuid, data)); memcpy(uuid->data, buf, msizeof(Uuid, data));
return true; return true;
} }

2
Sources/Plasma/PubUtilLib/plAudio/plDSoundBuffer.cpp

@ -317,7 +317,7 @@ bool plDSoundBuffer::SetupStreamingSource(void *data, unsigned bytes)
if(!size) if(!size)
break; break;
MemCopy(bufferData, pData, size); memcpy(bufferData, pData, size);
pData += size; pData += size;
bytes-= size; bytes-= size;
numBuffersToQueue++; numBuffersToQueue++;

6
Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglAuth.cpp

@ -2716,7 +2716,7 @@ bool LoginRequestTrans::Recv (
unsigned memSize = min(arrsize(s_encryptionKey), arrsize(reply.encryptionKey)); unsigned memSize = min(arrsize(s_encryptionKey), arrsize(reply.encryptionKey));
memSize *= sizeof(uint32_t); memSize *= sizeof(uint32_t);
MemCopy(s_encryptionKey, reply.encryptionKey, memSize); memcpy(s_encryptionKey, reply.encryptionKey, memSize);
} }
break; break;
@ -3635,7 +3635,7 @@ bool FileDownloadRequestTrans::Recv (
writeTrans->bytes = reply.chunkSize; writeTrans->bytes = reply.chunkSize;
writeTrans->offset = reply.chunkOffset; writeTrans->offset = reply.chunkOffset;
writeTrans->data = (uint8_t *)malloc(reply.chunkSize); writeTrans->data = (uint8_t *)malloc(reply.chunkSize);
MemCopy(writeTrans->data, reply.chunkData, reply.chunkSize); memcpy(writeTrans->data, reply.chunkData, reply.chunkSize);
NetTransSend(writeTrans); NetTransSend(writeTrans);
} }
@ -5286,7 +5286,7 @@ void NetCliAuthGetEncryptionKey (
) { ) {
unsigned memSize = min(arrsize(s_encryptionKey), size); unsigned memSize = min(arrsize(s_encryptionKey), size);
memSize *= sizeof(uint32_t); memSize *= sizeof(uint32_t);
MemCopy(key, s_encryptionKey, memSize); memcpy(key, s_encryptionKey, memSize);
} }
//============================================================================ //============================================================================

2
Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglFile.cpp

@ -1196,7 +1196,7 @@ bool DownloadRequestTrans::Recv (
writeTrans->writer = m_writer; writeTrans->writer = m_writer;
writeTrans->bytes = byteCount; writeTrans->bytes = byteCount;
writeTrans->data = (uint8_t *)malloc(byteCount); writeTrans->data = (uint8_t *)malloc(byteCount);
MemCopy(writeTrans->data, data, byteCount); memcpy(writeTrans->data, data, byteCount);
NetTransSend(writeTrans); NetTransSend(writeTrans);
} }
m_totalBytesReceived += byteCount; m_totalBytesReceived += byteCount;

4
Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglGame.cpp

@ -457,7 +457,7 @@ static bool Recv_PropagateBuffer (
trans->bufferType = reply.type; trans->bufferType = reply.type;
trans->bufferBytes = reply.bytes; trans->bufferBytes = reply.bytes;
trans->bufferData = (uint8_t *)malloc(reply.bytes); trans->bufferData = (uint8_t *)malloc(reply.bytes);
MemCopy(trans->bufferData, reply.buffer, reply.bytes); memcpy(trans->bufferData, reply.buffer, reply.bytes);
NetTransSend(trans); NetTransSend(trans);
return true; return true;
@ -474,7 +474,7 @@ static bool Recv_GameMgrMsg (
RcvdGameMgrMsgTrans * trans = new RcvdGameMgrMsgTrans; RcvdGameMgrMsgTrans * trans = new RcvdGameMgrMsgTrans;
trans->bufferBytes = reply.bytes; trans->bufferBytes = reply.bytes;
trans->bufferData = (uint8_t *)malloc(reply.bytes); trans->bufferData = (uint8_t *)malloc(reply.bytes);
MemCopy(trans->bufferData, reply.buffer, reply.bytes); memcpy(trans->bufferData, reply.buffer, reply.bytes);
NetTransSend(trans); NetTransSend(trans);
return true; return true;

16
Sources/Plasma/PubUtilLib/plVault/plVaultNodeAccess.cpp

@ -337,7 +337,7 @@ void VaultTextNoteNode::SetVisitInfo (const plAgeInfoStruct & info) {
StrToUnicode(src, info.GetAgeFilename(), arrsize(src)); StrToUnicode(src, info.GetAgeFilename(), arrsize(src));
unsigned len = StrLen(src); unsigned len = StrLen(src);
wchar_t * dst = buf.New(len); wchar_t * dst = buf.New(len);
MemCopy(dst, src, len * sizeof(src[0])); memcpy(dst, src, len * sizeof(src[0]));
} }
break; break;
@ -346,7 +346,7 @@ void VaultTextNoteNode::SetVisitInfo (const plAgeInfoStruct & info) {
StrToUnicode(src, info.GetAgeInstanceName(), arrsize(src)); StrToUnicode(src, info.GetAgeInstanceName(), arrsize(src));
unsigned len = StrLen(src); unsigned len = StrLen(src);
wchar_t * dst = buf.New(len); wchar_t * dst = buf.New(len);
MemCopy(dst, src, len * sizeof(src[0])); memcpy(dst, src, len * sizeof(src[0]));
} }
break; break;
@ -355,7 +355,7 @@ void VaultTextNoteNode::SetVisitInfo (const plAgeInfoStruct & info) {
StrToUnicode(src, info.GetAgeUserDefinedName(), arrsize(src)); StrToUnicode(src, info.GetAgeUserDefinedName(), arrsize(src));
unsigned len = StrLen(src); unsigned len = StrLen(src);
wchar_t * dst = buf.New(len); wchar_t * dst = buf.New(len);
MemCopy(dst, src, len * sizeof(src[0])); memcpy(dst, src, len * sizeof(src[0]));
} }
break; break;
@ -364,7 +364,7 @@ void VaultTextNoteNode::SetVisitInfo (const plAgeInfoStruct & info) {
StrToUnicode(src, info.GetAgeDescription(), arrsize(src)); StrToUnicode(src, info.GetAgeDescription(), arrsize(src));
unsigned len = StrLen(src); unsigned len = StrLen(src);
wchar_t * dst = buf.New(len); wchar_t * dst = buf.New(len);
MemCopy(dst, src, len * sizeof(src[0])); memcpy(dst, src, len * sizeof(src[0]));
} }
break; break;
@ -374,7 +374,7 @@ void VaultTextNoteNode::SetVisitInfo (const plAgeInfoStruct & info) {
GuidToString(guid, src, arrsize(src)); GuidToString(guid, src, arrsize(src));
unsigned len = StrLen(src); unsigned len = StrLen(src);
wchar_t * dst = buf.New(len); wchar_t * dst = buf.New(len);
MemCopy(dst, src, len * sizeof(src[0])); memcpy(dst, src, len * sizeof(src[0]));
} }
break; break;
@ -383,7 +383,7 @@ void VaultTextNoteNode::SetVisitInfo (const plAgeInfoStruct & info) {
StrPrintf(src, arrsize(src), L"%u", info.GetAgeLanguage()); StrPrintf(src, arrsize(src), L"%u", info.GetAgeLanguage());
unsigned len = StrLen(src); unsigned len = StrLen(src);
wchar_t * dst = buf.New(len); wchar_t * dst = buf.New(len);
MemCopy(dst, src, len * sizeof(src[0])); memcpy(dst, src, len * sizeof(src[0]));
} }
break; break;
@ -392,7 +392,7 @@ void VaultTextNoteNode::SetVisitInfo (const plAgeInfoStruct & info) {
StrPrintf(src, arrsize(src), L"%u", info.GetAgeSequenceNumber()); StrPrintf(src, arrsize(src), L"%u", info.GetAgeSequenceNumber());
unsigned len = StrLen(src); unsigned len = StrLen(src);
wchar_t * dst = buf.New(len); wchar_t * dst = buf.New(len);
MemCopy(dst, src, len * sizeof(src[0])); memcpy(dst, src, len * sizeof(src[0]));
} }
break; break;
@ -790,7 +790,7 @@ void VaultAgeLinkNode::GetSpawnPoints (plSpawnPointVec * out) const {
char str[2048]; char str[2048];
memset(&str, 0, sizeof(str)); memset(&str, 0, sizeof(str));
MemCopy(str, spawnPoints, min(spawnPointsLen, arrsize(str) - 1)); memcpy(str, spawnPoints, min(spawnPointsLen, arrsize(str) - 1));
char token1[ 1024 ]; char token1[ 1024 ];
hsStringTokenizer izer1( str, ";" ); hsStringTokenizer izer1( str, ";" );

Loading…
Cancel
Save