From edb7369a2c6a19393dc413a9595a234969fc2731 Mon Sep 17 00:00:00 2001 From: Neil Date: Thu, 3 Apr 2025 10:07:20 +1100 Subject: Silence 'magic' number clang-tidy warning where there is intense use of literal constants for processing character encodings or similar and where declaring constants would make the code more obscure, not less. --- src/UniConversion.cxx | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/UniConversion.cxx') diff --git a/src/UniConversion.cxx b/src/UniConversion.cxx index 4cf51c2b9..7183018f7 100644 --- a/src/UniConversion.cxx +++ b/src/UniConversion.cxx @@ -326,6 +326,10 @@ const unsigned char UTF8BytesOfLead[256] = { 4, 4, 4, 4, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // F0 - FF }; +// Silence 'magic' number warning as UTF-8 needs to distinguish byte values and byte value ranges. + +// NOLINTBEGIN(*-magic-numbers) + // Return both the width of the first character in the string and a status // saying whether it is valid or invalid. // Most invalid sequences return a width of 1 so are treated as isolated bytes but @@ -403,6 +407,8 @@ int UTF8Classify(const unsigned char *us, size_t len) noexcept { return UTF8MaskInvalid | 1; } +// NOLINTEND(*-magic-numbers) + int UTF8Classify(const char *s, size_t len) noexcept { return UTF8Classify(reinterpret_cast(s), len); } -- cgit v1.2.3