From 3322d07eac628cb542287b73b47d045bcb28c8d8 Mon Sep 17 00:00:00 2001 From: Mathis Rosenhauer Date: Mon, 26 Nov 2012 17:34:15 +0100 Subject: [PATCH] remove casts from malloc --- src/decode.c | 10 +++++----- src/encode.c | 16 ++++++++-------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/decode.c b/src/decode.c index 061da95..2b871d2 100644 --- a/src/decode.c +++ b/src/decode.c @@ -69,7 +69,7 @@ static void flush_##KIND(struct aec_stream *strm) \ { \ int i; \ - int64_t x, d, th, D, lower, m, sample; \ + int64_t x, d, th, D, lower, m; \ int64_t data; \ struct internal_state *state = strm->state; \ \ @@ -605,11 +605,11 @@ int aec_decode_init(struct aec_stream *strm) if (strm->bits_per_sample > 32 || strm->bits_per_sample == 0) return AEC_CONF_ERROR; - state = (struct internal_state *) malloc(sizeof(struct internal_state)); + state = malloc(sizeof(struct internal_state)); if (state == NULL) return AEC_MEM_ERROR; - state->se_table = (int *) malloc(182 * sizeof(int)); + state->se_table = malloc(182 * sizeof(int)); if (state->se_table == NULL) return AEC_MEM_ERROR; @@ -674,12 +674,12 @@ int aec_decode_init(struct aec_stream *strm) } state->id_table[modi - 1] = m_uncomp; - state->block = (int64_t *)malloc(strm->block_size * sizeof(int64_t)); + state->block = malloc(strm->block_size * sizeof(int64_t)); if (state->block == NULL) return AEC_MEM_ERROR; state->buf_size = strm->rsi * strm->block_size; - state->buf = (uint32_t *)malloc(state->buf_size * sizeof(uint32_t)); + state->buf = malloc(state->buf_size * sizeof(uint32_t)); if (state->buf == NULL) return AEC_MEM_ERROR; diff --git a/src/encode.c b/src/encode.c index 73d065e..cc5eef4 100644 --- a/src/encode.c +++ b/src/encode.c @@ -744,7 +744,7 @@ int aec_encode_init(struct aec_stream *strm) if (strm->rsi > 4096) return AEC_CONF_ERROR; - state = (struct internal_state *)malloc(sizeof(struct internal_state)); + state = malloc(sizeof(struct internal_state)); if (state == NULL) return AEC_MEM_ERROR; @@ -809,16 +809,16 @@ int aec_encode_init(struct aec_stream *strm) state->kmax = (1U << state->id_len) - 3; - state->data_pp = (uint32_t *)malloc(strm->rsi - * strm->block_size - * sizeof(uint32_t)); + state->data_pp = malloc(strm->rsi + * strm->block_size + * sizeof(uint32_t)); if (state->data_pp == NULL) return AEC_MEM_ERROR; if (strm->flags & AEC_DATA_PREPROCESS) { - state->data_raw = (uint32_t *)malloc(strm->rsi - * strm->block_size - * sizeof(uint32_t)); + state->data_raw = malloc(strm->rsi + * strm->block_size + * sizeof(uint32_t)); if (state->data_raw == NULL) return AEC_MEM_ERROR; } else { @@ -829,7 +829,7 @@ int aec_encode_init(struct aec_stream *strm) /* Largest possible CDS according to specs */ state->cds_len = (5 + 64 * 32) / 8 + 3; - state->cds_buf = (uint8_t *)malloc(state->cds_len); + state->cds_buf = malloc(state->cds_len); if (state->cds_buf == NULL) return AEC_MEM_ERROR; -- 2.7.4