[gtk+/gtk-3-20] cups: Fix more "format not a string literal" error
- From: Felipe Borges <felipeborges src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-3-20] cups: Fix more "format not a string literal" error
- Date: Wed, 13 Apr 2016 12:28:33 +0000 (UTC)
commit 8e0c2a3fff88a578b721eb2f7d236f6459056aa2
Author: Felipe Borges <felipeborges gnome org>
Date: Tue Apr 12 15:55:19 2016 +0200
cups: Fix more "format not a string literal" error
https://bugzilla.gnome.org/show_bug.cgi?id=764585
modules/printbackends/cups/gtkprintbackendcups.c | 61 +++++++++++++++++-----
1 files changed, 48 insertions(+), 13 deletions(-)
---
diff --git a/modules/printbackends/cups/gtkprintbackendcups.c
b/modules/printbackends/cups/gtkprintbackendcups.c
index 01f1f1e..9a4b733 100644
--- a/modules/printbackends/cups/gtkprintbackendcups.c
+++ b/modules/printbackends/cups/gtkprintbackendcups.c
@@ -4402,16 +4402,52 @@ static const struct {
{ "output-bin", "face-down", NC_("output-bin", "Face Down Bin") },
/* Translators: Large capacity output bin */
{ "output-bin", "large-capacity", NC_("output-bin", "Large Capacity Bin") },
- /* Translators: Output stacker number %d */
- { "output-bin", "stacker-N", NC_("output-bin", "Stacker %d") },
- /* Translators: Output mailbox number %d */
- { "output-bin", "mailbox-N", NC_("output-bin", "Mailbox %d") },
- /* Translators: Private mailbox */
- { "output-bin", "my-mailbox", NC_("output-bin", "My Mailbox") },
- /* Translators: Output tray number %d */
- { "output-bin", "tray-N", NC_("output-bin", "Tray %d") }
+ { NULL, NULL, NULL }
};
+/*
+ * Handles "format not a string literal" error
+ * https://mail.gnome.org/archives/desktop-devel-list/2016-March/msg00075.html
+ */
+static const gchar *
+get_ipp_choice_translation_string (gint index,
+ guint i)
+{
+ const gchar *translation;
+ gchar *string;
+
+ if (i < G_N_ELEMENTS (ipp_choice_translations))
+ translation = ipp_choice_translations[i].translation;
+ else
+ {
+ switch (i)
+ {
+ case 14:
+ /* Translators: Output stacker number %d */
+ string = g_strdup_printf ("Stacker %d", index);
+ break;
+ case 15:
+ /* Translators: Output mailbox number %d */
+ string = g_strdup_printf ("Mailbox %d", index);
+ break;
+ case 16:
+ /* Translators: Private mailbox */
+ string = g_strdup ("My Mailbox");
+ break;
+ case 17:
+ /* Translators: Output tray number %d */
+ string = g_strdup_printf ("Tray %d", index);
+ break;
+ default:
+ g_assert_not_reached ();
+ }
+
+ translation = NC_("output-bin", string);
+ }
+
+ return translation;
+}
+
static const struct {
const char *lpoption;
const char *name;
@@ -5143,7 +5179,7 @@ get_ipp_choice_translation (const gchar *ipp_option_name,
gchar *endptr;
gint i;
- for (i = 0; i < G_N_ELEMENTS (ipp_choice_translations); i++)
+ for (i = 0; ipp_choice_translations[i].ipp_option_name != NULL; i++)
{
if (g_strcmp0 (ipp_choice_translations[i].ipp_option_name, ipp_option_name) == 0)
{
@@ -5170,10 +5206,9 @@ get_ipp_choice_translation (const gchar *ipp_option_name,
if (index != 0 || endptr != nptr)
{
- translation = g_strdup_printf (g_dpgettext2 (GETTEXT_PACKAGE,
- ipp_option_name,
- ipp_choice_translations[i].translation),
- index);
+ translation = g_strdup (g_dpgettext2 (GETTEXT_PACKAGE,
+ ipp_option_name,
+ get_ipp_choice_translation_string (index, i)));
break;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]