From 3afd65b3afd338a32af0df8c8f0fdd4d2649c74e Mon Sep 17 00:00:00 2001 From: reynaldo <reynaldo@b3059339-0415-0410-9bf9-f77b7e298cf2> Date: Sun, 2 Jul 2006 08:17:07 +0000 Subject: [PATCH] rm unnecesary casts from void* - part 3 git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@18884 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpcodecs/ad_libvorbis.c | 2 +- libmpcodecs/ad_mpc.c | 2 +- libmpcodecs/ad_speex.c | 2 +- libmpcodecs/dec_audio.c | 2 +- libmpcodecs/vd_ffmpeg.c | 2 +- libmpcodecs/vd_mpng.c | 2 +- libmpcodecs/vd_theora.c | 2 +- libmpcodecs/vd_xvid.c | 2 +- libmpcodecs/vd_xvid4.c | 2 +- libmpcodecs/ve_nuv.c | 2 +- libmpcodecs/vf_screenshot.c | 2 +- libmpdemux/http.c | 26 +++++++-------- libmpdemux/url.c | 12 +++---- libmpdvdkit2/ifo_read.c | 66 ++++++++++++++++++------------------- m_config.c | 10 +++--- m_option.c | 4 +-- playtree.c | 4 +-- playtreeparser.c | 2 +- 18 files changed, 73 insertions(+), 73 deletions(-) diff --git a/libmpcodecs/ad_libvorbis.c b/libmpcodecs/ad_libvorbis.c index 65944cc0ce..637b4f669f 100644 --- a/libmpcodecs/ad_libvorbis.c +++ b/libmpcodecs/ad_libvorbis.c @@ -72,7 +72,7 @@ static int init(sh_audio_t *sh) } /// Init the decoder with the 3 header packets - ov = (struct ov_struct_st*)malloc(sizeof(struct ov_struct_st)); + ov = malloc(sizeof(struct ov_struct_st)); vorbis_info_init(&ov->vi); vorbis_comment_init(&vc); diff --git a/libmpcodecs/ad_mpc.c b/libmpcodecs/ad_mpc.c index fb00bb6a1f..e91998df7b 100644 --- a/libmpcodecs/ad_mpc.c +++ b/libmpcodecs/ad_mpc.c @@ -203,7 +203,7 @@ static int check_clip(void *buf, int len) { static int control(sh_audio_t *sh, int cmd, void* arg, ...) { if (cmd == ADCTRL_RESYNC_STREAM) { - unsigned char *buf = (unsigned char *)malloc(MAX_FRAMESIZE); + unsigned char *buf = malloc(MAX_FRAMESIZE); int i; int nr_ok = 0; for (i = 0; i < MAX_SEEK_DISCARD; i++) { diff --git a/libmpcodecs/ad_speex.c b/libmpcodecs/ad_speex.c index e78f42629c..21fa5a3d4d 100644 --- a/libmpcodecs/ad_speex.c +++ b/libmpcodecs/ad_speex.c @@ -36,7 +36,7 @@ static int preinit(sh_audio_t *sh) { } static int init(sh_audio_t *sh) { - context_t *ctx = (context_t *)calloc(1, sizeof(context_t)); + context_t *ctx = calloc(1, sizeof(context_t)); const SpeexMode *spx_mode; const SpeexStereoState st_st = SPEEX_STEREO_STATE_INIT; // hack if (!sh->wf || sh->wf->cbSize < 80) { diff --git a/libmpcodecs/dec_audio.c b/libmpcodecs/dec_audio.c index 2a6d152eb7..37ab41875b 100644 --- a/libmpcodecs/dec_audio.c +++ b/libmpcodecs/dec_audio.c @@ -290,7 +290,7 @@ int init_audio_filters(sh_audio_t *sh_audio, int out_minsize, int out_maxsize){ af_stream_t* afs=sh_audio->afilter; if(!afs){ - afs = (af_stream_t*)malloc(sizeof(af_stream_t)); + afs = malloc(sizeof(af_stream_t)); memset(afs,0,sizeof(af_stream_t)); } diff --git a/libmpcodecs/vd_ffmpeg.c b/libmpcodecs/vd_ffmpeg.c index e312e800fd..ea2091f206 100644 --- a/libmpcodecs/vd_ffmpeg.c +++ b/libmpcodecs/vd_ffmpeg.c @@ -383,7 +383,7 @@ static int init(sh_video_t *sh){ /* Pass palette to codec */ #if LIBAVCODEC_BUILD >= 4689 if (sh->bih && (sh->bih->biBitCount <= 8)) { - avctx->palctrl = (AVPaletteControl*)calloc(1,sizeof(AVPaletteControl)); + avctx->palctrl = calloc(1,sizeof(AVPaletteControl)); avctx->palctrl->palette_changed = 1; if (sh->bih->biSize-sizeof(BITMAPINFOHEADER)) /* Palette size in biSize */ diff --git a/libmpcodecs/vd_mpng.c b/libmpcodecs/vd_mpng.c index a92852cfec..9d99145ee6 100644 --- a/libmpcodecs/vd_mpng.c +++ b/libmpcodecs/vd_mpng.c @@ -135,7 +135,7 @@ static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){ if(!mpi) return NULL; // Let's DECODE! - row_p=(png_bytep*)malloc( sizeof( png_bytep ) * png_height ); + row_p=malloc( sizeof( png_bytep ) * png_height ); //png_get_rowbytes( png,info ) for ( i=0; i < png_height; i++ ) row_p[i]=mpi->planes[0] + mpi->stride[0]*i; png_read_image( png,row_p ); diff --git a/libmpcodecs/vd_theora.c b/libmpcodecs/vd_theora.c index de9d478c62..6bf1248155 100644 --- a/libmpcodecs/vd_theora.c +++ b/libmpcodecs/vd_theora.c @@ -64,7 +64,7 @@ static int init(sh_video_t *sh){ /* this is not a loop, just a context, from which we can break on error */ do { - context = (theora_struct_t *)calloc (sizeof (theora_struct_t), 1); + context = calloc (sizeof (theora_struct_t), 1); sh->context = context; if (!context) break; diff --git a/libmpcodecs/vd_xvid.c b/libmpcodecs/vd_xvid.c index b3b2ac4714..298d66685f 100644 --- a/libmpcodecs/vd_xvid.c +++ b/libmpcodecs/vd_xvid.c @@ -152,7 +152,7 @@ static int init(sh_video_t *sh){ return 0; } - p = (priv_t*)malloc(sizeof(priv_t)); + p = malloc(sizeof(priv_t)); p->cs = cs; p->hdl = dec_p.handle; sh->context = p; diff --git a/libmpcodecs/vd_xvid4.c b/libmpcodecs/vd_xvid4.c index a2471ead3c..335c101752 100644 --- a/libmpcodecs/vd_xvid4.c +++ b/libmpcodecs/vd_xvid4.c @@ -174,7 +174,7 @@ static int init(sh_video_t *sh) return(0); } - p = (priv_t*)malloc(sizeof(priv_t)); + p = malloc(sizeof(priv_t)); p->cs = cs; p->hdl = dec_p.handle; p->vo_initialized = 0; diff --git a/libmpcodecs/ve_nuv.c b/libmpcodecs/ve_nuv.c index 7d3706821e..4ed2e20dac 100644 --- a/libmpcodecs/ve_nuv.c +++ b/libmpcodecs/ve_nuv.c @@ -217,7 +217,7 @@ static int vf_open(vf_instance_t *vf, char* args){ vf->priv->lzo = 0; } vf->priv->zbuffer = (lzo_bytep)malloc(FRAMEHEADERSIZE + LZO_OUT_LEN); - vf->priv->zmem = (long*)malloc(sizeof(long)*LZO_AL(LZO1X_1_MEM_COMPRESS)); + vf->priv->zmem = malloc(sizeof(long)*LZO_AL(LZO1X_1_MEM_COMPRESS)); } return 1; diff --git a/libmpcodecs/vf_screenshot.c b/libmpcodecs/vf_screenshot.c index 2239eb016d..54939acc50 100644 --- a/libmpcodecs/vf_screenshot.c +++ b/libmpcodecs/vf_screenshot.c @@ -87,7 +87,7 @@ static void write_png(char *fname, unsigned char *buffer, int width, int height, png_set_bgr(png_ptr); - row_pointers = (png_byte**)malloc(height*sizeof(png_byte*)); + row_pointers = malloc(height*sizeof(png_byte*)); for (k = 0; k < height; k++) { unsigned char* s=buffer + stride*k; row_pointers[k] = s; diff --git a/libmpdemux/http.c b/libmpdemux/http.c index d175c9b8a3..6b122eda55 100644 --- a/libmpdemux/http.c +++ b/libmpdemux/http.c @@ -111,7 +111,7 @@ static void scast_meta_read(int fd, streaming_ctrl_t *sc) { my_read(fd, &tmp, 1, sc); metalen = tmp * 16; if (metalen > 0) { - char *info = (char *)malloc(metalen + 1); + char *info = malloc(metalen + 1); unsigned nlen = my_read(fd, info, metalen, sc); info[nlen] = 0; mp_msg(MSGT_DEMUXER, MSGL_INFO, "\nICY Info: %s\n", info); @@ -282,7 +282,7 @@ HTTP_header_t * http_new_header(void) { HTTP_header_t *http_hdr; - http_hdr = (HTTP_header_t*)malloc(sizeof(HTTP_header_t)); + http_hdr = malloc(sizeof(HTTP_header_t)); if( http_hdr==NULL ) return NULL; memset( http_hdr, 0, sizeof(HTTP_header_t) ); @@ -356,7 +356,7 @@ http_response_parse( HTTP_header_t *http_hdr ) { return -1; } len = hdr_ptr-http_hdr->buffer; - http_hdr->protocol = (char*)malloc(len+1); + http_hdr->protocol = malloc(len+1); if( http_hdr->protocol==NULL ) { mp_msg(MSGT_NETWORK,MSGL_FATAL,"Memory allocation failed\n"); return -1; @@ -384,7 +384,7 @@ http_response_parse( HTTP_header_t *http_hdr ) { return -1; } len = ptr-hdr_ptr; - http_hdr->reason_phrase = (char*)malloc(len+1); + http_hdr->reason_phrase = malloc(len+1); if( http_hdr->reason_phrase==NULL ) { mp_msg(MSGT_NETWORK,MSGL_FATAL,"Memory allocation failed\n"); return -1; @@ -448,7 +448,7 @@ http_build_request( HTTP_header_t *http_hdr ) { if( http_hdr->method==NULL ) http_set_method( http_hdr, "GET"); if( http_hdr->uri==NULL ) http_set_uri( http_hdr, "/"); else { - uri = (char*)malloc(strlen(http_hdr->uri) + 1); + uri = malloc(strlen(http_hdr->uri) + 1); if( uri==NULL ) { mp_msg(MSGT_NETWORK,MSGL_ERR,"Memory allocation failed\n"); return NULL; @@ -476,7 +476,7 @@ http_build_request( HTTP_header_t *http_hdr ) { free( http_hdr->buffer ); http_hdr->buffer = NULL; } - http_hdr->buffer = (char*)malloc(len+1); + http_hdr->buffer = malloc(len+1); if( http_hdr->buffer==NULL ) { mp_msg(MSGT_NETWORK,MSGL_ERR,"Memory allocation failed\n"); return NULL; @@ -542,13 +542,13 @@ http_set_field( HTTP_header_t *http_hdr, const char *field_name ) { HTTP_field_t *new_field; if( http_hdr==NULL || field_name==NULL ) return; - new_field = (HTTP_field_t*)malloc(sizeof(HTTP_field_t)); + new_field = malloc(sizeof(HTTP_field_t)); if( new_field==NULL ) { mp_msg(MSGT_NETWORK,MSGL_FATAL,"Memory allocation failed\n"); return; } new_field->next = NULL; - new_field->field_name = (char*)malloc(strlen(field_name)+1); + new_field->field_name = malloc(strlen(field_name)+1); if( new_field->field_name==NULL ) { mp_msg(MSGT_NETWORK,MSGL_FATAL,"Memory allocation failed\n"); return; @@ -568,7 +568,7 @@ void http_set_method( HTTP_header_t *http_hdr, const char *method ) { if( http_hdr==NULL || method==NULL ) return; - http_hdr->method = (char*)malloc(strlen(method)+1); + http_hdr->method = malloc(strlen(method)+1); if( http_hdr->method==NULL ) { mp_msg(MSGT_NETWORK,MSGL_FATAL,"Memory allocation failed\n"); return; @@ -580,7 +580,7 @@ void http_set_uri( HTTP_header_t *http_hdr, const char *uri ) { if( http_hdr==NULL || uri==NULL ) return; - http_hdr->uri = (char*)malloc(strlen(uri)+1); + http_hdr->uri = malloc(strlen(uri)+1); if( http_hdr->uri==NULL ) { mp_msg(MSGT_NETWORK,MSGL_FATAL,"Memory allocation failed\n"); return; @@ -599,7 +599,7 @@ http_add_basic_authentication( HTTP_header_t *http_hdr, const char *username, co pass_len = strlen(password); } - usr_pass = (char*)malloc(strlen(username)+pass_len+2); + usr_pass = malloc(strlen(username)+pass_len+2); if( usr_pass==NULL ) { mp_msg(MSGT_NETWORK,MSGL_FATAL,"Memory allocation failed\n"); goto out; @@ -609,7 +609,7 @@ http_add_basic_authentication( HTTP_header_t *http_hdr, const char *username, co // Base 64 encode with at least 33% more data than the original size encoded_len = strlen(usr_pass)*2; - b64_usr_pass = (char*)malloc(encoded_len); + b64_usr_pass = malloc(encoded_len); if( b64_usr_pass==NULL ) { mp_msg(MSGT_NETWORK,MSGL_FATAL,"Memory allocation failed\n"); goto out; @@ -623,7 +623,7 @@ http_add_basic_authentication( HTTP_header_t *http_hdr, const char *username, co b64_usr_pass[out_len]='\0'; - auth = (char*)malloc(encoded_len+22); + auth = malloc(encoded_len+22); if( auth==NULL ) { mp_msg(MSGT_NETWORK,MSGL_FATAL,"Memory allocation failed\n"); goto out; diff --git a/libmpdemux/url.c b/libmpdemux/url.c index 7893514ad7..52b850609b 100644 --- a/libmpdemux/url.c +++ b/libmpdemux/url.c @@ -40,7 +40,7 @@ url_new(const char* url) { } // Create the URL container - Curl = (URL_t*)malloc(sizeof(URL_t)); + Curl = malloc(sizeof(URL_t)); if( Curl==NULL ) { mp_msg(MSGT_NETWORK,MSGL_FATAL,MSGTR_MemAllocFailed); goto err_out; @@ -72,7 +72,7 @@ url_new(const char* url) { } } pos1 = ptr1-escfilename; - Curl->protocol = (char*)malloc(pos1+1); + Curl->protocol = malloc(pos1+1); if( Curl->protocol==NULL ) { mp_msg(MSGT_NETWORK,MSGL_FATAL,MSGTR_MemAllocFailed); goto err_out; @@ -94,7 +94,7 @@ url_new(const char* url) { if( ptr2!=NULL ) { // We got something, at least a username... int len = ptr2-ptr1; - Curl->username = (char*)malloc(len+1); + Curl->username = malloc(len+1); if( Curl->username==NULL ) { mp_msg(MSGT_NETWORK,MSGL_FATAL,MSGTR_MemAllocFailed); goto err_out; @@ -107,7 +107,7 @@ url_new(const char* url) { // We also have a password int len2 = ptr2-ptr3-1; Curl->username[ptr3-ptr1]='\0'; - Curl->password = (char*)malloc(len2+1); + Curl->password = malloc(len2+1); if( Curl->password==NULL ) { mp_msg(MSGT_NETWORK,MSGL_FATAL,MSGTR_MemAllocFailed); goto err_out; @@ -159,7 +159,7 @@ url_new(const char* url) { } if( v6addr ) pos2--; // copy the hostname in the URL container - Curl->hostname = (char*)malloc(pos2-pos1+1); + Curl->hostname = malloc(pos2-pos1+1); if( Curl->hostname==NULL ) { mp_msg(MSGT_NETWORK,MSGL_FATAL,MSGTR_MemAllocFailed); goto err_out; @@ -183,7 +183,7 @@ url_new(const char* url) { } // Check if a filename was given or set, else set it with '/' if( Curl->file==NULL ) { - Curl->file = (char*)malloc(2); + Curl->file = malloc(2); if( Curl->file==NULL ) { mp_msg(MSGT_NETWORK,MSGL_FATAL,MSGTR_MemAllocFailed); goto err_out; diff --git a/libmpdvdkit2/ifo_read.c b/libmpdvdkit2/ifo_read.c index ef308b52e0..ac81b0f14a 100644 --- a/libmpdvdkit2/ifo_read.c +++ b/libmpdvdkit2/ifo_read.c @@ -97,7 +97,7 @@ static inline int DVDFileSeek_( dvd_file_t *dvd_file, uint32_t offset ) { ifo_handle_t *ifoOpen(dvd_reader_t *dvd, int title) { ifo_handle_t *ifofile; - ifofile = (ifo_handle_t *)malloc(sizeof(ifo_handle_t)); + ifofile = malloc(sizeof(ifo_handle_t)); if(!ifofile) return 0; @@ -182,7 +182,7 @@ ifo_handle_t *ifoOpen(dvd_reader_t *dvd, int title) { ifo_handle_t *ifoOpenVMGI(dvd_reader_t *dvd) { ifo_handle_t *ifofile; - ifofile = (ifo_handle_t *)malloc(sizeof(ifo_handle_t)); + ifofile = malloc(sizeof(ifo_handle_t)); if(!ifofile) return 0; @@ -209,7 +209,7 @@ ifo_handle_t *ifoOpenVMGI(dvd_reader_t *dvd) { ifo_handle_t *ifoOpenVTSI(dvd_reader_t *dvd, int title) { ifo_handle_t *ifofile; - ifofile = (ifo_handle_t *)malloc(sizeof(ifo_handle_t)); + ifofile = malloc(sizeof(ifo_handle_t)); if(!ifofile) return 0; @@ -274,7 +274,7 @@ void ifoClose(ifo_handle_t *ifofile) { static int ifoRead_VMG(ifo_handle_t *ifofile) { vmgi_mat_t *vmgi_mat; - vmgi_mat = (vmgi_mat_t *)malloc(sizeof(vmgi_mat_t)); + vmgi_mat = malloc(sizeof(vmgi_mat_t)); if(!vmgi_mat) return 0; @@ -365,7 +365,7 @@ static int ifoRead_VTS(ifo_handle_t *ifofile) { vtsi_mat_t *vtsi_mat; int i; - vtsi_mat = (vtsi_mat_t *)malloc(sizeof(vtsi_mat_t)); + vtsi_mat = malloc(sizeof(vtsi_mat_t)); if(!vtsi_mat) return 0; @@ -493,7 +493,7 @@ static int ifoRead_PGC_COMMAND_TBL(ifo_handle_t *ifofile, if(cmd_tbl->nr_of_pre != 0) { unsigned int pre_cmds_size = cmd_tbl->nr_of_pre * COMMAND_DATA_SIZE; - cmd_tbl->pre_cmds = (vm_cmd_t *)malloc(pre_cmds_size); + cmd_tbl->pre_cmds = malloc(pre_cmds_size); if(!cmd_tbl->pre_cmds) return 0; @@ -505,7 +505,7 @@ static int ifoRead_PGC_COMMAND_TBL(ifo_handle_t *ifofile, if(cmd_tbl->nr_of_post != 0) { unsigned int post_cmds_size = cmd_tbl->nr_of_post * COMMAND_DATA_SIZE; - cmd_tbl->post_cmds = (vm_cmd_t *)malloc(post_cmds_size); + cmd_tbl->post_cmds = malloc(post_cmds_size); if(!cmd_tbl->post_cmds) { if(cmd_tbl->pre_cmds) free(cmd_tbl->pre_cmds); @@ -521,7 +521,7 @@ static int ifoRead_PGC_COMMAND_TBL(ifo_handle_t *ifofile, if(cmd_tbl->nr_of_cell != 0) { unsigned int cell_cmds_size = cmd_tbl->nr_of_cell * COMMAND_DATA_SIZE; - cmd_tbl->cell_cmds = (vm_cmd_t *)malloc(cell_cmds_size); + cmd_tbl->cell_cmds = malloc(cell_cmds_size); if(!cmd_tbl->cell_cmds) { if(cmd_tbl->pre_cmds) free(cmd_tbl->pre_cmds); @@ -748,7 +748,7 @@ int ifoRead_FP_PGC(ifo_handle_t *ifofile) { if(ifofile->vmgi_mat->first_play_pgc == 0) return 1; - ifofile->first_play_pgc = (pgc_t *)malloc(sizeof(pgc_t)); + ifofile->first_play_pgc = malloc(sizeof(pgc_t)); if(!ifofile->first_play_pgc) return 0; @@ -802,7 +802,7 @@ int ifoRead_TT_SRPT(ifo_handle_t *ifofile) { if(!DVDFileSeek_(ifofile->file, ifofile->vmgi_mat->tt_srpt * DVD_BLOCK_LEN)) return 0; - tt_srpt = (tt_srpt_t *)malloc(sizeof(tt_srpt_t)); + tt_srpt = malloc(sizeof(tt_srpt_t)); if(!tt_srpt) return 0; @@ -819,7 +819,7 @@ int ifoRead_TT_SRPT(ifo_handle_t *ifofile) { info_length = tt_srpt->last_byte + 1 - TT_SRPT_SIZE; - tt_srpt->title = (title_info_t *)malloc(info_length); + tt_srpt->title = malloc(info_length); if(!tt_srpt->title) { free(tt_srpt); ifofile->tt_srpt = 0; @@ -904,7 +904,7 @@ int ifoRead_VTS_PTT_SRPT(ifo_handle_t *ifofile) { ifofile->vtsi_mat->vts_ptt_srpt * DVD_BLOCK_LEN)) return 0; - vts_ptt_srpt = (vts_ptt_srpt_t *)malloc(sizeof(vts_ptt_srpt_t)); + vts_ptt_srpt = malloc(sizeof(vts_ptt_srpt_t)); if(!vts_ptt_srpt) return 0; @@ -925,7 +925,7 @@ int ifoRead_VTS_PTT_SRPT(ifo_handle_t *ifofile) { info_length = vts_ptt_srpt->last_byte + 1 - VTS_PTT_SRPT_SIZE; - data = (uint32_t *)malloc(info_length); + data = malloc(info_length); if(!data) { free(vts_ptt_srpt); ifofile->vts_ptt_srpt = 0; @@ -1043,7 +1043,7 @@ int ifoRead_PTL_MAIT(ifo_handle_t *ifofile) { if(!DVDFileSeek_(ifofile->file, ifofile->vmgi_mat->ptl_mait * DVD_BLOCK_LEN)) return 0; - ptl_mait = (ptl_mait_t *)malloc(sizeof(ptl_mait_t)); + ptl_mait = malloc(sizeof(ptl_mait_t)); if(!ptl_mait) return 0; @@ -1067,7 +1067,7 @@ int ifoRead_PTL_MAIT(ifo_handle_t *ifofile) { <= ptl_mait->last_byte + 1 - PTL_MAIT_SIZE); info_length = ptl_mait->nr_of_countries * sizeof(ptl_mait_country_t); - ptl_mait->countries = (ptl_mait_country_t *)malloc(info_length); + ptl_mait->countries = malloc(info_length); if(!ptl_mait->countries) { free(ptl_mait); ifofile->ptl_mait = 0; @@ -1108,7 +1108,7 @@ int ifoRead_PTL_MAIT(ifo_handle_t *ifofile) { return 0; } info_length = (ptl_mait->nr_of_vtss + 1) * sizeof(pf_level_t); - pf_temp = (uint16_t *)malloc(info_length); + pf_temp = malloc(info_length); if(!pf_temp) { for(j = 0; j < i ; j++) { free(ptl_mait->countries[j].pf_ptl_mai); @@ -1130,7 +1130,7 @@ int ifoRead_PTL_MAIT(ifo_handle_t *ifofile) { for (j = 0; j < ((ptl_mait->nr_of_vtss + 1) * 8); j++) { B2N_16(pf_temp[j]); } - ptl_mait->countries[i].pf_ptl_mai = (pf_level_t *)malloc(info_length); + ptl_mait->countries[i].pf_ptl_mai = malloc(info_length); if(!ptl_mait->countries[i].pf_ptl_mai) { free(pf_temp); for(j = 0; j < i ; j++) { @@ -1194,7 +1194,7 @@ int ifoRead_VTS_TMAPT(ifo_handle_t *ifofile) { if(!DVDFileSeek_(ifofile->file, offset)) return 0; - vts_tmapt = (vts_tmapt_t *)malloc(sizeof(vts_tmapt_t)); + vts_tmapt = malloc(sizeof(vts_tmapt_t)); if(!vts_tmapt) return 0; @@ -1214,7 +1214,7 @@ int ifoRead_VTS_TMAPT(ifo_handle_t *ifofile) { info_length = vts_tmapt->nr_of_tmaps * 4; - vts_tmap_srp = (uint32_t *)malloc(info_length); + vts_tmap_srp = malloc(info_length); if(!vts_tmap_srp) { free(vts_tmapt); ifofile->vts_tmapt = NULL; @@ -1238,7 +1238,7 @@ int ifoRead_VTS_TMAPT(ifo_handle_t *ifofile) { info_length = vts_tmapt->nr_of_tmaps * sizeof(vts_tmap_t); - vts_tmapt->tmap = (vts_tmap_t *)malloc(info_length); + vts_tmapt->tmap = malloc(info_length); if(!vts_tmapt->tmap) { free(vts_tmap_srp); free(vts_tmapt); @@ -1270,7 +1270,7 @@ int ifoRead_VTS_TMAPT(ifo_handle_t *ifofile) { info_length = vts_tmapt->tmap[i].nr_of_entries * sizeof(map_ent_t); - vts_tmapt->tmap[i].map_ent = (map_ent_t *)malloc(info_length); + vts_tmapt->tmap[i].map_ent = malloc(info_length); if(!vts_tmapt->tmap[i].map_ent) { ifoFree_VTS_TMAPT(ifofile); return 0; @@ -1318,7 +1318,7 @@ int ifoRead_TITLE_C_ADT(ifo_handle_t *ifofile) { if(ifofile->vtsi_mat->vts_c_adt == 0) /* mandatory */ return 0; - ifofile->vts_c_adt = (c_adt_t *)malloc(sizeof(c_adt_t)); + ifofile->vts_c_adt = malloc(sizeof(c_adt_t)); if(!ifofile->vts_c_adt) return 0; @@ -1350,7 +1350,7 @@ int ifoRead_C_ADT(ifo_handle_t *ifofile) { return 0; } - ifofile->menu_c_adt = (c_adt_t *)malloc(sizeof(c_adt_t)); + ifofile->menu_c_adt = malloc(sizeof(c_adt_t)); if(!ifofile->menu_c_adt) return 0; @@ -1392,7 +1392,7 @@ static int ifoRead_C_ADT_internal(ifo_handle_t *ifofile, c_adt->nr_of_vobs = info_length / sizeof(cell_adr_t); } - c_adt->cell_adr_table = (cell_adr_t *)malloc(info_length); + c_adt->cell_adr_table = malloc(info_length); if(!c_adt->cell_adr_table) return 0; @@ -1452,7 +1452,7 @@ int ifoRead_TITLE_VOBU_ADMAP(ifo_handle_t *ifofile) { if(ifofile->vtsi_mat->vts_vobu_admap == 0) /* mandatory */ return 0; - ifofile->vts_vobu_admap = (vobu_admap_t *)malloc(sizeof(vobu_admap_t)); + ifofile->vts_vobu_admap = malloc(sizeof(vobu_admap_t)); if(!ifofile->vts_vobu_admap) return 0; @@ -1484,7 +1484,7 @@ int ifoRead_VOBU_ADMAP(ifo_handle_t *ifofile) { return 0; } - ifofile->menu_vobu_admap = (vobu_admap_t *)malloc(sizeof(vobu_admap_t)); + ifofile->menu_vobu_admap = malloc(sizeof(vobu_admap_t)); if(!ifofile->menu_vobu_admap) return 0; @@ -1517,7 +1517,7 @@ static int ifoRead_VOBU_ADMAP_internal(ifo_handle_t *ifofile, Titles with a VOBS that has no VOBUs. */ CHECK_VALUE(info_length % sizeof(uint32_t) == 0); - vobu_admap->vobu_start_sectors = (uint32_t *)malloc(info_length); + vobu_admap->vobu_start_sectors = malloc(info_length); if(!vobu_admap->vobu_start_sectors) { return 0; } @@ -1569,7 +1569,7 @@ int ifoRead_PGCIT(ifo_handle_t *ifofile) { if(ifofile->vtsi_mat->vts_pgcit == 0) /* mandatory */ return 0; - ifofile->vts_pgcit = (pgcit_t *)malloc(sizeof(pgcit_t)); + ifofile->vts_pgcit = malloc(sizeof(pgcit_t)); if(!ifofile->vts_pgcit) return 0; @@ -1699,7 +1699,7 @@ int ifoRead_PGCI_UT(ifo_handle_t *ifofile) { return 0; } - ifofile->pgci_ut = (pgci_ut_t *)malloc(sizeof(pgci_ut_t)); + ifofile->pgci_ut = malloc(sizeof(pgci_ut_t)); if(!ifofile->pgci_ut) return 0; @@ -1889,7 +1889,7 @@ int ifoRead_VTS_ATRT(ifo_handle_t *ifofile) { if(!DVDFileSeek_(ifofile->file, sector * DVD_BLOCK_LEN)) return 0; - vts_atrt = (vts_atrt_t *)malloc(sizeof(vts_atrt_t)); + vts_atrt = malloc(sizeof(vts_atrt_t)); if(!vts_atrt) return 0; @@ -1911,7 +1911,7 @@ int ifoRead_VTS_ATRT(ifo_handle_t *ifofile) { VTS_ATRT_SIZE < vts_atrt->last_byte + 1); info_length = vts_atrt->nr_of_vtss * sizeof(uint32_t); - data = (uint32_t *)malloc(info_length); + data = malloc(info_length); if(!data) { free(vts_atrt); ifofile->vts_atrt = 0; @@ -1933,7 +1933,7 @@ int ifoRead_VTS_ATRT(ifo_handle_t *ifofile) { } info_length = vts_atrt->nr_of_vtss * sizeof(vts_attributes_t); - vts_atrt->vts = (vts_attributes_t *)malloc(info_length); + vts_atrt->vts = malloc(info_length); if(!vts_atrt->vts) { free(data); free(vts_atrt); @@ -1989,7 +1989,7 @@ int ifoRead_TXTDT_MGI(ifo_handle_t *ifofile) { ifofile->vmgi_mat->txtdt_mgi * DVD_BLOCK_LEN)) return 0; - txtdt_mgi = (txtdt_mgi_t *)malloc(sizeof(txtdt_mgi_t)); + txtdt_mgi = malloc(sizeof(txtdt_mgi_t)); if(!txtdt_mgi) { return 0; } diff --git a/m_config.c b/m_config.c index a9db1e6b6c..f8dcf46b44 100644 --- a/m_config.c +++ b/m_config.c @@ -47,7 +47,7 @@ m_config_new(void) { }; int i; - config = (m_config_t*)calloc(1,sizeof(m_config_t)); + config = calloc(1,sizeof(m_config_t)); config->lvl = 1; // 0 Is the defaults if(!inited) { inited = 1; @@ -133,7 +133,7 @@ m_config_push(m_config_t* config) { m_option_save(co->opt,co->slots->data,co->opt->p); // Allocate a new slot - slot = (m_config_save_slot_t*)calloc(1,sizeof(m_config_save_slot_t) + co->opt->type->size); + slot = calloc(1,sizeof(m_config_save_slot_t) + co->opt->type->size); slot->lvl = config->lvl; slot->prev = co->slots; co->slots = slot; @@ -193,7 +193,7 @@ m_config_add_option(m_config_t *config, m_option_t *arg, char* prefix) { #endif // Allocate a new entry for this option - co = (m_config_option_t*)calloc(1,sizeof(m_config_option_t) + arg->type->size); + co = calloc(1,sizeof(m_config_option_t) + arg->type->size); co->opt = arg; // Fill in the full name @@ -225,7 +225,7 @@ m_config_add_option(m_config_t *config, m_option_t *arg, char* prefix) { } if(!(co->flags & M_CFG_OPT_ALIAS)) { // Allocate a slot for the defaults - sl = (m_config_save_slot_t*)calloc(1,sizeof(m_config_save_slot_t) + arg->type->size); + sl = calloc(1,sizeof(m_config_save_slot_t) + arg->type->size); m_option_save(arg,sl->data,(void**)arg->p); // Hack to avoid too much trouble with dynamicly allocated data : // We always use a dynamic version @@ -235,7 +235,7 @@ m_config_add_option(m_config_t *config, m_option_t *arg, char* prefix) { } sl->lvl = 0; sl->prev = NULL; - co->slots = (m_config_save_slot_t*)calloc(1,sizeof(m_config_save_slot_t) + arg->type->size); + co->slots = calloc(1,sizeof(m_config_save_slot_t) + arg->type->size); co->slots->prev = sl; co->slots->lvl = config->lvl; m_option_copy(co->opt,co->slots->data,sl->data); diff --git a/m_option.c b/m_option.c index 17e67720fe..893f8e8fe1 100644 --- a/m_option.c +++ b/m_option.c @@ -699,7 +699,7 @@ static int parse_func_pf(m_option_t* opt,char *name, char *param, void* dst, int if(!dst) return 1; - s = (m_func_save_t*)calloc(1,sizeof(m_func_save_t)); + s = calloc(1,sizeof(m_func_save_t)); s->name = strdup(name); s->param = param ? strdup(param) : NULL; @@ -724,7 +724,7 @@ static void copy_func_pf(m_option_t* opt,void* dst, void* src) { free_func_pf(dst); while(s) { - d = (m_func_save_t*)calloc(1,sizeof(m_func_save_t)); + d = calloc(1,sizeof(m_func_save_t)); d->name = strdup(s->name); d->param = s->param ? strdup(s->param) : NULL; if(last) diff --git a/playtree.c b/playtree.c index 82fcc0d1e7..03ef13607b 100644 --- a/playtree.c +++ b/playtree.c @@ -20,7 +20,7 @@ play_tree_is_valid(play_tree_t* pt); play_tree_t* play_tree_new(void) { - play_tree_t* r = (play_tree_t*)calloc(1,sizeof(play_tree_t)); + play_tree_t* r = calloc(1,sizeof(play_tree_t)); if(r == NULL) mp_msg(MSGT_PLAYTREE,MSGL_ERR,"Can't allocate %d bytes of memory\n",sizeof(play_tree_t)); r->entry_type = PLAY_TREE_ENTRY_NODE; @@ -480,7 +480,7 @@ play_tree_iter_new(play_tree_t* pt,m_config_t* config) { if( ! play_tree_is_valid(pt)) return NULL; - iter = (play_tree_iter_t*)calloc(1,sizeof(play_tree_iter_t)); + iter = calloc(1,sizeof(play_tree_iter_t)); if(! iter) { mp_msg(MSGT_PLAYTREE,MSGL_ERR,"Can't allocate new iterator (%d bytes of memory)\n",sizeof(play_tree_iter_t)); return NULL; diff --git a/playtreeparser.c b/playtreeparser.c index 3984ea25e9..50a2b3ffbe 100644 --- a/playtreeparser.c +++ b/playtreeparser.c @@ -694,7 +694,7 @@ play_tree_parser_t* play_tree_parser_new(stream_t* stream,int deep) { play_tree_parser_t* p; - p = (play_tree_parser_t*)calloc(1,sizeof(play_tree_parser_t)); + p = calloc(1,sizeof(play_tree_parser_t)); if(!p) return NULL; p->stream = stream;