From 3f6aff84e65e7650f7110768646b86ece6b4dc8f Mon Sep 17 00:00:00 2001 From: Frederic Culot Date: Fri, 22 May 2009 19:59:17 +0000 Subject: The buffer should be allocated dynamically, but I am quite busy right now :'( Anyway, thanks Kamil for feedback --- src/apoint.c | 6 +++--- src/apoint.h | 3 +-- src/event.c | 6 +++--- src/event.h | 3 +-- src/recur.c | 10 +++++----- 5 files changed, 13 insertions(+), 15 deletions(-) diff --git a/src/apoint.c b/src/apoint.c index e0308c2..c1f8736 100755 --- a/src/apoint.c +++ b/src/apoint.c @@ -1,4 +1,4 @@ -/* $calcurse: apoint.c,v 1.33 2009/01/03 21:32:11 culot Exp $ */ +/* $calcurse: apoint.c,v 1.34 2009/05/22 19:59:17 culot Exp $ */ /* * Calcurse - text-based organizer @@ -462,14 +462,14 @@ apoint_write (apoint_llist_node_t *o, FILE *f) apoint_llist_node_t * apoint_scan (FILE *f, struct tm start, struct tm end, char state, char *note) { - char buf[MESG_MAXSIZE], *newline; + char buf[BUFSIZ], *newline; time_t tstart, tend, t; t = time (NULL); (void)localtime (&t); /* Read the appointment description */ - (void)fgets (buf, MESG_MAXSIZE, f); + (void)fgets (buf, sizeof buf, f); newline = strchr (buf, '\n'); if (newline) *newline = '\0'; diff --git a/src/apoint.h b/src/apoint.h index d4d6da2..0298c5d 100755 --- a/src/apoint.h +++ b/src/apoint.h @@ -1,4 +1,4 @@ -/* $calcurse: apoint.h,v 1.17 2009/01/03 21:32:11 culot Exp $ */ +/* $calcurse: apoint.h,v 1.18 2009/05/22 19:59:17 culot Exp $ */ /* * Calcurse - text-based organizer @@ -33,7 +33,6 @@ #include "vars.h" #define HRMIN_SIZE 6 -#define MESG_MAXSIZE 256 #define APOINT_NULL 0x0 #define APOINT_NOTIFY 0x1 /* Item needs to be notified */ diff --git a/src/event.c b/src/event.c index 8009054..c05e0f1 100755 --- a/src/event.c +++ b/src/event.c @@ -1,4 +1,4 @@ -/* $calcurse: event.c,v 1.12 2009/01/03 21:32:11 culot Exp $ */ +/* $calcurse: event.c,v 1.13 2009/05/22 19:59:18 culot Exp $ */ /* * Calcurse - text-based organizer @@ -141,14 +141,14 @@ event_write (struct event_s *o, FILE *f) struct event_s * event_scan (FILE *f, struct tm start, int id, char *note) { - char buf[MESG_MAXSIZE], *nl; + char buf[BUFSIZ], *nl; time_t tstart, t; t = time (NULL); (void)localtime (&t); /* Read the event description */ - (void)fgets (buf, MESG_MAXSIZE, f); + (void)fgets (buf, sizeof buf, f); nl = strchr (buf, '\n'); if (nl) { diff --git a/src/event.h b/src/event.h index 457a577..b81cac8 100755 --- a/src/event.h +++ b/src/event.h @@ -1,4 +1,4 @@ -/* $calcurse: event.h,v 1.8 2009/01/03 21:32:11 culot Exp $ */ +/* $calcurse: event.h,v 1.9 2009/05/22 19:59:18 culot Exp $ */ /* * Calcurse - text-based organizer @@ -30,7 +30,6 @@ #include "utils.h" #define HRMIN_SIZE 6 -#define MESG_MAXSIZE 256 struct event_s { diff --git a/src/recur.c b/src/recur.c index 8e3552d..300e7a8 100755 --- a/src/recur.c +++ b/src/recur.c @@ -1,4 +1,4 @@ -/* $calcurse: recur.c,v 1.49 2009/01/03 21:32:11 culot Exp $ */ +/* $calcurse: recur.c,v 1.50 2009/05/22 19:59:18 culot Exp $ */ /* * Calcurse - text-based organizer @@ -414,14 +414,14 @@ recur_apoint_scan (FILE *f, struct tm start, struct tm end, char type, char state) { struct tm *lt; - char buf[MESG_MAXSIZE], *nl; + char buf[BUFSIZ], *nl; time_t tstart, tend, t, tuntil; t = time (NULL); lt = localtime (&t); /* Read the appointment description */ - (void)fgets (buf, MESG_MAXSIZE, f); + (void)fgets (buf, sizeof buf, f); nl = strchr (buf, '\n'); if (nl) { @@ -462,11 +462,11 @@ struct recur_event_s * recur_event_scan (FILE *f, struct tm start, int id, char type, int freq, struct tm until, char *note, struct days_s **exc) { - char buf[MESG_MAXSIZE], *nl; + char buf[BUFSIZ], *nl; time_t tstart, tuntil; /* Read the event description */ - (void)fgets (buf, MESG_MAXSIZE, f); + (void)fgets (buf, sizeof buf, f); nl = strchr (buf, '\n'); if (nl) { -- cgit v1.2.3-54-g00ecf