aboutsummaryrefslogtreecommitdiffstats
path: root/camel
diff options
context:
space:
mode:
authorBertrand Guiheneuf <bertrand@src.gnome.org>1999-08-02 03:50:02 +0800
committerBertrand Guiheneuf <bertrand@src.gnome.org>1999-08-02 03:50:02 +0800
commit2c543492092832d71f1f677d52a42043c8787be7 (patch)
tree6ba93586355665bff1edf44616e5951550204f79 /camel
parente9e83c971456616965b183ce1009ba849be69672 (diff)
downloadgsoc2013-evolution-2c543492092832d71f1f677d52a42043c8787be7.tar.gz
gsoc2013-evolution-2c543492092832d71f1f677d52a42043c8787be7.tar.zst
gsoc2013-evolution-2c543492092832d71f1f677d52a42043c8787be7.zip
do not return NULL when line is empty.
* camel/gmime-utils.c (gmime_read_line_from_stream): do not return NULL when line is empty. * camel/camel-multipart.c (_read_part): return true when end of multipart is found, not the contrary svn path=/trunk/; revision=1055
Diffstat (limited to 'camel')
-rw-r--r--camel/camel-multipart.c13
-rw-r--r--camel/gmime-utils.c2
2 files changed, 7 insertions, 8 deletions
diff --git a/camel/camel-multipart.c b/camel/camel-multipart.c
index 05203dba13..490f80e4c0 100644
--- a/camel/camel-multipart.c
+++ b/camel/camel-multipart.c
@@ -367,18 +367,16 @@ _write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream)
* Thus, if there is no blank line before the boundary, the last crlf
* of the last line of the part is removed.
*
- * Return value: false if the last boundary element has been met true otherwise.
+ * Return value: true if the last boundary element has been found or if no more data was available from the stream, flase otherwise
**/
static gboolean
_read_part (GString *new_part, CamelStream *stream, gchar *normal_boundary, gchar *end_boundary)
{
gchar *new_line;
- gboolean end_of_part;
- gboolean last_part;
- gboolean pending_crlf = FALSE;
- guint line_length;
-
+ gboolean end_of_part = FALSE;
+ gboolean last_part = FALSE;
+
/* RFC 2046 precises that when parsing the content of a multipart
* element, the program should not think it will find the last bounndary,
* and in particular, the message could have been damaged during
@@ -408,6 +406,7 @@ _read_part (GString *new_part, CamelStream *stream, gchar *normal_boundary, gcha
} ;
#endif
new_line = gmime_read_line_from_stream (stream);
+ printf ("== new line = \"%s\"\n", new_line);
while (new_line && !end_of_part && !last_part) {
printf ("++ new line = \"%s\"\n", new_line);
end_of_part = (strcmp (new_line, normal_boundary) == 0);
@@ -417,7 +416,7 @@ _read_part (GString *new_part, CamelStream *stream, gchar *normal_boundary, gcha
new_line = gmime_read_line_from_stream (stream);
}
CAMEL_LOG_FULL_DEBUG ("CamelMultipart:: Leaving _read_part\n");
- return (!last_part && new_line);
+ return (last_part && !new_line);
}
static void
diff --git a/camel/gmime-utils.c b/camel/gmime-utils.c
index 27cc6b9674..359f96380b 100644
--- a/camel/gmime-utils.c
+++ b/camel/gmime-utils.c
@@ -235,7 +235,7 @@ gmime_read_line_from_stream (CamelStream *stream)
} else end_of_stream = TRUE;
} while (!end_of_line && !end_of_stream);
- if ( (new_line->str[0]) != '\0')
+ if (!end_of_stream)
result = g_strdup (new_line->str);
else result=NULL;
g_string_free (new_line, TRUE);