Use g_memdup2() where available and add fallback for older GLib versions

Alloc size is based on existing allocations and struct sizes.

g_memdup() is deprecated since GLib 2.68 and we want to avoid
deprecation warnings with recent versions of GLib.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/431>
This commit is contained in:
Tim-Philipp Müller 2021-05-22 18:54:49 +01:00 committed by GStreamer Marge Bot
parent f3dcdfbd60
commit 2614333389
2 changed files with 5 additions and 1 deletions

View file

@ -671,7 +671,7 @@ op_data_ensure_caps (GstVaapiFilterOpData * op_data, gpointer filter_caps,
return FALSE;
}
op_data->va_caps = g_memdup (filter_cap, op_data->va_cap_size * va_num_caps);
op_data->va_caps = g_memdup2 (filter_cap, op_data->va_cap_size * va_num_caps);
if (!op_data->va_caps)
return FALSE;

View file

@ -208,6 +208,10 @@ if gst_version_nano == 0
endif
endif
if gmodule_dep.version().version_compare('< 2.67.4')
cdata.set('g_memdup2(ptr,sz)', '(G_LIKELY(((guint64)(sz)) < G_MAXUINT)) ? g_memdup(ptr,sz) : (g_abort(),NULL)')
endif
configure_file(output: 'config.h', configuration: cdata)
python3 = import('python').find_installation()