diff options
author | Tim-Philipp Müller <tim@centricular.com> | 2021-05-23 19:15:25 +0100 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek@centricular.com> | 2021-08-05 20:51:00 +0530 |
commit | a561b1bd8601ed8ae8769339cc8d93c2c23e2d84 (patch) | |
tree | 632d06f7df0536e5e083826b182ddaf50a9503b1 /gst-libs | |
parent | 743387052856352c9baa66b6c5c197e3ec5f452b (diff) | |
download | gstreamer-plugins-bad-a561b1bd8601ed8ae8769339cc8d93c2c23e2d84.tar.gz |
Use g_memdup2() where available and add fallback for older GLib versions
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/gst-plugins-bad/-/merge_requests/2280>
Diffstat (limited to 'gst-libs')
-rw-r--r-- | gst-libs/gst/codecparsers/gsth264parser.c | 2 | ||||
-rw-r--r-- | gst-libs/gst/mpegts/gst-dvb-descriptor.c | 14 | ||||
-rw-r--r-- | gst-libs/gst/mpegts/gstmpegtsdescriptor.c | 4 | ||||
-rw-r--r-- | gst-libs/gst/mpegts/gstmpegtssection.c | 2 |
4 files changed, 11 insertions, 11 deletions
diff --git a/gst-libs/gst/codecparsers/gsth264parser.c b/gst-libs/gst/codecparsers/gsth264parser.c index 68aa25068..1a610f662 100644 --- a/gst-libs/gst/codecparsers/gsth264parser.c +++ b/gst-libs/gst/codecparsers/gsth264parser.c @@ -271,7 +271,7 @@ gst_h264_pps_copy (GstH264PPS * dst_pps, const GstH264PPS * src_pps) *dst_pps = *src_pps; if (src_pps->slice_group_id) - dst_pps->slice_group_id = g_memdup (src_pps->slice_group_id, + dst_pps->slice_group_id = g_memdup2 (src_pps->slice_group_id, src_pps->pic_size_in_map_units_minus1 + 1); return TRUE; diff --git a/gst-libs/gst/mpegts/gst-dvb-descriptor.c b/gst-libs/gst/mpegts/gst-dvb-descriptor.c index 399f405b4..e9ca2b191 100644 --- a/gst-libs/gst/mpegts/gst-dvb-descriptor.c +++ b/gst-libs/gst/mpegts/gst-dvb-descriptor.c @@ -204,7 +204,7 @@ gst_mpegts_descriptor_parse_dvb_stuffing (const GstMpegtsDescriptor * data = (guint8 *) descriptor->data + 2; - *stuffing_bytes = g_memdup (data, descriptor->length); + *stuffing_bytes = g_memdup2 (data, descriptor->length); return TRUE; } @@ -600,7 +600,7 @@ _gst_mpegts_dvb_linkage_descriptor_copy (GstMpegtsDVBLinkageDescriptor * source) break; } - copy->private_data_bytes = g_memdup (source->private_data_bytes, + copy->private_data_bytes = g_memdup2 (source->private_data_bytes, source->private_data_length); return copy; @@ -825,7 +825,7 @@ gst_mpegts_descriptor_parse_dvb_linkage (const GstMpegtsDescriptor * descriptor, } res->private_data_length = end - data; - res->private_data_bytes = g_memdup (data, res->private_data_length); + res->private_data_bytes = g_memdup2 (data, res->private_data_length); *desc = res; @@ -2013,7 +2013,7 @@ gst_mpegts_descriptor_parse_dvb_private_data_specifier (const if (length && private_data) { *length = descriptor->length - 4; - *private_data = g_memdup (data + 4, *length); + *private_data = g_memdup2 (data + 4, *length); } return TRUE; } @@ -2091,7 +2091,7 @@ _gst_mpegts_dvb_data_broadcast_descriptor_copy (GstMpegtsDataBroadcastDescriptor copy = g_slice_dup (GstMpegtsDataBroadcastDescriptor, source); - copy->selector_bytes = g_memdup (source->selector_bytes, source->length); + copy->selector_bytes = g_memdup2 (source->selector_bytes, source->length); copy->language_code = g_strdup (source->language_code); copy->text = g_strdup (source->text); @@ -2145,7 +2145,7 @@ gst_mpegts_descriptor_parse_dvb_data_broadcast (const GstMpegtsDescriptor res->length = *data; data += 1; - res->selector_bytes = g_memdup (data, res->length); + res->selector_bytes = g_memdup2 (data, res->length); data += res->length; res->language_code = convert_lang_code (data); @@ -2220,7 +2220,7 @@ gst_mpegts_descriptor_parse_dvb_data_broadcast_id (const GstMpegtsDescriptor *len = descriptor->length - 2; - *id_selector_bytes = g_memdup (data, *len); + *id_selector_bytes = g_memdup2 (data, *len); return TRUE; } diff --git a/gst-libs/gst/mpegts/gstmpegtsdescriptor.c b/gst-libs/gst/mpegts/gstmpegtsdescriptor.c index e63aa5c22..e6b18c1be 100644 --- a/gst-libs/gst/mpegts/gstmpegtsdescriptor.c +++ b/gst-libs/gst/mpegts/gstmpegtsdescriptor.c @@ -700,7 +700,7 @@ _copy_descriptor (GstMpegtsDescriptor * desc) GstMpegtsDescriptor *copy; copy = g_slice_dup (GstMpegtsDescriptor, desc); - copy->data = g_memdup (desc->data, desc->length + 2); + copy->data = g_memdup2 (desc->data, desc->length + 2); return copy; } @@ -788,7 +788,7 @@ gst_mpegts_parse_descriptors (guint8 * buffer, gsize buf_len) desc->tag = *data++; desc->length = *data++; /* Copy the data now that we known the size */ - desc->data = g_memdup (desc->data, desc->length + 2); + desc->data = g_memdup2 (desc->data, desc->length + 2); GST_LOG ("descriptor 0x%02x length:%d", desc->tag, desc->length); GST_MEMDUMP ("descriptor", desc->data + 2, desc->length); /* extended descriptors */ diff --git a/gst-libs/gst/mpegts/gstmpegtssection.c b/gst-libs/gst/mpegts/gstmpegtssection.c index d93253f58..cb15d2013 100644 --- a/gst-libs/gst/mpegts/gstmpegtssection.c +++ b/gst-libs/gst/mpegts/gstmpegtssection.c @@ -233,7 +233,7 @@ _gst_mpegts_section_copy (GstMpegtsSection * section) copy->last_section_number = section->last_section_number; copy->crc = section->crc; - copy->data = g_memdup (section->data, section->section_length); + copy->data = g_memdup2 (section->data, section->section_length); copy->section_length = section->section_length; /* Note: We do not copy the cached parsed item, it will be * reconstructed on that copy */ |