ACK: [PATCH] lib: fwts-battery: use PRIu32 format specifier, fixes cppcheck warning
Alex Hung
alex.hung at canonical.com
Wed Jan 24 03:39:15 UTC 2018
On 2018-01-23 03:50 AM, Colin King wrote:
> 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);
> }
>
Acked-by: Alex Hung <alex.hung at canonical.com>
More information about the fwts-devel
mailing list