summaryrefslogtreecommitdiff
path: root/payloads/libpayload/libc
diff options
context:
space:
mode:
authorPatrick Georgi <patrick.georgi@secunet.com>2011-07-26 12:51:59 +0200
committerPatrick Georgi <patrick@georgi-clan.de>2011-08-17 16:26:20 +0200
commitc643fdd157bbd54d15276b212d1f3d0bf64cd3f9 (patch)
treefc25bd1319be8db779f328eeff779d959faf51b2 /payloads/libpayload/libc
parent8bbdb61113ad7f6814b198c01236411e4a3b7482 (diff)
downloadcoreboot-c643fdd157bbd54d15276b212d1f3d0bf64cd3f9.tar.xz
libpayload: Some more compatibility (for flashrom)
libpci defines an arbitrary set of PCI vendor IDs, flashrom uses the Intel definition. Add it. flashrom also requires inttypes.h, so add the OpenBSD version Change-Id: I9bffd8193f635c375ac4d6b6eae8d3d876b95f5f Signed-off-by: Patrick Georgi <patrick.georgi@secunet.com> Reviewed-on: http://review.coreboot.org/154 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'payloads/libpayload/libc')
-rw-r--r--payloads/libpayload/libc/string.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/payloads/libpayload/libc/string.c b/payloads/libpayload/libc/string.c
index 8c6ea99115..cfa0b4ada4 100644
--- 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 <inttypes.h>
#include <errno.h>
/**
@@ -486,9 +487,9 @@ long atol(const char *nptr)
* @return An unsigned integer representation of the string
*/
-unsigned long int strtoul(const char *ptr, char **endptr, int base)
+unsigned long long int strtoull(const char *ptr, char **endptr, int base)
{
- int ret = 0;
+ unsigned long long int ret = 0;
if (endptr != NULL)
*endptr = (char *) ptr;
@@ -535,6 +536,14 @@ unsigned long int strtoul(const char *ptr, char **endptr, int base)
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