mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-12-08 06:09:50 +00:00
general: fix warning 'av_malloc_array' sizes specified with 'sizeof'
in the earlier argument and not in the later argument [-Wcalloc-transposed-args] Fixes trac ticket #11620
This commit is contained in:
parent
00225e9ebc
commit
ef60d5ac32
11 changed files with 18 additions and 18 deletions
|
|
@ -52,7 +52,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
|||
|
||||
ff_init_dsd_data();
|
||||
|
||||
s = av_malloc_array(sizeof(DSDContext), avctx->ch_layout.nb_channels);
|
||||
s = av_malloc_array(avctx->ch_layout.nb_channels, sizeof(*s));
|
||||
if (!s)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ static int vaapi_encode_make_packed_header(AVCodecContext *avctx,
|
|||
.has_emulation_bytes = 1,
|
||||
};
|
||||
|
||||
tmp = av_realloc_array(pic->param_buffers, sizeof(*tmp), pic->nb_param_buffers + 2);
|
||||
tmp = av_realloc_array(pic->param_buffers, pic->nb_param_buffers + 2, sizeof(*tmp));
|
||||
if (!tmp)
|
||||
return AVERROR(ENOMEM);
|
||||
pic->param_buffers = tmp;
|
||||
|
|
@ -93,7 +93,7 @@ static int vaapi_encode_make_param_buffer(AVCodecContext *avctx,
|
|||
VABufferID *tmp;
|
||||
VABufferID buffer;
|
||||
|
||||
tmp = av_realloc_array(pic->param_buffers, sizeof(*tmp), pic->nb_param_buffers + 1);
|
||||
tmp = av_realloc_array(pic->param_buffers, pic->nb_param_buffers + 1, sizeof(*tmp));
|
||||
if (!tmp)
|
||||
return AVERROR(ENOMEM);
|
||||
pic->param_buffers = tmp;
|
||||
|
|
|
|||
|
|
@ -463,11 +463,11 @@ static int create_vorbis_context(vorbis_enc_context *venc,
|
|||
venc->modes[1].mapping = 0;
|
||||
|
||||
venc->have_saved = 0;
|
||||
venc->saved = av_malloc_array(sizeof(float) * venc->channels, (1 << venc->log2_blocksize[1]) / 2);
|
||||
venc->samples = av_malloc_array(sizeof(float) * venc->channels, (1 << venc->log2_blocksize[1]));
|
||||
venc->floor = av_malloc_array(sizeof(float) * venc->channels, (1 << venc->log2_blocksize[1]) / 2);
|
||||
venc->coeffs = av_malloc_array(sizeof(float) * venc->channels, (1 << venc->log2_blocksize[1]) / 2);
|
||||
venc->scratch = av_malloc_array(sizeof(float) * venc->channels, (1 << venc->log2_blocksize[1]));
|
||||
venc->saved = av_malloc_array((1 << venc->log2_blocksize[1]) / 2, sizeof(float) * venc->channels);
|
||||
venc->samples = av_malloc_array((1 << venc->log2_blocksize[1]), sizeof(float) * venc->channels);
|
||||
venc->floor = av_malloc_array((1 << venc->log2_blocksize[1]) / 2, sizeof(float) * venc->channels);
|
||||
venc->coeffs = av_malloc_array((1 << venc->log2_blocksize[1]) / 2, sizeof(float) * venc->channels);
|
||||
venc->scratch = av_malloc_array((1 << venc->log2_blocksize[1]), sizeof(float) * venc->channels);
|
||||
|
||||
if (!venc->saved || !venc->samples || !venc->floor || !venc->coeffs || !venc->scratch)
|
||||
return AVERROR(ENOMEM);
|
||||
|
|
|
|||
|
|
@ -361,9 +361,9 @@ static int config_input(AVFilterLink *inlink)
|
|||
DenoiseState *st = &s->st[i];
|
||||
|
||||
st->rnn[0].model = s->model[0];
|
||||
st->rnn[0].vad_gru_state = av_calloc(sizeof(float), FFALIGN(s->model[0]->vad_gru_size, 16));
|
||||
st->rnn[0].noise_gru_state = av_calloc(sizeof(float), FFALIGN(s->model[0]->noise_gru_size, 16));
|
||||
st->rnn[0].denoise_gru_state = av_calloc(sizeof(float), FFALIGN(s->model[0]->denoise_gru_size, 16));
|
||||
st->rnn[0].vad_gru_state = av_calloc(FFALIGN(s->model[0]->vad_gru_size, 16), sizeof(float));
|
||||
st->rnn[0].noise_gru_state = av_calloc(FFALIGN(s->model[0]->noise_gru_size, 16), sizeof(float));
|
||||
st->rnn[0].denoise_gru_state = av_calloc(FFALIGN(s->model[0]->denoise_gru_size, 16), sizeof(float));
|
||||
if (!st->rnn[0].vad_gru_state ||
|
||||
!st->rnn[0].noise_gru_state ||
|
||||
!st->rnn[0].denoise_gru_state)
|
||||
|
|
|
|||
|
|
@ -210,7 +210,7 @@ static int config_output(AVFilterLink *outlink)
|
|||
{
|
||||
AudioStatsContext *s = outlink->src->priv;
|
||||
|
||||
s->chstats = av_calloc(sizeof(*s->chstats), outlink->ch_layout.nb_channels);
|
||||
s->chstats = av_calloc(outlink->ch_layout.nb_channels, sizeof(*s->chstats));
|
||||
if (!s->chstats)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
|
|
|
|||
|
|
@ -176,7 +176,7 @@ static int config_input(AVFilterLink *inlink)
|
|||
sizeof(*s->nb_null_samples));
|
||||
if (!s->nb_null_samples)
|
||||
return AVERROR(ENOMEM);
|
||||
s->start = av_malloc_array(sizeof(*s->start), s->independent_channels);
|
||||
s->start = av_malloc_array(s->independent_channels, sizeof(*s->start));
|
||||
if (!s->start)
|
||||
return AVERROR(ENOMEM);
|
||||
for (c = 0; c < s->independent_channels; c++)
|
||||
|
|
|
|||
|
|
@ -688,7 +688,7 @@ AVFilterFormats *ff_all_alpha_modes(void)
|
|||
if (!f) \
|
||||
return AVERROR(ENOMEM); \
|
||||
\
|
||||
tmp = av_realloc_array(f->refs, sizeof(*f->refs), f->refcount + 1); \
|
||||
tmp = av_realloc_array(f->refs, f->refcount + 1, sizeof(*f->refs)); \
|
||||
if (!tmp) { \
|
||||
unref_fn(&f); \
|
||||
return AVERROR(ENOMEM); \
|
||||
|
|
|
|||
|
|
@ -165,7 +165,7 @@ static int read_shape_from_file(int *cols, int *rows, int **values, const char *
|
|||
ret = AVERROR_INVALIDDATA;
|
||||
goto end;
|
||||
}
|
||||
if (!(*values = av_calloc(sizeof(int) * *rows, *cols))) {
|
||||
if (!(*values = av_calloc(*cols, sizeof(**values) * *rows))) {
|
||||
ret = AVERROR(ENOMEM);
|
||||
goto end;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ static int config_props(AVFilterLink *inlink)
|
|||
priv->pix_desc = av_pix_fmt_desc_get(inlink->format);
|
||||
|
||||
av_freep(&priv->line);
|
||||
if (!(priv->line = av_malloc_array(sizeof(*priv->line), inlink->w)))
|
||||
if (!(priv->line = av_malloc_array(inlink->w, sizeof(*priv->line))))
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -714,7 +714,7 @@ static VkBool32 VKAPI_CALL vk_dbg_callback(VkDebugUtilsMessageSeverityFlagBitsEX
|
|||
|
||||
#define ADD_VAL_TO_LIST(list, count, val) \
|
||||
do { \
|
||||
list = av_realloc_array(list, sizeof(*list), ++count); \
|
||||
list = av_realloc_array(list, ++count, sizeof(*list)); \
|
||||
if (!list) { \
|
||||
err = AVERROR(ENOMEM); \
|
||||
goto fail; \
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@ static AVFrameSideData *add_side_data_from_buf_ext(AVFrameSideData ***sd,
|
|||
if ((unsigned)*nb_sd >= FFMIN(INT_MAX, SIZE_MAX))
|
||||
return NULL;
|
||||
|
||||
tmp = av_realloc_array(*sd, sizeof(**sd), *nb_sd + 1);
|
||||
tmp = av_realloc_array(*sd, *nb_sd + 1, sizeof(**sd));
|
||||
if (!tmp)
|
||||
return NULL;
|
||||
*sd = tmp;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue