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:
@ -472,9 +472,9 @@ static void ProcessManifestEntry (void * param, ENetError error) {
|
|||||||
StrPrintf(text, arrsize(text), "Checking for updates... %S", p->mr->manifest[p->index].clientName);
|
StrPrintf(text, arrsize(text), "Checking for updates... %S", p->mr->manifest[p->index].clientName);
|
||||||
p->mr->info->SetText(text);
|
p->mr->info->SetText(text);
|
||||||
#endif
|
#endif
|
||||||
plFileName path = plFileName::Join(s_workingDir, p->mr->manifest[p->index].clientName);
|
plFileName path = plFileName::Join(s_workingDir, plString::FromWchar(p->mr->manifest[p->index].clientName));
|
||||||
uint32_t start = (uint32_t)(TimeGetTime() / kTimeIntervalsPerMs);
|
uint32_t start = (uint32_t)(TimeGetTime() / kTimeIntervalsPerMs);
|
||||||
if (!MD5Check(path, p->mr->manifest[p->index].md5.c_str())) {
|
if (!MD5Check(path, plString::FromWchar(p->mr->manifest[p->index].md5, 32).c_str())) {
|
||||||
p->mr->critsect.Lock();
|
p->mr->critsect.Lock();
|
||||||
p->mr->indices.Add(p->index);
|
p->mr->indices.Add(p->index);
|
||||||
p->mr->critsect.Unlock();
|
p->mr->critsect.Unlock();
|
||||||
@ -547,7 +547,7 @@ static void ProcessManifest (void * param) {
|
|||||||
p->index = i;
|
p->index = i;
|
||||||
p->mr = mr;
|
p->mr = mr;
|
||||||
p->exists = false;
|
p->exists = false;
|
||||||
plFileName path = plFileName::Join(s_workingDir, mr->manifest[i].clientName);
|
plFileName path = plFileName::Join(s_workingDir, plString::FromWchar(mr->manifest[i].clientName));
|
||||||
fd = plFileSystem::Open(path, "r");
|
fd = plFileSystem::Open(path, "r");
|
||||||
if (fd)
|
if (fd)
|
||||||
{
|
{
|
||||||
@ -589,13 +589,13 @@ static void ProcessManifest (void * param) {
|
|||||||
if(s_running)
|
if(s_running)
|
||||||
{
|
{
|
||||||
unsigned index = mr->indices[i];
|
unsigned index = mr->indices[i];
|
||||||
plFileName path = plFileName::Join(s_workingDir, manifest[index].clientName);
|
plFileName path = plFileName::Join(s_workingDir, plString::FromWchar(manifest[index].clientName));
|
||||||
plFileSystem::CreateDir(path.StripFileName(), true);
|
plFileSystem::CreateDir(path.StripFileName(), true);
|
||||||
|
|
||||||
ManifestFile* mf = new ManifestFile(
|
ManifestFile* mf = new ManifestFile(
|
||||||
manifest[index].clientName,
|
plString::FromWchar(manifest[index].clientName),
|
||||||
manifest[index].downloadName,
|
plString::FromWchar(manifest[index].downloadName),
|
||||||
manifest[index].md5,
|
plString::FromWchar(manifest[index].md5),
|
||||||
manifest[index].flags,
|
manifest[index].flags,
|
||||||
mr->info
|
mr->info
|
||||||
);
|
);
|
||||||
@ -733,8 +733,8 @@ static void ThinManifestCallback (
|
|||||||
if (!s_running)
|
if (!s_running)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
plFileName path = plFileName::Join(s_workingDir, manifest[i].clientName);
|
plFileName path = plFileName::Join(s_workingDir, plString::FromWchar(manifest[i].clientName));
|
||||||
if (!MD5Check(path, manifest[i].md5.c_str())) {
|
if (!MD5Check(path, plString::FromWchar(manifest[i].md5, 32).c_str())) {
|
||||||
s_patchComplete = false;
|
s_patchComplete = false;
|
||||||
NetCliFileManifestRequest(ManifestCallback, info, s_manifest, info->buildId);
|
NetCliFileManifestRequest(ManifestCallback, info, s_manifest, info->buildId);
|
||||||
break;
|
break;
|
||||||
@ -746,7 +746,7 @@ static void ThinManifestCallback (
|
|||||||
info->progressCallback(kStatusPending, &patchInfo);
|
info->progressCallback(kStatusPending, &patchInfo);
|
||||||
#ifndef PLASMA_EXTERNAL_RELEASE
|
#ifndef PLASMA_EXTERNAL_RELEASE
|
||||||
char text[256];
|
char text[256];
|
||||||
StrPrintf(text, arrsize(text), "Checking for updates... %s", manifest[i].clientName.AsString().c_str());
|
StrPrintf(text, arrsize(text), "Checking for updates... %S", manifest[i].clientName);
|
||||||
info->SetText(text);
|
info->SetText(text);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -184,7 +184,7 @@ static void ManifestCallback (
|
|||||||
// MD5 check current patcher against value in manifest
|
// MD5 check current patcher against value in manifest
|
||||||
ASSERT(entryCount == 1);
|
ASSERT(entryCount == 1);
|
||||||
plFileName curPatcherFile = plFileSystem::GetCurrentAppPath();
|
plFileName curPatcherFile = plFileSystem::GetCurrentAppPath();
|
||||||
if (!MD5Check(curPatcherFile, manifest[0].md5.c_str())) {
|
if (!MD5Check(curPatcherFile, plString::FromWchar(manifest[0].md5, 32).c_str())) {
|
||||||
// MessageBox(GetTopWindow(nil), "MD5 failed", "Msg", MB_OK);
|
// MessageBox(GetTopWindow(nil), "MD5 failed", "Msg", MB_OK);
|
||||||
SelfPatcherStream::totalBytes += manifest[0].zipSize;
|
SelfPatcherStream::totalBytes += manifest[0].zipSize;
|
||||||
|
|
||||||
@ -195,7 +195,7 @@ static void ManifestCallback (
|
|||||||
if (!stream->Open(s_newPatcherFile, "wb"))
|
if (!stream->Open(s_newPatcherFile, "wb"))
|
||||||
ErrorAssert(__LINE__, __FILE__, "Failed to create file: %s, errno: %u", s_newPatcherFile.AsString().c_str(), errno);
|
ErrorAssert(__LINE__, __FILE__, "Failed to create file: %s, errno: %u", s_newPatcherFile.AsString().c_str(), errno);
|
||||||
|
|
||||||
NetCliFileDownloadRequest(manifest[0].downloadName, stream, DownloadCallback, nil);
|
NetCliFileDownloadRequest(plString::FromWchar(manifest[0].downloadName), stream, DownloadCallback, nil);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
s_downloadComplete = true;
|
s_downloadComplete = true;
|
||||||
@ -272,7 +272,8 @@ static bool SelfPatcherProc (bool * abort, plLauncherInfo *info) {
|
|||||||
si.cb = sizeof(si);
|
si.cb = sizeof(si);
|
||||||
|
|
||||||
wchar_t cmdline[MAX_PATH];
|
wchar_t cmdline[MAX_PATH];
|
||||||
StrPrintf(cmdline, arrsize(cmdline), L"%s %s", s_newPatcherFile.AsString().ToWchar(), info->cmdLine);
|
StrPrintf(cmdline, arrsize(cmdline), L"%s %s",
|
||||||
|
s_newPatcherFile.AsString().ToWchar().GetData(), info->cmdLine);
|
||||||
|
|
||||||
// we have only successfully patched if we actually launch the new version of the patcher
|
// we have only successfully patched if we actually launch the new version of the patcher
|
||||||
patched = CreateProcessW(
|
patched = CreateProcessW(
|
||||||
|
@ -345,8 +345,8 @@ void pfSecurePreloader::PreloadManifest(const NetCliFileManifestEntry manifestEn
|
|||||||
const NetCliFileManifestEntry mfs = manifestEntries[i];
|
const NetCliFileManifestEntry mfs = manifestEntries[i];
|
||||||
bool fetchMe = true;
|
bool fetchMe = true;
|
||||||
hsRAMStream* s = nil;
|
hsRAMStream* s = nil;
|
||||||
plFileName clientName = mfs.clientName;
|
plFileName clientName = plString::FromWchar(mfs.clientName);
|
||||||
plFileName downloadName = mfs.downloadName;
|
plFileName downloadName = plString::FromWchar(mfs.downloadName);
|
||||||
|
|
||||||
if (plFileInfo(clientName).Exists())
|
if (plFileInfo(clientName).Exists())
|
||||||
{
|
{
|
||||||
@ -355,7 +355,7 @@ void pfSecurePreloader::PreloadManifest(const NetCliFileManifestEntry manifestEn
|
|||||||
{
|
{
|
||||||
// Damn this
|
// Damn this
|
||||||
plMD5Checksum srvHash;
|
plMD5Checksum srvHash;
|
||||||
srvHash.SetFromHexString(mfs.md5.c_str());
|
srvHash.SetFromHexString(plString::FromWchar(mfs.md5, 32).c_str());
|
||||||
|
|
||||||
// Now actually copare the hashes
|
// Now actually copare the hashes
|
||||||
plMD5Checksum lclHash;
|
plMD5Checksum lclHash;
|
||||||
|
@ -150,8 +150,8 @@ static void ManifestDownloaded(
|
|||||||
for (uint32_t i = 0; i < entryCount; ++i)
|
for (uint32_t i = 0; i < entryCount; ++i)
|
||||||
{
|
{
|
||||||
const NetCliFileManifestEntry mfs = manifest[i];
|
const NetCliFileManifestEntry mfs = manifest[i];
|
||||||
plFileName fileName = mfs.clientName;
|
plFileName fileName = plString::FromWchar(mfs.clientName);
|
||||||
plFileName downloadName = mfs.downloadName;
|
plFileName downloadName = plString::FromWchar(mfs.downloadName);
|
||||||
|
|
||||||
// See if the files are the same
|
// See if the files are the same
|
||||||
// 1. Check file size before we do time consuming md5 operations
|
// 1. Check file size before we do time consuming md5 operations
|
||||||
@ -160,7 +160,7 @@ static void ManifestDownloaded(
|
|||||||
{
|
{
|
||||||
plMD5Checksum cliMD5(fileName);
|
plMD5Checksum cliMD5(fileName);
|
||||||
plMD5Checksum srvMD5;
|
plMD5Checksum srvMD5;
|
||||||
srvMD5.SetFromHexString(mfs.md5.c_str());
|
srvMD5.SetFromHexString(plString::FromWchar(mfs.md5, 32).c_str());
|
||||||
|
|
||||||
if (cliMD5 == srvMD5)
|
if (cliMD5 == srvMD5)
|
||||||
continue;
|
continue;
|
||||||
|
@ -906,7 +906,7 @@ bool BuildIdRequestTrans::Recv (
|
|||||||
ManifestRequestTrans::ManifestRequestTrans (
|
ManifestRequestTrans::ManifestRequestTrans (
|
||||||
FNetCliFileManifestRequestCallback callback,
|
FNetCliFileManifestRequestCallback callback,
|
||||||
void * param,
|
void * param,
|
||||||
const wchar_t group[],
|
const wchar_t group[],
|
||||||
unsigned buildId
|
unsigned buildId
|
||||||
) : NetFileTrans(kManifestRequestTrans)
|
) : NetFileTrans(kManifestRequestTrans)
|
||||||
, m_callback(callback)
|
, m_callback(callback)
|
||||||
@ -943,9 +943,13 @@ void ManifestRequestTrans::Post () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
plString ReadStringFromMsg(const wchar_t* curMsgPtr, unsigned* length) {
|
void ReadStringFromMsg(const wchar_t* curMsgPtr, wchar_t* destPtr, unsigned* length) {
|
||||||
(*length) = wcslen(curMsgPtr);
|
if (!(*length)) {
|
||||||
return plString::FromWchar(curMsgPtr, *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
|
// read in the clientFilename
|
||||||
unsigned filenameLen;
|
unsigned filenameLen = 0;
|
||||||
entry.clientName = ReadStringFromMsg(curChar, &filenameLen);
|
ReadStringFromMsg(curChar, entry.clientName, &filenameLen);
|
||||||
curChar += filenameLen; // advance the pointer
|
curChar += filenameLen; // advance the pointer
|
||||||
wchar_tCount -= filenameLen; // keep track of the amount remaining
|
wchar_tCount -= filenameLen; // keep track of the amount remaining
|
||||||
if ((*curChar != L'\0') || (wchar_tCount <= 0))
|
if ((*curChar != L'\0') || (wchar_tCount <= 0))
|
||||||
@ -1014,7 +1018,8 @@ bool ManifestRequestTrans::Recv (
|
|||||||
|
|
||||||
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
||||||
// read in the downloadFilename
|
// read in the downloadFilename
|
||||||
entry.downloadName = ReadStringFromMsg(curChar, &filenameLen);
|
filenameLen = 0;
|
||||||
|
ReadStringFromMsg(curChar, entry.downloadName, &filenameLen);
|
||||||
curChar += filenameLen; // advance the pointer
|
curChar += filenameLen; // advance the pointer
|
||||||
wchar_tCount -= filenameLen; // keep track of the amount remaining
|
wchar_tCount -= filenameLen; // keep track of the amount remaining
|
||||||
if ((*curChar != L'\0') || (wchar_tCount <= 0))
|
if ((*curChar != L'\0') || (wchar_tCount <= 0))
|
||||||
@ -1026,7 +1031,8 @@ bool ManifestRequestTrans::Recv (
|
|||||||
|
|
||||||
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
||||||
// read in the md5
|
// read in the md5
|
||||||
entry.md5 = ReadStringFromMsg(curChar, &filenameLen);
|
filenameLen = 32;
|
||||||
|
ReadStringFromMsg(curChar, entry.md5, &filenameLen);
|
||||||
curChar += filenameLen; // advance the pointer
|
curChar += filenameLen; // advance the pointer
|
||||||
wchar_tCount -= filenameLen; // keep track of the amount remaining
|
wchar_tCount -= filenameLen; // keep track of the amount remaining
|
||||||
if ((*curChar != L'\0') || (wchar_tCount <= 0))
|
if ((*curChar != L'\0') || (wchar_tCount <= 0))
|
||||||
@ -1038,7 +1044,8 @@ bool ManifestRequestTrans::Recv (
|
|||||||
|
|
||||||
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
||||||
// read in the md5 for compressed files
|
// read in the md5 for compressed files
|
||||||
entry.md5compressed = ReadStringFromMsg(curChar, &filenameLen);
|
filenameLen = 32;
|
||||||
|
ReadStringFromMsg(curChar, entry.md5compressed, &filenameLen);
|
||||||
curChar += filenameLen; // advance the pointer
|
curChar += filenameLen; // advance the pointer
|
||||||
wchar_tCount -= filenameLen; // keep track of the amount remaining
|
wchar_tCount -= filenameLen; // keep track of the amount remaining
|
||||||
if ((*curChar != L'\0') || (wchar_tCount <= 0))
|
if ((*curChar != L'\0') || (wchar_tCount <= 0))
|
||||||
|
@ -97,10 +97,10 @@ void NetCliFileRegisterBuildIdUpdate (FNetCliFileBuildIdUpdateCallback callback)
|
|||||||
// Manifest
|
// Manifest
|
||||||
//============================================================================
|
//============================================================================
|
||||||
struct NetCliFileManifestEntry {
|
struct NetCliFileManifestEntry {
|
||||||
plFileName clientName; // path and file on client side (for comparison)
|
wchar_t clientName[MAX_PATH]; // path and file on client side (for comparison)
|
||||||
plFileName downloadName; // path and file on server side (for download)
|
wchar_t downloadName[MAX_PATH]; // path and file on server side (for download)
|
||||||
plString md5;
|
wchar_t md5[32];
|
||||||
plString md5compressed; // md5 for the compressed file
|
wchar_t md5compressed[32]; // md5 for the compressed file
|
||||||
unsigned fileSize;
|
unsigned fileSize;
|
||||||
unsigned zipSize;
|
unsigned zipSize;
|
||||||
unsigned flags;
|
unsigned flags;
|
||||||
|
Reference in New Issue
Block a user