From 325b60f362b9521663ac888c7df2425ea0cb84bf Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Fri, 15 Oct 2021 08:43:44 +0000 Subject: [PATCH] Restyled by clang-format --- src/lib/dnssd/Constants.h | 28 +++++++++++++++++----------- src/lib/support/tests/TestFold.cpp | 4 ++-- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/src/lib/dnssd/Constants.h b/src/lib/dnssd/Constants.h index 9115f6129dfbd7..2bca806587b5d1 100644 --- a/src/lib/dnssd/Constants.h +++ b/src/lib/dnssd/Constants.h @@ -49,11 +49,14 @@ constexpr size_t kSubTypeCompressedFabricIdMaxLength = 18; // _I<16-hex-dig namespace Operational { -constexpr auto kSubTypeLengths = { kSubTypeCompressedFabricIdMaxLength }; +#define SUBTYPES (std::initializer_list{ kSubTypeCompressedFabricIdMaxLength }) + constexpr size_t kInstanceNameMaxLength = 33; // - in hex (16 + 1 + 16) -constexpr size_t kSubTypeMaxNumber = kSubTypeLengths.size(); -constexpr size_t kSubTypeMaxLength = std::max(kSubTypeLengths); -constexpr size_t kSubTypeTotalLength = chip::Sum(kSubTypeLengths); +constexpr size_t kSubTypeMaxNumber = SUBTYPES.size(); +constexpr size_t kSubTypeMaxLength = std::max(SUBTYPES); +constexpr size_t kSubTypeTotalLength = chip::Sum(SUBTYPES); + +#undef SUBTYPES } // namespace Operational @@ -63,14 +66,17 @@ constexpr size_t kSubTypeTotalLength = chip::Sum(kSubTypeLengths); namespace Commissionable { -constexpr auto kSubTypeLengths = { - kSubTypeShortDiscriminatorMaxLength, kSubTypeLongDiscriminatorMaxLength, kSubTypeVendorMaxLength, - kSubTypeDeviceTypeMaxLength, kSubTypeCommissioningModeMaxLength, kSubTypeAdditionalCommissioningMaxLength -}; +#define SUBTYPES \ + (std::initializer_list{ kSubTypeShortDiscriminatorMaxLength, kSubTypeLongDiscriminatorMaxLength, \ + kSubTypeVendorMaxLength, kSubTypeDeviceTypeMaxLength, kSubTypeCommissioningModeMaxLength, \ + kSubTypeAdditionalCommissioningMaxLength }) + constexpr size_t kInstanceNameMaxLength = 16; // 64-bit random number in hex -constexpr size_t kSubTypeMaxNumber = kSubTypeLengths.size(); -constexpr size_t kSubTypeMaxLength = std::max(kSubTypeLengths); -constexpr size_t kSubTypeTotalLength = chip::Sum(kSubTypeLengths); +constexpr size_t kSubTypeMaxNumber = SUBTYPES.size(); +constexpr size_t kSubTypeMaxLength = std::max(SUBTYPES); +constexpr size_t kSubTypeTotalLength = chip::Sum(SUBTYPES); + +#undef SUBTYPES } // namespace Commissionable diff --git a/src/lib/support/tests/TestFold.cpp b/src/lib/support/tests/TestFold.cpp index 301cb633b073eb..0354ce742869d0 100644 --- a/src/lib/support/tests/TestFold.cpp +++ b/src/lib/support/tests/TestFold.cpp @@ -30,8 +30,8 @@ namespace { void TestFoldMax(nlTestSuite * inSuite, void * inContext) { - using List = std::initializer_list; - using Limits = std::numeric_limits; + using List = std::initializer_list; + using Limits = std::numeric_limits; const auto max = [](int left, int right) { return std::max(left, right); }; // Test empty list