mirror of https://github.com/xzeldon/htop.git
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;
|
this->values[0] = percent;
|
||||||
|
|
||||||
const char *onAcText, *onBatteryText, *unknownText;
|
const char* text;
|
||||||
|
switch (isOnAC) {
|
||||||
unknownText = "%.1f%%";
|
case AC_PRESENT:
|
||||||
if (this->mode == TEXT_METERMODE) {
|
text = this->mode == TEXT_METERMODE ? " (Running on A/C)" : "(A/C)";
|
||||||
onAcText = "%.1f%% (Running on A/C)";
|
break;
|
||||||
onBatteryText = "%.1f%% (Running on battery)";
|
case AC_ABSENT:
|
||||||
} else {
|
text = this->mode == TEXT_METERMODE ? " (Running on battery)" : "(bat)";
|
||||||
onAcText = "%.1f%%(A/C)";
|
break;
|
||||||
onBatteryText = "%.1f%%(bat)";
|
case AC_ERROR:
|
||||||
|
default:
|
||||||
|
text = "";
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isOnAC == AC_PRESENT) {
|
xSnprintf(buffer, len, "%.1f%%%s", percent, text);
|
||||||
xSnprintf(buffer, len, onAcText, percent);
|
|
||||||
} else if (isOnAC == AC_ABSENT) {
|
|
||||||
xSnprintf(buffer, len, onBatteryText, percent);
|
|
||||||
} else {
|
|
||||||
xSnprintf(buffer, len, unknownText, percent);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const MeterClass BatteryMeter_class = {
|
const MeterClass BatteryMeter_class = {
|
||||||
|
|
|
@ -333,6 +333,7 @@ AM_CFLAGS="\
|
||||||
-Wcast-qual\
|
-Wcast-qual\
|
||||||
-Wextra\
|
-Wextra\
|
||||||
-Wfloat-equal\
|
-Wfloat-equal\
|
||||||
|
-Wformat=2\
|
||||||
-Wmissing-format-attribute\
|
-Wmissing-format-attribute\
|
||||||
-Wmissing-noreturn\
|
-Wmissing-noreturn\
|
||||||
-Wmissing-prototypes\
|
-Wmissing-prototypes\
|
||||||
|
|
Loading…
Reference in New Issue