lib/string: change parameter types to match C standard

The third parameter of strncpy and strncmp is supposed to be a size_t
and not a signed int.

Signed-off-by: Felix Held <felix-coreboot@felixheld.de>
Change-Id: I485e45e18232a0d1625d4d626f923ec66cfbe4a2
Reviewed-on: https://review.coreboot.org/c/coreboot/+/83222
Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Varshit Pandya <pandyavarshit@gmail.com>
Reviewed-by: Marshall Dawson <marshalldawson3rd@gmail.com>
Reviewed-by: Elyes Haouas <ehaouas@noos.fr>
This commit is contained in:
Felix Held
2024-06-26 17:59:29 +02:00
committed by Elyes Haouas
parent 245b688a28
commit f04e5f9af7
2 changed files with 4 additions and 4 deletions

View File

@@ -16,10 +16,10 @@ char *strconcat(const char *s1, const char *s2);
size_t strnlen(const char *src, size_t max); size_t strnlen(const char *src, size_t max);
size_t strlen(const char *src); size_t strlen(const char *src);
char *strchr(const char *s, int c); char *strchr(const char *s, int c);
char *strncpy(char *to, const char *from, int count); char *strncpy(char *to, const char *from, size_t count);
char *strcpy(char *dst, const char *src); char *strcpy(char *dst, const char *src);
int strcmp(const char *s1, const char *s2); int strcmp(const char *s1, const char *s2);
int strncmp(const char *s1, const char *s2, int maxlen); int strncmp(const char *s1, const char *s2, size_t maxlen);
int strspn(const char *str, const char *spn); int strspn(const char *str, const char *spn);
int strcspn(const char *str, const char *spn); int strcspn(const char *str, const char *spn);
char *strstr(const char *haystack, const char *needle); char *strstr(const char *haystack, const char *needle);

View File

@@ -71,7 +71,7 @@ char *strrchr(const char *s, int c)
return p; return p;
} }
char *strncpy(char *to, const char *from, int count) char *strncpy(char *to, const char *from, size_t count)
{ {
char *ret = to; char *ret = to;
char data; char data;
@@ -113,7 +113,7 @@ int strcmp(const char *s1, const char *s2)
return r; return r;
} }
int strncmp(const char *s1, const char *s2, int maxlen) int strncmp(const char *s1, const char *s2, size_t maxlen)
{ {
int i; int i;