decoder/plugin: kludge for Android NDK r25c

This commit is contained in:
Max Kellermann 2023-03-12 19:52:41 +01:00
parent 89d66b6100
commit b5eff3cecd

View File

@ -20,13 +20,26 @@ DecoderPlugin::SupportsUri(const char *uri) const noexcept
return false; 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 bool
DecoderPlugin::SupportsSuffix(std::string_view suffix) const noexcept DecoderPlugin::SupportsSuffix(std::string_view suffix) const noexcept
{ {
return (suffixes != nullptr && return (suffixes != nullptr &&
StringArrayContainsCase(suffixes, suffix)) || StringArrayContainsCase(suffixes, suffix)) ||
(suffixes_function != nullptr && (suffixes_function != nullptr &&
suffixes_function().contains(suffix)); SetContains(suffixes_function(), suffix));
} }
bool bool