[PATCH] lib: fwts-battery: use PRIu32 format specifier, fixes cppcheck warning

Colin King colin.king at canonical.com
Tue Jan 23 11:50:15 UTC 2018


From: Colin Ian King <colin.king at canonical.com>

Use the correct format specifier for a uint32_t, fixes cppcheck warning:

[src/lib/src/fwts_battery.c:423]: (warning) %d in format string (no. 1)
requires 'int' but the argument type is 'unsigned int'.

Signed-off-by: Colin Ian King <colin.king at canonical.com>
---
 src/lib/src/fwts_battery.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/lib/src/fwts_battery.c b/src/lib/src/fwts_battery.c
index 3ec85fcc..194fdd35 100644
--- a/src/lib/src/fwts_battery.c
+++ b/src/lib/src/fwts_battery.c
@@ -420,7 +420,7 @@ static int fwts_battery_set_trip_point_sys_fs(
 				fwts_log_info(fw, "Battery %s present but undersupported - no state present.", entry->d_name);
 			} else {
 				char buffer[512];
-				sprintf(buffer, "%d", trip_point * 1000);
+				sprintf(buffer, "%" PRIu32, trip_point * 1000);
 				fputs(buffer, fp);
 				(void)fclose(fp);
 			}
-- 
2.15.1




More information about the fwts-devel mailing list