From 0ea73247a8ba4036567a9dc28b6133d4b58507b3 Mon Sep 17 00:00:00 2001 From: foswret Date: Wed, 26 Nov 2025 09:54:00 -0600 Subject: added CFLAGS to Makefile, therefore cleaned up some errors --- draw.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'draw.c') diff --git a/draw.c b/draw.c index dc84bfe..51f9367 100644 --- a/draw.c +++ b/draw.c @@ -41,7 +41,7 @@ int draw_calendar(cairo_t *c, double x, double y, struct dimensions d) { int draw_numbers(cairo_t *c, double x, double y, struct dimensions d, int wd, int nd) { - char str[3]; + char str[20]; cairo_text_extents_t te; cairo_font_extents_t fe; @@ -51,7 +51,6 @@ int draw_numbers(cairo_t *c, double x, double y, struct dimensions d, int wd, in int iterative = 0; cairo_font_extents (c, &fe); - double yi = y; double xi = x; int current_weekday = wd; x = d.m + (wd * d.bw); @@ -59,7 +58,7 @@ int draw_numbers(cairo_t *c, double x, double y, struct dimensions d, int wd, in y = y + d.bh - ((d.bh - fe.ascent) / 2); for (int k = current_weekday; k < d.c; k++) { if (iterative < nd) { - sprintf(str, "%d", iterative + 1); + snprintf(str, sizeof(str), "%d", iterative + 1); cairo_text_extents (c, str, &te); double box_margins = (d.bw - te.width) / 2; @@ -85,7 +84,6 @@ int draw_month_name(cairo_t *c, char *name, struct dimensions d) { double x, y = d.m; cairo_set_font_size(c, 1.0); cairo_text_extents_t te; - cairo_font_extents_t fe; cairo_text_extents(c, name, &te); x = (d.pw / 2) - (te.width / 2); y = 1.5; -- cgit v1.2.3