Browse Source

Remove all uses of GuidToString.

Darryl Pogue 12 years ago
parent
commit
274812c057
  1. 4
      Sources/Plasma/FeatureLib/pfPython/Games/pyGameCli.cpp
  2. 8
      Sources/Plasma/FeatureLib/pfPython/Games/pyGameMgrMsg.cpp
  3. 2
      Sources/Plasma/FeatureLib/pfPython/pyAgeVault.h
  4. 2
      Sources/Plasma/FeatureLib/pfPython/pyDniInfoSource.h
  5. 3
      Sources/Plasma/FeatureLib/pfPython/pyVaultAgeInfoNode.cpp
  6. 2
      Sources/Plasma/FeatureLib/pfPython/pyVaultMarkerGameNode.cpp
  7. 2
      Sources/Plasma/FeatureLib/pfPython/pyVaultNode.cpp
  8. 3
      Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoNode.cpp
  9. 2
      Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoNode.h
  10. 6
      Sources/Plasma/NucleusLib/pnUUID/CMakeLists.txt
  11. 11
      Sources/Plasma/NucleusLib/pnUUID/pnUUID.cpp
  12. 8
      Sources/Plasma/NucleusLib/pnUUID/pnUUID_Unix.cpp
  13. 2
      Sources/Plasma/NucleusLib/pnUtils/Unix/pnUtUxUuid.cpp
  14. 26
      Sources/Plasma/NucleusLib/pnUtils/Win32/pnUtW32Uuid.cpp
  15. 14
      Sources/Plasma/NucleusLib/pnUtils/pnUtUuid.cpp
  16. 4
      Sources/Plasma/NucleusLib/pnUtils/pnUtUuid.h
  17. 9
      Sources/Plasma/PubUtilLib/plNetClientComm/plNetClientComm.cpp
  18. 4
      Sources/Plasma/PubUtilLib/plVault/plVaultNodeAccess.cpp

4
Sources/Plasma/FeatureLib/pfPython/Games/pyGameCli.cpp

@ -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"";

8
Sources/Plasma/FeatureLib/pfPython/Games/pyGameMgrMsg.cpp

@ -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"";

2
Sources/Plasma/FeatureLib/pfPython/pyAgeVault.h

@ -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 );

2
Sources/Plasma/FeatureLib/pfPython/pyDniInfoSource.h

@ -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;
};

3
Sources/Plasma/FeatureLib/pfPython/pyVaultAgeInfoNode.cpp

@ -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;
}

2
Sources/Plasma/FeatureLib/pfPython/pyVaultMarkerGameNode.cpp

@ -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;
}

2
Sources/Plasma/FeatureLib/pfPython/pyVaultNode.cpp

@ -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;

3
Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoNode.cpp

@ -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;
}

2
Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoNode.h

@ -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

6
Sources/Plasma/NucleusLib/pnUUID/CMakeLists.txt

@ -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
)

11
Sources/Plasma/NucleusLib/pnUUID/pnUUID.cpp

@ -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);
}

8
Sources/Plasma/NucleusLib/pnUUID/pnUUID_Unix.cpp

@ -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

2
Sources/Plasma/NucleusLib/pnUtils/Unix/pnUtUxUuid.cpp

@ -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

26
Sources/Plasma/NucleusLib/pnUtils/Win32/pnUtW32Uuid.cpp

@ -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

14
Sources/Plasma/NucleusLib/pnUtils/pnUtUuid.cpp

@ -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;
}

4
Sources/Plasma/NucleusLib/pnUtils/pnUtUuid.h

@ -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; }

9
Sources/Plasma/PubUtilLib/plNetClientComm/plNetClientComm.cpp

@ -597,13 +597,16 @@ static void INetCliAuthAgeRequestCallback (
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(

4
Sources/Plasma/PubUtilLib/plVault/plVaultNodeAccess.cpp

@ -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]));

Loading…
Cancel
Save