[easytag] Use GFile for tag reading functions



commit 5f44956e440f3bcf0627015d92ee241578d21040
Author: David King <amigadave amigadave com>
Date:   Wed Oct 29 16:36:27 2014 +0000

    Use GFile for tag reading functions

 src/et_core.c          |   12 ++++----
 src/tags/ape_tag.c     |   18 ++++++++----
 src/tags/ape_tag.h     |    2 +-
 src/tags/flac_tag.c    |   16 +++++++---
 src/tags/flac_tag.h    |    2 +-
 src/tags/id3_tag.c     |    5 ++-
 src/tags/id3_tag.h     |    2 +-
 src/tags/id3v24_tag.c  |   73 +++++++++++++++++++++++++++++++++--------------
 src/tags/mp4_tag.cc    |   23 ++++----------
 src/tags/mp4_tag.h     |    2 +-
 src/tags/ogg_tag.c     |   19 ++++++------
 src/tags/ogg_tag.h     |    3 +-
 src/tags/wavpack_tag.c |    7 +++-
 src/tags/wavpack_tag.h |    2 +-
 14 files changed, 110 insertions(+), 76 deletions(-)
---
diff --git a/src/et_core.c b/src/et_core.c
index 30ef00e..028ae12 100644
--- a/src/et_core.c
+++ b/src/et_core.c
@@ -528,7 +528,7 @@ GList *ET_Add_File_To_File_List (gchar *filename)
     {
 #ifdef ENABLE_MP3
         case ID3_TAG:
-            if (!id3tag_read_file_tag (filename, FileTag, &error))
+            if (!id3tag_read_file_tag (file, FileTag, &error))
             {
                 Log_Print (LOG_ERROR,
                            "Error reading ID3 tag from file ‘%s’: %s",
@@ -539,7 +539,7 @@ GList *ET_Add_File_To_File_List (gchar *filename)
 #endif
 #ifdef ENABLE_OGG
         case OGG_TAG:
-            if (!ogg_tag_read_file_tag (filename, FileTag, &error))
+            if (!ogg_tag_read_file_tag (file, FileTag, &error))
             {
                 Log_Print (LOG_ERROR,
                            _("Error reading tag from Ogg file ‘%s’: %s"),
@@ -550,7 +550,7 @@ GList *ET_Add_File_To_File_List (gchar *filename)
 #endif
 #ifdef ENABLE_FLAC
         case FLAC_TAG:
-            if (!flac_tag_read_file_tag (filename, FileTag, &error))
+            if (!flac_tag_read_file_tag (file, FileTag, &error))
             {
                 Log_Print (LOG_ERROR,
                            _("Error reading tag from FLAC file ‘%s’: %s"),
@@ -560,7 +560,7 @@ GList *ET_Add_File_To_File_List (gchar *filename)
             break;
 #endif
         case APE_TAG:
-            if (!ape_tag_read_file_tag (filename, FileTag, &error))
+            if (!ape_tag_read_file_tag (file, FileTag, &error))
             {
                 Log_Print (LOG_ERROR,
                            _("Error reading APE tag from file ‘%s’: %s"),
@@ -570,7 +570,7 @@ GList *ET_Add_File_To_File_List (gchar *filename)
             break;
 #ifdef ENABLE_MP4
         case MP4_TAG:
-            if (!mp4tag_read_file_tag (filename, FileTag, &error))
+            if (!mp4tag_read_file_tag (file, FileTag, &error))
             {
                 Log_Print (LOG_ERROR,
                            _("Error reading tag from MP4 file ‘%s’: %s"),
@@ -581,7 +581,7 @@ GList *ET_Add_File_To_File_List (gchar *filename)
 #endif
 #ifdef ENABLE_WAVPACK
         case WAVPACK_TAG:
-            if (!wavpack_tag_read_file_tag (filename, FileTag, &error))
+            if (!wavpack_tag_read_file_tag (file, FileTag, &error))
             {
                 Log_Print (LOG_ERROR,
                            _("Error reading tag from WavPack file ‘%s’: %s"),
diff --git a/src/tags/ape_tag.c b/src/tags/ape_tag.c
index 04ef8b2..6e9f46c 100644
--- a/src/tags/ape_tag.c
+++ b/src/tags/ape_tag.c
@@ -46,28 +46,34 @@
  *  - if field is found but contains no info (strlen(str)==0), we don't read it
  */
 gboolean
-ape_tag_read_file_tag (const gchar *filename,
+ape_tag_read_file_tag (GFile *file,
                        File_Tag *FileTag,
                        GError **error)
 {
-    FILE *file;
+    FILE *fp;
+    gchar *filename;
     gchar *string = NULL;
     gchar *string1 = NULL;
     apetag *ape_cnt;
 
-    g_return_val_if_fail (filename != NULL && FileTag != NULL, FALSE);
+    g_return_val_if_fail (file != NULL && FileTag != NULL, FALSE);
     g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
 
-    if ((file = fopen (filename, "rb")) == NULL)
+    filename = g_file_get_path (file);
+
+    if ((fp = fopen (filename, "rb")) == NULL)
     {
         g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (errno),
                      _("Error while opening file: %s"),
                      g_strerror (errno));
+        g_free (filename);
         return FALSE;
     }
 
     ape_cnt = apetag_init();
-    apetag_read_fp(ape_cnt, file, filename, 0); /* read all tags ape,id3v[12]*/
+    apetag_read_fp (ape_cnt, fp, filename, 0); /* read all tags ape,id3v[12]*/
+
+    g_free (filename);
 
     /*********
      * Title *
@@ -198,7 +204,7 @@ ape_tag_read_file_tag (const gchar *filename,
         FileTag->encoded_by = Try_To_Validate_Utf8_String(string);
 
     apetag_free(ape_cnt);
-    fclose(file);
+    fclose (fp);
 
     return TRUE;
 }
diff --git a/src/tags/ape_tag.h b/src/tags/ape_tag.h
index 428218d..f16120e 100644
--- a/src/tags/ape_tag.h
+++ b/src/tags/ape_tag.h
@@ -25,7 +25,7 @@
 
 G_BEGIN_DECLS
 
-gboolean ape_tag_read_file_tag (const gchar *filename, File_Tag *FileTag, GError **error);
+gboolean ape_tag_read_file_tag (GFile *file, File_Tag *FileTag, GError **error);
 gboolean ape_tag_write_file_tag (const ET_File *ETFile, GError **error);
 
 G_END_DECLS
diff --git a/src/tags/flac_tag.c b/src/tags/flac_tag.c
index acb5ea8..57c4303 100644
--- a/src/tags/flac_tag.c
+++ b/src/tags/flac_tag.c
@@ -98,23 +98,26 @@ static gboolean Flac_Set_Tag (FLAC__StreamMetadata *vc_block, const gchar *tag_n
  *  - if field is found but contains no info (strlen(str)==0), we don't read it
  */
 gboolean
-flac_tag_read_file_tag (const gchar *filename,
+flac_tag_read_file_tag (GFile *file,
                         File_Tag *FileTag,
                         GError **error)
 {
     FLAC__Metadata_SimpleIterator *iter;
     const gchar *flac_error_msg;
     gchar *string = NULL;
-    gchar *filename_utf8 = filename_to_display(filename);
+    gchar *filename;
+    gchar *filename_utf8;
     guint i;
     Picture *prev_pic = NULL;
     //gint j = 1;
 
-    g_return_val_if_fail (filename != NULL && FileTag != NULL, FALSE);
+    g_return_val_if_fail (file != NULL && FileTag != NULL, FALSE);
     g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
 
-    // Initialize the iterator for the blocks
+    /* Initialize the iterator for the blocks. */
+    filename = g_file_get_path (file);
     iter = FLAC__metadata_simple_iterator_new();
+
     if ( iter == NULL || !FLAC__metadata_simple_iterator_init(iter, filename, true, false) )
     {
         if ( iter == NULL )
@@ -132,9 +135,12 @@ flac_tag_read_file_tag (const gchar *filename,
 
         g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED,
                      _("Error while opening file: %s"), flac_error_msg);
+        g_free (filename);
         return FALSE;
     }
     
+    filename_utf8 = filename_to_display (filename);
+    g_free (filename);
 
     /* libFLAC is able to detect (and skip) ID3v2 tags by itself */
 
@@ -733,7 +739,7 @@ flac_tag_read_file_tag (const gchar *filename,
       && FileTag->encoded_by  == NULL
       && FileTag->picture     == NULL)
     {
-        gboolean rc = id3tag_read_file_tag (filename, FileTag, NULL);
+        gboolean rc = id3tag_read_file_tag (file, FileTag, NULL);
 
         // If an ID3 tag has been found (and no FLAC tag), we mark the file as
         // unsaved to rewrite a flac tag.
diff --git a/src/tags/flac_tag.h b/src/tags/flac_tag.h
index 2b0e20e..85da0c9 100644
--- a/src/tags/flac_tag.h
+++ b/src/tags/flac_tag.h
@@ -26,7 +26,7 @@
 
 G_BEGIN_DECLS
 
-gboolean flac_tag_read_file_tag (const gchar *filename, File_Tag *FileTag, GError **error);
+gboolean flac_tag_read_file_tag (GFile *file, File_Tag *FileTag, GError **error);
 gboolean flac_tag_write_file_tag (const ET_File *ETFile, GError **error);
 
 G_END_DECLS
diff --git a/src/tags/id3_tag.c b/src/tags/id3_tag.c
index e3c5b0a..ccbb4de 100644
--- a/src/tags/id3_tag.c
+++ b/src/tags/id3_tag.c
@@ -220,7 +220,6 @@ id3tag_write_file_v23tag (const ET_File *ETFile,
         g_object_unref (file);
         return FALSE;
     }
-    g_object_unref (file);
 
     /* We get again the tag from the file to keep also unused data (by EasyTAG), then
      * we replace the changed data */
@@ -228,6 +227,7 @@ id3tag_write_file_v23tag (const ET_File *ETFile,
     {
         g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_NOMEM, "%s",
                      g_strerror (ENOMEM));
+        g_object_unref (file);
         return FALSE;
     }
 
@@ -655,7 +655,7 @@ id3tag_write_file_v23tag (const ET_File *ETFile,
                                                "id3v2-enable-unicode"))
                 {
                     File_Tag  *FileTag_tmp = ET_File_Tag_Item_New();
-                    if (id3tag_read_file_tag (filename, FileTag_tmp, NULL) == TRUE
+                    if (id3tag_read_file_tag (file, FileTag_tmp, NULL) == TRUE
                     &&  ET_Detect_Changes_Of_File_Tag(FileTag,FileTag_tmp) == TRUE)
                     {
                         GtkWidget *msgdialog;
@@ -737,6 +737,7 @@ id3tag_write_file_v23tag (const ET_File *ETFile,
 
     /* Free allocated data */
     ID3Tag_Delete(id3_tag);
+    g_object_unref (file);
     g_free(basename_utf8);
 
     return success;
diff --git a/src/tags/id3_tag.h b/src/tags/id3_tag.h
index dd9ec06..fd72dcc 100644
--- a/src/tags/id3_tag.h
+++ b/src/tags/id3_tag.h
@@ -27,7 +27,7 @@ G_BEGIN_DECLS
 
 #define ID3_INVALID_GENRE 255
 
-gboolean id3tag_read_file_tag (const gchar *filename, File_Tag *FileTag, GError **error);
+gboolean id3tag_read_file_tag (GFile *file, File_Tag *FileTag, GError **error);
 gboolean id3tag_write_file_v24tag (const ET_File *ETFile, GError **error);
 gboolean id3tag_write_file_tag (const ET_File *ETFile, GError **error);
 
diff --git a/src/tags/id3v24_tag.c b/src/tags/id3v24_tag.c
index 4922349..76ab6f2 100644
--- a/src/tags/id3v24_tag.c
+++ b/src/tags/id3v24_tag.c
@@ -91,11 +91,14 @@ static gboolean etag_write_tags (const gchar *filename, struct id3_tag const *v1
  * If a tag entry exists (ex: title), we allocate memory, else value stays to NULL
  */
 gboolean
-id3tag_read_file_tag (const gchar *filename,
+id3tag_read_file_tag (GFile *gfile,
                       File_Tag *FileTag,
                       GError **error)
 {
-    int tmpfile;
+    GInputStream *istream;
+    gsize bytes_read;
+    GSeekable *seekable;
+    gchar *filename;
     struct id3_file *file;
     struct id3_tag *tag;
     struct id3_frame *frame;
@@ -106,29 +109,33 @@ id3tag_read_file_tag (const gchar *filename,
     unsigned tmpupdate, update = 0;
     long tagsize;
 
-    g_return_val_if_fail (filename != NULL && FileTag != NULL, FALSE);
+    g_return_val_if_fail (gfile != NULL && FileTag != NULL, FALSE);
     g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
 
-    if ((tmpfile = open (filename, O_RDONLY)) < 0)
+    istream = G_INPUT_STREAM (g_file_read (gfile, NULL, error));
+
+    if (!istream)
     {
-        g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (errno),
-                     _("Error while opening file: %s"), g_strerror (errno));
         return FALSE;
     }
 
-    string1 = g_try_malloc(ID3_TAG_QUERYSIZE);
-    if (string1==NULL)
+    string1 = g_malloc0 (ID3_TAG_QUERYSIZE);
+
+    /* Check if the file has an ID3v2 tag or/and an ID3v1 tags.
+     * 1) ID3v2 tag. */
+    if (!g_input_stream_read_all (istream, string1, ID3_TAG_QUERYSIZE,
+                                  &bytes_read, NULL, error))
     {
-        close(tmpfile);
+        g_object_unref (istream);
+        g_free (string1);
         return FALSE;
     }
-
-    // Check if the file has an ID3v2 tag or/and an ID3v1 tags
-    // 1) ID3v2 tag
-    if (read(tmpfile, string1, ID3_TAG_QUERYSIZE) != ID3_TAG_QUERYSIZE)
+    else if (bytes_read != ID3_TAG_QUERYSIZE)
     {
-        close(tmpfile);
+        g_object_unref (istream);
         g_free (string1);
+        g_set_error (error, G_IO_ERROR, G_IO_ERROR_PARTIAL_INPUT, "%s",
+                     _("Error reading tags from file"));
         return FALSE;
     }
 
@@ -148,7 +155,11 @@ id3tag_read_file_tag (const gchar *filename,
             /* Determine version if user want to upgrade old tags */
             if (g_settings_get_boolean (MainSettings, "id3v2-convert-old")
             && (string1 = g_realloc (string1, tagsize))
-            && (read(tmpfile, &string1[ID3_TAG_QUERYSIZE], tagsize - ID3_TAG_QUERYSIZE) == tagsize - 
ID3_TAG_QUERYSIZE)
+                && g_input_stream_read_all (istream,
+                                            &string1[ID3_TAG_QUERYSIZE],
+                                            tagsize - ID3_TAG_QUERYSIZE,
+                                            &bytes_read, NULL, error)
+                && bytes_read == tagsize - ID3_TAG_QUERYSIZE
             && (tag = id3_tag_parse((id3_byte_t const *)string1, tagsize))
                )
             {
@@ -171,10 +182,24 @@ id3tag_read_file_tag (const gchar *filename,
         }
     }
 
-    // 2) ID3v1 tag
-    if ( (lseek(tmpfile,-128, SEEK_END) >= 0) // Go to the beginning of ID3v1 tag
+    /* 2) ID3v1 tag. */
+    seekable = G_SEEKABLE (istream);
+
+    if (!g_seekable_can_seek (seekable))
+    {
+        g_object_unref (istream);
+        g_free (string1);
+        g_set_error (error, G_IO_ERROR, G_IO_ERROR_PARTIAL_INPUT, "%s",
+                     _("Error reading tags from file"));
+        return FALSE;
+    }
+
+    /* Go to the beginning of ID3v1 tag. */
+    if (g_seekable_seek (seekable, -128, G_SEEK_END, NULL, error)
     && (string1)
-    && (read(tmpfile, string1, 3) == 3)
+        && g_input_stream_read_all (istream, string1, 3, &bytes_read, NULL,
+                                    NULL /* Ignore errors. */)
+        && bytes_read == 3
     && (string1[0] == 'T')
     && (string1[1] == 'A')
     && (string1[2] == 'G')
@@ -194,15 +219,19 @@ id3tag_read_file_tag (const gchar *filename,
         }
     }
 
-    g_free(string1);
+    g_free (string1);
+    g_object_unref (istream);
+
+    filename = g_file_get_path (gfile);
 
-    /* Takes ownership of the file descriptor on success. */
-    if ((file = id3_file_fdopen(tmpfile, ID3_FILE_MODE_READONLY)) == NULL)
+    if ((file = id3_file_open (filename, ID3_FILE_MODE_READONLY)) == NULL)
     {
-        close(tmpfile);
+        g_free (filename);
         return FALSE;
     }
 
+    g_free (filename);
+
     if ( ((tag = id3_file_tag(file)) == NULL)
     ||   (tag->nframes == 0))
     {
diff --git a/src/tags/mp4_tag.cc b/src/tags/mp4_tag.cc
index 7181d46..068cf9f 100644
--- a/src/tags/mp4_tag.cc
+++ b/src/tags/mp4_tag.cc
@@ -48,61 +48,52 @@
  * Read tag data into an Mp4 file.
  */
 gboolean
-mp4tag_read_file_tag (const gchar *filename,
+mp4tag_read_file_tag (GFile *file,
                       File_Tag *FileTag,
                       GError **error)
 {
     TagLib::MP4::Tag *tag;
     guint year;
 
-    g_return_val_if_fail (filename != NULL && FileTag != NULL, FALSE);
+    g_return_val_if_fail (file != NULL && FileTag != NULL, FALSE);
 
     /* Get data from tag. */
-    GFile *file = g_file_new_for_path (filename);
     GIO_InputStream stream (file);
 
     if (!stream.isOpen ())
     {
-        gchar *filename_utf8 = filename_to_display (filename);
         const GError *tmp_error = stream.getError ();
         g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED,
-                     _("Error while opening file ‘%s’: %s"), filename_utf8,
-                     tmp_error->message);
-        g_free (filename_utf8);
+                     _("Error while opening file: %s"), tmp_error->message);
         return FALSE;
     }
 
     TagLib::MP4::File mp4file (&stream);
-    g_object_unref (file);
 
     if (!mp4file.isOpen ())
     {
-        gchar *filename_utf8 = filename_to_display (filename);
         const GError *tmp_error = stream.getError ();
 
         if (tmp_error)
         {
             g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED,
-                         _("Error while opening file ‘%s’: %s"), filename_utf8,
+                         _("Error while opening file: %s"),
                          tmp_error->message);
         }
         else
         {
             g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED,
-                         _("Error while opening file ‘%s’: %s"), filename_utf8,
+                         _("Error while opening file: %s"),
                          _("MP4 format invalid"));
         }
 
-        g_free (filename_utf8);
         return FALSE;
     }
 
     if (!(tag = mp4file.tag ()))
     {
-        gchar *filename_utf8 = filename_to_display (filename);
-        g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED,
-                     _("Error reading tags from file ‘%s’"), filename_utf8);
-        g_free (filename_utf8);
+        g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED, "%s",
+                     _("Error reading tags from file"));
         return FALSE;
     }
 
diff --git a/src/tags/mp4_tag.h b/src/tags/mp4_tag.h
index 9dcbea2..8061bcd 100644
--- a/src/tags/mp4_tag.h
+++ b/src/tags/mp4_tag.h
@@ -25,7 +25,7 @@
 
 G_BEGIN_DECLS
 
-gboolean mp4tag_read_file_tag (const gchar *filename, File_Tag *FileTag, GError **error);
+gboolean mp4tag_read_file_tag (GFile *file, File_Tag *FileTag, GError **error);
 gboolean mp4tag_write_file_tag (const ET_File *ETFile, GError **error);
 
 G_END_DECLS
diff --git a/src/tags/ogg_tag.c b/src/tags/ogg_tag.c
index 0203318..64eaa17 100644
--- a/src/tags/ogg_tag.c
+++ b/src/tags/ogg_tag.c
@@ -634,27 +634,29 @@ et_add_file_tags_from_vorbis_comments (vorbis_comment *vc, File_Tag *FileTag,
  *  - if field is found but contains no info (strlen(str)==0), we don't read it
  */
 gboolean
-ogg_tag_read_file_tag (const gchar *filename, File_Tag *FileTag, GError **error)
+ogg_tag_read_file_tag (GFile *file,
+                       File_Tag *FileTag,
+                       GError **error)
 {
-    GFile *file;
     GFileInputStream *istream;
     vcedit_state   *state;
+    gchar *filename;
     gchar *filename_utf8;
 
-    g_return_val_if_fail (filename != NULL && FileTag != NULL, FALSE);
+    g_return_val_if_fail (file != NULL && FileTag != NULL, FALSE);
     g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
 
-    file = g_file_new_for_path (filename);
     istream = g_file_read (file, NULL, error);
 
     if (!istream)
     {
-        g_object_unref (file);
         g_assert (error == NULL || *error != NULL);
         return FALSE;
     }
 
+    filename = g_file_get_path (file);
     filename_utf8 = filename_to_display (filename);
+    g_free (filename);
 
     {
     // Skip the id3v2 tag
@@ -728,7 +730,6 @@ ogg_tag_read_file_tag (const gchar *filename, File_Tag *FileTag, GError **error)
     if (!vcedit_open (state, file, error))
     {
         g_assert (error == NULL || *error != NULL);
-        g_object_unref (file);
         vcedit_clear(state);
         g_free (filename_utf8);
         return FALSE;
@@ -746,8 +747,7 @@ ogg_tag_read_file_tag (const gchar *filename, File_Tag *FileTag, GError **error)
     et_add_file_tags_from_vorbis_comments (vcedit_comments(state), FileTag,
                                            filename_utf8);
     vcedit_clear(state);
-    g_object_unref (file);
-    g_free(filename_utf8);
+    g_free (filename_utf8);
 
     return TRUE;
 
@@ -755,8 +755,7 @@ err:
     g_assert (error == NULL || *error != NULL);
     g_object_unref (istream);
     g_object_unref (istream);
-    g_object_unref (file);
-    g_free(filename_utf8);
+    g_free (filename_utf8);
     return FALSE;
 }
 
diff --git a/src/tags/ogg_tag.h b/src/tags/ogg_tag.h
index eaf8051..7c9e4dd 100644
--- a/src/tags/ogg_tag.h
+++ b/src/tags/ogg_tag.h
@@ -31,8 +31,7 @@
 
 G_BEGIN_DECLS
 
-gboolean ogg_tag_read_file_tag (const gchar *filename, File_Tag *FileTag,
-                                GError **error);
+gboolean ogg_tag_read_file_tag (GFile *file, File_Tag *FileTag, GError **error);
 gboolean ogg_tag_write_file_tag (const ET_File *ETFile, GError **error);
 
 void et_add_file_tags_from_vorbis_comments (vorbis_comment *vc, File_Tag *FileTag, const gchar 
*filename_utf8);
diff --git a/src/tags/wavpack_tag.c b/src/tags/wavpack_tag.c
index faa2092..f9a81aa 100644
--- a/src/tags/wavpack_tag.c
+++ b/src/tags/wavpack_tag.c
@@ -65,10 +65,11 @@
  * Read tag data from a Wavpack file.
  */
 gboolean
-wavpack_tag_read_file_tag (const gchar *filename,
+wavpack_tag_read_file_tag (GFile *file,
                            File_Tag *FileTag,
                            GError **error)
 {
+    gchar *filename;
     WavpackContext *wpc;
     gchar message[80];
     gchar *field, *field2;
@@ -76,11 +77,13 @@ wavpack_tag_read_file_tag (const gchar *filename,
 
     int open_flags = OPEN_TAGS;
 
-    g_return_val_if_fail (filename != NULL && FileTag != NULL, FALSE);
+    g_return_val_if_fail (file != NULL && FileTag != NULL, FALSE);
     g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
 
     /* TODO: Use WavpackOpenFileInputEx() instead. */
+    filename = g_file_get_path (file);
     wpc = WavpackOpenFileInput (filename, message, open_flags, 0);
+    g_free (filename);
 
     if (wpc == NULL)
     {
diff --git a/src/tags/wavpack_tag.h b/src/tags/wavpack_tag.h
index 63c66d6..0a316c0 100644
--- a/src/tags/wavpack_tag.h
+++ b/src/tags/wavpack_tag.h
@@ -25,7 +25,7 @@
 
 G_BEGIN_DECLS
 
-gboolean wavpack_tag_read_file_tag (const gchar *filename, File_Tag *FileTag, GError **error);
+gboolean wavpack_tag_read_file_tag (GFile *file, File_Tag *FileTag, GError **error);
 gboolean wavpack_tag_write_file_tag (const ET_File *ETFile, GError **error);
 
 G_END_DECLS


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