aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Support
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2010-08-26 14:21:08 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2010-08-26 14:21:08 +0000
commit0043e35b8261af607d6cf0695b79b1d6584e67ac (patch)
tree2e88df1ae7791f609935964c877098903298034d /lib/Support
parent01b1e1c958d50b79acdf90824f36f7cb8a5be884 (diff)
downloadexternal_llvm-0043e35b8261af607d6cf0695b79b1d6584e67ac.zip
external_llvm-0043e35b8261af607d6cf0695b79b1d6584e67ac.tar.gz
external_llvm-0043e35b8261af607d6cf0695b79b1d6584e67ac.tar.bz2
Do unsigned char comparisons in StringRef::compare_lower to be more consistent with compare in corner cases.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112185 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support')
-rw-r--r--lib/Support/StringRef.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/Support/StringRef.cpp b/lib/Support/StringRef.cpp
index 40b732c..c33ca6a 100644
--- a/lib/Support/StringRef.cpp
+++ b/lib/Support/StringRef.cpp
@@ -31,14 +31,14 @@ static bool ascii_isdigit(char x) {
/// compare_lower - Compare strings, ignoring case.
int StringRef::compare_lower(StringRef RHS) const {
for (size_t I = 0, E = min(Length, RHS.Length); I != E; ++I) {
- char LHC = ascii_tolower(Data[I]);
- char RHC = ascii_tolower(RHS.Data[I]);
+ unsigned char LHC = ascii_tolower(Data[I]);
+ unsigned char RHC = ascii_tolower(RHS.Data[I]);
if (LHC != RHC)
return LHC < RHC ? -1 : 1;
}
if (Length == RHS.Length)
- return 0;
+ return 0;
return Length < RHS.Length ? -1 : 1;
}
@@ -62,7 +62,7 @@ int StringRef::compare_numeric(StringRef RHS) const {
return Data[I] < RHS.Data[I] ? -1 : 1;
}
if (Length == RHS.Length)
- return 0;
+ return 0;
return Length < RHS.Length ? -1 : 1;
}