aboutsummaryrefslogtreecommitdiff
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
parentc9493aae669fada3659547b2ce02ee292eb58ba5 (diff)
added CFLAGS to Makefile, therefore cleaned up some errors
-rw-r--r--0.pdfbin5492 -> 5500 bytes
-rw-r--r--Makefile2
-rw-r--r--draw.c6
-rw-r--r--main.c18
4 files changed, 13 insertions, 13 deletions
diff --git a/0.pdf b/0.pdf
index ac92d4d..a4a8dcc 100644
--- a/0.pdf
+++ b/0.pdf
Binary files differ
diff --git a/Makefile b/Makefile
index 8c6785c..a53e318 100644
--- a/Makefile
+++ b/Makefile
@@ -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
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;
diff --git a/main.c b/main.c
index 282fcb9..51fb86d 100644
--- a/main.c
+++ b/main.c
@@ -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;