Thread View: news.software.readers
2 messages
2 total messages
Started by Thomas Schultz
Sun, 09 Jul 2000 00:00
[slrn] Bugfix: Soft linebreak on last line
Author: Thomas Schultz
Date: Sun, 09 Jul 2000 00:00
Date: Sun, 09 Jul 2000 00:00
51 lines
2212 bytes
2212 bytes
Hello,
Quoted-Printable messages can contain "soft" linebreaks (indicated by
"=" at the end of the line). In slrn, this is handled by the function
merge_if_soft_linebreak() in mime.c. However, the code does not handle
the situation correctly if the _last_ line ends with a soft linebreak
(which may sound absurd, but is actually possible) and prints the "="
character. The fix for this is so trivial that I hope it can still go
into the next version of slrn. Here is the patch:
diff -ur slrn-0.9.6.2.orig/src/mime.c slrn-0.9.6.2/src/mime.c
--- slrn-0.9.6.2.orig/src/mime.c Sun Dec 19 22:51:32 1999
+++ slrn-0.9.6.2/src/mime.c Sun Jul 9 15:45:12 2000
@@ -478,11 +478,11 @@
static int merge_if_soft_linebreak (Slrn_Article_Line_Type *curr_line)
{
Slrn_Article_Line_Type *next_line;
+ unsigned int len;
while ((next_line = curr_line->next) != NULL)
{
char *b = curr_line->buf;
- unsigned int len;
len = strlen (b);
if (len == 0) return 0;
@@ -508,6 +508,12 @@
SLFREE (next_line->buf);
SLFREE (next_line);
}
+
+ /* In case the last line ends with a soft linebreak: */
+ len = strlen(curr_line->buf);
+ if (len && (curr_line->buf[len-1] == '='))
+ curr_line->buf[len-1] = '\0';
+
return 0;
}
@@ -532,8 +538,7 @@
b = line->buf;
len = strlen (b);
- if (len && (b[len - 1] == '=')
- && (line->next != NULL))
+ if (len && (b[len - 1] == '='))
{
(void) merge_if_soft_linebreak (line);
b = line->buf;
Re: [slrn] Bugfix: Soft linebreak on last line
Author: Thomas Schultz
Date: Sun, 09 Jul 2000 00:00
Date: Sun, 09 Jul 2000 00:00
61 lines
2524 bytes
2524 bytes
On 09 July 2000 at 14:21 GMT, I wrote:
[Bugreport and patch]
As a reply to my previous posting, Dirk Nimmich pointed out that there
is another mistake in the way slrn handles quoted-printable messages.
RFC 2045, section 6.7 (3) clearly requires that all trailing unencoded
whitespace has to be stripped from a line before decoding it:
| Therefore, when decoding a Quoted-Printable body, any trailing white
| space on a line must be deleted, as it will necessarily have been
| added by intermediate transport agents.
I added a fix for this to the patch. Here is the new version:
diff -ur slrn-0.9.6.2.orig/src/mime.c slrn-0.9.6.2/src/mime.c
--- slrn-0.9.6.2.orig/src/mime.c Sun Dec 19 22:51:32 1999
+++ slrn-0.9.6.2/src/mime.c Sun Jul 9 20:02:42 2000
@@ -478,13 +478,15 @@
static int merge_if_soft_linebreak (Slrn_Article_Line_Type *curr_line)
{
Slrn_Article_Line_Type *next_line;
+ unsigned int len;
while ((next_line = curr_line->next) != NULL)
{
char *b = curr_line->buf;
- unsigned int len;
len = strlen (b);
+ while (len && isspace(b[len - 1]))
+ b[--len] = '\0';
if (len == 0) return 0;
len--;
@@ -508,6 +510,12 @@
SLFREE (next_line->buf);
SLFREE (next_line);
}
+
+ /* In case the last line ends with a soft linebreak: */
+ len = strlen(curr_line->buf);
+ if (len && (curr_line->buf[len-1] == '='))
+ curr_line->buf[len-1] = '\0';
+
return 0;
}
@@ -532,8 +540,9 @@
b = line->buf;
len = strlen (b);
- if (len && (b[len - 1] == '=')
- && (line->next != NULL))
+ while (len && isspace(b[len - 1]))
+ b[--len] = '\0';
+ if (len && (b[len - 1] == '='))
{
(void) merge_if_soft_linebreak (line);
b = line->buf;
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads