db/update/Container: move SupportsContainerSuffix() to struct DecoderPlugin
This commit is contained in:
parent
d5681b678c
commit
fd1826cb91
@ -55,21 +55,13 @@ UpdateWalk::MakeDirectoryIfModified(Directory &parent, const char *name,
|
||||
return directory;
|
||||
}
|
||||
|
||||
static bool
|
||||
SupportsContainerSuffix(const DecoderPlugin &plugin,
|
||||
const char *suffix) noexcept
|
||||
{
|
||||
return plugin.container_scan != nullptr &&
|
||||
plugin.SupportsSuffix(suffix);
|
||||
}
|
||||
|
||||
bool
|
||||
UpdateWalk::UpdateContainerFile(Directory &directory,
|
||||
const char *name, const char *suffix,
|
||||
const StorageFileInfo &info) noexcept
|
||||
{
|
||||
const DecoderPlugin *_plugin = decoder_plugins_find([suffix](const DecoderPlugin &plugin){
|
||||
return SupportsContainerSuffix(plugin, suffix);
|
||||
return plugin.SupportsContainerSuffix(suffix);
|
||||
});
|
||||
if (_plugin == nullptr)
|
||||
return false;
|
||||
|
@ -225,6 +225,10 @@ struct DecoderPlugin {
|
||||
*/
|
||||
gcc_pure gcc_nonnull_all
|
||||
bool SupportsMimeType(const char *mime_type) const noexcept;
|
||||
|
||||
bool SupportsContainerSuffix(const char *suffix) const noexcept {
|
||||
return container_scan != nullptr && SupportsSuffix(suffix);
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user