dediprog: Use unsigned conversions to parse device string
We do neither expect nor support negative device or version numbers.
This also spares us a cast.
Change-Id: I77f56ea0531a7da601362716fe6f937acf312b52
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.sourcearcade.org/c/flashprog/+/92
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
diff --git a/dediprog.c b/dediprog.c
index 0d474f9..28ac7fb 100644
--- a/dediprog.c
+++ b/dediprog.c
@@ -836,10 +836,10 @@
return 1;
}
- int sfnum;
- int fw[3];
- if (sscanf(buf, "SF%d V:%d.%d.%d ", &sfnum, &fw[0], &fw[1], &fw[2]) != 4 ||
- sfnum != (int)dp_data->devicetype) {
+ unsigned int sfnum;
+ unsigned int fw[3];
+ if (sscanf(buf, "SF%u V:%u.%u.%u ", &sfnum, &fw[0], &fw[1], &fw[2]) != 4 ||
+ sfnum != dp_data->devicetype) {
msg_perr("Unexpected firmware version string '%s'\n", buf);
return 1;
}