diff --git a/AffinityPanel.c b/AffinityPanel.c index dcbc5d2f1366c15242743b53500b33e3a2e82a58..b3ea41239f0ac095c2ebff10d01b16952f3284c8 100644 --- a/AffinityPanel.c +++ b/AffinityPanel.c @@ -33,7 +33,7 @@ Panel* AffinityPanel_new(ProcessList* pl, unsigned long mask) { Panel_setHeader(this, "Use CPUs:"); for (int i = 0; i < pl->cpuCount; i++) { 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))); } return this; diff --git a/CPUMeter.c b/CPUMeter.c index 8e6f900193c29dd6141163c56a200bbec67a8655..2c4c4dbca753884b3387e038c1c23f39471db439 100644 --- a/CPUMeter.c +++ b/CPUMeter.c @@ -33,7 +33,7 @@ static void CPUMeter_init(Meter* this) { int cpu = this->param; if (this->pl->cpuCount > 1) { char caption[10]; - sprintf(caption, "%-3d", ProcessList_cpuId(this->pl, cpu)); + sprintf(caption, "%-3d", ProcessList_cpuId(this->pl, cpu - 1)); Meter_setCaption(this, caption); } if (this->param == 0) diff --git a/ProcessList.c b/ProcessList.c index 2a01d8e11dceedd9328b5f04906eb8f43ee54932..c200eb914f54a9a2e404461d6d201d4c5a842026 100644 --- a/ProcessList.c +++ b/ProcessList.c @@ -55,7 +55,7 @@ in the source distribution for its full text. #endif #ifndef ProcessList_cpuId -#define ProcessList_cpuId(pl, cpu) ((pl)->countCPUsFromZero ? (cpu)-1 : (cpu)) +#define ProcessList_cpuId(pl, cpu) ((pl)->countCPUsFromZero ? (cpu) : (cpu)+1) #endif }*/ diff --git a/ProcessList.h b/ProcessList.h index ea8f71d0d1744ee59a79d641fea891abf1ef9e94..c7bc5acad124f6856495aa19212d7f14fa4dc5f6 100644 --- a/ProcessList.h +++ b/ProcessList.h @@ -57,7 +57,7 @@ in the source distribution for its full text. #endif #ifndef ProcessList_cpuId -#define ProcessList_cpuId(pl, cpu) ((pl)->countCPUsFromZero ? (cpu)-1 : (cpu)) +#define ProcessList_cpuId(pl, cpu) ((pl)->countCPUsFromZero ? (cpu) : (cpu)+1) #endif diff --git a/htop.c b/htop.c index 2818b2e034d5b8bac0582d374386a51940b613bb..fd47a1e96afd00b03124094922798a40f22e865c 100644 --- a/htop.c +++ b/htop.c @@ -778,7 +778,7 @@ int main(int argc, char** argv) { if (!ok) beep(); } - ((Object*)affinityPanel)->delete((Object*)affinityPanel); + Panel_delete((Object*)affinityPanel); ProcessList_printHeader(pl, Panel_getHeader(panel)); refreshTimeout = 0; break;