mirror of
https://git.planet-casio.com/Vhex-Kernel-Core/fxlibc.git
synced 2024-12-29 13:03:38 +01:00
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:
commit
eb83e7442f
2 changed files with 2 additions and 2 deletions
|
@ -6,5 +6,5 @@ int strcmp(const char *s1, const char *s2)
|
||||||
s1 += 1;
|
s1 += 1;
|
||||||
s2 += 1;
|
s2 += 1;
|
||||||
}
|
}
|
||||||
return (*s1 - *s2);
|
return ((unsigned char) *s1 - (unsigned char) *s2);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,5 +7,5 @@ int strncmp(const char *s1, const char *s2, size_t n)
|
||||||
size_t i = -1;
|
size_t i = -1;
|
||||||
while (++i < n - 1 && s1[i] != '\0' && s2[i] != '\0'
|
while (++i < n - 1 && s1[i] != '\0' && s2[i] != '\0'
|
||||||
&& s1[i] == s2[i]) ;
|
&& s1[i] == s2[i]) ;
|
||||||
return (s1[i] - s2[i]);
|
return ((unsigned char) s1[i] - (unsigned char) s2[i]);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue