mirror of
https://github.com/mpv-player/mpv
synced 2024-12-25 00:02:13 +00:00
drops casts from void * on malloc/calloc from libmpdemux code
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@19067 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
241bfa8a0c
commit
32492483c0
@ -267,7 +267,7 @@ static int asf_streaming_parse_header(int fd, streaming_ctrl_t* streaming_ctrl)
|
||||
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 @@ static int asf_streaming_parse_header(int fd, streaming_ctrl_t* streaming_ctrl)
|
||||
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 @@ static int asf_http_streaming_start( stream_t *stream, int *demuxer_type ) {
|
||||
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;
|
||||
|
@ -410,7 +410,7 @@ int read_asf_header(demuxer_t *demuxer,struct asf_priv* asf){
|
||||
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);
|
||||
|
@ -185,7 +185,7 @@ static int open_cdda(stream_t *st,int m, void* opts, int* file_format) {
|
||||
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;
|
||||
|
@ -349,7 +349,7 @@ cddb_read_cache(cddb_data_t *cddb_data) {
|
||||
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 @@ cddb_resolve(const char *dev, char **xmcd_file) {
|
||||
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 @@ xmcd_parse_dtitle(cd_info_t *cd_info, char *line) {
|
||||
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 @@ xmcd_parse_dgenre(cd_info_t *cd_info, char *line) {
|
||||
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;
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ cd_info_t*
|
||||
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 @@ cd_info_add_track(cd_info_t *cd_info, char *track_name, unsigned int track_nb, u
|
||||
|
||||
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);
|
||||
|
@ -419,7 +419,7 @@ static int demux_audio_open(demuxer_t* demuxer) {
|
||||
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 @@ static int demux_audio_open(demuxer_t* demuxer) {
|
||||
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;
|
||||
|
@ -69,7 +69,7 @@ static int demux_fli_fill_buffer(demuxer_t *demuxer, demux_stream_t *ds){
|
||||
|
||||
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 @@ static demuxer_t* demux_open_fli(demuxer_t* demuxer){
|
||||
|
||||
// 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);
|
||||
|
@ -366,7 +366,7 @@ static int demux_lavf_fill_buffer(demuxer_t *demux, demux_stream_t *dsds){
|
||||
|
||||
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;
|
||||
|
@ -732,7 +732,7 @@ static void lschunks(demuxer_t* demuxer,int level,off_t endpos,mov_track_t* trak
|
||||
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 @@ quit_vorbis_block:
|
||||
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 @@ quit_vorbis_block:
|
||||
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 @@ quit_vorbis_block:
|
||||
|
||||
// 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 @@ quit_vorbis_block:
|
||||
// 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;
|
||||
|
@ -35,7 +35,7 @@ static demuxer_t* demux_rawaudio_open(demuxer_t* demuxer) {
|
||||
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;
|
||||
|
@ -130,7 +130,7 @@ static demuxer_t* demux_open_rawdv(demuxer_t* demuxer)
|
||||
{
|
||||
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);
|
||||
|
@ -151,7 +151,7 @@ static demuxer_t* demux_open_ra(demuxer_t* demuxer)
|
||||
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;
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ static demuxer_t* demux_open_roq(demuxer_t* demuxer)
|
||||
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 @@ static demuxer_t* demux_open_roq(demuxer_t* demuxer)
|
||||
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');
|
||||
|
@ -29,7 +29,7 @@ static demuxer_t* demux_open_vqf(demuxer_t* demuxer) {
|
||||
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;
|
||||
|
@ -220,7 +220,7 @@ static int demux_xmms_open(demuxer_t* demuxer) {
|
||||
|
||||
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 @@ static int demux_xmms_open(demuxer_t* demuxer) {
|
||||
|
||||
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;
|
||||
|
@ -96,7 +96,7 @@ mime_struct_t mime_type_table[] = {
|
||||
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 @@ http_seek( stream_t *stream, off_t pos ) {
|
||||
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;
|
||||
|
@ -78,7 +78,7 @@ static int open_live_sdp(stream_t *stream,int mode, void* opts, int* file_format
|
||||
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) {
|
||||
|
@ -589,7 +589,7 @@ static demuxer_t* demux_open_tv(demuxer_t *demuxer)
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user