libc/Android.bp: more cleanup.
These files were segregated because they were lacking a little cleanup.
Unfortunately that means this change has to do some of the cleanup, but
that's probably for the best.
Test: treehugger
Change-Id: I2dd33504787fc3313995de99e0745a0df22915b3
diff --git a/libc/stdio/vfwscanf.cpp b/libc/stdio/vfwscanf.cpp
index 3df4a87..21d1783 100644
--- a/libc/stdio/vfwscanf.cpp
+++ b/libc/stdio/vfwscanf.cpp
@@ -32,6 +32,7 @@
*/
#include "scanf_common.h"
+
// An interpretive version of __sccl from vfscanf.c --- a table of all wchar_t values would
// be a little too expensive, and some kind of compressed version isn't worth the trouble.
static inline bool in_ccl(wchar_t wc, const wchar_t* ccl) {
@@ -335,7 +336,7 @@
if (!(flags & SUPPRESS)) p = va_arg(ap, wchar_t*);
n = 0;
while (width-- != 0 && (wi = __fgetwc_unlock(fp)) != WEOF) {
- if (!(flags & SUPPRESS)) *p++ = (wchar_t)wi;
+ if (!(flags & SUPPRESS)) *p++ = static_cast<wchar_t>(wi);
n++;
}
if (n == 0) goto input_failure;
@@ -348,10 +349,10 @@
while (width != 0 && (wi = __fgetwc_unlock(fp)) != WEOF) {
if (width >= MB_CUR_MAX && !(flags & SUPPRESS)) {
nconv = wcrtomb(mbp, wi, &mbs);
- if (nconv == (size_t)-1) goto input_failure;
+ if (nconv == static_cast<size_t>(-1)) goto input_failure;
} else {
nconv = wcrtomb(mbbuf, wi, &mbs);
- if (nconv == (size_t)-1) goto input_failure;
+ if (nconv == static_cast<size_t>(-1)) goto input_failure;
if (nconv > width) {
__ungetwc(wi, fp);
break;
@@ -373,7 +374,7 @@
case CT_STRING:
// CT_CCL: scan a (nonempty) character class (sets NOSKIP).
// CT_STRING: like CCL, but zero-length string OK, & no NOSKIP.
- if (width == 0) width = (size_t)~0; // 'infinity'.
+ if (width == 0) width = SIZE_MAX; // 'infinity'.
if ((flags & SUPPRESS) && (flags & LONG)) {
n = 0;
while ((wi = __fgetwc_unlock(fp)) != WEOF && width-- != 0 && ((c == CT_CCL && in_ccl(wi, ccl)) || (c == CT_STRING && !iswspace(wi)))) n++;
@@ -381,7 +382,7 @@
} else if (flags & LONG) {
p0 = p = va_arg(ap, wchar_t*);
while ((wi = __fgetwc_unlock(fp)) != WEOF && width-- != 0 && ((c == CT_CCL && in_ccl(wi, ccl)) || (c == CT_STRING && !iswspace(wi)))) {
- *p++ = (wchar_t)wi;
+ *p++ = static_cast<wchar_t>(wi);
}
if (wi != WEOF) __ungetwc(wi, fp);
n = p - p0;
@@ -392,10 +393,10 @@
while ((wi = __fgetwc_unlock(fp)) != WEOF && width != 0 && ((c == CT_CCL && in_ccl(wi, ccl)) || (c == CT_STRING && !iswspace(wi)))) {
if (width >= MB_CUR_MAX && !(flags & SUPPRESS)) {
nconv = wcrtomb(mbp, wi, &mbs);
- if (nconv == (size_t)-1) goto input_failure;
+ if (nconv == static_cast<size_t>(-1)) goto input_failure;
} else {
nconv = wcrtomb(mbbuf, wi, &mbs);
- if (nconv == (size_t)-1) goto input_failure;
+ if (nconv == static_cast<size_t>(-1)) goto input_failure;
if (nconv > width) break;
if (!(flags & SUPPRESS)) memcpy(mbp, mbbuf, nconv);
}
@@ -485,7 +486,7 @@
case 'e':
case 'f':
if (base == 0) base = 10;
- if (base != 16 && (int)(c - '0') >= base) break; /* not legal here */
+ if (base != 16 && static_cast<int>(c - '0') >= base) break; /* not legal here */
flags &= ~(SIGNOK | PFBOK | PFXOK | NDIGITS);
goto ok;
@@ -523,7 +524,7 @@
/*
* c is legal: store it and look at the next.
*/
- *p++ = (wchar_t)c;
+ *p++ = static_cast<wchar_t>(c);
}
/*
* If we had only a sign, it is no good; push back the sign.
@@ -548,7 +549,7 @@
else
res = wcstoumax(buf, NULL, base);
if (flags & POINTER)
- *va_arg(ap, void**) = (void*)(uintptr_t)res;
+ *va_arg(ap, void**) = reinterpret_cast<void*>(res);
else if (flags & MAXINT)
*va_arg(ap, intmax_t*) = res;
else if (flags & LLONG)
@@ -587,7 +588,7 @@
float res = wcstof(buf, &p);
*va_arg(ap, float*) = res;
}
- if (p - buf != (ptrdiff_t)width) abort();
+ if (static_cast<size_t>(p - buf) != width) abort();
nassigned++;
}
nread += width;