[balsa] Complete the IMAP compression error handling.



commit abb1498316cbdf946d79f54a10dde23310a797bc
Author: Pawel Salek <pawsa damage localdomain>
Date:   Fri Jan 15 19:53:21 2010 +0100

    Complete the IMAP compression error handling.

 ChangeLog                     |   13 +++++++++++++
 libbalsa/imap/imap_compress.c |    2 +-
 libbalsa/imap/siobuf.c        |    9 ++++++---
 3 files changed, 20 insertions(+), 4 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 80d82d7..a655540 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2010-01-15  Pawel Salek
+
+	* libbalsa/imap/imap_compress.c:
+	* libbalsa/imap/siobuf.c: complete the compression error handling.
+
+2010-01-14  Peter Bloomfield
+
+	* libbalsa/html.h: new methods for printing.
+	* libbalsa/html.c (libbalsa_html_can_print),
+	(libbalsa_html_print): implement them.
+	* src/balsa-mime-widget-text.c (bmwt_populate_popup_menu),
+	(bmwt_populate_popup_cb): use them.
+
 2010-01-14  Peter Bloomfield
 
 	* libbalsa/html.h: new methods for printing.
diff --git a/libbalsa/imap/imap_compress.c b/libbalsa/imap/imap_compress.c
index d919730..54340be 100644
--- a/libbalsa/imap/imap_compress.c
+++ b/libbalsa/imap/imap_compress.c
@@ -49,7 +49,7 @@ imap_compress_cb(char **dstbuf, int *dstlen,
   err = deflate(&icb->out_stream, Z_SYNC_FLUSH);
   if ( !(err == Z_OK || err == Z_STREAM_END || err == Z_BUF_ERROR) ) {
     fprintf(stderr, "deflate error1 %d\n", err);
-    *dstlen = 0;
+    *dstlen = -1;
   } else {
     *dstlen = IMAP_COMPRESS_BUFFER_SIZE - icb->out_stream.avail_out;
     /* printf("imap_compress_cb %d bytes to %d\n", srclen, *dstlen); */
diff --git a/libbalsa/imap/siobuf.c b/libbalsa/imap/siobuf.c
index 619cc5c..2f92581 100644
--- a/libbalsa/imap/siobuf.c
+++ b/libbalsa/imap/siobuf.c
@@ -471,7 +471,7 @@ sio_flush (struct siobuf *sio)
          the next call in the same thread.  The secarg argument may be
          used to maintain this buffer. */
       while ((*sio->encode_cb) (&buf, &len, sio->write_buffer, 
-                                length, sio->secarg)) {
+                                length, sio->secarg) >0) {
         raw_write (sio, buf, len);
       }
     }
@@ -575,11 +575,14 @@ sio_fill (struct siobuf *sio)
        buffer. If that call returns 0, actual data read is performed
        and decode is given the second shot, when it isupposed to
        return nonzero.
+       length value 0 means error.
     */
-    while (!(*sio->decode_cb) (&sio->read_position, &sio->read_unread,
+    while ((*sio->decode_cb) (&sio->read_position, &sio->read_unread,
                                sio->read_buffer, sio->read_unread,
-                               sio->secarg)) {
+                               sio->secarg) == 0) {
       sio->read_unread = raw_read (sio, sio->read_buffer, sio->buffer_size);
+      if (sio->read_unread < 0)
+        break;
     }
     if (sio->read_unread <= 0)
       return 0;



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