diff options
author | Guy Benyei <guy.benyei@intel.com> | 2013-02-12 21:21:59 +0000 |
---|---|---|
committer | Guy Benyei <guy.benyei@intel.com> | 2013-02-12 21:21:59 +0000 |
commit | 87d0b9ed1462705dd9bf1cb7f67d0bf03af776c8 (patch) | |
tree | 54c1b122b1f937a363b1ce4a1e091e795d575785 /lib/Support | |
parent | 5f3c4a39109479e81238ce28e91e5dcc565f068c (diff) |
Add static cast to unsigned char whenever a character classification function is called with a signed char argument, in order to avoid assertions in Windows Debug configuration.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175006 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support')
-rw-r--r-- | lib/Support/FileUtilities.cpp | 4 | ||||
-rw-r--r-- | lib/Support/PathV2.cpp | 3 | ||||
-rw-r--r-- | lib/Support/Windows/Path.inc | 2 | ||||
-rw-r--r-- | lib/Support/raw_ostream.cpp | 3 |
4 files changed, 7 insertions, 5 deletions
diff --git a/lib/Support/FileUtilities.cpp b/lib/Support/FileUtilities.cpp index fc8a2f31bd..4d7b2391f0 100644 --- a/lib/Support/FileUtilities.cpp +++ b/lib/Support/FileUtilities.cpp @@ -87,9 +87,9 @@ static bool CompareNumbers(const char *&F1P, const char *&F2P, // If one of the positions is at a space and the other isn't, chomp up 'til // the end of the space. - while (isspace(*F1P) && F1P != F1End) + while (isspace(static_cast<unsigned char>(*F1P)) && F1P != F1End) ++F1P; - while (isspace(*F2P) && F2P != F2End) + while (isspace(static_cast<unsigned char>(*F2P)) && F2P != F2End) ++F2P; // If we stop on numbers, compare their difference. diff --git a/lib/Support/PathV2.cpp b/lib/Support/PathV2.cpp index 98d7382b4e..41add96194 100644 --- a/lib/Support/PathV2.cpp +++ b/lib/Support/PathV2.cpp @@ -44,7 +44,8 @@ namespace { #ifdef LLVM_ON_WIN32 // C: - if (path.size() >= 2 && std::isalpha(path[0]) && path[1] == ':') + if (path.size() >= 2 && std::isalpha(static_cast<unsigned char>(path[0])) && + path[1] == ':') return path.substr(0, 2); #endif diff --git a/lib/Support/Windows/Path.inc b/lib/Support/Windows/Path.inc index 98d8a1850b..f4898e619a 100644 --- a/lib/Support/Windows/Path.inc +++ b/lib/Support/Windows/Path.inc @@ -82,7 +82,7 @@ Path::isValid() const { pos = path.rfind(':',len); size_t rootslash = 0; if (pos != std::string::npos) { - if (pos != 1 || !isalpha(path[0]) || len < 3) + if (pos != 1 || !isalpha(static_cast<unsigned char>(path[0])) || len < 3) return false; rootslash = 2; } diff --git a/lib/Support/raw_ostream.cpp b/lib/Support/raw_ostream.cpp index 106864dd05..f71abd3b24 100644 --- a/lib/Support/raw_ostream.cpp +++ b/lib/Support/raw_ostream.cpp @@ -241,7 +241,8 @@ raw_ostream &raw_ostream::operator<<(double N) { if (cs == '+' || cs == '-') { int c1 = buf[len - 2]; int c0 = buf[len - 1]; - if (isdigit(c1) && isdigit(c0)) { + if (isdigit(static_cast<unsigned char>(c1)) && + isdigit(static_cast<unsigned char>(c0))) { // Trim leading '0': "...e+012" -> "...e+12\0" buf[len - 3] = c1; buf[len - 2] = c0; |