diff options
author | diego <diego@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2010-02-26 15:01:37 +0000 |
---|---|---|
committer | diego <diego@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2010-02-26 15:01:37 +0000 |
commit | b63759b175cf9ddd9735ca0d2f803fe62f69c3c3 (patch) | |
tree | a583febda46545afc4ed20ccbdbed0ae3165a5c4 | |
parent | fad137d7fe3bfef6a258518a1e86a4d811d3b4b5 (diff) | |
download | mpv-b63759b175cf9ddd9735ca0d2f803fe62f69c3c3.tar.bz2 mpv-b63759b175cf9ddd9735ca0d2f803fe62f69c3c3.tar.xz |
Do not cast the results of malloc/calloc/realloc.
These functions return void*, which is compatible with any pointer,
so there is no need for casts.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30744 b3059339-0415-0410-9bf9-f77b7e298cf2
50 files changed, 139 insertions, 142 deletions
diff --git a/TOOLS/bmovl-test.c b/TOOLS/bmovl-test.c index b6d0f55022..04c1e7dd71 100644 --- a/TOOLS/bmovl-test.c +++ b/TOOLS/bmovl-test.c @@ -104,7 +104,7 @@ int main(int argc, char **argv) { blit(fifo, image->pixels, image->w, image->h, i, i, 0, 1); // Create a 75x75 bitmap - bitmap = (unsigned char*)malloc(75*75*4); + bitmap = malloc(75 * 75 * 4); // Paint bitmap red, 50% transparent and blit at position 50,50 paint(bitmap, (75*75*4), 255, 0, 0, 128); diff --git a/TOOLS/vfw2menc.c b/TOOLS/vfw2menc.c index b15b773a05..bdeb960351 100644 --- a/TOOLS/vfw2menc.c +++ b/TOOLS/vfw2menc.c @@ -72,7 +72,7 @@ static int save_settings(HDRVR hDriver, const char *filename) return -1; } - pv = (char *) malloc(cb); + pv = malloc(cb); if (SendDriverMessage(hDriver, ICM_GETSTATE, (LPARAM) pv, (LPARAM) &cb) != ICERR_OK) { printf("ICM_GETSTATE failed\n"); @@ -112,7 +112,7 @@ static int load_settings(HDRVR hDriver, const char *filename) return -1; } - pv = (char *) malloc(info.st_size); + pv = malloc(info.st_size); fd = fopen(filename, "rb"); if (!fd) diff --git a/asxparser.c b/asxparser.c index 931482e339..9ea11435ae 100644 --- a/asxparser.c +++ b/asxparser.c @@ -44,7 +44,7 @@ asx_list_add(void* list_ptr,void* entry){ if(list != NULL) for( ; list[c] != NULL; c++) ; - list = (void*)realloc(list,sizeof(void*)*(c+2)); + list = realloc(list, sizeof(void*) * (c + 2)); list[c] = entry; list[c+1] = NULL; @@ -77,7 +77,7 @@ asx_list_remove(void* list_ptr,void* entry,ASX_FreeFunc free_func) { if(c > e) // If c==e the memmove is not needed memmove(list+e,list+e+1,(c-e)*sizeof(void*)); - list = (void*)realloc(list,(c-1)*sizeof(void*)); + list = realloc(list, (c - 1) * sizeof(void*)); list[c-1] = NULL; *(void***)list_ptr = list; @@ -186,7 +186,7 @@ asx_parse_attribs(ASX_Parser_t* parser,char* buffer,char*** _attribs) { val[ptr2-ptr1] = '\0'; n_attrib++; - attribs = (char**)realloc(attribs,(2*n_attrib+1)*sizeof(char*)); + attribs = realloc(attribs, (2 * n_attrib + 1) * sizeof(char*)); attribs[n_attrib*2-2] = attrib; attribs[n_attrib*2-1] = val; @@ -241,7 +241,7 @@ asx_get_element(ASX_Parser_t* parser,char** _buffer, memmove(parser->ret_stack,parser->ret_stack+i, (parser->ret_stack_size - i)*sizeof(ASX_LineSave_t)); parser->ret_stack_size -= i; if(parser->ret_stack_size > 0) - parser->ret_stack = (ASX_LineSave_t*)realloc(parser->ret_stack,parser->ret_stack_size*sizeof(ASX_LineSave_t)); + parser->ret_stack = realloc(parser->ret_stack,parser->ret_stack_size*sizeof(ASX_LineSave_t)); else { free(parser->ret_stack); parser->ret_stack = NULL; @@ -422,7 +422,7 @@ asx_get_element(ASX_Parser_t* parser,char** _buffer, parser->last_body = body; parser->ret_stack_size++; - parser->ret_stack = (ASX_LineSave_t*)realloc(parser->ret_stack,parser->ret_stack_size*sizeof(ASX_LineSave_t)); + parser->ret_stack = realloc(parser->ret_stack,parser->ret_stack_size*sizeof(ASX_LineSave_t)); if(parser->ret_stack_size > 1) memmove(parser->ret_stack+1,parser->ret_stack,(parser->ret_stack_size-1)*sizeof(ASX_LineSave_t)); parser->ret_stack[0].buffer = ret; diff --git a/gui/win32/dialogs.c b/gui/win32/dialogs.c index 60a8d8c759..edd63d570c 100644 --- a/gui/win32/dialogs.c +++ b/gui/win32/dialogs.c @@ -715,7 +715,7 @@ static LRESULT CALLBACK SkinBrowserWndProc(HWND hwnd, UINT iMsg, WPARAM wParam, { if (guiIntfStruct.Playing) guiGetEvent(guiCEvent, (void *) guiSetStop); if (skinName) free(skinName); - skinName = (char *) malloc(len+1); + skinName = malloc(len + 1); SendMessage(listbox, LB_GETTEXT, (WPARAM) index, (LPARAM) skinName); /* fill out the full pathname to the skin */ strcpy(skinspath, get_path("skins")); diff --git a/gui/win32/widgetrender.c b/gui/win32/widgetrender.c index 0ac2e730ea..4dcd105b8b 100644 --- a/gui/win32/widgetrender.c +++ b/gui/win32/widgetrender.c @@ -185,7 +185,7 @@ static char *generatetextfromlabel(widget *item) /* cuts text to buflen scrolling from right to left */ static void scrolltext(char *text, unsigned int buflen, float *value) { - char *buffer = (char *) malloc(buflen + 1); + char *buffer = malloc(buflen + 1); unsigned int x,i; if(*value < buflen) x = 0; else x = *value - buflen; diff --git a/libao2/ao_coreaudio.c b/libao2/ao_coreaudio.c index 36456f3cc6..dffab4dd2e 100644 --- a/libao2/ao_coreaudio.c +++ b/libao2/ao_coreaudio.c @@ -291,7 +291,7 @@ int b_alive; } /* Retrieve the name of the device. */ - psz_name = (char *)malloc(i_param_size); + psz_name = malloc(i_param_size); err = AudioDeviceGetProperty(devid_def, 0, 0, kAudioDevicePropertyDeviceName, &i_param_size, psz_name); @@ -513,7 +513,7 @@ static int OpenSPDIF(void) } i_streams = i_param_size / sizeof(AudioStreamID); - p_streams = (AudioStreamID *)malloc(i_param_size); + p_streams = malloc(i_param_size); if (p_streams == NULL) { ao_msg(MSGT_AO, MSGL_WARN, "out of memory\n" ); @@ -549,7 +549,7 @@ static int OpenSPDIF(void) } i_formats = i_param_size / sizeof(AudioStreamBasicDescription); - p_format_list = (AudioStreamBasicDescription *)malloc(i_param_size); + p_format_list = malloc(i_param_size); if (p_format_list == NULL) { ao_msg(MSGT_AO, MSGL_WARN, "could not malloc the memory\n" ); @@ -742,7 +742,7 @@ static int AudioDeviceSupportsDigital( AudioDeviceID i_dev_id ) } i_streams = i_param_size / sizeof(AudioStreamID); - p_streams = (AudioStreamID *)malloc(i_param_size); + p_streams = malloc(i_param_size); if (p_streams == NULL) { ao_msg(MSGT_AO,MSGL_V, "out of memory\n"); @@ -791,7 +791,7 @@ static int AudioStreamSupportsDigital( AudioStreamID i_stream_id ) } i_formats = i_param_size / sizeof(AudioStreamBasicDescription); - p_format_list = (AudioStreamBasicDescription *)malloc(i_param_size); + p_format_list = malloc(i_param_size); if (p_format_list == NULL) { ao_msg(MSGT_AO,MSGL_V, "could not malloc the memory\n" ); diff --git a/libmenu/menu_filesel.c b/libmenu/menu_filesel.c index e6978d7fc2..06f6089806 100644 --- a/libmenu/menu_filesel.c +++ b/libmenu/menu_filesel.c @@ -193,7 +193,7 @@ static char **get_extensions(menu_t *menu){ if(!fp) return NULL; - extensions = (char **) malloc(sizeof(*extensions)); + extensions = malloc(sizeof(*extensions)); *extensions = NULL; while(fgets(ext,sizeof(ext),fp)) { @@ -204,9 +204,9 @@ static char **get_extensions(menu_t *menu){ ext[s-1] = '\0'; s--; } - e = (char *) malloc(s+1); - extensions = (char **) realloc(extensions, ++n * sizeof(*extensions)); - extensions = (char **) realloc(extensions, ++n * sizeof(*extensions)); + e = malloc(s+1); + extensions = realloc(extensions, ++n * sizeof(*extensions)); + extensions = realloc(extensions, ++n * sizeof(*extensions)); strcpy (e, ext); for (l=extensions; *l; l++); *l++ = e; @@ -262,7 +262,7 @@ static int open_dir(menu_t* menu,char* args) { } } - namelist = (char **) malloc(sizeof(char *)); + namelist = malloc(sizeof(char *)); extensions = get_extensions(menu); n=0; @@ -290,7 +290,7 @@ static int open_dir(menu_t* menu,char* args) { continue; } if(n%20 == 0){ // Get some more mem - if((tp = (char **) realloc(namelist, (n+20) * sizeof (char *))) + if((tp = realloc(namelist, (n+20) * sizeof (char *))) == NULL) { mp_msg(MSGT_GLOBAL,MSGL_ERR,MSGTR_LIBMENU_ReallocError, strerror(errno)); n--; @@ -299,7 +299,7 @@ static int open_dir(menu_t* menu,char* args) { namelist=tp; } - namelist[n] = (char *) malloc(strlen(dp->d_name) + 2); + namelist[n] = malloc(strlen(dp->d_name) + 2); if(namelist[n] == NULL){ mp_msg(MSGT_GLOBAL,MSGL_ERR,MSGTR_LIBMENU_MallocError, strerror(errno)); n--; diff --git a/libmpcodecs/ad_libmad.c b/libmpcodecs/ad_libmad.c index 21fc25fac7..103a05f4a9 100644 --- a/libmpcodecs/ad_libmad.c +++ b/libmpcodecs/ad_libmad.c @@ -52,7 +52,7 @@ typedef struct mad_decoder_s { static int preinit(sh_audio_t *sh){ - mad_decoder_t *this = (mad_decoder_t *) malloc(sizeof(mad_decoder_t)); + mad_decoder_t *this = malloc(sizeof(mad_decoder_t)); memset(this,0,sizeof(mad_decoder_t)); sh->context = this; diff --git a/libmpcodecs/ae.c b/libmpcodecs/ae.c index acf16319a9..1669359981 100644 --- a/libmpcodecs/ae.c +++ b/libmpcodecs/ae.c @@ -59,7 +59,7 @@ audio_encoder_t *new_audio_encoder(muxer_stream_t *stream, audio_encoding_params if(! params) return NULL; - encoder = (audio_encoder_t *) calloc(1, sizeof(audio_encoder_t)); + encoder = calloc(1, sizeof(audio_encoder_t)); memcpy(&encoder->params, params, sizeof(audio_encoding_params_t)); encoder->stream = stream; diff --git a/libmpcodecs/ae_toolame.c b/libmpcodecs/ae_toolame.c index 7e64b2a41f..2a0e9f7941 100644 --- a/libmpcodecs/ae_toolame.c +++ b/libmpcodecs/ae_toolame.c @@ -165,7 +165,7 @@ int mpae_init_toolame(audio_encoder_t *encoder) else mp_msg(MSGT_MENCODER, MSGL_ERR, "ae_toolame, Toolame can't encode > 2 channels, exiting\n"); - ctx = (mpae_toolame_ctx *) calloc(1, sizeof(mpae_toolame_ctx)); + ctx = calloc(1, sizeof(mpae_toolame_ctx)); if(ctx == NULL) { mp_msg(MSGT_MENCODER, MSGL_ERR, "ae_toolame, couldn't alloc a %d bytes context, exiting\n", sizeof(mpae_toolame_ctx)); diff --git a/libmpcodecs/mp_image.h b/libmpcodecs/mp_image.h index ba69e720ef..65b155e037 100644 --- a/libmpcodecs/mp_image.h +++ b/libmpcodecs/mp_image.h @@ -209,7 +209,7 @@ static inline void mp_image_setfmt(mp_image_t* mpi,unsigned int out_fmt){ #endif static inline mp_image_t* new_mp_image(int w,int h){ - mp_image_t* mpi=(mp_image_t*)malloc(sizeof(mp_image_t)); + mp_image_t* mpi = malloc(sizeof(mp_image_t)); if(!mpi) return NULL; // error! memset(mpi,0,sizeof(mp_image_t)); mpi->width=mpi->w=w; diff --git a/libmpcodecs/vd_mpng.c b/libmpcodecs/vd_mpng.c index 919364742e..13dcfdbf78 100644 --- a/libmpcodecs/vd_mpng.c +++ b/libmpcodecs/vd_mpng.c @@ -162,7 +162,7 @@ static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){ if (out_fmt==IMGFMT_BGR8) { png_get_PLTE( png,info,&pal,&cols ); - mpi->planes[1] = (char*)realloc(mpi->planes[1], 4*cols); + mpi->planes[1] = realloc(mpi->planes[1], 4*cols); p = mpi->planes[1]; for (i = 0; i < cols; i++) { *p++ = pal[i].blue; diff --git a/libmpcodecs/vd_mtga.c b/libmpcodecs/vd_mtga.c index f6eee54cbe..310d6e2702 100644 --- a/libmpcodecs/vd_mtga.c +++ b/libmpcodecs/vd_mtga.c @@ -92,7 +92,7 @@ static int control(sh_video_t *sh, int cmd, void *arg, ...) /* init driver */ static int init(sh_video_t *sh) { - sh->context = (TGAInfo *) calloc(1, sizeof(TGAInfo)); + sh->context = calloc(1, sizeof(TGAInfo)); last_w = -1; return 1; diff --git a/libmpcodecs/vd_sgi.c b/libmpcodecs/vd_sgi.c index 07dd8ff60d..e951542a8b 100644 --- a/libmpcodecs/vd_sgi.c +++ b/libmpcodecs/vd_sgi.c @@ -84,7 +84,7 @@ control(sh_video_t* sh, int cmd, void *arg, ...) static int init(sh_video_t *sh) { - sh->context = (SGIInfo *) calloc(1, sizeof(SGIInfo)); + sh->context = calloc(1, sizeof(SGIInfo)); last_x = -1; return 1; diff --git a/libmpcodecs/ve_vfw.c b/libmpcodecs/ve_vfw.c index c43d389ba9..27c5c83d80 100644 --- a/libmpcodecs/ve_vfw.c +++ b/libmpcodecs/ve_vfw.c @@ -139,7 +139,7 @@ mp_msg(MSGT_WIN32,MSGL_INFO,"\n"); mp_msg(MSGT_WIN32,MSGL_ERR,"Cannot open Compressor data file!\n"); return NULL; } - drvdata = (char *) malloc(st.st_size); + drvdata = malloc(st.st_size); if (fread(drvdata, st.st_size, 1, fd) != 1) { mp_msg(MSGT_WIN32,MSGL_ERR,"Cannot read Compressor data file!\n"); fclose(fd); diff --git a/libmpcodecs/vf_eq2.c b/libmpcodecs/vf_eq2.c index 099acc85a0..fe4a89fb13 100644 --- a/libmpcodecs/vf_eq2.c +++ b/libmpcodecs/vf_eq2.c @@ -255,11 +255,11 @@ int put_image (vf_instance_t *vf, mp_image_t *src, double pts) img_n = eq2->buf_w[0]*eq2->buf_h[0]; if(src->num_planes>1){ img_c = eq2->buf_w[1]*eq2->buf_h[1]; - eq2->buf[0] = (unsigned char *) realloc (eq2->buf[0], img_n + 2*img_c); + eq2->buf[0] = realloc (eq2->buf[0], img_n + 2*img_c); eq2->buf[1] = eq2->buf[0] + img_n; eq2->buf[2] = eq2->buf[1] + img_c; } else - eq2->buf[0] = (unsigned char *) realloc (eq2->buf[0], img_n); + eq2->buf[0] = realloc (eq2->buf[0], img_n); } dst = vf_get_image (vf->next, src->imgfmt, MP_IMGTYPE_EXPORT, 0, src->w, src->h); @@ -457,7 +457,7 @@ int vf_open(vf_instance_t *vf, char *args) vf->put_image = put_image; vf->uninit = uninit; - vf->priv = (vf_eq2_t *) malloc (sizeof (vf_eq2_t)); + vf->priv = malloc (sizeof (vf_eq2_t)); eq2 = vf->priv; for (i = 0; i < 3; i++) { diff --git a/libmpdemux/demux_aac.c b/libmpdemux/demux_aac.c index cfbedfc8c1..54493fb466 100644 --- a/libmpdemux/demux_aac.c +++ b/libmpdemux/demux_aac.c @@ -47,7 +47,7 @@ static int demux_aac_init(demuxer_t *demuxer) if(!priv) return 0; - priv->buf = (uint8_t*) malloc(8); + priv->buf = malloc(8); if(!priv->buf) { free(priv); diff --git a/libmpdemux/demux_roq.c b/libmpdemux/demux_roq.c index 5c13d9739a..e51fab6717 100644 --- a/libmpdemux/demux_roq.c +++ b/libmpdemux/demux_roq.c @@ -191,7 +191,7 @@ static demuxer_t* demux_open_roq(demuxer_t* demuxer) } // index the chunk - roq_data->chunks = (roq_chunk_t *)realloc(roq_data->chunks, + roq_data->chunks = realloc(roq_data->chunks, (roq_data->total_chunks + 1) * sizeof (roq_chunk_t)); roq_data->chunks[roq_data->total_chunks].chunk_type = CHUNK_TYPE_AUDIO; roq_data->chunks[roq_data->total_chunks].chunk_offset = @@ -214,7 +214,7 @@ static demuxer_t* demux_open_roq(demuxer_t* demuxer) { // index a new chunk if it's a codebook or quad VQ not following a // codebook - roq_data->chunks = (roq_chunk_t *)realloc(roq_data->chunks, + roq_data->chunks = realloc(roq_data->chunks, (roq_data->total_chunks + 1) * sizeof (roq_chunk_t)); roq_data->chunks[roq_data->total_chunks].chunk_type = CHUNK_TYPE_VIDEO; roq_data->chunks[roq_data->total_chunks].chunk_offset = diff --git a/libmpdemux/demux_ts.c b/libmpdemux/demux_ts.c index d27ae76596..0a79dcded5 100644 --- a/libmpdemux/demux_ts.c +++ b/libmpdemux/demux_ts.c @@ -320,7 +320,7 @@ static void ts_add_stream(demuxer_t * demuxer, ES_stream_t *es) if(es->extradata && es->extradata_len) { - sh->wf = (WAVEFORMATEX *) malloc(sizeof (WAVEFORMATEX) + es->extradata_len); + sh->wf = malloc(sizeof (WAVEFORMATEX) + es->extradata_len); sh->wf->cbSize = es->extradata_len; memcpy(sh->wf + 1, es->extradata, es->extradata_len); } @@ -344,7 +344,7 @@ static void ts_add_stream(demuxer_t * demuxer, ES_stream_t *es) if(sh->format == VIDEO_AVC && es->extradata && es->extradata_len) { int w = 0, h = 0; - sh->bih = (BITMAPINFOHEADER *) calloc(1, sizeof(BITMAPINFOHEADER) + es->extradata_len); + sh->bih = calloc(1, sizeof(BITMAPINFOHEADER) + es->extradata_len); sh->bih->biSize= sizeof(BITMAPINFOHEADER) + es->extradata_len; sh->bih->biCompression = sh->format; memcpy(sh->bih + 1, es->extradata, es->extradata_len); @@ -680,7 +680,7 @@ static off_t ts_detect_streams(demuxer_t *demuxer, tsdemux_init_t *param) pptr = &pes_priv1[es.pid]; if(pptr->pos < 64*1024) { - tmpbuf = (char*) realloc(pptr->buf, pptr->pos + es.size); + tmpbuf = realloc(pptr->buf, pptr->pos + es.size); if(tmpbuf != NULL) { pptr->buf = tmpbuf; @@ -1678,7 +1678,7 @@ static int collect_section(ts_section_t *section, int is_start, unsigned char *b { if(! section->buffer) { - section->buffer = (uint8_t*) malloc(4096+256); + section->buffer = malloc(4096 + 256); if(section->buffer == NULL) return 0; } @@ -2697,7 +2697,7 @@ static int fill_extradata(mp4_decoder_config_t * mp4_dec, ES_stream_t *tss) if(mp4_dec->buf_size > tss->extradata_alloc) { - tmp = (uint8_t *) realloc(tss->extradata, mp4_dec->buf_size); + tmp = realloc(tss->extradata, mp4_dec->buf_size); if(!tmp) return 0; tss->extradata = tmp; diff --git a/libmpdemux/demuxer.c b/libmpdemux/demuxer.c index 9935a4a896..0553429790 100644 --- a/libmpdemux/demuxer.c +++ b/libmpdemux/demuxer.c @@ -1306,8 +1306,7 @@ int demux_info_add(demuxer_t *demuxer, const char *opt, const char *param) } } - info = demuxer->info = (char **) realloc(info, - (2 * (n + 2)) * sizeof(char *)); + info = demuxer->info = realloc(info, (2 * (n + 2)) * sizeof(char *)); info[2 * n] = strdup(opt); info[2 * n + 1] = strdup(param); memset(&info[2 * (n + 1)], 0, 2 * sizeof(char *)); diff --git a/libmpdemux/demuxer.h b/libmpdemux/demuxer.h index 699e5a56b9..4be7e5a5a0 100644 --- a/libmpdemux/demuxer.h +++ b/libmpdemux/demuxer.h @@ -261,7 +261,7 @@ typedef struct { } demux_program_t; static inline demux_packet_t* new_demux_packet(int len){ - demux_packet_t* dp=(demux_packet_t*)malloc(sizeof(demux_packet_t)); + demux_packet_t* dp = malloc(sizeof(demux_packet_t)); dp->len=len; dp->next=NULL; dp->pts=MP_NOPTS_VALUE; @@ -272,7 +272,7 @@ static inline demux_packet_t* new_demux_packet(int len){ dp->refcount=1; dp->master=NULL; dp->buffer=NULL; - if (len > 0 && (dp->buffer = (unsigned char *)malloc(len + MP_INPUT_BUFFER_PADDING_SIZE))) + if (len > 0 && (dp->buffer = malloc(len + MP_INPUT_BUFFER_PADDING_SIZE))) memset(dp->buffer + len, 0, 8); else dp->len = 0; @@ -283,7 +283,7 @@ static inline void resize_demux_packet(demux_packet_t* dp, int len) { if(len > 0) { - dp->buffer=(unsigned char *)realloc(dp->buffer,len+8); + dp->buffer = realloc(dp->buffer, len + 8); } else { @@ -298,7 +298,7 @@ static inline void resize_demux_packet(demux_packet_t* dp, int len) } static inline demux_packet_t* clone_demux_packet(demux_packet_t* pack){ - demux_packet_t* dp=(demux_packet_t*)malloc(sizeof(demux_packet_t)); + demux_packet_t* dp = malloc(sizeof(demux_packet_t)); while(pack->master) pack=pack->master; // find the master memcpy(dp,pack,sizeof(demux_packet_t)); dp->next=NULL; diff --git a/libmpdemux/ebml.c b/libmpdemux/ebml.c index a007bd4ad4..d22314fa8d 100644 --- a/libmpdemux/ebml.c +++ b/libmpdemux/ebml.c @@ -230,7 +230,7 @@ ebml_read_ascii (stream_t *s, uint64_t *length) if (length) *length = len + l; - str = (char *) malloc (len+1); + str = malloc (len + 1); if (stream_read(s, str, len) != (int) len) { free (str); diff --git a/libmpdemux/muxer_lavf.c b/libmpdemux/muxer_lavf.c index f531423979..90367f4258 100644 --- a/libmpdemux/muxer_lavf.c +++ b/libmpdemux/muxer_lavf.c @@ -340,7 +340,7 @@ int muxer_init_muxer_lavf(muxer_t *muxer) "will play these INCORRECT files as if nothing were wrong!\n" "*******************************************************************************\n"); - priv = (muxer_priv_t *) calloc(1, sizeof(muxer_priv_t)); + priv = calloc(1, sizeof(muxer_priv_t)); if(priv == NULL) return 0; diff --git a/libmpdemux/muxer_mpeg.c b/libmpdemux/muxer_mpeg.c index 27f360d00d..817361ad7a 100644 --- a/libmpdemux/muxer_mpeg.c +++ b/libmpdemux/muxer_mpeg.c @@ -339,13 +339,13 @@ static mpeg_frame_t *init_frames(uint16_t num, size_t size) mpeg_frame_t *tmp; uint16_t i; - tmp = (mpeg_frame_t *) calloc(num, sizeof(mpeg_frame_t)); + tmp = calloc(num, sizeof(mpeg_frame_t)); if(tmp == NULL) return NULL; for(i=0; i < num; i++) { - tmp[i].buffer = (uint8_t *) calloc(1, size); + tmp[i].buffer = calloc(1, size); if(tmp[i].buffer == NULL) return NULL; tmp[i].size = 0; @@ -386,14 +386,14 @@ static muxer_stream_t* mpegfile_new_stream(muxer_t *muxer,int type){ mp_msg(MSGT_MUXER, MSGL_ERR, "Unknown stream type!\n"); return NULL; } - s = (muxer_stream_t*) calloc(1, sizeof(muxer_stream_t)); + s = calloc(1, sizeof(muxer_stream_t)); if(!s) return NULL; // no mem!? if (!(s->b_buffer = malloc(priv->packet_size))) goto init_fail; s->b_buffer_size = priv->packet_size; s->b_buffer_ptr = 0; s->b_buffer_len = 0; - s->priv = (muxer_headers_t*) calloc(1, sizeof(muxer_headers_t)); + s->priv = calloc(1, sizeof(muxer_headers_t)); if(s->priv == NULL) goto init_fail; spriv = (muxer_headers_t *) s->priv; @@ -1964,7 +1964,7 @@ static int fill_last_frame(muxer_headers_t *spriv, uint8_t *ptr, int len) { if(spriv->framebuf[idx] |