changeset 32103:04da24405c6c

Replace malloc+memset by calloc.
author reimar
date Sun, 12 Sep 2010 12:41:37 +0000
parents 52f920e9c540
children e24003316c1c
files libmpcodecs/ve_lavc.c
diffstat 1 files changed, 7 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/ve_lavc.c	Sun Sep 12 12:32:28 2010 +0000
+++ b/libmpcodecs/ve_lavc.c	Sun Sep 12 12:41:37 2010 +0000
@@ -928,8 +928,7 @@
     vf->control=control;
     vf->query_format=query_format;
     vf->put_image=put_image;
-    vf->priv=malloc(sizeof(struct vf_priv_s));
-    memset(vf->priv,0,sizeof(struct vf_priv_s));
+    vf->priv=calloc(1, sizeof(struct vf_priv_s));
     vf->priv->mux=(muxer_stream_t*)args;
 
     /* XXX: hack: some of the MJPEG decoder DLL's needs exported huffman
@@ -937,40 +936,34 @@
        huffman tables into the stream, so no problem */
     if (lavc_param_vcodec && !strcasecmp(lavc_param_vcodec, "mjpeg"))
     {
-	mux_v->bih=malloc(sizeof(BITMAPINFOHEADER)+28);
-	memset(mux_v->bih, 0, sizeof(BITMAPINFOHEADER)+28);
+	mux_v->bih=calloc(1, sizeof(BITMAPINFOHEADER)+28);
 	mux_v->bih->biSize=sizeof(BITMAPINFOHEADER)+28;
     }
     else if (lavc_param_vcodec && (!strcasecmp(lavc_param_vcodec, "huffyuv")
                                 || !strcasecmp(lavc_param_vcodec, "ffvhuff")))
     {
     /* XXX: hack: huffyuv needs to store huffman tables (allthough we dunno the size yet ...) */
-	mux_v->bih=malloc(sizeof(BITMAPINFOHEADER)+1000);
-	memset(mux_v->bih, 0, sizeof(BITMAPINFOHEADER)+1000);
+	mux_v->bih=calloc(1, sizeof(BITMAPINFOHEADER)+1000);
 	mux_v->bih->biSize=sizeof(BITMAPINFOHEADER)+1000;
     }
     else if (lavc_param_vcodec && !strcasecmp(lavc_param_vcodec, "asv1"))
     {
-	mux_v->bih=malloc(sizeof(BITMAPINFOHEADER)+8);
-	memset(mux_v->bih, 0, sizeof(BITMAPINFOHEADER)+8);
+	mux_v->bih=calloc(1, sizeof(BITMAPINFOHEADER)+8);
 	mux_v->bih->biSize=sizeof(BITMAPINFOHEADER)+8;
     }
     else if (lavc_param_vcodec && !strcasecmp(lavc_param_vcodec, "asv2"))
     {
-	mux_v->bih=malloc(sizeof(BITMAPINFOHEADER)+8);
-	memset(mux_v->bih, 0, sizeof(BITMAPINFOHEADER)+8);
+	mux_v->bih=calloc(1, sizeof(BITMAPINFOHEADER)+8);
 	mux_v->bih->biSize=sizeof(BITMAPINFOHEADER)+8;
     }
     else if (lavc_param_vcodec && !strcasecmp(lavc_param_vcodec, "wmv2"))
     {
-	mux_v->bih=malloc(sizeof(BITMAPINFOHEADER)+4);
-	memset(mux_v->bih, 0, sizeof(BITMAPINFOHEADER)+4);
+	mux_v->bih=calloc(1, sizeof(BITMAPINFOHEADER)+4);
 	mux_v->bih->biSize=sizeof(BITMAPINFOHEADER)+4;
     }
     else
     {
-	mux_v->bih=malloc(sizeof(BITMAPINFOHEADER));
-	memset(mux_v->bih, 0, sizeof(BITMAPINFOHEADER));
+	mux_v->bih=calloc(1, sizeof(BITMAPINFOHEADER));
 	mux_v->bih->biSize=sizeof(BITMAPINFOHEADER);
     }
     mux_v->bih->biWidth=0;