From df568a576f7b44ac5a2b9b7222c7f39d9932f626 Mon Sep 17 00:00:00 2001 From: Daniel Lange Date: Wed, 11 Apr 2018 01:26:28 +0200 Subject: Imported Upstream version 2.2.0 --- Meter.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Meter.c') diff --git a/Meter.c b/Meter.c index 52dbdd9..05a4eb2 100644 --- a/Meter.c +++ b/Meter.c @@ -287,7 +287,7 @@ static void BarMeterMode_draw(Meter* this, int x, int y, int w) { int blockSizes[10]; - xSnprintf(bar, w + 1, "%*s", w, buffer); + xSnprintf(bar, w + 1, "%*.*s", w, w, buffer); // First draw in the bar[] buffer... int offset = 0; @@ -359,7 +359,7 @@ static int GraphMeterMode_pixPerRow; static void GraphMeterMode_draw(Meter* this, int x, int y, int w) { if (!this->drawData) this->drawData = xCalloc(1, sizeof(GraphData)); - GraphData* data = (GraphData*) this->drawData; + GraphData* data = (GraphData*) this->drawData; const int nValues = METER_BUFFER_LEN; #ifdef HAVE_LIBNCURSESW @@ -404,7 +404,7 @@ static void GraphMeterMode_draw(Meter* this, int x, int y, int w) { k = -i/2; i = 0; } - for (; i < nValues; i+=2, k++) { + for (; i < nValues - 1; i+=2, k++) { int pix = GraphMeterMode_pixPerRow * GRAPH_HEIGHT; int v1 = CLAMP((int) lround(data->values[i] * pix), 1, pix); int v2 = CLAMP((int) lround(data->values[i+1] * pix), 1, pix); -- cgit v1.2.3