Re: [libav-devel] [PATCH 14/16] atrac3: use sizeof(variable) instead of sizeof(type)

2012-10-19 Thread Martin Storsjö

On Thu, 18 Oct 2012, Justin Ruggles wrote:


---
libavcodec/atrac3.c |   13 +++--
1 files changed, 7 insertions(+), 6 deletions(-)


LGTM

// Martin
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 14/16] atrac3: use sizeof(variable) instead of sizeof(type)

2012-10-18 Thread Justin Ruggles
---
 libavcodec/atrac3.c |   13 +++--
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/libavcodec/atrac3.c b/libavcodec/atrac3.c
index b3e1593..c662015 100644
--- a/libavcodec/atrac3.c
+++ b/libavcodec/atrac3.c
@@ -313,13 +313,13 @@ static int decode_spectrum(GetBitContext *gb, float 
*output)
 output[first] = mantissas[j] * scale_factor;
 } else {
 /* this subband was not coded, so zero the entire subband */
-memset(output + first, 0, subband_size * sizeof(float));
+memset(output + first, 0, subband_size * sizeof(*output));
 }
 }
 
 /* clear the subbands that were not coded */
 first = subband_tab[i];
-memset(output + first, 0, (SAMPLES_PER_FRAME - first) * sizeof(float));
+memset(output + first, 0, (SAMPLES_PER_FRAME - first) * sizeof(*output));
 return num_subbands;
 }
 
@@ -496,7 +496,7 @@ static void gain_compensate_and_overlap(float *input, float 
*prev,
 }
 
 /* Delay for the overlapping part. */
-memcpy(prev, &input[256], 256 * sizeof(float));
+memcpy(prev, &input[256], 256 * sizeof(*prev));
 }
 
 /*
@@ -686,7 +686,7 @@ static int decode_channel_sound_unit(ATRAC3Context *q, 
GetBitContext *gb,
 if (band <= num_bands)
 imlt(q, &snd->spectrum[band * 256], snd->imdct_buf, band & 1);
 else
-memset(snd->imdct_buf, 0, 512 * sizeof(float));
+memset(snd->imdct_buf, 0, 512 * sizeof(*snd->imdct_buf));
 
 /* gain compensation and overlapping */
 gain_compensate_and_overlap(snd->imdct_buf,
@@ -744,7 +744,8 @@ static int decode_frame(AVCodecContext *avctx, const 
uint8_t *databuf,
 init_get_bits(&q->gb, ptr1, avctx->block_align * 8);
 
 /* Fill the Weighting coeffs delay buffer */
-memmove(q->weighting_delay, &q->weighting_delay[2], 4 * sizeof(int));
+memmove(q->weighting_delay, &q->weighting_delay[2],
+4 * sizeof(*q->weighting_delay));
 q->weighting_delay[4] = get_bits1(&q->gb);
 q->weighting_delay[5] = get_bits(&q->gb, 3);
 
@@ -985,7 +986,7 @@ static av_cold int atrac3_decode_init(AVCodecContext *avctx)
 avpriv_float_dsp_init(&q->fdsp, avctx->flags & CODEC_FLAG_BITEXACT);
 ff_fmt_convert_init(&q->fmt_conv, avctx);
 
-q->units = av_mallocz(sizeof(ChannelUnit) * avctx->channels);
+q->units = av_mallocz(sizeof(*q->units) * avctx->channels);
 if (!q->units) {
 atrac3_decode_close(avctx);
 return AVERROR(ENOMEM);
-- 
1.7.1

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel