aboutsummaryrefslogtreecommitdiffhomepage
path: root/lexlib
diff options
context:
space:
mode:
Diffstat (limited to 'lexlib')
-rw-r--r--lexlib/CharacterSet.cxx8
-rw-r--r--lexlib/CharacterSet.h10
2 files changed, 10 insertions, 8 deletions
diff --git a/lexlib/CharacterSet.cxx b/lexlib/CharacterSet.cxx
index 791177fcc..2a1dabc1c 100644
--- a/lexlib/CharacterSet.cxx
+++ b/lexlib/CharacterSet.cxx
@@ -18,8 +18,8 @@ namespace Scintilla {
int CompareCaseInsensitive(const char *a, const char *b) {
while (*a && *b) {
if (*a != *b) {
- const char upperA = static_cast<char>(MakeUpperCase(*a));
- const char upperB = static_cast<char>(MakeUpperCase(*b));
+ const char upperA = MakeUpperCase(*a);
+ const char upperB = MakeUpperCase(*b);
if (upperA != upperB)
return upperA - upperB;
}
@@ -33,8 +33,8 @@ int CompareCaseInsensitive(const char *a, const char *b) {
int CompareNCaseInsensitive(const char *a, const char *b, size_t len) {
while (*a && *b && len) {
if (*a != *b) {
- const char upperA = static_cast<char>(MakeUpperCase(*a));
- const char upperB = static_cast<char>(MakeUpperCase(*b));
+ const char upperA = MakeUpperCase(*a);
+ const char upperB = MakeUpperCase(*b);
if (upperA != upperB)
return upperA - upperB;
}
diff --git a/lexlib/CharacterSet.h b/lexlib/CharacterSet.h
index be906ceaa..5965f38ca 100644
--- a/lexlib/CharacterSet.h
+++ b/lexlib/CharacterSet.h
@@ -167,16 +167,18 @@ inline bool isoperator(int ch) {
return false;
}
-// Simple case functions for ASCII.
+// Simple case functions for ASCII supersets.
-inline int MakeUpperCase(int ch) {
+template <typename T>
+inline T MakeUpperCase(T ch) {
if (ch < 'a' || ch > 'z')
return ch;
else
- return static_cast<char>(ch - 'a' + 'A');
+ return ch - 'a' + 'A';
}
-inline int MakeLowerCase(int ch) {
+template <typename T>
+inline T MakeLowerCase(T ch) {
if (ch < 'A' || ch > 'Z')
return ch;
else