[vala/staging: 4/6] Do not use non-literal printf format strings



commit 0eddb6af4a17d54d016aecafd61c1e9bd190b7ea
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 25097a5..e7b6902 100644
--- a/vala/valagenieparser.vala
+++ b/vala/valagenieparser.vala
@@ -163,7 +163,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 {
@@ -173,7 +173,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 () {
@@ -2436,7 +2436,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 11e8bad..ab3fa15 100644
--- a/vala/valaparser.vala
+++ b/vala/valaparser.vala
@@ -126,7 +126,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 () {
@@ -2698,7 +2698,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]