MinGW uses standard Windows C libraries and those apparently don't support %hhx for sscanf into a uint8_t. SCNx8 isn't available either.
Signed-off-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net
Index: flashrom-mingw_workaround_broken_sscanf_uint8t/dummyflasher.c =================================================================== --- flashrom-mingw_workaround_broken_sscanf_uint8t/dummyflasher.c (Revision 1492) +++ flashrom-mingw_workaround_broken_sscanf_uint8t/dummyflasher.c (Arbeitskopie) @@ -199,7 +199,12 @@ } } 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 @@ } } 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++)
2012/2/16 Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net:
MinGW uses standard Windows C libraries and those apparently don't support %hhx for sscanf into a uint8_t. SCNx8 isn't available either.
Signed-off-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net
Acked-by: Idwer Vollering vidwer@gmail.com
Index: flashrom-mingw_workaround_broken_sscanf_uint8t/dummyflasher.c
--- flashrom-mingw_workaround_broken_sscanf_uint8t/dummyflasher.c (Revision 1492) +++ flashrom-mingw_workaround_broken_sscanf_uint8t/dummyflasher.c (Arbeitskopie) @@ -199,7 +199,12 @@ } } 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 @@ } } 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++)
flashrom mailing list flashrom@flashrom.org http://www.flashrom.org/mailman/listinfo/flashrom