aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers/pop3
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2000-06-21 10:09:48 +0800
committerDan Winship <danw@src.gnome.org>2000-06-21 10:09:48 +0800
commit4f20138bfc192d2feff2e913fbc0ff87ca6bd19c (patch)
tree76c0972dee1278911723b296a1870e9a3922768f /camel/providers/pop3
parented11b82023a5501fb05837f63cceff18698691a5 (diff)
downloadgsoc2013-evolution-4f20138bfc192d2feff2e913fbc0ff87ca6bd19c.tar.gz
gsoc2013-evolution-4f20138bfc192d2feff2e913fbc0ff87ca6bd19c.tar.zst
gsoc2013-evolution-4f20138bfc192d2feff2e913fbc0ff87ca6bd19c.zip
flush the filter stream before unreffing it, so it will
* camel-mime-part.c (write_to_stream): flush the filter stream before unreffing it, so it will camel_mime_filter_complete. * camel-stream-filter.c (camel_stream_filter_class_init): Fix a braino so camel_stream_flush works here. * camel-stream-mem.c (stream_seek): Fix a bug that resulted in large attachments being silently dropped. * providers/pop3/camel-pop3-store.c (camel_pop3_command_get_additional_data): Don't use g_strjoinv here, since it is O(n^2) on the length of the output string, and we can do O(n). * camel-mime-part-utils.c (simple_data_wrapper_construct_from_parser): add a CRLF decoder after the QP/B64 decoder if it's text. svn path=/trunk/; revision=3658
Diffstat (limited to 'camel/providers/pop3')
-rw-r--r--camel/providers/pop3/camel-pop3-store.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/camel/providers/pop3/camel-pop3-store.c b/camel/providers/pop3/camel-pop3-store.c
index b465faa499..ea4db42097 100644
--- a/camel/providers/pop3/camel-pop3-store.c
+++ b/camel/providers/pop3/camel-pop3-store.c
@@ -642,8 +642,8 @@ camel_pop3_command_get_additional_data (CamelPop3Store *store,
{
CamelStreamBuffer *stream = CAMEL_STREAM_BUFFER (store->istream);
GPtrArray *data;
- char *buf;
- int i, status = CAMEL_POP3_OK;
+ char *buf, *p;
+ int i, len = 0, status = CAMEL_POP3_OK;
data = g_ptr_array_new ();
while (1) {
@@ -655,24 +655,26 @@ camel_pop3_command_get_additional_data (CamelPop3Store *store,
if (!strcmp (buf, "."))
break;
- if (*buf == '.')
- memmove (buf, buf + 1, strlen (buf));
- g_ptr_array_add (data, buf);
+ p = (*buf == '.') ? buf + 1 : buf;
+ g_ptr_array_add (data, p);
+ len += strlen (p) + 1;
}
g_free (buf);
if (status == CAMEL_POP3_OK) {
- /* Append an empty string to the end of the array
- * so when we g_strjoinv it, we get a "\n" after
- * the last real line.
- */
- g_ptr_array_add (data, "");
- g_ptr_array_add (data, NULL);
- buf = g_strjoinv ("\n", (char **)data->pdata);
+ buf = g_malloc (len + 1);
+
+ for (i = 0, p = buf; i < data->len; i++) {
+ len = strlen (data->pdata[i]);
+ memcpy (p, data->pdata[i], len);
+ p += len;
+ *p++ = '\n';
+ }
+ *p = '\0';
} else
buf = NULL;
- for (i = 0; i < data->len - 2; i++)
+ for (i = 0; i < data->len; i++)
g_free (data->pdata[i]);
g_ptr_array_free (data, TRUE);