summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qbytearray.cpp
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2014-11-18 14:19:09 -0800
committerThiago Macieira <thiago.macieira@intel.com>2014-12-13 05:10:28 +0100
commitef89efe137b7c32f4700d259e593bb35c7c264e2 (patch)
tree018532ee0b10b669128401f2e4f15efa7de1899e /src/corelib/tools/qbytearray.cpp
parentcfe12f716b0e138b51e3d8f5e481c4d9624459dc (diff)
Merge the multiple implementations of fromHex too
Change-Id: I8c22f784207dd8bffb88e70ac3c867abf0af86af Reviewed-by: Jason McDonald <macadder1@gmail.com>
Diffstat (limited to 'src/corelib/tools/qbytearray.cpp')
-rw-r--r--src/corelib/tools/qbytearray.cpp12
1 files changed, 3 insertions, 9 deletions
diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp
index bf29ebcd6d..92c2188caa 100644
--- a/src/corelib/tools/qbytearray.cpp
+++ b/src/corelib/tools/qbytearray.cpp
@@ -4125,15 +4125,9 @@ QByteArray QByteArray::fromHex(const QByteArray &hexEncoded)
bool odd_digit = true;
for (int i = hexEncoded.size() - 1; i >= 0; --i) {
- int ch = hexEncoded.at(i);
- int tmp;
- if (ch >= '0' && ch <= '9')
- tmp = ch - '0';
- else if (ch >= 'a' && ch <= 'f')
- tmp = ch - 'a' + 10;
- else if (ch >= 'A' && ch <= 'F')
- tmp = ch - 'A' + 10;
- else
+ uchar ch = uchar(hexEncoded.at(i));
+ int tmp = QtMiscUtils::fromHex(ch);
+ if (tmp == -1)
continue;
if (odd_digit) {
--result;