aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk/empathy-avatar-chooser.c
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@src.gnome.org>2008-11-11 23:27:24 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2008-11-11 23:27:24 +0800
commit0518ac47b6255f6d8424663cd3d2bf1500e2f05c (patch)
treef7725ab2a05d83ecb7de6660a586a24c13b7a7ce /libempathy-gtk/empathy-avatar-chooser.c
parent1144e4f7de44ef8dfad796e6c79bf1e0633f5159 (diff)
downloadgsoc2013-empathy-0518ac47b6255f6d8424663cd3d2bf1500e2f05c.tar
gsoc2013-empathy-0518ac47b6255f6d8424663cd3d2bf1500e2f05c.tar.gz
gsoc2013-empathy-0518ac47b6255f6d8424663cd3d2bf1500e2f05c.tar.bz2
gsoc2013-empathy-0518ac47b6255f6d8424663cd3d2bf1500e2f05c.tar.lz
gsoc2013-empathy-0518ac47b6255f6d8424663cd3d2bf1500e2f05c.tar.xz
gsoc2013-empathy-0518ac47b6255f6d8424663cd3d2bf1500e2f05c.tar.zst
gsoc2013-empathy-0518ac47b6255f6d8424663cd3d2bf1500e2f05c.zip
Make can_satisfy_mime_type_requirements accept NULL out params.
svn path=/trunk/; revision=1697
Diffstat (limited to 'libempathy-gtk/empathy-avatar-chooser.c')
-rw-r--r--libempathy-gtk/empathy-avatar-chooser.c30
1 files changed, 24 insertions, 6 deletions
diff --git a/libempathy-gtk/empathy-avatar-chooser.c b/libempathy-gtk/empathy-avatar-chooser.c
index acab3e719..31c7adca8 100644
--- a/libempathy-gtk/empathy-avatar-chooser.c
+++ b/libempathy-gtk/empathy-avatar-chooser.c
@@ -309,9 +309,11 @@ can_satisfy_mime_type_requirements (gchar **accepted_mime_types,
gchar **satisfactory_format_name,
gchar **satisfactory_mime_type)
{
- GSList *formats;
- GSList *l;
- gchar **strv;
+ GSList *formats;
+ GSList *l;
+ gchar **strv;
+ gchar *name = NULL,
+ *type = NULL;
gboolean done = FALSE;
if (accepted_mime_types == NULL || *accepted_mime_types == NULL) {
@@ -334,8 +336,8 @@ can_satisfy_mime_type_requirements (gchar **accepted_mime_types,
format_mime_types = gdk_pixbuf_format_get_mime_types (format);
for (strv = format_mime_types; *strv != NULL; strv++) {
if (str_in_strv (*strv, accepted_mime_types)) {
- *satisfactory_format_name = gdk_pixbuf_format_get_name (format);
- *satisfactory_mime_type = g_strdup (*strv);
+ name = gdk_pixbuf_format_get_name (format);
+ type = g_strdup (*strv);
done = TRUE;
break;
}
@@ -345,7 +347,23 @@ can_satisfy_mime_type_requirements (gchar **accepted_mime_types,
g_slist_free (formats);
- return done;
+ if (done) {
+ if (satisfactory_format_name != NULL) {
+ *satisfactory_format_name = name;
+ } else {
+ g_free (name);
+ }
+ if (satisfactory_mime_type != NULL) {
+ *satisfactory_mime_type = type;
+ } else {
+ g_free (type);
+ }
+ return TRUE;
+ } else {
+ /* check we're not leaking. */
+ g_assert (name == NULL && type == NULL);
+ return FALSE;
+ }
}
static EmpathyAvatar *