aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/AudioConfig.cxx2
-rw-r--r--src/Listen.cxx4
-rw-r--r--src/LogInit.cxx6
-rw-r--r--src/Main.cxx30
-rw-r--r--src/Permission.cxx4
-rw-r--r--src/PlaylistFile.cxx7
-rw-r--r--src/ReplayGainConfig.cxx10
-rw-r--r--src/client/ClientGlobal.cxx6
-rw-r--r--src/config/ConfigFile.cxx2
-rw-r--r--src/config/ConfigOption.hxx128
-rw-r--r--src/config/ConfigPath.cxx2
-rw-r--r--src/config/ConfigTemplates.cxx4
-rw-r--r--src/config/Data.hxx2
-rw-r--r--src/db/Configured.cxx4
-rw-r--r--src/db/update/Walk.cxx4
-rw-r--r--src/decoder/DecoderList.cxx3
-rw-r--r--src/decoder/plugins/MadDecoderPlugin.cxx2
-rw-r--r--src/filter/FilterConfig.cxx3
-rw-r--r--src/fs/Config.cxx2
-rw-r--r--src/input/Init.cxx3
-rw-r--r--src/input/plugins/CurlInputPlugin.cxx8
-rw-r--r--src/lib/despotify/DespotifyUtils.cxx6
-rw-r--r--src/neighbor/Glue.cxx2
-rw-r--r--src/output/Init.cxx4
-rw-r--r--src/output/MultipleOutputs.cxx2
-rw-r--r--src/pcm/ConfiguredResampler.cxx2
-rw-r--r--src/playlist/PlaylistRegistry.cxx6
-rw-r--r--src/queue/PlaylistState.cxx2
-rw-r--r--src/storage/Configured.cxx6
-rw-r--r--src/tag/TagConfig.cxx3
-rw-r--r--src/tag/TagId3.cxx3
-rw-r--r--src/zeroconf/ZeroconfGlue.cxx5
32 files changed, 149 insertions, 128 deletions
diff --git a/src/AudioConfig.cxx b/src/AudioConfig.cxx
index ef1f96ee9..8ee17f301 100644
--- a/src/AudioConfig.cxx
+++ b/src/AudioConfig.cxx
@@ -39,7 +39,7 @@ getOutputAudioFormat(AudioFormat inAudioFormat)
void initAudioConfig(void)
{
- const struct config_param *param = config_get_param(CONF_AUDIO_OUTPUT_FORMAT);
+ const struct config_param *param = config_get_param(ConfigOption::AUDIO_OUTPUT_FORMAT);
if (param == nullptr)
return;
diff --git a/src/Listen.cxx b/src/Listen.cxx
index 05a2bdd4d..c360b9650 100644
--- a/src/Listen.cxx
+++ b/src/Listen.cxx
@@ -103,9 +103,9 @@ listen_systemd_activation(Error &error_r)
bool
listen_global_init(EventLoop &loop, Partition &partition, Error &error)
{
- int port = config_get_positive(CONF_PORT, DEFAULT_PORT);
+ int port = config_get_positive(ConfigOption::PORT, DEFAULT_PORT);
const struct config_param *param =
- config_get_param(CONF_BIND_TO_ADDRESS);
+ config_get_param(ConfigOption::BIND_TO_ADDRESS);
listen_socket = new ClientListener(loop, partition);
diff --git a/src/LogInit.cxx b/src/LogInit.cxx
index b154bcec4..f0f00495f 100644
--- a/src/LogInit.cxx
+++ b/src/LogInit.cxx
@@ -139,14 +139,14 @@ log_init(bool verbose, bool use_stdout, Error &error)
if (verbose)
SetLogThreshold(LogLevel::DEBUG);
- else if ((param = config_get_param(CONF_LOG_LEVEL)) != nullptr)
+ else if ((param = config_get_param(ConfigOption::LOG_LEVEL)) != nullptr)
SetLogThreshold(parse_log_level(param->value.c_str(),
param->line));
if (use_stdout) {
return true;
} else {
- param = config_get_param(CONF_LOG_FILE);
+ param = config_get_param(ConfigOption::LOG_FILE);
if (param == nullptr) {
#ifdef HAVE_SYSLOG
/* no configuration: default to syslog (if
@@ -164,7 +164,7 @@ log_init(bool verbose, bool use_stdout, Error &error)
return true;
#endif
} else {
- out_path = config_get_path(CONF_LOG_FILE, error);
+ out_path = config_get_path(ConfigOption::LOG_FILE, error);
return !out_path.IsNull() &&
log_init_file(param->line, error);
}
diff --git a/src/Main.cxx b/src/Main.cxx
index c7304f117..9b7679369 100644
--- a/src/Main.cxx
+++ b/src/Main.cxx
@@ -141,12 +141,12 @@ static StateFile *state_file;
static bool
glue_daemonize_init(const struct options *options, Error &error)
{
- auto pid_file = config_get_path(CONF_PID_FILE, error);
+ auto pid_file = config_get_path(ConfigOption::PID_FILE, error);
if (pid_file.IsNull() && error.IsDefined())
return false;
- daemonize_init(config_get_string(CONF_USER, nullptr),
- config_get_string(CONF_GROUP, nullptr),
+ daemonize_init(config_get_string(ConfigOption::USER, nullptr),
+ config_get_string(ConfigOption::GROUP, nullptr),
std::move(pid_file));
if (options->kill)
@@ -160,7 +160,7 @@ glue_daemonize_init(const struct options *options, Error &error)
static bool
glue_mapper_init(Error &error)
{
- auto playlist_dir = config_get_path(CONF_PLAYLIST_DIR, error);
+ auto playlist_dir = config_get_path(ConfigOption::PLAYLIST_DIR, error);
if (playlist_dir.IsNull() && error.IsDefined())
return false;
@@ -255,7 +255,7 @@ glue_sticker_init(void)
{
#ifdef ENABLE_SQLITE
Error error;
- auto sticker_file = config_get_path(CONF_STICKER_FILE, error);
+ auto sticker_file = config_get_path(ConfigOption::STICKER_FILE, error);
if (sticker_file.IsNull()) {
if (error.IsDefined())
FatalError(error);
@@ -270,7 +270,7 @@ glue_sticker_init(void)
static bool
glue_state_file_init(Error &error)
{
- auto path_fs = config_get_path(CONF_STATE_FILE, error);
+ auto path_fs = config_get_path(ConfigOption::STATE_FILE, error);
if (path_fs.IsNull()) {
if (error.IsDefined())
return false;
@@ -286,8 +286,9 @@ glue_state_file_init(Error &error)
#endif
}
- unsigned interval = config_get_unsigned(CONF_STATE_FILE_INTERVAL,
- StateFile::DEFAULT_INTERVAL);
+ const unsigned interval =
+ config_get_unsigned(ConfigOption::STATE_FILE_INTERVAL,
+ StateFile::DEFAULT_INTERVAL);
state_file = new StateFile(std::move(path_fs), interval,
*instance->partition,
@@ -324,7 +325,7 @@ initialize_decoder_and_player(void)
const struct config_param *param;
size_t buffer_size;
- param = config_get_param(CONF_AUDIO_BUFFER_SIZE);
+ param = config_get_param(ConfigOption::AUDIO_BUFFER_SIZE);
if (param != nullptr) {
char *test;
long tmp = strtol(param->value.c_str(), &test, 10);
@@ -345,7 +346,7 @@ initialize_decoder_and_player(void)
(unsigned long)buffer_size);
float perc;
- param = config_get_param(CONF_BUFFER_BEFORE_PLAY);
+ param = config_get_param(ConfigOption::BUFFER_BEFORE_PLAY);
if (param != nullptr) {
char *test;
perc = strtod(param->value.c_str(), &test);
@@ -363,7 +364,7 @@ initialize_decoder_and_player(void)
buffered_before_play = buffered_chunks;
const unsigned max_length =
- config_get_positive(CONF_MAX_PLAYLIST_LENGTH,
+ config_get_positive(ConfigOption::MAX_PLAYLIST_LENGTH,
DEFAULT_PLAYLIST_MAX_LENGTH);
instance->partition = new Partition(*instance,
@@ -503,7 +504,8 @@ int mpd_main(int argc, char *argv[])
}
#endif
- const unsigned max_clients = config_get_positive(CONF_MAX_CONN, 10);
+ const unsigned max_clients =
+ config_get_positive(ConfigOption::MAX_CONN, 10);
instance->client_list = new ClientList(max_clients);
initialize_decoder_and_player();
@@ -630,14 +632,14 @@ static int mpd_main_after_fork(struct options options)
instance->partition->outputs.SetReplayGainMode(replay_gain_get_real_mode(instance->partition->playlist.queue.random));
#ifdef ENABLE_DATABASE
- if (config_get_bool(CONF_AUTO_UPDATE, false)) {
+ if (config_get_bool(ConfigOption::AUTO_UPDATE, false)) {
#ifdef ENABLE_INOTIFY
if (instance->storage != nullptr &&
instance->update != nullptr)
mpd_inotify_init(*instance->event_loop,
*instance->storage,
*instance->update,
- config_get_unsigned(CONF_AUTO_UPDATE_DEPTH,
+ config_get_unsigned(ConfigOption::AUTO_UPDATE_DEPTH,
INT_MAX));
#else
FormatWarning(main_domain,
diff --git a/src/Permission.cxx b/src/Permission.cxx
index c14830ac7..b6ff39bdb 100644
--- a/src/Permission.cxx
+++ b/src/Permission.cxx
@@ -92,7 +92,7 @@ void initPermissions(void)
permission_default = PERMISSION_READ | PERMISSION_ADD |
PERMISSION_CONTROL | PERMISSION_ADMIN;
- param = config_get_param(CONF_PASSWORD);
+ param = config_get_param(ConfigOption::PASSWORD);
if (param) {
permission_default = 0;
@@ -118,7 +118,7 @@ void initPermissions(void)
} while ((param = param->next) != nullptr);
}
- param = config_get_param(CONF_DEFAULT_PERMS);
+ param = config_get_param(ConfigOption::DEFAULT_PERMS);
if (param)
permission_default = parsePermissions(param->value.c_str());
diff --git a/src/PlaylistFile.cxx b/src/PlaylistFile.cxx
index 65974fb55..f77d1930f 100644
--- a/src/PlaylistFile.cxx
+++ b/src/PlaylistFile.cxx
@@ -53,11 +53,12 @@ bool playlist_saveAbsolutePaths = DEFAULT_PLAYLIST_SAVE_ABSOLUTE_PATHS;
void
spl_global_init(void)
{
- playlist_max_length = config_get_positive(CONF_MAX_PLAYLIST_LENGTH,
- DEFAULT_PLAYLIST_MAX_LENGTH);
+ playlist_max_length =
+ config_get_positive(ConfigOption::MAX_PLAYLIST_LENGTH,
+ DEFAULT_PLAYLIST_MAX_LENGTH);
playlist_saveAbsolutePaths =
- config_get_bool(CONF_SAVE_ABSOLUTE_PATHS,
+ config_get_bool(ConfigOption::SAVE_ABSOLUTE_PATHS,
DEFAULT_PLAYLIST_SAVE_ABSOLUTE_PATHS);
}
diff --git a/src/ReplayGainConfig.cxx b/src/ReplayGainConfig.cxx
index 8d1f83404..b8a907cdc 100644
--- a/src/ReplayGainConfig.cxx
+++ b/src/ReplayGainConfig.cxx
@@ -81,7 +81,8 @@ replay_gain_set_mode_string(const char *p)
void replay_gain_global_init(void)
{
- const struct config_param *param = config_get_param(CONF_REPLAYGAIN);
+ const struct config_param *param =
+ config_get_param(ConfigOption::REPLAYGAIN);
if (param != nullptr &&
!replay_gain_set_mode_string(param->value.c_str())) {
@@ -89,7 +90,7 @@ void replay_gain_global_init(void)
param->value.c_str(), param->line);
}
- param = config_get_param(CONF_REPLAYGAIN_PREAMP);
+ param = config_get_param(ConfigOption::REPLAYGAIN_PREAMP);
if (param) {
char *test;
@@ -110,7 +111,7 @@ void replay_gain_global_init(void)
replay_gain_preamp = pow(10, f / 20.0);
}
- param = config_get_param(CONF_REPLAYGAIN_MISSING_PREAMP);
+ param = config_get_param(ConfigOption::REPLAYGAIN_MISSING_PREAMP);
if (param) {
char *test;
@@ -131,7 +132,8 @@ void replay_gain_global_init(void)
replay_gain_missing_preamp = pow(10, f / 20.0);
}
- replay_gain_limit = config_get_bool(CONF_REPLAYGAIN_LIMIT, DEFAULT_REPLAYGAIN_LIMIT);
+ replay_gain_limit = config_get_bool(ConfigOption::REPLAYGAIN_LIMIT,
+ DEFAULT_REPLAYGAIN_LIMIT);
}
ReplayGainMode
diff --git a/src/client/ClientGlobal.cxx b/src/client/ClientGlobal.cxx
index b084839bc..078fd0981 100644
--- a/src/client/ClientGlobal.cxx
+++ b/src/client/ClientGlobal.cxx
@@ -31,15 +31,15 @@ size_t client_max_output_buffer_size;
void client_manager_init(void)
{
- client_timeout = config_get_positive(CONF_CONN_TIMEOUT,
+ client_timeout = config_get_positive(ConfigOption::CONN_TIMEOUT,
CLIENT_TIMEOUT_DEFAULT);
client_max_command_list_size =
- config_get_positive(CONF_MAX_COMMAND_LIST_SIZE,
+ config_get_positive(ConfigOption::MAX_COMMAND_LIST_SIZE,
CLIENT_MAX_COMMAND_LIST_DEFAULT / 1024)
* 1024;
client_max_output_buffer_size =
- config_get_positive(CONF_MAX_OUTPUT_BUFFER_SIZE,
+ config_get_positive(ConfigOption::MAX_OUTPUT_BUFFER_SIZE,
CLIENT_MAX_OUTPUT_BUFFER_SIZE_DEFAULT / 1024)
* 1024;
}
diff --git a/src/config/ConfigFile.cxx b/src/config/ConfigFile.cxx
index 258482db9..e3b47bae6 100644
--- a/src/config/ConfigFile.cxx
+++ b/src/config/ConfigFile.cxx
@@ -175,7 +175,7 @@ ReadConfigFile(ConfigData &config_data, FILE *fp, Error &error)
"repeatable" flag */
const ConfigOption o = ParseConfigOptionName(name);
- if (o == CONF_MAX) {
+ if (o == ConfigOption::MAX) {
error.Format(config_file_domain,
"unrecognized parameter in config file at "
"line %i: %s\n", count, name);
diff --git a/src/config/ConfigOption.hxx b/src/config/ConfigOption.hxx
index 1c177acf0..c3f4c9aad 100644
--- a/src/config/ConfigOption.hxx
+++ b/src/config/ConfigOption.hxx
@@ -22,68 +22,78 @@
#include "Compiler.h"
-enum ConfigOption {
- CONF_MUSIC_DIR,
- CONF_PLAYLIST_DIR,
- CONF_FOLLOW_INSIDE_SYMLINKS,
- CONF_FOLLOW_OUTSIDE_SYMLINKS,
- CONF_DB_FILE,
- CONF_STICKER_FILE,
- CONF_LOG_FILE,
- CONF_PID_FILE,
- CONF_STATE_FILE,
- CONF_STATE_FILE_INTERVAL,
- CONF_RESTORE_PAUSED,
- CONF_USER,
- CONF_GROUP,
- CONF_BIND_TO_ADDRESS,
- CONF_PORT,
- CONF_LOG_LEVEL,
- CONF_ZEROCONF_NAME,
- CONF_ZEROCONF_ENABLED,
- CONF_PASSWORD,
- CONF_DEFAULT_PERMS,
- CONF_AUDIO_OUTPUT,
- CONF_AUDIO_OUTPUT_FORMAT,
- CONF_MIXER_TYPE,
- CONF_REPLAYGAIN,
- CONF_REPLAYGAIN_PREAMP,
- CONF_REPLAYGAIN_MISSING_PREAMP,
- CONF_REPLAYGAIN_LIMIT,
- CONF_VOLUME_NORMALIZATION,
- CONF_SAMPLERATE_CONVERTER,
- CONF_AUDIO_BUFFER_SIZE,
- CONF_BUFFER_BEFORE_PLAY,
- CONF_HTTP_PROXY_HOST,
- CONF_HTTP_PROXY_PORT,
- CONF_HTTP_PROXY_USER,
- CONF_HTTP_PROXY_PASSWORD,
- CONF_CONN_TIMEOUT,
- CONF_MAX_CONN,
- CONF_MAX_PLAYLIST_LENGTH,
- CONF_MAX_COMMAND_LIST_SIZE,
- CONF_MAX_OUTPUT_BUFFER_SIZE,
- CONF_FS_CHARSET,
- CONF_ID3V1_ENCODING,
- CONF_METADATA_TO_USE,
- CONF_SAVE_ABSOLUTE_PATHS,
- CONF_DECODER,
- CONF_INPUT,
- CONF_GAPLESS_MP3_PLAYBACK,
- CONF_PLAYLIST_PLUGIN,
- CONF_AUTO_UPDATE,
- CONF_AUTO_UPDATE_DEPTH,
- CONF_DESPOTIFY_USER,
- CONF_DESPOTIFY_PASSWORD,
- CONF_DESPOTIFY_HIGH_BITRATE,
- CONF_AUDIO_FILTER,
- CONF_DATABASE,
- CONF_NEIGHBORS,
- CONF_MAX
+#if defined(WIN32) && CLANG_OR_GCC_VERSION(4,7)
+/* "INPUT" is declared by winuser.h */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wshadow"
+#endif
+
+enum class ConfigOption {
+ MUSIC_DIR,
+ PLAYLIST_DIR,
+ FOLLOW_INSIDE_SYMLINKS,
+ FOLLOW_OUTSIDE_SYMLINKS,
+ DB_FILE,
+ STICKER_FILE,
+ LOG_FILE,
+ PID_FILE,
+ STATE_FILE,
+ STATE_FILE_INTERVAL,
+ RESTORE_PAUSED,
+ USER,
+ GROUP,
+ BIND_TO_ADDRESS,
+ PORT,
+ LOG_LEVEL,
+ ZEROCONF_NAME,
+ ZEROCONF_ENABLED,
+ PASSWORD,
+ DEFAULT_PERMS,
+ AUDIO_OUTPUT,
+ AUDIO_OUTPUT_FORMAT,
+ MIXER_TYPE,
+ REPLAYGAIN,
+ REPLAYGAIN_PREAMP,
+ REPLAYGAIN_MISSING_PREAMP,
+ REPLAYGAIN_LIMIT,
+ VOLUME_NORMALIZATION,
+ SAMPLERATE_CONVERTER,
+ AUDIO_BUFFER_SIZE,
+ BUFFER_BEFORE_PLAY,
+ HTTP_PROXY_HOST,
+ HTTP_PROXY_PORT,
+ HTTP_PROXY_USER,
+ HTTP_PROXY_PASSWORD,
+ CONN_TIMEOUT,
+ MAX_CONN,
+ MAX_PLAYLIST_LENGTH,
+ MAX_COMMAND_LIST_SIZE,
+ MAX_OUTPUT_BUFFER_SIZE,
+ FS_CHARSET,
+ ID3V1_ENCODING,
+ METADATA_TO_USE,
+ SAVE_ABSOLUTE_PATHS,
+ DECODER,
+ INPUT,
+ GAPLESS_MP3_PLAYBACK,
+ PLAYLIST_PLUGIN,
+ AUTO_UPDATE,
+ AUTO_UPDATE_DEPTH,
+ DESPOTIFY_USER,
+ DESPOTIFY_PASSWORD,
+ DESPOTIFY_HIGH_BITRATE,
+ AUDIO_FILTER,
+ DATABASE,
+ NEIGHBORS,
+ MAX
};
+#if defined(WIN32) && CLANG_OR_GCC_VERSION(4,7)
+#pragma GCC diagnostic pop
+#endif
+
/**
- * @return #CONF_MAX if not found
+ * @return #ConfigOption::MAX if not found
*/
gcc_pure
enum ConfigOption
diff --git a/src/config/ConfigPath.cxx b/src/config/ConfigPath.cxx
index c10b3a1d5..fe42fdf60 100644
--- a/src/config/ConfigPath.cxx
+++ b/src/config/ConfigPath.cxx
@@ -70,7 +70,7 @@ GetHome(Error &error)
static AllocatedPath
GetConfiguredHome(Error &error)
{
- const char *user = config_get_string(CONF_USER, nullptr);
+ const char *user = config_get_string(ConfigOption::USER, nullptr);
return user != nullptr
? GetHome(user, error)
: GetHome(error);
diff --git a/src/config/ConfigTemplates.cxx b/src/config/ConfigTemplates.cxx
index 1949a5ff1..8f01d4104 100644
--- a/src/config/ConfigTemplates.cxx
+++ b/src/config/ConfigTemplates.cxx
@@ -84,7 +84,7 @@ const ConfigTemplate config_templates[] = {
static constexpr unsigned n_config_templates = ARRAY_SIZE(config_templates);
-static_assert(n_config_templates == unsigned(CONF_MAX),
+static_assert(n_config_templates == unsigned(ConfigOption::MAX),
"Wrong number of config_templates");
ConfigOption
@@ -94,5 +94,5 @@ ParseConfigOptionName(const char *name)
if (strcmp(config_templates[i].name, name) == 0)
return ConfigOption(i);
- return CONF_MAX;
+ return ConfigOption::MAX;
}
diff --git a/src/config/Data.hxx b/src/config/Data.hxx
index af1da956f..56e7d2553 100644
--- a/src/config/Data.hxx
+++ b/src/config/Data.hxx
@@ -27,7 +27,7 @@
struct config_param;
struct ConfigData {
- std::array<config_param *, std::size_t(CONF_MAX)> params;
+ std::array<config_param *, std::size_t(ConfigOption::MAX)> params;
void Clear();
};
diff --git a/src/db/Configured.cxx b/src/db/Configured.cxx
index 7bdd10b56..5d53e5951 100644
--- a/src/db/Configured.cxx
+++ b/src/db/Configured.cxx
@@ -32,8 +32,8 @@ Database *
CreateConfiguredDatabase(EventLoop &loop, DatabaseListener &listener,
Error &error)
{
- const struct config_param *param = config_get_param(CONF_DATABASE);
- const struct config_param *path = config_get_param(CONF_DB_FILE);
+ const auto *param = config_get_param(ConfigOption::DATABASE);
+ const auto *path = config_get_param(ConfigOption::DB_FILE);
if (param != nullptr && path != nullptr) {
error.Format(config_domain,
diff --git a/src/db/update/Walk.cxx b/src/db/update/Walk.cxx
index b1aa4af6a..6442e6d23 100644
--- a/src/db/update/Walk.cxx
+++ b/src/db/update/Walk.cxx
@@ -57,11 +57,11 @@ UpdateWalk::UpdateWalk(EventLoop &_loop, DatabaseListener &_listener,
{
#ifndef WIN32
follow_inside_symlinks =
- config_get_bool(CONF_FOLLOW_INSIDE_SYMLINKS,
+ config_get_bool(ConfigOption::FOLLOW_INSIDE_SYMLINKS,
DEFAULT_FOLLOW_INSIDE_SYMLINKS);
follow_outside_symlinks =
- config_get_bool(CONF_FOLLOW_OUTSIDE_SYMLINKS,
+ config_get_bool(ConfigOption::FOLLOW_OUTSIDE_SYMLINKS,
DEFAULT_FOLLOW_OUTSIDE_SYMLINKS);
#endif
}
diff --git a/src/decoder/DecoderList.cxx b/src/decoder/DecoderList.cxx
index c5b8ff5fb..56cc83eba 100644
--- a/src/decoder/DecoderList.cxx
+++ b/src/decoder/DecoderList.cxx
@@ -132,7 +132,8 @@ void decoder_plugin_init_all(void)
for (unsigned i = 0; decoder_plugins[i] != nullptr; ++i) {
const DecoderPlugin &plugin = *decoder_plugins[i];
const struct config_param *param =
- config_find_block(CONF_DECODER, "plugin", plugin.name);
+ config_find_block(ConfigOption::DECODER, "plugin",
+ plugin.name);
if (param == nullptr)
param = &empty;
diff --git a/src/decoder/plugins/MadDecoderPlugin.cxx b/src/decoder/plugins/MadDecoderPlugin.cxx
index 07e9bd02b..6e6feabc1 100644
--- a/src/decoder/plugins/MadDecoderPlugin.cxx
+++ b/src/decoder/plugins/MadDecoderPlugin.cxx
@@ -109,7 +109,7 @@ mad_fixed_to_24_buffer(int32_t *dest, const struct mad_synth *synth,
static bool
mp3_plugin_init(gcc_unused const config_param &param)
{
- gapless_playback = config_get_bool(CONF_GAPLESS_MP3_PLAYBACK,
+ gapless_playback = config_get_bool(ConfigOption::GAPLESS_MP3_PLAYBACK,
DEFAULT_GAPLESS_MP3_PLAYBACK);
return true;
}
diff --git a/src/filter/FilterConfig.cxx b/src/filter/FilterConfig.cxx
index 6ceecd581..be2547751 100644
--- a/src/filter/FilterConfig.cxx
+++ b/src/filter/FilterConfig.cxx
@@ -35,7 +35,8 @@ static bool
filter_chain_append_new(Filter &chain, const char *template_name, Error &error)
{
const struct config_param *cfg =
- config_find_block(CONF_AUDIO_FILTER, "name", template_name);
+ config_find_block(ConfigOption::AUDIO_FILTER, "name",
+ template_name);
if (cfg == nullptr) {
error.Format(config_domain,
"filter template not found: %s",
diff --git a/src/fs/Config.cxx b/src/fs/Config.cxx
index 6975152ca..623736c54 100644
--- a/src/fs/Config.cxx
+++ b/src/fs/Config.cxx
@@ -35,7 +35,7 @@ ConfigureFS(Error &error)
#ifdef HAVE_FS_CHARSET
const char *charset = nullptr;
- charset = config_get_string(CONF_FS_CHARSET, nullptr);
+ charset = config_get_string(ConfigOption::FS_CHARSET, nullptr);
if (charset == nullptr) {
#ifdef WIN32
/* Glib claims that file system encoding is always utf-8
diff --git a/src/input/Init.cxx b/src/input/Init.cxx
index 9fbef934e..0debf6d43 100644
--- a/src/input/Init.cxx
+++ b/src/input/Init.cxx
@@ -43,7 +43,8 @@ input_stream_global_init(Error &error)
assert(plugin->open != nullptr);
const struct config_param *param =
- config_find_block(CONF_INPUT, "plugin", plugin->name);
+ config_find_block(ConfigOption::INPUT, "plugin",
+ plugin->name);
if (param == nullptr) {
param = &empty;
} else if (!param->GetBlockValue("enabled", true))
diff --git a/src/input/plugins/CurlInputPlugin.cxx b/src/input/plugins/CurlInputPlugin.cxx
index 114f03f3c..bdfcaf647 100644
--- a/src/input/plugins/CurlInputPlugin.cxx
+++ b/src/input/plugins/CurlInputPlugin.cxx
@@ -564,10 +564,10 @@ input_curl_init(const config_param &param, Error &error)
if (proxy == nullptr) {
/* deprecated proxy configuration */
- proxy = config_get_string(CONF_HTTP_PROXY_HOST, nullptr);
- proxy_port = config_get_positive(CONF_HTTP_PROXY_PORT, 0);
- proxy_user = config_get_string(CONF_HTTP_PROXY_USER, nullptr);
- proxy_password = config_get_string(CONF_HTTP_PROXY_PASSWORD,
+ proxy = config_get_string(ConfigOption::HTTP_PROXY_HOST, nullptr);
+ proxy_port = config_get_positive(ConfigOption::HTTP_PROXY_PORT, 0);
+ proxy_user = config_get_string(ConfigOption::HTTP_PROXY_USER, nullptr);
+ proxy_password = config_get_string(ConfigOption::HTTP_PROXY_PASSWORD,
"");
}
diff --git a/src/lib/despotify/DespotifyUtils.cxx b/src/lib/despotify/DespotifyUtils.cxx
index e62994c6a..c72715ace 100644
--- a/src/lib/despotify/DespotifyUtils.cxx
+++ b/src/lib/despotify/DespotifyUtils.cxx
@@ -124,9 +124,9 @@ mpd_despotify_get_session()
return g_session;
const char *const user =
- config_get_string(CONF_DESPOTIFY_USER, nullptr);
+ config_get_string(ConfigOption::DESPOTIFY_USER, nullptr);
const char *const passwd =
- config_get_string(CONF_DESPOTIFY_PASSWORD, nullptr);
+ config_get_string(ConfigOption::DESPOTIFY_PASSWORD, nullptr);
if (user == nullptr || passwd == nullptr) {
LogDebug(despotify_domain,
@@ -140,7 +140,7 @@ mpd_despotify_get_session()
}
const bool high_bitrate =
- config_get_bool(CONF_DESPOTIFY_HIGH_BITRATE, true);
+ config_get_bool(ConfigOption::DESPOTIFY_HIGH_BITRATE, true);
g_session = despotify_init_client(callback, nullptr,
high_bitrate, true);
if (!g_session) {
diff --git a/src/neighbor/Glue.cxx b/src/neighbor/Glue.cxx
index e5d67f962..57383b1d5 100644
--- a/src/neighbor/Glue.cxx
+++ b/src/neighbor/Glue.cxx
@@ -59,7 +59,7 @@ CreateNeighborExplorer(EventLoop &loop, NeighborListener &listener,
bool
NeighborGlue::Init(EventLoop &loop, NeighborListener &listener, Error &error)
{
- for (const config_param *param = config_get_param(CONF_NEIGHBORS);
+ for (const auto *param = config_get_param(ConfigOption::NEIGHBORS);
param != nullptr; param = param->next) {
NeighborExplorer *explorer =
CreateNeighborExplorer(loop, listener, *param, error);
diff --git a/src/output/Init.cxx b/src/output/Init.cxx
index 4a1217196..c4e4a1880 100644
--- a/src/output/Init.cxx
+++ b/src/output/Init.cxx
@@ -108,7 +108,7 @@ audio_output_mixer_type(const config_param &param)
/* fall back to the global "mixer_type" setting (also
deprecated) */
- return mixer_type_parse(config_get_string(CONF_MIXER_TYPE,
+ return mixer_type_parse(config_get_string(ConfigOption::MIXER_TYPE,
"hardware"));
}
@@ -191,7 +191,7 @@ AudioOutput::Configure(const config_param &param, Error &error)
/* create the normalization filter (if configured) */
- if (config_get_bool(CONF_VOLUME_NORMALIZATION, false)) {
+ if (config_get_bool(ConfigOption::VOLUME_NORMALIZATION, false)) {
Filter *normalize_filter =
filter_new(&normalize_filter_plugin, config_param(),
IgnoreError());
diff --git a/src/output/MultipleOutputs.cxx b/src/output/MultipleOutputs.cxx
index ba4423f77..83a8b98c9 100644
--- a/src/output/MultipleOutputs.cxx
+++ b/src/output/MultipleOutputs.cxx
@@ -74,7 +74,7 @@ LoadOutput(EventLoop &event_loop, MixerListener &mixer_listener,
void
MultipleOutputs::Configure(EventLoop &event_loop, PlayerControl &pc)
{
- for (const config_param *param = config_get_param(CONF_AUDIO_OUTPUT);
+ for (const auto *param = config_get_param(ConfigOption::AUDIO_OUTPUT);
param != nullptr; param = param->next) {
auto output = LoadOutput(event_loop, mixer_listener,
pc, *param);
diff --git a/src/pcm/ConfiguredResampler.cxx b/src/pcm/ConfiguredResampler.cxx
index db1f8d526..bf6ea58ee 100644
--- a/src/pcm/ConfiguredResampler.cxx
+++ b/src/pcm/ConfiguredResampler.cxx
@@ -53,7 +53,7 @@ bool
pcm_resampler_global_init(Error &error)
{
const char *converter =
- config_get_string(CONF_SAMPLERATE_CONVERTER, "");
+ config_get_string(ConfigOption::SAMPLERATE_CONVERTER, "");
if (strcmp(converter, "internal") == 0)
return true;
diff --git a/src/playlist/PlaylistRegistry.cxx b/src/playlist/PlaylistRegistry.cxx
index a1c0cd37a..a5a5319fc 100644
--- a/src/playlist/PlaylistRegistry.cxx
+++ b/src/playlist/PlaylistRegistry.cxx
@@ -81,9 +81,9 @@ playlist_list_global_init(void)
for (unsigned i = 0; playlist_plugins[i] != nullptr; ++i) {
const struct playlist_plugin *plugin = playlist_plugins[i];
- const struct config_param *param =
- config_find_block(CONF_PLAYLIST_PLUGIN, "name",
- plugin->name);
+ const auto *param =
+ config_find_block(ConfigOption::PLAYLIST_PLUGIN,
+ "name", plugin->name);
if (param == nullptr)
param = &empty;
else if (!param->GetBlockValue("enabled", true))
diff --git a/src/queue/PlaylistState.cxx b/src/queue/PlaylistState.cxx
index b19a948e4..c2dbd02b5 100644
--- a/src/queue/PlaylistState.cxx
+++ b/src/queue/PlaylistState.cxx
@@ -195,7 +195,7 @@ playlist_state_restore(const char *line, TextFile &file,
current = 0;
if (state == PlayerState::PLAY &&
- config_get_bool(CONF_RESTORE_PAUSED, false))
+ config_get_bool(ConfigOption::RESTORE_PAUSED, false))
/* the user doesn't want MPD to auto-start
playback after startup; fall back to
"pause" */
diff --git a/src/storage/Configured.cxx b/src/storage/Configured.cxx
index b0585c750..adb5c7dc5 100644
--- a/src/storage/Configured.cxx
+++ b/src/storage/Configured.cxx
@@ -44,7 +44,7 @@ CreateConfiguredStorageUri(EventLoop &event_loop, const char *uri,
static AllocatedPath
GetConfiguredMusicDirectory(Error &error)
{
- AllocatedPath path = config_get_path(CONF_MUSIC_DIR, error);
+ AllocatedPath path = config_get_path(ConfigOption::MUSIC_DIR, error);
if (path.IsNull() && !error.IsDefined())
path = GetUserMusicDir();
@@ -68,7 +68,7 @@ CreateConfiguredStorage(EventLoop &event_loop, Error &error)
{
assert(!error.IsDefined());
- auto uri = config_get_string(CONF_MUSIC_DIR, nullptr);
+ auto uri = config_get_string(ConfigOption::MUSIC_DIR, nullptr);
if (uri != nullptr && uri_has_scheme(uri))
return CreateConfiguredStorageUri(event_loop, uri, error);
@@ -78,5 +78,5 @@ CreateConfiguredStorage(EventLoop &event_loop, Error &error)
bool
IsStorageConfigured()
{
- return config_get_string(CONF_MUSIC_DIR, nullptr) != nullptr;
+ return config_get_string(ConfigOption::MUSIC_DIR, nullptr) != nullptr;
}
diff --git a/src/tag/TagConfig.cxx b/src/tag/TagConfig.cxx
index 49e6105cc..df40c2bc0 100644
--- a/src/tag/TagConfig.cxx
+++ b/src/tag/TagConfig.cxx
@@ -35,7 +35,8 @@
void
TagLoadConfig()
{
- const char *value = config_get_string(CONF_METADATA_TO_USE, nullptr);
+ const char *value = config_get_string(ConfigOption::METADATA_TO_USE,
+ nullptr);
if (value == nullptr)
return;
diff --git a/src/tag/TagId3.cxx b/src/tag/TagId3.cxx
index 2d64924d3..ade1fd007 100644
--- a/src/tag/TagId3.cxx
+++ b/src/tag/TagId3.cxx
@@ -99,7 +99,8 @@ import_id3_string(bool is_id3v1, const id3_ucs4_t *ucs4)
/* use encoding field here? */
const char *encoding;
if (is_id3v1 &&
- (encoding = config_get_string(CONF_ID3V1_ENCODING, nullptr)) != nullptr) {
+ (encoding = config_get_string(ConfigOption::ID3V1_ENCODING,
+ nullptr)) != nullptr) {
id3_latin1_t *isostr = id3_ucs4_latin1duplicate(ucs4);
if (gcc_unlikely(isostr == nullptr))
return nullptr;
diff --git a/src/zeroconf/ZeroconfGlue.cxx b/src/zeroconf/ZeroconfGlue.cxx
index 499b55000..f00395e7c 100644
--- a/src/zeroconf/ZeroconfGlue.cxx
+++ b/src/zeroconf/ZeroconfGlue.cxx
@@ -44,7 +44,7 @@ ZeroconfInit(gcc_unused EventLoop &loop)
{
const char *serviceName;
- zeroconfEnabled = config_get_bool(CONF_ZEROCONF_ENABLED,
+ zeroconfEnabled = config_get_bool(ConfigOption::ZEROCONF_ENABLED,
DEFAULT_ZEROCONF_ENABLED);
if (!zeroconfEnabled)
return;
@@ -56,7 +56,8 @@ ZeroconfInit(gcc_unused EventLoop &loop)
return;
}
- serviceName = config_get_string(CONF_ZEROCONF_NAME, SERVICE_NAME);
+ serviceName = config_get_string(ConfigOption::ZEROCONF_NAME,
+ SERVICE_NAME);
#ifdef HAVE_AVAHI
AvahiInit(loop, serviceName);