summaryrefslogtreecommitdiff
path: root/src/io.c
diff options
context:
space:
mode:
authorFrederic Culot <calcurse@culot.org>2009-07-29 18:20:54 +0000
committerFrederic Culot <calcurse@culot.org>2009-07-29 18:20:54 +0000
commit35e4aa61c777b45bbfcd819fee09e25d1c1b1faf (patch)
treeb778537e742e03157008aeda945d60a8e08dbc94 /src/io.c
parent3509b7bb723c5b6fcf64f0b933b4b223e96728ef (diff)
downloadcalcurse-35e4aa61c777b45bbfcd819fee09e25d1c1b1faf.zip
bugfixes
Diffstat (limited to 'src/io.c')
-rwxr-xr-xsrc/io.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/io.c b/src/io.c
index 094042b..97b424d 100755
--- a/src/io.c
+++ b/src/io.c
@@ -1,4 +1,4 @@
-/* $calcurse: io.c,v 1.75 2009/07/27 21:00:41 culot Exp $ */
+/* $calcurse: io.c,v 1.76 2009/07/29 18:20:55 culot Exp $ */
/*
* Calcurse - text-based organizer
@@ -795,11 +795,12 @@ io_init (char *cfile, char *datadir)
}
}
- /* get data from file */
void
io_extract_data (char *dst_data, const char *org, int len)
{
- for (;;)
+ int i;
+
+ for (i = 0; i < len - 1; i++)
{
if (*org == '\n' || *org == '\0')
break;
@@ -1296,11 +1297,11 @@ io_load_todo (void)
else
note[0] = '\0';
/* Then read todo description. */
- (void)fgets (buf, BUFSIZ, data_file);
+ (void)fgets (buf, sizeof buf, data_file);
newline = strchr (buf, '\n');
if (newline)
*newline = '\0';
- io_extract_data (e_todo, buf, strlen (buf));
+ io_extract_data (e_todo, buf, sizeof buf);
todo_add (e_todo, id, note);
++nb_tod;
}