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)
|
||||
{
|
||||
wchar_t guidStr[256];
|
||||
GuidToString(gameClient->GetGameTypeId(), guidStr, arrsize(guidStr));
|
||||
wchar_t guidStr[64];
|
||||
wcsncpy(guidStr, plUUID(gameClient->GetGameTypeId()).AsString().ToWchar(), 64);
|
||||
return guidStr;
|
||||
}
|
||||
return L"";
|
||||
@ -182,4 +182,4 @@ PyObject* pyGameCli::UpcastToVarSyncGame()
|
||||
if (gameClient && (gameClient->GetGameTypeId() == kGameTypeId_VarSync))
|
||||
return pyVarSyncGame::New(gameClient);
|
||||
PYTHON_RETURN_NONE;
|
||||
}
|
||||
}
|
||||
|
@ -108,8 +108,8 @@ std::wstring pyGameMgrInviteReceivedMsg::GameTypeID() const
|
||||
if (message)
|
||||
{
|
||||
const Srv2Cli_GameMgr_InviteReceived* gmMsg = (const Srv2Cli_GameMgr_InviteReceived*)message->netMsg;
|
||||
wchar_t buffer[256];
|
||||
GuidToString(gmMsg->gameTypeId, buffer, arrsize(buffer));
|
||||
wchar_t buffer[64];
|
||||
wcsncpy(buffer, plUUID(gmMsg->gameTypeId).AsString().ToWchar(), 64);
|
||||
return buffer;
|
||||
}
|
||||
return L"";
|
||||
@ -149,8 +149,8 @@ std::wstring pyGameMgrInviteRevokedMsg::GameTypeID() const
|
||||
if (message)
|
||||
{
|
||||
const Srv2Cli_GameMgr_InviteRevoked* gmMsg = (const Srv2Cli_GameMgr_InviteRevoked*)message->netMsg;
|
||||
wchar_t buffer[256];
|
||||
GuidToString(gmMsg->gameTypeId, buffer, arrsize(buffer));
|
||||
wchar_t buffer[64];
|
||||
wcsncpy(buffer, plUUID(gmMsg->gameTypeId).AsString().ToWchar(), 64);
|
||||
return buffer;
|
||||
}
|
||||
return L"";
|
||||
@ -164,4 +164,4 @@ unsigned long pyGameMgrInviteRevokedMsg::NewGameID() const
|
||||
return gmMsg->newGameId;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ public:
|
||||
|
||||
static void AddPlasmaClasses(PyObject *m);
|
||||
|
||||
plUUID GetAgeGuid( void );
|
||||
plUUID GetAgeGuid(void);
|
||||
|
||||
PyObject * GetAgeSDL() const; // returns pySDLStateDataRecord
|
||||
void UpdateAgeSDL( pySDLStateDataRecord & pyrec );
|
||||
|
@ -74,7 +74,7 @@ public:
|
||||
// name of current age
|
||||
const char * GetAgeName( void ) const;
|
||||
// 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) {
|
||||
VaultAgeInfoNode access(fNode);
|
||||
GuidToString(access.ageInstUuid, fAgeInstGuid, arrsize(fAgeInstGuid));
|
||||
|
||||
strncpy(fAgeInstGuid, plUUID(access.ageInstUuid).AsString().c_str(), 64);
|
||||
}
|
||||
return fAgeInstGuid;
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ const char * pyVaultMarkerGameNode::GetGameGuid () const
|
||||
|
||||
if (fNode) {
|
||||
VaultMarkerGameNode access(fNode);
|
||||
GuidToString(access.gameGuid, fGameGuid, arrsize(fGameGuid));
|
||||
strncpy(fGameGuid, plUUID(access.gameGuid).AsString().c_str(), 64);
|
||||
}
|
||||
return fGameGuid;
|
||||
}
|
||||
|
@ -332,7 +332,7 @@ const char * pyVaultNode::GetCreateAgeGuid( void )
|
||||
|
||||
if (fNode) {
|
||||
fCreateAgeGuid = (char*)malloc(64);
|
||||
GuidToString(fNode->createAgeUuid, fCreateAgeGuid, 64);
|
||||
strncpy(fCreateAgeGuid, plUUID(fNode->createAgeUuid).AsString().c_str(), 64);
|
||||
}
|
||||
|
||||
return fCreateAgeGuid;
|
||||
|
@ -164,7 +164,8 @@ const char * pyVaultPlayerInfoNode::Player_GetAgeGuid( void )
|
||||
return "";
|
||||
|
||||
VaultPlayerInfoNode playerInfo(fNode);
|
||||
GuidToString(playerInfo.ageInstUuid, ansiAgeInstUuid, arrsize(ansiAgeInstUuid));
|
||||
|
||||
strncpy(ansiAgeInstUuid, plUUID(playerInfo.ageInstUuid).AsString().c_str(), 64);
|
||||
return ansiAgeInstUuid;
|
||||
}
|
||||
|
||||
|
@ -55,7 +55,7 @@ class pyVaultPlayerInfoNode : public pyVaultNode
|
||||
{
|
||||
mutable char * ansiPlayerName;
|
||||
mutable char * ansiAgeInstName;
|
||||
mutable char ansiAgeInstUuid[256];
|
||||
mutable char ansiAgeInstUuid[64];
|
||||
|
||||
protected:
|
||||
// should only be created from C++ side
|
||||
|
@ -7,10 +7,12 @@ set(pnUUID_SOURCES
|
||||
|
||||
if(WIN32)
|
||||
set(pnUUID_SOURCES ${pnUUID_SOURCES} pnUUID_Win32.cpp)
|
||||
else(WIN32)
|
||||
set(pnUUID_SOURCES ${pnUUID_SOURCES} pnUUID_Unix.cpp)
|
||||
endif(WIN32)
|
||||
|
||||
if(UNIX)
|
||||
set(pnUUID_SOURCES ${pnUUID_SOURCES} pnUUID_Unix.cpp)
|
||||
endif(UNIX)
|
||||
|
||||
set(pnUUID_HEADERS
|
||||
pnUUID.h
|
||||
)
|
||||
|
@ -47,12 +47,7 @@ plUUID::plUUID()
|
||||
Clear();
|
||||
}
|
||||
|
||||
plUUID::plUUID(const plString & s)
|
||||
{
|
||||
FromString(s);
|
||||
}
|
||||
|
||||
plUUID::plUUID(const char * s)
|
||||
plUUID::plUUID(const plString& s)
|
||||
{
|
||||
FromString(s.c_str());
|
||||
}
|
||||
@ -67,13 +62,13 @@ plUUID::plUUID(const Uuid& uuid)
|
||||
memcpy(fData, uuid.data, sizeof(fData));
|
||||
}
|
||||
|
||||
void plUUID::Read(hsStream * s)
|
||||
void plUUID::Read(hsStream* s)
|
||||
{
|
||||
s->LogSubStreamPushDesc("plUUID");
|
||||
s->Read(sizeof(fData), (void*)fData);
|
||||
}
|
||||
|
||||
void plUUID::Write(hsStream * s)
|
||||
void plUUID::Write(hsStream* s)
|
||||
{
|
||||
s->Write(sizeof(fData), (const void*)fData);
|
||||
}
|
||||
|
@ -126,12 +126,4 @@ plUUID plUUID::Generate()
|
||||
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
|
||||
|
@ -57,7 +57,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
#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
|
||||
|
||||
|
@ -147,30 +147,4 @@ bool GuidIsNil (const Uuid & uuid) {
|
||||
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
|
||||
|
@ -64,17 +64,3 @@ Uuid::Uuid (const wchar_t str[]) {
|
||||
|
||||
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);
|
||||
inline bool GuidsAreEqual (const Uuid & a, const Uuid & b) { return 0 == GuidCompare(a, b); }
|
||||
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 (const wchar_t str[]);
|
||||
Uuid (const uint8_t buf[], unsigned length);
|
||||
operator bool () const { return !GuidIsNil(*this); }
|
||||
inline bool operator ! () const { return GuidIsNil(*this); }
|
||||
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) {
|
||||
s_age.ageInstId = ageInstId;
|
||||
s_age.ageVaultId = ageVaultId;
|
||||
|
||||
wchar_t ageInstIdStr[64];
|
||||
|
||||
plString gameAddrStr = gameAddr.GetHostString();
|
||||
plString ageInstIdStr = plUUID(ageInstId).AsString();
|
||||
|
||||
LogMsg(
|
||||
kLogPerf,
|
||||
L"Connecting to game server %s, ageInstId %s",
|
||||
gameAddr.GetHostString().ToWchar().GetData(),
|
||||
GuidToString(ageInstId, ageInstIdStr, arrsize(ageInstIdStr))
|
||||
gameAddrStr.c_str(),
|
||||
ageInstIdStr.c_str()
|
||||
);
|
||||
|
||||
NetCliGameDisconnect();
|
||||
NetCliGameStartConnect(gameAddr.GetHost());
|
||||
NetCliGameJoinAgeRequest(
|
||||
|
@ -369,9 +369,9 @@ void VaultTextNoteNode::SetVisitInfo (const plAgeInfoStruct & info) {
|
||||
break;
|
||||
|
||||
case kAgeInstGuid: {
|
||||
Uuid guid = (Uuid)*info.GetAgeInstanceGuid();
|
||||
plUUID guid = (plUUID)*info.GetAgeInstanceGuid();
|
||||
wchar_t src[64];
|
||||
GuidToString(guid, src, arrsize(src));
|
||||
wcsncpy(src, guid.AsString().ToWchar(), 64);
|
||||
unsigned len = StrLen(src);
|
||||
wchar_t * dst = buf.New(len);
|
||||
memcpy(dst, src, len * sizeof(src[0]));
|
||||
|
Reference in New Issue
Block a user