mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-17 10:52:46 +00:00
Convert custom HeadSpin integer types to standard types from stdint.h
This commit is contained in:
@ -151,7 +151,7 @@ static CEvent s_dialogCreateEvent(kEventManualReset);
|
||||
static CCritSect s_critsect;
|
||||
static LISTDECL(WndEvent, link) s_eventQ;
|
||||
static CEvent s_shutdownEvent(kEventManualReset);
|
||||
static wchar s_workingDir[MAX_PATH];
|
||||
static wchar_t s_workingDir[MAX_PATH];
|
||||
static CEvent s_statusEvent(kEventManualReset);
|
||||
static char s_curlError[CURL_ERROR_SIZE];
|
||||
|
||||
@ -202,8 +202,8 @@ static void PostEvent (WndEvent *event) {
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
static void LogV (ELogSev sev, const wchar fmt[], va_list args) {
|
||||
static struct { FILE * file; const wchar * pre; } s_log[] = {
|
||||
static void LogV (ELogSev sev, const wchar_t fmt[], va_list args) {
|
||||
static struct { FILE * file; const wchar_t * pre; } s_log[] = {
|
||||
{ stdout, L"Inf" },
|
||||
{ stderr, L"Err" },
|
||||
};
|
||||
@ -218,7 +218,7 @@ static void LogV (ELogSev sev, const wchar fmt[], va_list args) {
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
static void Log (ELogSev sev, const wchar fmt[], ...) {
|
||||
static void Log (ELogSev sev, const wchar_t fmt[], ...) {
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
LogV(sev, fmt, args);
|
||||
@ -227,7 +227,7 @@ static void Log (ELogSev sev, const wchar fmt[], ...) {
|
||||
|
||||
//============================================================================
|
||||
// NOTE: Must use LocalFree() on the return value of this function when finished with the string
|
||||
static wchar *TranslateErrorCode(DWORD errorCode) {
|
||||
static wchar_t *TranslateErrorCode(DWORD errorCode) {
|
||||
LPVOID lpMsgBuf;
|
||||
|
||||
FormatMessageW(
|
||||
@ -236,11 +236,11 @@ static wchar *TranslateErrorCode(DWORD errorCode) {
|
||||
NULL,
|
||||
errorCode,
|
||||
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
||||
(wchar *) &lpMsgBuf,
|
||||
(wchar_t *) &lpMsgBuf,
|
||||
0,
|
||||
NULL
|
||||
);
|
||||
return (wchar *)lpMsgBuf;
|
||||
return (wchar_t *)lpMsgBuf;
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
@ -531,7 +531,7 @@ static void WindowThreadProc(void *) {
|
||||
SetTimer(s_dialog, kEventTimer, 250, 0);
|
||||
|
||||
char productString[256];
|
||||
wchar productStringW[256];
|
||||
wchar_t productStringW[256];
|
||||
ProductString(productStringW, arrsize(productStringW));
|
||||
StrToAnsi(productString, productStringW, arrsize(productString));
|
||||
SendMessage(GetDlgItem(s_dialog, IDC_PRODUCTSTRING), WM_SETTEXT, 0, (LPARAM) productString);
|
||||
@ -740,8 +740,8 @@ int __stdcall WinMain (
|
||||
){
|
||||
PF_CONSOLE_INITIALIZE(Core)
|
||||
|
||||
wchar token[256];
|
||||
const wchar *appCmdLine = AppGetCommandLine();
|
||||
wchar_t token[256];
|
||||
const wchar_t *appCmdLine = AppGetCommandLine();
|
||||
StrTokenize(&appCmdLine, token, arrsize(token), WHITESPACE);
|
||||
while(!StrStr(token, L".exe") && !StrStr(token, L".tmp"))
|
||||
{
|
||||
@ -750,8 +750,8 @@ int __stdcall WinMain (
|
||||
while (*appCmdLine == L' ')
|
||||
++appCmdLine;
|
||||
|
||||
wchar curPatcherFile[MAX_PATH];
|
||||
wchar newPatcherFile[MAX_PATH];
|
||||
wchar_t curPatcherFile[MAX_PATH];
|
||||
wchar_t newPatcherFile[MAX_PATH];
|
||||
bool isTempPatcher = false;
|
||||
|
||||
PathGetProgramName(curPatcherFile, arrsize(curPatcherFile));
|
||||
@ -780,7 +780,7 @@ int __stdcall WinMain (
|
||||
|
||||
curl_global_init(CURL_GLOBAL_ALL);
|
||||
|
||||
const wchar *serverIni = L"server.ini";
|
||||
const wchar_t *serverIni = L"server.ini";
|
||||
if(cmdParser.IsSpecified(kArgServerIni))
|
||||
serverIni = cmdParser.GetString(kArgServerIni);
|
||||
|
||||
@ -835,9 +835,9 @@ int __stdcall WinMain (
|
||||
Sleep(1000);
|
||||
|
||||
if (!PathDeleteFile(newPatcherFile)) {
|
||||
wchar error[256];
|
||||
wchar_t error[256];
|
||||
DWORD errorCode = GetLastError();
|
||||
wchar *msg = TranslateErrorCode(errorCode);
|
||||
wchar_t *msg = TranslateErrorCode(errorCode);
|
||||
|
||||
StrPrintf(error, arrsize(error), L"Failed to delete old patcher executable. %s", msg);
|
||||
MessageBoxW(GetTopWindow(nil), error, L"Error", MB_OK);
|
||||
@ -845,9 +845,9 @@ int __stdcall WinMain (
|
||||
break;
|
||||
}
|
||||
if (!PathMoveFile(curPatcherFile, newPatcherFile)) {
|
||||
wchar error[256];
|
||||
wchar_t error[256];
|
||||
DWORD errorCode = GetLastError();
|
||||
wchar *msg = TranslateErrorCode(errorCode);
|
||||
wchar_t *msg = TranslateErrorCode(errorCode);
|
||||
|
||||
StrPrintf(error, arrsize(error), L"Failed to replace old patcher executable. %s", msg);
|
||||
MessageBoxW(GetTopWindow(nil), error, L"Error", MB_OK);
|
||||
@ -864,7 +864,7 @@ int __stdcall WinMain (
|
||||
ZERO(pi);
|
||||
si.cb = sizeof(si);
|
||||
|
||||
wchar cmdline[MAX_PATH];
|
||||
wchar_t cmdline[MAX_PATH];
|
||||
StrPrintf(cmdline, arrsize(cmdline), L"%s %s", newPatcherFile, s_launcherInfo.cmdLine);
|
||||
|
||||
// we have only successfully patched if we actually launch the new version of the patcher
|
||||
@ -891,7 +891,7 @@ int __stdcall WinMain (
|
||||
|
||||
// Clean up old temp files
|
||||
ARRAY(PathFind) paths;
|
||||
wchar fileSpec[MAX_PATH];
|
||||
wchar_t fileSpec[MAX_PATH];
|
||||
PathGetProgramDirectory(fileSpec, arrsize(fileSpec));
|
||||
PathAddFilename(fileSpec, fileSpec, L"*.tmp", arrsize(fileSpec));
|
||||
PathFindFiles(&paths, fileSpec, kPathFlagFile);
|
||||
@ -937,7 +937,7 @@ int __stdcall WinMain (
|
||||
// Self-patch failed
|
||||
SetText("Self-patch failed. Exiting...");
|
||||
if (!s_shutdown) {
|
||||
wchar str[256];
|
||||
wchar_t str[256];
|
||||
StrPrintf(str, arrsize(str), L"Patcher update failed. Error %u, %s", selfPatchResult, NetErrorToString(selfPatchResult));
|
||||
MessageBoxW(GetTopWindow(nil), str, L"Error", MB_OK);
|
||||
}
|
||||
|
@ -56,14 +56,14 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
***/
|
||||
|
||||
#ifndef PLASMA_EXTERNAL_RELEASE
|
||||
static const wchar s_manifest[] = L"InternalPatcher";
|
||||
static const wchar_t s_manifest[] = L"InternalPatcher";
|
||||
#else
|
||||
static const wchar s_manifest[] = L"ExternalPatcher";
|
||||
static const wchar_t s_manifest[] = L"ExternalPatcher";
|
||||
#endif
|
||||
|
||||
class SelfPatcherStream : public plZlibStream {
|
||||
public:
|
||||
virtual UInt32 Write(UInt32 byteCount, const void* buffer);
|
||||
virtual uint32_t Write(uint32_t byteCount, const void* buffer);
|
||||
static plLauncherInfo *info;
|
||||
static unsigned totalBytes;
|
||||
static unsigned progress;
|
||||
@ -76,7 +76,7 @@ static bool s_downloadComplete;
|
||||
static long s_numFiles;
|
||||
static ENetError s_patchResult;
|
||||
static bool s_updated;
|
||||
static wchar s_newPatcherFile[MAX_PATH];
|
||||
static wchar_t s_newPatcherFile[MAX_PATH];
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
@ -105,7 +105,7 @@ static void NetErrorHandler (ENetProtocol protocol, ENetError error) {
|
||||
static void DownloadCallback (
|
||||
ENetError result,
|
||||
void * param,
|
||||
const wchar filename[],
|
||||
const wchar_t filename[],
|
||||
hsStream * writer
|
||||
) {
|
||||
if(IS_NET_ERROR(result)) {
|
||||
@ -135,7 +135,7 @@ static void DownloadCallback (
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
static bool MD5Check (const char filename[], const wchar md5[]) {
|
||||
static bool MD5Check (const char filename[], const wchar_t md5[]) {
|
||||
// Do md5 check
|
||||
char md5copy[MAX_PATH];
|
||||
plMD5Checksum existingMD5(filename);
|
||||
@ -150,7 +150,7 @@ static bool MD5Check (const char filename[], const wchar md5[]) {
|
||||
static void ManifestCallback (
|
||||
ENetError result,
|
||||
void * param,
|
||||
const wchar group[],
|
||||
const wchar_t group[],
|
||||
const NetCliFileManifestEntry manifest[],
|
||||
unsigned entryCount
|
||||
) {
|
||||
@ -180,7 +180,7 @@ static void ManifestCallback (
|
||||
|
||||
// MD5 check current patcher against value in manifest
|
||||
ASSERT(entryCount == 1);
|
||||
wchar curPatcherFile[MAX_PATH];
|
||||
wchar_t curPatcherFile[MAX_PATH];
|
||||
PathGetProgramName(curPatcherFile, arrsize(curPatcherFile));
|
||||
StrToAnsi(ansi, curPatcherFile, arrsize(ansi));
|
||||
if (!MD5Check(ansi, manifest[0].md5)) {
|
||||
@ -206,7 +206,7 @@ static void ManifestCallback (
|
||||
static void FileSrvIpAddressCallback (
|
||||
ENetError result,
|
||||
void * param,
|
||||
const wchar addr[]
|
||||
const wchar_t addr[]
|
||||
) {
|
||||
NetCliGateKeeperDisconnect();
|
||||
|
||||
@ -236,7 +236,7 @@ static bool SelfPatcherProc (bool * abort, plLauncherInfo *info) {
|
||||
NetClientInitialize();
|
||||
NetClientSetErrorHandler(NetErrorHandler);
|
||||
|
||||
const wchar ** addrs;
|
||||
const wchar_t ** addrs;
|
||||
unsigned count;
|
||||
|
||||
count = GetGateKeeperSrvHostnames(&addrs);
|
||||
@ -267,7 +267,7 @@ static bool SelfPatcherProc (bool * abort, plLauncherInfo *info) {
|
||||
ZERO(pi);
|
||||
si.cb = sizeof(si);
|
||||
|
||||
wchar cmdline[MAX_PATH];
|
||||
wchar_t cmdline[MAX_PATH];
|
||||
StrPrintf(cmdline, arrsize(cmdline), L"%s %s", s_newPatcherFile, info->cmdLine);
|
||||
|
||||
// we have only successfully patched if we actually launch the new version of the patcher
|
||||
@ -300,7 +300,7 @@ static bool SelfPatcherProc (bool * abort, plLauncherInfo *info) {
|
||||
***/
|
||||
|
||||
//============================================================================
|
||||
UInt32 SelfPatcherStream::Write(UInt32 byteCount, const void* buffer) {
|
||||
uint32_t SelfPatcherStream::Write(uint32_t byteCount, const void* buffer) {
|
||||
progress += byteCount;
|
||||
float p = (float)progress / (float)totalBytes * 100; // progress
|
||||
SetProgress( (int)p );
|
||||
|
@ -69,8 +69,8 @@ typedef void (*setTimeRemainingCallback)(unsigned seconds);
|
||||
typedef void (*setBytesRemainingCallback)(unsigned bytes);
|
||||
|
||||
struct plLauncherInfo {
|
||||
wchar path[MAX_PATH];
|
||||
wchar cmdLine[512];
|
||||
wchar_t path[MAX_PATH];
|
||||
wchar_t cmdLine[512];
|
||||
unsigned buildId; // buildId override
|
||||
launcherCallback prepCallback;
|
||||
launcherCallback initCallback;
|
||||
|
Reference in New Issue
Block a user