[libgsf] Fix -Wformat with printf()



commit 762225accefad020a36f76238a652532a5c439d2
Author: Marc-André Lureau <marcandre lureau redhat com>
Date:   Fri Jan 31 15:18:47 2020 +0100

    Fix -Wformat with printf()
    
    Use glib printf-variants functions that are gnuc-compliant.
    Fixes win32 build warnings:
     warning: unknown conversion type character 'l' in format
    
    Signed-off-by: Marc-André Lureau <marcandre lureau redhat com>

 tests/test-cat-zip.c | 12 ++++++------
 tests/test-msole2.c  | 14 +++++++-------
 tests/test-zip1.c    |  8 ++++----
 3 files changed, 17 insertions(+), 17 deletions(-)
---
diff --git a/tests/test-cat-zip.c b/tests/test-cat-zip.c
index 56a2a01..0e47b55 100644
--- a/tests/test-cat-zip.c
+++ b/tests/test-cat-zip.c
@@ -36,16 +36,16 @@ ls_R (GsfInput *input)
        gboolean is_dir = GSF_IS_INFILE (input) &&
                (gsf_infile_num_children (GSF_INFILE (input)) >= 0);
 
-       printf ("%c '%s'\t\t%" GSF_OFF_T_FORMAT "\n",
+       g_print ("%c '%s'\t\t%" GSF_OFF_T_FORMAT "\n",
                (is_dir ? 'd' : ' '),
                (name != NULL) ? name : "",
                gsf_input_size (GSF_INPUT (input)));
 
        if (is_dir) {
-               puts ("{");
+               g_print ("{");
                for (i = 0 ; i < gsf_infile_num_children (GSF_INFILE (input)) ; i++)
                        ls_R (gsf_infile_child_by_index (GSF_INFILE (input), i));
-               puts ("}");
+               g_print ("}");
        }
 
        g_object_unref (G_OBJECT (input));
@@ -58,7 +58,7 @@ test (int argc, char *argv[])
        GsfInfile *infile;
        GError    *err = NULL;
 
-       fprintf (stderr, "%s\n", argv [1]);
+       g_printerr ("%s\n", argv [1]);
        input = gsf_input_stdio_new (argv[1], &err);
        if (input == NULL) {
 
@@ -85,7 +85,7 @@ test (int argc, char *argv[])
                int i;
                GsfInput *child, *ptr = GSF_INPUT (infile);
                for (i = 2 ; i < argc && ptr != NULL; i++, ptr = child) {
-                       fprintf (stderr, "--> '%s'\n", argv [i]);
+                       g_printerr ("--> '%s'\n", argv [i]);
                        if (GSF_IS_INFILE (ptr) &&
                            gsf_infile_num_children (GSF_INFILE (ptr)) >= 0) {
                                child = gsf_infile_child_by_name (GSF_INFILE (ptr), argv [i]);
@@ -123,7 +123,7 @@ main (int argc, char *argv[])
        int res;
 
        if (argc < 2) {
-               fprintf (stderr, "%s : file stream stream ...\n", argv [0]);
+               g_printerr ("%s : file stream stream ...\n", argv [0]);
                return 1;
        }
 
diff --git a/tests/test-msole2.c b/tests/test-msole2.c
index 5150824..5a7359a 100644
--- a/tests/test-msole2.c
+++ b/tests/test-msole2.c
@@ -39,7 +39,7 @@ ls_R (GsfInput *input)
                (gsf_infile_num_children (GSF_INFILE (input)) >= 0);
        /* Please see the comment on is_dir in test-cp-msole.c. */
 
-       printf ("%c '%s'\t\t%" GSF_OFF_T_FORMAT "\n",
+       g_print ("%c '%s'\t\t%" GSF_OFF_T_FORMAT "\n",
                (is_dir ? 'd' : ' '),
                (name != NULL) ? name : "",
                gsf_input_size (input));
@@ -48,10 +48,10 @@ ls_R (GsfInput *input)
                GsfInfile *infile = GSF_INFILE (input);
                int i;
 
-               puts ("{");
+               g_print ("{");
                for (i = 0 ; i < gsf_infile_num_children (infile) ; i++)
                        ls_R (gsf_infile_child_by_index (infile, i));
-               puts ("}");
+               g_print ("}");
        }
 
        g_object_unref (G_OBJECT (input));
@@ -64,7 +64,7 @@ test (int argc, char *argv[])
        GsfInfile *infile;
        GError    *err = NULL;
 
-       fprintf (stderr, "%s\n", argv [1]);
+       g_printerr ("%s\n", argv [1]);
        input = gsf_input_stdio_new (argv[1], &err);
        if (input == NULL) {
 
@@ -92,7 +92,7 @@ test (int argc, char *argv[])
                GsfInput *child, *ptr = GSF_INPUT (infile);
 
                for (i = 2 ; i < argc && ptr != NULL; i++, ptr = child) {
-                       fprintf (stderr, "--> '%s'\n", argv [i]);
+                       g_printerr ("--> '%s'\n", argv [i]);
                        if (GSF_IS_INFILE (ptr) &&
                            gsf_infile_num_children (GSF_INFILE (ptr)) >= 0) {
                                child = gsf_infile_child_by_name (GSF_INFILE (ptr), argv [i]);
@@ -135,8 +135,8 @@ main (int argc, char *argv[])
        }
 
        if (argc < 2) {
-               fprintf (stderr, "Usage: %s [--hex] file stream stream ...\n\n", progname);
-               fprintf (stderr, "For example, \"%s X A B C\" dumps the streem C "
+               g_printerr ("Usage: %s [--hex] file stream stream ...\n\n", progname);
+               g_printerr ("For example, \"%s X A B C\" dumps the streem C "
                        "from directory A/B from file X.\n", progname);
                return 1;
        }
diff --git a/tests/test-zip1.c b/tests/test-zip1.c
index d329f69..c118dcc 100644
--- a/tests/test-zip1.c
+++ b/tests/test-zip1.c
@@ -33,7 +33,7 @@ ls_R (GsfInput *input)
        gboolean is_dir = GSF_IS_INFILE (input) &&
                (gsf_infile_num_children (GSF_INFILE (input)) >= 0);
 
-       printf ("%c '%s' %" GSF_OFF_T_FORMAT "\n",
+       g_print ("%c '%s' %" GSF_OFF_T_FORMAT "\n",
                (is_dir ? 'd' : ' '),
                gsf_input_name (GSF_INPUT (input)),
                gsf_input_size (GSF_INPUT (input)));
@@ -41,10 +41,10 @@ ls_R (GsfInput *input)
        if (!is_dir)
                return;
 
-       puts ("{");
+       g_print ("{");
        for (i = 0 ; i < gsf_infile_num_children (GSF_INFILE (input)) ; i++)
                ls_R (gsf_infile_child_by_index (GSF_INFILE (input), i));
-       puts ("}");
+       g_print ("}");
 }
 
 static int
@@ -56,7 +56,7 @@ test (int argc, char *argv[])
        int i;
 
        for (i = 1 ; i < argc ; i++) {
-               puts (argv[i]);
+               g_print ("%s", argv[i]);
                input = gsf_input_stdio_new (argv[i], &err);
                if (input == NULL) {
 


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