libc/wchar: Remove the unnecessary cast
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
parent
11e1a8b28b
commit
4c34075d10
|
@ -66,13 +66,13 @@ wint_t btowc(int c)
|
|||
|
||||
b = (char)c;
|
||||
|
||||
retval = mbtowc(&pwc, (FAR const char *)&b, 1);
|
||||
retval = mbtowc(&pwc, &b, 1);
|
||||
|
||||
if (retval != 0 && retval != 1)
|
||||
{
|
||||
return WEOF;
|
||||
}
|
||||
|
||||
return (wint_t)pwc;
|
||||
return pwc;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -68,13 +68,6 @@ size_t mbrtowc(FAR wchar_t *pwc, FAR const char *s,
|
|||
retval = mbtowc(pwc, s, n);
|
||||
}
|
||||
|
||||
if (retval == -1)
|
||||
{
|
||||
return (size_t)(-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
return (size_t)retval;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -69,13 +69,6 @@ size_t wcrtomb(FAR char *s, wchar_t wc, FAR mbstate_t *ps)
|
|||
retval = wctomb(s, wc);
|
||||
}
|
||||
|
||||
if (retval == -1)
|
||||
{
|
||||
return (size_t)(-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
return (size_t)retval;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -63,10 +63,10 @@ int wcscmp(FAR const wchar_t *s1, FAR const wchar_t *s2)
|
|||
{
|
||||
if (*s1++ == 0)
|
||||
{
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return (*s1 - *--s2);
|
||||
return *s1 - *--s2;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -57,6 +57,6 @@ int wctob(wint_t wc)
|
|||
return EOF;
|
||||
}
|
||||
|
||||
return wctomb(pmb, wc) == 1 ? (int)pmb[0] : EOF;
|
||||
return wctomb(pmb, wc) == 1 ? pmb[0] : EOF;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -55,6 +55,6 @@
|
|||
|
||||
FAR wchar_t *wmemcpy(FAR wchar_t *d, FAR const wchar_t *s, size_t n)
|
||||
{
|
||||
return (FAR wchar_t *)memcpy(d, s, n * sizeof(wchar_t));
|
||||
return memcpy(d, s, n * sizeof(wchar_t));
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -54,6 +54,6 @@
|
|||
|
||||
FAR wchar_t *wmemmove(FAR wchar_t *d, FAR const wchar_t *s, size_t n)
|
||||
{
|
||||
return (FAR wchar_t *)memmove(d, s, n * sizeof(wchar_t));
|
||||
return memmove(d, s, n * sizeof(wchar_t));
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -57,7 +57,7 @@ FAR wchar_t *wmemset(FAR wchar_t *s, wchar_t c, size_t n)
|
|||
FAR wchar_t *p;
|
||||
size_t i;
|
||||
|
||||
p = (FAR wchar_t *)s;
|
||||
p = s;
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
*p = c;
|
||||
|
|
Loading…
Reference in New Issue