[gmime] Renamed g_mime_stream_[file,fs]_new_for_path() to _open()



commit 5ed6a7c228ad426fb166fac3ced720f979a42f97
Author: Jeffrey Stedfast <jestedfa microsoft com>
Date:   Sat Mar 4 18:10:57 2017 -0500

    Renamed g_mime_stream_[file,fs]_new_for_path() to _open()

 PORTING                   |    6 ++++++
 gmime/gmime-stream-file.c |    6 ++----
 gmime/gmime-stream-file.h |    2 +-
 gmime/gmime-stream-fs.c   |    6 ++----
 gmime/gmime-stream-fs.h   |    2 +-
 tests/test-mbox.c         |   11 +++--------
 tests/test-partial.c      |   18 +++++++++---------
 7 files changed, 24 insertions(+), 27 deletions(-)
---
diff --git a/PORTING b/PORTING
index f4e07e0..61a2825 100644
--- a/PORTING
+++ b/PORTING
@@ -109,6 +109,12 @@ Porting from GMime 2.6 to GMime 3.0
 - GMimeSignatureStatus and GMimeSignatureErrors have been merged into a
   single bitfield (GMimeSignatureStatus) which mirrors gpgme_sigsum_t.
 
+- g_mime_stream_file_new_for_path() has been renamed to
+  g_mime_stream_file_open().
+
+- g_mime_stream_fs_new_for_path() has been renamed to
+  g_mime_stream_fs_open().
+
 
 Porting from GMime 2.4 to GMime 2.6
 -----------------------------------
diff --git a/gmime/gmime-stream-file.c b/gmime/gmime-stream-file.c
index 774eb43..e637e98 100644
--- a/gmime/gmime-stream-file.c
+++ b/gmime/gmime-stream-file.c
@@ -423,7 +423,7 @@ g_mime_stream_file_new_with_bounds (FILE *fp, gint64 start, gint64 end)
 
 
 /**
- * g_mime_stream_file_new_for_path:
+ * g_mime_stream_file_open:
  * @path: the path to a file
  * @mode: as in fopen(3)
  *
@@ -431,11 +431,9 @@ g_mime_stream_file_new_with_bounds (FILE *fp, gint64 start, gint64 end)
  *
  * Returns: a stream using for reading and/or writing to the specified
  * file path or %NULL on error.
- *
- * Since: 2.6.18
  **/
 GMimeStream *
