[gnome-autoar] extractor: Fix compile warnings



commit d96af24324ac3a028fad2a1243d59820bde3e44f
Author: Peter Keresztes Schmidt <carbenium outlook com>
Date:   Mon Aug 5 17:43:23 2019 +0200

    extractor: Fix compile warnings
    
    Following compile warnings showed up when link, mkfifo and mklink
    weren't defined:
    
    ../gnome-autoar/autoar-extractor.c: In function ‘autoar_extractor_do_write_entry’:
    ../gnome-autoar/autoar-extractor.c:993:17: warning: unused variable ‘uname’ [-Wunused-variable]
      993 |     const char *uname;
          |                 ^~~~~
    ../gnome-autoar/autoar-extractor.c:1022:17: warning: unused variable ‘gname’ [-Wunused-variable]
     1022 |     const char *gname;
          |                 ^~~~~
    ../gnome-autoar/autoar-extractor.c:1237:1: warning: label ‘applyinfo’ defined but not used 
[-Wunused-label]
     1237 | applyinfo:
          | ^~~~~~~~~
    ../gnome-autoar/autoar-extractor.c:941:7: warning: variable ‘r’ set but not used 
[-Wunused-but-set-variable]
      941 |   int r;
          |       ^

 gnome-autoar/autoar-extractor.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/gnome-autoar/autoar-extractor.c b/gnome-autoar/autoar-extractor.c
index c6cca22..55b9957 100644
--- a/gnome-autoar/autoar-extractor.c
+++ b/gnome-autoar/autoar-extractor.c
@@ -973,7 +973,9 @@ autoar_extractor_do_write_entry (AutoarExtractor      *self,
 {
   GFileInfo *info;
   mode_t filetype;
+#if defined HAVE_LINK || defined HAVE_MKNOD || defined HAVE_MKFIFO
   int r;
+#endif
 
   {
     GFile *parent;
@@ -1025,10 +1027,10 @@ autoar_extractor_do_write_entry (AutoarExtractor      *self,
   /* user */
   {
     guint32 uid;
-    const char *uname;
 
     g_debug ("autoar_extractor_do_write_entry: user");
 #ifdef HAVE_GETPWNAM
+    const char *uname;
     if ((uname = archive_entry_uname (entry)) != NULL) {
       void *got_uid;
       if (g_hash_table_lookup_extended (self->userhash, uname, NULL, &got_uid) == TRUE) {
@@ -1054,10 +1056,10 @@ autoar_extractor_do_write_entry (AutoarExtractor      *self,
   /* group */
   {
     guint32 gid;
-    const char *gname;
 
     g_debug ("autoar_extractor_do_write_entry: group");
 #ifdef HAVE_GETGRNAM
+    const char *gname;
     if ((gname = archive_entry_gname (entry)) != NULL) {
       void *got_gid;
       if (g_hash_table_lookup_extended (self->grouphash, gname, NULL, &got_gid) == TRUE) {
@@ -1103,7 +1105,9 @@ autoar_extractor_do_write_entry (AutoarExtractor      *self,
 #endif
 
   g_debug ("autoar_extractor_do_write_entry: writing");
+#if defined HAVE_MKNOD || defined HAVE_MKFIFO
   r = 0;
+#endif
 
   switch (filetype = archive_entry_filetype (entry)) {
     default:
@@ -1269,7 +1273,9 @@ autoar_extractor_do_write_entry (AutoarExtractor      *self,
   }
 #endif
 
+#ifdef HAVE_LINK
 applyinfo:
+#endif
   g_debug ("autoar_extractor_do_write_entry: applying info");
   g_file_set_attributes_from_info (dest,
                                    info,


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