From b04d4af057ef507ab081008fe85a8108bbfabe58 Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Thu, 26 Aug 2010 14:21:08 +0000 Subject: Do unsigned char comparisons in StringRef::compare_lower to be more consistent with compare in corner cases. llvm-svn: 112185 --- llvm/lib/Support/StringRef.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'llvm/lib/Support/StringRef.cpp') diff --git a/llvm/lib/Support/StringRef.cpp b/llvm/lib/Support/StringRef.cpp index 40b732c6..c33ca6a 100644 --- a/llvm/lib/Support/StringRef.cpp +++ b/llvm/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; } -- cgit v1.1