From ea8034ec35a9e3d6784d7e6f50617af3d87f6a9f Mon Sep 17 00:00:00 2001 From: Michael Jones Date: Wed, 13 Jan 2021 21:36:05 +0000 Subject: [PATCH] [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 --- libc/src/ctype/isblank.cpp | 2 +- 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(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(c); return ch < 0x20 || ch == 0x7f; }