[gnome-autoar] extractor: Make error codes public



commit ddc09cb9c7ded9689f3e2c09b598667e5d8612b9
Author: Sergio Costas Rodriguez <sergio costas canonical com>
Date:   Tue Jun 21 18:17:18 2022 +0200

    extractor: Make error codes public
    
    The error codes are private currently. Let's make them public to allow
    clients to handle them concretely.
    
    Fixes: https://gitlab.gnome.org/GNOME/gnome-autoar/-/issues/21

 gnome-autoar/autoar-extractor.c | 6 ++----
 gnome-autoar/autoar-extractor.h | 3 +++
 2 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/gnome-autoar/autoar-extractor.c b/gnome-autoar/autoar-extractor.c
index 35bb4ad..e34fec2 100644
--- a/gnome-autoar/autoar-extractor.c
+++ b/gnome-autoar/autoar-extractor.c
@@ -95,8 +95,6 @@
 G_DEFINE_QUARK (autoar-extractor, autoar_extractor)
 
 #define BUFFER_SIZE (64 * 1024)
-#define NOT_AN_ARCHIVE_ERRNO 2013
-#define EMPTY_ARCHIVE_ERRNO 2014
 
 typedef struct _GFileAndInfo GFileAndInfo;
 
@@ -1664,7 +1662,7 @@ autoar_extractor_step_scan_toplevel (AutoarExtractor *self)
        * want this thing to happen because it does unnecesssary copying. */
       if (self->error == NULL)
         self->error = g_error_new_literal (AUTOAR_EXTRACTOR_ERROR,
-                                           NOT_AN_ARCHIVE_ERRNO,
+                                           AUTOAR_NOT_AN_ARCHIVE_ERRNO,
                                            "not an archive");
       return;
     }
@@ -1739,7 +1737,7 @@ autoar_extractor_step_scan_toplevel (AutoarExtractor *self)
   if (self->files_list == NULL) {
     if (self->error == NULL) {
       self->error = g_error_new_literal (AUTOAR_EXTRACTOR_ERROR,
-                                         EMPTY_ARCHIVE_ERRNO,
+                                         AUTOAR_EMPTY_ARCHIVE_ERRNO,
                                          "empty archive");
     }
     archive_read_free (a);
diff --git a/gnome-autoar/autoar-extractor.h b/gnome-autoar/autoar-extractor.h
index fbe44e1..5b19ad0 100644
--- a/gnome-autoar/autoar-extractor.h
+++ b/gnome-autoar/autoar-extractor.h
@@ -44,6 +44,9 @@ G_DECLARE_FINAL_TYPE (AutoarExtractor, autoar_extractor, AUTOAR, EXTRACTOR, GObj
  **/
 #define AUTOAR_EXTRACTOR_ERROR autoar_extractor_quark()
 
+#define AUTOAR_NOT_AN_ARCHIVE_ERRNO 2013
+#define AUTOAR_EMPTY_ARCHIVE_ERRNO 2014
+
 GQuark           autoar_extractor_quark                       (void);
 
 AutoarExtractor *autoar_extractor_new                         (GFile *source_file,


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