changeset 19062:83c3afeab35d

drops casts from void * on malloc/calloc from libmpdemux code
author reynaldo
date Thu, 13 Jul 2006 16:41:13 +0000
parents 86350b4b8203
children 5525af2ee4c7
files libmpdemux/asf_streaming.c libmpdemux/asfheader.c libmpdemux/cdda.c libmpdemux/cddb.c libmpdemux/cdinfo.c libmpdemux/demux_audio.c libmpdemux/demux_fli.c libmpdemux/demux_lavf.c libmpdemux/demux_mov.c libmpdemux/demux_rawaudio.c libmpdemux/demux_rawdv.c libmpdemux/demux_realaud.c libmpdemux/demux_roq.c libmpdemux/demux_vqf.c libmpdemux/demux_xmms.c libmpdemux/network.c libmpdemux/stream_livedotcom.c libmpdemux/tv.c
diffstat 18 files changed, 36 insertions(+), 36 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/asf_streaming.c	Thu Jul 13 16:17:24 2006 +0000
+++ b/libmpdemux/asf_streaming.c	Thu Jul 13 16:41:13 2006 +0000
@@ -267,7 +267,7 @@
       switch(ASF_LOAD_GUID_PREFIX(streamh->type)) {
       case 0xF8699E40 : // audio stream
 	if(asf_ctrl->audio_streams == NULL){
-	  asf_ctrl->audio_streams = (int*)malloc(sizeof(int));
+	  asf_ctrl->audio_streams = malloc(sizeof(int));
 	  asf_ctrl->n_audio = 1;
 	} else {
 	  asf_ctrl->n_audio++;
@@ -278,7 +278,7 @@
 	break;
       case 0xBC19EFC0 : // video stream
 	if(asf_ctrl->video_streams == NULL){
-	  asf_ctrl->video_streams = (int*)malloc(sizeof(int));
+	  asf_ctrl->video_streams = malloc(sizeof(int));
 	  asf_ctrl->n_video = 1;
 	} else {
 	  asf_ctrl->n_video++;
@@ -715,7 +715,7 @@
 	int done;
 	int auth_retry = 0;
 
-	asf_http_ctrl = (asf_http_streaming_ctrl_t*)malloc(sizeof(asf_http_streaming_ctrl_t));
+	asf_http_ctrl = malloc(sizeof(asf_http_streaming_ctrl_t));
 	if( asf_http_ctrl==NULL ) {
 		mp_msg(MSGT_NETWORK,MSGL_FATAL,MSGTR_MemAllocFailed);
 		return -1;
--- a/libmpdemux/asfheader.c	Thu Jul 13 16:17:24 2006 +0000
+++ b/libmpdemux/asfheader.c	Thu Jul 13 16:41:13 2006 +0000
@@ -410,7 +410,7 @@
         ptr += sizeof(uint16_t);
         if (ptr > &hdr[hdr_len]) goto len_err_out;
         if(stream_count > 0)
-              streams = (uint32_t*)malloc(2*stream_count*sizeof(uint32_t));
+              streams = malloc(2*stream_count*sizeof(uint32_t));
         mp_msg(MSGT_HEADER,MSGL_V," stream count=[0x%x][%u]\n", stream_count, stream_count );
         for( i=0 ; i<stream_count ; i++ ) {
           stream_id = le2me_16(*(uint16_t*)ptr);
--- a/libmpdemux/cdda.c	Thu Jul 13 16:17:24 2006 +0000
+++ b/libmpdemux/cdda.c	Thu Jul 13 16:41:13 2006 +0000
@@ -185,7 +185,7 @@
   cd_info->sec  = (unsigned int)((audiolen/75)%60);
   cd_info->msec = (unsigned int)(audiolen%75);
 
-  priv = (cdda_priv*)malloc(sizeof(cdda_priv));
+  priv = malloc(sizeof(cdda_priv));
   memset(priv, 0, sizeof(cdda_priv));
   priv->cd = cdd;
   priv->cd_info = cd_info;
--- a/libmpdemux/cddb.c	Thu Jul 13 16:17:24 2006 +0000
+++ b/libmpdemux/cddb.c	Thu Jul 13 16:41:13 2006 +0000
@@ -349,7 +349,7 @@
 		file_size = stats.st_size;
 	}
 	
-	cddb_data->xmcd_file = (char*)malloc(file_size);
+	cddb_data->xmcd_file = malloc(file_size);
 	if( cddb_data->xmcd_file==NULL ) {
 		mp_msg(MSGT_DEMUX, MSGL_ERR, MSGTR_MemAllocFailed);
 		close(file_fd);
@@ -741,7 +741,7 @@
 	if( home_dir==NULL ) {
 		cddb_data.cache_dir = NULL;
 	} else {
-		cddb_data.cache_dir = (char*)malloc(strlen(home_dir)+strlen(cddb_cache_dir)+1);
+		cddb_data.cache_dir = malloc(strlen(home_dir)+strlen(cddb_cache_dir)+1);
 		if( cddb_data.cache_dir==NULL ) {
 			mp_msg(MSGT_DEMUX, MSGL_ERR, MSGTR_MemAllocFailed);
 			return -1;
@@ -779,14 +779,14 @@
 		ptr += 7;
 		album = strstr(ptr, "/");
 		if( album==NULL ) return NULL;
-		cd_info->album = (char*)malloc(strlen(album+2)+1);
+		cd_info->album = malloc(strlen(album+2)+1);
 		if( cd_info->album==NULL ) {
 			return NULL;
 		}
 		strcpy( cd_info->album, album+2 );
 		album--;
 		album[0] = '\0';
-		cd_info->artist = (char*)malloc(strlen(ptr)+1);
+		cd_info->artist = malloc(strlen(ptr)+1);
 		if( cd_info->artist==NULL ) {
 			return NULL;
 		}
@@ -801,7 +801,7 @@
 	ptr = strstr(line, "DGENRE=");
 	if( ptr!=NULL ) {
 		ptr += 7;
-		cd_info->genre = (char*)malloc(strlen(ptr)+1);
+		cd_info->genre = malloc(strlen(ptr)+1);
 		if( cd_info->genre==NULL ) {
 			return NULL;
 		}
--- a/libmpdemux/cdinfo.c	Thu Jul 13 16:17:24 2006 +0000
+++ b/libmpdemux/cdinfo.c	Thu Jul 13 16:41:13 2006 +0000
@@ -25,7 +25,7 @@
 cd_info_new() {
 	cd_info_t *cd_info = NULL;
 	
-	cd_info = (cd_info_t*)malloc(sizeof(cd_info_t));
+	cd_info = malloc(sizeof(cd_info_t));
 	if( cd_info==NULL ) {
 		mp_msg(MSGT_DEMUX, MSGL_ERR, MSGTR_MemAllocFailed);
 		return NULL;
@@ -59,14 +59,14 @@
 	
 	if( cd_info==NULL || track_name==NULL ) return NULL;
 	
-	cd_track = (cd_track_t*)malloc(sizeof(cd_track_t));
+	cd_track = malloc(sizeof(cd_track_t));
 	if( cd_track==NULL ) {
 		mp_msg(MSGT_DEMUX, MSGL_ERR, MSGTR_MemAllocFailed);
 		return NULL;
 	}
 	memset(cd_track, 0, sizeof(cd_track_t));
 	
-	cd_track->name = (char*)malloc(strlen(track_name)+1);
+	cd_track->name = malloc(strlen(track_name)+1);
 	if( cd_track->name==NULL ) {
 		mp_msg(MSGT_DEMUX, MSGL_ERR, MSGTR_MemAllocFailed);
 		free(cd_track);
--- a/libmpdemux/demux_audio.c	Thu Jul 13 16:17:24 2006 +0000
+++ b/libmpdemux/demux_audio.c	Thu Jul 13 16:41:13 2006 +0000
@@ -419,7 +419,7 @@
       free_sh_audio(demuxer, 0);
       return 0;
     }
-    sh_audio->wf = w = (WAVEFORMATEX*)malloc(l > sizeof(WAVEFORMATEX) ? l : sizeof(WAVEFORMATEX));
+    sh_audio->wf = w = malloc(l > sizeof(WAVEFORMATEX) ? l : sizeof(WAVEFORMATEX));
     w->wFormatTag = sh_audio->format = stream_read_word_le(s);
     w->nChannels = sh_audio->channels = stream_read_word_le(s);
     w->nSamplesPerSec = sh_audio->samplerate = stream_read_dword_le(s);
@@ -522,7 +522,7 @@
 	    break;
   }
 
-  priv = (da_priv_t*)malloc(sizeof(da_priv_t));
+  priv = malloc(sizeof(da_priv_t));
   priv->frmt = frmt;
   priv->last_pts = -1;
   demuxer->priv = priv;
--- a/libmpdemux/demux_fli.c	Thu Jul 13 16:17:24 2006 +0000
+++ b/libmpdemux/demux_fli.c	Thu Jul 13 16:41:13 2006 +0000
@@ -69,7 +69,7 @@
 
 static demuxer_t* demux_open_fli(demuxer_t* demuxer){
   sh_video_t *sh_video = NULL;
-  fli_frames_t *frames = (fli_frames_t *)malloc(sizeof(fli_frames_t));
+  fli_frames_t *frames = malloc(sizeof(fli_frames_t));
   int frame_number;
   int speed;
   unsigned int frame_size;
@@ -104,8 +104,8 @@
 
   // allocate enough entries for the indices
   //   audit: num_frames is 16bit so it is safe against overflow
-  frames->filepos = (off_t *)malloc(frames->num_frames * sizeof(off_t));
-  frames->frame_size = (int *)malloc(frames->num_frames * sizeof(int));
+  frames->filepos = malloc(frames->num_frames * sizeof(off_t));
+  frames->frame_size = malloc(frames->num_frames * sizeof(int));
 
   // create a new video stream header
   sh_video = new_sh_video(demuxer, 0);
--- a/libmpdemux/demux_lavf.c	Thu Jul 13 16:17:24 2006 +0000
+++ b/libmpdemux/demux_lavf.c	Thu Jul 13 16:41:13 2006 +0000
@@ -366,7 +366,7 @@
         
     if(0/*pkt.destruct == av_destruct_packet*/){
         //ok kids, dont try this at home :)
-        dp=(demux_packet_t*)malloc(sizeof(demux_packet_t));
+        dp=malloc(sizeof(demux_packet_t));
         dp->len=pkt.size;
         dp->next=NULL;
         dp->refcount=1;
--- a/libmpdemux/demux_mov.c	Thu Jul 13 16:17:24 2006 +0000
+++ b/libmpdemux/demux_mov.c	Thu Jul 13 16:41:13 2006 +0000
@@ -732,7 +732,7 @@
 			  if (len >= 36 + char2int(trak->stdata,52)) {
 			    sh->codecdata_len = char2int(trak->stdata,52+char2int(trak->stdata,52));
 			    mp_msg(MSGT_DEMUX, MSGL_V, "MOV: Found alac atom (%d)!\n", sh->codecdata_len);
-			    sh->codecdata = (unsigned char *)malloc(sh->codecdata_len);
+			    sh->codecdata = malloc(sh->codecdata_len);
 			    memcpy(sh->codecdata, &trak->stdata[52+char2int(trak->stdata,52)], sh->codecdata_len);
 			  }
 			  break;
@@ -842,7 +842,7 @@
 			    if(!is_vorbis)
 			    {
 			    sh->codecdata_len = esds.decoderConfigLen;
-			    sh->codecdata = (unsigned char *)malloc(sh->codecdata_len);
+			    sh->codecdata = malloc(sh->codecdata_len);
 			    memcpy(sh->codecdata, esds.decoderConfig, sh->codecdata_len);
 			    }
 			    }
@@ -860,7 +860,7 @@
 			if(atom_len > 8) {
 			    // copy all the atom (not only payload) for lavc alac decoder
 			    sh->codecdata_len = atom_len;
-			    sh->codecdata = (unsigned char *)malloc(sh->codecdata_len);
+			    sh->codecdata = malloc(sh->codecdata_len);
 			    memcpy(sh->codecdata, &trak->stdata[28], sh->codecdata_len);
 			}
 		      } break;
@@ -1033,7 +1033,7 @@
 
 			  // dump away the codec specific configuration for the AAC decoder
 			  trak->stream_header_len = esds.decoderConfigLen;
-			  trak->stream_header = (unsigned char *)malloc(trak->stream_header_len);
+			  trak->stream_header = malloc(trak->stream_header_len);
 			  memcpy(trak->stream_header, esds.decoderConfig, trak->stream_header_len);
 			}
 			mp4_free_esds(&esds); // freeup esds mem
@@ -1068,7 +1068,7 @@
 		        // Copy avcC for the AVC decoder
 		        // This data will be put in extradata below, where BITMAPINFOHEADER is created
 		        trak->stream_header_len = atom_len-8;
-		        trak->stream_header = (unsigned char *)malloc(trak->stream_header_len);
+		        trak->stream_header = malloc(trak->stream_header_len);
 		        memcpy(trak->stream_header, trak->stdata+pos+8, trak->stream_header_len);
 		      }	      
 		      break;
--- a/libmpdemux/demux_rawaudio.c	Thu Jul 13 16:17:24 2006 +0000
+++ b/libmpdemux/demux_rawaudio.c	Thu Jul 13 16:41:13 2006 +0000
@@ -35,7 +35,7 @@
   WAVEFORMATEX* w;
 
   sh_audio = new_sh_audio(demuxer,0);
-  sh_audio->wf = w = (WAVEFORMATEX*)malloc(sizeof(WAVEFORMATEX));
+  sh_audio->wf = w = malloc(sizeof(WAVEFORMATEX));
   w->wFormatTag = sh_audio->format = format;
   w->nChannels = sh_audio->channels = channels;
   w->nSamplesPerSec = sh_audio->samplerate = samplerate;
--- a/libmpdemux/demux_rawdv.c	Thu Jul 13 16:17:24 2006 +0000
+++ b/libmpdemux/demux_rawdv.c	Thu Jul 13 16:41:13 2006 +0000
@@ -130,7 +130,7 @@
 {
    unsigned char dv_frame[DV_PAL_FRAME_SIZE];
    sh_video_t *sh_video = NULL;
-   rawdv_frames_t *frames = (rawdv_frames_t *)malloc(sizeof(rawdv_frames_t));
+   rawdv_frames_t *frames = malloc(sizeof(rawdv_frames_t));
    dv_decoder_t *dv_decoder=NULL;
 
    mp_msg(MSGT_DEMUXER,MSGL_V,"demux_open_rawdv() end_pos %"PRId64"\n",(int64_t)demuxer->stream->end_pos);
--- a/libmpdemux/demux_realaud.c	Thu Jul 13 16:17:24 2006 +0000
+++ b/libmpdemux/demux_realaud.c	Thu Jul 13 16:41:13 2006 +0000
@@ -151,7 +151,7 @@
 	int i;
 	char *buf;
 
-  if ((ra_priv = (ra_priv_t *)malloc(sizeof(ra_priv_t))) == NULL) {
+  if ((ra_priv = malloc(sizeof(ra_priv_t))) == NULL) {
     mp_msg(MSGT_DEMUX, MSGL_ERR, "[RealAudio] Can't allocate memory for private data.\n");
     return 0;
   }
--- a/libmpdemux/demux_roq.c	Thu Jul 13 16:17:24 2006 +0000
+++ b/libmpdemux/demux_roq.c	Thu Jul 13 16:41:13 2006 +0000
@@ -92,7 +92,7 @@
   sh_video_t *sh_video = NULL;
   sh_audio_t *sh_audio = NULL;
 
-  roq_data_t *roq_data = (roq_data_t *)malloc(sizeof(roq_data_t));
+  roq_data_t *roq_data = malloc(sizeof(roq_data_t));
   int chunk_id;
   int chunk_size;
   int chunk_arg;
@@ -160,7 +160,7 @@
         sh_audio->ds = demuxer->audio;
 
         // go through the bother of making a WAVEFORMATEX structure
-        sh_audio->wf = (WAVEFORMATEX *)malloc(sizeof(WAVEFORMATEX));
+        sh_audio->wf = malloc(sizeof(WAVEFORMATEX));
 
         // custom fourcc for internal MPlayer use
         sh_audio->format = mmioFOURCC('R', 'o', 'Q', 'A');
--- a/libmpdemux/demux_vqf.c	Thu Jul 13 16:17:24 2006 +0000
+++ b/libmpdemux/demux_vqf.c	Thu Jul 13 16:41:13 2006 +0000
@@ -29,7 +29,7 @@
   s = demuxer->stream;
 
   sh_audio = new_sh_audio(demuxer,0);
-  sh_audio->wf = w = (WAVEFORMATEX*)malloc(sizeof(WAVEFORMATEX)+sizeof(headerInfo));
+  sh_audio->wf = w = malloc(sizeof(WAVEFORMATEX)+sizeof(headerInfo));
   hi = (headerInfo *)&w[1];
   memset(hi,0,sizeof(headerInfo));
   w->wFormatTag = 0x1;
--- a/libmpdemux/demux_xmms.c	Thu Jul 13 16:17:24 2006 +0000
+++ b/libmpdemux/demux_xmms.c	Thu Jul 13 16:41:13 2006 +0000
@@ -220,7 +220,7 @@
   
   pthread_mutex_init(&xmms_mutex,NULL);    
 
-  xmms_priv=priv=(xmms_priv_t *)malloc(sizeof(xmms_priv_t));
+  xmms_priv=priv=malloc(sizeof(xmms_priv_t));
   memset(priv,0,sizeof(xmms_priv_t));
   priv->ip=ip;
 
@@ -228,7 +228,7 @@
 
   xmms_channels=0;
   sh_audio = new_sh_audio(demuxer,0);
-  sh_audio->wf = w = (WAVEFORMATEX*)malloc(sizeof(WAVEFORMATEX));
+  sh_audio->wf = w = malloc(sizeof(WAVEFORMATEX));
   w->wFormatTag = sh_audio->format = format;
       
   demuxer->movi_start = 0;
--- a/libmpdemux/network.c	Thu Jul 13 16:17:24 2006 +0000
+++ b/libmpdemux/network.c	Thu Jul 13 16:41:13 2006 +0000
@@ -96,7 +96,7 @@
 streaming_ctrl_t *
 streaming_ctrl_new(void) {
 	streaming_ctrl_t *streaming_ctrl;
-	streaming_ctrl = (streaming_ctrl_t*)malloc(sizeof(streaming_ctrl_t));
+	streaming_ctrl = malloc(sizeof(streaming_ctrl_t));
 	if( streaming_ctrl==NULL ) {
 		mp_msg(MSGT_NETWORK,MSGL_FATAL,MSGTR_MemAllocFailed);
 		return NULL;
@@ -583,7 +583,7 @@
 int
 streaming_bufferize( streaming_ctrl_t *streaming_ctrl, char *buffer, int size) {
 //printf("streaming_bufferize\n");
-	streaming_ctrl->buffer = (char*)malloc(size);
+	streaming_ctrl->buffer = malloc(size);
 	if( streaming_ctrl->buffer==NULL ) {
 		mp_msg(MSGT_NETWORK,MSGL_FATAL,MSGTR_MemAllocFailed);
 		return -1;
--- a/libmpdemux/stream_livedotcom.c	Thu Jul 13 16:17:24 2006 +0000
+++ b/libmpdemux/stream_livedotcom.c	Thu Jul 13 16:41:13 2006 +0000
@@ -78,7 +78,7 @@
     if(len > SIZE_MAX - 1)
       return STREAM_ERROR;
 
-    sdpDescription = (char*)malloc(len+1);
+    sdpDescription = malloc(len+1);
     if(sdpDescription == NULL) return STREAM_ERROR;
     numBytesRead = read(f, sdpDescription, len);
     if(numBytesRead != len) {
--- a/libmpdemux/tv.c	Thu Jul 13 16:17:24 2006 +0000
+++ b/libmpdemux/tv.c	Thu Jul 13 16:41:13 2006 +0000
@@ -589,7 +589,7 @@
 	    sh_audio->channels;
 
 	// emulate WF for win32 codecs:
-	sh_audio->wf = (WAVEFORMATEX *)malloc(sizeof(WAVEFORMATEX));
+	sh_audio->wf = malloc(sizeof(WAVEFORMATEX));
 	sh_audio->wf->wFormatTag = sh_audio->format;
 	sh_audio->wf->nChannels = sh_audio->channels;
 	sh_audio->wf->wBitsPerSample = sh_audio->samplesize * 8;