-g_mime_stream_file_new_for_path (const char *path, const char *mode)
+g_mime_stream_file_open (const char *path, const char *mode)
 {
        FILE *fp;
        
diff --git a/gmime/gmime-stream-file.h b/gmime/gmime-stream-file.h
index ed77d59..e0d0b0c 100644
--- a/gmime/gmime-stream-file.h
+++ b/gmime/gmime-stream-file.h
@@ -64,7 +64,7 @@ GType g_mime_stream_file_get_type (void);
 GMimeStream *g_mime_stream_file_new (FILE *fp);
 GMimeStream *g_mime_stream_file_new_with_bounds (FILE *fp, gint64 start, gint64 end);
 
-GMimeStream *g_mime_stream_file_new_for_path (const char *path, const char *mode);
+GMimeStream *g_mime_stream_file_open (const char *path, const char *mode);
 
 gboolean g_mime_stream_file_get_owner (GMimeStreamFile *stream);
 void g_mime_stream_file_set_owner (GMimeStreamFile *stream, gboolean owner);
diff --git a/gmime/gmime-stream-fs.c b/gmime/gmime-stream-fs.c
index 1509272..eccb317 100644
--- a/gmime/gmime-stream-fs.c
+++ b/gmime/gmime-stream-fs.c
@@ -465,7 +465,7 @@ g_mime_stream_fs_new_with_bounds (int fd, gint64 start, gint64 end)
 
 
 /**
- * g_mime_stream_fs_new_for_path:
+ * g_mime_stream_fs_open:
  * @path: the path to a file
  * @flags: as in open(2)
  * @mode: as in open(2)
@@ -474,11 +474,9 @@ g_mime_stream_fs_new_with_bounds (int fd, gint64 start, gint64 end)
  *
  * Returns: a stream using for reading and/or writing to the specified
  * file path or %NULL on error.
- *
- * Since: 2.6.18
  **/
 GMimeStream *
-g_mime_stream_fs_new_for_path (const char *path, int flags, int mode)
+g_mime_stream_fs_open (const char *path, int flags, int mode)
 {
        int fd;
        
diff --git a/gmime/gmime-stream-fs.h b/gmime/gmime-stream-fs.h
index 85b5efe..f58cd4e 100644
--- a/gmime/gmime-stream-fs.h
+++ b/gmime/gmime-stream-fs.h
@@ -64,7 +64,7 @@ GType g_mime_stream_fs_get_type (void);
 GMimeStream *g_mime_stream_fs_new (int fd);
 GMimeStream *g_mime_stream_fs_new_with_bounds (int fd, gint64 start, gint64 end);
 
-GMimeStream *g_mime_stream_fs_new_for_path (const char *path, int flags, int mode);
+GMimeStream *g_mime_stream_fs_open (const char *path, int flags, int mode);
 
 gboolean g_mime_stream_fs_get_owner (GMimeStreamFs *stream);
 void g_mime_stream_fs_set_owner (GMimeStreamFs *stream, gboolean owner);
diff --git a/tests/test-mbox.c b/tests/test-mbox.c
index 35e3a8d..2e36f7f 100644
--- a/tests/test-mbox.c
+++ b/tests/test-mbox.c
@@ -316,20 +316,16 @@ int main (int argc, char **argv)
                        
                        testsuite_check ("%s", dent);
                        try {
-                               if ((fd = open (input, O_RDONLY, 0)) == -1) {
+                               if (!(istream = g_mime_stream_fs_open (input, O_RDONLY, 0))) {
                                        throw (exception_new ("could not open `%s': %s",
                                                              input, g_strerror (errno)));
                                }
                                
-                               istream = g_mime_stream_fs_new (fd);
-                               
-                               if ((fd = open (output, O_RDONLY, 0)) == -1) {
+                               if (!(ostream = g_mime_stream_fs_open (output, O_RDONLY, 0))) {
                                        throw (exception_new ("could not open `%s': %s",
                                                              output, g_strerror (errno)));
                                }
                                
-                               ostream = g_mime_stream_fs_new (fd);
-                               
 #ifdef ENABLE_MBOX_MATCH
                                tmp = g_strdup_printf ("./tmp/%s.XXXXXX", dent);
                                if ((fd = g_mkstemp (tmp)) == -1) {
@@ -395,10 +391,9 @@ int main (int argc, char **argv)
                g_dir_close (dir);
        } else if (S_ISREG (st.st_mode)) {
                /* manually run test on a single file */
-               if ((fd = open (path, O_RDONLY, 0)) == -1)
+               if (!(istream = g_mime_stream_fs_open (path, O_RDONLY, 0)))
                        goto exit;
                
-               istream = g_mime_stream_fs_new (fd);
                parser = g_mime_parser_new_with_stream (istream);
                g_mime_parser_set_scan_from (parser, TRUE);
                
diff --git a/tests/test-partial.c b/tests/test-partial.c
index 6709171..a23d651 100644
--- a/tests/test-partial.c
+++ b/tests/test-partial.c
@@ -142,7 +142,7 @@ int main (int argc, char **argv)
        const char *dent;
        struct stat st;
        char *path;
-       int fd, i;
+       int i;
        
        g_mime_init ();
        
@@ -182,10 +182,9 @@ int main (int argc, char **argv)
                        while ((dent = g_dir_read_name (dir))) {
                                path = g_build_filename (input->str, dent, NULL);
                                
-                               if ((fd = open (path, O_RDONLY, 0)) == -1)
+                               if (!(stream = g_mime_stream_fs_open (path, O_RDONLY, 0)))
                                        throw (exception_new ("Failed to open `%s'", path));
                                
-                               stream = g_mime_stream_fs_new (fd);
                                g_mime_parser_init_with_stream (parser, stream);
                                g_object_unref (stream);
                                
@@ -212,18 +211,15 @@ int main (int argc, char **argv)
                        g_mime_stream_reset (combined);
                        g_object_unref (message);
                        
-                       if ((fd = open (output->str, O_RDONLY, 0)) == -1) {
-                               fd = open (output->str, O_WRONLY | O_CREAT | O_TRUNC, 0644);
-                               expected = g_mime_stream_fs_new (fd);
+                       if (!(expected = g_mime_stream_fs_open (output->str, O_RDONLY, 0))) {
+                               expected = g_mime_stream_fs_open (output->str, O_WRONLY | O_CREAT | O_TRUNC, 
0644);
                                g_mime_stream_write_to_stream (combined, expected);
                                g_object_unref (expected);
-                               
                                g_object_unref (combined);
+                               
                                throw (exception_new ("Failed to open `%s'", output->str));
                        }
                        
-                       expected = g_mime_stream_fs_new (fd);
-                       
                        if (!streams_match (expected, combined)) {
                                g_object_unref (combined);
                                g_object_unref (expected);
@@ -252,6 +248,10 @@ int main (int argc, char **argv)
        }
        
  exit:
+       g_string_free (output, TRUE);
+       g_string_free (input, TRUE);
+       g_dir_close (data);
+       
        testsuite_end ();
        
        g_mime_shutdown ();


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