[gmime] Fixed GMimeMultipart's write_to_stream() logic



commit 737bfb9c66152f931a5c1fc99b5720ebb5703f3e
Author: Jeffrey Stedfast <jestedfa microsoft com>
Date:   Fri Feb 3 12:48:44 2017 -0500

    Fixed GMimeMultipart's write_to_stream() logic

 gmime/gmime-multipart.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/gmime/gmime-multipart.c b/gmime/gmime-multipart.c
index a1121a4..7a60f56 100644
--- a/gmime/gmime-multipart.c
+++ b/gmime/gmime-multipart.c
@@ -191,7 +191,7 @@ multipart_write_to_stream (GMimeObject *object, GMimeStream *stream, gboolean co
                part = multipart->children->pdata[i];
                
                /* write the boundary */
-               if ((nwritten = g_mime_stream_printf (stream, "\n--%s\n", boundary)) == -1)
+               if ((nwritten = g_mime_stream_printf (stream, "--%s\n", boundary)) == -1)
                        return -1;
                
                total += nwritten;
@@ -201,11 +201,16 @@ multipart_write_to_stream (GMimeObject *object, GMimeStream *stream, gboolean co
                        return -1;
                
                total += nwritten;
+               
+               if (g_mime_stream_write (stream, "\n", 1) == -1)
+                       return -1;
+               
+               total++;
        }
        
        /* write the end-boundary (but only if a boundary is set) */
        if (boundary) {
-               if ((nwritten = g_mime_stream_printf (stream, "\n--%s--\n", boundary)) == -1)
+               if ((nwritten = g_mime_stream_printf (stream, "--%s--\n", boundary)) == -1)
                        return -1;
                
                total += nwritten;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]