icon: Replace deprecated g_memdup with g_memdup2 where possible

This avoids a potential conversion from gsize to guint and silences a
warning.
This commit is contained in:
fwsmit 2021-04-06 19:48:25 +02:00
parent 7c6620c92d
commit 1d3822ee8b

View File

@ -347,7 +347,13 @@ GdkPixbuf *icon_get_for_data(GVariant *data, char **id)
return NULL; return NULL;
} }
// g_memdup is deprecated in glib 2.67.4 and higher.
// g_memdup2 is a safer alternative
#if GLIB_CHECK_VERSION(2,67,3)
data_pb = (guchar *) g_memdup2(g_variant_get_data(data_variant), len_actual);
#else
data_pb = (guchar *) g_memdup(g_variant_get_data(data_variant), len_actual); data_pb = (guchar *) g_memdup(g_variant_get_data(data_variant), len_actual);
#endif
pixbuf = gdk_pixbuf_new_from_data(data_pb, pixbuf = gdk_pixbuf_new_from_data(data_pb,
GDK_COLORSPACE_RGB, GDK_COLORSPACE_RGB,