Commit 43150646 431506466774567083c52a2cf5f9517aa1671826 by Sergey Poznyakoff

(stream_getline,parse_content_type): A couple of bugfixes.

1 parent e526dcb7
Showing 1 changed file with 5 additions and 5 deletions
...@@ -1593,7 +1593,7 @@ stream_getline (stream_t str, char **buf, size_t *bufsize, size_t *pnum) ...@@ -1593,7 +1593,7 @@ stream_getline (stream_t str, char **buf, size_t *bufsize, size_t *pnum)
1593 numread += n; 1593 numread += n;
1594 if ((*buf)[numread - 1] != '\n') 1594 if ((*buf)[numread - 1] != '\n')
1595 { 1595 {
1596 if (numread == *bufsize) 1596 if (numread + 1 == *bufsize)
1597 { 1597 {
1598 *bufsize += 128; 1598 *bufsize += 128;
1599 *buf = xrealloc (*buf, *bufsize); 1599 *buf = xrealloc (*buf, *bufsize);
...@@ -1660,9 +1660,10 @@ parse_content_type (struct compose_env *env, ...@@ -1660,9 +1660,10 @@ parse_content_type (struct compose_env *env,
1660 char *rest = *prest; 1660 char *rest = *prest;
1661 char *sp; 1661 char *sp;
1662 char *comment = NULL; 1662 char *comment = NULL;
1663 1663
1664 while (stop == 0 && status == 0 && *rest) 1664 while (stop == 0 && status == 0 && *rest)
1665 { 1665 {
1666 skipws (rest);
1666 switch (*rest++) 1667 switch (*rest++)
1667 { 1668 {
1668 case '(': 1669 case '(':
...@@ -1742,7 +1743,6 @@ parse_content_type (struct compose_env *env, ...@@ -1742,7 +1743,6 @@ parse_content_type (struct compose_env *env,
1742 stop = 1; 1743 stop = 1;
1743 break; 1744 break;
1744 } 1745 }
1745 skipws (rest);
1746 } 1746 }
1747 1747
1748 if (comment) 1748 if (comment)
...@@ -1849,7 +1849,7 @@ edit_extern (char *cmd, struct compose_env *env, message_t *msg, int level) ...@@ -1849,7 +1849,7 @@ edit_extern (char *cmd, struct compose_env *env, message_t *msg, int level)
1849 body_t body; 1849 body_t body;
1850 stream_t in, out = NULL; 1850 stream_t in, out = NULL;
1851 struct obstack stk; 1851 struct obstack stk;
1852 1852
1853 if (!*msg) 1853 if (!*msg)
1854 message_create (msg, NULL); 1854 message_create (msg, NULL);
1855 1855
...@@ -1883,7 +1883,7 @@ edit_extern (char *cmd, struct compose_env *env, message_t *msg, int level) ...@@ -1883,7 +1883,7 @@ edit_extern (char *cmd, struct compose_env *env, message_t *msg, int level)
1883 id = mh_create_message_id (env->subpart); 1883 id = mh_create_message_id (env->subpart);
1884 header_set_value (hdr2, MU_HEADER_CONTENT_ID, id, 1); 1884 header_set_value (hdr2, MU_HEADER_CONTENT_ID, id, 1);
1885 free (id); 1885 free (id);
1886 1886
1887 header_get_stream (hdr2, &in); 1887 header_get_stream (hdr2, &in);
1888 stream_seek (in, 0, SEEK_SET); 1888 stream_seek (in, 0, SEEK_SET);
1889 cat_message (out, in); 1889 cat_message (out, in);
......