aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNotZed <notzed@zedzone.helixcode.com>2000-02-10 10:15:02 +0800
committerMichael Zucci <zucchi@src.gnome.org>2000-02-10 10:15:02 +0800
commit8e008e868d747a7dfc5d6be37dc01a2209632f83 (patch)
treed156ff0aee34aeec8d2f722a61e3a887c44b34de
parent504b7541a21b33307d970bfde272b2329fa828a0 (diff)
downloadgsoc2013-evolution-8e008e868d747a7dfc5d6be37dc01a2209632f83.tar.gz
gsoc2013-evolution-8e008e868d747a7dfc5d6be37dc01a2209632f83.tar.zst
gsoc2013-evolution-8e008e868d747a7dfc5d6be37dc01a2209632f83.zip
If we get a -1 read, DONT update the total bytes, and try and truncate the
2000-02-09 NotZed <notzed@zedzone.helixcode.com> * camel/camel-mime-part-utils.c (camel_mime_part_store_stream_in_buffer): If we get a -1 read, DONT update the total bytes, and try and truncate the array in reverse. Eek. * camel/camel-mime-part.c (camel_mime_part_encoding_from_string): This was DEFINETLEY not the right way to do it. strncmp!=strcmp (camel_mime_part_encoding_to_string): Handle the default case. : include string.h for strcmp() etc. svn path=/trunk/; revision=1720
-rw-r--r--ChangeLog12
-rw-r--r--camel/camel-mime-part-utils.c19
-rw-r--r--camel/camel-mime-part.c11
3 files changed, 30 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index 5e34caacc4..abdd2026d7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2000-02-09 NotZed <notzed@zedzone.helixcode.com>
+
+ * camel/camel-mime-part-utils.c
+ (camel_mime_part_store_stream_in_buffer): If we get a -1 read,
+ DONT update the total bytes, and try and truncate the array in
+ reverse. Eek.
+
+ * camel/camel-mime-part.c (camel_mime_part_encoding_from_string):
+ This was DEFINETLEY not the right way to do it. strncmp!=strcmp
+ (camel_mime_part_encoding_to_string): Handle the default case.
+ : include string.h for strcmp() etc.
+
2000-02-09 Matt Loper <matt@helixcode.com>
* tests/ui-tests/test-multipart-alt.msg: New test file; run
diff --git a/camel/camel-mime-part-utils.c b/camel/camel-mime-part-utils.c
index 5e6d187a11..463aa7cb3c 100644
--- a/camel/camel-mime-part-utils.c
+++ b/camel/camel-mime-part-utils.c
@@ -150,21 +150,24 @@ camel_mime_part_store_stream_in_buffer (CamelMimePart *mime_part,
mime_part->temp_message_buffer = g_byte_array_new ();
buffer = mime_part->temp_message_buffer;
-
+
g_byte_array_set_size (buffer, nb_bytes_read_total + STREAM_READ_CHUNK_SZ);
nb_bytes_read_chunk = camel_stream_read (stream,
buffer->data + nb_bytes_read_total,
STREAM_READ_CHUNK_SZ);
- nb_bytes_read_total += nb_bytes_read_chunk;
- while (nb_bytes_read_chunk >0) {
- g_byte_array_set_size (buffer, nb_bytes_read_total + STREAM_READ_CHUNK_SZ);
- nb_bytes_read_chunk = camel_stream_read (stream,
- buffer->data + nb_bytes_read_total,
- STREAM_READ_CHUNK_SZ);
+ if (nb_bytes_read_chunk>0) {
nb_bytes_read_total += nb_bytes_read_chunk;
+
+ while (nb_bytes_read_chunk >0) {
+ g_byte_array_set_size (buffer, nb_bytes_read_total + STREAM_READ_CHUNK_SZ);
+ nb_bytes_read_chunk = camel_stream_read (stream,
+ buffer->data + nb_bytes_read_total,
+ STREAM_READ_CHUNK_SZ);
+ nb_bytes_read_total += nb_bytes_read_chunk;
+ }
}
-
+
g_byte_array_set_size (buffer, nb_bytes_read_total);
CAMEL_LOG_FULL_DEBUG ("CamelMimePartUtils::store_stream_in_buffer entering\n");
diff --git a/camel/camel-mime-part.c b/camel/camel-mime-part.c
index 874400deb8..84140f5aa7 100644
--- a/camel/camel-mime-part.c
+++ b/camel/camel-mime-part.c
@@ -25,6 +25,7 @@
* USA
*/
#include <config.h>
+#include <string.h>
#include "camel-mime-part.h"
#include <stdio.h>
#include "gmime-content-field.h"
@@ -591,6 +592,7 @@ _get_content_object (CamelMedium *medium)
* Beware : this will destroy the temp buffer as well
*/
gtk_object_unref (GTK_OBJECT (stream));
+ mime_part->temp_message_buffer = 0;
} else {
CAMEL_LOG_FULL_DEBUG ("CamelMimePart::get_content_object part has a pointer "
"to a content object as well as a temp buffer\n");
@@ -803,6 +805,7 @@ camel_mime_part_encoding_to_string (CamelMimePartEncodingType encoding)
case CAMEL_MIME_PART_ENCODING_QUOTEDPRINTABLE:
return "quoted-printable";
}
+ return "";
}
@@ -810,13 +813,13 @@ camel_mime_part_encoding_to_string (CamelMimePartEncodingType encoding)
CamelMimePartEncodingType
camel_mime_part_encoding_from_string (const gchar *string)
{
- if (strncmp (string, "7bit") == 0)
+ if (strcmp (string, "7bit") == 0)
return CAMEL_MIME_PART_ENCODING_7BIT;
- else if (strncmp (string, "8bit") == 0)
+ else if (strcmp (string, "8bit") == 0)
return CAMEL_MIME_PART_ENCODING_8BIT;
- else if (strncmp (string, "base64") == 0)
+ else if (strcmp (string, "base64") == 0)
return CAMEL_MIME_PART_ENCODING_BASE64;
- else if (strncmp (string, "quoted-printable") == 0)
+ else if (strcmp (string, "quoted-printable") == 0)
return CAMEL_MIME_PART_ENCODING_QUOTEDPRINTABLE;
else
/* FIXME? Spit a warning? */