[gnome-control-center] printers: Fix "format not a string literal" error



commit 82b73e5e779b667279950d42f42d71eb30a22870
Author: Bastien Nocera <hadess hadess net>
Date:   Fri Apr 8 11:29:28 2016 +0200

    printers: Fix "format not a string literal" error
    
    https://bugzilla.gnome.org/show_bug.cgi?id=764727

 panels/printers/cc-printers-panel.c |   38 ++++++++++++----------------------
 1 files changed, 14 insertions(+), 24 deletions(-)
---
diff --git a/panels/printers/cc-printers-panel.c b/panels/printers/cc-printers-panel.c
index a09908c..66529de 100644
--- a/panels/printers/cc-printers-panel.c
+++ b/panels/printers/cc-printers-panel.c
@@ -2547,10 +2547,6 @@ test_page_cb (GtkButton *button,
       const gchar  *const dirs[] = { "/usr/share/cups",
                                      "/usr/local/share/cups",
                                      NULL };
-      const gchar  *testprint[] = { "%s/data/testprint",
-                                    "%s/data/testprint.ps",
-                                    NULL };
-      const gchar **pattern;
       const gchar  *datadir = NULL;
       http_t       *http = NULL;
       gchar        *printer_uri = NULL;
@@ -2561,32 +2557,26 @@ test_page_cb (GtkButton *button,
 
       if ((datadir = getenv ("CUPS_DATADIR")) != NULL)
         {
-          for (pattern = testprint; *pattern != NULL; pattern++)
-            {
-              filename = g_strdup_printf (*pattern, datadir);
-              if (g_access (filename, R_OK) == 0)
-                break;
-              else
-                {
-                  g_free (filename);
-                  filename = NULL;
-                }
-            }
+          filename = g_strdup_printf ("%s/data/testprint", datadir);
+          if (g_access (filename, R_OK) != 0)
+           {
+             g_free (filename);
+             filename = g_strdup_printf ("%s/data/testprint.ps", datadir);
+             if (g_access (filename, R_OK) != 0)
+               g_clear_pointer (&filename, g_free);
+           }
         }
       else
         {
           for (i = 0; (datadir = dirs[i]) != NULL && filename == NULL; i++)
             {
-              for (pattern = testprint; *pattern != NULL; pattern++)
+              filename = g_strdup_printf ("%s/data/testprint", datadir);
+              if (g_access (filename, R_OK) != 0)
                 {
-                  filename = g_strdup_printf (*pattern, datadir);
-                  if (g_access (filename, R_OK) == 0)
-                    break;
-                  else
-                    {
-                      g_free (filename);
-                      filename = NULL;
-                    }
+                  g_free (filename);
+                  filename = g_strdup_printf ("%s/data/testprint.ps", datadir);
+                  if (g_access (filename, R_OK) != 0)
+                    g_clear_pointer (&filename, g_free);
                 }
             }
         }


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