[MPlayer-dev-eng] rm casts from void *

Reynaldo H. Verdejo Pinochet reynaldo at opendot.cl
Sat Jul 1 06:38:03 CEST 2006


I have several like this one, maybe i hurry up a little on the
one i already commited, thumbs up?

	Reynaldo
-------------- next part --------------
Index: input/input.c
===================================================================
--- input/input.c	(revision 18872)
+++ input/input.c	(working copy)
@@ -690,7 +690,7 @@
 	ptr2 = e + 1;
         l--;
       }
-      cmd->args[i].v.s = (char*)malloc(l+1);
+      cmd->args[i].v.s = malloc(l+1);
       strncpy(cmd->args[i].v.s,start,l);
       cmd->args[i].v.s[l] = '\0';
       if(term != ' ') ptr += l+2;
@@ -746,7 +746,7 @@
 
   // Allocate the buffer if it doesn't exist
   if(!mp_fd->buffer) {
-    mp_fd->buffer = (char*)malloc(MP_CMD_MAX_SIZE);
+    mp_fd->buffer = malloc(MP_CMD_MAX_SIZE);
     mp_fd->pos = 0;
     mp_fd->size = MP_CMD_MAX_SIZE;
   } 
@@ -802,7 +802,7 @@
 
     // Not dropping : put the cmd in ret
     if( ! (mp_fd->flags & MP_FD_DROP)) {
-      (*ret) = (char*)malloc(l+1);
+      (*ret) = malloc(l+1);
       strncpy((*ret),mp_fd->buffer,l);
       (*ret)[l] = '\0';
     } else { // Remove the dropping flag
@@ -1275,7 +1275,7 @@
   assert(cmd != NULL);
 #endif
 
-  ret = (mp_cmd_t*)malloc(sizeof(mp_cmd_t));
+  ret = malloc(sizeof(mp_cmd_t));
   memcpy(ret,cmd,sizeof(mp_cmd_t));
   if(cmd->name)
     ret->name = strdup(cmd->name);
Index: libvo/vo_s3fb.c
===================================================================
--- libvo/vo_s3fb.c	(revision 18872)
+++ libvo/vo_s3fb.c	(working copy)
@@ -105,7 +105,7 @@
   if (v)
     return 1;
   errno = 0;
-  v = (vga_t *)malloc(sizeof(vga_t));
+  v = malloc(sizeof(vga_t));
   if (v) {
     if (ioperm(0x3d4, 2, 1) == 0) {
       fd = open("/dev/mem", O_RDWR);
Index: libvo/vo_macosx.m
===================================================================
--- libvo/vo_macosx.m	(revision 18872)
+++ libvo/vo_macosx.m	(working copy)
@@ -125,7 +125,7 @@
 			break;
 	}
 	image_bytes = (image_depth + 7) / 8;
-	image_data = (unsigned char*)malloc(image_width*image_height*image_bytes);
+	image_data = malloc(image_width*image_height*image_bytes);
 		
 	if(!shared_buffer)
 	{		
Index: libvo/font_load_ft.c
===================================================================
--- libvo/font_load_ft.c	(revision 18872)
+++ libvo/font_load_ft.c	(working copy)
@@ -618,9 +618,9 @@
 
     desc->faces[pic_idx] = face;
 
-    desc->pic_a[pic_idx] = (raw_file*)malloc(sizeof(raw_file));
+    desc->pic_a[pic_idx] = malloc(sizeof(raw_file));
     if (!desc->pic_a[pic_idx]) return -1;
-    desc->pic_b[pic_idx] = (raw_file*)malloc(sizeof(raw_file));
+    desc->pic_b[pic_idx] = malloc(sizeof(raw_file));
     if (!desc->pic_b[pic_idx]) return -1;
 
     desc->pic_a[pic_idx]->bmp = NULL;
@@ -628,11 +628,11 @@
     desc->pic_b[pic_idx]->bmp = NULL;
     desc->pic_b[pic_idx]->pal = NULL;
 
-    desc->pic_a[pic_idx]->pal = (unsigned char*)malloc(sizeof(unsigned char)*256*3);
+    desc->pic_a[pic_idx]->pal = malloc(sizeof(unsigned char)*256*3);
     if (!desc->pic_a[pic_idx]->pal) return -1;
     for (i = 0; i<768; ++i) desc->pic_a[pic_idx]->pal[i] = i/3;
 
-    desc->pic_b[pic_idx]->pal = (unsigned char*)malloc(sizeof(unsigned char)*256*3);
+    desc->pic_b[pic_idx]->pal = malloc(sizeof(unsigned char)*256*3);
     if (!desc->pic_b[pic_idx]->pal) return -1;
     for (i = 0; i<768; ++i) desc->pic_b[pic_idx]->pal[i] = i/3;
 
@@ -673,13 +673,13 @@
 //    fprintf(stderr, "o_r = %d\n", desc->tables.o_r);
 
     if (desc->tables.g_r) {
-	desc->tables.g = (unsigned*)malloc(desc->tables.g_w * sizeof(unsigned));
-	desc->tables.gt2 = (unsigned*)malloc(256 * desc->tables.g_w * sizeof(unsigned));
+	desc->tables.g = malloc(desc->tables.g_w * sizeof(unsigned));
+	desc->tables.gt2 = malloc(256 * desc->tables.g_w * sizeof(unsigned));
 	if (desc->tables.g==NULL || desc->tables.gt2==NULL) {
 	    return -1;
 	}
     }
-    desc->tables.om = (unsigned*)malloc(desc->tables.o_w*desc->tables.o_w * sizeof(unsigned));
+    desc->tables.om = malloc(desc->tables.o_w*desc->tables.o_w * sizeof(unsigned));
     desc->tables.omt = malloc(desc->tables.o_size*256);
 
     omtp = desc->tables.omt;
Index: libvo/vo_xvmc.c
===================================================================
--- libvo/vo_xvmc.c	(revision 18872)
+++ libvo/vo_xvmc.c	(working copy)
@@ -779,7 +779,7 @@
 
       snum = subpicture.num_palette_entries;
       seb = subpicture.entry_bytes;
-      palette = (char*)malloc(snum*seb);//check fail
+      palette = malloc(snum*seb);//check fail
       if(palette == NULL) return;
       for(i=0; i<snum; i++){
          // 0-black max-white the other are gradients
Index: libvo/vo_gl.c
===================================================================
--- libvo/vo_gl.c	(revision 18872)
+++ libvo/vo_gl.c	(working copy)
@@ -457,7 +457,7 @@
   glCreateClearTex(gl_target, GL_ALPHA, scale_type, sx, sy, 255);
   {
   int i;
-  char *tmp = (char *)malloc(stride * h);
+  char *tmp = malloc(stride * h);
   // convert alpha from weird MPlayer scale.
   // in-place is not possible since it is reused for future OSDs
   for (i = h * stride - 1; i > 0; i--)
Index: libvo/vo_directfb2.c
===================================================================
--- libvo/vo_directfb2.c	(revision 18872)
+++ libvo/vo_directfb2.c	(working copy)
@@ -222,7 +222,7 @@
 	{
 	    int argc = 2;
 	    char arg0[10] = "mplayer";
-	    char *arg1 = (char *)malloc(dfb_params.len + 7);
+	    char *arg1 = malloc(dfb_params.len + 7);
 	    char* argv[3];
 	    char ** a;
 	    
Index: libvo/gl_common.c
===================================================================
--- libvo/gl_common.c	(revision 18872)
+++ libvo/gl_common.c	(working copy)
@@ -298,7 +298,7 @@
   char *allexts;
   if (!extensions) extensions = "";
   if (!ext2) ext2 = "";
-  allexts = (char *)malloc(strlen(extensions) + strlen(ext2) + 2);
+  allexts = malloc(strlen(extensions) + strlen(ext2) + 2);
   strcpy(allexts, extensions);
   strcat(allexts, " ");
   strcat(allexts, ext2);
@@ -332,7 +332,7 @@
   GLfloat fval = (GLfloat)val / 255.0;
   GLfloat border[4] = {fval, fval, fval, fval};
   GLenum clrfmt = (fmt == GL_ALPHA) ? GL_ALPHA : GL_LUMINANCE;
-  char *init = (char *)malloc(w * h);
+  char *init = malloc(w * h);
   memset(init, val, w * h);
   glAdjustAlignment(w);
   glPixelStorei(GL_UNPACK_ROW_LENGTH, w);
@@ -400,7 +400,7 @@
     return 0;
   if (w > MAXDIM || h > MAXDIM)
     return 0;
-  data = (char *)malloc(w * h * 3);
+  data = malloc(w * h * 3);
   if (fread(data, w * 3, h, f) != h)
     return 0;
   glCreateClearTex(target, fmt, filter, w, h, 0);
Index: loader/win32.c
===================================================================
--- loader/win32.c	(revision 18872)
+++ loader/win32.c	(working copy)
@@ -2759,7 +2759,7 @@
 	dbgprintf("GetPrivateProfileIntA('%s', '%s', %d, '%s') => %d\n", appname, keyname, default_value, filename, default_value );
 	return default_value;
     }
-    fullname=(char*)malloc(50+strlen(appname)+strlen(keyname)+strlen(filename));
+    fullname=malloc(50+strlen(appname)+strlen(keyname)+strlen(filename));
     strcpy(fullname, "Software\\IniFileMapping\\");
     strcat(fullname, appname);
     strcat(fullname, "\\");
@@ -2797,7 +2797,7 @@
     char* fullname;
     dbgprintf("GetPrivateProfileStringA('%s', '%s', def_val '%s', 0x%x, 0x%x, '%s')", appname, keyname, def_val, dest, len, filename );
     if(!(appname && keyname && filename) ) return 0;
-    fullname=(char*)malloc(50+strlen(appname)+strlen(keyname)+strlen(filename));
+    fullname=malloc(50+strlen(appname)+strlen(keyname)+strlen(filename));
     strcpy(fullname, "Software\\IniFileMapping\\");
     strcat(fullname, appname);
     strcat(fullname, "\\");
@@ -2828,7 +2828,7 @@
 	dbgprintf(" => -1\n");
 	return -1;
     }
-    fullname=(char*)malloc(50+strlen(appname)+strlen(keyname)+strlen(filename));
+    fullname=malloc(50+strlen(appname)+strlen(keyname)+strlen(filename));
     strcpy(fullname, "Software\\IniFileMapping\\");
     strcat(fullname, appname);
     strcat(fullname, "\\");
@@ -3542,7 +3542,7 @@
     if(strstr(cs1, "QuickTime.qts"))
     {
 	int result;
-	char* tmp=(char*)malloc(strlen(def_path)+50);
+	char* tmp=malloc(strlen(def_path)+50);
 	strcpy(tmp, def_path);
 	strcat(tmp, "/");
 	strcat(tmp, "QuickTime.qts");
@@ -3553,7 +3553,7 @@
     if(strstr(cs1, ".qtx"))
     {
 	int result;
-	char* tmp=(char*)malloc(strlen(def_path)+250);
+	char* tmp=malloc(strlen(def_path)+250);
 	char* x=strrchr(cs1,'\\');
 	sprintf(tmp,"%s/%s",def_path,x?(x+1):cs1);
 //	printf("### Open: %s -> %s\n",cs1,tmp);
@@ -3566,7 +3566,7 @@
     if(strncmp(cs1, "AP", 2) == 0)
     {
 	int result;
-	char* tmp=(char*)malloc(strlen(def_path)+50);
+	char* tmp=malloc(strlen(def_path)+50);
 	strcpy(tmp, def_path);
 	strcat(tmp, "/");
 	strcat(tmp, "APmpg4v1.apl");
@@ -3578,7 +3578,7 @@
     {
 	int r;
 	int flg = 0;
-	char* tmp=(char*)malloc(20 + strlen(cs1));
+	char* tmp=malloc(20 + strlen(cs1));
 	strcpy(tmp, "/tmp/");
 	strcat(tmp, cs1);
 	r = 4;
Index: loader/afl.c
===================================================================
--- loader/afl.c	(revision 18872)
+++ loader/afl.c	(working copy)
@@ -282,7 +282,7 @@
 	MSACM_hHeap = GetProcessHeap();
 #endif
     padid = (PWINE_ACMDRIVERID) HeapAlloc(MSACM_hHeap, 0, sizeof(WINE_ACMDRIVERID));
-    padid->pszFileName = (char*)malloc(strlen(pszFileName)+1);
+    padid->pszFileName = malloc(strlen(pszFileName)+1);
     strcpy(padid->pszFileName, pszFileName);
 //    1~strdup(pszDriverAlias);
     padid->wFormatTag = wFormatTag;
Index: loader/registry.c
===================================================================
--- loader/registry.c	(revision 18872)
+++ loader/registry.c	(working copy)
@@ -66,11 +66,11 @@
 	save_registry();
 	return;
     }
-    regs=(struct reg_value*)malloc(3*sizeof(struct reg_value));
+    regs=malloc(3*sizeof(struct reg_value));
     regs[0].type=regs[1].type=DIR;
-    regs[0].name=(char*)malloc(5);
+    regs[0].name=malloc(5);
     strcpy(regs[0].name, "HKLM");
-    regs[1].name=(char*)malloc(5);
+    regs[1].name=malloc(5);
     strcpy(regs[1].name, "HKCU");
     regs[0].value=regs[1].value=NULL;
     regs[0].len=regs[1].len=0;
@@ -97,13 +97,13 @@
 	    return;
 	}
 	read(fd, &reg_size, 4);
-	regs=(struct reg_value*)malloc(reg_size*sizeof(struct reg_value));
+	regs=malloc(reg_size*sizeof(struct reg_value));
 	head = 0;
 	for(i=0; i<reg_size; i++)
 	{
 		read(fd,&regs[i].type,4);
 		read(fd,&len,4);
-		regs[i].name=(char*)malloc(len+1);
+		regs[i].name=malloc(len+1);
 		if(regs[i].name==0)
 		{
 			reg_size=i+1;
@@ -112,7 +112,7 @@
 		read(fd, regs[i].name, len);
 		regs[i].name[len]=0;
 		read(fd,&regs[i].len,4);
-		regs[i].value=(char*)malloc(regs[i].len+1);
+		regs[i].value=malloc(regs[i].len+1);
 		if(regs[i].value==0)
 		{
 		        free(regs[i].name);
@@ -226,7 +226,7 @@
 static reg_handle_t* insert_handle(long handle, const char* name)
 {
 	reg_handle_t* t;
-	t=(reg_handle_t*)malloc(sizeof(reg_handle_t));
+	t=malloc(sizeof(reg_handle_t));
 	if(head==0)
 	{
 		t->prev=0;
@@ -237,7 +237,7 @@
 		t->prev=head;
 	}
 	t->next=0;
-	t->name=(char*)malloc(strlen(name)+1);
+	t->name=malloc(strlen(name)+1);
 	strcpy(t->name, name);
 	t->handle=handle;
 	head=t;
@@ -254,7 +254,7 @@
 	}
 	if(subkey==NULL)
 		subkey="<default>";
-	full_name=(char*)malloc(strlen(t->name)+strlen(subkey)+10);
+	full_name=malloc(strlen(t->name)+strlen(subkey)+10);
 	strcpy(full_name, t->name);
 	strcat(full_name, "\\");
 	strcat(full_name, subkey);
@@ -290,9 +290,9 @@
 	TRACE("RegInsert '%s'  %p  v:%d  len:%d\n", name, value, *(int*)value, len);
 	v->type=type;
 	v->len=len;
-	v->value=(char*)malloc(len);
+	v->value=malloc(len);
 	memcpy(v->value, value, len);
-	v->name=(char*)malloc(strlen(fullname)+1);
+	v->name=malloc(strlen(fullname)+1);
 	strcpy(v->name, fullname);
         free(fullname);
 	save_registry();
@@ -325,7 +325,7 @@
                 pthn = pwent->pw_dir;
 	    }
 
-	    localregpathname = (char*)malloc(strlen(pthn)+20);
+	    localregpathname = malloc(strlen(pthn)+20);
 	    strcpy(localregpathname, pthn);
 	    strcat(localregpathname, "/.registry");
 	}
@@ -347,7 +347,7 @@
 	}
 	if(subkey==NULL)
 		return t;
-	full_name=(char*)malloc(strlen(t->name)+strlen(subkey)+10);
+	full_name=malloc(strlen(t->name)+strlen(subkey)+10);
 	strcpy(full_name, t->name);
 	strcat(full_name, "\\");
 	strcat(full_name, subkey);
Index: loader/ldt_keeper.c
===================================================================
--- loader/ldt_keeper.c	(revision 18872)
+++ loader/ldt_keeper.c	(working copy)
@@ -272,7 +272,7 @@
 
     Setup_FS_Segment();
 
-    ldt_fs->prev_struct = (char*)malloc(8);
+    ldt_fs->prev_struct = malloc(8);
     *(void**)array.base_addr = ldt_fs->prev_struct;
 
     return ldt_fs;
Index: loader/vfl.c
===================================================================
--- loader/vfl.c	(revision 18872)
+++ loader/vfl.c	(working copy)
@@ -78,7 +78,7 @@
 	/* FIXME: do we need to fill out the rest too? */
 	hdrv=OpenDriverA((long)&icopen);
 	if (!hdrv) return 0;
-	whic = (WINE_HIC*)malloc(sizeof(WINE_HIC));
+	whic = malloc(sizeof(WINE_HIC));
 	whic->hdrv	= hdrv;
 	whic->driverproc= ((DRVR*)hdrv)->DriverProc;
 //	whic->private	= ICSendMessage((HIC)whic,DRV_OPEN,0,(long)&icopen);
Index: loader/dmo/DMO_VideoDecoder.c
===================================================================
--- loader/dmo/DMO_VideoDecoder.c	(revision 18872)
+++ loader/dmo/DMO_VideoDecoder.c	(working copy)
@@ -119,7 +119,7 @@
 	bihs = (format->biSize < (int) sizeof(BITMAPINFOHEADER)) ?
 	    sizeof(BITMAPINFOHEADER) : format->biSize;
      
-        this->iv.m_bh = (BITMAPINFOHEADER*)malloc(bihs);
+        this->iv.m_bh = malloc(bihs);
         memcpy(this->iv.m_bh, format, bihs);
 
         this->iv.m_State = STOP;
@@ -131,7 +131,7 @@
         this->iv.m_bCapable16b = true;
                 
         bihs += sizeof(VIDEOINFOHEADER) - sizeof(BITMAPINFOHEADER);
-	this->m_sVhdr = (VIDEOINFOHEADER*)malloc(bihs);
+	this->m_sVhdr = malloc(bihs);
 	memset(this->m_sVhdr, 0, bihs);
 	memcpy(&this->m_sVhdr->bmiHeader, this->iv.m_bh, this->iv.m_bh->biSize);
 	this->m_sVhdr->rcSource.left = this->m_sVhdr->rcSource.top = 0;
Index: loader/dshow/inputpin.c
===================================================================
--- loader/dshow/inputpin.c	(revision 18872)
+++ loader/dshow/inputpin.c	(working copy)
@@ -179,7 +179,7 @@
     *pmt=((CInputPin*)This)->type;
     if (pmt->cbFormat > 0)
     {
-	pmt->pbFormat=(char *)malloc(pmt->cbFormat);
+	pmt->pbFormat=malloc(pmt->cbFormat);
 	memcpy(pmt->pbFormat, ((CInputPin*)This)->type.pbFormat, pmt->cbFormat);
     }
     return 0;
Index: loader/dshow/outputpin.c
===================================================================
--- loader/dshow/outputpin.c	(revision 18872)
+++ loader/dshow/outputpin.c	(working copy)
@@ -56,12 +56,12 @@
 
     if (pcFetched)
 	*pcFetched=1;
-    ppMediaTypes[0] = (AM_MEDIA_TYPE *)malloc(sizeof(AM_MEDIA_TYPE));
+    ppMediaTypes[0] = malloc(sizeof(AM_MEDIA_TYPE));
     // copy structures - C can handle this...
     **ppMediaTypes = *type;
     if (ppMediaTypes[0]->pbFormat)
     {
-	ppMediaTypes[0]->pbFormat=(char *)malloc(ppMediaTypes[0]->cbFormat);
+	ppMediaTypes[0]->pbFormat=malloc(ppMediaTypes[0]->cbFormat);
 	memcpy(ppMediaTypes[0]->pbFormat, type->pbFormat, ppMediaTypes[0]->cbFormat);
     }
     if (cMediaTypes == 1)
@@ -219,7 +219,7 @@
     *pmt = ((COutputPin*)This)->type;
     if (pmt->cbFormat>0)
     {
-	pmt->pbFormat=(char *)malloc(pmt->cbFormat);
+	pmt->pbFormat=malloc(pmt->cbFormat);
 	memcpy(pmt->pbFormat, ((COutputPin*)This)->type.pbFormat, pmt->cbFormat);
     }
     return 0;
Index: loader/dshow/test.c
===================================================================
--- loader/dshow/test.c	(revision 18872)
+++ loader/dshow/test.c	(working copy)
@@ -20,7 +20,7 @@
     fread(&bih,sizeof(BITMAPINFOHEADER),1,f);
     printf("frame dim: %d x %d \n",(int)bih.biWidth,(int)bih.biHeight);
 
-    src=(char*)malloc(512000);
+    src=malloc(512000);
     len=fread(src,1,512000,f);
     printf("frame len = %d\n",len);
 
Index: loader/dshow/DS_VideoDecoder.c
===================================================================
--- loader/dshow/DS_VideoDecoder.c	(revision 18872)
+++ loader/dshow/DS_VideoDecoder.c	(working copy)
@@ -114,7 +114,7 @@
 	bihs = (format->biSize < (int) sizeof(BITMAPINFOHEADER)) ?
 	    sizeof(BITMAPINFOHEADER) : format->biSize;
      
-        this->iv.m_bh = (BITMAPINFOHEADER*)malloc(bihs);
+        this->iv.m_bh = malloc(bihs);
         memcpy(this->iv.m_bh, format, bihs);
 
         this->iv.m_State = STOP;
@@ -126,7 +126,7 @@
         this->iv.m_bCapable16b = true;
                 
         bihs += sizeof(VIDEOINFOHEADER) - sizeof(BITMAPINFOHEADER);
-	this->m_sVhdr = (VIDEOINFOHEADER*)malloc(bihs);
+	this->m_sVhdr = malloc(bihs);
 	memset(this->m_sVhdr, 0, bihs);
 	memcpy(&this->m_sVhdr->bmiHeader, this->iv.m_bh, this->iv.m_bh->biSize);
 	this->m_sVhdr->rcSource.left = this->m_sVhdr->rcSource.top = 0;
Index: loader/dshow/cmediasample.c
===================================================================
--- loader/dshow/cmediasample.c	(revision 18872)
+++ loader/dshow/cmediasample.c	(working copy)
@@ -178,9 +178,9 @@
 
     t = &((CMediaSample*)This)->media_type;
     //    if(t.pbFormat)free(t.pbFormat);
-    (*ppMediaType) = (AM_MEDIA_TYPE*)malloc(sizeof(AM_MEDIA_TYPE));
+    (*ppMediaType) = malloc(sizeof(AM_MEDIA_TYPE));
     **ppMediaType = *t;
-    (*ppMediaType)->pbFormat = (char*)malloc(t->cbFormat);
+    (*ppMediaType)->pbFormat = malloc(t->cbFormat);
     memcpy((*ppMediaType)->pbFormat, t->pbFormat, t->cbFormat);
     //    *ppMediaType=0; //media type was not changed
     return 0;
@@ -199,7 +199,7 @@
     t = pMediaType;
     if (t->cbFormat)
     {
-	t->pbFormat = (char*)malloc(t->cbFormat);
+	t->pbFormat = malloc(t->cbFormat);
 	memcpy(t->pbFormat, pMediaType->pbFormat, t->cbFormat);
     }
     else
Index: loader/module.c
===================================================================
--- loader/module.c	(revision 18872)
+++ loader/module.c	(working copy)
@@ -242,7 +242,7 @@
     }
     else
     {
-	local_wm = (modref_list*)malloc(sizeof(modref_list));
+	local_wm = malloc(sizeof(modref_list));
 	local_wm->next=local_wm->prev=NULL;
 	local_wm->wm=wm;
     }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20060701/d936345a/attachment.pgp>


More information about the MPlayer-dev-eng mailing list