]> git.pld-linux.org Git - packages/calcurse.git/blob - calcurse-bufsize.patch
- works fine, rel 1
[packages/calcurse.git] / calcurse-bufsize.patch
1 > Hello:)
2 >
3 > Calcurse is nice program - i like this program, but i find bug:
4 >
5 > if lenght one entry in file ~/.calcurse/apts (Appointments) > 256 then i
6 > see error in execute program:
7 > (...)
8
9 Hello Kamil,
10
11 enclosed you will find an updated version that should fix the bug you mention.
12 Actually this is a quick fix (I am very busy at work right now so it is
13 difficult to spend time on calcurse...). Anyway, if you want to send me a
14 better patch I would be happy to include it in next stable release.  The
15 function to update is apoint_scan (file apoint.c): the item should be loaded
16 into a dynamically allocated string, whereas for now on it is just a fixed
17 size buffer.
18
19 Please tell me if the enclosed version fixes your problem, and many thanks for
20 your bug report. Do not hesitate to contact me if you find other bugs!
21
22 Regards,
23 Frederic
24
25 diff -Naur calcurse-2.5/src/apoint.c calcurse-2.5.new/src/apoint.c
26 --- calcurse-2.5/src/apoint.c   2009-01-03 22:32:11.000000000 +0100
27 +++ calcurse-2.5.new/src/apoint.c       2009-05-22 21:40:33.000000000 +0200
28 @@ -462,14 +462,14 @@
29  apoint_llist_node_t *
30  apoint_scan (FILE *f, struct tm start, struct tm end, char state, char *note)
31  {
32 -  char buf[MESG_MAXSIZE], *newline;
33 +  char buf[BUFSIZ], *newline;
34    time_t tstart, tend, t;
35  
36    t = time (NULL);
37    (void)localtime (&t);
38  
39    /* Read the appointment description */
40 -  (void)fgets (buf, MESG_MAXSIZE, f);
41 +  (void)fgets (buf, sizeof buf, f);
42    newline = strchr (buf, '\n');
43    if (newline)
44      *newline = '\0';
45 diff -Naur calcurse-2.5/src/apoint.h calcurse-2.5.new/src/apoint.h
46 --- calcurse-2.5/src/apoint.h   2009-01-03 22:32:11.000000000 +0100
47 +++ calcurse-2.5.new/src/apoint.h       2009-05-22 21:44:42.000000000 +0200
48 @@ -33,7 +33,6 @@
49  #include "vars.h"
50  
51  #define HRMIN_SIZE 6
52 -#define MESG_MAXSIZE 256
53  
54  #define APOINT_NULL            0x0
55  #define APOINT_NOTIFY          0x1     /* Item needs to be notified */
56 diff -Naur calcurse-2.5/src/event.c calcurse-2.5.new/src/event.c
57 --- calcurse-2.5/src/event.c    2009-01-03 22:32:11.000000000 +0100
58 +++ calcurse-2.5.new/src/event.c        2009-05-22 21:45:30.000000000 +0200
59 @@ -141,14 +141,14 @@
60  struct event_s *
61  event_scan (FILE *f, struct tm start, int id, char *note)
62  {
63 -  char buf[MESG_MAXSIZE], *nl;
64 +  char buf[BUFSIZ], *nl;
65    time_t tstart, t;
66  
67    t = time (NULL);
68    (void)localtime (&t);
69  
70    /* Read the event description */
71 -  (void)fgets (buf, MESG_MAXSIZE, f);
72 +  (void)fgets (buf, sizeof buf, f);
73    nl = strchr (buf, '\n');
74    if (nl)
75      {
76 diff -Naur calcurse-2.5/src/event.h calcurse-2.5.new/src/event.h
77 --- calcurse-2.5/src/event.h    2009-01-03 22:32:11.000000000 +0100
78 +++ calcurse-2.5.new/src/event.h        2009-05-22 21:45:35.000000000 +0200
79 @@ -30,7 +30,6 @@
80  #include "utils.h"
81  
82  #define HRMIN_SIZE 6
83 -#define MESG_MAXSIZE 256
84  
85  struct event_s
86  {
87 diff -Naur calcurse-2.5/src/recur.c calcurse-2.5.new/src/recur.c
88 --- calcurse-2.5/src/recur.c    2009-01-03 22:32:11.000000000 +0100
89 +++ calcurse-2.5.new/src/recur.c        2009-05-22 21:46:07.000000000 +0200
90 @@ -414,14 +414,14 @@
91                    char state)
92  {
93    struct tm *lt;
94 -  char buf[MESG_MAXSIZE], *nl;
95 +  char buf[BUFSIZ], *nl;
96    time_t tstart, tend, t, tuntil;
97  
98    t = time (NULL);
99    lt = localtime (&t);
100  
101    /* Read the appointment description */
102 -  (void)fgets (buf, MESG_MAXSIZE, f);
103 +  (void)fgets (buf, sizeof buf, f);
104    nl = strchr (buf, '\n');
105    if (nl)
106      {
107 @@ -462,11 +462,11 @@
108  recur_event_scan (FILE *f, struct tm start, int id, char type, int freq,
109                   struct tm until, char *note, struct days_s **exc)
110  {
111 -  char buf[MESG_MAXSIZE], *nl;
112 +  char buf[BUFSIZ], *nl;
113    time_t tstart, tuntil;
114  
115    /* Read the event description */
116 -  (void)fgets (buf, MESG_MAXSIZE, f);
117 +  (void)fgets (buf, sizeof buf, f);
118    nl = strchr (buf, '\n');
119    if (nl)
120      {
This page took 0.037307 seconds and 3 git commands to generate.