diff options
| author | foswret <foswret@posteo.com> | 2025-11-26 09:54:00 -0600 |
|---|---|---|
| committer | foswret <foswret@posteo.com> | 2025-11-26 09:54:00 -0600 |
| commit | 0ea73247a8ba4036567a9dc28b6133d4b58507b3 (patch) | |
| tree | 45bc57e0d3e27df3fcac15ce81132aceae00ed30 | |
| parent | c9493aae669fada3659547b2ce02ee292eb58ba5 (diff) | |
added CFLAGS to Makefile, therefore cleaned up some errors
| -rw-r--r-- | 0.pdf | bin | 5492 -> 5500 bytes | |||
| -rw-r--r-- | Makefile | 2 | ||||
| -rw-r--r-- | draw.c | 6 | ||||
| -rw-r--r-- | main.c | 18 |
4 files changed, 13 insertions, 13 deletions
| Binary files differ @@ -3,7 +3,7 @@ OBJS = draw.o main.o CAIROI = `pkg-config --cflags -libs cairo cairo-pdf` .PHONY: clean all -#CFLAGS = -O2 -g -Wall -Werror -Wextra -Winit-self -Wuninitialized -pedantic +CFLAGS = -O2 -g -Wall -Werror -Wextra -Winit-self -Wuninitialized -pedantic all: output @@ -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; @@ -17,7 +17,8 @@ #include "draw.h" -int main (int argc, char *argv[]) { +// int main (int argc, char *argv[]) { +int main (void) { /* Dimension initialization */ int rows = 5; /* Number of weeks in a month */ int columns = 7; /* Number of days in a week */ @@ -52,14 +53,15 @@ int main (int argc, char *argv[]) { "November", "December" }; - int days_in_month[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; - const char *weekday_names[] = { - "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" - }; + //int days_in_month[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; + + // const char *weekday_names[] = { + // "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" + // }; - const char *weekdays_abbr[] = { - "Su", "Mo", "Tue", "Wed", "Thurs", "Fri", "Sat" - }; + // const char *weekdays_abbr[] = { + // "Su", "Mo", "Tue", "Wed", "Thurs", "Fri", "Sat" + // }; int year = 2025; int month = 2; |
