From d36ff64b29031f402184e4946969810e7d9db0e0 Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 24 Jan 2018 00:02:13 +0100 Subject: audio: fix annyoing af_get_best_sample_formats() definition The af_get_best_sample_formats() function had an argument of int[AF_FORMAT_COUNT], which is slightly incorrect, because it's 0 terminated and should in theory have AF_FORMAT_COUNT+1 entries. It won't actually write this many formats (since some formats are fundamentally incompatible), but it still feels annoying and incorrect. So fix it, and require that callers pass an AF_FORMAT_COUNT+1 array. Note that the array size has no meaning in C function arguments (just another issue with C static arrays being weird and stupid), so get rid of it completely. Not changing the af_lavcac3enc use, since that is rewritten in another branch anyway. --- audio/out/ao_oss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'audio/out/ao_oss.c') diff --git a/audio/out/ao_oss.c b/audio/out/ao_oss.c index 1300a72043..f037812e70 100644 --- a/audio/out/ao_oss.c +++ b/audio/out/ao_oss.c @@ -315,7 +315,7 @@ static int reopen_device(struct ao *ao, bool allow_format_changes) } } - int try_formats[AF_FORMAT_COUNT]; + int try_formats[AF_FORMAT_COUNT + 1]; af_get_best_sample_formats(format, try_formats); for (int n = 0; try_formats[n]; n++) { format = try_formats[n]; -- cgit v1.2.3