mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-17 10:52:46 +00:00
ARRAY(T) uses malloc, and therefore breaks classes which need constructors
This commit is contained in:
@ -150,8 +150,8 @@ static void ManifestDownloaded(
|
||||
for (uint32_t i = 0; i < entryCount; ++i)
|
||||
{
|
||||
const NetCliFileManifestEntry mfs = manifest[i];
|
||||
plFileName fileName = mfs.clientName;
|
||||
plFileName downloadName = mfs.downloadName;
|
||||
plFileName fileName = plString::FromWchar(mfs.clientName);
|
||||
plFileName downloadName = plString::FromWchar(mfs.downloadName);
|
||||
|
||||
// See if the files are the same
|
||||
// 1. Check file size before we do time consuming md5 operations
|
||||
@ -160,7 +160,7 @@ static void ManifestDownloaded(
|
||||
{
|
||||
plMD5Checksum cliMD5(fileName);
|
||||
plMD5Checksum srvMD5;
|
||||
srvMD5.SetFromHexString(mfs.md5.c_str());
|
||||
srvMD5.SetFromHexString(plString::FromWchar(mfs.md5, 32).c_str());
|
||||
|
||||
if (cliMD5 == srvMD5)
|
||||
continue;
|
||||
|
@ -906,7 +906,7 @@ bool BuildIdRequestTrans::Recv (
|
||||
ManifestRequestTrans::ManifestRequestTrans (
|
||||
FNetCliFileManifestRequestCallback callback,
|
||||
void * param,
|
||||
const wchar_t group[],
|
||||
const wchar_t group[],
|
||||
unsigned buildId
|
||||
) : NetFileTrans(kManifestRequestTrans)
|
||||
, m_callback(callback)
|
||||
@ -943,9 +943,13 @@ void ManifestRequestTrans::Post () {
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
plString ReadStringFromMsg(const wchar_t* curMsgPtr, unsigned* length) {
|
||||
(*length) = wcslen(curMsgPtr);
|
||||
return plString::FromWchar(curMsgPtr, *length);
|
||||
void ReadStringFromMsg(const wchar_t* curMsgPtr, wchar_t* destPtr, unsigned* length) {
|
||||
if (!(*length)) {
|
||||
size_t maxlen = wcsnlen(curMsgPtr, MAX_PATH - 1); // Hacky sack
|
||||
(*length) = maxlen;
|
||||
destPtr[maxlen] = 0; // Don't do this on fixed length, because there's no room for it
|
||||
}
|
||||
memcpy(destPtr, curMsgPtr, *length * sizeof(wchar_t));
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
@ -1001,8 +1005,8 @@ bool ManifestRequestTrans::Recv (
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// read in the clientFilename
|
||||
unsigned filenameLen;
|
||||
entry.clientName = ReadStringFromMsg(curChar, &filenameLen);
|
||||
unsigned filenameLen = 0;
|
||||
ReadStringFromMsg(curChar, entry.clientName, &filenameLen);
|
||||
curChar += filenameLen; // advance the pointer
|
||||
wchar_tCount -= filenameLen; // keep track of the amount remaining
|
||||
if ((*curChar != L'\0') || (wchar_tCount <= 0))
|
||||
@ -1014,7 +1018,8 @@ bool ManifestRequestTrans::Recv (
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// read in the downloadFilename
|
||||
entry.downloadName = ReadStringFromMsg(curChar, &filenameLen);
|
||||
filenameLen = 0;
|
||||
ReadStringFromMsg(curChar, entry.downloadName, &filenameLen);
|
||||
curChar += filenameLen; // advance the pointer
|
||||
wchar_tCount -= filenameLen; // keep track of the amount remaining
|
||||
if ((*curChar != L'\0') || (wchar_tCount <= 0))
|
||||
@ -1026,7 +1031,8 @@ bool ManifestRequestTrans::Recv (
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// read in the md5
|
||||
entry.md5 = ReadStringFromMsg(curChar, &filenameLen);
|
||||
filenameLen = 32;
|
||||
ReadStringFromMsg(curChar, entry.md5, &filenameLen);
|
||||
curChar += filenameLen; // advance the pointer
|
||||
wchar_tCount -= filenameLen; // keep track of the amount remaining
|
||||
if ((*curChar != L'\0') || (wchar_tCount <= 0))
|
||||
@ -1038,7 +1044,8 @@ bool ManifestRequestTrans::Recv (
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// read in the md5 for compressed files
|
||||
entry.md5compressed = ReadStringFromMsg(curChar, &filenameLen);
|
||||
filenameLen = 32;
|
||||
ReadStringFromMsg(curChar, entry.md5compressed, &filenameLen);
|
||||
curChar += filenameLen; // advance the pointer
|
||||
wchar_tCount -= filenameLen; // keep track of the amount remaining
|
||||
if ((*curChar != L'\0') || (wchar_tCount <= 0))
|
||||
|
@ -97,10 +97,10 @@ void NetCliFileRegisterBuildIdUpdate (FNetCliFileBuildIdUpdateCallback callback)
|
||||
// Manifest
|
||||
//============================================================================
|
||||
struct NetCliFileManifestEntry {
|
||||
plFileName clientName; // path and file on client side (for comparison)
|
||||
plFileName downloadName; // path and file on server side (for download)
|
||||
plString md5;
|
||||
plString md5compressed; // md5 for the compressed file
|
||||
wchar_t clientName[MAX_PATH]; // path and file on client side (for comparison)
|
||||
wchar_t downloadName[MAX_PATH]; // path and file on server side (for download)
|
||||
wchar_t md5[32];
|
||||
wchar_t md5compressed[32]; // md5 for the compressed file
|
||||
unsigned fileSize;
|
||||
unsigned zipSize;
|
||||
unsigned flags;
|
||||
|
Reference in New Issue
Block a user