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

Convert custom HeadSpin integer types to standard types from stdint.h

This commit is contained in:
2012-01-19 21:19:26 -05:00
parent a0d54e2644
commit 5027b5a4ac
1301 changed files with 14497 additions and 14532 deletions

File diff suppressed because it is too large Load Diff

View File

@ -61,7 +61,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
// Connect
//============================================================================
void NetCliAuthStartConnect (
const wchar * authAddrList[],
const wchar_t * authAddrList[],
unsigned authAddrCount
);
bool NetCliAuthQueryConnected ();
@ -88,8 +88,8 @@ typedef void (*FNetCliAuthPingRequestCallback)(
void * param,
unsigned pingAtMs,
unsigned replyAtMs,
unsigned payloadbytes,
const byte payload[]
unsigned payloadBytes,
const uint8_t payload[]
);
void NetCliAuthPingRequest (
unsigned pingTimeMs,
@ -108,7 +108,7 @@ typedef void (*FNetCliAuthAccountExistsRequestCallback)(
bool accountExists
);
void NetCliAuthAccountExistsRequest (
const wchar accountName[],
const wchar_t accountName[],
FNetCliAuthAccountExistsRequestCallback callback,
void * param
);
@ -118,8 +118,8 @@ void NetCliAuthAccountExistsRequest (
//============================================================================
struct NetCliAuthPlayerInfo {
unsigned playerInt;
wchar playerName[kMaxPlayerNameLength];
wchar avatarShape[kMaxVaultNodeStringLength];
wchar_t playerName[kMaxPlayerNameLength];
wchar_t avatarShape[kMaxVaultNodeStringLength];
unsigned playerFlags;
unsigned explorer;
};
@ -134,10 +134,10 @@ typedef void (*FNetCliAuthLoginRequestCallback)(
unsigned playerCount
);
void NetCliAuthLoginRequest (
const wchar accountName[], // nil --> reuse previous acct name
const wchar_t accountName[], // nil --> reuse previous acct name
const ShaDigest * accountNamePassHash, // nil --> reuse previous acct pass
const wchar authToken[], // nil --> reuse previous auth token
const wchar os[], // nil --> reuse previous os
const wchar_t authToken[], // nil --> reuse previous auth token
const wchar_t os[], // nil --> reuse previous os
FNetCliAuthLoginRequestCallback callback,
void * param
);
@ -164,8 +164,8 @@ typedef void (*FNetCliAuthAccountCreateRequestCallback)(
const Uuid & accountId
);
void NetCliAuthAccountCreateRequest (
const wchar accountName[],
const wchar accountPass[],
const wchar_t accountName[],
const wchar_t accountPass[],
unsigned accountFlags,
unsigned billingType,
FNetCliAuthAccountCreateRequestCallback callback,
@ -182,8 +182,8 @@ typedef void (*FNetCliAuthAccountCreateFromKeyRequestCallback)(
const Uuid & activationKey
);
void NetCliAuthAccountCreateFromKeyRequest (
const wchar accountName[],
const wchar accountPass[],
const wchar_t accountName[],
const wchar_t accountPass[],
Uuid key,
unsigned billingType,
FNetCliAuthAccountCreateFromKeyRequestCallback callback,
@ -199,9 +199,9 @@ typedef void (*FNetCliAuthPlayerCreateRequestCallback)(
const NetCliAuthPlayerInfo & playerInfo
);
void NetCliAuthPlayerCreateRequest (
const wchar playerName[],
const wchar avatarShape[],
const wchar friendInvite[],
const wchar_t playerName[],
const wchar_t avatarShape[],
const wchar_t friendInvite[],
FNetCliAuthPlayerCreateRequestCallback callback,
void * param
);
@ -257,7 +257,7 @@ typedef void (*FNetCliAuthGetPublicAgeListCallback)(
const ARRAY(NetAgeInfo) & ages
);
void NetCliAuthGetPublicAgeList (
const wchar ageName[],
const wchar_t ageName[],
FNetCliAuthGetPublicAgeListCallback callback,
void * param
);
@ -270,8 +270,8 @@ typedef void (*FNetCliAuthAccountChangePasswordRequestCallback)(
void * param
);
void NetCliAuthAccountChangePasswordRequest (
const wchar accountName[],
const wchar accountPass[],
const wchar_t accountName[],
const wchar_t accountPass[],
FNetCliAuthAccountChangePasswordRequestCallback callback,
void * param
);
@ -284,7 +284,7 @@ typedef void (*FNetCliAuthAccountSetRolesRequestCallback)(
void * param
);
void NetCliAuthAccountSetRolesRequest (
const wchar accountName[],
const wchar_t accountName[],
unsigned accountFlags,
FNetCliAuthAccountSetRolesRequestCallback callback,
void * param
@ -298,7 +298,7 @@ typedef void (*FNetCliAuthAccountSetBillingTypeRequestCallback)(
void * param
);
void NetCliAuthAccountSetBillingTypeRequest (
const wchar accountName[],
const wchar_t accountName[],
unsigned billingType,
FNetCliAuthAccountSetBillingTypeRequestCallback callback,
void * param
@ -329,7 +329,7 @@ typedef void (*FNetCliAuthAgeRequestCallback)(
NetAddressNode gameAddr
);
void NetCliAuthAgeRequest (
const wchar ageName[], // L"Teledahn"
const wchar_t ageName[], // L"Teledahn"
const Uuid & ageInstId,
FNetCliAuthAgeRequestCallback callback,
void * param
@ -339,7 +339,7 @@ void NetCliAuthAgeRequest (
// Secure File Encryption Key
//============================================================================
void NetCliAuthGetEncryptionKey (
UInt32 key[],
uint32_t key[],
unsigned size
);
@ -347,7 +347,7 @@ void NetCliAuthGetEncryptionKey (
// File List
//============================================================================
struct NetCliAuthFileInfo {
wchar filename[MAX_PATH];
wchar_t filename[MAX_PATH];
unsigned filesize;
};
typedef void (*FNetCliAuthFileListRequestCallback)(
@ -357,8 +357,8 @@ typedef void (*FNetCliAuthFileListRequestCallback)(
unsigned infoCount
);
void NetCliAuthFileListRequest (
const wchar dir[],
const wchar ext[],
const wchar_t dir[],
const wchar_t ext[],
FNetCliAuthFileListRequestCallback callback,
void * param
);
@ -369,11 +369,11 @@ void NetCliAuthFileListRequest (
typedef void (*FNetCliAuthFileRequestCallback)(
ENetError result,
void * param,
const wchar filename[],
const wchar_t filename[],
hsStream * writer
);
void NetCliAuthFileRequest (
const wchar filename[],
const wchar_t filename[],
hsStream * writer,
FNetCliAuthFileRequestCallback callback,
void * param
@ -520,19 +520,19 @@ typedef void (*FNetCliAuthAgeInitCallback) (
void NetCliAuthVaultInitAge (
const Uuid & ageInstId, // optional. is used in match
const Uuid & parentAgeInstId, // optional. is used in match
const wchar ageFilename[], // optional. is used in match
const wchar ageInstName[], // optional. not used in match
const wchar ageUserName[], // optional. not used in match
const wchar ageDesc[], // optional. not used in match
const wchar_t ageFilename[], // optional. is used in match
const wchar_t ageInstName[], // optional. not used in match
const wchar_t ageUserName[], // optional. not used in match
const wchar_t ageDesc[], // optional. not used in match
unsigned ageSequenceNumber, // optional. not used in match
unsigned ageLanguage, // optional. not used in match
FNetCliAuthAgeInitCallback callback, // optional
void * param // optional
);
void NetCliAuthLogPythonTraceback (const wchar traceback[]);
void NetCliAuthLogPythonTraceback (const wchar_t traceback[]);
void NetCliAuthLogStackDump (const wchar stackdump[]);
void NetCliAuthLogStackDump (const wchar_t stackdump[]);
void NetCliAuthLogClientDebuggerConnect ();
//============================================================================
@ -565,7 +565,7 @@ typedef void (*FNetCliAuthChangePlayerNameRequestCallback)(
);
void NetCliAuthChangePlayerNameRequest (
unsigned playerId,
const wchar newName[],
const wchar_t newName[],
FNetCliAuthChangePlayerNameRequestCallback callback,
void * param
);
@ -574,7 +574,7 @@ void NetCliAuthChangePlayerNameRequest (
// CCRPetition
//============================================================================
void NetCliAuthSendCCRPetition (
const wchar * petitionText
const wchar_t * petitionText
);
//============================================================================
@ -586,8 +586,8 @@ typedef void (*FNetCliAuthSendFriendInviteCallback)(
);
void NetCliAuthSendFriendInvite (
const wchar emailAddress[],
const wchar toName[],
const wchar_t emailAddress[],
const wchar_t toName[],
const Uuid& inviteUuid,
FNetCliAuthSendFriendInviteCallback callback,
void * param
@ -599,7 +599,7 @@ void NetCliAuthSendFriendInvite (
typedef void (*FNetCliAuthRecvBufferHandler)(
unsigned type,
unsigned bytes,
const byte buffer[]
const uint8_t buffer[]
);
void NetCliAuthSetRecvBufferHandler (
FNetCliAuthRecvBufferHandler handler
@ -607,7 +607,7 @@ void NetCliAuthSetRecvBufferHandler (
void NetCliAuthPropagateBuffer (
unsigned type,
unsigned bytes,
const byte buffer[]
const uint8_t buffer[]
);
//============================================================================
@ -631,7 +631,7 @@ typedef void (*FNetCliAuthCreateScoreCallback)(
ENetError result,
void * param,
unsigned scoreId,
UInt32 createdTime,
uint32_t createdTime,
unsigned ownerId,
const char* gameName,
unsigned gameType,

View File

@ -90,7 +90,7 @@ struct CliCsConn : AtomicRef {
void StopAutoPing ();
void TimerPing ();
void Send (const unsigned_ptr fields[], unsigned count);
void Send (const uintptr_t fields[], unsigned count);
};
@ -115,7 +115,7 @@ struct ConnectedNotifyTrans : NetNotifyTrans {
struct LoginRequestTrans : NetCsrTrans {
wchar m_csrName[kMaxAccountNameLength];
wchar_t m_csrName[kMaxAccountNameLength];
ShaDigest m_namePassHash;
FNetCliCsrLoginCallback m_callback;
void * m_param;
@ -124,7 +124,7 @@ struct LoginRequestTrans : NetCsrTrans {
unsigned m_csrFlags;
LoginRequestTrans (
const wchar csrName[],
const wchar_t csrName[],
const ShaDigest & namePassHash,
FNetCliCsrLoginCallback callback,
void * param
@ -133,7 +133,7 @@ struct LoginRequestTrans : NetCsrTrans {
bool Send ();
void Post ();
bool Recv (
const byte msg[],
const uint8_t msg[],
unsigned bytes
);
};
@ -213,7 +213,7 @@ static void UnlinkAndAbandonConn_CS (CliCsConn * conn) {
//============================================================================
static void SendRegisterRequest (CliCsConn * conn) {
const unsigned_ptr msg[] = {
const uintptr_t msg[] = {
kCli2Csr_RegisterRequest,
0
};
@ -411,7 +411,7 @@ static void Connect (
//============================================================================
static void AsyncLookupCallback (
void * param,
const wchar name[],
const wchar_t name[],
unsigned addrCount,
const NetAddress addrs[]
) {
@ -437,7 +437,7 @@ static void AsyncLookupCallback (
//============================================================================
static bool Recv_PingReply (
const byte msg[],
const uint8_t msg[],
unsigned bytes,
void *
) {
@ -450,7 +450,7 @@ static bool Recv_PingReply (
//============================================================================
static bool Recv_RegisterReply (
const byte msg[],
const uint8_t msg[],
unsigned ,
void * param
) {
@ -474,7 +474,7 @@ static bool Recv_RegisterReply (
//============================================================================
static bool Recv_LoginReply (
const byte msg[],
const uint8_t msg[],
unsigned bytes,
void *
) {
@ -583,7 +583,7 @@ void CliCsConn::TimerPing () {
// Send a ping request
pingSendTimeMs = GetNonZeroTimeMs();
const unsigned_ptr msg[] = {
const uintptr_t msg[] = {
kCli2Auth_PingRequest,
0, // not a transaction
pingSendTimeMs,
@ -595,7 +595,7 @@ void CliCsConn::TimerPing () {
}
//============================================================================
void CliCsConn::Send (const unsigned_ptr fields[], unsigned count) {
void CliCsConn::Send (const uintptr_t fields[], unsigned count) {
critsect.Enter();
{
@ -628,7 +628,7 @@ void ConnectedNotifyTrans::Post () {
//============================================================================
LoginRequestTrans::LoginRequestTrans (
const wchar csrName[],
const wchar_t csrName[],
const ShaDigest & namePassHash,
FNetCliCsrLoginCallback callback,
void * param
@ -648,11 +648,11 @@ bool LoginRequestTrans::Send () {
return false;
ShaDigest challengeHash;
dword clientChallenge = 0;
uint32_t clientChallenge = 0;
CryptCreateRandomSeed(
sizeof(clientChallenge),
(byte *) &clientChallenge
(uint8_t *) &clientChallenge
);
CryptHashPasswordChallenge(
@ -662,12 +662,12 @@ bool LoginRequestTrans::Send () {
&challengeHash
);
const unsigned_ptr msg[] = {
const uintptr_t msg[] = {
kCli2Csr_LoginRequest,
m_transId,
clientChallenge,
(unsigned_ptr) m_csrName,
(unsigned_ptr) &challengeHash
(uintptr_t) m_csrName,
(uintptr_t) &challengeHash
};
m_conn->Send(msg, arrsize(msg));
@ -687,7 +687,7 @@ void LoginRequestTrans::Post () {
//============================================================================
bool LoginRequestTrans::Recv (
const byte msg[],
const uint8_t msg[],
unsigned bytes
) {
const Csr2Cli_LoginReply & reply = *(const Csr2Cli_LoginReply *) msg;
@ -828,7 +828,7 @@ unsigned CsrGetConnId () {
//============================================================================
void NetCliCsrStartConnect (
const wchar * addrList[],
const wchar_t * addrList[],
unsigned addrCount,
FNetCliCsrConnectedCallback callback,
void * param
@ -838,7 +838,7 @@ void NetCliCsrStartConnect (
for (unsigned i = 0; i < addrCount; ++i) {
// Do we need to lookup the address?
const wchar * name = addrList[i];
const wchar_t * name = addrList[i];
while (unsigned ch = *name) {
++name;
if (!(isdigit(ch) || ch == L'.' || ch == L':')) {
@ -884,7 +884,7 @@ void NetCliCsrDisconnect () {
//============================================================================
void NetCliCsrLoginRequest (
const wchar csrName[],
const wchar_t csrName[],
const ShaDigest & namePassHash,
FNetCliCsrLoginCallback callback,
void * param

View File

@ -62,7 +62,7 @@ typedef void (*FNetCliCsrConnectedCallback) (
unsigned latestBuildId
);
void NetCliCsrStartConnect (
const wchar * addrList[],
const wchar_t * addrList[],
unsigned addrCount,
FNetCliCsrConnectedCallback callback = nil,
void * param = nil
@ -76,7 +76,7 @@ typedef void (*FNetCliCsrLoginCallback)(
unsigned csrFlags
);
void NetCliCsrLoginRequest (
const wchar csrName[],
const wchar_t csrName[],
const ShaDigest & namePassHash,
FNetCliCsrLoginCallback callback,
void * param
@ -87,7 +87,7 @@ typedef void (*FNetCliCsrSetTicketFilterCallback)(
void * param
);
void NetCliCsrSetTicketFilter (
const wchar filterSpec[],
const wchar_t filterSpec[],
FNetCliCsrSetTicketFilterCallback callback,
void * param
);

View File

@ -64,10 +64,10 @@ struct CliFileConn : AtomicRef {
LINK(CliFileConn) link;
CLock sockLock; // to protect the socket pointer so we don't nuke it while using it
AsyncSocket sock;
wchar name[MAX_PATH];
wchar_t name[MAX_PATH];
NetAddress addr;
unsigned seq;
ARRAY(byte) recvBuffer;
ARRAY(uint8_t) recvBuffer;
AsyncCancelId cancelId;
bool abandoned;
unsigned buildId;
@ -134,7 +134,7 @@ struct BuildIdRequestTrans : NetFileTrans {
bool Send ();
void Post ();
bool Recv (
const byte msg[],
const uint8_t msg[],
unsigned bytes
);
};
@ -145,7 +145,7 @@ struct BuildIdRequestTrans : NetFileTrans {
struct ManifestRequestTrans : NetFileTrans {
FNetCliFileManifestRequestCallback m_callback;
void * m_param;
wchar m_group[MAX_PATH];
wchar_t m_group[MAX_PATH];
unsigned m_buildId;
ARRAY(NetCliFileManifestEntry) m_manifest;
@ -154,14 +154,14 @@ struct ManifestRequestTrans : NetFileTrans {
ManifestRequestTrans (
FNetCliFileManifestRequestCallback callback,
void * param,
const wchar group[],
const wchar_t group[],
unsigned buildId
);
bool Send ();
void Post ();
bool Recv (
const byte msg[],
const uint8_t msg[],
unsigned bytes
);
};
@ -173,7 +173,7 @@ struct DownloadRequestTrans : NetFileTrans {
FNetCliFileDownloadRequestCallback m_callback;
void * m_param;
wchar m_filename[MAX_PATH];
wchar_t m_filename[MAX_PATH];
hsStream * m_writer;
unsigned m_buildId;
@ -182,7 +182,7 @@ struct DownloadRequestTrans : NetFileTrans {
DownloadRequestTrans (
FNetCliFileDownloadRequestCallback callback,
void * param,
const wchar filename[],
const wchar_t filename[],
hsStream * writer,
unsigned buildId
);
@ -190,7 +190,7 @@ struct DownloadRequestTrans : NetFileTrans {
bool Send ();
void Post ();
bool Recv (
const byte msg[],
const uint8_t msg[],
unsigned bytes
);
};
@ -201,7 +201,7 @@ struct DownloadRequestTrans : NetFileTrans {
struct RcvdFileDownloadChunkTrans : NetNotifyTrans {
unsigned bytes;
byte * data;
uint8_t * data;
hsStream * writer;
RcvdFileDownloadChunkTrans () : NetNotifyTrans (kFileRcvdFileDownloadChunkTrans) {}
@ -437,10 +437,10 @@ static bool NotifyConnSocketRead (CliFileConn * conn, AsyncNotifySocketRead * re
read->bytesProcessed += read->bytes;
for (;;) {
if (conn->recvBuffer.Count() < sizeof(dword))
if (conn->recvBuffer.Count() < sizeof(uint32_t))
return true;
dword msgSize = *(dword *)conn->recvBuffer.Ptr();
uint32_t msgSize = *(uint32_t *)conn->recvBuffer.Ptr();
if (conn->recvBuffer.Count() < msgSize)
return true;
@ -539,7 +539,7 @@ static void Connect (CliFileConn * conn) {
//============================================================================
static void Connect (
const wchar name[],
const wchar_t name[],
const NetAddress & addr
) {
ASSERT(s_running);
@ -559,7 +559,7 @@ static void Connect (
//============================================================================
static void AsyncLookupCallback (
void * param,
const wchar name[],
const wchar_t name[],
unsigned addrCount,
const NetAddress addrs[]
) {
@ -798,7 +798,7 @@ bool CliFileConn::Recv_PingReply (
bool CliFileConn::Recv_BuildIdReply (
const File2Cli_BuildIdReply * msg
) {
NetTransRecv(msg->transId, (const byte *)msg, msg->messageBytes);
NetTransRecv(msg->transId, (const uint8_t *)msg, msg->messageBytes);
return true;
}
@ -816,7 +816,7 @@ bool CliFileConn::Recv_BuildIdUpdate (
bool CliFileConn::Recv_ManifestReply (
const File2Cli_ManifestReply * msg
) {
NetTransRecv(msg->transId, (const byte *)msg, msg->messageBytes);
NetTransRecv(msg->transId, (const uint8_t *)msg, msg->messageBytes);
return true;
}
@ -825,7 +825,7 @@ bool CliFileConn::Recv_ManifestReply (
bool CliFileConn::Recv_FileDownloadReply (
const File2Cli_FileDownloadReply * msg
) {
NetTransRecv(msg->transId, (const byte *)msg, msg->messageBytes);
NetTransRecv(msg->transId, (const uint8_t *)msg, msg->messageBytes);
return true;
}
@ -868,7 +868,7 @@ void BuildIdRequestTrans::Post () {
//============================================================================
bool BuildIdRequestTrans::Recv (
const byte msg[],
const uint8_t msg[],
unsigned bytes
) {
const File2Cli_BuildIdReply & reply = *(const File2Cli_BuildIdReply *) msg;
@ -900,7 +900,7 @@ bool BuildIdRequestTrans::Recv (
ManifestRequestTrans::ManifestRequestTrans (
FNetCliFileManifestRequestCallback callback,
void * param,
const wchar group[],
const wchar_t group[],
unsigned buildId
) : NetFileTrans(kManifestRequestTrans)
, m_callback(callback)
@ -937,7 +937,7 @@ void ManifestRequestTrans::Post () {
}
//============================================================================
void ReadStringFromMsg(const wchar* curMsgPtr, wchar str[], unsigned maxStrLen, unsigned* length) {
void ReadStringFromMsg(const wchar_t* curMsgPtr, wchar_t str[], unsigned maxStrLen, unsigned* length) {
StrCopy(str, curMsgPtr, maxStrLen);
str[maxStrLen - 1] = L'\0'; // make sure it's terminated
@ -945,22 +945,22 @@ void ReadStringFromMsg(const wchar* curMsgPtr, wchar str[], unsigned maxStrLen,
}
//============================================================================
void ReadUnsignedFromMsg(const wchar* curMsgPtr, unsigned* val) {
void ReadUnsignedFromMsg(const wchar_t* curMsgPtr, unsigned* val) {
(*val) = ((*curMsgPtr) << 16) + (*(curMsgPtr + 1));
}
//============================================================================
bool ManifestRequestTrans::Recv (
const byte msg[],
const uint8_t msg[],
unsigned bytes
) {
m_timeoutAtMs = TimeGetMs() + NetTransGetTimeoutMs(); // Reset the timeout counter
const File2Cli_ManifestReply & reply = *(const File2Cli_ManifestReply *) msg;
dword numFiles = reply.numFiles;
dword wcharCount = reply.wcharCount;
const wchar* curChar = reply.manifestData; // the pointer is not yet dereferenced here!
uint32_t numFiles = reply.numFiles;
uint32_t wchar_tCount = reply.wchar_tCount;
const wchar_t* curChar = reply.manifestData; // the pointer is not yet dereferenced here!
// tell the server we got the data
Cli2File_ManifestEntryAck manifestAck;
@ -971,9 +971,9 @@ bool ManifestRequestTrans::Recv (
m_conn->Send(&manifestAck, manifestAck.messageBytes);
// if wcharCount is 2 or less, the data only contains the terminator "\0\0" and we
// if wchar_tCount is 2 or less, the data only contains the terminator "\0\0" and we
// don't need to convert anything (and we are done)
if ((IS_NET_ERROR(reply.result)) || (wcharCount <= 2)) {
if ((IS_NET_ERROR(reply.result)) || (wchar_tCount <= 2)) {
// we have a problem... or we have nothing to so, so we're done
m_result = reply.result;
m_state = kTransStateComplete;
@ -986,7 +986,7 @@ bool ManifestRequestTrans::Recv (
// manifestData format: "clientFile\0downloadFile\0md5\0filesize\0zipsize\0flags\0...\0\0"
bool done = false;
while (!done) {
if (wcharCount == 0)
if (wchar_tCount == 0)
{
done = true;
break;
@ -1000,98 +1000,98 @@ bool ManifestRequestTrans::Recv (
unsigned filenameLen;
ReadStringFromMsg(curChar, entry.clientName, arrsize(entry.clientName), &filenameLen);
curChar += filenameLen; // advance the pointer
wcharCount -= filenameLen; // keep track of the amount remaining
if ((*curChar != L'\0') || (wcharCount <= 0))
wchar_tCount -= filenameLen; // keep track of the amount remaining
if ((*curChar != L'\0') || (wchar_tCount <= 0))
return false; // something is screwy, abort and disconnect
// point it at the downloadFile
curChar++;
wcharCount--;
wchar_tCount--;
// --------------------------------------------------------------------
// read in the downloadFilename
ReadStringFromMsg(curChar, entry.downloadName, arrsize(entry.downloadName), &filenameLen);
curChar += filenameLen; // advance the pointer
wcharCount -= filenameLen; // keep track of the amount remaining
if ((*curChar != L'\0') || (wcharCount <= 0))
wchar_tCount -= filenameLen; // keep track of the amount remaining
if ((*curChar != L'\0') || (wchar_tCount <= 0))
return false; // something is screwy, abort and disconnect
// point it at the md5
curChar++;
wcharCount--;
wchar_tCount--;
// --------------------------------------------------------------------
// read in the md5
ReadStringFromMsg(curChar, entry.md5, arrsize(entry.md5), &filenameLen);
curChar += filenameLen; // advance the pointer
wcharCount -= filenameLen; // keep track of the amount remaining
if ((*curChar != L'\0') || (wcharCount <= 0))
wchar_tCount -= filenameLen; // keep track of the amount remaining
if ((*curChar != L'\0') || (wchar_tCount <= 0))
return false; // something is screwy, abort and disconnect
// point it at the md5 for compressed files
curChar++;
wcharCount--;
wchar_tCount--;
// --------------------------------------------------------------------
// read in the md5 for compressed files
ReadStringFromMsg(curChar, entry.md5compressed, arrsize(entry.md5compressed), &filenameLen);
curChar += filenameLen; // advance the pointer
wcharCount -= filenameLen; // keep track of the amount remaining
if ((*curChar != L'\0') || (wcharCount <= 0))
wchar_tCount -= filenameLen; // keep track of the amount remaining
if ((*curChar != L'\0') || (wchar_tCount <= 0))
return false; // something is screwy, abort and disconnect
// point it at the first part of the filesize value (format: 0xHHHHLLLL)
curChar++;
wcharCount--;
wchar_tCount--;
// --------------------------------------------------------------------
if (wcharCount < 2) // we have to have 2 chars for the size
if (wchar_tCount < 2) // we have to have 2 chars for the size
return false; // screwy data
ReadUnsignedFromMsg(curChar, &entry.fileSize);
curChar += 2;
wcharCount -= 2;
if ((*curChar != L'\0') || (wcharCount <= 0))
wchar_tCount -= 2;
if ((*curChar != L'\0') || (wchar_tCount <= 0))
return false; // screwy data
// point it at the first part of the zipsize value (format: 0xHHHHLLLL)
curChar++;
wcharCount--;
wchar_tCount--;
// --------------------------------------------------------------------
if (wcharCount < 2) // we have to have 2 chars for the size
if (wchar_tCount < 2) // we have to have 2 chars for the size
return false; // screwy data
ReadUnsignedFromMsg(curChar, &entry.zipSize);
curChar += 2;
wcharCount -= 2;
if ((*curChar != L'\0') || (wcharCount <= 0))
wchar_tCount -= 2;
if ((*curChar != L'\0') || (wchar_tCount <= 0))
return false; // screwy data
// point it at the first part of the flags value (format: 0xHHHHLLLL)
curChar++;
wcharCount--;
wchar_tCount--;
// --------------------------------------------------------------------
if (wcharCount < 2) // we have to have 2 chars for the size
if (wchar_tCount < 2) // we have to have 2 chars for the size
return false; // screwy data
ReadUnsignedFromMsg(curChar, &entry.flags);
curChar += 2;
wcharCount -= 2;
if ((*curChar != L'\0') || (wcharCount <= 0))
wchar_tCount -= 2;
if ((*curChar != L'\0') || (wchar_tCount <= 0))
return false; // screwy data
// --------------------------------------------------------------------
// point it at either the second part of the terminator, or the next filename
curChar++;
wcharCount--;
wchar_tCount--;
// do sanity checking
if (*curChar == L'\0') {
// we hit the terminator
if (wcharCount != 1)
if (wchar_tCount != 1)
return false; // invalid data, we shouldn't have any more
done = true; // we're done
}
else if (wcharCount < 14)
else if (wchar_tCount < 14)
// we must have at least three 1-char strings, three nulls, three 32-bit ints, and 2-char terminator left (3+3+6+2)
return false; // screwy data
@ -1123,7 +1123,7 @@ bool ManifestRequestTrans::Recv (
DownloadRequestTrans::DownloadRequestTrans (
FNetCliFileDownloadRequestCallback callback,
void * param,
const wchar filename[],
const wchar_t filename[],
hsStream * writer,
unsigned buildId
) : NetFileTrans(kDownloadRequestTrans)
@ -1163,15 +1163,15 @@ void DownloadRequestTrans::Post () {
//============================================================================
bool DownloadRequestTrans::Recv (
const byte msg[],
const uint8_t msg[],
unsigned bytes
) {
m_timeoutAtMs = TimeGetMs() + NetTransGetTimeoutMs(); // Reset the timeout counter
const File2Cli_FileDownloadReply & reply = *(const File2Cli_FileDownloadReply *) msg;
dword byteCount = reply.byteCount;
const byte* data = reply.fileData;
uint32_t byteCount = reply.byteCount;
const uint8_t* data = reply.fileData;
// tell the server we got the data
Cli2File_FileDownloadChunkAck fileAck;
@ -1195,7 +1195,7 @@ bool DownloadRequestTrans::Recv (
RcvdFileDownloadChunkTrans * writeTrans = NEW(RcvdFileDownloadChunkTrans);
writeTrans->writer = m_writer;
writeTrans->bytes = byteCount;
writeTrans->data = (byte *)ALLOC(byteCount);
writeTrans->data = (uint8_t *)ALLOC(byteCount);
MemCopy(writeTrans->data, data, byteCount);
NetTransSend(writeTrans);
}
@ -1334,7 +1334,7 @@ unsigned FileGetConnId () {
//============================================================================
void NetCliFileStartConnect (
const wchar * fileAddrList[],
const wchar_t * fileAddrList[],
unsigned fileAddrCount,
bool isPatcher /* = false */
) {
@ -1346,7 +1346,7 @@ void NetCliFileStartConnect (
for (unsigned i = 0; i < fileAddrCount; ++i) {
// Do we need to lookup the address?
const wchar * name = fileAddrList[i];
const wchar_t * name = fileAddrList[i];
while (unsigned ch = *name) {
++name;
if (!(isdigit(ch) || ch == L'.' || ch == L':')) {
@ -1371,7 +1371,7 @@ void NetCliFileStartConnect (
//============================================================================
void NetCliFileStartConnectAsServer (
const wchar * fileAddrList[],
const wchar_t * fileAddrList[],
unsigned fileAddrCount,
unsigned serverType,
unsigned serverBuildId
@ -1384,7 +1384,7 @@ void NetCliFileStartConnectAsServer (
for (unsigned i = 0; i < fileAddrCount; ++i) {
// Do we need to lookup the address?
const wchar * name = fileAddrList[i];
const wchar_t * name = fileAddrList[i];
while (unsigned ch = *name) {
++name;
if (!(isdigit(ch) || ch == L'.' || ch == L':')) {
@ -1439,7 +1439,7 @@ void NetCliFileRegisterBuildIdUpdate (FNetCliFileBuildIdUpdateCallback callback)
void NetCliFileManifestRequest (
FNetCliFileManifestRequestCallback callback,
void * param,
const wchar group[],
const wchar_t group[],
unsigned buildId /* = 0 */
) {
ManifestRequestTrans * trans = NEW(ManifestRequestTrans)(
@ -1453,7 +1453,7 @@ void NetCliFileManifestRequest (
//============================================================================
void NetCliFileDownloadRequest (
const wchar filename[],
const wchar_t filename[],
hsStream * writer,
FNetCliFileDownloadRequestCallback callback,
void * param,

View File

@ -62,12 +62,12 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
// Connect
//============================================================================
void NetCliFileStartConnect (
const wchar * fileAddrList[],
const wchar_t * fileAddrList[],
unsigned fileAddrCount,
bool isPatcher = false
);
void NetCliFileStartConnectAsServer (
const wchar * fileAddrList[],
const wchar_t * fileAddrList[],
unsigned fileAddrCount,
unsigned serverType,
unsigned serverBuildId
@ -97,10 +97,10 @@ void NetCliFileRegisterBuildIdUpdate (FNetCliFileBuildIdUpdateCallback callback)
// Manifest
//============================================================================
struct NetCliFileManifestEntry {
wchar clientName[MAX_PATH]; // path and file on client side (for comparison)
wchar downloadName[MAX_PATH]; // path and file on server side (for download)
wchar md5[MAX_PATH];
wchar md5compressed[MAX_PATH]; // 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[MAX_PATH];
wchar_t md5compressed[MAX_PATH]; // md5 for the compressed file
unsigned fileSize;
unsigned zipSize;
unsigned flags;
@ -108,14 +108,14 @@ struct NetCliFileManifestEntry {
typedef void (*FNetCliFileManifestRequestCallback)(
ENetError result,
void * param,
const wchar group[],
const wchar_t group[],
const NetCliFileManifestEntry manifest[],
unsigned entryCount
);
void NetCliFileManifestRequest (
FNetCliFileManifestRequestCallback callback,
void * param,
const wchar group[], // the group of files you want (empty or nil = all)
const wchar_t group[], // the group of files you want (empty or nil = all)
unsigned buildId = 0 // 0 = get latest, other = get particular build (servers only)
);
@ -125,11 +125,11 @@ void NetCliFileManifestRequest (
typedef void (*FNetCliFileDownloadRequestCallback)(
ENetError result,
void * param,
const wchar filename[],
const wchar_t filename[],
hsStream * writer
);
void NetCliFileDownloadRequest (
const wchar filename[],
const wchar_t filename[],
hsStream * writer,
FNetCliFileDownloadRequestCallback callback,
void * param,

View File

@ -74,7 +74,7 @@ struct CliGmConn : AtomicRef {
CliGmConn ();
~CliGmConn ();
void Send (const unsigned_ptr fields[], unsigned count);
void Send (const uintptr_t fields[], unsigned count);
};
@ -100,7 +100,7 @@ struct JoinAgeRequestTrans : NetGameTrans {
bool Send ();
void Post ();
bool Recv (
const byte msg[],
const uint8_t msg[],
unsigned bytes
);
};
@ -112,7 +112,7 @@ struct RcvdPropagatedBufferTrans : NetNotifyTrans {
unsigned bufferType;
unsigned bufferBytes;
byte * bufferData;
uint8_t * bufferData;
RcvdPropagatedBufferTrans () : NetNotifyTrans(kGmRcvdPropagatedBufferTrans) {}
~RcvdPropagatedBufferTrans ();
@ -125,7 +125,7 @@ struct RcvdPropagatedBufferTrans : NetNotifyTrans {
struct RcvdGameMgrMsgTrans : NetNotifyTrans {
unsigned bufferBytes;
byte * bufferData;
uint8_t * bufferData;
RcvdGameMgrMsgTrans () : NetNotifyTrans(kGmRcvdGameMgrMsgTrans) {}
~RcvdGameMgrMsgTrans ();
@ -405,7 +405,7 @@ CliGmConn::~CliGmConn () {
}
//============================================================================
void CliGmConn::Send (const unsigned_ptr fields[], unsigned count) {
void CliGmConn::Send (const uintptr_t fields[], unsigned count) {
critsect.Enter();
{
NetCliSend(cli, fields, count);
@ -423,7 +423,7 @@ void CliGmConn::Send (const unsigned_ptr fields[], unsigned count) {
//============================================================================
static bool Recv_PingReply (
const byte msg[],
const uint8_t msg[],
unsigned bytes,
void * param
) {
@ -432,7 +432,7 @@ static bool Recv_PingReply (
//============================================================================
static bool Recv_JoinAgeReply (
const byte msg[],
const uint8_t msg[],
unsigned bytes,
void * param
) {
@ -447,7 +447,7 @@ static bool Recv_JoinAgeReply (
//============================================================================
static bool Recv_PropagateBuffer (
const byte msg[],
const uint8_t msg[],
unsigned bytes,
void * param
) {
@ -456,7 +456,7 @@ static bool Recv_PropagateBuffer (
RcvdPropagatedBufferTrans * trans = NEW(RcvdPropagatedBufferTrans);
trans->bufferType = reply.type;
trans->bufferBytes = reply.bytes;
trans->bufferData = (byte *)ALLOC(reply.bytes);
trans->bufferData = (uint8_t *)ALLOC(reply.bytes);
MemCopy(trans->bufferData, reply.buffer, reply.bytes);
NetTransSend(trans);
@ -465,7 +465,7 @@ static bool Recv_PropagateBuffer (
//============================================================================
static bool Recv_GameMgrMsg (
const byte msg[],
const uint8_t msg[],
unsigned bytes,
void * param
) {
@ -473,7 +473,7 @@ static bool Recv_GameMgrMsg (
RcvdGameMgrMsgTrans * trans = NEW(RcvdGameMgrMsgTrans);
trans->bufferBytes = reply.bytes;
trans->bufferData = (byte *)ALLOC(reply.bytes);
trans->bufferData = (uint8_t *)ALLOC(reply.bytes);
MemCopy(trans->bufferData, reply.buffer, reply.bytes);
NetTransSend(trans);
@ -530,11 +530,11 @@ bool JoinAgeRequestTrans::Send () {
if (!AcquireConn())
return false;
const unsigned_ptr msg[] = {
const uintptr_t msg[] = {
kCli2Game_JoinAgeRequest,
m_transId,
m_ageMcpId,
(unsigned_ptr) &m_accountUuid,
(uintptr_t) &m_accountUuid,
m_playerInt,
};
@ -553,7 +553,7 @@ void JoinAgeRequestTrans::Post () {
//============================================================================
bool JoinAgeRequestTrans::Recv (
const byte msg[],
const uint8_t msg[],
unsigned bytes
) {
const Game2Cli_JoinAgeReply & reply = *(const Game2Cli_JoinAgeReply *) msg;
@ -771,17 +771,17 @@ void NetCliGameSetRecvBufferHandler (
void NetCliGamePropagateBuffer (
unsigned type,
unsigned bytes,
const byte buffer[]
const uint8_t buffer[]
) {
CliGmConn * conn = GetConnIncRef("PropBuffer");
if (!conn)
return;
const unsigned_ptr msg[] = {
const uintptr_t msg[] = {
kCli2Game_PropagateBuffer,
type,
bytes,
(unsigned_ptr) buffer,
(uintptr_t) buffer,
};
conn->Send(msg, arrsize(msg));
@ -800,10 +800,10 @@ void NetCliGameSendGameMgrMsg (GameMsgHeader * msgHdr) {
if (!conn)
return;
const unsigned_ptr msg[] = {
const uintptr_t msg[] = {
kCli2Game_GameMgrMsg,
msgHdr->messageBytes,
(unsigned_ptr) msgHdr,
(uintptr_t) msgHdr,
};
conn->Send(msg, arrsize(msg));

View File

@ -90,7 +90,7 @@ void NetCliGameJoinAgeRequest (
typedef void (*FNetCliGameRecvBufferHandler)(
unsigned type,
unsigned bytes,
const byte buffer[]
const uint8_t buffer[]
);
void NetCliGameSetRecvBufferHandler (
FNetCliGameRecvBufferHandler handler
@ -98,7 +98,7 @@ void NetCliGameSetRecvBufferHandler (
void NetCliGamePropagateBuffer (
unsigned type,
unsigned bytes,
const byte buffer[]
const uint8_t buffer[]
);
//============================================================================

View File

@ -83,13 +83,13 @@ struct CliGkConn : AtomicRef {
void StopAutoPing ();
void TimerPing ();
void Send (const unsigned_ptr fields[], unsigned count);
void Send (const uintptr_t fields[], unsigned count);
CCritSect critsect;
LINK(CliGkConn) link;
AsyncSocket sock;
NetCli * cli;
wchar name[MAX_PATH];
wchar_t name[MAX_PATH];
NetAddress addr;
Uuid token;
unsigned seq;
@ -107,7 +107,7 @@ struct PingRequestTrans : NetGateKeeperTrans {
void * m_param;
unsigned m_pingAtMs;
unsigned m_replyAtMs;
ARRAY(byte) m_payload;
ARRAY(uint8_t) m_payload;
PingRequestTrans (
FNetCliGateKeeperPingRequestCallback callback,
@ -120,7 +120,7 @@ struct PingRequestTrans : NetGateKeeperTrans {
bool Send ();
void Post ();
bool Recv (
const byte msg[],
const uint8_t msg[],
unsigned bytes
);
};
@ -131,7 +131,7 @@ struct PingRequestTrans : NetGateKeeperTrans {
struct FileSrvIpAddressRequestTrans : NetGateKeeperTrans {
FNetCliGateKeeperFileSrvIpAddressRequestCallback m_callback;
void * m_param;
wchar m_addr[64];
wchar_t m_addr[64];
bool m_isPatcher;
FileSrvIpAddressRequestTrans (
@ -143,7 +143,7 @@ struct FileSrvIpAddressRequestTrans : NetGateKeeperTrans {
bool Send ();
void Post ();
bool Recv (
const byte msg[],
const uint8_t msg[],
unsigned bytes
);
};
@ -154,7 +154,7 @@ struct FileSrvIpAddressRequestTrans : NetGateKeeperTrans {
struct AuthSrvIpAddressRequestTrans : NetGateKeeperTrans {
FNetCliGateKeeperAuthSrvIpAddressRequestCallback m_callback;
void * m_param;
wchar m_addr[64];
wchar_t m_addr[64];
AuthSrvIpAddressRequestTrans (
FNetCliGateKeeperAuthSrvIpAddressRequestCallback callback,
@ -164,7 +164,7 @@ struct AuthSrvIpAddressRequestTrans : NetGateKeeperTrans {
bool Send ();
void Post ();
bool Recv (
const byte msg[],
const uint8_t msg[],
unsigned bytes
);
};
@ -246,7 +246,7 @@ static void UnlinkAndAbandonConn_CS (CliGkConn * conn) {
//============================================================================
static void SendClientRegisterRequest (CliGkConn * conn) {
/* const unsigned_ptr msg[] = {
/* const uintptr_t msg[] = {
kCli2GateKeeper_ClientRegisterRequest,
BuildId(),
};
@ -463,7 +463,7 @@ static void Connect (
//============================================================================
static void Connect (
const wchar name[],
const wchar_t name[],
const NetAddress & addr
) {
ASSERT(s_running);
@ -481,7 +481,7 @@ static void Connect (
//============================================================================
static void AsyncLookupCallback (
void * param,
const wchar name[],
const wchar_t name[],
unsigned addrCount,
const NetAddress addrs[]
) {
@ -660,7 +660,7 @@ void CliGkConn::TimerPing () {
// Send a ping request
pingSendTimeMs = GetNonZeroTimeMs();
const unsigned_ptr msg[] = {
const uintptr_t msg[] = {
kCli2GateKeeper_PingRequest,
pingSendTimeMs,
0, // not a transaction
@ -673,7 +673,7 @@ void CliGkConn::TimerPing () {
}
//============================================================================
void CliGkConn::Send (const unsigned_ptr fields[], unsigned count) {
void CliGkConn::Send (const uintptr_t fields[], unsigned count) {
critsect.Enter();
{
NetCliSend(cli, fields, count);
@ -691,7 +691,7 @@ void CliGkConn::Send (const unsigned_ptr fields[], unsigned count) {
//============================================================================
static bool Recv_PingReply (
const byte msg[],
const uint8_t msg[],
unsigned bytes,
void *
) {
@ -706,7 +706,7 @@ static bool Recv_PingReply (
//============================================================================
static bool Recv_FileSrvIpAddressReply (
const byte msg[],
const uint8_t msg[],
unsigned bytes,
void *
) {
@ -720,7 +720,7 @@ static bool Recv_FileSrvIpAddressReply (
//============================================================================
static bool Recv_AuthSrvIpAddressReply (
const byte msg[],
const uint8_t msg[],
unsigned bytes,
void *
) {
@ -774,7 +774,7 @@ PingRequestTrans::PingRequestTrans (
, m_param(param)
, m_pingAtMs(pingAtMs)
{
m_payload.Set((const byte *)payload, payloadBytes);
m_payload.Set((const uint8_t *)payload, payloadBytes);
}
//============================================================================
@ -783,12 +783,12 @@ bool PingRequestTrans::Send () {
if (!AcquireConn())
return false;
const unsigned_ptr msg[] = {
const uintptr_t msg[] = {
kCli2GateKeeper_PingRequest,
m_pingAtMs,
m_transId,
m_payload.Count(),
(unsigned_ptr) m_payload.Ptr(),
(uintptr_t) m_payload.Ptr(),
};
m_conn->Send(msg, arrsize(msg));
@ -811,7 +811,7 @@ void PingRequestTrans::Post () {
//============================================================================
bool PingRequestTrans::Recv (
const byte msg[],
const uint8_t msg[],
unsigned bytes
) {
const GateKeeper2Cli_PingReply & reply = *(const GateKeeper2Cli_PingReply *)msg;
@ -850,7 +850,7 @@ bool FileSrvIpAddressRequestTrans::Send () {
return false;
const unsigned_ptr msg[] = {
const uintptr_t msg[] = {
kCli2GateKeeper_FileSrvIpAddressRequest,
m_transId,
m_isPatcher == true ? 1 : 0
@ -873,7 +873,7 @@ void FileSrvIpAddressRequestTrans::Post () {
//============================================================================
bool FileSrvIpAddressRequestTrans::Recv (
const byte msg[],
const uint8_t msg[],
unsigned bytes
) {
const GateKeeper2Cli_FileSrvIpAddressReply & reply = *(const GateKeeper2Cli_FileSrvIpAddressReply *)msg;
@ -909,7 +909,7 @@ bool AuthSrvIpAddressRequestTrans::Send () {
if (!AcquireConn())
return false;
const unsigned_ptr msg[] = {
const uintptr_t msg[] = {
kCli2GateKeeper_AuthSrvIpAddressRequest,
m_transId,
};
@ -931,7 +931,7 @@ void AuthSrvIpAddressRequestTrans::Post () {
//============================================================================
bool AuthSrvIpAddressRequestTrans::Recv (
const byte msg[],
const uint8_t msg[],
unsigned bytes
) {
const GateKeeper2Cli_AuthSrvIpAddressReply & reply = *(const GateKeeper2Cli_AuthSrvIpAddressReply *)msg;
@ -1065,14 +1065,14 @@ unsigned GateKeeperGetConnId () {
//============================================================================
void NetCliGateKeeperStartConnect (
const wchar * gateKeeperAddrList[],
const wchar_t * gateKeeperAddrList[],
unsigned gateKeeperAddrCount
) {
gateKeeperAddrCount = min(gateKeeperAddrCount, 1);
for (unsigned i = 0; i < gateKeeperAddrCount; ++i) {
// Do we need to lookup the address?
const wchar * name = gateKeeperAddrList[i];
const wchar_t * name = gateKeeperAddrList[i];
while (unsigned ch = *name) {
++name;
if (!(isdigit(ch) || ch == L'.' || ch == L':')) {

View File

@ -62,7 +62,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
// Connect
//============================================================================
void NetCliGateKeeperStartConnect (
const wchar * gateKeeperAddrList[],
const wchar_t * gateKeeperAddrList[],
unsigned gateKeeperAddrCount
);
@ -91,8 +91,8 @@ typedef void (*FNetCliGateKeeperPingRequestCallback)(
void * param,
unsigned pingAtMs,
unsigned replyAtMs,
unsigned payloadbytes,
const byte payload[]
unsigned payloadBytes,
const uint8_t payload[]
);
void NetCliGateKeeperPingRequest (
unsigned pingTimeMs,
@ -109,7 +109,7 @@ void NetCliGateKeeperPingRequest (
typedef void (*FNetCliGateKeeperFileSrvIpAddressRequestCallback)(
ENetError result,
void * param,
const wchar addr[]
const wchar_t addr[]
);
void NetCliGateKeeperFileSrvIpAddressRequest (
@ -125,7 +125,7 @@ void NetCliGateKeeperFileSrvIpAddressRequest (
typedef void (*FNetCliGateKeeperAuthSrvIpAddressRequestCallback)(
ENetError result,
void * param,
const wchar addr[]
const wchar_t addr[]
);
void NetCliGateKeeperAuthSrvIpAddressRequest (

View File

@ -211,7 +211,7 @@ void NetTransSend (NetTrans * trans) {
}
//============================================================================
bool NetTransRecv (unsigned transId, const byte msg[], unsigned bytes) {
bool NetTransRecv (unsigned transId, const uint8_t msg[], unsigned bytes) {
NetTrans * trans = FindTransIncRef(transId, "Recv");
if (!trans)