Merge pull request 'Fix signedness issues with strcmp and strncmp' (#4) from Heath123/fxlibc:heath123-patch-1 into master

Reviewed-on: https://gitea.planet-casio.com/Vhex-Kernel-Core/fxlibc/pulls/4
This commit is contained in:
Lephenixnoir 2022-11-24 14:23:21 +01:00
commit eb83e7442f
2 changed files with 2 additions and 2 deletions

View File

@ -6,5 +6,5 @@ int strcmp(const char *s1, const char *s2)
s1 += 1;
s2 += 1;
}
return (*s1 - *s2);
return ((unsigned char) *s1 - (unsigned char) *s2);
}

View File

@ -7,5 +7,5 @@ int strncmp(const char *s1, const char *s2, size_t n)
size_t i = -1;
while (++i < n - 1 && s1[i] != '\0' && s2[i] != '\0'
&& s1[i] == s2[i]) ;
return (s1[i] - s2[i]);
return ((unsigned char) s1[i] - (unsigned char) s2[i]);
}