From b63759b175cf9ddd9735ca0d2f803fe62f69c3c3 Mon Sep 17 00:00:00 2001 From: diego Date: Fri, 26 Feb 2010 15:01:37 +0000 Subject: Do not cast the results of malloc/calloc/realloc. These functions return void*, which is compatible with any pointer, so there is no need for casts. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30744 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpcodecs/ad_libmad.c | 2 +- libmpcodecs/ae.c | 2 +- libmpcodecs/ae_toolame.c | 2 +- libmpcodecs/mp_image.h | 2 +- libmpcodecs/vd_mpng.c | 2 +- libmpcodecs/vd_mtga.c | 2 +- libmpcodecs/vd_sgi.c | 2 +- libmpcodecs/ve_vfw.c | 2 +- libmpcodecs/vf_eq2.c | 6 +++--- 9 files changed, 11 insertions(+), 11 deletions(-) (limited to 'libmpcodecs') 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++) { -- cgit v1.2.3