Commit 1e13a055 authored by Ting-Wei Lan's avatar Ting-Wei Lan Committed by Alberto Fanjul

build: Fix non-literal format string warnings for clang

#160
#161
parent d46caa25
Pipeline #38919 passed with stages
in 11 minutes and 30 seconds
......@@ -103,12 +103,12 @@ class RefActionFetch : GitgExt.UIElement, GitgExt.Action, GitgExt.RefAction, Obj
if (a.is_zero())
{
/* Translators: new refers to a new remote reference having been fetched, */
updates.add(@"$name (%s)".printf(_("new")));
updates.add(@"%s (%s)".printf(name, _("new")));
}
else
{
/* Translators: updated refers to a remote reference having been updated, */
updates.add(@"$name (%s)".printf(_("updated")));
updates.add(@"%s (%s)".printf(name, _("updated")));
}
});
......
......@@ -30,22 +30,20 @@ class Gitg.DiffImageSideBySide : Gtk.DrawingArea
{
if (d_old_size_layout == null && cache.old_pixbuf != null)
{
string message;
string message = @"$(cache.old_pixbuf.get_width()) × $(cache.old_pixbuf.get_height())";
if (cache.new_pixbuf != null)
{
// Translators: this label is displayed below the image diff, %s
// is substituted with the size of the image
message = _("before (%s)");
d_old_size_layout = create_pango_layout(_("before (%s)").printf(message));
}
else
{
// Translators: this label is displayed below the image diff, %s
// is substituted with the size of the image
message = _("removed (%s)");
d_old_size_layout = create_pango_layout(_("removed (%s)").printf(message));
}
d_old_size_layout = create_pango_layout(message.printf(@"$(cache.old_pixbuf.get_width()) × $(cache.old_pixbuf.get_height())"));
}
return d_old_size_layout;
......@@ -58,22 +56,20 @@ class Gitg.DiffImageSideBySide : Gtk.DrawingArea
{
if (d_new_size_layout == null && cache.new_pixbuf != null)
{
string message;
string message = @"$(cache.new_pixbuf.get_width()) × $(cache.new_pixbuf.get_height())";
if (cache.old_pixbuf != null)
{
// Translators: this label is displayed below the image diff, %s
// is substituted with the size of the image
message = _("after (%s)");
d_new_size_layout = create_pango_layout(_("after (%s)").printf(message));
}
else
{
// Translators: this label is displayed below the image diff, %s
// is substituted with the size of the image
message = _("added (%s)");
d_new_size_layout = create_pango_layout(_("added (%s)").printf(message));
}
d_new_size_layout = create_pango_layout(message.printf(@"$(cache.new_pixbuf.get_width()) × $(cache.new_pixbuf.get_height())"));
}
return d_new_size_layout;
......
......@@ -26,7 +26,7 @@ class Gitg.DiffViewLinesRenderer : Gtk.SourceGutterRendererText
SYMBOL
}
private string d_num_digits_fmts;
private int d_num_digits;
private string d_num_digits_fill;
private ulong d_view_style_updated_id;
......@@ -182,7 +182,7 @@ class Gitg.DiffViewLinesRenderer : Gtk.SourceGutterRendererText
num_digits = 1;
}
d_num_digits_fmts = @"%$(num_digits)d";
d_num_digits = num_digits;
d_num_digits_fill = string.nfill(num_digits, ' ');
}
......@@ -207,14 +207,14 @@ class Gitg.DiffViewLinesRenderer : Gtk.SourceGutterRendererText
case Style.NEW:
if (origin == Ggit.DiffLineType.CONTEXT || origin == Ggit.DiffLineType.ADDITION)
{
ltext = d_num_digits_fmts.printf(newn);
ltext = "%*d".printf(d_num_digits, newn);
newn++;
}
break;
case Style.OLD:
if (origin == Ggit.DiffLineType.CONTEXT || origin == Ggit.DiffLineType.DELETION)
{
ltext = d_num_digits_fmts.printf(oldn);
ltext = "%*d".printf(d_num_digits, oldn);
oldn++;
}
break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment