aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--TOOLS/bmovl-test.c2
-rw-r--r--TOOLS/vfw2menc.c4
-rw-r--r--asxparser.c10
-rw-r--r--gui/win32/dialogs.c2
-rw-r--r--gui/win32/widgetrender.c2
-rw-r--r--libao2/ao_coreaudio.c10
-rw-r--r--libmenu/menu_filesel.c14
-rw-r--r--libmpcodecs/ad_libmad.c2
-rw-r--r--libmpcodecs/ae.c2
-rw-r--r--libmpcodecs/ae_toolame.c2
-rw-r--r--libmpcodecs/mp_image.h2
-rw-r--r--libmpcodecs/vd_mpng.c2
-rw-r--r--libmpcodecs/vd_mtga.c2
-rw-r--r--libmpcodecs/vd_sgi.c2
-rw-r--r--libmpcodecs/ve_vfw.c2
-rw-r--r--libmpcodecs/vf_eq2.c6
-rw-r--r--libmpdemux/demux_aac.c2
-rw-r--r--libmpdemux/demux_roq.c4
-rw-r--r--libmpdemux/demux_ts.c10
-rw-r--r--libmpdemux/demuxer.c3
-rw-r--r--libmpdemux/demuxer.h8
-rw-r--r--libmpdemux/ebml.c2
-rw-r--r--libmpdemux/muxer_lavf.c2
-rw-r--r--libmpdemux/muxer_mpeg.c18
-rw-r--r--libmpdemux/video.c2
-rw-r--r--libvo/sub.c12
-rw-r--r--libvo/video_out.c2
-rw-r--r--libvo/vo_fbdev2.c2
-rw-r--r--loader/dmo/buffer.c4
-rw-r--r--loader/dmo/dmo.c2
-rw-r--r--loader/drv.c4
-rw-r--r--loader/dshow/allocator.c6
-rw-r--r--loader/dshow/cmediasample.c8
-rw-r--r--loader/dshow/inputpin.c24
-rw-r--r--loader/elfdll.c6
-rw-r--r--loader/ext.c14
-rw-r--r--loader/ldt_keeper.c2
-rw-r--r--loader/module.c6
-rw-r--r--loader/registry.c2
-rw-r--r--loader/win32.c4
-rw-r--r--m_option.c2
-rw-r--r--mp3lib/equalizer.c2
-rw-r--r--osdep/mmap-os2.c2
-rw-r--r--playtree.c12
-rw-r--r--playtreeparser.c10
-rw-r--r--stream/http.c6
-rw-r--r--stream/stream_netstream.h3
-rw-r--r--stream/tvi_def.h4
-rw-r--r--stream/tvi_dshow.c21
-rw-r--r--subreader.c4
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].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 @@ static int add_frame(muxer_headers_t *spriv, uint64_t idur, uint8_t *ptr, int le
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 @@ static int add_frame(muxer_headers_t *spriv, uint64_t idur, uint8_t *ptr, int le
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 @@ static void generate_flags(uint8_t *bff_mask, int source, int target)
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 @@ int muxer_init_muxer_mpeg(muxer_t *muxer)
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);
diff --git a/libmpdemux/video.c b/libmpdemux/video.c
index fc79da6c6e..a7b1ca1232 100644
--- a/libmpdemux/video.c
+++ b/libmpdemux/video.c
@@ -382,7 +382,7 @@ mpeg_header_parser:
}
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;
diff --git a/libvo/sub.c b/libvo/sub.c
index 79780ce974..b7e9ccdd6b 100644
--- a/libvo/sub.c
+++ b/libvo/sub.c
@@ -726,7 +726,7 @@ inline static void vo_update_text_sub(mp_osd_obj_t* obj,int dxs,int dys){
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 @@ inline static void vo_update_text_sub(mp_osd_obj_t* obj,int dxs,int dys){
}
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 @@ inline static void vo_update_text_sub(mp_osd_obj_t* obj,int dxs,int dys){
// 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 @@ inline static void vo_update_text_sub(mp_osd_obj_t* obj,int dxs,int dys){
}
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 @@ inline static void vo_update_text_sub(mp_osd_obj_t* obj,int dxs,int dys){
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 @@ inline static void vo_update_text_sub(mp_osd_obj_t* obj,int dxs,int dys){
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;
diff --git a/libvo/video_out.c b/libvo/video_out.c
index b285458c87..d721e0a526 100644
--- a/libvo/video_out.c
+++ b/libvo/video_out.c
@@ -482,7 +482,7 @@ range_t *str2range(char *s)
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;
}
diff --git a/libvo/vo_fbdev2.c b/libvo/vo_fbdev2.c
index 55527a660c..0e8f3743cd 100644
--- a/libvo/vo_fbdev2.c
+++ b/libvo/vo_fbdev2.c
@@ -300,7 +300,7 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width,
( (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;
}
diff --git a/loader/dmo/buffer.c b/loader/dmo/buffer.c
index 70883b9abe..78428e249f 100644
--- a/loader/dmo/buffer.c
+++ b/loader/dmo/buffer.c
@@ -69,12 +69,12 @@ IMPLEMENT_IUNKNOWN(CMediaBuffer)
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);
diff --git a/loader/dmo/dmo.c b/loader/dmo/dmo.c
index f8898efcb5..0ca7cf3206 100644
--- a/loader/dmo/dmo.c
+++ b/loader/dmo/dmo.c
@@ -36,7 +36,7 @@ DMO_Filter* DMO_FilterCreate(const char* dllname, const GUID* id,
{
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;
diff --git a/loader/drv.c b/loader/drv.c
index 43d9485646..9479e6944d 100644
--- a/loader/drv.c
+++ b/loader/drv.c
@@ -75,7 +75,7 @@ void SetCodecPath(const char* path)
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 @@ HDRVR DrvOpen(LPARAM lParam2)
#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));
diff --git a/loader/dshow/allocator.c b/loader/dshow/allocator.c
index 8ead279a37..b75f1bebfb 100644
--- a/loader/dshow/allocator.c
+++ b/loader/dshow/allocator.c
@@ -58,7 +58,7 @@ static inline int avm_list_print(avm_list_t* head)
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 @@ IMPLEMENT_IUNKNOWN(MemAllocator)
MemAllocator* MemAllocatorCreate()
{
- MemAllocator* This = (MemAllocator*) malloc(sizeof(MemAllocator));
+ MemAllocator* This = malloc(sizeof(MemAllocator));
if (!This)
return NULL;
@@ -323,7 +323,7 @@ MemAllocator* MemAllocatorCreate()
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)
{
diff --git a/loader/dshow/cmediasample.c b/loader/dshow/cmediasample.c
index c594bae787..efa3ef89cd 100644
--- a/loader/dshow/cmediasample.c
+++ b/loader/dshow/cmediasample.c
@@ -313,7 +313,7 @@ static HRESULT STDCALL CMediaSample_SetActualDataLength(IMediaSample* This,
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 @@ static void CMediaSample_ResetPointer(CMediaSample* This)
*/
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 @@ CMediaSample* CMediaSampleCreate(IMemAllocator* allocator, int size)
//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;
diff --git a/loader/dshow/inputpin.c b/loader/dshow/inputpin.c
index 5c9b832f7a..3227339bee 100644
--- a/loader/dshow/inputpin.c
+++ b/loader/dshow/inputpin.c
@@ -167,7 +167,7 @@ IMPLEMENT_IUNKNOWN(CEnumPins)
*/
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 @@ static CEnumPins* CEnumPinsCreate(IPin* p, IPin* pp)
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 @@ IMPLEMENT_IUNKNOWN(CInputPin)
*/
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 @@ CInputPin* CInputPinCreate(CBaseFilter* p, const AM_MEDIA_TYPE* amt)
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 @@ IMPLEMENT_IUNKNOWN(CBaseFilter)
*/
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 @@ CBaseFilter* CBaseFilterCreate(const AM_MEDIA_TYPE* type, CBaseFilter2* parent)
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 @@ static GUID CBaseFilter2_interf3 =
*/
CBaseFilter2* CBaseFilter2Create()
{
- CBaseFilter2* This = (CBaseFilter2*) malloc(sizeof(CBaseFilter2));
+ CBaseFilter2* This = malloc(sizeof(CBaseFilter2));
if (!This)
return NULL;
@@ -1222,7 +1222,7 @@ CBaseFilter2* CBaseFilter2Create()
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 @@ IMPLEMENT_IUNKNOWN(CRemotePin)
*/
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 @@ CRemotePin* CRemotePinCreate(CBaseFilter* pt, IPin* rpin)
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 @@ IMPLEMENT_IUNKNOWN(CRemotePin2)
*/
CRemotePin2* CRemotePin2Create(CBaseFilter2* p)
{
- CRemotePin2* This = (CRemotePin2*) malloc(sizeof(CRemotePin2));
+ CRemotePin2* This = malloc(sizeof(CRemotePin2));
if (!This)
return NULL;
@@ -1474,7 +1474,7 @@ CRemotePin2* CRemotePin2Create(CBaseFilter2* p)
This->parent = p;
This->refcount = 1;
- This->vt = (IPin_vt*) malloc(sizeof(IPin_vt));
+ This->vt = malloc(sizeof(IPin_vt));
if (!This->vt)
{
diff --git a/loader/elfdll.c b/loader/elfdll.c
index 1927640505..e4a0190f89 100644
--- a/loader/elfdll.c
+++ b/loader/elfdll.c
@@ -197,7 +197,7 @@ static WINE_MODREF *ELFDLL_CreateModref(HMODULE hModule, LPCSTR path)
// 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 @@ static WINE_MODREF *ELFDLL_CreateModref(HMODULE hModule, LPCSTR path)
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 @@ static WINE_MODREF *ELFDLL_CreateModref(HMODULE hModule, LPCSTR path)
}
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;
}
diff --git a/loader/ext.c b/loader/ext.c
index 23c0292c6c..9c00d1988b 100644
--- a/loader/ext.c
+++ b/loader/ext.c
@@ -197,7 +197,7 @@ WIN_BOOL WINAPI IsBadReadPtr(LPCVOID data, UINT size)
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 @@ LPWSTR HEAP_strdupAtoW(HANDLE heap, DWORD flags, LPCSTR string)
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 @@ LPSTR HEAP_strdupWtoA(HANDLE heap, DWORD flags, LPCWSTR string)
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 @@ HANDLE WINAPI CreateFileMappingA(HANDLE handle, LPSECURITY_ATTRIBUTES lpAttr,
{
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 @@ HANDLE WINAPI CreateFileMappingA(HANDLE handle, LPSECURITY_ATTRIBUTES lpAttr,
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 @@ LPVOID WINAPI VirtualAlloc(LPVOID address, DWORD size, DWORD type, DWORD protec
}
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;
diff --git a/loader/ldt_keeper.c b/loader/ldt_keeper.c
index 0fcc98d53c..92a7df88a5 100644
--- a/loader/ldt_keeper.c
+++ b/loader/ldt_keeper.c
@@ -182,7 +182,7 @@ ldt_fs_t* Setup_LDT_Keeper(void)
{
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;
diff --git a/loader/module.c b/loader/module.c
index 3eb024460a..79c01270d3 100644
--- a/loader/module.c
+++ b/loader/module.c
@@ -241,7 +241,7 @@ static WIN_BOOL MODULE_DllProcessAttach( WINE_MODREF *wm, LPVOID lpReserved )
//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 @@ static int report_func(void *stack_base, int stack_size, reg386_t *reg, uint32_t
// 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 @@ static int report_func(void *stack_base, int stack_size, reg386_t *reg, uint32_t
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
diff --git a/loader/registry.c b/loader/registry.c
index 37a262270e..9964eeb9ff 100644
--- a/loader/registry.c
+++ b/loader/registry.c
@@ -277,7 +277,7 @@ static struct reg_value* insert_reg_value(int handle, const char* name, int type
{
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++;
diff --git a/loader/win32.c b/loader/win32.c
index fbd4d5a4e5..f560ffdfb4 100644
--- a/loader/win32.c
+++ b/loader/win32.c
@@ -358,7 +358,7 @@ void* mreq_private(int size, int to_zero, int type);
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 @@ static HPALETTE WINAPI expCreatePalette(CONST LOGPALETTE *lpgpl)
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;
diff --git a/m_option.c b/m_option.c
index 6a5565eca0..8224ba7f35 100644
--- a/m_option.c
+++ b/m_option.c
@@ -1011,7 +1011,7 @@ static int parse_subconf(const m_option_t* opt,const char *name, const char *par
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*));
diff --git a/mp3lib/equalizer.c b/mp3lib/equalizer.c
index acb5bc18e0..78db17ef67 100644
--- a/mp3lib/equalizer.c
+++ b/mp3lib/equalizer.c
@@ -5,7 +5,7 @@ void init_spline(float *x, float *y, int n, float *y2)
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;
diff --git a/osdep/mmap-os2.c b/osdep/mmap-os2.c
index 7646296cd9..a1e0c29e3f 100644
--- a/osdep/mmap-os2.c
+++ b/osdep/mmap-os2.c
@@ -84,7 +84,7 @@ void *mmap( void *addr, size_t len, int prot, int flags, int fildes, off_t off )
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;
diff --git a/playtree.c b/playtree.c
index f6f068ec33..4ff88f241e 100644
--- a/playtree.c
+++ b/playtree.c
@@ -283,7 +283,7 @@ play_tree_add_file(play_tree_t* pt,char* file) {
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 @@ play_tree_remove_file(play_tree_t* pt,char* file) {
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 @@ play_tree_set_param(play_tree_t* pt, char* name, char* val) {
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 @@ play_tree_unset_param(play_tree_t* pt, char* name) {
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 @@ play_tree_iter_up_step(play_tree_iter_t* iter, int d,int with_nodes) {
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_down_step(play_tree_iter_t* iter, int d,int with_nodes) {
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;
diff --git a/playtreeparser.c b/playtreeparser.c
index 33a23e6353..c9a6695b86 100644
--- a/playtreeparser.c
+++ b/playtreeparser.c
@@ -81,7 +81,7 @@ play_tree_parser_get_line(play_tree_parser_t* p) {
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 @@ play_tree_parser_get_line(play_tree_parser_t* p) {
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 @@ pls_read_entry(char* line,pls_entry_t** _e,int* _max_entry,char** val) {
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 @@ play_tree_add_basepath(play_tree_t* pt, char* bp) {
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);
}
diff --git a/stream/http.c b/stream/http.c
index bda6c060c7..d79f7632ca 100644
--- a/stream/http.c
+++ b/stream/http.c
@@ -332,7 +332,7 @@ http_response_append( HTTP_header_t *http_hdr, char *response, int length ) {
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 @@ http_response_parse( HTTP_header_t *http_hdr ) {
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 @@ char *
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;
diff --git a/stream/stream_netstream.h b/stream/stream_netstream.h
index a81bc37c83..4d3e30e849 100644
--- a/stream/stream_netstream.h
+++ b/stream/stream_netstream.h
@@ -89,8 +89,7 @@ static int net_read(int fd, char* buf, int len) {
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);
diff --git a/stream/tvi_def.h b/stream/tvi_def.h
index 261a8ee4cd..43de8c6423 100644
--- a/stream/tvi_def.h
+++ b/stream/tvi_def.h
@@ -47,11 +47,11 @@ static const tvi_functions_t functions =
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);
diff --git a/stream/tvi_dshow.c b/stream/tvi_dshow.c
index 9aec47ed54..354c0f541b 100644
--- a/stream/tvi_dshow.c
+++ b/stream/tvi_dshow.c
@@ -796,19 +796,19 @@ static HRESULT init_ringbuffer(grabber_ringbuffer_t * rb, int buffersize,
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 @@ static HRESULT init_ringbuffer(grabber_ringbuffer_t * rb, int buffersize,
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 @@ static HRESULT load_freq_table(int nCountry, int nInputType,
}
*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 @@ static void get_capabilities(priv_t * priv)
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 @@ static HRESULT get_available_formats_stream(chain_t *chain)
}
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 @@ static HRESULT get_available_formats_pin(ICaptureGraphBuilder2 * pBuilder,
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 @@ static HRESULT get_available_formats_pin(ICaptureGraphBuilder2 * pBuilder,
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])
diff --git a/subreader.c b/subreader.c
index ddbd2839df..bbabda8511 100644
--- a/subreader.c
+++ b/subreader.c
@@ -1655,7 +1655,7 @@ if ((suboverlap_enabled == 2) ||
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 @@ if ((suboverlap_enabled == 2) ||
// 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;