Mercurial > mplayer.hg
changeset 30702:9fc9d1e788aa
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.
line wrap: on
line diff
--- a/TOOLS/bmovl-test.c Fri Feb 26 12:49:49 2010 +0000 +++ b/TOOLS/bmovl-test.c Fri Feb 26 15:01:37 2010 +0000 @@ -104,7 +104,7 @@ 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);
--- a/TOOLS/vfw2menc.c Fri Feb 26 12:49:49 2010 +0000 +++ b/TOOLS/vfw2menc.c Fri Feb 26 15:01:37 2010 +0000 @@ -72,7 +72,7 @@ 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 @@ return -1; } - pv = (char *) malloc(info.st_size); + pv = malloc(info.st_size); fd = fopen(filename, "rb"); if (!fd)
--- a/asxparser.c Fri Feb 26 12:49:49 2010 +0000 +++ b/asxparser.c Fri Feb 26 15:01:37 2010 +0000 @@ -44,7 +44,7 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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;
--- a/gui/win32/dialogs.c Fri Feb 26 12:49:49 2010 +0000 +++ b/gui/win32/dialogs.c Fri Feb 26 15:01:37 2010 +0000 @@ -715,7 +715,7 @@ { 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"));
--- a/gui/win32/widgetrender.c Fri Feb 26 12:49:49 2010 +0000 +++ b/gui/win32/widgetrender.c Fri Feb 26 15:01:37 2010 +0000 @@ -185,7 +185,7 @@ /* 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;
--- a/libao2/ao_coreaudio.c Fri Feb 26 12:49:49 2010 +0000 +++ b/libao2/ao_coreaudio.c Fri Feb 26 15:01:37 2010 +0000 @@ -291,7 +291,7 @@ } /* 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 @@ } 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 @@ } 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 @@ } 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 @@ } 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" );
--- a/libmenu/menu_filesel.c Fri Feb 26 12:49:49 2010 +0000 +++ b/libmenu/menu_filesel.c Fri Feb 26 15:01:37 2010 +0000 @@ -193,7 +193,7 @@ 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 @@ 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 @@ } } - namelist = (char **) malloc(sizeof(char *)); + namelist = malloc(sizeof(char *)); extensions = get_extensions(menu); n=0; @@ -290,7 +290,7 @@ 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 @@ 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--;
--- a/libmpcodecs/ad_libmad.c Fri Feb 26 12:49:49 2010 +0000 +++ b/libmpcodecs/ad_libmad.c Fri Feb 26 15:01:37 2010 +0000 @@ -52,7 +52,7 @@ 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;
--- a/libmpcodecs/ae.c Fri Feb 26 12:49:49 2010 +0000 +++ b/libmpcodecs/ae.c Fri Feb 26 15:01:37 2010 +0000 @@ -59,7 +59,7 @@ 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;
--- a/libmpcodecs/ae_toolame.c Fri Feb 26 12:49:49 2010 +0000 +++ b/libmpcodecs/ae_toolame.c Fri Feb 26 15:01:37 2010 +0000 @@ -165,7 +165,7 @@ 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));
--- a/libmpcodecs/mp_image.h Fri Feb 26 12:49:49 2010 +0000 +++ b/libmpcodecs/mp_image.h Fri Feb 26 15:01:37 2010 +0000 @@ -209,7 +209,7 @@ #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;
--- a/libmpcodecs/vd_mpng.c Fri Feb 26 12:49:49 2010 +0000 +++ b/libmpcodecs/vd_mpng.c Fri Feb 26 15:01:37 2010 +0000 @@ -162,7 +162,7 @@ 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;
--- a/libmpcodecs/vd_mtga.c Fri Feb 26 12:49:49 2010 +0000 +++ b/libmpcodecs/vd_mtga.c Fri Feb 26 15:01:37 2010 +0000 @@ -92,7 +92,7 @@ /* 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;
--- a/libmpcodecs/vd_sgi.c Fri Feb 26 12:49:49 2010 +0000 +++ b/libmpcodecs/vd_sgi.c Fri Feb 26 15:01:37 2010 +0000 @@ -84,7 +84,7 @@ 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;
--- a/libmpcodecs/ve_vfw.c Fri Feb 26 12:49:49 2010 +0000 +++ b/libmpcodecs/ve_vfw.c Fri Feb 26 15:01:37 2010 +0000 @@ -139,7 +139,7 @@ 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);
--- a/libmpcodecs/vf_eq2.c Fri Feb 26 12:49:49 2010 +0000 +++ b/libmpcodecs/vf_eq2.c Fri Feb 26 15:01:37 2010 +0000 @@ -255,11 +255,11 @@ 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 @@ 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++) {
--- a/libmpdemux/demux_aac.c Fri Feb 26 12:49:49 2010 +0000 +++ b/libmpdemux/demux_aac.c Fri Feb 26 15:01:37 2010 +0000 @@ -47,7 +47,7 @@ if(!priv) return 0; - priv->buf = (uint8_t*) malloc(8); + priv->buf = malloc(8); if(!priv->buf) { free(priv);
--- a/libmpdemux/demux_roq.c Fri Feb 26 12:49:49 2010 +0000 +++ b/libmpdemux/demux_roq.c Fri Feb 26 15:01:37 2010 +0000 @@ -191,7 +191,7 @@ } // 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 @@ { // 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 =
--- a/libmpdemux/demux_ts.c Fri Feb 26 12:49:49 2010 +0000 +++ b/libmpdemux/demux_ts.c Fri Feb 26 15:01:37 2010 +0000 @@ -320,7 +320,7 @@ 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 @@ 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 @@ 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 @@ { 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 @@ 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;
--- a/libmpdemux/demuxer.c Fri Feb 26 12:49:49 2010 +0000 +++ b/libmpdemux/demuxer.c Fri Feb 26 15:01:37 2010 +0000 @@ -1306,8 +1306,7 @@ } } - 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 *));
--- a/libmpdemux/demuxer.h Fri Feb 26 12:49:49 2010 +0000 +++ b/libmpdemux/demuxer.h Fri Feb 26 15:01:37 2010 +0000 @@ -261,7 +261,7 @@ } 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 @@ 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 @@ { 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 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;
--- a/libmpdemux/ebml.c Fri Feb 26 12:49:49 2010 +0000 +++ b/libmpdemux/ebml.c Fri Feb 26 15:01:37 2010 +0000 @@ -230,7 +230,7 @@ if (length) *length = len + l; - str = (char *) malloc (len+1); + str = malloc (len + 1); if (stream_read(s, str, len) != (int) len) { free (str);
--- a/libmpdemux/muxer_lavf.c Fri Feb 26 12:49:49 2010 +0000 +++ b/libmpdemux/muxer_lavf.c Fri Feb 26 15:01:37 2010 +0000 @@ -340,7 +340,7 @@ "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;
--- a/libmpdemux/muxer_mpeg.c Fri Feb 26 12:49:49 2010 +0000 +++ b/libmpdemux/muxer_mpeg.c Fri Feb 26 15:01:37 2010 +0000 @@ -339,13 +339,13 @@ 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 @@ 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 @@ { if(spriv->framebuf[idx].size > SIZE_MAX - (size_t)len) return 0; - spriv->framebuf[idx].buffer = (uint8_t*) realloc(spriv->framebuf[idx].buffer, spriv->framebuf[idx].size + len); + spriv->framebuf[idx].buffer = realloc(spriv->framebuf[idx].buffer, spriv->framebuf[idx].size + len); if(! spriv->framebuf[idx].buffer) return 0; spriv->framebuf[idx].alloc_size = spriv->framebuf[idx].size + len; @@ -1983,7 +1983,7 @@ idx = spriv->framebuf_used; if(idx >= spriv->framebuf_cnt) { - spriv->framebuf = (mpeg_frame_t*) realloc_struct(spriv->framebuf, (spriv->framebuf_cnt+1), sizeof(mpeg_frame_t)); + spriv->framebuf = realloc_struct(spriv->framebuf, (spriv->framebuf_cnt+1), sizeof(mpeg_frame_t)); if(spriv->framebuf == NULL) { mp_msg(MSGT_MUXER, MSGL_FATAL, "Couldn't realloc frame buffer(idx), abort\n"); @@ -1994,7 +1994,7 @@ spriv->framebuf[spriv->framebuf_cnt].alloc_size = 0; spriv->framebuf[spriv->framebuf_cnt].pos = 0; - spriv->framebuf[spriv->framebuf_cnt].buffer = (uint8_t*) malloc(len); + spriv->framebuf[spriv->framebuf_cnt].buffer = malloc(len); if(spriv->framebuf[spriv->framebuf_cnt].buffer == NULL) { mp_msg(MSGT_MUXER, MSGL_FATAL, "Couldn't realloc frame buffer(frame), abort\n"); @@ -2500,7 +2500,7 @@ int muxer_init_muxer_mpeg(muxer_t *muxer) { muxer_priv_t *priv; - priv = (muxer_priv_t *) calloc(1, sizeof(muxer_priv_t)); + priv = calloc(1, sizeof(muxer_priv_t)); if(priv == NULL) return 0; priv->update_system_header = 1; @@ -2716,7 +2716,7 @@ priv->drop = conf_drop; - priv->buff = (uint8_t *) malloc(priv->packet_size); + priv->buff = malloc(priv->packet_size); if((priv->buff == NULL)) { mp_msg(MSGT_MUXER, MSGL_ERR, "\nCouldn't allocate %d bytes, exit\n", priv->packet_size);
--- a/libmpdemux/video.c Fri Feb 26 12:49:49 2010 +0000 +++ b/libmpdemux/video.c Fri Feb 26 15:01:37 2010 +0000 @@ -382,7 +382,7 @@ } if(mp_vc1_decode_sequence_header(&picture, &videobuffer[4], videobuf_len-4)) { - sh_video->bih = (BITMAPINFOHEADER *) calloc(1, sizeof(BITMAPINFOHEADER) + videobuf_len); + sh_video->bih = calloc(1, sizeof(BITMAPINFOHEADER) + videobuf_len); if(sh_video->bih == NULL) { mp_msg(MSGT_DECVIDEO,MSGL_ERR,"Couldn't alloc %d bytes for VC-1 extradata!\n", sizeof(BITMAPINFOHEADER) + videobuf_len); return 0;
--- a/libvo/sub.c Fri Feb 26 12:49:49 2010 +0000 +++ b/libvo/sub.c Fri Feb 26 15:01:37 2010 +0000 @@ -726,7 +726,7 @@ render_one_glyph(sub_font, c); if (c == ' ') { - struct osd_text_t *tmp_ott = (struct osd_text_t *) calloc(1, sizeof(struct osd_text_t)); + struct osd_text_t *tmp_ott = calloc(1, sizeof(struct osd_text_t)); if (osl == NULL) { osl = cp_ott = tmp_ott; @@ -739,7 +739,7 @@ } tmp_ott->osd_length = xsize; tmp_ott->text_length = char_position; - tmp_ott->text = (int *) malloc(char_position * sizeof(int)); + tmp_ott->text = malloc(char_position * sizeof(int)); for (counter = 0; counter < char_position; ++counter) tmp_ott->text[counter] = char_seq[counter]; char_position = 0; @@ -769,7 +769,7 @@ // osl holds an ordered (as they appear in the lines) chain of the subtitle words { - struct osd_text_t *tmp_ott = (struct osd_text_t *) calloc(1, sizeof(struct osd_text_t)); + struct osd_text_t *tmp_ott = calloc(1, sizeof(struct osd_text_t)); if (osl == NULL) { osl = cp_ott = tmp_ott; @@ -782,7 +782,7 @@ } tmp_ott->osd_length = xsize; tmp_ott->text_length = char_position; - tmp_ott->text = (int *) malloc(char_position * sizeof(int)); + tmp_ott->text = malloc(char_position * sizeof(int)); for (counter = 0; counter < char_position; ++counter) tmp_ott->text[counter] = char_seq[counter]; char_position = 0; @@ -794,7 +794,7 @@ int value = 0, exit = 0, minimum = 0; // otp will contain the chain of the osd subtitle lines coming from the single vo_sub line. - otp = tmp_otp = (struct osd_text_p *) calloc(1, sizeof(struct osd_text_p)); + otp = tmp_otp = calloc(1, sizeof(struct osd_text_p)); tmp_otp->ott = osl; for (tmp_ott = tmp_otp->ott; exit == 0; ) { do { @@ -802,7 +802,7 @@ tmp_ott = tmp_ott->next; } while ((tmp_ott != NULL) && (value + tmp_ott->osd_kerning + tmp_ott->osd_length <= xlimit)); if (tmp_ott != NULL) { - struct osd_text_p *tmp = (struct osd_text_p *) calloc(1, sizeof(struct osd_text_p)); + struct osd_text_p *tmp = calloc(1, sizeof(struct osd_text_p)); tmp_otp->value = value; tmp_otp->next = tmp;
--- a/libvo/video_out.c Fri Feb 26 12:49:49 2010 +0000 +++ b/libvo/video_out.c Fri Feb 26 15:01:37 2010 +0000 @@ -482,7 +482,7 @@ for (i = 0; *endptr; i++) { if (*s == ',') goto out_err; - if (!(r = (range_t *) realloc(r, sizeof(*r) * (i + 2)))) { + if (!(r = realloc(r, sizeof(*r) * (i + 2)))) { mp_msg(MSGT_GLOBAL, MSGL_WARN,"can't realloc 'r'\n"); return NULL; }
--- a/libvo/vo_fbdev2.c Fri Feb 26 12:49:49 2010 +0000 +++ b/libvo/vo_fbdev2.c Fri Feb 26 15:01:37 2010 +0000 @@ -300,7 +300,7 @@ ( (out_height - in_height) / 2 ) * fb_line_len; #ifndef USE_CONVERT2FB - if (!(next_frame = (uint8_t *) realloc(next_frame, in_width * in_height * fb_pixel_size))) { + if (!(next_frame = realloc(next_frame, in_width * in_height * fb_pixel_size))) { mp_msg(MSGT_VO, MSGL_ERR, "[fbdev2] Can't malloc next_frame: %s\n", strerror(errno)); return 1; }
--- a/loader/dmo/buffer.c Fri Feb 26 12:49:49 2010 +0000 +++ b/loader/dmo/buffer.c Fri Feb 26 15:01:37 2010 +0000 @@ -69,12 +69,12 @@ CMediaBuffer* CMediaBufferCreate(unsigned long maxlen, void* mem, unsigned long len, int copy) { - CMediaBuffer* This = (CMediaBuffer*) malloc(sizeof(CMediaBuffer)); + CMediaBuffer* This = malloc(sizeof(CMediaBuffer)); if (!This) return NULL; - This->vt = (IMediaBuffer_vt*) malloc(sizeof(IMediaBuffer_vt)); + This->vt = malloc(sizeof(IMediaBuffer_vt)); if (!This->vt) { CMediaBuffer_Destroy(This);
--- a/loader/dmo/dmo.c Fri Feb 26 12:49:49 2010 +0000 +++ b/loader/dmo/dmo.c Fri Feb 26 15:01:37 2010 +0000 @@ -36,7 +36,7 @@ { HRESULT hr = 0; const char* em = NULL; - DMO_Filter* This = (DMO_Filter*) malloc(sizeof(DMO_Filter)); + DMO_Filter* This = malloc(sizeof(DMO_Filter)); if (!This) return NULL;
--- a/loader/drv.c Fri Feb 26 12:49:49 2010 +0000 +++ b/loader/drv.c Fri Feb 26 15:01:37 2010 +0000 @@ -75,7 +75,7 @@ needs_free=0; return; } - def_path = (char*) malloc(strlen(path)+1); + def_path = malloc(strlen(path)+1); strcpy(def_path, path); needs_free=1; } @@ -153,7 +153,7 @@ #endif printf("Loading codec DLL: '%s'\n",filename); - hDriver = (NPDRVR) malloc(sizeof(DRVR)); + hDriver = malloc(sizeof(DRVR)); if (!hDriver) return (HDRVR) 0; memset((void*)hDriver, 0, sizeof(DRVR));
--- a/loader/dshow/allocator.c Fri Feb 26 12:49:49 2010 +0000 +++ b/loader/dshow/allocator.c Fri Feb 26 15:01:37 2010 +0000 @@ -58,7 +58,7 @@ static inline avm_list_t* avm_list_add_head(avm_list_t* head, void* member) { - avm_list_t* n = (avm_list_t*) malloc(sizeof(avm_list_t)); + avm_list_t* n = malloc(sizeof(avm_list_t)); n->member = member; if (!head) @@ -310,7 +310,7 @@ MemAllocator* MemAllocatorCreate() { - MemAllocator* This = (MemAllocator*) malloc(sizeof(MemAllocator)); + MemAllocator* This = malloc(sizeof(MemAllocator)); if (!This) return NULL; @@ -323,7 +323,7 @@ This->props.cbAlign = 1; This->props.cbPrefix = 0; - This->vt = (IMemAllocator_vt*) malloc(sizeof(IMemAllocator_vt)); + This->vt = malloc(sizeof(IMemAllocator_vt)); if (!This->vt) {
--- a/loader/dshow/cmediasample.c Fri Feb 26 12:49:49 2010 +0000 +++ b/loader/dshow/cmediasample.c Fri Feb 26 15:01:37 2010 +0000 @@ -313,7 +313,7 @@ char* c = cms->own_block; Debug printf("CMediaSample - buffer overflow %ld %d %p %p\n", __MIDL_0010, ((CMediaSample*)This)->size, cms->own_block, cms->block); - cms->own_block = (char*) realloc(cms->own_block, (size_t) __MIDL_0010 + SAFETY_ACEL); + cms->own_block = realloc(cms->own_block, (size_t) __MIDL_0010 + SAFETY_ACEL); if (c == cms->block) cms->block = cms->own_block; cms->size = __MIDL_0010; @@ -510,7 +510,7 @@ */ CMediaSample* CMediaSampleCreate(IMemAllocator* allocator, int size) { - CMediaSample* This = (CMediaSample*) malloc(sizeof(CMediaSample)); + CMediaSample* This = malloc(sizeof(CMediaSample)); if (!This) return NULL; @@ -524,8 +524,8 @@ //if (size < 0x1000) // size = (size + 0xfff) & ~0xfff; - This->vt = (IMediaSample_vt*) malloc(sizeof(IMediaSample_vt)); - This->own_block = (char*) malloc((size_t)size + SAFETY_ACEL); + This->vt = malloc(sizeof(IMediaSample_vt)); + This->own_block = malloc((size_t)size + SAFETY_ACEL); This->media_type.pbFormat = 0; This->media_type.pUnk = 0;
--- a/loader/dshow/inputpin.c Fri Feb 26 12:49:49 2010 +0000 +++ b/loader/dshow/inputpin.c Fri Feb 26 15:01:37 2010 +0000 @@ -167,7 +167,7 @@ */ static CEnumPins* CEnumPinsCreate(IPin* p, IPin* pp) { - CEnumPins* This = (CEnumPins*) malloc(sizeof(CEnumPins)); + CEnumPins* This = malloc(sizeof(CEnumPins)); if (!This) return NULL; @@ -177,7 +177,7 @@ This->pin2 = pp; This->counter = 0; - This->vt = (IEnumPins_vt*) malloc(sizeof(IEnumPins_vt)); + This->vt = malloc(sizeof(IEnumPins_vt)); if (!This->vt) { free(This); @@ -539,7 +539,7 @@ */ CInputPin* CInputPinCreate(CBaseFilter* p, const AM_MEDIA_TYPE* amt) { - CInputPin* This = (CInputPin*) malloc(sizeof(CInputPin)); + CInputPin* This = malloc(sizeof(CInputPin)); if (!This) return NULL; @@ -548,7 +548,7 @@ This->parent = p; CopyMediaType(&(This->type),amt); - This->vt= (IPin_vt*) malloc(sizeof(IPin_vt)); + This->vt= malloc(sizeof(IPin_vt)); if (!This->vt) { @@ -879,7 +879,7 @@ */ CBaseFilter* CBaseFilterCreate(const AM_MEDIA_TYPE* type, CBaseFilter2* parent) { - CBaseFilter* This = (CBaseFilter*) malloc(sizeof(CBaseFilter)); + CBaseFilter* This = malloc(sizeof(CBaseFilter)); if (!This) return NULL; @@ -888,7 +888,7 @@ This->pin = (IPin*) CInputPinCreate(This, type); This->unused_pin = (IPin*) CRemotePinCreate(This, parent->GetPin(parent)); - This->vt = (IBaseFilter_vt*) malloc(sizeof(IBaseFilter_vt)); + This->vt = malloc(sizeof(IBaseFilter_vt)); if (!This->vt || !This->pin || !This->unused_pin) { CBaseFilter_Destroy(This); @@ -1214,7 +1214,7 @@ */ CBaseFilter2* CBaseFilter2Create() { - CBaseFilter2* This = (CBaseFilter2*) malloc(sizeof(CBaseFilter2)); + CBaseFilter2* This = malloc(sizeof(CBaseFilter2)); if (!This) return NULL; @@ -1222,7 +1222,7 @@ This->refcount = 1; This->pin = (IPin*) CRemotePin2Create(This); - This->vt = (IBaseFilter_vt*) malloc(sizeof(IBaseFilter_vt)); + This->vt = malloc(sizeof(IBaseFilter_vt)); if (!This->pin || !This->vt) { @@ -1374,7 +1374,7 @@ */ CRemotePin* CRemotePinCreate(CBaseFilter* pt, IPin* rpin) { - CRemotePin* This = (CRemotePin*) malloc(sizeof(CRemotePin)); + CRemotePin* This = malloc(sizeof(CRemotePin)); if (!This) return NULL; @@ -1385,7 +1385,7 @@ This->remote_pin = rpin; This->refcount = 1; - This->vt = (IPin_vt*) malloc(sizeof(IPin_vt)); + This->vt = malloc(sizeof(IPin_vt)); if (!This->vt) { @@ -1464,7 +1464,7 @@ */ CRemotePin2* CRemotePin2Create(CBaseFilter2* p) { - CRemotePin2* This = (CRemotePin2*) malloc(sizeof(CRemotePin2)); + CRemotePin2* This = malloc(sizeof(CRemotePin2)); if (!This) return NULL; @@ -1474,7 +1474,7 @@ This->parent = p; This->refcount = 1; - This->vt = (IPin_vt*) malloc(sizeof(IPin_vt)); + This->vt = malloc(sizeof(IPin_vt)); if (!This->vt) {
--- a/loader/elfdll.c Fri Feb 26 12:49:49 2010 +0000 +++ b/loader/elfdll.c Fri Feb 26 15:01:37 2010 +0000 @@ -197,7 +197,7 @@ // wm->binfmt.pe.pe_resource = (PIMAGE_RESOURCE_DIRECTORY)RVA(hModule, dir->VirtualAddress); - wm->filename = (char*) malloc(strlen(path)+1); + wm->filename = malloc(strlen(path)+1); strcpy(wm->filename, path); wm->modname = strrchr( wm->filename, '\\' ); if (!wm->modname) wm->modname = wm->filename; @@ -216,7 +216,7 @@ if(local_wm) { - local_wm->next = (modref_list*) malloc(sizeof(modref_list)); + local_wm->next = malloc(sizeof(modref_list)); local_wm->next->prev=local_wm; local_wm->next->next=NULL; local_wm->next->wm=wm; @@ -224,7 +224,7 @@ } else { - local_wm = (modref_list*) malloc(sizeof(modref_list)); + local_wm = malloc(sizeof(modref_list)); local_wm->next=local_wm->prev=NULL; local_wm->wm=wm; }
--- a/loader/ext.c Fri Feb 26 12:49:49 2010 +0000 +++ b/loader/ext.c Fri Feb 26 15:01:37 2010 +0000 @@ -197,7 +197,7 @@ LPSTR HEAP_strdupA(HANDLE heap, DWORD flags, LPCSTR string) { // return strdup(string); - char* answ = (char*) malloc(strlen(string) + 1); + char* answ = malloc(strlen(string) + 1); strcpy(answ, string); return answ; } @@ -208,7 +208,7 @@ if(string==0) return 0; size=strlen(string); - answer = (WCHAR*) malloc(sizeof(WCHAR) * (size + 1)); + answer = malloc(sizeof(WCHAR) * (size + 1)); for(i=0; i<=size; i++) answer[i]=(short)string[i]; return answer; @@ -222,7 +222,7 @@ size=0; while(string[size]) size++; - answer = (char*) malloc(size + 2); + answer = malloc(size + 2); for(i=0; i<=size; i++) answer[i]=(char)string[i]; return answer; @@ -372,12 +372,12 @@ { if(fm==0) { - fm = (file_mapping*) malloc(sizeof(file_mapping)); + fm = malloc(sizeof(file_mapping)); fm->prev=NULL; } else { - fm->next = (file_mapping*) malloc(sizeof(file_mapping)); + fm->next = malloc(sizeof(file_mapping)); fm->next->prev=fm; fm=fm->next; } @@ -385,7 +385,7 @@ fm->handle=answer; if(name) { - fm->name = (char*) malloc(strlen(name)+1); + fm->name = malloc(strlen(name)+1); strcpy(fm->name, name); } else @@ -510,7 +510,7 @@ } else { - virt_alloc *new_vm = (virt_alloc*) malloc(sizeof(virt_alloc)); + virt_alloc *new_vm = malloc(sizeof(virt_alloc)); new_vm->mapping_size=size; new_vm->address=(char*)answer; new_vm->prev=vm;
--- a/loader/ldt_keeper.c Fri Feb 26 12:49:49 2010 +0000 +++ b/loader/ldt_keeper.c Fri Feb 26 15:01:37 2010 +0000 @@ -182,7 +182,7 @@ { struct modify_ldt_ldt_s array; int ret; - ldt_fs_t* ldt_fs = (ldt_fs_t*) malloc(sizeof(ldt_fs_t)); + ldt_fs_t* ldt_fs = malloc(sizeof(ldt_fs_t)); if (!ldt_fs) return NULL;
--- a/loader/module.c Fri Feb 26 12:49:49 2010 +0000 +++ b/loader/module.c Fri Feb 26 15:01:37 2010 +0000 @@ -241,7 +241,7 @@ //local_wm=wm; if(local_wm) { - local_wm->next = (modref_list*) malloc(sizeof(modref_list)); + local_wm->next = malloc(sizeof(modref_list)); local_wm->next->prev=local_wm; local_wm->next->next=NULL; local_wm->next->wm=wm; @@ -854,7 +854,7 @@ // memory management: case 0x150011: //NewPtrClear case 0x150012: //NewPtrSysClear - reg->eax=(uint32_t)malloc(((uint32_t *)stack_base)[1]); + reg->eax = malloc(((uint32_t *)stack_base)[1]); memset((void *)reg->eax,0,((uint32_t *)stack_base)[1]); #ifdef DEBUG_QTX_API printf("%*sLEAVE(%d): EMULATED! 0x%X\n",ret_i*2,"",ret_i, reg->eax); @@ -862,7 +862,7 @@ return 1; case 0x15000F: //NewPtr case 0x150010: //NewPtrSys - reg->eax=(uint32_t)malloc(((uint32_t *)stack_base)[1]); + reg->eax = malloc(((uint32_t *)stack_base)[1]); #ifdef DEBUG_QTX_API printf("%*sLEAVE(%d): EMULATED! 0x%X\n",ret_i*2,"",ret_i, reg->eax); #endif
--- a/loader/registry.c Fri Feb 26 12:49:49 2010 +0000 +++ b/loader/registry.c Fri Feb 26 15:01:37 2010 +0000 @@ -277,7 +277,7 @@ { if(regs==0) create_registry(); - regs=(struct reg_value*)realloc(regs, sizeof(struct reg_value)*(reg_size+1)); + regs = realloc(regs, sizeof(struct reg_value) * (reg_size +1 )); //regs=(struct reg_value*)my_realloc(regs, sizeof(struct reg_value)*(reg_size+1)); v=regs+reg_size; reg_size++;
--- a/loader/win32.c Fri Feb 26 12:49:49 2010 +0000 +++ b/loader/win32.c Fri Feb 26 15:01:37 2010 +0000 @@ -358,7 +358,7 @@ void* mreq_private(int size, int to_zero, int type) { int nsize = size + sizeof(alloc_header); - alloc_header* header = (alloc_header* ) malloc(nsize); + alloc_header* header = malloc(nsize); if (!header) return 0; if (to_zero) @@ -4716,7 +4716,7 @@ dbgprintf("CreatePalette(%x) => NULL\n", lpgpl); i = sizeof(LOGPALETTE)+((lpgpl->palNumEntries-1)*sizeof(PALETTEENTRY)); - test = (HPALETTE)malloc(i); + test = malloc(i); memcpy((void *)test, lpgpl, i); return test;
--- a/m_option.c Fri Feb 26 12:49:49 2010 +0000 +++ b/m_option.c Fri Feb 26 15:01:37 2010 +0000 @@ -1011,7 +1011,7 @@ subparam[0] == 0 ? NULL : subparam,NULL,src); if(r < 0) return r; if(dst) { - lst = (char**)realloc(lst,2 * (nr+2) * sizeof(char*)); + lst = realloc(lst,2 * (nr+2) * sizeof(char*)); lst[2*nr] = strdup(subopt); lst[2*nr+1] = subparam[0] == 0 ? NULL : strdup(subparam); memset(&lst[2*(nr+1)],0,2*sizeof(char*));
--- a/mp3lib/equalizer.c Fri Feb 26 12:49:49 2010 +0000 +++ b/mp3lib/equalizer.c Fri Feb 26 15:01:37 2010 +0000 @@ -5,7 +5,7 @@ int i, k; float p, qn, sig, un, *u; - u = (float *) malloc(n * sizeof (float)); + u = malloc(n * sizeof (float)); y2[0] = u[0] = 0.0;
--- a/osdep/mmap-os2.c Fri Feb 26 12:49:49 2010 +0000 +++ b/osdep/mmap-os2.c Fri Feb 26 15:01:37 2010 +0000 @@ -84,7 +84,7 @@ return MAP_FAILED; } - new_mmap = ( os2_mmap * )malloc( sizeof( os2_mmap )); + new_mmap = malloc( sizeof( os2_mmap )); new_mmap->addr = ret; new_mmap->len = len; new_mmap->flags = flags;
--- a/playtree.c Fri Feb 26 12:49:49 2010 +0000 +++ b/playtree.c Fri Feb 26 15:01:37 2010 +0000 @@ -283,7 +283,7 @@ for(n = 0 ; pt->files[n] != NULL ; n++) /* NOTHING */; } - pt->files = (char**)realloc(pt->files,(n+2)*sizeof(char*)); + pt->files = realloc(pt->files, (n + 2) * sizeof(char*)); if(pt->files ==NULL) { mp_msg(MSGT_PLAYTREE,MSGL_ERR,"Can't allocate %d bytes of memory\n",(n+2)*(int)sizeof(char*)); return; @@ -322,7 +322,7 @@ if(n > 1) { memmove(&pt->files[f],&pt->files[f+1],(n-f)*sizeof(char*)); - pt->files = (char**)realloc(pt->files,n*sizeof(char*)); + pt->files = realloc(pt->files, n * sizeof(char*)); if(pt->files == NULL) { mp_msg(MSGT_PLAYTREE,MSGL_ERR,"Can't allocate %d bytes of memory\n",(n+2)*(int)sizeof(char*)); return -1; @@ -347,7 +347,7 @@ if(pt->params) for ( ; pt->params[n].name != NULL ; n++ ) { } - pt->params = (play_tree_param_t*)realloc(pt->params,(n+2)*sizeof(play_tree_param_t)); + pt->params = realloc(pt->params, (n + 2) * sizeof(play_tree_param_t)); if(pt->params == NULL) { mp_msg(MSGT_PLAYTREE,MSGL_ERR,"Can't realloc params (%d bytes of memory)\n",(n+2)*(int)sizeof(play_tree_param_t)); return; @@ -382,7 +382,7 @@ if(n > 1) { memmove(&pt->params[ni],&pt->params[ni+1],(n-ni)*sizeof(play_tree_param_t)); - pt->params = (play_tree_param_t*)realloc(pt->params,n*sizeof(play_tree_param_t)); + pt->params = realloc(pt->params, n * sizeof(play_tree_param_t)); if(pt->params == NULL) { mp_msg(MSGT_PLAYTREE,MSGL_ERR,"Can't allocate %d bytes of memory\n",n*(int)sizeof(play_tree_param_t)); return -1; @@ -707,7 +707,7 @@ iter->stack_size--; iter->loop = iter->status_stack[iter->stack_size]; if(iter->stack_size > 0) - iter->status_stack = (int*)realloc(iter->status_stack,iter->stack_size*sizeof(int)); + iter->status_stack = realloc(iter->status_stack, iter->stack_size * sizeof(int)); else { free(iter->status_stack); iter->status_stack = NULL; @@ -745,7 +745,7 @@ play_tree_iter_push_params(iter); iter->stack_size++; - iter->status_stack = (int*)realloc(iter->status_stack,iter->stack_size*sizeof(int)); + iter->status_stack = realloc(iter->status_stack, iter->stack_size * sizeof(int)); if(iter->status_stack == NULL) { mp_msg(MSGT_PLAYTREE,MSGL_ERR,"Can't allocate %d bytes of memory\n",iter->stack_size*(int)sizeof(int)); return PLAY_TREE_ITER_ERROR;
--- a/playtreeparser.c Fri Feb 26 12:49:49 2010 +0000 +++ b/playtreeparser.c Fri Feb 26 15:01:37 2010 +0000 @@ -81,7 +81,7 @@ if(resize) { r = p->iter - p->buffer; - p->buffer = (char*)realloc(p->buffer,p->buffer_size+BUF_STEP); + p->buffer = realloc(p->buffer, p->buffer_size + BUF_STEP); p->iter = p->buffer + r; p->buffer_size += BUF_STEP; resize = 0; @@ -113,7 +113,7 @@ line_end = (end > p->iter && *(end-1) == '\r') ? end-1 : end; if(line_end - p->iter >= 0) - p->line = (char*)realloc(p->line,line_end - p->iter+1); + p->line = realloc(p->line, line_end - p->iter + 1); else return NULL; if(line_end - p->iter > 0) @@ -252,7 +252,7 @@ mp_msg(MSGT_PLAYTREE,MSGL_WARN,"No entry index in entry %s\nAssuming %d\n",line,num); } if(num > max_entry) { - e = (pls_entry_t*)realloc(e,num*sizeof(pls_entry_t)); + e = realloc(e, num * sizeof(pls_entry_t)); memset(&e[max_entry],0,(num-max_entry)*sizeof(pls_entry_t)); max_entry = num; } @@ -713,12 +713,12 @@ if (pt->files[i][0] == '\\') { if (pt->files[i][1] == '\\') continue; - pt->files[i] = (char*)realloc(pt->files[i],2+fl+1); + pt->files[i] = realloc(pt->files[i], 2 + fl + 1); memmove(pt->files[i] + 2,pt->files[i],fl+1); memcpy(pt->files[i],bp,2); continue; } - pt->files[i] = (char*)realloc(pt->files[i],bl+fl+1); + pt->files[i] = realloc(pt->files[i], bl + fl + 1); memmove(pt->files[i] + bl,pt->files[i],fl+1); memcpy(pt->files[i],bp,bl); }
--- a/stream/http.c Fri Feb 26 12:49:49 2010 +0000 +++ b/stream/http.c Fri Feb 26 15:01:37 2010 +0000 @@ -332,7 +332,7 @@ mp_msg(MSGT_NETWORK,MSGL_FATAL,"Bad size in memory (re)allocation\n"); return -1; } - http_hdr->buffer = (char*)realloc( http_hdr->buffer, http_hdr->buffer_size+length+1 ); + http_hdr->buffer = realloc( http_hdr->buffer, http_hdr->buffer_size+length+1 ); if( http_hdr->buffer==NULL ) { mp_msg(MSGT_NETWORK,MSGL_FATAL,"Memory (re)allocation failed\n"); return -1; @@ -428,7 +428,7 @@ while( *ptr!='\r' && *ptr!='\n' ) ptr++; len = ptr-hdr_ptr; if( len==0 ) break; - field = (char*)realloc(field, len+1); + field = realloc(field, len+1); if( field==NULL ) { mp_msg(MSGT_NETWORK,MSGL_ERR,"Memory allocation failed\n"); return -1; @@ -520,7 +520,7 @@ http_get_field( HTTP_header_t *http_hdr, const char *field_name ) { if( http_hdr==NULL || field_name==NULL ) return NULL; http_hdr->field_search_pos = http_hdr->first_field; - http_hdr->field_search = (char*)realloc( http_hdr->field_search, strlen(field_name)+1 ); + http_hdr->field_search = realloc( http_hdr->field_search, strlen(field_name)+1 ); if( http_hdr->field_search==NULL ) { mp_msg(MSGT_NETWORK,MSGL_FATAL,"Memory allocation failed\n"); return NULL;
--- a/stream/stream_netstream.h Fri Feb 26 12:49:49 2010 +0000 +++ b/stream/stream_netstream.h Fri Feb 26 15:01:37 2010 +0000 @@ -89,8 +89,7 @@ static mp_net_stream_packet_t* read_packet(int fd) { uint16_t len; - mp_net_stream_packet_t* pack = - (mp_net_stream_packet_t*)malloc(sizeof(mp_net_stream_packet_t)); + mp_net_stream_packet_t* pack = malloc(sizeof(mp_net_stream_packet_t)); if(!net_read(fd,(char*)pack,sizeof(mp_net_stream_packet_t))) { free(pack);
--- a/stream/tvi_def.h Fri Feb 26 12:49:49 2010 +0000 +++ b/stream/tvi_def.h Fri Feb 26 15:01:37 2010 +0000 @@ -47,11 +47,11 @@ static tvi_handle_t *new_handle(void) { - tvi_handle_t *h = (tvi_handle_t *)malloc(sizeof(tvi_handle_t)); + tvi_handle_t *h = malloc(sizeof(tvi_handle_t)); if (!h) return NULL; - h->priv = (priv_t *)malloc(sizeof(priv_t)); + h->priv = malloc(sizeof(priv_t)); if (!h->priv) { free(h);
--- a/stream/tvi_dshow.c Fri Feb 26 12:49:49 2010 +0000 +++ b/stream/tvi_dshow.c Fri Feb 26 15:01:37 2010 +0000 @@ -796,19 +796,19 @@ mp_msg(MSGT_TV, MSGL_DBG2, "tvi_dshow: Capture buffer: %d blocks of %d bytes.\n", rb->buffersize, rb->blocksize); - rb->ringbuffer = (char **) malloc(rb->buffersize * sizeof(char *)); + rb->ringbuffer = malloc(rb->buffersize * sizeof(char *)); if (!rb) return E_POINTER; memset(rb->ringbuffer, 0, rb->buffersize * sizeof(char *)); for (i = 0; i < rb->buffersize; i++) { - rb->ringbuffer[i] = (char *) malloc(rb->blocksize * sizeof(char)); + rb->ringbuffer[i] = malloc(rb->blocksize * sizeof(char)); if (!rb->ringbuffer[i]) { destroy_ringbuffer(rb); return E_OUTOFMEMORY; } } - rb->dpts = (double*) malloc(rb->buffersize * sizeof(double)); + rb->dpts = malloc(rb->buffersize * sizeof(double)); if (!rb->dpts) { destroy_ringbuffer(rb); return E_OUTOFMEMORY; @@ -817,7 +817,7 @@ rb->tail = 0; rb->count = 0; rb->tStart = -1; - rb->pMutex = (CRITICAL_SECTION *) malloc(sizeof(CRITICAL_SECTION)); + rb->pMutex = malloc(sizeof(CRITICAL_SECTION)); if (!rb->pMutex) { destroy_ringbuffer(rb); return E_OUTOFMEMORY; @@ -966,7 +966,7 @@ } *pnFirst = plFreqTable[0]; *pnLen = (int) (plFreqTable[1] - plFreqTable[0] + 1); - *pplFreqTable = (long *) malloc((*pnLen) * sizeof(long)); + *pplFreqTable = malloc((*pnLen) * sizeof(long)); if (!*pplFreqTable) { FreeLibrary(hDLL); return E_FAIL; @@ -1273,7 +1273,7 @@ OLE_CALL_ARGS(priv->pCrossbar, get_PinCounts, &lOutputPins, &lInputPins); - tv_available_inputs = (long *) malloc(sizeof(long) * lInputPins); + tv_available_inputs = malloc(sizeof(long) * lInputPins); tv_available_inputs_count = 0; mp_msg(MSGT_TV, MSGL_V, MSGTR_TVI_DS_AvailableVideoInputs); @@ -2063,11 +2063,11 @@ } done = 0; - arpmt = (AM_MEDIA_TYPE **) malloc((count + 1) * sizeof(AM_MEDIA_TYPE *)); + arpmt = malloc((count + 1) * sizeof(AM_MEDIA_TYPE *)); if (arpmt) { memset(arpmt, 0, (count + 1) * sizeof(AM_MEDIA_TYPE *)); - pBuf = (void **) malloc((count + 1) * sizeof(void *)); + pBuf = malloc((count + 1) * sizeof(void *)); if (pBuf) { memset(pBuf, 0, (count + 1) * sizeof(void *)); @@ -2170,8 +2170,7 @@ OLE_CALL(pEnum,Reset); count = i; - arpmt = - (AM_MEDIA_TYPE **) malloc((count + 1) * sizeof(AM_MEDIA_TYPE *)); + arpmt = malloc((count + 1) * sizeof(AM_MEDIA_TYPE *)); if (!arpmt) return E_OUTOFMEMORY; memset(arpmt, 0, (count + 1) * sizeof(AM_MEDIA_TYPE *)); @@ -2184,7 +2183,7 @@ OLE_RELEASE_SAFE(pEnum); - pBuf = (void **) malloc((count + 1) * sizeof(void *)); + pBuf = malloc((count + 1) * sizeof(void *)); if (!pBuf) { for (i = 0; i < count; i++) if (arpmt[i])
--- a/subreader.c Fri Feb 26 12:49:49 2010 +0000 +++ b/subreader.c Fri Feb 26 15:01:37 2010 +0000 @@ -1655,7 +1655,7 @@ if (higher_line >= SUB_MAX_TEXT) { // the 'block' has too much lines, so we don't overlap the // subtitles - second = (subtitle *) realloc(second, (sub_num + sub_to_add + 1) * sizeof(subtitle)); + second = realloc(second, (sub_num + sub_to_add + 1) * sizeof(subtitle)); for (j = 0; j <= sub_to_add; ++j) { int ls; memset(&second[sub_num + j], '\0', sizeof(subtitle)); @@ -1675,7 +1675,7 @@ // we read the placeholder structure and create the new // subs. - second = (subtitle *) realloc(second, (sub_num + 1) * sizeof(subtitle)); + second = realloc(second, (sub_num + 1) * sizeof(subtitle)); memset(&second[sub_num], '\0', sizeof(subtitle)); second[sub_num].start = local_start; second[sub_num].end = local_end;