[coreboot] r3539 - in trunk/payloads/libpayload: include libc
svn at coreboot.org
svn at coreboot.org
Tue Aug 26 23:51:05 CEST 2008
Author: stepan
Date: 2008-08-26 23:51:04 +0200 (Tue, 26 Aug 2008)
New Revision: 3539
Modified:
trunk/payloads/libpayload/include/libpayload.h
trunk/payloads/libpayload/libc/string.c
Log:
fix string function prototypes in libpayload according to sysv/4.3bsd.
Discussed on IRC, trivial
Signed-off-by: Stefan Reinauer <stepan at coresystems.de>
Acked-by: Stefan Reinauer <stepan at coresystems.de>
Modified: trunk/payloads/libpayload/include/libpayload.h
===================================================================
--- trunk/payloads/libpayload/include/libpayload.h 2008-08-26 19:37:37 UTC (rev 3538)
+++ trunk/payloads/libpayload/include/libpayload.h 2008-08-26 21:51:04 UTC (rev 3539)
@@ -214,10 +214,10 @@
size_t strnlen(const char *str, size_t maxlen);
size_t strlen(const char *str);
int strcmp(const char *s1, const char *s2);
-int strncmp(const char *s1, const char *s2, int maxlen);
-char *strncpy(char *d, const char *s, int n);
+int strncmp(const char *s1, const char *s2, size_t maxlen);
+char *strncpy(char *d, const char *s, size_t n);
char *strcpy(char *d, const char *s);
-char *strncat(char *d, const char *s, int n);
+char *strncat(char *d, const char *s, size_t n);
char *strchr(const char *s, int c);
char *strdup(const char *s);
char *strstr(const char *h, const char *n);
Modified: trunk/payloads/libpayload/libc/string.c
===================================================================
--- trunk/payloads/libpayload/libc/string.c 2008-08-26 19:37:37 UTC (rev 3538)
+++ trunk/payloads/libpayload/libc/string.c 2008-08-26 21:51:04 UTC (rev 3539)
@@ -116,7 +116,7 @@
* @param maxlen Return at most maxlen characters as length of the string.
* @return A non-zero value if s1 and s2 differ, or zero if s1 equals s2.
*/
-int strncmp(const char *s1, const char *s2, int maxlen)
+int strncmp(const char *s1, const char *s2, size_t maxlen)
{
int i;
@@ -128,7 +128,7 @@
return 0;
}
-char *strncpy(char *d, const char *s, int n)
+char *strncpy(char *d, const char *s, size_t n)
{
/* Use +1 to get the NUL terminator. */
int max = n > strlen(s) + 1 ? strlen(s) + 1 : n;
@@ -145,7 +145,7 @@
return strncpy(d, s, strlen(s) + 1);
}
-char *strncat(char *d, const char *s, int n)
+char *strncat(char *d, const char *s, size_t n)
{
char *p = d + strlen(d);
int max = n > strlen(s) ? strlen(s) : n;
More information about the coreboot
mailing list