am cb1df916: string: Fix wrong comparison semantics

* commit 'cb1df9161666db2a312814752de67fc623149a9b':
  string: Fix wrong comparison semantics
This commit is contained in:
Bruce Beare 2011-12-05 22:12:07 -08:00 committed by Android Git Automerger
commit cb835cd77c
4 changed files with 7 additions and 7 deletions

View File

@ -34,7 +34,7 @@ char *
index(const char *p, int ch)
{
for (;; ++p) {
if (*p == ch)
if (*p == (char) ch)
return((char *)p);
if (!*p)
return((char *)NULL);

View File

@ -35,10 +35,10 @@ void *memrchr(const void *s, int c, size_t n)
const char* q = p + n;
while (1) {
q--; if (q < p || q[0] == c) break;
q--; if (q < p || q[0] == c) break;
q--; if (q < p || q[0] == c) break;
q--; if (q < p || q[0] == c) break;
q--; if (q < p || q[0] == (char) c) break;
q--; if (q < p || q[0] == (char) c) break;
q--; if (q < p || q[0] == (char) c) break;
q--; if (q < p || q[0] == (char) c) break;
}
if (q >= p)
return (void*)q;

View File

@ -34,7 +34,7 @@ char *
strchr(const char *p, int ch)
{
for (;; ++p) {
if (*p == ch)
if (*p == (char) ch)
return((char *)p);
if (!*p)
return((char *)NULL);

View File

@ -36,7 +36,7 @@ strrchr(const char *p, int ch)
char *save;
for (save = NULL;; ++p) {
if (*p == ch)
if (*p == (char) ch)
save = (char *)p;
if (!*p)
return(save);