aboutsummaryrefslogtreecommitdiffstats
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
parent6c9c376c96da32a105598c7a10aba976599d350a (diff)
downloadgsoc2013-evolution-9b0724a24a8dd79139c161ebe341235ef3d65b6b.tar
gsoc2013-evolution-9b0724a24a8dd79139c161ebe341235ef3d65b6b.tar.gz
gsoc2013-evolution-9b0724a24a8dd79139c161ebe341235ef3d65b6b.tar.bz2
gsoc2013-evolution-9b0724a24a8dd79139c161ebe341235ef3d65b6b.tar.lz
gsoc2013-evolution-9b0724a24a8dd79139c161ebe341235ef3d65b6b.tar.xz
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
-rw-r--r--camel/ChangeLog5
-rw-r--r--camel/camel-stream-buffer.c10
2 files changed, 10 insertions, 5 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index 88bfb7cb30..67442996ed 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,5 +1,10 @@
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.
+
* providers/imap4/camel-imap4-store.c (connect_to_server_wrapper):
Duh. If the user doesn't care about SSL/TLS - use USE_SSL_NEVER,
not USE_SSL_ALWAYS.
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' */
}