[easytag] Ignore Ogg EOF and EOS errors when reading packets



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

    Ignore Ogg EOF and EOS errors when reading packets
    
    The errors do not indicate failure, but merely the end of stream and
    file, so ignore them.

 src/easytag.c |    1 +
 src/misc.c    |    2 +-
 src/vcedit.c  |   14 ++++++++++++--
 3 files changed, 14 insertions(+), 3 deletions(-)
---
diff --git a/src/easytag.c b/src/easytag.c
index 41c722d..eef0fbc 100644
--- a/src/easytag.c
+++ b/src/easytag.c
@@ -2995,6 +2995,7 @@ Write_File_Tag (ET_File *ETFile, gboolean hide_msgbox)
     msg = g_strdup_printf(_("Writing tag of '%s'"),basename_utf8);
     Statusbar_Message(msg,TRUE);
     g_free(msg);
+    msg = NULL;
 
     if (ET_Save_File_Tag_To_HD(ETFile))
     {
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..354677f 100644
--- a/src/vcedit.c
+++ b/src/vcedit.c
@@ -626,9 +626,19 @@ vcedit_write(vcedit_state *state, GFile *file, GError **error)
         }
     }
 
-    if (error == NULL || *error != NULL)
+    if (error != NULL)
     {
-        goto cleanup;
+        if (g_error_matches (*error, ET_OGG_ERROR, ET_OGG_ERROR_EOF)
+            || g_error_matches (*error, ET_OGG_ERROR, ET_OGG_ERROR_EOS))
+        {
+            /* While nominally errors, these are 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]