mirror of https://github.com/xzeldon/htop.git
Fix off-by-one error in PROCESSOR display
This commit is contained in:
parent
4e72e790e3
commit
f7fe4b4722
|
@ -33,7 +33,7 @@ Panel* AffinityPanel_new(ProcessList* pl, unsigned long mask) {
|
||||||
Panel_setHeader(this, "Use CPUs:");
|
Panel_setHeader(this, "Use CPUs:");
|
||||||
for (int i = 0; i < pl->cpuCount; i++) {
|
for (int i = 0; i < pl->cpuCount; i++) {
|
||||||
char number[10];
|
char number[10];
|
||||||
snprintf(number, 9, "%d", ProcessList_cpuId(pl, i) + 1);
|
snprintf(number, 9, "%d", ProcessList_cpuId(pl, i));
|
||||||
Panel_add(this, (Object*) CheckItem_new(String_copy(number), NULL, mask & (1 << i)));
|
Panel_add(this, (Object*) CheckItem_new(String_copy(number), NULL, mask & (1 << i)));
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
|
|
|
@ -33,7 +33,7 @@ static void CPUMeter_init(Meter* this) {
|
||||||
int cpu = this->param;
|
int cpu = this->param;
|
||||||
if (this->pl->cpuCount > 1) {
|
if (this->pl->cpuCount > 1) {
|
||||||
char caption[10];
|
char caption[10];
|
||||||
sprintf(caption, "%-3d", ProcessList_cpuId(this->pl, cpu));
|
sprintf(caption, "%-3d", ProcessList_cpuId(this->pl, cpu - 1));
|
||||||
Meter_setCaption(this, caption);
|
Meter_setCaption(this, caption);
|
||||||
}
|
}
|
||||||
if (this->param == 0)
|
if (this->param == 0)
|
||||||
|
|
|
@ -55,7 +55,7 @@ in the source distribution for its full text.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef ProcessList_cpuId
|
#ifndef ProcessList_cpuId
|
||||||
#define ProcessList_cpuId(pl, cpu) ((pl)->countCPUsFromZero ? (cpu)-1 : (cpu))
|
#define ProcessList_cpuId(pl, cpu) ((pl)->countCPUsFromZero ? (cpu) : (cpu)+1)
|
||||||
#endif
|
#endif
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ in the source distribution for its full text.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef ProcessList_cpuId
|
#ifndef ProcessList_cpuId
|
||||||
#define ProcessList_cpuId(pl, cpu) ((pl)->countCPUsFromZero ? (cpu)-1 : (cpu))
|
#define ProcessList_cpuId(pl, cpu) ((pl)->countCPUsFromZero ? (cpu) : (cpu)+1)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
2
htop.c
2
htop.c
|
@ -778,7 +778,7 @@ int main(int argc, char** argv) {
|
||||||
if (!ok)
|
if (!ok)
|
||||||
beep();
|
beep();
|
||||||
}
|
}
|
||||||
((Object*)affinityPanel)->delete((Object*)affinityPanel);
|
Panel_delete((Object*)affinityPanel);
|
||||||
ProcessList_printHeader(pl, Panel_getHeader(panel));
|
ProcessList_printHeader(pl, Panel_getHeader(panel));
|
||||||
refreshTimeout = 0;
|
refreshTimeout = 0;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue