[MPlayer-cvslog] r32187 - trunk/libmpcodecs/ve_lavc.c

reimar subversion at mplayerhq.hu
Sun Sep 12 14:41:37 CEST 2010


Author: reimar
Date: Sun Sep 12 14:41:37 2010
New Revision: 32187

Log:
Replace malloc+memset by calloc.

Modified:
   trunk/libmpcodecs/ve_lavc.c

Modified: trunk/libmpcodecs/ve_lavc.c
==============================================================================
--- trunk/libmpcodecs/ve_lavc.c	Sun Sep 12 14:32:28 2010	(r32186)
+++ trunk/libmpcodecs/ve_lavc.c	Sun Sep 12 14:41:37 2010	(r32187)
@@ -928,8 +928,7 @@ static int vf_open(vf_instance_t *vf, ch
     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 @@ static int vf_open(vf_instance_t *vf, ch
        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;


More information about the MPlayer-cvslog mailing list