From ee42660ea52a3119c5b9ca6a06fc6d63c1a580e7 Mon Sep 17 00:00:00 2001 From: Heath Mitchell Date: Thu, 24 Nov 2022 13:30:46 +0100 Subject: [PATCH 1/2] Update 'src/string/strncmp.c' --- src/string/strncmp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/string/strncmp.c b/src/string/strncmp.c index 0469f47..d03448a 100644 --- a/src/string/strncmp.c +++ b/src/string/strncmp.c @@ -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]); } From aeeae3810d4263f2118f73bdb08bd34b5f243a40 Mon Sep 17 00:00:00 2001 From: Heath Mitchell Date: Thu, 24 Nov 2022 13:36:02 +0100 Subject: [PATCH 2/2] Update 'src/string/strcmp.c' --- src/string/strcmp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/string/strcmp.c b/src/string/strcmp.c index f3ec3cc..5ec8600 100644 --- a/src/string/strcmp.c +++ b/src/string/strcmp.c @@ -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); }