[gmime/gmime-2-4] Fixed memory stream writes



commit 71d6c4f9db4a1a15189f763347a57a2ffc9acf6b
Author: Jeffrey Stedfast <fejj gnome org>
Date:   Sat Jan 22 15:31:03 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 d636fd3..2bc428c 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 e6f3f67..e818a2b 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, stream->position + len);
+	if (stream->bound_end == -1) {
+		if (stream->position + len > mem->buffer->len)
+			g_byte_array_set_size (mem->buffer, 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]