Message ID | 20180123115015.18869-1-colin.king@canonical.com |
---|---|
State | Accepted |
Headers | show |
Series | lib: fwts-battery: use PRIu32 format specifier, fixes cppcheck warning | expand |
On 2018-01-23 03:50 AM, Colin King wrote: > From: Colin Ian King <colin.king@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@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@canonical.com>
On 01/23/2018 07:50 PM, Colin King wrote: > From: Colin Ian King <colin.king@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@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: Ivan Hu <ivan.hu@canonical.com>
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); }