[libcroco] Fixed format string issues by giving static literals, fixes bug 640897



commit c7197cad42d6269739f379025c2bec9e474c8027
Author: Tobias Mueller <tobiasmue gnome org>
Date:   Sat Jan 29 16:31:30 2011 +0100

    Fixed format string issues by giving static literals, fixes bug 640897

 src/cr-statement.c |   10 +++++-----
 tests/test2-main.c |    8 +++-----
 tests/test3-main.c |    8 +++-----
 3 files changed, 11 insertions(+), 15 deletions(-)
---
diff --git a/src/cr-statement.c b/src/cr-statement.c
index a1b8259..cb9b11c 100644
--- a/src/cr-statement.c
+++ b/src/cr-statement.c
@@ -2611,7 +2611,7 @@ cr_statement_dump_ruleset (CRStatement const * a_this, FILE * a_fp, glong a_inde
         g_return_if_fail (a_fp && a_this);
         str = cr_statement_ruleset_to_string (a_this, a_indent);
         if (str) {
-                fprintf (a_fp, str);
+                fprintf (a_fp, "%s", str);
                 g_free (str);
                 str = NULL;
         }
@@ -2662,7 +2662,7 @@ cr_statement_dump_charset (CRStatement const * a_this, FILE * a_fp, gulong a_ind
         str = cr_statement_charset_to_string (a_this,
                                               a_indent) ;
         if (str) {
-                fprintf (a_fp, str) ;
+                fprintf (a_fp, "%s", str) ;
                 g_free (str) ;
                 str = NULL ;
         }
@@ -2689,7 +2689,7 @@ cr_statement_dump_page (CRStatement const * a_this, FILE * a_fp, gulong a_indent
 
         str = cr_statement_at_page_rule_to_string (a_this, a_indent) ;
         if (str) {
-                fprintf (a_fp, str);
+                fprintf (a_fp, "%s", str);
                 g_free (str) ;
                 str = NULL ; 
         }
@@ -2715,7 +2715,7 @@ cr_statement_dump_media_rule (CRStatement const * a_this,
 
         str = cr_statement_media_rule_to_string (a_this, a_indent) ;
         if (str) {
-                fprintf (a_fp, str) ;
+                fprintf (a_fp, "%s", str) ;
                 g_free (str) ;
                 str = NULL ;
         }
@@ -2741,7 +2741,7 @@ cr_statement_dump_import_rule (CRStatement const * a_this, FILE * a_fp,
 
         str = cr_statement_import_rule_to_string (a_this, a_indent) ;
         if (str) {
-                fprintf (a_fp, str) ;
+                fprintf (a_fp, "%s", str) ;
                 g_free (str) ;
                 str = NULL ;
         }
diff --git a/tests/test2-main.c b/tests/test2-main.c
index 0a576a5..be1d545 100644
--- a/tests/test2-main.c
+++ b/tests/test2-main.c
@@ -130,8 +130,7 @@ test_import_style (CRDocHandler * a_handler,
                                          ((CRString *) cur->data)->stryng->len);
 
                                 if (str) {
-                                        fprintf (stdout, str);
-                                        fprintf (stdout, "\n");
+                                        fprintf (stdout, "%s\n", str);
                                         g_free (str);
                                         str = NULL;
                                 }
@@ -145,8 +144,7 @@ test_import_style (CRDocHandler * a_handler,
                         guchar *str = cr_string_dup2 
                                 (a_uri_default_ns) ;
                         if (str) {
-                                fprintf (stdout, str);
-                                fprintf (stdout, "\n");
+                                fprintf (stdout, "%s\n", str);
                                 g_free (str);
                                 str = NULL;
                         }
@@ -270,7 +268,7 @@ test_property (CRDocHandler * a_handler,
                          a_name->stryng->len);
 
                 if (name) {
-                        fprintf (stdout, name);
+                        fprintf (stdout, "%s", name);
                 }
                 if (a_expr) {
                         fprintf (stdout, ": ");
diff --git a/tests/test3-main.c b/tests/test3-main.c
index f2c69c9..33e1a9a 100644
--- a/tests/test3-main.c
+++ b/tests/test3-main.c
@@ -123,8 +123,7 @@ test_import_style (CRDocHandler * a_handler,
                                 guchar *str =
                                         cr_string_dup2 ((CRString *) cur->data);
                                 if (str) {
-                                        fprintf (stdout, str);
-                                        fprintf (stdout, "\n");
+                                        fprintf (stdout, "%s\n", str);
                                         g_free (str);
                                         str = NULL;
                                 }
@@ -136,8 +135,7 @@ test_import_style (CRDocHandler * a_handler,
                 if (a_uri_default_ns) {
                         guchar *str = cr_string_dup2 (a_uri_default_ns) ;
                         if (str) {
-                                fprintf (stdout, str);
-                                fprintf (stdout, "\n");
+                                fprintf (stdout, "%s\n", str);
                                 g_free (str);
                                 str = NULL;
                         }
@@ -255,7 +253,7 @@ test_property (CRDocHandler * a_handler, CRString * a_name,
         if (a_name) {
                 guchar *name = cr_string_dup2  (a_name);
                 if (name) {
-                        fprintf (stdout, name);
+                        fprintf (stdout, "%s", name);
                 }
                 if (a_expr) {
                         fprintf (stdout, ": ");



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