From a33cbae28826de4f20930d225e31f3be0db0502b Mon Sep 17 00:00:00 2001 From: Zev Weiss Date: Sat, 21 May 2022 20:14:02 -0700 Subject: Meter: allocate GraphData buffer dynamically On wide screens the previous value of 256 could end up insufficient to cover the screen space allocated to the graph, leaving it awkwardly truncated mid-column. We now allocate the buffer dynamically instead, growing it to accommodate whatever width the graph occupies. Signed-off-by: Zev Weiss --- Meter.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Meter.h') diff --git a/Meter.h b/Meter.h index 89f0570a..c0a44338 100644 --- a/Meter.h +++ b/Meter.h @@ -20,7 +20,6 @@ in the source distribution for its full text. #define METER_TXTBUFFER_LEN 256 -#define METER_GRAPHDATA_SIZE 256 #define METER_BUFFER_CHECK(buffer, size, written) \ do { \ @@ -97,7 +96,8 @@ typedef struct MeterClass_ { typedef struct GraphData_ { struct timeval time; - double values[METER_GRAPHDATA_SIZE]; + size_t nValues; + double* values; } GraphData; struct Meter_ { @@ -108,7 +108,7 @@ struct Meter_ { char* caption; int mode; unsigned int param; - GraphData* drawData; + GraphData drawData; int h; int columnWidthCount; /**< only used internally by the Header */ uint8_t curItems; -- cgit v1.2.3