Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
1c3f5517
Commit
1c3f5517
authored
Jan 21, 2015
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
config/Option: convert to strictly-typed enum
parent
10972da0
Hide whitespace changes
Inline
Side-by-side
Showing
36 changed files
with
153 additions
and
132 deletions
+153
-132
AudioConfig.cxx
src/AudioConfig.cxx
+1
-1
Listen.cxx
src/Listen.cxx
+2
-2
LogInit.cxx
src/LogInit.cxx
+3
-3
Main.cxx
src/Main.cxx
+16
-14
Permission.cxx
src/Permission.cxx
+2
-2
PlaylistFile.cxx
src/PlaylistFile.cxx
+4
-3
ReplayGainConfig.cxx
src/ReplayGainConfig.cxx
+6
-4
ClientGlobal.cxx
src/client/ClientGlobal.cxx
+3
-3
ConfigFile.cxx
src/config/ConfigFile.cxx
+1
-1
ConfigOption.hxx
src/config/ConfigOption.hxx
+69
-59
ConfigPath.cxx
src/config/ConfigPath.cxx
+1
-1
ConfigTemplates.cxx
src/config/ConfigTemplates.cxx
+2
-2
Data.hxx
src/config/Data.hxx
+1
-1
Configured.cxx
src/db/Configured.cxx
+2
-2
Walk.cxx
src/db/update/Walk.cxx
+2
-2
DecoderList.cxx
src/decoder/DecoderList.cxx
+2
-1
MadDecoderPlugin.cxx
src/decoder/plugins/MadDecoderPlugin.cxx
+1
-1
FilterConfig.cxx
src/filter/FilterConfig.cxx
+2
-1
Config.cxx
src/fs/Config.cxx
+1
-1
Init.cxx
src/input/Init.cxx
+2
-1
CurlInputPlugin.cxx
src/input/plugins/CurlInputPlugin.cxx
+4
-4
DespotifyUtils.cxx
src/lib/despotify/DespotifyUtils.cxx
+3
-3
Glue.cxx
src/neighbor/Glue.cxx
+1
-1
Init.cxx
src/output/Init.cxx
+2
-2
MultipleOutputs.cxx
src/output/MultipleOutputs.cxx
+1
-1
ConfiguredResampler.cxx
src/pcm/ConfiguredResampler.cxx
+1
-1
PlaylistRegistry.cxx
src/playlist/PlaylistRegistry.cxx
+3
-3
PlaylistState.cxx
src/queue/PlaylistState.cxx
+1
-1
Configured.cxx
src/storage/Configured.cxx
+3
-3
TagConfig.cxx
src/tag/TagConfig.cxx
+2
-1
TagId3.cxx
src/tag/TagId3.cxx
+2
-1
ZeroconfGlue.cxx
src/zeroconf/ZeroconfGlue.cxx
+3
-2
DumpDatabase.cxx
test/DumpDatabase.cxx
+1
-1
read_conf.cxx
test/read_conf.cxx
+1
-1
run_filter.cxx
test/run_filter.cxx
+1
-1
run_output.cxx
test/run_output.cxx
+1
-1
No files found.
src/AudioConfig.cxx
View file @
1c3f5517
...
...
@@ -39,7 +39,7 @@ getOutputAudioFormat(AudioFormat inAudioFormat)
void
initAudioConfig
(
void
)
{
const
struct
config_param
*
param
=
config_get_param
(
C
ONF_
AUDIO_OUTPUT_FORMAT
);
const
struct
config_param
*
param
=
config_get_param
(
C
onfigOption
::
AUDIO_OUTPUT_FORMAT
);
if
(
param
==
nullptr
)
return
;
...
...
src/Listen.cxx
View file @
1c3f5517
...
...
@@ -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
(
C
ONF_
PORT
,
DEFAULT_PORT
);
int
port
=
config_get_positive
(
C
onfigOption
::
PORT
,
DEFAULT_PORT
);
const
struct
config_param
*
param
=
config_get_param
(
C
ONF_
BIND_TO_ADDRESS
);
config_get_param
(
C
onfigOption
::
BIND_TO_ADDRESS
);
listen_socket
=
new
ClientListener
(
loop
,
partition
);
...
...
src/LogInit.cxx
View file @
1c3f5517
...
...
@@ -139,14 +139,14 @@ log_init(bool verbose, bool use_stdout, Error &error)
if
(
verbose
)
SetLogThreshold
(
LogLevel
::
DEBUG
);
else
if
((
param
=
config_get_param
(
C
ONF_
LOG_LEVEL
))
!=
nullptr
)
else
if
((
param
=
config_get_param
(
C
onfigOption
::
LOG_LEVEL
))
!=
nullptr
)
SetLogThreshold
(
parse_log_level
(
param
->
value
.
c_str
(),
param
->
line
));
if
(
use_stdout
)
{
return
true
;
}
else
{
param
=
config_get_param
(
C
ONF_
LOG_FILE
);
param
=
config_get_param
(
C
onfigOption
::
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
(
C
ONF_
LOG_FILE
,
error
);
out_path
=
config_get_path
(
C
onfigOption
::
LOG_FILE
,
error
);
return
!
out_path
.
IsNull
()
&&
log_init_file
(
param
->
line
,
error
);
}
...
...
src/Main.cxx
View file @
1c3f5517
...
...
@@ -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
(
C
ONF_
PID_FILE
,
error
);
auto
pid_file
=
config_get_path
(
C
onfigOption
::
PID_FILE
,
error
);
if
(
pid_file
.
IsNull
()
&&
error
.
IsDefined
())
return
false
;
daemonize_init
(
config_get_string
(
C
ONF_
USER
,
nullptr
),
config_get_string
(
C
ONF_
GROUP
,
nullptr
),
daemonize_init
(
config_get_string
(
C
onfigOption
::
USER
,
nullptr
),
config_get_string
(
C
onfigOption
::
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
(
C
ONF_
PLAYLIST_DIR
,
error
);
auto
playlist_dir
=
config_get_path
(
C
onfigOption
::
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
(
C
ONF_
STICKER_FILE
,
error
);
auto
sticker_file
=
config_get_path
(
C
onfigOption
::
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
(
C
ONF_
STATE_FILE
,
error
);
auto
path_fs
=
config_get_path
(
C
onfigOption
::
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
(
C
ONF_
AUDIO_BUFFER_SIZE
);
param
=
config_get_param
(
C
onfigOption
::
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
(
C
ONF_
BUFFER_BEFORE_PLAY
);
param
=
config_get_param
(
C
onfigOption
::
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
(
C
ONF_
MAX_PLAYLIST_LENGTH
,
config_get_positive
(
C
onfigOption
::
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
(
C
ONF_
AUTO_UPDATE
,
false
))
{
if
(
config_get_bool
(
C
onfigOption
::
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
(
C
ONF_
AUTO_UPDATE_DEPTH
,
config_get_unsigned
(
C
onfigOption
::
AUTO_UPDATE_DEPTH
,
INT_MAX
));
#else
FormatWarning
(
main_domain
,
...
...
src/Permission.cxx
View file @
1c3f5517
...
...
@@ -92,7 +92,7 @@ void initPermissions(void)
permission_default
=
PERMISSION_READ
|
PERMISSION_ADD
|
PERMISSION_CONTROL
|
PERMISSION_ADMIN
;
param
=
config_get_param
(
C
ONF_
PASSWORD
);
param
=
config_get_param
(
C
onfigOption
::
PASSWORD
);
if
(
param
)
{
permission_default
=
0
;
...
...
@@ -118,7 +118,7 @@ void initPermissions(void)
}
while
((
param
=
param
->
next
)
!=
nullptr
);
}
param
=
config_get_param
(
C
ONF_
DEFAULT_PERMS
);
param
=
config_get_param
(
C
onfigOption
::
DEFAULT_PERMS
);
if
(
param
)
permission_default
=
parsePermissions
(
param
->
value
.
c_str
());
...
...
src/PlaylistFile.cxx
View file @
1c3f5517
...
...
@@ -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
(
C
ONF_
SAVE_ABSOLUTE_PATHS
,
config_get_bool
(
C
onfigOption
::
SAVE_ABSOLUTE_PATHS
,
DEFAULT_PLAYLIST_SAVE_ABSOLUTE_PATHS
);
}
...
...
src/ReplayGainConfig.cxx
View file @
1c3f5517
...
...
@@ -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
(
C
ONF_
REPLAYGAIN_PREAMP
);
param
=
config_get_param
(
C
onfigOption
::
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
(
C
ONF_
REPLAYGAIN_MISSING_PREAMP
);
param
=
config_get_param
(
C
onfigOption
::
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
...
...
src/client/ClientGlobal.cxx
View file @
1c3f5517
...
...
@@ -31,15 +31,15 @@ size_t client_max_output_buffer_size;
void
client_manager_init
(
void
)
{
client_timeout
=
config_get_positive
(
C
ONF_
CONN_TIMEOUT
,
client_timeout
=
config_get_positive
(
C
onfigOption
::
CONN_TIMEOUT
,
CLIENT_TIMEOUT_DEFAULT
);
client_max_command_list_size
=
config_get_positive
(
C
ONF_
MAX_COMMAND_LIST_SIZE
,
config_get_positive
(
C
onfigOption
::
MAX_COMMAND_LIST_SIZE
,
CLIENT_MAX_COMMAND_LIST_DEFAULT
/
1024
)
*
1024
;
client_max_output_buffer_size
=
config_get_positive
(
C
ONF_
MAX_OUTPUT_BUFFER_SIZE
,
config_get_positive
(
C
onfigOption
::
MAX_OUTPUT_BUFFER_SIZE
,
CLIENT_MAX_OUTPUT_BUFFER_SIZE_DEFAULT
/
1024
)
*
1024
;
}
src/config/ConfigFile.cxx
View file @
1c3f5517
...
...
@@ -175,7 +175,7 @@ ReadConfigFile(ConfigData &config_data, FILE *fp, Error &error)
"repeatable" flag */
const
ConfigOption
o
=
ParseConfigOptionName
(
name
);
if
(
o
==
C
ONF_
MAX
)
{
if
(
o
==
C
onfigOption
::
MAX
)
{
error
.
Format
(
config_file_domain
,
"unrecognized parameter in config file at "
"line %i: %s
\n
"
,
count
,
name
);
...
...
src/config/ConfigOption.hxx
View file @
1c3f5517
...
...
@@ -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 #C
ONF_
MAX if not found
* @return #C
onfigOption::
MAX if not found
*/
gcc_pure
enum
ConfigOption
...
...
src/config/ConfigPath.cxx
View file @
1c3f5517
...
...
@@ -70,7 +70,7 @@ GetHome(Error &error)
static
AllocatedPath
GetConfiguredHome
(
Error
&
error
)
{
const
char
*
user
=
config_get_string
(
C
ONF_
USER
,
nullptr
);
const
char
*
user
=
config_get_string
(
C
onfigOption
::
USER
,
nullptr
);
return
user
!=
nullptr
?
GetHome
(
user
,
error
)
:
GetHome
(
error
);
...
...
src/config/ConfigTemplates.cxx
View file @
1c3f5517
...
...
@@ -84,7 +84,7 @@ const ConfigTemplate config_templates[] = {
static
constexpr
unsigned
n_config_templates
=
ARRAY_SIZE
(
config_templates
);
static_assert
(
n_config_templates
==
unsigned
(
C
ONF_
MAX
),
static_assert
(
n_config_templates
==
unsigned
(
C
onfigOption
::
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
C
ONF_
MAX
;
return
C
onfigOption
::
MAX
;
}
src/config/Data.hxx
View file @
1c3f5517
...
...
@@ -27,7 +27,7 @@
struct
config_param
;
struct
ConfigData
{
std
::
array
<
config_param
*
,
std
::
size_t
(
C
ONF_
MAX
)
>
params
;
std
::
array
<
config_param
*
,
std
::
size_t
(
C
onfigOption
::
MAX
)
>
params
;
void
Clear
();
};
...
...
src/db/Configured.cxx
View file @
1c3f5517
...
...
@@ -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
,
...
...
src/db/update/Walk.cxx
View file @
1c3f5517
...
...
@@ -57,11 +57,11 @@ UpdateWalk::UpdateWalk(EventLoop &_loop, DatabaseListener &_listener,
{
#ifndef WIN32
follow_inside_symlinks
=
config_get_bool
(
C
ONF_
FOLLOW_INSIDE_SYMLINKS
,
config_get_bool
(
C
onfigOption
::
FOLLOW_INSIDE_SYMLINKS
,
DEFAULT_FOLLOW_INSIDE_SYMLINKS
);
follow_outside_symlinks
=
config_get_bool
(
C
ONF_
FOLLOW_OUTSIDE_SYMLINKS
,
config_get_bool
(
C
onfigOption
::
FOLLOW_OUTSIDE_SYMLINKS
,
DEFAULT_FOLLOW_OUTSIDE_SYMLINKS
);
#endif
}
...
...
src/decoder/DecoderList.cxx
View file @
1c3f5517
...
...
@@ -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
;
...
...
src/decoder/plugins/MadDecoderPlugin.cxx
View file @
1c3f5517
...
...
@@ -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
(
C
ONF_
GAPLESS_MP3_PLAYBACK
,
gapless_playback
=
config_get_bool
(
C
onfigOption
::
GAPLESS_MP3_PLAYBACK
,
DEFAULT_GAPLESS_MP3_PLAYBACK
);
return
true
;
}
...
...
src/filter/FilterConfig.cxx
View file @
1c3f5517
...
...
@@ -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"
,
...
...
src/fs/Config.cxx
View file @
1c3f5517
...
...
@@ -35,7 +35,7 @@ ConfigureFS(Error &error)
#ifdef HAVE_FS_CHARSET
const
char
*
charset
=
nullptr
;
charset
=
config_get_string
(
C
ONF_
FS_CHARSET
,
nullptr
);
charset
=
config_get_string
(
C
onfigOption
::
FS_CHARSET
,
nullptr
);
if
(
charset
==
nullptr
)
{
#ifdef WIN32
/* Glib claims that file system encoding is always utf-8
...
...
src/input/Init.cxx
View file @
1c3f5517
...
...
@@ -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
))
...
...
src/input/plugins/CurlInputPlugin.cxx
View file @
1c3f5517
...
...
@@ -564,10 +564,10 @@ input_curl_init(const config_param ¶m, Error &error)
if
(
proxy
==
nullptr
)
{
/* deprecated proxy configuration */
proxy
=
config_get_string
(
C
ONF_
HTTP_PROXY_HOST
,
nullptr
);
proxy_port
=
config_get_positive
(
C
ONF_
HTTP_PROXY_PORT
,
0
);
proxy_user
=
config_get_string
(
C
ONF_
HTTP_PROXY_USER
,
nullptr
);
proxy_password
=
config_get_string
(
C
ONF_
HTTP_PROXY_PASSWORD
,
proxy
=
config_get_string
(
C
onfigOption
::
HTTP_PROXY_HOST
,
nullptr
);
proxy_port
=
config_get_positive
(
C
onfigOption
::
HTTP_PROXY_PORT
,
0
);
proxy_user
=
config_get_string
(
C
onfigOption
::
HTTP_PROXY_USER
,
nullptr
);
proxy_password
=
config_get_string
(
C
onfigOption
::
HTTP_PROXY_PASSWORD
,
""
);
}
...
...
src/lib/despotify/DespotifyUtils.cxx
View file @
1c3f5517
...
...
@@ -124,9 +124,9 @@ mpd_despotify_get_session()
return
g_session
;
const
char
*
const
user
=
config_get_string
(
C
ONF_
DESPOTIFY_USER
,
nullptr
);
config_get_string
(
C
onfigOption
::
DESPOTIFY_USER
,
nullptr
);
const
char
*
const
passwd
=
config_get_string
(
C
ONF_
DESPOTIFY_PASSWORD
,
nullptr
);
config_get_string
(
C
onfigOption
::
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
(
C
ONF_
DESPOTIFY_HIGH_BITRATE
,
true
);
config_get_bool
(
C
onfigOption
::
DESPOTIFY_HIGH_BITRATE
,
true
);
g_session
=
despotify_init_client
(
callback
,
nullptr
,
high_bitrate
,
true
);
if
(
!
g_session
)
{
...
...
src/neighbor/Glue.cxx
View file @
1c3f5517
...
...
@@ -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
);
...
...
src/output/Init.cxx
View file @
1c3f5517
...
...
@@ -108,7 +108,7 @@ audio_output_mixer_type(const config_param ¶m)
/* fall back to the global "mixer_type" setting (also
deprecated) */
return
mixer_type_parse
(
config_get_string
(
C
ONF_
MIXER_TYPE
,
return
mixer_type_parse
(
config_get_string
(
C
onfigOption
::
MIXER_TYPE
,
"hardware"
));
}
...
...
@@ -191,7 +191,7 @@ AudioOutput::Configure(const config_param ¶m, Error &error)
/* create the normalization filter (if configured) */
if
(
config_get_bool
(
C
ONF_
VOLUME_NORMALIZATION
,
false
))
{
if
(
config_get_bool
(
C
onfigOption
::
VOLUME_NORMALIZATION
,
false
))
{
Filter
*
normalize_filter
=
filter_new
(
&
normalize_filter_plugin
,
config_param
(),
IgnoreError
());
...
...
src/output/MultipleOutputs.cxx
View file @
1c3f5517
...
...
@@ -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
);
...
...
src/pcm/ConfiguredResampler.cxx
View file @
1c3f5517
...
...
@@ -53,7 +53,7 @@ bool
pcm_resampler_global_init
(
Error
&
error
)
{
const
char
*
converter
=
config_get_string
(
C
ONF_
SAMPLERATE_CONVERTER
,
""
);
config_get_string
(
C
onfigOption
::
SAMPLERATE_CONVERTER
,
""
);
if
(
strcmp
(
converter
,
"internal"
)
==
0
)
return
true
;
...
...
src/playlist/PlaylistRegistry.cxx
View file @
1c3f5517
...
...
@@ -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
(
C
ONF_PLAYLIST_PLUGIN
,
"name"
,
plugin
->
name
);
const
auto
*
param
=
config_find_block
(
C
onfigOption
::
PLAYLIST_PLUGIN
,
"name"
,
plugin
->
name
);
if
(
param
==
nullptr
)
param
=
&
empty
;
else
if
(
!
param
->
GetBlockValue
(
"enabled"
,
true
))
...
...
src/queue/PlaylistState.cxx
View file @
1c3f5517
...
...
@@ -195,7 +195,7 @@ playlist_state_restore(const char *line, TextFile &file,
current
=
0
;
if
(
state
==
PlayerState
::
PLAY
&&
config_get_bool
(
C
ONF_
RESTORE_PAUSED
,
false
))
config_get_bool
(
C
onfigOption
::
RESTORE_PAUSED
,
false
))
/* the user doesn't want MPD to auto-start
playback after startup; fall back to
"pause" */
...
...
src/storage/Configured.cxx
View file @
1c3f5517
...
...
@@ -44,7 +44,7 @@ CreateConfiguredStorageUri(EventLoop &event_loop, const char *uri,
static
AllocatedPath
GetConfiguredMusicDirectory
(
Error
&
error
)
{
AllocatedPath
path
=
config_get_path
(
C
ONF_
MUSIC_DIR
,
error
);
AllocatedPath
path
=
config_get_path
(
C
onfigOption
::
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
(
C
ONF_
MUSIC_DIR
,
nullptr
);
auto
uri
=
config_get_string
(
C
onfigOption
::
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
(
C
ONF_
MUSIC_DIR
,
nullptr
)
!=
nullptr
;
return
config_get_string
(
C
onfigOption
::
MUSIC_DIR
,
nullptr
)
!=
nullptr
;
}
src/tag/TagConfig.cxx
View file @
1c3f5517
...
...
@@ -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
;
...
...
src/tag/TagId3.cxx
View file @
1c3f5517
...
...
@@ -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
;
...
...
src/zeroconf/ZeroconfGlue.cxx
View file @
1c3f5517
...
...
@@ -44,7 +44,7 @@ ZeroconfInit(gcc_unused EventLoop &loop)
{
const
char
*
serviceName
;
zeroconfEnabled
=
config_get_bool
(
C
ONF_
ZEROCONF_ENABLED
,
zeroconfEnabled
=
config_get_bool
(
C
onfigOption
::
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
);
...
...
test/DumpDatabase.cxx
View file @
1c3f5517
...
...
@@ -120,7 +120,7 @@ main(int argc, char **argv)
/* do it */
const
struct
config_param
*
path
=
config_get_param
(
CONF_
DB_FILE
);
const
auto
*
path
=
config_get_param
(
ConfigOption
::
DB_FILE
);
config_param
param
(
"database"
,
path
!=
nullptr
?
path
->
line
:
-
1
);
if
(
path
!=
nullptr
)
param
.
AddBlockParam
(
"path"
,
path
->
value
.
c_str
(),
path
->
line
);
...
...
test/read_conf.cxx
View file @
1c3f5517
...
...
@@ -46,7 +46,7 @@ int main(int argc, char **argv)
}
ConfigOption
option
=
ParseConfigOptionName
(
name
);
const
char
*
value
=
option
!=
C
ONF_
MAX
const
char
*
value
=
option
!=
C
onfigOption
::
MAX
?
config_get_string
(
option
,
nullptr
)
:
nullptr
;
int
ret
;
...
...
test/run_filter.cxx
View file @
1c3f5517
...
...
@@ -51,7 +51,7 @@ static Filter *
load_filter
(
const
char
*
name
)
{
const
config_param
*
param
=
config_find_block
(
C
ONF_
AUDIO_FILTER
,
"name"
,
name
);
config_find_block
(
C
onfigOption
::
AUDIO_FILTER
,
"name"
,
name
);
if
(
param
==
NULL
)
{
fprintf
(
stderr
,
"No such configured filter: %s
\n
"
,
name
);
return
nullptr
;
...
...
test/run_output.cxx
View file @
1c3f5517
...
...
@@ -62,7 +62,7 @@ static AudioOutput *
load_audio_output
(
EventLoop
&
event_loop
,
const
char
*
name
)
{
const
config_param
*
param
=
config_find_block
(
C
ONF_
AUDIO_OUTPUT
,
"name"
,
name
);
config_find_block
(
C
onfigOption
::
AUDIO_OUTPUT
,
"name"
,
name
);
if
(
param
==
NULL
)
{
fprintf
(
stderr
,
"No such configured audio output: %s
\n
"
,
name
);
return
nullptr
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment