bool nsID::Parse(const char* aIDStr) { /* Optimized for speed */ if (!aIDStr) { return false; } bool expectFormat1 = (aIDStr[0] == '{'); if (expectFormat1) { ++aIDStr; } PARSE_CHARS_TO_NUM(aIDStr, m0, 8); PARSE_HYPHEN(aIDStr); PARSE_CHARS_TO_NUM(aIDStr, m1, 4); PARSE_HYPHEN(aIDStr); PARSE_CHARS_TO_NUM(aIDStr, m2, 4); PARSE_HYPHEN(aIDStr); int i; for (i = 0; i < 2; ++i) { PARSE_CHARS_TO_NUM(aIDStr, m3[i], 2); } PARSE_HYPHEN(aIDStr); while (i < 8) { PARSE_CHARS_TO_NUM(aIDStr, m3[i], 2); i++; } return expectFormat1 ? *aIDStr == '}' : true; }
PRBool nsID::Parse(const char *aIDStr) { /* Optimized for speed */ if(!aIDStr) { return PR_FALSE; } PRBool expectFormat1 = (aIDStr[0] == '{'); if(expectFormat1) aIDStr++; PARSE_CHARS_TO_NUM(aIDStr, m0, 8); PARSE_HYPHEN(aIDStr); PARSE_CHARS_TO_NUM(aIDStr, m1, 4); PARSE_HYPHEN(aIDStr); PARSE_CHARS_TO_NUM(aIDStr, m2, 4); PARSE_HYPHEN(aIDStr); int i; for(i=0; i<2; i++) PARSE_CHARS_TO_NUM(aIDStr, m3[i], 2); PARSE_HYPHEN(aIDStr); while(i < 8) { PARSE_CHARS_TO_NUM(aIDStr, m3[i], 2); i++; } return expectFormat1 ? *aIDStr == '}' : PR_TRUE; }