diff options
author | Michael Jones <michaelrj@google.com> | 2021-01-13 21:36:05 +0000 |
---|---|---|
committer | Michael Jones <michaelrj@google.com> | 2021-01-13 22:06:56 +0000 |
commit | ea8034ec35a9e3d6784d7e6f50617af3d87f6a9f (patch) | |
tree | ee62b1ee9102f3dc4c060966d0f0aa5c9941e60d | |
parent | 6077d55381a6aa3e947ef7abdc36a7515c598c8a (diff) | |
download | llvm-ea8034ec35a9e3d6784d7e6f50617af3d87f6a9f.tar.gz |
[libc][NFC] change isblank and iscntrl from implicit casting
isblank and iscntrl were casting an int to a char implicitly and this
was throwing errors under Fuchsia. I've added a static cast to resolve
this issue.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D94634
-rw-r--r-- | libc/src/ctype/isblank.cpp | 2 | ||||
-rw-r--r-- | libc/src/ctype/iscntrl.cpp | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/libc/src/ctype/isblank.cpp b/libc/src/ctype/isblank.cpp index b29d19aef2f1..1c3061379b29 100644 --- a/libc/src/ctype/isblank.cpp +++ b/libc/src/ctype/isblank.cpp @@ -15,7 +15,7 @@ namespace __llvm_libc { // TODO: Currently restricted to default locale. // These should be extended using locale information. LLVM_LIBC_FUNCTION(int, isblank, (int c)) { - const unsigned char ch = c; + const unsigned char ch = static_cast<char>(c); return ch == ' ' || ch == '\t'; } diff --git a/libc/src/ctype/iscntrl.cpp b/libc/src/ctype/iscntrl.cpp index 8962bcae0a84..b061199c47ec 100644 --- a/libc/src/ctype/iscntrl.cpp +++ b/libc/src/ctype/iscntrl.cpp @@ -15,7 +15,7 @@ namespace __llvm_libc { // TODO: Currently restricted to default locale. // These should be extended using locale information. LLVM_LIBC_FUNCTION(int, iscntrl, (int c)) { - const unsigned char ch = c; + const unsigned char ch = static_cast<char>(c); return ch < 0x20 || ch == 0x7f; } |