projects
/
coreboot.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
libpayload: Some more compatibility (for flashrom)
[coreboot.git]
/
payloads
/
libpayload
/
libc
/
string.c
diff --git
a/payloads/libpayload/libc/string.c
b/payloads/libpayload/libc/string.c
index cc587c82a2989411a023d1a4faffe920795b1418..cfa0b4ada445879e7e7d6f20f2e8971e4bdaf4df 100644
(file)
--- a/
payloads/libpayload/libc/string.c
+++ b/
payloads/libpayload/libc/string.c
@@
-32,6
+32,7
@@
#include <libpayload.h>
#include <string.h>
#include <ctype.h>
#include <libpayload.h>
#include <string.h>
#include <ctype.h>
+#include <inttypes.h>
#include <errno.h>
/**
#include <errno.h>
/**
@@
-246,7
+247,7
@@
char *strncat(char *d, const char *s, size_t n)
*
* @param d The destination string.
* @param s The source string.
*
* @param d The destination string.
* @param s The source string.
- * @param n
Not more than n characters from s will be appended to d
.
+ * @param n
d will have at most n-1 characters (plus NUL) after invocation
.
* @return A pointer to the destination string.
*/
size_t strlcat(char *d, const char *s, size_t n)
* @return A pointer to the destination string.
*/
size_t strlcat(char *d, const char *s, size_t n)
@@
-473,6
+474,11
@@
long int strtol(const char *ptr, char **endptr, int base)
return ret * negative;
}
return ret * negative;
}
+long atol(const char *nptr)
+{
+ return strtol(nptr, NULL, 10);
+}
+
/**
* Convert the initial portion of a string into an unsigned int
* @param ptr A pointer to the string to convert
/**
* Convert the initial portion of a string into an unsigned int
* @param ptr A pointer to the string to convert
@@
-481,9
+487,9
@@
long int strtol(const char *ptr, char **endptr, int base)
* @return An unsigned integer representation of the string
*/
* @return An unsigned integer representation of the string
*/
-unsigned long
int strtou
l(const char *ptr, char **endptr, int base)
+unsigned long
long int strtoul
l(const char *ptr, char **endptr, int base)
{
{
- int ret = 0;
+
unsigned long long
int ret = 0;
if (endptr != NULL)
*endptr = (char *) ptr;
if (endptr != NULL)
*endptr = (char *) ptr;
@@
-530,6
+536,14
@@
unsigned long int strtoul(const char *ptr, char **endptr, int base)
return ret;
}
return ret;
}
+unsigned long int strtoul(const char *ptr, char **endptr, int base)
+{
+ unsigned long long val = strtoull(ptr, endptr, base);
+ if (val > UINT32_MAX) return UINT32_MAX;
+ return val;
+}
+
+
/**
* Determine the number of leading characters in s that match characters in a
* @param s A pointer to the string to analyse
/**
* Determine the number of leading characters in s that match characters in a
* @param s A pointer to the string to analyse