[easytag/wip/ogg-errors: 3/3] Ignore Ogg EOF errors when fetching packets



commit f1d1ee4752b61a4e73dbe85cdbe0fd8e6533320c
Author: David King <amigadave amigadave com>
Date:   Thu May 30 22:56:52 2013 +0100

    Ignore Ogg EOF errors when fetching packets
    
    Although this is nominally an error, it is not a failure if there are no
    more packets in the stream.

 src/misc.c   |    2 +-
 src/vcedit.c |   11 ++++++++++-
 2 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/src/misc.c b/src/misc.c
index 2e6829c..93c8c1f 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -3108,7 +3108,7 @@ Load_File_Content (GtkWidget *entry)
     gtk_list_store_clear(LoadFileContentListModel);
     while ((size_read = g_input_stream_read (G_INPUT_STREAM (istream),
                                              buffer, sizeof(buffer),
-                                             NULL, &error) > 0))
+                                             NULL, &error)) > 0)
     {
         if (buffer[strlen(buffer)-1]=='\n')
             buffer[strlen(buffer)-1]='\0';
diff --git a/src/vcedit.c b/src/vcedit.c
index d0befe2..cbaa47b 100644
--- a/src/vcedit.c
+++ b/src/vcedit.c
@@ -628,7 +628,16 @@ vcedit_write(vcedit_state *state, GFile *file, GError **error)
 
     if (error == NULL || *error != NULL)
     {
-        goto cleanup;
+        if (g_error_matches (*error, ET_OGG_ERROR, ET_OGG_ERROR_EOF))
+        {
+            /* While nominally an  error, this is expected and can be safely
+             * ignored. */
+            g_clear_error (error);
+        }
+        else
+        {
+            goto cleanup;
+        }
     }
 
     streamout.e_o_s = 1;


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