[igt-dev] [PATCH i-g-t] lib/tests/igt_audio: fix bad-function-cast warning
Martin Peres
martin.peres at linux.intel.com
Wed Jun 12 10:53:49 UTC 2019
On 07/06/2019 14:08, Simon Ser wrote:
> Cast a variable instead of the return value of the function.
>
> Signed-off-by: Simon Ser <simon.ser at intel.com>
Reviewed-by: Martin Peres <martin.peres at linux.intel.com>
> ---
> lib/tests/igt_audio.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/lib/tests/igt_audio.c b/lib/tests/igt_audio.c
> index 47e61adf74fe..eee4dd51f04c 100644
> --- a/lib/tests/igt_audio.c
> +++ b/lib/tests/igt_audio.c
> @@ -65,11 +65,14 @@ static void test_signal_detect_noise(struct audio_signal *signal)
> double buf[BUFFER_LEN];
> bool ok;
> size_t i;
> + long r;
>
> /* Generate random samples between -1 and 1 */
> srand(42);
> - for (i = 0; i < BUFFER_LEN; i++)
> - buf[i] = (double) random() / RAND_MAX * 2 - 1;
> + for (i = 0; i < BUFFER_LEN; i++) {
> + r = random();
> + buf[i] = (double) r / RAND_MAX * 2 - 1;
> + }
>
> ok = audio_signal_detect(signal, SAMPLING_RATE, 0, buf, BUFFER_LEN);
>
> --
> 2.21.0
>
> _______________________________________________
> igt-dev mailing list
> igt-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/igt-dev
>
More information about the igt-dev
mailing list