aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamon Chaplin <damon@ximian.com>2001-10-31 22:13:29 +0800
committerDamon Chaplin <damon@src.gnome.org>2001-10-31 22:13:29 +0800
commitc9ce571c203987c9033de3683e41d9ead1104ce0 (patch)
tree2aa3d32581409ca03ceacaf7e933d85ed3be8d20
parentd5ae9d8cd3227a5b723f996a52491413ea4901c3 (diff)
downloadgsoc2013-evolution-c9ce571c203987c9033de3683e41d9ead1104ce0.tar.gz
gsoc2013-evolution-c9ce571c203987c9033de3683e41d9ead1104ce0.tar.zst
gsoc2013-evolution-c9ce571c203987c9033de3683e41d9ead1104ce0.zip
use MAX_LINE_LEN rather than magic numbers all over the place.
2001-10-31 Damon Chaplin <damon@ximian.com> * src/libical/icalproperty.c (get_next_line_start): use MAX_LINE_LEN rather than magic numbers all over the place. svn path=/trunk/; revision=14536
-rw-r--r--libical/ChangeLog5
-rw-r--r--libical/src/libical/icalproperty.c9
2 files changed, 11 insertions, 3 deletions
diff --git a/libical/ChangeLog b/libical/ChangeLog
index 44cc7bef5d..b00c82defe 100644
--- a/libical/ChangeLog
+++ b/libical/ChangeLog
@@ -1,5 +1,10 @@
2001-10-31 Damon Chaplin <damon@ximian.com>
+ * src/libical/icalproperty.c (get_next_line_start): use MAX_LINE_LEN
+ rather than magic numbers all over the place.
+
+2001-10-31 Damon Chaplin <damon@ximian.com>
+
* src/libical/icalproperty.c (icalproperty_as_ical_string): had to
redo the folding code since Outlook 2000 doesn't like parameter values
like 'TENTATIVE' cut in half. Now it tries to split after a ';', ':'
diff --git a/libical/src/libical/icalproperty.c b/libical/src/libical/icalproperty.c
index bd361aecc2..8cd34f1413 100644
--- a/libical/src/libical/icalproperty.c
+++ b/libical/src/libical/icalproperty.c
@@ -265,6 +265,9 @@ icalproperty_free (icalproperty* prop)
/* This returns where the start of the next line should be. chars_left does
not include the trailing '\0'. */
+#define MAX_LINE_LEN 75
+/*#define MAX_LINE_LEN 120*/
+
static char*
get_next_line_start (char *line_start, int chars_left)
{
@@ -272,7 +275,7 @@ get_next_line_start (char *line_start, int chars_left)
/* If we have 74 chars or less left, we can output all of them.
we return a pointer to the '\0' at the end of the string. */
- if (chars_left <= 74) {
+ if (chars_left < MAX_LINE_LEN) {
return line_start + chars_left;
}
@@ -280,7 +283,7 @@ get_next_line_start (char *line_start, int chars_left)
trying to find a ';' ':' or ' '. If we find one, we return the character
after it. If not, we break at 74 chars (the 75th char is the space at
the start of the line). */
- pos = line_start + 73;
+ pos = line_start + MAX_LINE_LEN - 2;
while (pos > line_start) {
if (*pos == ';' || *pos == ':' || *pos == ' ') {
return pos + 1;
@@ -288,7 +291,7 @@ get_next_line_start (char *line_start, int chars_left)
pos--;
}
- return line_start + 74;
+ return line_start + MAX_LINE_LEN - 1;
}