summaryrefslogtreecommitdiffstats
path: root/Source/cmUuid.cxx
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2022-05-17 17:10:30 (GMT)
committerBrad King <brad.king@kitware.com>2022-05-24 13:09:43 (GMT)
commit6ff03d463f40176389943100690cf1ca8593d739 (patch)
tree09ad876ecf9d635108df5374f8c0f5ebb4400506 /Source/cmUuid.cxx
parent9409e5c04f0a534b53ce2f0e0a81c5e7e70c38f1 (diff)
downloadCMake-6ff03d463f40176389943100690cf1ca8593d739.zip
CMake-6ff03d463f40176389943100690cf1ca8593d739.tar.gz
CMake-6ff03d463f40176389943100690cf1ca8593d739.tar.bz2
clang-tidy: address `google-readability-casting` lints
At least those involving `static_cast`.
Diffstat (limited to 'Source/cmUuid.cxx')
-rw-r--r--Source/cmUuid.cxx13
1 files changed, 7 insertions, 6 deletions
diff --git a/Source/cmUuid.cxx b/Source/cmUuid.cxx
index dc018b1..6688668 100644
--- a/Source/cmUuid.cxx
+++ b/Source/cmUuid.cxx
@@ -59,7 +59,7 @@ std::string cmUuid::FromDigest(const unsigned char* digest,
memcpy(uuid, digest, 16);
uuid[6] &= 0xF;
- uuid[6] |= byte_t(version << 4);
+ uuid[6] |= static_cast<byte_t>(version << 4);
uuid[8] &= 0x3F;
uuid[8] |= 0x80;
@@ -118,7 +118,8 @@ std::string cmUuid::ByteToHex(unsigned char byte) const
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));
+ char c = (rest < 0xA) ? static_cast<char>('0' + rest)
+ : static_cast<char>('a' + (rest - 0xA));
result.at(1 - i) = c;
}
@@ -143,7 +144,7 @@ bool cmUuid::StringToBinaryImpl(std::string const& input,
return false;
}
- output.push_back(char(c1 << 4 | c2));
+ output.push_back(static_cast<char>(c1 << 4 | c2));
}
return true;
@@ -152,15 +153,15 @@ bool cmUuid::StringToBinaryImpl(std::string const& input,
bool cmUuid::IntFromHexDigit(char input, char& output) const
{
if (input >= '0' && input <= '9') {
- output = char(input - '0');
+ output = static_cast<char>(input - '0');
return true;
}
if (input >= 'a' && input <= 'f') {
- output = char(input - 'a' + 0xA);
+ output = static_cast<char>(input - 'a' + 0xA);
return true;
}
if (input >= 'A' && input <= 'F') {
- output = char(input - 'A' + 0xA);
+ output = static_cast<char>(input - 'A' + 0xA);
return true;
}
return false;