aboutsummaryrefslogtreecommitdiff
path: root/draw.c
diff options
context:
space:
mode:
authorfoswret <foswret@posteo.com>2025-11-26 09:54:00 -0600
committerfoswret <foswret@posteo.com>2025-11-26 09:54:00 -0600
commit0ea73247a8ba4036567a9dc28b6133d4b58507b3 (patch)
tree45bc57e0d3e27df3fcac15ce81132aceae00ed30 /draw.c
parentc9493aae669fada3659547b2ce02ee292eb58ba5 (diff)
added CFLAGS to Makefile, therefore cleaned up some errors
Diffstat (limited to 'draw.c')
-rw-r--r--draw.c6
1 files changed, 2 insertions, 4 deletions
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;