MCPcopy Create free account
hub / github.com/ddnet/ddnet / ParseUuid

Function ParseUuid

src/engine/shared/uuid_manager.cpp:70–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

68}
69
70int ParseUuid(CUuid *pUuid, const char *pBuffer)
71{
72 if(str_length(pBuffer) + 1 != UUID_MAXSTRSIZE)
73 {
74 return 2;
75 }
76 char aCopy[UUID_MAXSTRSIZE];
77 str_copy(aCopy, pBuffer);
78 // 01234567-9012-4567-9012-456789012345
79 if(aCopy[8] != '-' || aCopy[13] != '-' || aCopy[18] != '-' || aCopy[23] != '-')
80 {
81 return 1;
82 }
83 aCopy[8] = aCopy[13] = aCopy[18] = aCopy[23] = 0;
84 if(static_cast<bool>(str_hex_decode(pUuid->m_aData + 0, 4, aCopy + 0)) ||
85 str_hex_decode(pUuid->m_aData + 4, 2, aCopy + 9) ||
86 str_hex_decode(pUuid->m_aData + 6, 2, aCopy + 14) ||
87 str_hex_decode(pUuid->m_aData + 8, 2, aCopy + 19) ||
88 str_hex_decode(pUuid->m_aData + 10, 6, aCopy + 24))
89 {
90 return 1;
91 }
92 return 0;
93}
94
95bool CUuid::operator==(const CUuid &Other) const
96{

Callers 2

LoadTeamMethod · 0.85
TESTFunction · 0.85

Calls 3

str_lengthFunction · 0.85
str_hex_decodeFunction · 0.85
str_copyFunction · 0.50

Tested by 1

TESTFunction · 0.68