aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/UniConversion.cxx
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2025-04-03 10:07:20 +1100
committerNeil <nyamatongwe@gmail.com>2025-04-03 10:07:20 +1100
commitedb7369a2c6a19393dc413a9595a234969fc2731 (patch)
tree1dd7de2ad759c58d48606bd8a204503944feec12 /src/UniConversion.cxx
parentf40a7ce87a20e830a4959e33238d2caadef0ea04 (diff)
downloadscintilla-mirror-edb7369a2c6a19393dc413a9595a234969fc2731.tar.gz
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.
Diffstat (limited to 'src/UniConversion.cxx')
-rw-r--r--src/UniConversion.cxx6
1 files changed, 6 insertions, 0 deletions
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<const unsigned char *>(s), len);
}