mirror of
https://github.com/xzeldon/htop.git
synced 2024-12-23 22:55:46 +00:00
Enable -Wformat=2
Now that the global format variable Process_pidFormat is gone, enable the compiler warning -Wformat=2.
This commit is contained in:
parent
9f68c8d341
commit
c150e4bde9
@ -35,24 +35,21 @@ static void BatteryMeter_updateValues(Meter* this, char* buffer, size_t len) {
|
||||
|
||||
this->values[0] = percent;
|
||||
|
||||
const char *onAcText, *onBatteryText, *unknownText;
|
||||
|
||||
unknownText = "%.1f%%";
|
||||
if (this->mode == TEXT_METERMODE) {
|
||||
onAcText = "%.1f%% (Running on A/C)";
|
||||
onBatteryText = "%.1f%% (Running on battery)";
|
||||
} else {
|
||||
onAcText = "%.1f%%(A/C)";
|
||||
onBatteryText = "%.1f%%(bat)";
|
||||
const char* text;
|
||||
switch (isOnAC) {
|
||||
case AC_PRESENT:
|
||||
text = this->mode == TEXT_METERMODE ? " (Running on A/C)" : "(A/C)";
|
||||
break;
|
||||
case AC_ABSENT:
|
||||
text = this->mode == TEXT_METERMODE ? " (Running on battery)" : "(bat)";
|
||||
break;
|
||||
case AC_ERROR:
|
||||
default:
|
||||
text = "";
|
||||
break;
|
||||
}
|
||||
|
||||
if (isOnAC == AC_PRESENT) {
|
||||
xSnprintf(buffer, len, onAcText, percent);
|
||||
} else if (isOnAC == AC_ABSENT) {
|
||||
xSnprintf(buffer, len, onBatteryText, percent);
|
||||
} else {
|
||||
xSnprintf(buffer, len, unknownText, percent);
|
||||
}
|
||||
xSnprintf(buffer, len, "%.1f%%%s", percent, text);
|
||||
}
|
||||
|
||||
const MeterClass BatteryMeter_class = {
|
||||
|
@ -333,6 +333,7 @@ AM_CFLAGS="\
|
||||
-Wcast-qual\
|
||||
-Wextra\
|
||||
-Wfloat-equal\
|
||||
-Wformat=2\
|
||||
-Wmissing-format-attribute\
|
||||
-Wmissing-noreturn\
|
||||
-Wmissing-prototypes\
|
||||
|
Loading…
Reference in New Issue
Block a user