aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-stream-buffer.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@novell.com>2004-06-05 02:48:20 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2004-06-05 02:48:20 +0800
commit9b0724a24a8dd79139c161ebe341235ef3d65b6b (patch)
tree3b2350a4bac35896e29e8b88cc6fa081e21c8931 /camel/camel-stream-buffer.c
parent6c9c376c96da32a105598c7a10aba976599d350a (diff)
downloadgsoc2013-evolution-9b0724a24a8dd79139c161ebe341235ef3d65b6b.tar.gz
gsoc2013-evolution-9b0724a24a8dd79139c161ebe341235ef3d65b6b.tar.zst
gsoc2013-evolution-9b0724a24a8dd79139c161ebe341235ef3d65b6b.zip
Fixed to work properly. After we've flushed the buffer, we want to set
2004-06-04 Jeffrey Stedfast <fejj@novell.com> * camel-stream-buffer.c (stream_flush): Fixed to work properly. After we've flushed the buffer, we want to set sbf->ptr to sbf->buf, we don't want to do sbf->ptr += written, that'll just corrupt our next write. svn path=/trunk/; revision=26220
Diffstat (limited to 'camel/camel-stream-buffer.c')
-rw-r--r--camel/camel-stream-buffer.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/camel/camel-stream-buffer.c b/camel/camel-stream-buffer.c
index 8051441ae7..5db1c124f5 100644
--- a/camel/camel-stream-buffer.c
+++ b/camel/camel-stream-buffer.c
@@ -333,12 +333,12 @@ stream_flush (CamelStream *stream)
CamelStreamBuffer *sbf = CAMEL_STREAM_BUFFER (stream);
if ((sbf->mode & CAMEL_STREAM_BUFFER_MODE) == CAMEL_STREAM_BUFFER_WRITE) {
- int len = sbf->ptr-sbf->buf;
- int written = camel_stream_write(sbf->stream, sbf->buf, len);
- if (written > 0)
- sbf->ptr += written;
- if (written != len)
+ size_t len = sbf->ptr - sbf->buf;
+
+ if (camel_stream_write (sbf->stream, sbf->buf, len) == -1)
return -1;
+
+ sbf->ptr = sbf->buf;
} else {
/* nothing to do for read mode 'flush' */
}