char *icon_names[3];
int n = 0;
GIcon *themed_icon;
- const char *file_template;
const char *xdg_icon;
+ const char *suffix;
g_return_val_if_fail (type != NULL, NULL);
if (symbolic)
- {
- file_template = "%s-symbolic";
- }
+ suffix = "-symbolic";
else
- {
- file_template = "%s";
- }
+ suffix = "";
G_LOCK (gio_xdgmime);
xdg_icon = xdg_mime_get_icon (type);
G_UNLOCK (gio_xdgmime);
if (xdg_icon != NULL)
- xdg_mimetype_icon = g_strdup_printf (file_template, xdg_icon);
+ xdg_mimetype_icon = g_strconcat (xdg_icon, suffix, NULL);
if (xdg_mimetype_icon)
icon_names[n++] = xdg_mimetype_icon;
- mimetype_icon = g_strdup_printf (file_template, type);
+ mimetype_icon = g_strconcat (type, suffix, NULL);
while ((q = strchr (mimetype_icon, '/')) != NULL)
*q = '-';
xdg_mimetype_generic_icon = g_content_type_get_generic_icon_name (type);
if (xdg_mimetype_generic_icon)
- generic_mimetype_icon = g_strdup_printf (file_template, xdg_mimetype_generic_icon);
+ generic_mimetype_icon = g_strconcat (xdg_mimetype_generic_icon, suffix, NULL);
if (generic_mimetype_icon)
icon_names[n++] = generic_mimetype_icon;
if (len <= 0)
{
- GResolverError errnum;
- const gchar *format;
-
if (len == 0 || herr == HOST_NOT_FOUND || herr == NO_DATA)
{
- errnum = G_RESOLVER_ERROR_NOT_FOUND;
- format = _("No DNS record of the requested type for '%s'");
+ g_set_error (error, G_RESOLVER_ERROR, G_RESOLVER_ERROR_NOT_FOUND,
+ _("No DNS record of the requested type for '%s'"), rrname);
}
else if (herr == TRY_AGAIN)
{
- errnum = G_RESOLVER_ERROR_TEMPORARY_FAILURE;
- format = _("Temporarily unable to resolve '%s'");
+ g_set_error (error, G_RESOLVER_ERROR, G_RESOLVER_ERROR_TEMPORARY_FAILURE,
+ _("Temporarily unable to resolve '%s'"), rrname);
}
else
{
- errnum = G_RESOLVER_ERROR_INTERNAL;
- format = _("Error resolving '%s'");
+ g_set_error (error, G_RESOLVER_ERROR, G_RESOLVER_ERROR_INTERNAL,
+ _("Error resolving '%s'"), rrname);
}
- g_set_error (error, G_RESOLVER_ERROR, errnum, format, rrname);
return NULL;
}
if (status != ERROR_SUCCESS)
{
- GResolverError errnum;
- const gchar *format;
-
if (status == DNS_ERROR_RCODE_NAME_ERROR)
{
- errnum = G_RESOLVER_ERROR_NOT_FOUND;
- format = _("No DNS record of the requested type for '%s'");
+ g_set_error (error, G_RESOLVER_ERROR, G_RESOLVER_ERROR_NOT_FOUND,
+ _("No DNS record of the requested type for '%s'"), rrname);
}
else if (status == DNS_ERROR_RCODE_SERVER_FAILURE)
{
- errnum = G_RESOLVER_ERROR_TEMPORARY_FAILURE;
- format = _("Temporarily unable to resolve '%s'");
+ g_set_error (error, G_RESOLVER_ERROR, G_RESOLVER_ERROR_TEMPORARY_FAILURE,
+ _("Temporarily unable to resolve '%s'"), rrname);
}
else
{
- errnum = G_RESOLVER_ERROR_INTERNAL;
- format = _("Error resolving '%s'");
+ g_set_error (error, G_RESOLVER_ERROR, G_RESOLVER_ERROR_INTERNAL,
+ _("Error resolving '%s'"), rrname);
}
- g_set_error (error, G_RESOLVER_ERROR, errnum, format, rrname);
return NULL;
}
* the "0" in "%-03d".) But we need to test that our printf gets
* those rules right. So we fool gcc into not warning.
*/
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wformat"
fmt = "% +d";
res = g_snprintf (buf, 128, fmt, 5);
g_assert_cmpint (res, ==, 2);
res = g_snprintf (buf, 128, fmt, -5);
g_assert_cmpint (res, ==, 3);
g_assert_cmpstr (buf, ==, "-5 ");
+#pragma GCC diagnostic pop
}
static void