summaryrefslogtreecommitdiffstats
path: root/src/corelib/plugin
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2014-11-18 13:46:21 -0800
committerThiago Macieira <thiago.macieira@intel.com>2014-12-13 05:10:20 +0100
commitcfe12f716b0e138b51e3d8f5e481c4d9624459dc (patch)
tree26232a23b4985ba8984a139e03ac30403a38089d /src/corelib/plugin
parent0bc6c4f7ecfa332de57500fe722872eff4009b9b (diff)
Merge the different implementations of toHex in one central place
It's a simple enough function, but we don't need to duplicate those 17 bytes all over the place. Now they'll be duplicated at most once per library. Change-Id: Ic995e2a934b005e7e996e70f2ee644bfa948eb38 Reviewed-by: Jason McDonald <macadder1@gmail.com>
Diffstat (limited to 'src/corelib/plugin')
-rw-r--r--src/corelib/plugin/quuid.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/corelib/plugin/quuid.cpp b/src/corelib/plugin/quuid.cpp
index 4a5f4e791d..f7c569f123 100644
--- a/src/corelib/plugin/quuid.cpp
+++ b/src/corelib/plugin/quuid.cpp
@@ -36,14 +36,13 @@
#include "qdatastream.h"
#include "qendian.h"
#include "qdebug.h"
+#include "private/qtools_p.h"
#ifndef QT_BOOTSTRAPPED
#include "qcryptographichash.h"
#endif
QT_BEGIN_NAMESPACE
-static const char digits[] = "0123456789abcdef";
-
template <class Char, class Integral>
void _q_toHex(Char *&dst, Integral value)
{
@@ -52,10 +51,8 @@ void _q_toHex(Char *&dst, Integral value)
const char* p = reinterpret_cast<const char*>(&value);
for (uint i = 0; i < sizeof(Integral); ++i, dst += 2) {
- uint j = (p[i] >> 4) & 0xf;
- dst[0] = Char(digits[j]);
- j = p[i] & 0xf;
- dst[1] = Char(digits[j]);
+ dst[0] = Char(QtMiscUtils::toHexLower((p[i] >> 4) & 0xf));
+ dst[1] = Char(QtMiscUtils::toHexLower(p[i] & 0xf));
}
}