1
0
mirror of https://github.com/simh/simh.git synced 2026-03-01 09:31:16 +00:00

Compiler detected unsigned bug

This commit is contained in:
Mark Pizzolato
2012-03-21 14:46:34 -07:00
parent 5284f8f1e6
commit 3049f16af2

View File

@@ -459,10 +459,9 @@ int strnicmp (const char *a, const char *b, size_t n)
{
int ca, cb;
for (;;) {
if (--n < 0) /* still equal after n characters? quit now */
return 0;
if (n == 0) return 0; /* zero length compare is equal */
for (;;) {
if ((ca = *a) == 0) /* get character, stop on null terminator */
return *b ? -1 : 0;
@@ -477,6 +476,9 @@ int strnicmp (const char *a, const char *b, size_t n)
return ca;
a++, b++;
if (--n == 0) /* still equal after n characters? quit now */
return 0;
}
}