changeset 2626:a2b910e21225 HEAD

i_stream_read_data(): return 0 if i_stream_read() returned 0.
author Timo Sirainen <tss@iki.fi>
date Wed, 15 Sep 2004 02:58:26 +0300
parents babebc7ec9b1
children f806d35be249
files src/lib/istream.c src/lib/istream.h
diffstat 2 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib/istream.c	Mon Sep 13 13:47:16 2004 +0300
+++ b/src/lib/istream.c	Wed Sep 15 02:58:26 2004 +0300
@@ -188,7 +188,7 @@
 
 	*data = i_stream_get_data(stream, size);
 	return ret == -2 ? -2 :
-		(read_more ? 0 : -1);
+		(read_more || ret == 0 ? 0 : -1);
 }
 
 struct istream *_i_stream_create(struct _istream *_stream, pool_t pool, int fd,
--- a/src/lib/istream.h	Mon Sep 13 13:47:16 2004 +0300
+++ b/src/lib/istream.h	Wed Sep 15 02:58:26 2004 +0300
@@ -65,7 +65,8 @@
 					    size_t *size);
 /* Like i_stream_get_data(), but read more when needed. Returns 1 if more
    than threshold bytes are available, 0 if less, -1 if error or EOF with no
-   bytes available, or -2 if stream's input buffer is full. */
+   bytes read that weren't already in buffer, or -2 if stream's input buffer
+   is full. */
 int i_stream_read_data(struct istream *stream, const unsigned char **data,
 		       size_t *size, size_t threshold);