Removed clang.format changes

This commit is contained in:
Jason 2022-01-10 13:44:58 -08:00
parent 5f739d3e26
commit 76c4651202

View File

@ -69,7 +69,8 @@ namespace uuids
template <typename TChar>
constexpr inline bool is_hex(TChar const ch)
{
return (ch >= static_cast<TChar>('0') && ch <= static_cast<TChar>('9')) ||
return
(ch >= static_cast<TChar>('0') && ch <= static_cast<TChar>('9')) ||
(ch >= static_cast<TChar>('a') && ch <= static_cast<TChar>('f')) ||
(ch >= static_cast<TChar>('A') && ch <= static_cast<TChar>('F'));
}
@ -77,8 +78,7 @@ namespace uuids
template <typename TChar>
constexpr std::basic_string_view<TChar> to_string_view(TChar const * str)
{
if (str)
return str;
if (str) return str;
return {};
}
@ -149,21 +149,16 @@ namespace uuids
{
size_t const bitCount = this->m_byteCount * 8;
process_byte(0x80);
if (this->m_blockByteIndex > 56)
{
while (m_blockByteIndex != 0)
{
if (this->m_blockByteIndex > 56) {
while (m_blockByteIndex != 0) {
process_byte(0);
}
while (m_blockByteIndex < 56)
{
while (m_blockByteIndex < 56) {
process_byte(0);
}
}
else
{
while (m_blockByteIndex < 56)
{
else {
while (m_blockByteIndex < 56) {
process_byte(0);
}
}
@ -217,15 +212,13 @@ namespace uuids
void process_block()
{
uint32_t w[80];
for (size_t i = 0; i < 16; i++)
{
for (size_t i = 0; i < 16; i++) {
w[i] = static_cast<uint32_t>(m_block[i * 4 + 0] << 24);
w[i] |= static_cast<uint32_t>(m_block[i * 4 + 1] << 16);
w[i] |= static_cast<uint32_t>(m_block[i * 4 + 2] << 8);
w[i] |= static_cast<uint32_t>(m_block[i * 4 + 3]);
}
for (size_t i = 16; i < 80; i++)
{
for (size_t i = 16; i < 80; i++) {
w[i] = left_rotate((w[i - 3] ^ w[i - 8] ^ w[i - 14] ^ w[i - 16]), 1);
}
@ -240,23 +233,19 @@ namespace uuids
uint32_t f = 0;
uint32_t k = 0;
if (i < 20)
{
if (i < 20) {
f = (b & c) | (~b & d);
k = 0x5A827999;
}
else if (i < 40)
{
else if (i < 40) {
f = b ^ c ^ d;
k = 0x6ED9EBA1;
}
else if (i < 60)
{
else if (i < 60) {
f = (b & c) | (b & d) | (c & d);
k = 0x8F1BBCDC;
}
else
{
else {
f = b ^ c ^ d;
k = 0xCA62C1D6;
}
@ -422,9 +411,7 @@ namespace uuids
constexpr bool is_nil() const noexcept
{
for (size_t i = 0; i < data.size(); ++i)
if (data[i] != 0)
return false;
for (size_t i = 0; i < data.size(); ++i) if (data[i] != 0) return false;
return true;
}
@ -456,8 +443,7 @@ namespace uuids
for (size_t i = hasBraces; i < str.size() - hasBraces; ++i)
{
if (str[i] == '-')
continue;
if (str[i] == '-') continue;
if (index >= 16 || !detail::is_hex(str[i]))
{
@ -493,8 +479,7 @@ namespace uuids
std::array<uint8_t, 16> data{ { 0 } };
if (str.empty())
return {};
if (str.empty()) return {};
if (str.front() == '{')
hasBraces = 1;
@ -503,8 +488,7 @@ namespace uuids
for (size_t i = hasBraces; i < str.size() - hasBraces; ++i)
{
if (str[i] == '-')
continue;
if (str[i] == '-') continue;
if (index >= 16 || !detail::is_hex(str[i]))
{
@ -638,7 +622,8 @@ namespace uuids
}
std::array<uint8_t, 16> bytes =
{{static_cast<unsigned char>((newId.Data1 >> 24) & 0xFF),
{ {
static_cast<unsigned char>((newId.Data1 >> 24) & 0xFF),
static_cast<unsigned char>((newId.Data1 >> 16) & 0xFF),
static_cast<unsigned char>((newId.Data1 >> 8) & 0xFF),
static_cast<unsigned char>((newId.Data1) & 0xFF),
@ -656,7 +641,8 @@ namespace uuids
newId.Data4[4],
newId.Data4[5],
newId.Data4[6],
newId.Data4[7]}};
newId.Data4[7]
} };
return uuid{ std::begin(bytes), std::end(bytes) };
@ -666,7 +652,8 @@ namespace uuids
uuid_generate(id);
std::array<uint8_t, 16> bytes =
{{id[0],
{ {
id[0],
id[1],
id[2],
id[3],
@ -681,7 +668,8 @@ namespace uuids
id[12],
id[13],
id[14],
id[15]}};
id[15]
} };
return uuid{ std::begin(bytes), std::end(bytes) };
@ -691,7 +679,8 @@ namespace uuids
CFRelease(newId);
std::array<uint8_t, 16> arrbytes =
{{bytes.byte0,
{ {
bytes.byte0,
bytes.byte1,
bytes.byte2,
bytes.byte3,
@ -706,7 +695,8 @@ namespace uuids
bytes.byte12,
bytes.byte13,
bytes.byte14,
bytes.byte15}};
bytes.byte15
} };
return uuid{ std::begin(arrbytes), std::end(arrbytes) };
#else
return uuid{};
@ -721,8 +711,10 @@ namespace uuids
public:
using engine_type = UniformRandomNumberGenerator;
explicit basic_uuid_random_generator(engine_type &gen) : generator(&gen, [](auto) {}) {}
explicit basic_uuid_random_generator(engine_type *gen) : generator(gen, [](auto) {}) {}
explicit basic_uuid_random_generator(engine_type& gen) :
generator(&gen, [](auto) {}) {}
explicit basic_uuid_random_generator(engine_type* gen) :
generator(gen, [](auto) {}) {}
uuid operator()()
{
@ -753,8 +745,7 @@ namespace uuids
public:
explicit uuid_name_generator(uuid const& namespace_uuid) noexcept
: nsuuid(namespace_uuid)
{
}
{}
template <typename StringType>
uuid operator()(StringType const & name)
@ -829,13 +820,11 @@ namespace uuids
#ifdef _WIN32
DWORD len = 0;
auto ret = GetAdaptersInfo(nullptr, &len);
if (ret != ERROR_BUFFER_OVERFLOW)
return false;
if (ret != ERROR_BUFFER_OVERFLOW) return false;
std::vector<unsigned char> buf(len);
auto pips = reinterpret_cast<PIP_ADAPTER_INFO>(&buf.front());
ret = GetAdaptersInfo(pips, &len);
if (ret != ERROR_SUCCESS)
return false;
if (ret != ERROR_SUCCESS) return false;
mac_address addr;
std::copy(pips->Address, pips->Address + 6, std::begin(addr));
device_address = addr;