case CURLINFO_TEXT:
case CURLINFO_HEADER_IN:
case CURLINFO_HEADER_OUT:
- msg = g_memdup (data, size);
+ msg = g_memdup2 (data, size);
if (size > 0) {
msg[size - 1] = '\0';
g_strchomp (msg);
switch (type) {
case CURLINFO_TEXT:
case CURLINFO_HEADER_OUT:
- msg = g_memdup (data, size);
+ msg = g_memdup2 (data, size);
if (size > 0) {
msg[size - 1] = '\0';
g_strchomp (msg);
faad->samplerate = info->samplerate;
faad->channels = info->channels;
g_free (faad->channel_positions);
- faad->channel_positions = g_memdup (info->channel_position, faad->channels);
+ faad->channel_positions = g_memdup2 (info->channel_position, faad->channels);
faad->bps = 16 / 8;
g_free (hlsdemux_stream->current_key);
hlsdemux_stream->current_key = g_strdup (file->key);
g_free (hlsdemux_stream->current_iv);
- hlsdemux_stream->current_iv = g_memdup (file->iv, sizeof (file->iv));
+ hlsdemux_stream->current_iv = g_memdup2 (file->iv, sizeof (file->iv));
g_free (stream->fragment.uri);
stream->fragment.uri = g_strdup (file->uri);
n_lines = teletext->frame->current_slice - teletext->frame->sliced_begin;
GST_LOG_OBJECT (teletext, "Completed frame, decoding new %d lines",
n_lines);
- s = g_memdup (teletext->frame->sliced_begin,
+ s = g_memdup2 (teletext->frame->sliced_begin,
n_lines * sizeof (vbi_sliced));
vbi_decode (teletext->decoder, s, n_lines, teletext->last_ts);
/* From vbi_decode():
*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;
data = (guint8 *) descriptor->data + 2;
- *stuffing_bytes = g_memdup (data, descriptor->length);
+ *stuffing_bytes = g_memdup2 (data, descriptor->length);
return TRUE;
}
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;
}
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;
if (length && private_data) {
*length = descriptor->length - 4;
- *private_data = g_memdup (data + 4, *length);
+ *private_data = g_memdup2 (data + 4, *length);
}
return TRUE;
}
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);
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);
*len = descriptor->length - 2;
- *id_selector_bytes = g_memdup (data, *len);
+ *id_selector_bytes = g_memdup2 (data, *len);
return TRUE;
}
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;
}
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 */
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 */
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;
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;
* 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>
/* 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;
" 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;
}
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);
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);
}
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) {
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);
}
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);
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);
if (out_size) {
*out_size = size;
- return g_memdup (data, size);
+ return g_memdup2 (data, size);
} else {
return g_strndup (data, 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);
endif
endif
+if glib_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)
run_command(python3, '-c', 'import shutil; shutil.copy("hooks/pre-commit.hook", ".git/hooks/pre-commit")')
guint8 *data;
gst_buffer_map (codec_data, &minfo, GST_MAP_READ);
- data = g_memdup (minfo.data, minfo.size);
+ data = g_memdup2 (minfo.data, minfo.size);
self->codec_datas = g_list_prepend (self->codec_datas, data);
gst_amc_format_set_buffer (format, "csd-0", data, minfo.size, &err);
if (err)
fname = g_strdup_printf ("csd-%d", j);
gst_buffer_map (buf, &minfo, GST_MAP_READ);
- data = g_memdup (minfo.data, minfo.size);
+ data = g_memdup2 (minfo.data, minfo.size);
self->codec_datas = g_list_prepend (self->codec_datas, data);
gst_amc_format_set_buffer (format, fname, data, minfo.size, &err);
if (err)
GstMapInfo cminfo;
gst_buffer_map (state->codec_data, &cminfo, GST_MAP_READ);
- codec_data = g_memdup (cminfo.data, cminfo.size);
+ codec_data = g_memdup2 (cminfo.data, cminfo.size);
codec_data_size = cminfo.size;
is_format_change |= (!self->codec_data
goto done;
}
- ret = g_memdup (elems, sizeof (jint) * len);
+ ret = g_memdup2 (elems, sizeof (jint) * len);
*length = len;
done:
gst_amc_buffer_get_position_and_limit (&buf, NULL, &position, &limit);
*size = limit;
- *data = g_memdup (*data + position, limit);
+ *data = g_memdup2 (*data + position, limit);
ret = TRUE;
}
*size = buffer.length;
- *data = (guint8 *) g_memdup (buffer.ptr, buffer.length);
+ *data = (guint8 *) g_memdup2 (buffer.ptr, buffer.length);
MLMediaFormatKeyByteBufferRelease (format->handle, &buffer);
return TRUE;
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
#include <gst/check/gstcheck.h>
#include <gst/mpegts/mpegts.h>
guint8 *data;
GstDateTime *dt;
- data = g_memdup (stt_data_check, 20);
+ data = g_memdup2 (stt_data_check, 20);
section = gst_mpegts_section_new (0x1ffb, data, 20);
stt = gst_mpegts_section_get_atsc_stt (section);