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 | |
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')
-rw-r--r-- | gst/audiovisualizers/gstspectrascope.c | 2 | ||||
-rw-r--r-- | gst/mpegpsmux/mpegpsmux.c | 2 | ||||
-rw-r--r-- | gst/mpegtsdemux/mpegtspacketizer.c | 5 | ||||
-rw-r--r-- | gst/mpegtsdemux/tsdemux.c | 2 | ||||
-rw-r--r-- | gst/mxf/mxfaes-bwf.c | 4 | ||||
-rw-r--r-- | gst/mxf/mxfdms1.c | 2 | ||||
-rw-r--r-- | gst/mxf/mxfmetadata.c | 2 | ||||
-rw-r--r-- | gst/mxf/mxfmpeg.c | 2 | ||||
-rw-r--r-- | gst/mxf/mxftypes.c | 2 | ||||
-rw-r--r-- | gst/rtmp2/rtmp/amf.c | 6 |
10 files changed, 16 insertions, 13 deletions
diff --git a/gst/audiovisualizers/gstspectrascope.c b/gst/audiovisualizers/gstspectrascope.c index 06077f10a..52b81d41f 100644 --- a/gst/audiovisualizers/gstspectrascope.c +++ b/gst/audiovisualizers/gstspectrascope.c @@ -188,7 +188,7 @@ gst_spectra_scope_render (GstAudioVisualizer * bscope, GstBuffer * audio, channels = GST_AUDIO_INFO_CHANNELS (&bscope->ainfo); - mono_adata = (gint16 *) g_memdup (amap.data, amap.size); + mono_adata = g_memdup2 (amap.data, amap.size); if (channels > 1) { guint ch = channels; diff --git a/gst/mpegpsmux/mpegpsmux.c b/gst/mpegpsmux/mpegpsmux.c index 50c6c707e..4881177fc 100644 --- a/gst/mpegpsmux/mpegpsmux.c +++ b/gst/mpegpsmux/mpegpsmux.c @@ -673,7 +673,7 @@ new_packet_cb (guint8 * data, guint len, void *user_data) GST_LOG_OBJECT (mux, "Outputting a packet of length %d", len); - data = g_memdup (data, len); + data = g_memdup2 (data, len); buf = gst_buffer_new_wrapped (data, len); GST_BUFFER_TIMESTAMP (buf) = mux->last_ts; diff --git a/gst/mpegtsdemux/mpegtspacketizer.c b/gst/mpegtsdemux/mpegtspacketizer.c index 91df87f90..4e961feb0 100644 --- a/gst/mpegtsdemux/mpegtspacketizer.c +++ b/gst/mpegtsdemux/mpegtspacketizer.c @@ -21,6 +21,9 @@ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, * Boston, MA 02110-1301, USA. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include <string.h> #include <stdlib.h> @@ -1113,7 +1116,7 @@ section_start: /* Only do fast-path if we have enough byte */ if (data + section_length <= packet->data_end) { if ((section = - gst_mpegts_section_new (packet->pid, g_memdup (data, + gst_mpegts_section_new (packet->pid, g_memdup2 (data, section_length), section_length))) { GST_DEBUG ("PID 0x%04x Short section complete !", packet->pid); section->offset = packet->offset; diff --git a/gst/mpegtsdemux/tsdemux.c b/gst/mpegtsdemux/tsdemux.c index 0c0ece9bc..d648faa6f 100644 --- a/gst/mpegtsdemux/tsdemux.c +++ b/gst/mpegtsdemux/tsdemux.c @@ -825,7 +825,7 @@ scan_keyframe_h264 (TSDemuxStream * stream, const guint8 * data, " we will push later"); h264infos->framedata.data = - g_memdup (frame_unit.data + frame_unit.sc_offset, + g_memdup2 (frame_unit.data + frame_unit.sc_offset, stream->current_size - frame_unit.sc_offset); h264infos->framedata.size = stream->current_size - frame_unit.sc_offset; } diff --git a/gst/mxf/mxfaes-bwf.c b/gst/mxf/mxfaes-bwf.c index f0cd37c1e..d828233ff 100644 --- a/gst/mxf/mxfaes-bwf.c +++ b/gst/mxf/mxfaes-bwf.c @@ -211,7 +211,7 @@ mxf_metadata_wave_audio_essence_descriptor_handle_tag (MXFMetadataBase * mxf_timestamp_to_string (&self->peak_envelope_timestamp, str)); break; case 0x3d31: - self->peak_envelope_data = g_memdup (tag_data, tag_size); + self->peak_envelope_data = g_memdup2 (tag_data, tag_size); self->peak_envelope_data_length = tag_size; GST_DEBUG (" peak evelope data size = %u", self->peak_envelope_data_length); @@ -507,7 +507,7 @@ mxf_metadata_wave_audio_essence_descriptor_write_tags (MXFMetadataBase * m, t = g_slice_new0 (MXFLocalTag); memcpy (&t->ul, &peak_envelope_data_ul, 16); t->size = self->peak_envelope_data_length; - t->data = g_memdup (self->peak_envelope_data, t->size); + t->data = g_memdup2 (self->peak_envelope_data, t->size); mxf_primer_pack_add_mapping (primer, 0x3d31, &t->ul); ret = g_list_prepend (ret, t); } diff --git a/gst/mxf/mxfdms1.c b/gst/mxf/mxfdms1.c index bb5234e8f..6a611f8a3 100644 --- a/gst/mxf/mxfdms1.c +++ b/gst/mxf/mxfdms1.c @@ -1656,7 +1656,7 @@ mxf_dms1_identification_handle_tag (MXFMetadataBase * metadata, memcpy (self->identifier_kind, tag_data, tag_size); GST_DEBUG (" identifier kind = %s", self->identifier_kind); } else if (memcmp (tag_ul, &identifier_value_ul, 16) == 0) { - self->identifier_value = g_memdup (tag_data, tag_size); + self->identifier_value = g_memdup2 (tag_data, tag_size); self->identifier_value_length = tag_size; GST_DEBUG (" identifier value length = %u", tag_size); } else if (memcmp (tag_ul, &identification_locator_ul, 16) == 0) { diff --git a/gst/mxf/mxfmetadata.c b/gst/mxf/mxfmetadata.c index ac147d541..298f05942 100644 --- a/gst/mxf/mxfmetadata.c +++ b/gst/mxf/mxfmetadata.c @@ -252,7 +252,7 @@ mxf_metadata_base_to_buffer (MXFMetadataBase * self, MXFPrimerPack * primer) mxf_primer_pack_add_mapping (primer, 0x0000, &t->ul); memcpy (tmp->data, t->data, t->size); } else { - tmp->data = g_memdup (t->data, t->size); + tmp->data = g_memdup2 (t->data, t->size); } tags = g_list_prepend (tags, tmp); } diff --git a/gst/mxf/mxfmpeg.c b/gst/mxf/mxfmpeg.c index cb89696cf..2025437d2 100644 --- a/gst/mxf/mxfmpeg.c +++ b/gst/mxf/mxfmpeg.c @@ -1321,7 +1321,7 @@ mxf_mpeg_video_get_descriptor (GstPadTemplate * tmpl, GstCaps * caps, codec_data = gst_value_get_buffer (v); gst_buffer_map ((GstBuffer *) codec_data, &map, GST_MAP_READ); t->size = map.size; - t->data = g_memdup (map.data, map.size); + t->data = g_memdup2 (map.data, map.size); gst_buffer_unmap ((GstBuffer *) codec_data, &map); memcpy (&t->ul, &sony_mpeg4_extradata, 16); mxf_local_tag_insert (t, &MXF_METADATA_BASE (ret)->other_tags); diff --git a/gst/mxf/mxftypes.c b/gst/mxf/mxftypes.c index f5c2852e3..73a886907 100644 --- a/gst/mxf/mxftypes.c +++ b/gst/mxf/mxftypes.c @@ -1706,7 +1706,7 @@ mxf_local_tag_add_to_hash_table (const MXFPrimerPack * primer, local_tag = g_slice_new0 (MXFLocalTag); memcpy (&local_tag->ul, ul, sizeof (MXFUL)); local_tag->size = tag_size; - local_tag->data = tag_size == 0 ? NULL : g_memdup (tag_data, tag_size); + local_tag->data = tag_size == 0 ? NULL : g_memdup2 (tag_data, tag_size); local_tag->g_slice = FALSE; g_hash_table_insert (*hash_table, &local_tag->ul, local_tag); diff --git a/gst/rtmp2/rtmp/amf.c b/gst/rtmp2/rtmp/amf.c index f103b91c5..84c5cd41d 100644 --- a/gst/rtmp2/rtmp/amf.c +++ b/gst/rtmp2/rtmp/amf.c @@ -329,7 +329,7 @@ gst_amf_node_get_string (const GstAmfNode * node, gsize * out_size) if (out_size) { *out_size = size; - return g_memdup (data, size); + return g_memdup2 (data, size); } else { return g_strndup (data, size); } @@ -444,9 +444,9 @@ gst_amf_node_set_string (GstAmfNode * node, const gchar * value, gssize size) if (size < 0) { size = strlen (value); - copy = g_memdup (value, size + 1); + copy = g_memdup2 (value, size + 1); } else { - copy = g_memdup (value, size); + copy = g_memdup2 (value, size); } gst_amf_node_take_string (node, copy, size); |