2
3
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-14 02:27:40 -04:00

ARRAY(T) uses malloc, and therefore breaks classes which need constructors

This commit is contained in:
2013-01-22 21:00:01 -08:00
parent 8f67596686
commit 0343e997da
6 changed files with 40 additions and 32 deletions

View File

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

View File

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