Use g_memdup2() where available and add fallback for older GLib versions
[platform/upstream/gstreamer.git] / gst-libs / gst / riff / riff-read.c
index a60b9cf..5e9f331 100644 (file)
@@ -235,7 +235,8 @@ gst_riff_parse_file_header (GstElement * element,
     goto too_small;
 
   tag = GST_READ_UINT32_LE (info.data);
-  if (tag != GST_RIFF_TAG_RIFF && tag != GST_RIFF_TAG_AVF0)
+  if (tag != GST_RIFF_TAG_RIFF && tag != GST_RIFF_TAG_AVF0
+      && tag != GST_RIFF_TAG_RF64)
     goto not_riff;
 
   *doctype = GST_READ_UINT32_LE (info.data + 8);
@@ -292,7 +293,7 @@ gst_riff_parse_strh (GstElement * element,
   if (info.size < sizeof (gst_riff_strh))
     goto too_small;
 
-  strh = g_memdup (info.data, info.size);
+  strh = g_memdup2 (info.data, info.size);
   gst_buffer_unmap (buf, &info);
 
   gst_buffer_unref (buf);
@@ -361,7 +362,7 @@ too_small:
  *        containing extradata for this particular stream (e.g.
  *        palette, codec initialization data).
  *
- * Parses a video stream´s strf structure plus optionally some
+ * Parses a video stream's strf structure plus optionally some
  * extradata from input data. This function takes ownership of @buf.
  *
  * Returns: TRUE if parsing succeeded, otherwise FALSE. The stream
@@ -383,7 +384,7 @@ gst_riff_parse_strf_vids (GstElement * element,
   if (info.size < sizeof (gst_riff_strf_vids))
     goto too_small;
 
-  strf = g_memdup (info.data, info.size);
+  strf = g_memdup2 (info.data, info.size);
   gst_buffer_unmap (buf, &info);
 
 #if (G_BYTE_ORDER == G_BIG_ENDIAN)
@@ -459,7 +460,7 @@ too_small:
  *        containing extradata for this particular stream (e.g.
  *        codec initialization data).
  *
- * Parses an audio stream´s strf structure plus optionally some
+ * Parses an audio stream's strf structure plus optionally some
  * extradata from input data. This function takes ownership of @buf.
  * use.
  *
@@ -481,7 +482,7 @@ gst_riff_parse_strf_auds (GstElement * element,
   if (info.size < sizeof (gst_riff_strf_auds))
     goto too_small;
 
-  strf = g_memdup (info.data, info.size);
+  strf = g_memdup2 (info.data, info.size);
 
 #if (G_BYTE_ORDER == G_BIG_ENDIAN)
   strf->format = GUINT16_FROM_LE (strf->format);
@@ -573,7 +574,7 @@ gst_riff_parse_strf_iavs (GstElement * element,
   if (info.size < sizeof (gst_riff_strf_iavs))
     goto too_small;
 
-  strf = g_memdup (info.data, info.size);
+  strf = g_memdup2 (info.data, info.size);
   gst_buffer_unmap (buf, &info);
 
   gst_buffer_unref (buf);