aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/CharacterCategoryMap.cxx6
-rw-r--r--src/DBCS.cxx8
-rw-r--r--src/Document.cxx8
-rw-r--r--src/UniConversion.cxx6
-rw-r--r--win32/ScintillaWin.cxx6
5 files changed, 34 insertions, 0 deletions
diff --git a/src/CharacterCategoryMap.cxx b/src/CharacterCategoryMap.cxx
index 5bf6394ba..10218b3af 100644
--- a/src/CharacterCategoryMap.cxx
+++ b/src/CharacterCategoryMap.cxx
@@ -4072,6 +4072,10 @@ namespace {
enum class OtherID { oidNone, oidStart, oidContinue };
+// Silence 'magic' number warning as these character values are not used in multiple places.
+
+// NOLINTBEGIN(*-magic-numbers)
+
// Some characters are treated as valid for identifiers even
// though most characters from their category are not.
// Values copied from http://www.unicode.org/Public/9.0.0/ucd/PropList.txt
@@ -4161,6 +4165,8 @@ bool OmitXidContinue(int character) noexcept {
}
}
+// NOLINTEND(*-magic-numbers)
+
}
// UAX #31 defines ID_Start as
diff --git a/src/DBCS.cxx b/src/DBCS.cxx
index 0f22a705a..f53b8e9ed 100644
--- a/src/DBCS.cxx
+++ b/src/DBCS.cxx
@@ -16,6 +16,12 @@ using namespace Scintilla::Internal;
namespace Scintilla::Internal {
+// Silence 'magic' number use since the set of DBCS lead and trail bytes differ
+// between encodings and would require many constant declarations that would just
+// obscure the behaviour.
+
+// NOLINTBEGIN(*-magic-numbers)
+
bool DBCSIsLeadByte(int codePage, char ch) noexcept {
// Byte ranges found in Wikipedia articles with relevant search strings in each case
const unsigned char uch = ch;
@@ -91,6 +97,8 @@ bool IsDBCSValidSingleByte(int codePage, int ch) noexcept {
}
}
+// NOLINTEND(*-magic-numbers)
+
using CodePageToFoldMap = std::map<int, FoldMap>;
CodePageToFoldMap cpToFoldMap;
diff --git a/src/Document.cxx b/src/Document.cxx
index 5dd64eed9..ddcf43276 100644
--- a/src/Document.cxx
+++ b/src/Document.cxx
@@ -1109,6 +1109,12 @@ bool SCI_METHOD Document::IsDBCSLeadByte(char ch) const {
return IsDBCSLeadByteNoExcept(ch);
}
+// Silence 'magic' number use since the set of DBCS lead and trail bytes differ
+// between encodings and would require many constant declarations that would just
+// obscure the behaviour.
+
+// NOLINTBEGIN(*-magic-numbers)
+
bool Document::IsDBCSLeadByteNoExcept(char ch) const noexcept {
// Used inside core Scintilla
// Byte ranges found in Wikipedia articles with relevant search strings in each case
@@ -1192,6 +1198,8 @@ unsigned char Document::DBCSMinTrailByte() const noexcept {
}
}
+// NOLINTEND(*-magic-numbers)
+
int Document::DBCSDrawBytes(std::string_view text) const noexcept {
if (text.length() <= 1) {
return static_cast<int>(text.length());
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);
}
diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx
index 5b88b715c..d6ae32736 100644
--- a/win32/ScintillaWin.cxx
+++ b/win32/ScintillaWin.cxx
@@ -1614,6 +1614,10 @@ constexpr bool IsVisualCharacter(wchar_t charCode) noexcept {
namespace Scintilla::Internal {
+// Removing 'magic' numbers here would not help here.
+
+// NOLINTBEGIN(*-magic-numbers)
+
UINT CodePageFromCharSet(CharacterSet characterSet, UINT documentCodePage) noexcept {
if (documentCodePage == CpUtf8) {
return CpUtf8;
@@ -1646,6 +1650,8 @@ UINT CodePageFromCharSet(CharacterSet characterSet, UINT documentCodePage) noexc
return documentCodePage;
}
+// NOLINTEND(*-magic-numbers)
+
}
UINT ScintillaWin::CodePageOfDocument() const noexcept {