summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2011-09-08 02:48:53 +0000
committerHisham Muhammad <hisham@gobolinux.org>2011-09-08 02:48:53 +0000
commitf7fe4b4722129a8444b2f07d2ef1ce9d2500e613 (patch)
tree735412c0093433cb71aeef3d78008b422b9bce26
parent4e72e790e338ea806237ce22a82bc96a48b1ee04 (diff)
Fix off-by-one error in PROCESSOR display
-rw-r--r--AffinityPanel.c2
-rw-r--r--CPUMeter.c2
-rw-r--r--ProcessList.c2
-rw-r--r--ProcessList.h2
-rw-r--r--htop.c2
5 files changed, 5 insertions, 5 deletions
diff --git a/AffinityPanel.c b/AffinityPanel.c
index dcbc5d2f..b3ea4123 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 8e6f9001..2c4c4dbc 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 2a01d8e1..c200eb91 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 ea8f71d0..c7bc5aca 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 2818b2e0..fd47a1e9 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;

© 2014-2024 Faster IT GmbH | imprint | privacy policy