summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>2012-02-16 01:43:06 +0000
committerCarl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>2012-02-16 01:43:06 +0000
commit5b5547126d9e80ce6e9c8572b7eb810990618b57 (patch)
tree3df3b2547bfb8a58b79153912b6f15fec8b06da1
parent5210e72d136158ccadfb1b5641eb20ce34066f25 (diff)
downloadast2050-flashrom-5b5547126d9e80ce6e9c8572b7eb810990618b57.zip
ast2050-flashrom-5b5547126d9e80ce6e9c8572b7eb810990618b57.tar.gz
Workaround missing %hhx support in MinGW sscanf
MinGW uses standard Windows C libraries and those apparently don't support %hhx for sscanf into a uint8_t. SCNx8 isn't available either. Corresponding to flashrom svn r1495. Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> Acked-by: Idwer Vollering <vidwer@gmail.com>
-rw-r--r--dummyflasher.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/dummyflasher.c b/dummyflasher.c
index 6281ff8..9b976d9 100644
--- a/dummyflasher.c
+++ b/dummyflasher.c
@@ -199,7 +199,12 @@ int dummy_init(void)
}
}
for (i = 0; i < spi_blacklist_size; i++) {
- sscanf(tmp + i * 2, "%2hhx", &spi_blacklist[i]);
+ unsigned int tmp2;
+ /* SCNx8 is apparently not supported by MSVC (and thus
+ * MinGW), so work around it with an extra variable
+ */
+ sscanf(tmp + i * 2, "%2x", &tmp2);
+ spi_blacklist[i] = (uint8_t)tmp2;
}
msg_pdbg("SPI blacklist is ");
for (i = 0; i < spi_blacklist_size; i++)
@@ -230,7 +235,12 @@ int dummy_init(void)
}
}
for (i = 0; i < spi_ignorelist_size; i++) {
- sscanf(tmp + i * 2, "%2hhx", &spi_ignorelist[i]);
+ unsigned int tmp2;
+ /* SCNx8 is apparently not supported by MSVC (and thus
+ * MinGW), so work around it with an extra variable
+ */
+ sscanf(tmp + i * 2, "%2x", &tmp2);
+ spi_ignorelist[i] = (uint8_t)tmp2;
}
msg_pdbg("SPI ignorelist is ");
for (i = 0; i < spi_ignorelist_size; i++)
OpenPOWER on IntegriCloud