ArchivePlugin: rename struct archive_plugin to ArchivePlugin
This commit is contained in:
parent
5fb54095d2
commit
9906daeca7
@ -23,14 +23,15 @@
|
||||
class Mutex;
|
||||
class Cond;
|
||||
class Error;
|
||||
struct ArchivePlugin;
|
||||
class ArchiveVisitor;
|
||||
struct InputStream;
|
||||
|
||||
class ArchiveFile {
|
||||
public:
|
||||
const struct archive_plugin &plugin;
|
||||
const ArchivePlugin &plugin;
|
||||
|
||||
ArchiveFile(const struct archive_plugin &_plugin)
|
||||
ArchiveFile(const ArchivePlugin &_plugin)
|
||||
:plugin(_plugin) {}
|
||||
|
||||
protected:
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
const struct archive_plugin *const archive_plugins[] = {
|
||||
const ArchivePlugin *const archive_plugins[] = {
|
||||
#ifdef HAVE_BZ2
|
||||
&bz2_archive_plugin,
|
||||
#endif
|
||||
@ -48,7 +48,7 @@ static bool archive_plugins_enabled[ARRAY_SIZE(archive_plugins) - 1];
|
||||
archive_plugins_for_each(plugin) \
|
||||
if (archive_plugins_enabled[archive_plugin_iterator - archive_plugins])
|
||||
|
||||
const struct archive_plugin *
|
||||
const ArchivePlugin *
|
||||
archive_plugin_from_suffix(const char *suffix)
|
||||
{
|
||||
if (suffix == nullptr)
|
||||
@ -62,7 +62,7 @@ archive_plugin_from_suffix(const char *suffix)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const struct archive_plugin *
|
||||
const ArchivePlugin *
|
||||
archive_plugin_from_name(const char *name)
|
||||
{
|
||||
archive_plugins_for_each_enabled(plugin)
|
||||
@ -75,7 +75,7 @@ archive_plugin_from_name(const char *name)
|
||||
void archive_plugin_init_all(void)
|
||||
{
|
||||
for (unsigned i = 0; archive_plugins[i] != nullptr; ++i) {
|
||||
const struct archive_plugin *plugin = archive_plugins[i];
|
||||
const ArchivePlugin *plugin = archive_plugins[i];
|
||||
if (plugin->init == nullptr || archive_plugins[i]->init())
|
||||
archive_plugins_enabled[i] = true;
|
||||
}
|
||||
|
@ -20,22 +20,22 @@
|
||||
#ifndef MPD_ARCHIVE_LIST_HXX
|
||||
#define MPD_ARCHIVE_LIST_HXX
|
||||
|
||||
struct archive_plugin;
|
||||
struct ArchivePlugin;
|
||||
|
||||
extern const struct archive_plugin *const archive_plugins[];
|
||||
extern const ArchivePlugin *const archive_plugins[];
|
||||
|
||||
#define archive_plugins_for_each(plugin) \
|
||||
for (const struct archive_plugin *plugin, \
|
||||
for (const ArchivePlugin *plugin, \
|
||||
*const*archive_plugin_iterator = &archive_plugins[0]; \
|
||||
(plugin = *archive_plugin_iterator) != nullptr; \
|
||||
++archive_plugin_iterator)
|
||||
|
||||
/* interface for using plugins */
|
||||
|
||||
const struct archive_plugin *
|
||||
const ArchivePlugin *
|
||||
archive_plugin_from_suffix(const char *suffix);
|
||||
|
||||
const struct archive_plugin *
|
||||
const ArchivePlugin *
|
||||
archive_plugin_from_name(const char *name);
|
||||
|
||||
/* this is where we "load" all the "plugins" ;-) */
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include <assert.h>
|
||||
|
||||
ArchiveFile *
|
||||
archive_file_open(const struct archive_plugin *plugin, const char *path,
|
||||
archive_file_open(const ArchivePlugin *plugin, const char *path,
|
||||
Error &error)
|
||||
{
|
||||
assert(plugin != nullptr);
|
||||
|
@ -23,7 +23,7 @@
|
||||
class ArchiveFile;
|
||||
class Error;
|
||||
|
||||
struct archive_plugin {
|
||||
struct ArchivePlugin {
|
||||
const char *name;
|
||||
|
||||
/**
|
||||
@ -54,7 +54,7 @@ struct archive_plugin {
|
||||
};
|
||||
|
||||
ArchiveFile *
|
||||
archive_file_open(const struct archive_plugin *plugin, const char *path,
|
||||
archive_file_open(const ArchivePlugin *plugin, const char *path,
|
||||
Error &error);
|
||||
|
||||
#endif
|
||||
|
@ -282,7 +282,7 @@ const InputPlugin bz2_inputplugin = {
|
||||
nullptr,
|
||||
};
|
||||
|
||||
const struct archive_plugin bz2_archive_plugin = {
|
||||
const ArchivePlugin bz2_archive_plugin = {
|
||||
"bz2",
|
||||
nullptr,
|
||||
nullptr,
|
||||
|
@ -20,6 +20,8 @@
|
||||
#ifndef MPD_ARCHIVE_BZ2_HXX
|
||||
#define MPD_ARCHIVE_BZ2_HXX
|
||||
|
||||
extern const struct archive_plugin bz2_archive_plugin;
|
||||
struct ArchivePlugin;
|
||||
|
||||
extern const ArchivePlugin bz2_archive_plugin;
|
||||
|
||||
#endif
|
||||
|
@ -266,7 +266,7 @@ const InputPlugin iso9660_input_plugin = {
|
||||
nullptr,
|
||||
};
|
||||
|
||||
const struct archive_plugin iso9660_archive_plugin = {
|
||||
const ArchivePlugin iso9660_archive_plugin = {
|
||||
"iso",
|
||||
nullptr,
|
||||
nullptr,
|
||||
|
@ -20,6 +20,8 @@
|
||||
#ifndef MPD_ARCHIVE_ISO9660_HXX
|
||||
#define MPD_ARCHIVE_ISO9660_HXX
|
||||
|
||||
extern const struct archive_plugin iso9660_archive_plugin;
|
||||
struct ArchivePlugin;
|
||||
|
||||
extern const ArchivePlugin iso9660_archive_plugin;
|
||||
|
||||
#endif
|
||||
|
@ -214,7 +214,7 @@ const InputPlugin zzip_input_plugin = {
|
||||
zzip_input_seek,
|
||||
};
|
||||
|
||||
const struct archive_plugin zzip_archive_plugin = {
|
||||
const ArchivePlugin zzip_archive_plugin = {
|
||||
"zzip",
|
||||
nullptr,
|
||||
nullptr,
|
||||
|
@ -20,6 +20,8 @@
|
||||
#ifndef MPD_ARCHIVE_ZZIP_HXX
|
||||
#define MPD_ARCHIVE_ZZIP_HXX
|
||||
|
||||
extern const struct archive_plugin zzip_archive_plugin;
|
||||
struct ArchivePlugin;
|
||||
|
||||
extern const ArchivePlugin zzip_archive_plugin;
|
||||
|
||||
#endif
|
||||
|
@ -105,7 +105,7 @@ class UpdateArchiveVisitor final : public ArchiveVisitor {
|
||||
void
|
||||
UpdateWalk::UpdateArchiveFile(Directory &parent, const char *name,
|
||||
const FileInfo &info,
|
||||
const archive_plugin &plugin)
|
||||
const ArchivePlugin &plugin)
|
||||
{
|
||||
db_lock();
|
||||
Directory *directory = parent.FindChild(name);
|
||||
@ -158,8 +158,7 @@ UpdateWalk::UpdateArchiveFile(Directory &directory,
|
||||
const char *name, const char *suffix,
|
||||
const FileInfo &info)
|
||||
{
|
||||
const struct archive_plugin *plugin =
|
||||
archive_plugin_from_suffix(suffix);
|
||||
const ArchivePlugin *plugin = archive_plugin_from_suffix(suffix);
|
||||
if (plugin == nullptr)
|
||||
return false;
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
||||
struct stat;
|
||||
struct FileInfo;
|
||||
struct Directory;
|
||||
struct archive_plugin;
|
||||
struct ArchivePlugin;
|
||||
class Storage;
|
||||
class ExcludeList;
|
||||
|
||||
@ -93,7 +93,7 @@ private:
|
||||
|
||||
void UpdateArchiveFile(Directory &directory, const char *name,
|
||||
const FileInfo &info,
|
||||
const archive_plugin &plugin);
|
||||
const ArchivePlugin &plugin);
|
||||
|
||||
|
||||
#else
|
||||
|
@ -44,7 +44,7 @@ input_archive_open(const char *pathname,
|
||||
Mutex &mutex, Cond &cond,
|
||||
Error &error)
|
||||
{
|
||||
const struct archive_plugin *arplug;
|
||||
const ArchivePlugin *arplug;
|
||||
InputStream *is;
|
||||
|
||||
if (!PathTraitsFS::IsAbsolute(pathname))
|
||||
|
@ -77,7 +77,7 @@ main(int argc, char **argv)
|
||||
|
||||
/* open the archive and dump it */
|
||||
|
||||
const archive_plugin *plugin = archive_plugin_from_name(plugin_name);
|
||||
const ArchivePlugin *plugin = archive_plugin_from_name(plugin_name);
|
||||
if (plugin == nullptr) {
|
||||
fprintf(stderr, "No such plugin: %s\n", plugin_name);
|
||||
return EXIT_FAILURE;
|
||||
|
Loading…
Reference in New Issue
Block a user