MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / parse_token

Function parse_token

Engine/source/core/util/uuid.cpp:186–220  ·  view source on GitHub ↗

dav_parse_locktoken: Parses string produced from * dav_format_opaquelocktoken back into a xuuid_t * structure. On failure, return DAV_IF_ERROR_PARSE, * else DAV_IF_ERROR_NONE. */

Source from the content-addressed store, hash-verified

184 * else DAV_IF_ERROR_NONE.
185 */
186static int parse_token(const char *char_token, xuuid_t *bin_token)
187{
188 int i;
189
190 for (i = 0; i < 36; ++i) {
191 char c = char_token[i];
192 if (!isxdigit(c) &&
193 !(c == '-' && (i == 8 || i == 13 || i == 18 || i == 23)))
194 return -1;
195 }
196 if (char_token[36] != '\0')
197 return -1;
198
199 bin_token->time_low =
200 (dav_parse_hexpair(&char_token[0]) << 24) |
201 (dav_parse_hexpair(&char_token[2]) << 16) |
202 (dav_parse_hexpair(&char_token[4]) << 8) |
203 dav_parse_hexpair(&char_token[6]);
204
205 bin_token->time_mid =
206 (dav_parse_hexpair(&char_token[9]) << 8) |
207 dav_parse_hexpair(&char_token[11]);
208
209 bin_token->time_hi_and_version =
210 (dav_parse_hexpair(&char_token[14]) << 8) |
211 dav_parse_hexpair(&char_token[16]);
212
213 bin_token->clock_seq_hi_and_reserved = dav_parse_hexpair(&char_token[19]);
214 bin_token->clock_seq_low = dav_parse_hexpair(&char_token[21]);
215
216 for (i = 6; i--;)
217 bin_token->node[i] = dav_parse_hexpair(&char_token[i*2+24]);
218
219 return 0;
220}
221
222/* format_uuid_v1 -- make a UUID from the timestamp, clockseq, and node ID */
223static void format_uuid_v1(xuuid_t * uuid, unsigned16 clock_seq,

Callers 1

fromStringMethod · 0.85

Calls 1

dav_parse_hexpairFunction · 0.85

Tested by

no test coverage detected