added support for using hex values in value list

This commit is contained in:
john30
2014-12-26 14:22:52 +01:00
parent 6a46e8cbdb
commit d7a9d505b7
2 changed files with 6 additions and 2 deletions
+5 -1
View File
@@ -211,7 +211,11 @@ result_t DataField::create(vector<string>::iterator& it,
while (getline(stream, token, VALUE_SEPARATOR) != 0) {
const char* str = token.c_str();
char* strEnd = NULL;
unsigned int id = strtoul(str, &strEnd, 10);
unsigned int id;
if (strncasecmp(str, "0x", 2) == 0)
id = strtoul(str+2, &strEnd, 16); // hexadecimal
else
id = strtoul(str, &strEnd, 10); // decimal
if (strEnd == NULL || strEnd == str || *strEnd != '=') {
result = RESULT_ERR_INVALID_LIST;
break;