diff options
author | Justin Ruggles <justin.ruggles@gmail.com> | 2011-10-26 20:42:02 -0400 |
---|---|---|
committer | Justin Ruggles <justin.ruggles@gmail.com> | 2011-10-29 13:43:28 -0400 |
commit | e694831f9d0cb75225b8ce300db4f20da85b7438 (patch) | |
tree | eca9e03ba5eefb6a13d3c323ad87ff6a55bbf385 /libavcodec/cook.c | |
parent | 776e9815a523eb817b47dd34ac56e4cbdabff17e (diff) | |
download | ffmpeg-e694831f9d0cb75225b8ce300db4f20da85b7438.tar.gz |
cook: avoid hardcoded sizes in sizeof()
Diffstat (limited to 'libavcodec/cook.c')
-rw-r--r-- | libavcodec/cook.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/libavcodec/cook.c b/libavcodec/cook.c index 93e1758665..25a698c21d 100644 --- a/libavcodec/cook.c +++ b/libavcodec/cook.c @@ -215,7 +215,7 @@ static av_cold int init_cook_mlt(COOKContext *q) { int j; int mlt_size = q->samples_per_channel; - if ((q->mlt_window = av_malloc(sizeof(float)*mlt_size)) == 0) + if ((q->mlt_window = av_malloc(mlt_size * sizeof(*q->mlt_window))) == 0) return -1; /* Initialize the MLT window: simple sine window. */ @@ -405,9 +405,9 @@ static void categorize(COOKContext *q, COOKSubpacket *p, int* quant_index_table, //av_log(q->avctx, AV_LOG_ERROR, "bits_left = %d\n",bits_left); } - memset(&exp_index1,0,102*sizeof(int)); - memset(&exp_index2,0,102*sizeof(int)); - memset(&tmp_categorize_array,0,128*2*sizeof(int)); + memset(&exp_index1, 0, sizeof(exp_index1)); + memset(&exp_index2, 0, sizeof(exp_index2)); + memset(&tmp_categorize_array, 0, sizeof(tmp_categorize_array)); bias=-32; @@ -628,8 +628,8 @@ static void mono_decode(COOKContext *q, COOKSubpacket *p, float* mlt_buffer) { int quant_index_table[102]; int category[128]; - memset(&category, 0, 128*sizeof(int)); - memset(&category_index, 0, 128*sizeof(int)); + memset(&category, 0, sizeof(category)); + memset(&category_index, 0, sizeof(category_index)); decode_envelope(q, p, quant_index_table); q->num_vectors = get_bits(&q->gb,p->log2_numvector_size); @@ -728,7 +728,8 @@ static void imlt_gain(COOKContext *q, float *inbuffer, } /* Save away the current to be previous block. */ - memcpy(previous_buffer, buffer0, sizeof(float)*q->samples_per_channel); + memcpy(previous_buffer, buffer0, + q->samples_per_channel * sizeof(*previous_buffer)); } @@ -806,11 +807,11 @@ static void joint_decode(COOKContext *q, COOKSubpacket *p, float* mlt_buffer1, const float* cplscale; memset(decouple_tab, 0, sizeof(decouple_tab)); - memset(decode_buffer, 0, sizeof(decode_buffer)); + memset(decode_buffer, 0, sizeof(q->decode_buffer_0)); /* Make sure the buffers are zeroed out. */ - memset(mlt_buffer1,0, 1024*sizeof(float)); - memset(mlt_buffer2,0, 1024*sizeof(float)); + memset(mlt_buffer1, 0, 1024 * sizeof(*mlt_buffer1)); + memset(mlt_buffer2, 0, 1024 * sizeof(*mlt_buffer2)); decouple_info(q, p, decouple_tab); mono_decode(q, p, decode_buffer); |