Mercurial > mplayer.hg
changeset 18885:5c8acc972551
rm unnecesary casts from void* - part 4
author | reynaldo |
---|---|
date | Mon, 03 Jul 2006 13:21:54 +0000 |
parents | b635d250fd0e |
children | f877f8c4ff42 |
files | input/input.c libao2/ao_jack.c libao2/ao_macosx.c libao2/ao_openal.c libmpdemux/demux_demuxers.c libmpdemux/demux_film.c libmpdemux/demux_mkv.c libmpdemux/demux_mpc.c libmpdemux/demux_mpg.c libmpdemux/demux_nsv.c libmpdemux/demux_ogg.c libmpdemux/dvdnav_stream.c libmpdemux/tvi_v4l.c libmpdemux/tvi_v4l2.c |
diffstat | 14 files changed, 50 insertions(+), 50 deletions(-) [+] |
line wrap: on
line diff
--- a/input/input.c Sun Jul 02 20:31:02 2006 +0000 +++ b/input/input.c Mon Jul 03 13:21:54 2006 +0000 @@ -631,7 +631,7 @@ cmd_def = &mp_cmds[i]; - cmd = (mp_cmd_t*)calloc(1, sizeof(mp_cmd_t)); + cmd = calloc(1, sizeof(mp_cmd_t)); cmd->id = cmd_def->id; cmd->name = strdup(cmd_def->name); cmd->pausing = pausing;
--- a/libao2/ao_jack.c Sun Jul 02 20:31:02 2006 +0000 +++ b/libao2/ao_jack.c Mon Jul 03 13:21:54 2006 +0000 @@ -240,7 +240,7 @@ goto err_out; } if (!client_name) { - client_name = (char *)malloc(40); + client_name = malloc(40); sprintf(client_name, "MPlayer [%d]", getpid()); } client = jack_client_new(client_name);
--- a/libao2/ao_macosx.c Sun Jul 02 20:31:02 2006 +0000 +++ b/libao2/ao_macosx.c Mon Jul 03 13:21:54 2006 +0000 @@ -221,7 +221,7 @@ UInt32 size, maxFrames; int aoIsCreated = ao != NULL; - if (!aoIsCreated) ao = (ao_macosx_t *)malloc(sizeof(ao_macosx_t)); + if (!aoIsCreated) ao = malloc(sizeof(ao_macosx_t)); // Build Description for the input format inDesc.mSampleRate=rate; @@ -315,8 +315,8 @@ ao->num_chunks = NUM_BUFS; ao->buffer_len = (ao->num_chunks + 1) * ao->chunk_size; - ao->buffer = aoIsCreated ? (unsigned char *)realloc(ao->buffer,(ao->num_chunks + 1)*ao->chunk_size) - : (unsigned char *)calloc(ao->num_chunks + 1, ao->chunk_size); + ao->buffer = aoIsCreated ? realloc(ao->buffer,(ao->num_chunks + 1)*ao->chunk_size) + : calloc(ao->num_chunks + 1, ao->chunk_size); ao_data.samplerate = inDesc.mSampleRate; ao_data.channels = inDesc.mChannelsPerFrame;
--- a/libao2/ao_openal.c Sun Jul 02 20:31:02 2006 +0000 +++ b/libao2/ao_openal.c Mon Jul 03 13:21:54 2006 +0000 @@ -96,7 +96,7 @@ ao_data.bps = channels * rate * 2; ao_data.buffersize = CHUNK_SIZE * NUM_BUF; ao_data.outburst = channels * CHUNK_SIZE; - tmpbuf = (int16_t *)malloc(CHUNK_SIZE); + tmpbuf = malloc(CHUNK_SIZE); return 1; err_out:
--- a/libmpdemux/demux_demuxers.c Sun Jul 02 20:31:02 2006 +0000 +++ b/libmpdemux/demux_demuxers.c Mon Jul 03 13:21:54 2006 +0000 @@ -21,9 +21,9 @@ demuxer_t* ret; dd_priv_t* priv; - ret = (demuxer_t*)calloc(1,sizeof(demuxer_t)); + ret = calloc(1,sizeof(demuxer_t)); - priv = (dd_priv_t*)malloc(sizeof(dd_priv_t)); + priv = malloc(sizeof(dd_priv_t)); priv->vd = vd; priv->ad = ad; priv->sd = sd;
--- a/libmpdemux/demux_film.c Sun Jul 02 20:31:02 2006 +0000 +++ b/libmpdemux/demux_film.c Mon Jul 03 13:21:54 2006 +0000 @@ -221,7 +221,7 @@ int counting_chunks; unsigned int total_audio_bytes = 0; - film_data = (film_data_t *)malloc(sizeof(film_data_t)); + film_data = malloc(sizeof(film_data_t)); film_data->total_chunks = 0; film_data->current_chunk = 0; film_data->chunks = NULL; @@ -310,7 +310,7 @@ demuxer->audio->sh = sh_audio; sh_audio->ds = demuxer->audio; - sh_audio->wf = (WAVEFORMATEX *)malloc(sizeof(WAVEFORMATEX)); + sh_audio->wf = malloc(sizeof(WAVEFORMATEX)); // uncompressed PCM format sh_audio->wf->wFormatTag = 1; @@ -341,7 +341,7 @@ demuxer->audio->sh = sh_audio; sh_audio->ds = demuxer->audio; - sh_audio->wf = (WAVEFORMATEX *)malloc(sizeof(WAVEFORMATEX)); + sh_audio->wf = malloc(sizeof(WAVEFORMATEX)); // uncompressed PCM format sh_audio->wf->wFormatTag = 1; @@ -377,7 +377,7 @@ // allocate enough entries for the chunk film_data->chunks = - (film_chunk_t *)calloc(film_data->total_chunks, sizeof(film_chunk_t)); + calloc(film_data->total_chunks, sizeof(film_chunk_t)); // build the chunk index counting_chunks = 1;
--- a/libmpdemux/demux_mkv.c Sun Jul 02 20:31:02 2006 +0000 +++ b/libmpdemux/demux_mkv.c Mon Jul 03 13:21:54 2006 +0000 @@ -503,7 +503,7 @@ return 0; things_found = 0; - buf = (char *)malloc(t->private_size + 1); + buf = malloc(t->private_size + 1); if (buf == NULL) return 0; memcpy(buf, t->private_data, t->private_size); @@ -1891,7 +1891,7 @@ track->qt_last_a_pts = 0.0; if (track->private_data != NULL) { - sh_a->codecdata=(unsigned char *)malloc(track->private_size); + sh_a->codecdata=malloc(track->private_size); memcpy (sh_a->codecdata, track->private_data, track->private_size); sh_a->codecdata_len = track->private_size; @@ -1907,7 +1907,7 @@ if (!strcmp (track->codec_id, MKV_A_AAC) && (NULL != track->private_data)) { - sh_a->codecdata=(unsigned char *)malloc(track->private_size); + sh_a->codecdata=malloc(track->private_size); memcpy (sh_a->codecdata, track->private_data, track->private_size); sh_a->codecdata_len = track->private_size; @@ -2495,7 +2495,7 @@ { case 0: /* no lacing */ *laces = 1; - lace_size = (uint32_t *)calloc(*laces, sizeof(uint32_t)); + lace_size = calloc(*laces, sizeof(uint32_t)); lace_size[0] = *size; break; @@ -2505,7 +2505,7 @@ *laces = *buffer++; (*size)--; (*laces)++; - lace_size = (uint32_t *)calloc(*laces, sizeof(uint32_t)); + lace_size = calloc(*laces, sizeof(uint32_t)); switch ((flags & 0x06) >> 1) {
--- a/libmpdemux/demux_mpc.c Sun Jul 02 20:31:02 2006 +0000 +++ b/libmpdemux/demux_mpc.c Mon Jul 03 13:21:54 2006 +0000 @@ -78,7 +78,7 @@ sh_audio = new_sh_audio(demuxer,0); { - char *wf = (char *)calloc(1, sizeof(WAVEFORMATEX) + HDR_SIZE); + char *wf = calloc(1, sizeof(WAVEFORMATEX) + HDR_SIZE); char *header = &wf[sizeof(WAVEFORMATEX)]; const int freqs[4] = {44100, 48000, 37800, 32000}; int frames; @@ -102,7 +102,7 @@ demuxer->movi_end = s->end_pos; } - priv = (da_priv_t *)malloc(sizeof(da_priv_t)); + priv = malloc(sizeof(da_priv_t)); priv->last_pts = -1; priv->pts_per_packet = (32 * 36) / (float)sh_audio->wf->nSamplesPerSec; priv->length = seconds;
--- a/libmpdemux/demux_mpg.c Sun Jul 02 20:31:02 2006 +0000 +++ b/libmpdemux/demux_mpg.c Mon Jul 03 13:21:54 2006 +0000 @@ -111,7 +111,7 @@ mpg_demuxer_t* mpg_d; if (!ds_fill_buffer(demuxer->video)) return 0; - mpg_d = (mpg_demuxer_t*)calloc(1,sizeof(mpg_demuxer_t)); + mpg_d = calloc(1,sizeof(mpg_demuxer_t)); demuxer->priv = mpg_d; mpg_d->final_pts = 0.0; mpg_d->has_valid_timestamps = 1;
--- a/libmpdemux/demux_nsv.c Sun Jul 02 20:31:02 2006 +0000 +++ b/libmpdemux/demux_nsv.c Mon Jul 03 13:21:54 2006 +0000 @@ -209,7 +209,7 @@ // new video stream! parse header sh_video->disp_w=hdr[12]|(hdr[13]<<8); sh_video->disp_h=hdr[14]|(hdr[15]<<8); - sh_video->bih=(BITMAPINFOHEADER*)calloc(1,sizeof(BITMAPINFOHEADER)); + sh_video->bih=calloc(1,sizeof(BITMAPINFOHEADER)); sh_video->bih->biSize=sizeof(BITMAPINFOHEADER); sh_video->bih->biPlanes=1; sh_video->bih->biBitCount=24;
--- a/libmpdemux/demux_ogg.c Sun Jul 02 20:31:02 2006 +0000 +++ b/libmpdemux/demux_ogg.c Mon Jul 03 13:21:54 2006 +0000 @@ -248,7 +248,7 @@ int lcv; if(!ogg_sub.text[0]) // not yet allocated for (lcv = 0; lcv < SUB_MAX_TEXT; lcv++) { - ogg_sub.text[lcv] = (char*)malloc(OGG_SUB_MAX_LINE); + ogg_sub.text[lcv] = malloc(OGG_SUB_MAX_LINE); } } @@ -813,7 +813,7 @@ od->vi_inited = 1; len = op[0].bytes + op[1].bytes + op[2].bytes; - sh->wf = (WAVEFORMATEX*)calloc(1, sizeof(WAVEFORMATEX) + len + len/255 + 64); + sh->wf = calloc(1, sizeof(WAVEFORMATEX) + len + len/255 + 64); ptr = (unsigned char*) (sh->wf+1); ptr[0] = 2; @@ -879,7 +879,7 @@ s = demuxer->stream; demuxer->priv = - ogg_d = (ogg_demuxer_t*)calloc(1,sizeof(ogg_demuxer_t)); + ogg_d = calloc(1,sizeof(ogg_demuxer_t)); sync = &ogg_d->sync; page = &ogg_d->page; @@ -948,7 +948,7 @@ mp_msg(MSGT_DEMUX,MSGL_INFO,"[Ogg] stream %d: audio (Vorbis), -aid %d\n",ogg_d->num_sub,n_audio-1); } else if (pack.bytes >= 80 && !strncmp(pack.packet,"Speex", 5)) { sh_a = new_sh_audio(demuxer, ogg_d->num_sub); - sh_a->wf = (WAVEFORMATEX*)calloc(1, sizeof(WAVEFORMATEX) + pack.bytes); + sh_a->wf = calloc(1, sizeof(WAVEFORMATEX) + pack.bytes); sh_a->format = FOURCC_SPEEX; sh_a->samplerate = sh_a->wf->nSamplesPerSec = get_uint32(&pack.packet[36]); sh_a->channels = sh_a->wf->nChannels = get_uint32(&pack.packet[48]); @@ -986,7 +986,7 @@ sh_v = new_sh_video(demuxer,ogg_d->num_sub); sh_v->context = NULL; - sh_v->bih = (BITMAPINFOHEADER*)calloc(1,sizeof(BITMAPINFOHEADER)); + sh_v->bih = calloc(1,sizeof(BITMAPINFOHEADER)); sh_v->bih->biSize=sizeof(BITMAPINFOHEADER); sh_v->bih->biCompression= sh_v->format = FOURCC_THEORA; sh_v->fps = ((double)inf.fps_numerator)/ @@ -1032,7 +1032,7 @@ // Old video header if(get_uint32 (pack.packet+96) == 0x05589f80 && pack.bytes >= 184) { sh_v = new_sh_video(demuxer,ogg_d->num_sub); - sh_v->bih = (BITMAPINFOHEADER*)calloc(1,sizeof(BITMAPINFOHEADER)); + sh_v->bih = calloc(1,sizeof(BITMAPINFOHEADER)); sh_v->bih->biSize=sizeof(BITMAPINFOHEADER); sh_v->bih->biCompression= sh_v->format = mmioFOURCC(pack.packet[68],pack.packet[69], @@ -1058,7 +1058,7 @@ unsigned int extra_size; sh_a = new_sh_audio(demuxer,ogg_d->num_sub); extra_size = get_uint16(pack.packet+140); - sh_a->wf = (WAVEFORMATEX*)calloc(1,sizeof(WAVEFORMATEX)+extra_size); + sh_a->wf = calloc(1,sizeof(WAVEFORMATEX)+extra_size); sh_a->format = sh_a->wf->wFormatTag = get_uint16(pack.packet+124); sh_a->channels = sh_a->wf->nChannels = get_uint16(pack.packet+126); sh_a->samplerate = sh_a->wf->nSamplesPerSec = get_uint32(pack.packet+128); @@ -1086,7 +1086,7 @@ /// New video header if(strncmp(st->streamtype,"video",5) == 0) { sh_v = new_sh_video(demuxer,ogg_d->num_sub); - sh_v->bih = (BITMAPINFOHEADER*)calloc(1,sizeof(BITMAPINFOHEADER)); + sh_v->bih = calloc(1,sizeof(BITMAPINFOHEADER)); sh_v->bih->biSize=sizeof(BITMAPINFOHEADER); sh_v->bih->biCompression= sh_v->format = mmioFOURCC(st->subtype[0],st->subtype[1], @@ -1127,7 +1127,7 @@ } sh_a = new_sh_audio(demuxer,ogg_d->num_sub); - sh_a->wf = (WAVEFORMATEX*)calloc(1,sizeof(WAVEFORMATEX)+extra_size); + sh_a->wf = calloc(1,sizeof(WAVEFORMATEX)+extra_size); sh_a->format = sh_a->wf->wFormatTag = strtol(buffer, NULL, 16); sh_a->channels = sh_a->wf->nChannels = get_uint16(&st->sh.audio.channels); sh_a->samplerate = sh_a->wf->nSamplesPerSec = get_uint64(&st->samples_per_unit); @@ -1368,9 +1368,9 @@ } // Build the ogg demuxer private datas - ogg_d = (ogg_demuxer_t*)calloc(1,sizeof(ogg_demuxer_t)); + ogg_d = calloc(1,sizeof(ogg_demuxer_t)); ogg_d->num_sub = 1; - ogg_d->subs = (ogg_stream_t*)malloc(sizeof(ogg_stream_t)); + ogg_d->subs = malloc(sizeof(ogg_stream_t)); ogg_d->subs[0].vorbis = 1; // Init the ogg physical stream
--- a/libmpdemux/dvdnav_stream.c Sun Jul 02 20:31:02 2006 +0000 +++ b/libmpdemux/dvdnav_stream.c Mon Jul 03 13:21:54 2006 +0000 @@ -59,7 +59,7 @@ if (!filename) return NULL; - if (!(dvdnav_priv=(dvdnav_priv_t*)calloc(1,sizeof(*dvdnav_priv)))) + if (!(dvdnav_priv=calloc(1,sizeof(*dvdnav_priv)))) return NULL; if (!(dvdnav_priv->filename=strdup(filename))) { @@ -166,7 +166,7 @@ if (!dvdnav_priv->started) return; - if (!(dvdnav_event=(dvdnav_event_t*)calloc(1,sizeof(*dvdnav_event)))) { + if (!(dvdnav_event=calloc(1,sizeof(*dvdnav_event)))) { mp_msg(MSGT_OPEN,MSGL_V, "%s: dvdnav_event: out of memory!\n",__FUNCTION__); return; } @@ -175,7 +175,7 @@ memcpy(dvdnav_event->details,buf,len); dvdnav_event->len=len; - if (!(cmd = (mp_cmd_t*)calloc(1,sizeof(*cmd)))) { + if (!(cmd = calloc(1,sizeof(*cmd)))) { mp_msg(MSGT_OPEN,MSGL_V, "%s: mp_cmd_t: out of memory!\n",__FUNCTION__); free(dvdnav_event->details); free(dvdnav_event);
--- a/libmpdemux/tvi_v4l.c Sun Jul 02 20:31:02 2006 +0000 +++ b/libmpdemux/tvi_v4l.c Mon Jul 03 13:21:54 2006 +0000 @@ -568,7 +568,7 @@ } mp_msg(MSGT_TV, MSGL_INFO, " Inputs: %d\n", priv->capability.channels); - priv->channels = (struct video_channel *)calloc(priv->capability.channels, sizeof(struct video_channel)); + priv->channels = calloc(priv->capability.channels, sizeof(struct video_channel)); if (!priv->channels) goto malloc_failed; memset(priv->channels, 0, sizeof(struct video_channel)*priv->capability.channels); @@ -621,7 +621,7 @@ priv->nbuf = priv->mbuf.frames; /* video buffers */ - priv->buf = (struct video_mmap *)calloc(priv->nbuf, sizeof(struct video_mmap)); + priv->buf = calloc(priv->nbuf, sizeof(struct video_mmap)); if (!priv->buf) goto malloc_failed; memset(priv->buf, 0, priv->nbuf * sizeof(struct video_mmap)); @@ -856,13 +856,13 @@ if (!tv_param_noaudio) { setup_audio_buffer_sizes(priv); bytes_per_sample = priv->audio_in.bytes_per_sample; - priv->audio_skew_buffer = (long long*)calloc(priv->aud_skew_cnt, sizeof(long long)); + priv->audio_skew_buffer = calloc(priv->aud_skew_cnt, sizeof(long long)); if (!priv->audio_skew_buffer) { mp_msg(MSGT_TV, MSGL_ERR, "cannot allocate skew buffer: %s\n", strerror(errno)); return 0; } - priv->audio_ringbuffer = (unsigned char*)calloc(priv->audio_in.blocksize, priv->audio_buffer_size); + priv->audio_ringbuffer = calloc(priv->audio_in.blocksize, priv->audio_buffer_size); if (!priv->audio_ringbuffer) { mp_msg(MSGT_TV, MSGL_ERR, "cannot allocate audio buffer: %s\n", strerror(errno)); return 0; @@ -900,7 +900,7 @@ priv->video_buffer_size_max, priv->video_buffer_size_max*priv->height*priv->bytesperline/(1024*1024)); - priv->video_ringbuffer = (unsigned char**)calloc(priv->video_buffer_size_max, sizeof(unsigned char*)); + priv->video_ringbuffer = calloc(priv->video_buffer_size_max, sizeof(unsigned char*)); if (!priv->video_ringbuffer) { mp_msg(MSGT_TV, MSGL_ERR, "cannot allocate video buffer: %s\n", strerror(errno)); return 0; @@ -908,12 +908,12 @@ for (i = 0; i < priv->video_buffer_size_max; i++) priv->video_ringbuffer[i] = NULL; - priv->video_timebuffer = (long long*)calloc(priv->video_buffer_size_max, sizeof(long long)); + priv->video_timebuffer = calloc(priv->video_buffer_size_max, sizeof(long long)); if (!priv->video_timebuffer) { mp_msg(MSGT_TV, MSGL_ERR, "cannot allocate time buffer: %s\n", strerror(errno)); return 0; } - priv->video_avg_buffer = (long long*)malloc(sizeof(long long) * VIDEO_AVG_BUFFER_SIZE); + priv->video_avg_buffer = malloc(sizeof(long long) * VIDEO_AVG_BUFFER_SIZE); if (!priv->video_avg_buffer) { mp_msg(MSGT_TV, MSGL_ERR, "cannot allocate period buffer: %s\n", strerror(errno)); return 0; @@ -1569,7 +1569,7 @@ pthread_mutex_lock(&priv->video_buffer_mutex); if (priv->video_buffer_size_current < priv->video_buffer_size_max) { if (priv->video_cnt == priv->video_buffer_size_current) { - unsigned char *newbuf = (unsigned char*)calloc(priv->bytesperline, priv->height); + unsigned char *newbuf = calloc(priv->bytesperline, priv->height); if (newbuf) { memmove(priv->video_ringbuffer+priv->video_tail+1, priv->video_ringbuffer+priv->video_tail, (priv->video_buffer_size_current-priv->video_tail)*sizeof(unsigned char *));
--- a/libmpdemux/tvi_v4l2.c Sun Jul 02 20:31:02 2006 +0000 +++ b/libmpdemux/tvi_v4l2.c Mon Jul 03 13:21:54 2006 +0000 @@ -1169,18 +1169,18 @@ if (!tv_param_noaudio) { setup_audio_buffer_sizes(priv); - priv->audio_skew_buffer = (long long*)calloc(priv->aud_skew_cnt, sizeof(long long)); + priv->audio_skew_buffer = calloc(priv->aud_skew_cnt, sizeof(long long)); if (!priv->audio_skew_buffer) { mp_msg(MSGT_TV, MSGL_ERR, "cannot allocate skew buffer: %s\n", strerror(errno)); return 0; } - priv->audio_skew_delta_buffer = (long long*)calloc(priv->aud_skew_cnt, sizeof(long long)); + priv->audio_skew_delta_buffer = calloc(priv->aud_skew_cnt, sizeof(long long)); if (!priv->audio_skew_delta_buffer) { mp_msg(MSGT_TV, MSGL_ERR, "cannot allocate skew buffer: %s\n", strerror(errno)); return 0; } - priv->audio_ringbuffer = (unsigned char*)calloc(priv->audio_in.blocksize, priv->audio_buffer_size); + priv->audio_ringbuffer = calloc(priv->audio_in.blocksize, priv->audio_buffer_size); if (!priv->audio_ringbuffer) { mp_msg(MSGT_TV, MSGL_ERR, "cannot allocate audio buffer: %s\n", strerror(errno)); return 0; @@ -1226,14 +1226,14 @@ priv->video_buffer_size_max*priv->format.fmt.pix.height*bytesperline/(1024*1024)); } - priv->video_ringbuffer = (unsigned char**)calloc(priv->video_buffer_size_max, sizeof(unsigned char*)); + priv->video_ringbuffer = calloc(priv->video_buffer_size_max, sizeof(unsigned char*)); if (!priv->video_ringbuffer) { mp_msg(MSGT_TV, MSGL_ERR, "cannot allocate video buffer: %s\n", strerror(errno)); return 0; } for (i = 0; i < priv->video_buffer_size_max; i++) priv->video_ringbuffer[i] = NULL; - priv->video_timebuffer = (long long*)calloc(priv->video_buffer_size_max, sizeof(long long)); + priv->video_timebuffer = calloc(priv->video_buffer_size_max, sizeof(long long)); if (!priv->video_timebuffer) { mp_msg(MSGT_TV, MSGL_ERR, "cannot allocate time buffer: %s\n", strerror(errno)); return 0; @@ -1471,7 +1471,7 @@ pthread_mutex_lock(&priv->video_buffer_mutex); if (priv->video_buffer_size_current < priv->video_buffer_size_max) { if (priv->video_cnt == priv->video_buffer_size_current) { - unsigned char *newbuf = (unsigned char*)malloc(framesize); + unsigned char *newbuf = malloc(framesize); if (newbuf) { memmove(priv->video_ringbuffer+priv->video_tail+1, priv->video_ringbuffer+priv->video_tail, (priv->video_buffer_size_current-priv->video_tail)*sizeof(unsigned char *)); @@ -1561,7 +1561,7 @@ // for testing purposes only static void read_doublespeed(priv_t *priv) { - char *bufx = (char*)calloc(priv->audio_in.blocksize, 2); + char *bufx = calloc(priv->audio_in.blocksize, 2); short *s; short *d; int i;