From b5eff3cecdf543125236b150da750f0fd9bf0cbe Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 12 Mar 2023 19:52:41 +0100 Subject: [PATCH] decoder/plugin: kludge for Android NDK r25c --- src/decoder/DecoderPlugin.cxx | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/decoder/DecoderPlugin.cxx b/src/decoder/DecoderPlugin.cxx index b96510a00..5ccdc395b 100644 --- a/src/decoder/DecoderPlugin.cxx +++ b/src/decoder/DecoderPlugin.cxx @@ -20,13 +20,26 @@ DecoderPlugin::SupportsUri(const char *uri) const noexcept return false; } +[[gnu::pure]] +static bool +SetContains(const auto &set, const auto &key) noexcept +{ +#ifdef ANDROID + /* the libc++ version in Android NDK r25c doesn't implement + std::set::contains() */ + return set.find(key) != set.end(); +#else + return set.contains(key); +#endif +} + bool DecoderPlugin::SupportsSuffix(std::string_view suffix) const noexcept { return (suffixes != nullptr && StringArrayContainsCase(suffixes, suffix)) || (suffixes_function != nullptr && - suffixes_function().contains(suffix)); + SetContains(suffixes_function(), suffix)); } bool