string: Fix wrong comparison semantics

Chars are signed for x86 -- correct the comparison semantics.

Change-Id: I2049e98eb063c0b4e83ea973d3fcae49c6817dde
Author: Liubov Dmitrieva <liubov.dmitrieva@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
This commit is contained in:
Bruce Beare 2011-10-25 13:06:09 +04:00 committed by Jean-Baptiste Queru
parent 89d3fdcae2
commit cb1df91616
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);