From 805e12f72127bb12a1534a04171af47373516cfb Mon Sep 17 00:00:00 2001 From: violette Date: Fri, 2 May 2025 12:51:50 -0400 Subject: [PATCH] fix: vbuf and non init var --- main.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index f6254b3..e67f532 100644 --- a/main.c +++ b/main.c @@ -17,6 +17,7 @@ #include #include "json.h" +#define VBUF 1 #define SCREEN_WIDTH 80 #define SCREEN_HEIGHT 32 #define CUBE_WIDTH 10 @@ -160,7 +161,7 @@ chooseColor(char c) char chooseMainFace() { - int total; + int total = 0; int faces[NUM_FACES] = {0}; for (int k = 0; k < SCREEN_WIDTH * SCREEN_HEIGHT; ++k) @@ -304,7 +305,7 @@ printCV(char face, struct json_object_element_s *r) struct json_object_element_s start = *r; struct json_object_element_s *next = &start; - char k = 0; + char k = 0; if (face >= 0) for (; k < face; ++k) next = next->next; @@ -344,7 +345,9 @@ printAscii(struct json_value_s *json) for (int k = 0; k < SCREEN_WIDTH * SCREEN_HEIGHT; ++k) printf("%s", k % SCREEN_WIDTH ? chooseColor(output[k]) : "\r\n"); printf("\r\n"); +#ifdef VBUF fflush(stdout); +#endif } void