commit-mailutils
[Top][All Lists]
Advanced

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

[SCM] GNU Mailutils branch, stream-cleanup, updated. rel-2_1-86-g62db89e


From: Sergey Poznyakoff
Subject: [SCM] GNU Mailutils branch, stream-cleanup, updated. rel-2_1-86-g62db89e
Date: Sat, 01 May 2010 17:52:35 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Mailutils".

http://git.savannah.gnu.org/cgit/mailutils.git/commit/?id=62db89e3dca29f9b931c62b25014955a4ede36c0

The branch, stream-cleanup has been updated
       via  62db89e3dca29f9b931c62b25014955a4ede36c0 (commit)
      from  17e7050b820314f268996c7f06ae9344a5f4f5c2 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 62db89e3dca29f9b931c62b25014955a4ede36c0
Author: Sergey Poznyakoff <address@hidden>
Date:   Sat May 1 20:51:57 2010 +0300

    Bugfixes.
    
    * mailbox/rfc2047.c (mu_rfc2047_decode): Rewind in_stream.
    * mailbox/stream.c (_stream_scandelim): Break the loop when
    the delimiter is found.
    * mailbox/streamref.c (_streamref_readdelim): Take into account
    the abridgement.

-----------------------------------------------------------------------

Summary of changes:
 mailbox/rfc2047.c   |    1 +
 mailbox/stream.c    |    2 ++
 mailbox/streamref.c |   30 +++++++++++++++++++++++++++---
 3 files changed, 30 insertions(+), 3 deletions(-)

diff --git a/mailbox/rfc2047.c b/mailbox/rfc2047.c
index a5f61b4..df19d9f 100644
--- a/mailbox/rfc2047.c
+++ b/mailbox/rfc2047.c
@@ -162,6 +162,7 @@ mu_rfc2047_decode (const char *tocode, const char *input, 
char **ptostr)
 
          mu_memory_stream_create (&in_stream, 0);
          mu_stream_write (in_stream, encoded_text, size, NULL);
+         mu_stream_seek (in_stream, 0, MU_SEEK_SET, NULL);
          status = mu_decode_filter (&filter, in_stream, filter_type, fromcode,
                                     tocode);
          if (status != 0)
diff --git a/mailbox/stream.c b/mailbox/stream.c
index 21e4fec..4e74caf 100644
--- a/mailbox/stream.c
+++ b/mailbox/stream.c
@@ -563,6 +563,8 @@ _stream_scandelim (mu_stream_t stream, char *buf, size_t 
size, int delim,
       buf += len;
       size -= len;
       nread += len;
+      if (p) /* Delimiter found */
+       break;
     }
   *buf = 0;
   *pnread = nread;
diff --git a/mailbox/streamref.c b/mailbox/streamref.c
index 0cad3fa..de5fec8 100644
--- a/mailbox/streamref.c
+++ b/mailbox/streamref.c
@@ -73,9 +73,33 @@ _streamref_readdelim (struct _mu_stream *str, char *buf, 
size_t bufsize,
                      int delim, size_t *pnread)
 {
   struct _mu_streamref *sp = (struct _mu_streamref *)str;
-  return streamref_return (sp, mu_stream_readdelim (sp->transport,
-                                                   buf, bufsize,
-                                                   delim, pnread));
+  int rc;
+  size_t nread;
+  mu_off_t off;
+  
+  rc = mu_stream_seek (sp->transport, sp->offset, MU_SEEK_SET, &off);
+  if (rc == 0)
+    {
+      if (sp->end)
+       {
+         size_t size = sp->end - off + 2; /* extra 1 to account for \0 */
+         if (size < bufsize)
+           bufsize = size;
+       }
+      rc = mu_stream_readdelim (sp->transport, buf, bufsize, delim, &nread);
+      if (rc == 0)
+       {
+         sp->offset += nread;
+         *pnread = nread;
+       }
+    }
+  else if (rc == ESPIPE)
+    {
+      *pnread = 0;
+      mu_stream_clearerr (sp->transport);
+      return 0;
+    }
+  return streamref_return (sp, rc);
 }
 
 static int


hooks/post-receive
-- 
GNU Mailutils




reply via email to

[Prev in Thread] Current Thread [Next in Thread]