summaryrefslogtreecommitdiff
path: root/Source/cmUuid.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmUuid.cxx')
-rw-r--r--Source/cmUuid.cxx14
1 files changed, 6 insertions, 8 deletions
diff --git a/Source/cmUuid.cxx b/Source/cmUuid.cxx
index 51ecbd180..cd52b3f30 100644
--- a/Source/cmUuid.cxx
+++ b/Source/cmUuid.cxx
@@ -2,10 +2,10 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmUuid.h"
-#include "cmCryptoHash.h"
-
#include <array>
-#include <string.h>
+#include <cstring>
+
+#include "cmCryptoHash.h"
static const std::array<int, 5> kUuidGroups = { { 4, 2, 2, 2, 6 } };
@@ -53,7 +53,7 @@ void cmUuid::CreateHashInput(std::vector<unsigned char> const& uuidNamespace,
std::string cmUuid::FromDigest(const unsigned char* digest,
unsigned char version) const
{
- typedef unsigned char byte_t;
+ using byte_t = unsigned char;
byte_t uuid[16] = { 0 };
memcpy(uuid, digest, 16);
@@ -114,14 +114,12 @@ std::string cmUuid::BinaryToString(const unsigned char* input) const
std::string cmUuid::ByteToHex(unsigned char byte) const
{
- std::string result;
+ std::string result(" ");
for (int i = 0; i < 2; ++i) {
unsigned char rest = byte % 16;
byte /= 16;
-
char c = (rest < 0xA) ? char('0' + rest) : char('a' + (rest - 0xA));
-
- result = c + result;
+ result.at(1 - i) = c;
}
return result;