From cfa9ecfac92d6f8b3c0c5127843d0af282d8637b Mon Sep 17 00:00:00 2001 From: David Reid Date: Sat, 7 Mar 2020 10:37:32 +1000 Subject: [PATCH] Fix compiler errors with the Speex resampler and -std=c89. --- extras/speex_resampler/ma_speex_resampler.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/extras/speex_resampler/ma_speex_resampler.h b/extras/speex_resampler/ma_speex_resampler.h index 054ae9bf..c6f405d7 100644 --- a/extras/speex_resampler/ma_speex_resampler.h +++ b/extras/speex_resampler/ma_speex_resampler.h @@ -29,6 +29,16 @@ int ma_speex_resampler_get_expected_output_frame_count(SpeexResamplerState* st, #endif /* ma_speex_resampler_h */ #if defined(MINIAUDIO_SPEEX_RESAMPLER_IMPLEMENTATION) +/* The Speex resampler uses "inline", which is not defined for C89. We need to define it here. */ +#if defined(__GNUC__) && !defined(_MSC_VER) + #if defined(__STRICT_ANSI__) + #if !defined(inline) + #define inline __inline__ __attribute__((always_inline)) + #define MA_SPEEX_INLINE_DEFINED + #endif + #endif +#endif + #if defined(_MSC_VER) && !defined(__clang__) #pragma warning(push) #pragma warning(disable:4244) /* conversion from 'x' to 'y', possible loss of data */ @@ -45,6 +55,11 @@ int ma_speex_resampler_get_expected_output_frame_count(SpeexResamplerState* st, #pragma GCC diagnostic pop #endif +#if defined(MA_SPEEX_INLINE_DEFINED) + #undef inline + #undef MA_SPEEX_INLINE_DEFINED +#endif + EXPORT int ma_speex_resampler_get_required_input_frame_count(SpeexResamplerState* st, spx_uint64_t out_len, spx_uint64_t* in_len) { spx_uint64_t count;