diff options
Diffstat (limited to 'src/NetUtils.cpp')
-rw-r--r-- | src/NetUtils.cpp | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/src/NetUtils.cpp b/src/NetUtils.cpp index 9cf88c7..4f5fce8 100644 --- a/src/NetUtils.cpp +++ b/src/NetUtils.cpp @@ -44,12 +44,23 @@ namespace QuickMedia { index += 2; size_t end_index = str.find(';', index); if(end_index != std::string::npos && end_index - index <= 3) { - const size_t num_length = end_index - index; - int num; - if(to_num(str.c_str() + index, num_length, num)) { - const char num_c = (char)num; - str.replace(index - 2, 2 + num_length + 1, &num_c, 1); - index += (-2 + 1); + if(str[index] == 'x') { + ++index; + const size_t num_length = end_index - index; + int num; + if(to_num_hex(str.c_str() + index, num_length, num)) { + const char num_c = (char)num; + str.replace(index - 3, 3 + num_length + 1, &num_c, 1); + index += (-3 + 1); + } + } else { + const size_t num_length = end_index - index; + int num; + if(to_num(str.c_str() + index, num_length, num)) { + const char num_c = (char)num; + str.replace(index - 2, 2 + num_length + 1, &num_c, 1); + index += (-2 + 1); + } } } } |