gmime r1468 - in trunk: . gmime



Author: fejj
Date: Fri Sep 26 00:58:40 2008
New Revision: 1468
URL: http://svn.gnome.org/viewvc/gmime?rev=1468&view=rev

Log:
2008-09-25  Jeffrey Stedfast  <fejj novell com>

	* gmime/gmime-stream.c (stream_length): Implemented a default
	solution using g_mime_stream_seek().



Modified:
   trunk/ChangeLog
   trunk/gmime/gmime-stream.c

Modified: trunk/gmime/gmime-stream.c
==============================================================================
--- trunk/gmime/gmime-stream.c	(original)
+++ trunk/gmime/gmime-stream.c	Fri Sep 26 00:58:40 2008
@@ -384,8 +384,18 @@
 static ssize_t
 stream_length (GMimeStream *stream)
 {
-	d(g_warning ("Invoked default stream_length implementation."));
-	return -1;
+	gint64 bound_end;
+	
+	if (stream->bound_end != -1)
+		return stream->bound_end - stream->bound_start;
+	
+	bound_end = g_mime_stream_seek (stream, 0, GMIME_STREAM_SEEK_END);
+	g_mime_stream_seek (stream, stream->position, GMIME_STREAM_SEEK_SET);
+	
+	if (bound_end < stream->bound_start)
+		return -1;
+	
+	return bound_end - stream->bound_start;
 }
 
 



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