From 60ff6a73d6f85d707d5df0f5f763530edc372c05 Mon Sep 17 00:00:00 2001 From: nick black Date: Wed, 3 Mar 2021 23:33:33 -0500 Subject: [PATCH] sliders: simplify, kill compiler warning --- src/demo/sliding.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/demo/sliding.c b/src/demo/sliding.c index 3190c4def..c37039e5a 100644 --- a/src/demo/sliding.c +++ b/src/demo/sliding.c @@ -94,7 +94,6 @@ static int fill_chunk(struct ncplane* n, int idx){ const int hidx = idx % CHUNKS_HORZ; const int vidx = idx / CHUNKS_HORZ; - char buf[4]; int maxy, maxx; ncplane_dim_yx(n, &maxy, &maxx); uint64_t channels = 0; @@ -113,11 +112,8 @@ fill_chunk(struct ncplane* n, int idx){ } ret |= ncplane_double_box(n, 0, channels, maxy - 1, maxx - 1, 0); if(maxx >= 4 && maxy >= 3){ - ret |= ncplane_cursor_move_yx(n, (maxy - 1) / 2, (maxx - 1) / 2); - snprintf(buf, sizeof(buf), "%d", (idx + 1) / 10); // don't zero-index to viewer - ret |= (ncplane_putegc(n, buf, NULL) < 0); - snprintf(buf, sizeof(buf), "%d", (idx + 1) % 10); - ret |= (ncplane_putegc(n, buf, NULL) < 0); + // don't zero-index to viewer + ret |= (ncplane_printf_yx(n, (maxy - 1) / 2, (maxx - 1) / 2, "%02d", idx + 1) < 0); } return ret; }