[gmime] Fixed memory stream writes



commit c92dd773598a994c1e458e45ab4135b33457915d
Author: Jeffrey Stedfast <fejj gnome org>
Date:   Sat Jan 22 15:32:52 2011 -0500

    Fixed memory stream writes
    
    2011-01-22  Jeffrey Stedfast  <fejj novell com>
    
    	* gmime/gmime-stream-mem.c (stream_write): Correctly calculate
    	the end boundary of the stream when bound_end is -1.

 ChangeLog                |    5 +++++
 gmime/gmime-stream-mem.c |    6 ++++--
 2 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index b023925..20053c8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2011-01-22  Jeffrey Stedfast  <fejj novell com>
+
+	* gmime/gmime-stream-mem.c (stream_write): Correctly calculate the
+	end boundary of the stream when bound_end is -1.
+
 2010-12-05  Jeffrey Stedfast  <fejj novell com>
 
 	* README: Bumped version
diff --git a/gmime/gmime-stream-mem.c b/gmime/gmime-stream-mem.c
index e8cd272..eba78c6 100644
--- a/gmime/gmime-stream-mem.c
+++ b/gmime/gmime-stream-mem.c
@@ -163,8 +163,10 @@ stream_write (GMimeStream *stream, const char *buf, size_t len)
 		return -1;
 	}
 	
-	if (stream->bound_end == -1 && stream->position + len > mem->buffer->len) {
-		g_byte_array_set_size (mem->buffer, (guint) stream->position + len);
+	if (stream->bound_end == -1) {
+		if (stream->position + len > mem->buffer->len)
+			g_byte_array_set_size (mem->buffer, (guint) stream->position + len);
+		
 		bound_end = mem->buffer->len;
 	} else
 		bound_end = stream->bound_end;



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