Commit 5b554712 authored by Carl-Daniel Hailfinger's avatar Carl-Daniel Hailfinger
Browse files

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: default avatarCarl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: default avatarIdwer Vollering <vidwer@gmail.com>
parent 5210e72d
...@@ -199,7 +199,12 @@ int dummy_init(void) ...@@ -199,7 +199,12 @@ int dummy_init(void)
} }
} }
for (i = 0; i < spi_blacklist_size; i++) { 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 "); msg_pdbg("SPI blacklist is ");
for (i = 0; i < spi_blacklist_size; i++) for (i = 0; i < spi_blacklist_size; i++)
...@@ -230,7 +235,12 @@ int dummy_init(void) ...@@ -230,7 +235,12 @@ int dummy_init(void)
} }
} }
for (i = 0; i < spi_ignorelist_size; i++) { 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 "); msg_pdbg("SPI ignorelist is ");
for (i = 0; i < spi_ignorelist_size; i++) for (i = 0; i < spi_ignorelist_size; i++)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment