commit-mailutils
[Top][All Lists]
Advanced

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

[SCM] GNU Mailutils branch, master, updated. release-2.2-99-g5984fc0


From: Wojciech Polak
Subject: [SCM] GNU Mailutils branch, master, updated. release-2.2-99-g5984fc0
Date: Tue, 21 Sep 2010 17:47:57 +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=5984fc0cd9f8841e574991ba8155cb1448389af3

The branch, master has been updated
       via  5984fc0cd9f8841e574991ba8155cb1448389af3 (commit)
      from  89ea7423fc240601e018851dbb219a07d476e1d4 (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 5984fc0cd9f8841e574991ba8155cb1448389af3
Author: Wojciech Polak <address@hidden>
Date:   Tue Sep 21 19:42:11 2010 +0200

    Update C++ API and the examples.
    
    * include/mailutils/cpp/pop3.h (capa): Add reread parameter.
    (getline): Add new prototype.
    (send, readline): Remove.
    (response, stat): Change prototype.
    * libmu_cpp/pop3.cc: Likewise.
    * include/mailutils/cpp/stream.h
    (read, write, readline): Change prototype.
    (sequential_readline, sequential_write): Remove.
    * libmu_cpp/stream.cc: Likewise.

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

Summary of changes:
 examples/cpp/iconv.cc          |    8 +++---
 examples/cpp/mimetest.cc       |    4 +--
 examples/cpp/msg-send.cc       |    2 +-
 examples/cpp/murun.cc          |   10 ++++----
 include/mailutils/cpp/pop3.h   |    9 +++----
 include/mailutils/cpp/stream.h |   11 ++++-----
 libmu_cpp/pop3.cc              |   32 ++++++++------------------
 libmu_cpp/stream.cc            |   48 +++++++++++++++++----------------------
 8 files changed, 51 insertions(+), 73 deletions(-)

diff --git a/examples/cpp/iconv.cc b/examples/cpp/iconv.cc
index 2901784..e94c47b 100644
--- a/examples/cpp/iconv.cc
+++ b/examples/cpp/iconv.cc
@@ -39,7 +39,7 @@ main (int argc, char **argv)
     }
 
   try {
-    StdioStream *in = new StdioStream (stdin, 0);
+    StdioStream *in = new StdioStream (MU_STDIN_FD, 0);
     in->open ();
 
     FilterIconvStream cvt (*in, (string)argv[1], (string)argv[2], 0,
@@ -47,12 +47,12 @@ main (int argc, char **argv)
     cvt.open ();
     delete in;
     
-    StdioStream out (stdout, 0);
+    StdioStream out (MU_STDOUT_FD, 0);
     out.open ();
 
     do {
-      cvt.read (buffer, sizeof (buffer), total);
-      out.sequential_write (buffer, cvt.get_read_count ());
+      cvt.read (buffer, sizeof (buffer));
+      out.write (buffer, cvt.get_read_count ());
       total += cvt.get_read_count ();
     } while (cvt.get_read_count ());
 
diff --git a/examples/cpp/mimetest.cc b/examples/cpp/mimetest.cc
index 40249ed..2215b94 100644
--- a/examples/cpp/mimetest.cc
+++ b/examples/cpp/mimetest.cc
@@ -187,14 +187,12 @@ message_display_parts (Message& msg, int indent)
          Stream stream = body.get_stream ();
 
          FilterStream filter (stream, encoding, 0, 0);
-          int offset = 0;
          char buf[2048];
 
-          while (filter.readline (buf, sizeof (buf), offset) == 0 &&
+          while (filter.readline (buf, sizeof (buf)) == 0 &&
                 filter.get_read_count ())
             {
              cout << setw (indent) << setfill (' ') << buf;
-              offset += filter.get_read_count ();
             }
         }
       else
diff --git a/examples/cpp/msg-send.cc b/examples/cpp/msg-send.cc
index 1c5eac6..79b300d 100644
--- a/examples/cpp/msg-send.cc
+++ b/examples/cpp/msg-send.cc
@@ -88,7 +88,7 @@ main (int argc, char *argv[])
     }
 
   try {
-    StdioStream in (stdin, MU_STREAM_SEEK);
+    StdioStream in (MU_STDIN_FD, MU_STREAM_SEEK);
     in.open ();
 
     Message msg;
diff --git a/examples/cpp/murun.cc b/examples/cpp/murun.cc
index 13d3020..6dc1e1a 100644
--- a/examples/cpp/murun.cc
+++ b/examples/cpp/murun.cc
@@ -33,11 +33,11 @@ read_and_print (Stream *in, Stream& out)
 {
   char buffer[128];
   
-  in->sequential_readline (buffer, sizeof (buffer));
+  in->readline (buffer, sizeof (buffer));
   while (in->get_read_count ())
     {
-      out.sequential_write (buffer, in->get_read_count ());
-      in->sequential_readline (buffer, sizeof (buffer));
+      out.write (buffer, in->get_read_count ());
+      in->readline (buffer, sizeof (buffer));
     }
 }
 
@@ -47,7 +47,7 @@ create_filter (bool read_stdin, char *cmdline, int flags)
   try {
     if (read_stdin)
       {
-       StdioStream *in = new StdioStream (stdin, 0);
+       StdioStream *in = new StdioStream (MU_STDIN_FD, 0);
        in->open ();
        FilterProgStream *stream = new FilterProgStream (cmdline, in);
        stream->open ();
@@ -96,7 +96,7 @@ main (int argc, char *argv[])
   stream = create_filter (read_stdin, cmdline, flags);
 
   try {
-    StdioStream out (stdout, 0);
+    StdioStream out (MU_STDOUT_FD, 0);
     out.open ();
 
     read_and_print (stream, out);
diff --git a/include/mailutils/cpp/pop3.h b/include/mailutils/cpp/pop3.h
index 943e79a..bd288e5 100644
--- a/include/mailutils/cpp/pop3.h
+++ b/include/mailutils/cpp/pop3.h
@@ -51,7 +51,7 @@ class Pop3
 
   void apop (const char* name, const char* digest);
   void stls ();
-  Iterator& capa ();
+  Iterator& capa (bool reread);
   void dele (unsigned int msgno);
   size_t list (unsigned int msgno);
   Iterator& list_all ();
@@ -60,16 +60,15 @@ class Pop3
   void quit ();
   Stream& retr (unsigned int msgno);
   void rset ();
-  void stat (unsigned int* count, size_t* octets);
+  void stat (unsigned int* count, mu_off_t* octets);
   Stream& top (unsigned int msgno, unsigned int lines);
   std::string uidl  (unsigned int msgno);
   Iterator& uidl_all ();
   void user (const char* user);
 
-  size_t readline (char* buf, size_t buflen);
-  size_t response (char* buf, size_t buflen);
+  void getline ();
+  void response (size_t* nread);
   void sendline (const char* line);
-  void send ();
 };
 
 }
diff --git a/include/mailutils/cpp/stream.h b/include/mailutils/cpp/stream.h
index be05203..5b67b58 100644
--- a/include/mailutils/cpp/stream.h
+++ b/include/mailutils/cpp/stream.h
@@ -68,11 +68,10 @@ class Stream
   void set_waitflags (int flags);
   void wait (); // timeval is missing
   void wait (int flags); // timeval is missing
-  int  read (char* rbuf, size_t size, off_t offset);
-  int  write (const std::string& wbuf, size_t size, off_t offset);
-  int  readline (char* rbuf, size_t size, off_t offset);
-  void sequential_readline (char* rbuf, size_t size);
-  void sequential_write (const std::string& wbuf, size_t size);
+  int  read (void* rbuf, size_t size);
+  int  write (void* wbuf, size_t size);
+  int  write (const std::string& wbuf, size_t size);
+  int  readline (char* rbuf, size_t size);
   void flush ();
 
   // Inlines
@@ -108,7 +107,7 @@ class FileStream : public Stream
 class StdioStream : public Stream
 {
  public:
-  StdioStream (FILE*, int);
+  StdioStream (int fd, int flags);
 };
 
 class ProgStream : public Stream
diff --git a/libmu_cpp/pop3.cc b/libmu_cpp/pop3.cc
index 7979669..8ca7c5d 100644
--- a/libmu_cpp/pop3.cc
+++ b/libmu_cpp/pop3.cc
@@ -120,11 +120,11 @@ Pop3 :: stls ()
 }
 
 Iterator&
-Pop3 :: capa ()
+Pop3 :: capa (bool reread = false)
 {
   mu_iterator_t mu_itr;
 
-  int status = mu_pop3_capa (pop3, &mu_itr);
+  int status = mu_pop3_capa (pop3, reread, &mu_itr);
   if (status)
     throw Exception ("Pop3::capa", status);
 
@@ -208,7 +208,7 @@ Pop3 :: rset ()
 }
 
 void
-Pop3 :: stat (unsigned int* count, size_t* octets)
+Pop3 :: stat (unsigned int* count, mu_off_t* octets)
 {
   int status = mu_pop3_stat (pop3, count, octets);
   if (status)
@@ -264,22 +264,18 @@ Pop3 :: user (const char* user)
     throw Exception ("Pop3::user", status);
 }
 
-size_t
-Pop3 :: readline (char* buf, size_t buflen)
+void
+Pop3 :: getline ()
 {
-  size_t nread;
-
-  int status = mu_pop3_readline (pop3, buf, buflen, &nread);
+  int status = mu_pop3_getline (pop3);
   if (status)
-    throw Exception ("Pop3::readline", status);
+    throw Exception ("Pop3::getline", status);
 }
 
-size_t
-Pop3 :: response (char* buf, size_t buflen)
+void
+Pop3 :: response (size_t* nread)
 {
-  size_t nread;
-
-  int status = mu_pop3_response (pop3, buf, buflen, &nread);
+  int status = mu_pop3_response (pop3, nread);
   if (status)
     throw Exception ("Pop3::response", status);
 }
@@ -292,11 +288,3 @@ Pop3 :: sendline (const char* line)
     throw Exception ("Pop3::sendline", status);
 }
 
-void
-Pop3 :: send ()
-{
-  int status = mu_pop3_send (pop3);
-  if (status)
-    throw Exception ("Pop3::send", status);
-}
-
diff --git a/libmu_cpp/stream.cc b/libmu_cpp/stream.cc
index d417007..eb95740 100644
--- a/libmu_cpp/stream.cc
+++ b/libmu_cpp/stream.cc
@@ -56,7 +56,7 @@ Stream :: ~Stream ()
     {
       close ();
       if (this->stm)
-       mu_stream_destroy (&stm, NULL);
+       mu_stream_destroy (&stm);
     }
 }
 
@@ -109,9 +109,9 @@ Stream :: wait (int flags)
 }
 
 int
-Stream :: read (char* rbuf, size_t size, off_t offset)
+Stream :: read (void* rbuf, size_t size)
 {
-  int status = mu_stream_read (stm, rbuf, size, offset, &read_count);
+  int status = mu_stream_read (stm, rbuf, size, &read_count);
   if (status == EAGAIN)
     throw Stream::EAgain ("Stream::read", status);
   else if (status)
@@ -120,10 +120,9 @@ Stream :: read (char* rbuf, size_t size, off_t offset)
 }
 
 int
-Stream :: write (const std::string& wbuf, size_t size, off_t offset)
+Stream :: write (void* wbuf, size_t size)
 {
-  int status = mu_stream_write (stm, wbuf.c_str (), size, offset,
-                               &write_count);
+  int status = mu_stream_write (stm, wbuf, size, &write_count);
   if (status == EAGAIN)
     throw Stream::EAgain ("Stream::write", status);
   else if (status)
@@ -132,30 +131,25 @@ Stream :: write (const std::string& wbuf, size_t size, 
off_t offset)
 }
 
 int
-Stream :: readline (char* rbuf, size_t size, off_t offset)
+Stream :: write (const std::string& wbuf, size_t size)
 {
-  int status = mu_stream_readline (stm, rbuf, size, offset, &read_count);
+  int status = mu_stream_write (stm, wbuf.c_str (), size, &write_count);
   if (status == EAGAIN)
-    throw Stream::EAgain ("Stream::readline", status);
+    throw Stream::EAgain ("Stream::write", status);
   else if (status)
-    throw Exception ("Stream::readline", status);
+    throw Exception ("Stream::write", status);
   return status;
 }
 
-void
-Stream :: sequential_readline (char* rbuf, size_t size)
-{
-  int status = mu_stream_sequential_readline (stm, rbuf, size, &read_count);
-  if (status)
-    throw Exception ("Stream::sequential_readline", status);
-}
-
-void
-Stream :: sequential_write (const std::string& wbuf, size_t size)
+int
+Stream :: readline (char* rbuf, size_t size)
 {
-  int status = mu_stream_sequential_write (stm, wbuf.c_str (), size);
-  if (status)
-    throw Exception ("Stream::sequential_write", status);
+  int status = mu_stream_readline (stm, rbuf, size, &read_count);
+  if (status == EAGAIN)
+    throw Stream::EAgain ("Stream::readline", status);
+  else if (status)
+    throw Exception ("Stream::readline", status);
+  return status;
 }
 
 void
@@ -171,7 +165,7 @@ namespace mailutils
   Stream&
   operator << (Stream& stm, const std::string& wbuf)
   {
-    stm.write (wbuf, wbuf.length (), 0);
+    stm.write (wbuf, wbuf.length ());
     return stm;
   }
 
@@ -179,7 +173,7 @@ namespace mailutils
   operator >> (Stream& stm, std::string& rbuf)
   {
     char tmp[1024];
-    stm.read (tmp, sizeof (tmp), 0);
+    stm.read (tmp, sizeof (tmp));
     rbuf = std::string (tmp);
     return stm;
   }
@@ -211,9 +205,9 @@ FileStream :: FileStream (const std::string& filename, int 
flags)
 // StdioStream
 //
 
-StdioStream :: StdioStream (FILE* fp, int flags)
+StdioStream :: StdioStream (int fd, int flags)
 {
-  int status = mu_stdio_stream_create (&stm, fp, flags);
+  int status = mu_stdio_stream_create (&stm, fd, flags);
   if (status)
     throw Exception ("StdioStream::StdioStream", status);
 }


hooks/post-receive
-- 
GNU Mailutils



reply via email to

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