From fa20bcc314c931e0c790ba62ab028706d802ccc3 Mon Sep 17 00:00:00 2001 From: Ilya Kurdyukov <59548320+ilyakurdyukov@users.noreply.github.com> Date: Wed, 21 Jun 2023 13:51:25 +0700 Subject: [PATCH] fixed reading partition table from .xml on Windows --- spd_dump.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spd_dump.c b/spd_dump.c index 8f1a77e..1c700ba 100644 --- a/spd_dump.c +++ b/spd_dump.c @@ -785,7 +785,7 @@ static int scan_xml_partitions(const char *fn, uint8_t *buf, size_t buf_size) { src[size] = 0; p = src; for (;;) { - int i, a = *p++, size, n; char c; + int i, a = *p++, n; char c; long long size; if (a == ' ' || a == '\t' || a == '\n' || a == '\r') continue; if (a != '<') { if (!a) break; @@ -813,7 +813,7 @@ static int scan_xml_partitions(const char *fn, uint8_t *buf, size_t buf_size) { stage++; continue; } - i = sscanf(p, "Partition id=\"%35[^\"]\" size=\"%i\"/%n%c", name, &size, &n, &c); + i = sscanf(p, "Partition id=\"%35[^\"]\" size=\"%lli\"/%n%c", name, &size, &n, &c); if (i != 3 || c != '>') ERR_EXIT("xml: unexpected syntax\n"); p += n + 1; @@ -825,7 +825,7 @@ static int scan_xml_partitions(const char *fn, uint8_t *buf, size_t buf_size) { if (!i) ERR_EXIT("empty partition name\n"); WRITE32_LE(buf + 0x48, size); buf += 0x4c; - DBG_LOG("[%d] %s, %d\n", found, name, size); + DBG_LOG("[%d] %s, %d\n", found, name, (int)size); found++; } if (p - 1 != src + size) ERR_EXIT("xml: zero byte");