diff --git a/goo/GooString.cc b/goo/GooString.cc index 036a432..2f1d7d5 100644 --- a/goo/GooString.cc +++ b/goo/GooString.cc @@ -663,11 +663,13 @@ GooString *GooString::lowerCase() { int GooString::cmp(GooString *str) { int n1, n2, i, x; - char *p1, *p2; + unsigned char *p1, *p2; n1 = length; n2 = str->length; - for (i = 0, p1 = s, p2 = str->s; i < n1 && i < n2; ++i, ++p1, ++p2) { + p1 = (unsigned char*)s; + p2 = (unsigned char*)str->s; + for (i = 0; i < n1 && i < n2; ++i, ++p1, ++p2) { x = *p1 - *p2; if (x != 0) { return x; @@ -678,12 +680,13 @@ int GooString::cmp(GooString *str) { int GooString::cmpN(GooString *str, int n) { int n1, n2, i, x; - char *p1, *p2; + unsigned char *p1, *p2; n1 = length; n2 = str->length; - for (i = 0, p1 = s, p2 = str->s; - i < n1 && i < n2 && i < n; + p1 = (unsigned char*)s; + p2 = (unsigned char*)str->s; + for (i = 0; i < n1 && i < n2 && i < n; ++i, ++p1, ++p2) { x = *p1 - *p2; if (x != 0) { @@ -698,10 +701,12 @@ int GooString::cmpN(GooString *str, int n) { int GooString::cmp(const char *sA) { int n1, i, x; - const char *p1, *p2; + const unsigned char *p1, *p2; n1 = length; - for (i = 0, p1 = s, p2 = sA; i < n1 && *p2; ++i, ++p1, ++p2) { + p1 = (unsigned char*)s; + p2 = (unsigned char*)sA; + for (i = 0; i < n1 && *p2; ++i, ++p1, ++p2) { x = *p1 - *p2; if (x != 0) { return x; @@ -718,10 +723,12 @@ int GooString::cmp(const char *sA) { int GooString::cmpN(const char *sA, int n) { int n1, i, x; - const char *p1, *p2; + const unsigned char *p1, *p2; n1 = length; - for (i = 0, p1 = s, p2 = sA; i < n1 && *p2 && i < n; ++i, ++p1, ++p2) { + p1 = (unsigned char*)s; + p2 = (unsigned char*)sA; + for (i = 0; i < n1 && *p2 && i < n; ++i, ++p1, ++p2) { x = *p1 - *p2; if (x != 0) { return x;