Пример #1
0
const char *uuidstr_to_str(const char *uuid)
{
	uint32_t val;

	if (!uuid)
		return NULL;

	if (strlen(uuid) != 36)
		return NULL;

	if (strncasecmp(uuid + 8, "-0000-1000-8000-00805f9b34fb", 28))
		return "Vendor specific";

	if (sscanf(uuid, "%08x-0000-1000-8000-00805f9b34fb", &val) != 1)
		return NULL;

	return uuid32_to_str(val);
}
Пример #2
0
const char *uuidstr_to_str(const char *uuid)
{
	uint32_t val;
	int i;

	if (!uuid)
		return NULL;

	if (strlen(uuid) != 36)
		return NULL;

	for (i = 0; uuid128_table[i].str; i++) {
		if (strcasecmp(uuid128_table[i].uuid, uuid) == 0)
			return uuid128_table[i].str;
	}

	if (strncasecmp(uuid + 8, "-0000-1000-8000-00805f9b34fb", 28))
		return "Vendor specific";

	if (sscanf(uuid, "%08x-0000-1000-8000-00805f9b34fb", &val) != 1)
		return NULL;

	return uuid32_to_str(val);
}