mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-14 02:27:40 -04:00
Remove all uses of GuidToString.
This commit is contained in:
@ -103,8 +103,8 @@ std::wstring pyGameCli::GameTypeID() const
|
|||||||
{
|
{
|
||||||
if (gameClient)
|
if (gameClient)
|
||||||
{
|
{
|
||||||
wchar_t guidStr[256];
|
wchar_t guidStr[64];
|
||||||
GuidToString(gameClient->GetGameTypeId(), guidStr, arrsize(guidStr));
|
wcsncpy(guidStr, plUUID(gameClient->GetGameTypeId()).AsString().ToWchar(), 64);
|
||||||
return guidStr;
|
return guidStr;
|
||||||
}
|
}
|
||||||
return L"";
|
return L"";
|
||||||
@ -182,4 +182,4 @@ PyObject* pyGameCli::UpcastToVarSyncGame()
|
|||||||
if (gameClient && (gameClient->GetGameTypeId() == kGameTypeId_VarSync))
|
if (gameClient && (gameClient->GetGameTypeId() == kGameTypeId_VarSync))
|
||||||
return pyVarSyncGame::New(gameClient);
|
return pyVarSyncGame::New(gameClient);
|
||||||
PYTHON_RETURN_NONE;
|
PYTHON_RETURN_NONE;
|
||||||
}
|
}
|
||||||
|
@ -108,8 +108,8 @@ std::wstring pyGameMgrInviteReceivedMsg::GameTypeID() const
|
|||||||
if (message)
|
if (message)
|
||||||
{
|
{
|
||||||
const Srv2Cli_GameMgr_InviteReceived* gmMsg = (const Srv2Cli_GameMgr_InviteReceived*)message->netMsg;
|
const Srv2Cli_GameMgr_InviteReceived* gmMsg = (const Srv2Cli_GameMgr_InviteReceived*)message->netMsg;
|
||||||
wchar_t buffer[256];
|
wchar_t buffer[64];
|
||||||
GuidToString(gmMsg->gameTypeId, buffer, arrsize(buffer));
|
wcsncpy(buffer, plUUID(gmMsg->gameTypeId).AsString().ToWchar(), 64);
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
return L"";
|
return L"";
|
||||||
@ -149,8 +149,8 @@ std::wstring pyGameMgrInviteRevokedMsg::GameTypeID() const
|
|||||||
if (message)
|
if (message)
|
||||||
{
|
{
|
||||||
const Srv2Cli_GameMgr_InviteRevoked* gmMsg = (const Srv2Cli_GameMgr_InviteRevoked*)message->netMsg;
|
const Srv2Cli_GameMgr_InviteRevoked* gmMsg = (const Srv2Cli_GameMgr_InviteRevoked*)message->netMsg;
|
||||||
wchar_t buffer[256];
|
wchar_t buffer[64];
|
||||||
GuidToString(gmMsg->gameTypeId, buffer, arrsize(buffer));
|
wcsncpy(buffer, plUUID(gmMsg->gameTypeId).AsString().ToWchar(), 64);
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
return L"";
|
return L"";
|
||||||
@ -164,4 +164,4 @@ unsigned long pyGameMgrInviteRevokedMsg::NewGameID() const
|
|||||||
return gmMsg->newGameId;
|
return gmMsg->newGameId;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -82,7 +82,7 @@ public:
|
|||||||
|
|
||||||
static void AddPlasmaClasses(PyObject *m);
|
static void AddPlasmaClasses(PyObject *m);
|
||||||
|
|
||||||
plUUID GetAgeGuid( void );
|
plUUID GetAgeGuid(void);
|
||||||
|
|
||||||
PyObject * GetAgeSDL() const; // returns pySDLStateDataRecord
|
PyObject * GetAgeSDL() const; // returns pySDLStateDataRecord
|
||||||
void UpdateAgeSDL( pySDLStateDataRecord & pyrec );
|
void UpdateAgeSDL( pySDLStateDataRecord & pyrec );
|
||||||
|
@ -74,7 +74,7 @@ public:
|
|||||||
// name of current age
|
// name of current age
|
||||||
const char * GetAgeName( void ) const;
|
const char * GetAgeName( void ) const;
|
||||||
// unique identifier for this age instance
|
// unique identifier for this age instance
|
||||||
plUUID GetAgeGuid( void ) const;
|
plUUID GetAgeGuid(void) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -234,7 +234,8 @@ const char * pyVaultAgeInfoNode::GetAgeInstanceGuid() const
|
|||||||
|
|
||||||
if (fNode) {
|
if (fNode) {
|
||||||
VaultAgeInfoNode access(fNode);
|
VaultAgeInfoNode access(fNode);
|
||||||
GuidToString(access.ageInstUuid, fAgeInstGuid, arrsize(fAgeInstGuid));
|
|
||||||
|
strncpy(fAgeInstGuid, plUUID(access.ageInstUuid).AsString().c_str(), 64);
|
||||||
}
|
}
|
||||||
return fAgeInstGuid;
|
return fAgeInstGuid;
|
||||||
}
|
}
|
||||||
|
@ -94,7 +94,7 @@ const char * pyVaultMarkerGameNode::GetGameGuid () const
|
|||||||
|
|
||||||
if (fNode) {
|
if (fNode) {
|
||||||
VaultMarkerGameNode access(fNode);
|
VaultMarkerGameNode access(fNode);
|
||||||
GuidToString(access.gameGuid, fGameGuid, arrsize(fGameGuid));
|
strncpy(fGameGuid, plUUID(access.gameGuid).AsString().c_str(), 64);
|
||||||
}
|
}
|
||||||
return fGameGuid;
|
return fGameGuid;
|
||||||
}
|
}
|
||||||
|
@ -332,7 +332,7 @@ const char * pyVaultNode::GetCreateAgeGuid( void )
|
|||||||
|
|
||||||
if (fNode) {
|
if (fNode) {
|
||||||
fCreateAgeGuid = (char*)malloc(64);
|
fCreateAgeGuid = (char*)malloc(64);
|
||||||
GuidToString(fNode->createAgeUuid, fCreateAgeGuid, 64);
|
strncpy(fCreateAgeGuid, plUUID(fNode->createAgeUuid).AsString().c_str(), 64);
|
||||||
}
|
}
|
||||||
|
|
||||||
return fCreateAgeGuid;
|
return fCreateAgeGuid;
|
||||||
|
@ -164,7 +164,8 @@ const char * pyVaultPlayerInfoNode::Player_GetAgeGuid( void )
|
|||||||
return "";
|
return "";
|
||||||
|
|
||||||
VaultPlayerInfoNode playerInfo(fNode);
|
VaultPlayerInfoNode playerInfo(fNode);
|
||||||
GuidToString(playerInfo.ageInstUuid, ansiAgeInstUuid, arrsize(ansiAgeInstUuid));
|
|
||||||
|
strncpy(ansiAgeInstUuid, plUUID(playerInfo.ageInstUuid).AsString().c_str(), 64);
|
||||||
return ansiAgeInstUuid;
|
return ansiAgeInstUuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ class pyVaultPlayerInfoNode : public pyVaultNode
|
|||||||
{
|
{
|
||||||
mutable char * ansiPlayerName;
|
mutable char * ansiPlayerName;
|
||||||
mutable char * ansiAgeInstName;
|
mutable char * ansiAgeInstName;
|
||||||
mutable char ansiAgeInstUuid[256];
|
mutable char ansiAgeInstUuid[64];
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// should only be created from C++ side
|
// should only be created from C++ side
|
||||||
|
@ -7,10 +7,12 @@ set(pnUUID_SOURCES
|
|||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
set(pnUUID_SOURCES ${pnUUID_SOURCES} pnUUID_Win32.cpp)
|
set(pnUUID_SOURCES ${pnUUID_SOURCES} pnUUID_Win32.cpp)
|
||||||
else(WIN32)
|
|
||||||
set(pnUUID_SOURCES ${pnUUID_SOURCES} pnUUID_Unix.cpp)
|
|
||||||
endif(WIN32)
|
endif(WIN32)
|
||||||
|
|
||||||
|
if(UNIX)
|
||||||
|
set(pnUUID_SOURCES ${pnUUID_SOURCES} pnUUID_Unix.cpp)
|
||||||
|
endif(UNIX)
|
||||||
|
|
||||||
set(pnUUID_HEADERS
|
set(pnUUID_HEADERS
|
||||||
pnUUID.h
|
pnUUID.h
|
||||||
)
|
)
|
||||||
|
@ -47,12 +47,7 @@ plUUID::plUUID()
|
|||||||
Clear();
|
Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
plUUID::plUUID(const plString & s)
|
plUUID::plUUID(const plString& s)
|
||||||
{
|
|
||||||
FromString(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
plUUID::plUUID(const char * s)
|
|
||||||
{
|
{
|
||||||
FromString(s.c_str());
|
FromString(s.c_str());
|
||||||
}
|
}
|
||||||
@ -67,13 +62,13 @@ plUUID::plUUID(const Uuid& uuid)
|
|||||||
memcpy(fData, uuid.data, sizeof(fData));
|
memcpy(fData, uuid.data, sizeof(fData));
|
||||||
}
|
}
|
||||||
|
|
||||||
void plUUID::Read(hsStream * s)
|
void plUUID::Read(hsStream* s)
|
||||||
{
|
{
|
||||||
s->LogSubStreamPushDesc("plUUID");
|
s->LogSubStreamPushDesc("plUUID");
|
||||||
s->Read(sizeof(fData), (void*)fData);
|
s->Read(sizeof(fData), (void*)fData);
|
||||||
}
|
}
|
||||||
|
|
||||||
void plUUID::Write(hsStream * s)
|
void plUUID::Write(hsStream* s)
|
||||||
{
|
{
|
||||||
s->Write(sizeof(fData), (const void*)fData);
|
s->Write(sizeof(fData), (const void*)fData);
|
||||||
}
|
}
|
||||||
|
@ -126,12 +126,4 @@ plUUID plUUID::Generate()
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
// dummy function to prevent a linker warning complaining about no public symbols if the
|
|
||||||
// contents of the file get compiled out via pre-processor
|
|
||||||
void _preventLNK4221WarningStub()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -57,7 +57,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
|||||||
|
|
||||||
#include <uuid/uuid.h>
|
#include <uuid/uuid.h>
|
||||||
|
|
||||||
COMPILER_ASSERT(sizeof(Uuid) >= sizeof(uuid_t));
|
static_assert(sizeof(Uuid) >= sizeof(uuid_t), "UUID size does not match uuid_t");
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
@ -147,30 +147,4 @@ bool GuidIsNil (const Uuid & uuid) {
|
|||||||
return 1 == UuidIsNil((GUID *)&uuid, &s );
|
return 1 == UuidIsNil((GUID *)&uuid, &s );
|
||||||
}
|
}
|
||||||
|
|
||||||
//============================================================================
|
|
||||||
const wchar_t * GuidToString (const Uuid & uuid, wchar_t * dst, unsigned chars) {
|
|
||||||
wchar_t * src;
|
|
||||||
RPC_STATUS s;
|
|
||||||
s = UuidToStringW( (GUID *) &uuid, (unsigned short**)&src );
|
|
||||||
if (RPC_S_OK == s)
|
|
||||||
StrCopy(dst, src, chars);
|
|
||||||
else
|
|
||||||
StrCopy(dst, L"", chars);
|
|
||||||
RpcStringFreeW( (unsigned short**)&src );
|
|
||||||
return dst;
|
|
||||||
}
|
|
||||||
|
|
||||||
//============================================================================
|
|
||||||
const char * GuidToString (const Uuid & uuid, char * dst, unsigned chars) {
|
|
||||||
uint8_t * src;
|
|
||||||
RPC_STATUS s;
|
|
||||||
s = UuidToStringA( (GUID *) &uuid, &src );
|
|
||||||
if (RPC_S_OK == s)
|
|
||||||
StrCopy(dst, (char *)src, chars);
|
|
||||||
else
|
|
||||||
StrCopy(dst, "", chars);
|
|
||||||
RpcStringFreeA(&src);
|
|
||||||
return dst;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // HS_BUILD_FOR_WIN32
|
#endif // HS_BUILD_FOR_WIN32
|
||||||
|
@ -64,17 +64,3 @@ Uuid::Uuid (const wchar_t str[]) {
|
|||||||
|
|
||||||
GuidFromString(str, this);
|
GuidFromString(str, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
//============================================================================
|
|
||||||
Uuid::Uuid (const uint8_t buf[], unsigned length) {
|
|
||||||
|
|
||||||
GuidFromHex(buf, length, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
//============================================================================
|
|
||||||
bool GuidFromHex (const uint8_t buf[], unsigned length, Uuid * uuid) {
|
|
||||||
|
|
||||||
ASSERT(length == sizeof(uuid->data));
|
|
||||||
memcpy(uuid->data, buf, sizeof(uuid->data));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
@ -80,9 +80,6 @@ bool GuidFromString (const char str[], Uuid * uuid);
|
|||||||
int GuidCompare (const Uuid & a, const Uuid & b);
|
int GuidCompare (const Uuid & a, const Uuid & b);
|
||||||
inline bool GuidsAreEqual (const Uuid & a, const Uuid & b) { return 0 == GuidCompare(a, b); }
|
inline bool GuidsAreEqual (const Uuid & a, const Uuid & b) { return 0 == GuidCompare(a, b); }
|
||||||
bool GuidIsNil (const Uuid & uuid);
|
bool GuidIsNil (const Uuid & uuid);
|
||||||
const wchar_t * GuidToString (const Uuid & uuid, wchar_t * dst, unsigned chars); // returns dst
|
|
||||||
const char * GuidToString (const Uuid & uuid, char * dst, unsigned chars); // returns dst
|
|
||||||
bool GuidFromHex (const uint8_t buf[], unsigned length, Uuid * uuid);
|
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
@ -100,7 +97,6 @@ struct Uuid {
|
|||||||
|
|
||||||
Uuid () {}
|
Uuid () {}
|
||||||
Uuid (const wchar_t str[]);
|
Uuid (const wchar_t str[]);
|
||||||
Uuid (const uint8_t buf[], unsigned length);
|
|
||||||
operator bool () const { return !GuidIsNil(*this); }
|
operator bool () const { return !GuidIsNil(*this); }
|
||||||
inline bool operator ! () const { return GuidIsNil(*this); }
|
inline bool operator ! () const { return GuidIsNil(*this); }
|
||||||
inline bool operator < (const Uuid & rhs) const { return GuidCompare(*this, rhs) < 0; }
|
inline bool operator < (const Uuid & rhs) const { return GuidCompare(*this, rhs) < 0; }
|
||||||
|
@ -596,14 +596,17 @@ static void INetCliAuthAgeRequestCallback (
|
|||||||
if (!IS_NET_ERROR(result) || result == kNetErrVaultNodeNotFound) {
|
if (!IS_NET_ERROR(result) || result == kNetErrVaultNodeNotFound) {
|
||||||
s_age.ageInstId = ageInstId;
|
s_age.ageInstId = ageInstId;
|
||||||
s_age.ageVaultId = ageVaultId;
|
s_age.ageVaultId = ageVaultId;
|
||||||
|
|
||||||
wchar_t ageInstIdStr[64];
|
plString gameAddrStr = gameAddr.GetHostString();
|
||||||
|
plString ageInstIdStr = plUUID(ageInstId).AsString();
|
||||||
|
|
||||||
LogMsg(
|
LogMsg(
|
||||||
kLogPerf,
|
kLogPerf,
|
||||||
L"Connecting to game server %s, ageInstId %s",
|
L"Connecting to game server %s, ageInstId %s",
|
||||||
gameAddr.GetHostString().ToWchar().GetData(),
|
gameAddrStr.c_str(),
|
||||||
GuidToString(ageInstId, ageInstIdStr, arrsize(ageInstIdStr))
|
ageInstIdStr.c_str()
|
||||||
);
|
);
|
||||||
|
|
||||||
NetCliGameDisconnect();
|
NetCliGameDisconnect();
|
||||||
NetCliGameStartConnect(gameAddr.GetHost());
|
NetCliGameStartConnect(gameAddr.GetHost());
|
||||||
NetCliGameJoinAgeRequest(
|
NetCliGameJoinAgeRequest(
|
||||||
|
@ -369,9 +369,9 @@ void VaultTextNoteNode::SetVisitInfo (const plAgeInfoStruct & info) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case kAgeInstGuid: {
|
case kAgeInstGuid: {
|
||||||
Uuid guid = (Uuid)*info.GetAgeInstanceGuid();
|
plUUID guid = (plUUID)*info.GetAgeInstanceGuid();
|
||||||
wchar_t src[64];
|
wchar_t src[64];
|
||||||
GuidToString(guid, src, arrsize(src));
|
wcsncpy(src, guid.AsString().ToWchar(), 64);
|
||||||
unsigned len = StrLen(src);
|
unsigned len = StrLen(src);
|
||||||
wchar_t * dst = buf.New(len);
|
wchar_t * dst = buf.New(len);
|
||||||
memcpy(dst, src, len * sizeof(src[0]));
|
memcpy(dst, src, len * sizeof(src[0]));
|
||||||
|
Reference in New Issue
Block a user