Bug & patch : balsa-message.c
- From: Emmanuel <e allaud wanadoo fr>
- To: balsa-list gnome org
- Subject: Bug & patch : balsa-message.c
- Date: Mon, 23 Jul 2001 14:24:11 +0200
Hi all,
this patch corrects find_beg_and_end in the corner case when str+pos
points on a \n.
Indeed the function returned the correct beginning (the first char after
the first \n preceding the one pointed on by str+pos) but the resulting
end was pointing on the last char before the first \n (or \0) following
the \n pointed on by str+pos so that there were 2 paragraphs between the
begin and end returned by the function.
Last but not least the function is now a lot simpler.
Manu
--- ../../balsa-1.1.7/src/balsa-message.c Thu Jul 12 12:16:02 2001
+++ balsa-message.c Mon Jul 23 07:28:35 2001
@@ -1067,21 +1066,15 @@
void
find_beg_and_end(gchar * str, gint pos, gchar ** l, gchar ** u)
{
- gint ln;
-
*l = str + pos;
- while (*l > str && !(**l == '\n' && *(*l - 1) == '\n'))
- (*l)--;
- if (*l + 1 <= str + pos && **l == '\n')
- (*l)++;
-
+ while (*l > str && (*(*l - 1) == '\n'))
+ (*l)--;
+
*u = str + pos;
- ln = 0;
- while (**u && !(ln && **u == '\n'))
- ln = *(*u)++ == '\n';
- if (ln)
- (*u)--;
+
+ while (**u && (**u!='\n'))
+ (*u)++;
}
/* lspace - last was space, iidx - insertion index. */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]