From d34645f8f1b958454f182fcc061a05fefe48f4df Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Mon, 23 Nov 2015 03:46:43 -0200 Subject: [PATCH] Array entries have been oddly flipped here for years. --- LoadAverageMeter.c | 14 +++++++------- Meter.c | 1 - RichString.c | 3 +-- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/LoadAverageMeter.c b/LoadAverageMeter.c index 23645dda..d292a7cb 100644 --- a/LoadAverageMeter.c +++ b/LoadAverageMeter.c @@ -15,25 +15,25 @@ in the source distribution for its full text. }*/ int LoadAverageMeter_attributes[] = { - LOAD_AVERAGE_FIFTEEN, LOAD_AVERAGE_FIVE, LOAD_AVERAGE_ONE + LOAD_AVERAGE_ONE, LOAD_AVERAGE_FIVE, LOAD_AVERAGE_FIFTEEN }; int LoadMeter_attributes[] = { LOAD }; static void LoadAverageMeter_setValues(Meter* this, char* buffer, int size) { - Platform_getLoadAverage(&this->values[2], &this->values[1], &this->values[0]); - snprintf(buffer, size, "%.2f/%.2f/%.2f", this->values[2], this->values[1], this->values[0]); + Platform_getLoadAverage(&this->values[0], &this->values[1], &this->values[2]); + snprintf(buffer, size, "%.2f/%.2f/%.2f", this->values[0], this->values[1], this->values[2]); } static void LoadAverageMeter_display(Object* cast, RichString* out) { Meter* this = (Meter*)cast; char buffer[20]; - sprintf(buffer, "%.2f ", this->values[2]); - RichString_write(out, CRT_colors[LOAD_AVERAGE_FIFTEEN], buffer); + sprintf(buffer, "%.2f ", this->values[0]); + RichString_write(out, CRT_colors[LOAD_AVERAGE_ONE], buffer); sprintf(buffer, "%.2f ", this->values[1]); RichString_append(out, CRT_colors[LOAD_AVERAGE_FIVE], buffer); - sprintf(buffer, "%.2f ", this->values[0]); - RichString_append(out, CRT_colors[LOAD_AVERAGE_ONE], buffer); + sprintf(buffer, "%.2f ", this->values[2]); + RichString_append(out, CRT_colors[LOAD_AVERAGE_FIFTEEN], buffer); } static void LoadMeter_setValues(Meter* this, char* buffer, int size) { diff --git a/Meter.c b/Meter.c index 8792f93d..834c9b0b 100644 --- a/Meter.c +++ b/Meter.c @@ -251,7 +251,6 @@ static void TextMeterMode_draw(Meter* this, int x, int y, int w) { mvaddstr(y, x, this->caption); int captionLen = strlen(this->caption); x += captionLen; - mvhline(y, x, ' ', CRT_colors[DEFAULT_COLOR]); attrset(CRT_colors[RESET_COLOR]); RichString_begin(out); Meter_displayBuffer(this, buffer, &out); diff --git a/RichString.c b/RichString.c index 8a06baae..c9c02dec 100644 --- a/RichString.c +++ b/RichString.c @@ -100,8 +100,7 @@ static inline void RichString_writeFrom(RichString* this, int attrs, const char* int newLen = from + len; RichString_setLen(this, newLen); for (int i = from, j = 0; i < newLen; i++, j++) { - CharType* c = &(this->chptr[i]); - *c = (CharType) { .attr = attrs, .chars = { (iswprint(data[j]) ? data[j] : '?') } }; + this->chptr[i] = (CharType) { .attr = attrs & 0xffffff, .chars = { (iswprint(data[j]) ? data[j] : '?') } }; } }