Fix poor performance of hex XML entities

Closes #2245 Closes #2269
This commit is contained in:
dail8859 2016-09-11 12:54:51 -04:00
parent 8e9e8c04cd
commit 27216901d4
1 changed files with 3 additions and 2 deletions

View File

@ -232,8 +232,9 @@ const TCHAR* TiXmlBase::GetEntity( const TCHAR* p, TCHAR* value )
const TCHAR* end = generic_strchr(p+3, TEXT(';')); const TCHAR* end = generic_strchr(p+3, TEXT(';'));
if (end && end - p <= 3 + 4) if (end && end - p <= 3 + 4)
{ {
int val; TCHAR* hexend;
if (generic_sscanf(p+3, TEXT("%x"), &val) == 1) auto val = generic_strtol(p + 3, &hexend, 16);
if (hexend == end)
{ {
*value = static_cast<TCHAR>(val); *value = static_cast<TCHAR>(val);
return end + 1; return end + 1;