[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
GitOrigin-RevId: ea8034ec35a9e3d6784d7e6f50617af3d87f6a9f
diff --git a/src/ctype/isblank.cpp b/src/ctype/isblank.cpp
index b29d19a..1c30613 100644
--- a/src/ctype/isblank.cpp
+++ b/src/ctype/isblank.cpp
@@ -15,7 +15,7 @@
// 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/src/ctype/iscntrl.cpp b/src/ctype/iscntrl.cpp
index 8962bca..b061199 100644
--- a/src/ctype/iscntrl.cpp
+++ b/src/ctype/iscntrl.cpp
@@ -15,7 +15,7 @@
// 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;
}