[vala/staging: 5/7] Do not use non-literal printf format strings



commit 8b8515833b5af0bac904686d580af9965068e4e8
Author: Jürg Billeter <j bitron ch>
Date:   Tue Nov 1 18:14:09 2016 +0100

    Do not use non-literal printf format strings

 codegen/valagvariantmodule.vala |    2 +-
 vala/valagenieparser.vala       |    6 +++---
 vala/valaparser.vala            |    4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/codegen/valagvariantmodule.vala b/codegen/valagvariantmodule.vala
index b2d9861..b50aca0 100644
--- a/codegen/valagvariantmodule.vala
+++ b/codegen/valagvariantmodule.vala
@@ -126,7 +126,7 @@ public class Vala.GVariantModule : GAsyncModule {
                                        }
                                }
 
-                               sig = sig.printf (element_sig);
+                               sig = sig.replace ("%s", element_sig);
                        }
 
                        if (sig == null &&
diff --git a/vala/valagenieparser.vala b/vala/valagenieparser.vala
index 9f22f67..b598602 100644
--- a/vala/valagenieparser.vala
+++ b/vala/valagenieparser.vala
@@ -165,7 +165,7 @@ public class Vala.Genie.Parser : CodeVisitor {
                TokenType cur = current ();
                TokenType pre =  tokens[index - 1].type;
 
-               throw new ParseError.SYNTAX (get_error ("expected %s but got %s with previous %s".printf 
(type.to_string (), cur.to_string (), pre.to_string())));
+               throw new ParseError.SYNTAX (get_error ("expected %s but got %s with previous %s"), 
type.to_string (), cur.to_string (), pre.to_string());
        }
 
        inline bool expect_terminator () throws ParseError {
@@ -175,7 +175,7 @@ public class Vala.Genie.Parser : CodeVisitor {
 
                TokenType cur = current ();
 
-               throw new ParseError.SYNTAX (get_error ("expected line end or semicolon but got %s".printf 
(cur.to_string())));
+               throw new ParseError.SYNTAX (get_error ("expected line end or semicolon but got %s"), 
cur.to_string());
        }
 
        inline SourceLocation get_location () {
@@ -2435,7 +2435,7 @@ public class Vala.Genie.Parser : CodeVisitor {
                TokenType cur = current ();
                TokenType pre =  tokens[index-1].type;
 
-               throw new ParseError.SYNTAX (get_error ("expected declaration  but got %s with previous 
%s".printf (cur.to_string (), pre.to_string())));
+               throw new ParseError.SYNTAX (get_error ("expected declaration  but got %s with previous %s"), 
cur.to_string (), pre.to_string());
        }
 
        void parse_declarations (Symbol parent, bool root = false) throws ParseError {
diff --git a/vala/valaparser.vala b/vala/valaparser.vala
index 06f5a68..91aeedd 100644
--- a/vala/valaparser.vala
+++ b/vala/valaparser.vala
@@ -128,7 +128,7 @@ public class Vala.Parser : CodeVisitor {
                        return true;
                }
 
-               throw new ParseError.SYNTAX (get_error ("expected %s".printf (type.to_string ())));
+               throw new ParseError.SYNTAX (get_error ("expected %s"), type.to_string ());
        }
 
        inline SourceLocation get_location () {
@@ -2697,7 +2697,7 @@ public class Vala.Parser : CodeVisitor {
                        if (ModifierFlags.ABSTRACT in flags
                            || ModifierFlags.VIRTUAL in flags
                            || ModifierFlags.OVERRIDE in flags) {
-                               throw new ParseError.SYNTAX (get_error ("the modifiers `abstract', `virtual', 
and `override' are not valid for %s methods".printf ((ModifierFlags.CLASS in flags) ? "class" : "static")));
+                               throw new ParseError.SYNTAX (get_error ("the modifiers `abstract', `virtual', 
and `override' are not valid for %s methods"), (ModifierFlags.CLASS in flags) ? "class" : "static");
                        }
                }
 


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