//\r
// Add each character to the result\r
//\r
- if (IsHex || (AsciiString[Index] == '0' && (AsciiString[Index + 1] == 'x' || AsciiString[Index + 1] == 'X'))) {\r
+ \r
+ //\r
+ // Skip first two chars only if the string starts with '0x' or '0X'\r
+ //\r
+ if (AsciiString[Index] == '0' && (AsciiString[Index + 1] == 'x' || AsciiString[Index + 1] == 'X')) {\r
+ IsHex = TRUE;\r
+ Index += 2;\r
+ }\r
+ if (IsHex) {\r
//\r
// Convert the hex string.\r
//\r
- for (Index = Index + 2; AsciiString[Index] != '\0'; Index++) {\r
+ for (; AsciiString[Index] != '\0'; Index++) {\r
CurrentChar = AsciiString[Index];\r
if (CurrentChar == ' ') {\r
break;\r