audiotestsrc: convert sizes to const size_t

`sizes` members participate in multiplication and subsequent assignment
into port->bpf, which has size_t. So LGTM rightfully complains, there's
a chance the multiplication will overflow before the assignment happens.

Should have no influence on performance since 64 bit multiplication is
as fast, and since the struct is constified, a wise compiler should make
sure it doesn't take excess space either.

Fixes LGTM warning:

    Multiplication result may overflow 'unsigned int' before it is converted to 'size_t'.
This commit is contained in:
Konstantin Kharlamov 2021-07-05 23:26:09 +03:00
parent ab71d2c3cb
commit dea1a0bee2

View file

@ -725,7 +725,7 @@ port_set_format(struct impl *this,
} else {
struct spa_audio_info info = { 0 };
int idx;
int sizes[4] = { 2, 4, 4, 8 };
const size_t sizes[4] = { 2, 4, 4, 8 };
if ((res = spa_format_parse(format, &info.media_type, &info.media_subtype)) < 0)
return res;