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
5b2b4bf1
Commit
5b2b4bf1
authored
Oct 28, 2016
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
config/Param: use CamelCase
parent
4bd67bc2
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
39 additions
and
44 deletions
+39
-44
AudioConfig.cxx
src/AudioConfig.cxx
+1
-1
Listen.cxx
src/Listen.cxx
+2
-3
LogInit.cxx
src/LogInit.cxx
+2
-4
Main.cxx
src/Main.cxx
+1
-1
Permission.cxx
src/Permission.cxx
+1
-1
ReplayGainConfig.cxx
src/ReplayGainConfig.cxx
+1
-2
ConfigFile.cxx
src/config/ConfigFile.cxx
+5
-5
ConfigGlobal.cxx
src/config/ConfigGlobal.cxx
+8
-8
ConfigGlobal.hxx
src/config/ConfigGlobal.hxx
+3
-3
Data.hxx
src/config/Data.hxx
+2
-2
Param.cxx
src/config/Param.cxx
+2
-2
Param.hxx
src/config/Param.hxx
+8
-8
Glue.hxx
src/neighbor/Glue.hxx
+0
-1
OutputPlugin.hxx
src/output/OutputPlugin.hxx
+1
-1
ConfiguredResampler.cxx
src/pcm/ConfiguredResampler.cxx
+2
-2
No files found.
src/AudioConfig.cxx
View file @
5b2b4bf1
...
@@ -39,7 +39,7 @@ getOutputAudioFormat(AudioFormat inAudioFormat)
...
@@ -39,7 +39,7 @@ getOutputAudioFormat(AudioFormat inAudioFormat)
void
initAudioConfig
(
void
)
void
initAudioConfig
(
void
)
{
{
const
struct
config_param
*
param
=
config_get_param
(
ConfigOption
::
AUDIO_OUTPUT_FORMAT
);
const
auto
*
param
=
config_get_param
(
ConfigOption
::
AUDIO_OUTPUT_FORMAT
);
if
(
param
==
nullptr
)
if
(
param
==
nullptr
)
return
;
return
;
...
...
src/Listen.cxx
View file @
5b2b4bf1
...
@@ -60,7 +60,7 @@ int listen_port;
...
@@ -60,7 +60,7 @@ int listen_port;
static
bool
static
bool
listen_add_config_param
(
unsigned
int
port
,
listen_add_config_param
(
unsigned
int
port
,
const
struct
config_p
aram
*
param
,
const
ConfigP
aram
*
param
,
Error
&
error_r
)
Error
&
error_r
)
{
{
assert
(
param
!=
nullptr
);
assert
(
param
!=
nullptr
);
...
@@ -104,8 +104,7 @@ bool
...
@@ -104,8 +104,7 @@ bool
listen_global_init
(
EventLoop
&
loop
,
Partition
&
partition
,
Error
&
error
)
listen_global_init
(
EventLoop
&
loop
,
Partition
&
partition
,
Error
&
error
)
{
{
int
port
=
config_get_positive
(
ConfigOption
::
PORT
,
DEFAULT_PORT
);
int
port
=
config_get_positive
(
ConfigOption
::
PORT
,
DEFAULT_PORT
);
const
struct
config_param
*
param
=
const
auto
*
param
=
config_get_param
(
ConfigOption
::
BIND_TO_ADDRESS
);
config_get_param
(
ConfigOption
::
BIND_TO_ADDRESS
);
listen_socket
=
new
ClientListener
(
loop
,
partition
);
listen_socket
=
new
ClientListener
(
loop
,
partition
);
...
...
src/LogInit.cxx
View file @
5b2b4bf1
...
@@ -124,18 +124,16 @@ log_init(bool verbose, bool use_stdout, Error &error)
...
@@ -124,18 +124,16 @@ log_init(bool verbose, bool use_stdout, Error &error)
return
true
;
return
true
;
#else
#else
const
struct
config_param
*
param
;
if
(
verbose
)
if
(
verbose
)
SetLogThreshold
(
LogLevel
::
DEBUG
);
SetLogThreshold
(
LogLevel
::
DEBUG
);
else
if
(
(
param
=
config_get_param
(
ConfigOption
::
LOG_LEVEL
))
!=
nullptr
)
else
if
(
const
auto
&
param
=
config_get_param
(
ConfigOption
::
LOG_LEVEL
)
)
SetLogThreshold
(
parse_log_level
(
param
->
value
.
c_str
(),
SetLogThreshold
(
parse_log_level
(
param
->
value
.
c_str
(),
param
->
line
));
param
->
line
));
if
(
use_stdout
)
{
if
(
use_stdout
)
{
return
true
;
return
true
;
}
else
{
}
else
{
param
=
config_get_param
(
ConfigOption
::
LOG_FILE
);
const
auto
*
param
=
config_get_param
(
ConfigOption
::
LOG_FILE
);
if
(
param
==
nullptr
)
{
if
(
param
==
nullptr
)
{
#ifdef HAVE_SYSLOG
#ifdef HAVE_SYSLOG
/* no configuration: default to syslog (if
/* no configuration: default to syslog (if
...
...
src/Main.cxx
View file @
5b2b4bf1
...
@@ -307,7 +307,7 @@ static void winsock_init(void)
...
@@ -307,7 +307,7 @@ static void winsock_init(void)
static
void
static
void
initialize_decoder_and_player
(
void
)
initialize_decoder_and_player
(
void
)
{
{
const
struct
config_p
aram
*
param
;
const
ConfigP
aram
*
param
;
size_t
buffer_size
;
size_t
buffer_size
;
param
=
config_get_param
(
ConfigOption
::
AUDIO_BUFFER_SIZE
);
param
=
config_get_param
(
ConfigOption
::
AUDIO_BUFFER_SIZE
);
...
...
src/Permission.cxx
View file @
5b2b4bf1
...
@@ -87,7 +87,7 @@ static unsigned parsePermissions(const char *string)
...
@@ -87,7 +87,7 @@ static unsigned parsePermissions(const char *string)
void
initPermissions
(
void
)
void
initPermissions
(
void
)
{
{
unsigned
permission
;
unsigned
permission
;
const
struct
config_p
aram
*
param
;
const
ConfigP
aram
*
param
;
permission_default
=
PERMISSION_READ
|
PERMISSION_ADD
|
permission_default
=
PERMISSION_READ
|
PERMISSION_ADD
|
PERMISSION_CONTROL
|
PERMISSION_ADMIN
;
PERMISSION_CONTROL
|
PERMISSION_ADMIN
;
...
...
src/ReplayGainConfig.cxx
View file @
5b2b4bf1
...
@@ -78,8 +78,7 @@ replay_gain_set_mode_string(const char *p)
...
@@ -78,8 +78,7 @@ replay_gain_set_mode_string(const char *p)
void
replay_gain_global_init
(
void
)
void
replay_gain_global_init
(
void
)
{
{
const
struct
config_param
*
param
=
const
auto
*
param
=
config_get_param
(
ConfigOption
::
REPLAYGAIN
);
config_get_param
(
ConfigOption
::
REPLAYGAIN
);
if
(
param
!=
nullptr
&&
if
(
param
!=
nullptr
&&
!
replay_gain_set_mode_string
(
param
->
value
.
c_str
()))
{
!
replay_gain_set_mode_string
(
param
->
value
.
c_str
()))
{
...
...
src/config/ConfigFile.cxx
View file @
5b2b4bf1
...
@@ -145,11 +145,11 @@ ReadConfigBlock(ConfigData &config_data, BufferedReader &reader,
...
@@ -145,11 +145,11 @@ ReadConfigBlock(ConfigData &config_data, BufferedReader &reader,
gcc_nonnull_all
gcc_nonnull_all
static
void
static
void
Append
(
config_param
*&
head
,
config_p
aram
*
p
)
Append
(
ConfigParam
*&
head
,
ConfigP
aram
*
p
)
{
{
assert
(
p
->
next
==
nullptr
);
assert
(
p
->
next
==
nullptr
);
config_param
**
i
=
&
head
;
auto
**
i
=
&
head
;
while
(
*
i
!=
nullptr
)
while
(
*
i
!=
nullptr
)
i
=
&
(
*
i
)
->
next
;
i
=
&
(
*
i
)
->
next
;
...
@@ -163,10 +163,10 @@ ReadConfigParam(ConfigData &config_data, BufferedReader &reader,
...
@@ -163,10 +163,10 @@ ReadConfigParam(ConfigData &config_data, BufferedReader &reader,
{
{
const
unsigned
i
=
unsigned
(
o
);
const
unsigned
i
=
unsigned
(
o
);
const
ConfigTemplate
&
option
=
config_param_templates
[
i
];
const
ConfigTemplate
&
option
=
config_param_templates
[
i
];
config_param
*&
head
=
config_data
.
params
[
i
];
auto
*&
head
=
config_data
.
params
[
i
];
if
(
head
!=
nullptr
&&
!
option
.
repeatable
)
{
if
(
head
!=
nullptr
&&
!
option
.
repeatable
)
{
struct
config_param
*
param
=
head
;
auto
*
param
=
head
;
throw
FormatRuntimeError
(
"config parameter
\"
%s
\"
is first defined "
throw
FormatRuntimeError
(
"config parameter
\"
%s
\"
is first defined "
"on line %d and redefined on line %u
\n
"
,
"on line %d and redefined on line %u
\n
"
,
name
,
param
->
line
,
name
,
param
->
line
,
...
@@ -184,7 +184,7 @@ ReadConfigParam(ConfigData &config_data, BufferedReader &reader,
...
@@ -184,7 +184,7 @@ ReadConfigParam(ConfigData &config_data, BufferedReader &reader,
throw
FormatRuntimeError
(
"line %u: Unknown tokens after value"
,
throw
FormatRuntimeError
(
"line %u: Unknown tokens after value"
,
reader
.
GetLineNumber
());
reader
.
GetLineNumber
());
auto
*
param
=
new
config_p
aram
(
value
,
reader
.
GetLineNumber
());
auto
*
param
=
new
ConfigP
aram
(
value
,
reader
.
GetLineNumber
());
Append
(
head
,
param
);
Append
(
head
,
param
);
}
}
...
...
src/config/ConfigGlobal.cxx
View file @
5b2b4bf1
...
@@ -75,10 +75,10 @@ void config_global_check(void)
...
@@ -75,10 +75,10 @@ void config_global_check(void)
Check
(
*
p
);
Check
(
*
p
);
}
}
const
config_p
aram
*
const
ConfigP
aram
*
config_get_param
(
ConfigOption
option
)
config_get_param
(
ConfigOption
option
)
{
{
config_param
*
param
=
config_data
.
params
[
unsigned
(
option
)];
auto
*
param
=
config_data
.
params
[
unsigned
(
option
)];
if
(
param
!=
nullptr
)
if
(
param
!=
nullptr
)
param
->
used
=
true
;
param
->
used
=
true
;
return
param
;
return
param
;
...
@@ -113,7 +113,7 @@ config_find_block(ConfigBlockOption option, const char *key, const char *value)
...
@@ -113,7 +113,7 @@ config_find_block(ConfigBlockOption option, const char *key, const char *value)
const
char
*
const
char
*
config_get_string
(
ConfigOption
option
,
const
char
*
default_value
)
config_get_string
(
ConfigOption
option
,
const
char
*
default_value
)
{
{
const
struct
config_param
*
param
=
config_get_param
(
option
);
const
auto
*
param
=
config_get_param
(
option
);
if
(
param
==
nullptr
)
if
(
param
==
nullptr
)
return
default_value
;
return
default_value
;
...
@@ -124,7 +124,7 @@ config_get_string(ConfigOption option, const char *default_value)
...
@@ -124,7 +124,7 @@ config_get_string(ConfigOption option, const char *default_value)
AllocatedPath
AllocatedPath
config_get_path
(
ConfigOption
option
,
Error
&
error
)
config_get_path
(
ConfigOption
option
,
Error
&
error
)
{
{
const
struct
config_param
*
param
=
config_get_param
(
option
);
const
auto
*
param
=
config_get_param
(
option
);
if
(
param
==
nullptr
)
if
(
param
==
nullptr
)
return
AllocatedPath
::
Null
();
return
AllocatedPath
::
Null
();
...
@@ -132,7 +132,7 @@ config_get_path(ConfigOption option, Error &error)
...
@@ -132,7 +132,7 @@ config_get_path(ConfigOption option, Error &error)
}
}
AllocatedPath
AllocatedPath
config_parse_path
(
const
struct
config_p
aram
*
param
,
Error
&
error
)
config_parse_path
(
const
ConfigP
aram
*
param
,
Error
&
error
)
{
{
AllocatedPath
path
=
ParsePath
(
param
->
value
.
c_str
(),
error
);
AllocatedPath
path
=
ParsePath
(
param
->
value
.
c_str
(),
error
);
if
(
gcc_unlikely
(
path
.
IsNull
()))
if
(
gcc_unlikely
(
path
.
IsNull
()))
...
@@ -145,7 +145,7 @@ config_parse_path(const struct config_param *param, Error & error)
...
@@ -145,7 +145,7 @@ config_parse_path(const struct config_param *param, Error & error)
unsigned
unsigned
config_get_unsigned
(
ConfigOption
option
,
unsigned
default_value
)
config_get_unsigned
(
ConfigOption
option
,
unsigned
default_value
)
{
{
const
struct
config_param
*
param
=
config_get_param
(
option
);
const
auto
*
param
=
config_get_param
(
option
);
long
value
;
long
value
;
char
*
endptr
;
char
*
endptr
;
...
@@ -163,7 +163,7 @@ config_get_unsigned(ConfigOption option, unsigned default_value)
...
@@ -163,7 +163,7 @@ config_get_unsigned(ConfigOption option, unsigned default_value)
unsigned
unsigned
config_get_positive
(
ConfigOption
option
,
unsigned
default_value
)
config_get_positive
(
ConfigOption
option
,
unsigned
default_value
)
{
{
const
struct
config_param
*
param
=
config_get_param
(
option
);
const
auto
*
param
=
config_get_param
(
option
);
long
value
;
long
value
;
char
*
endptr
;
char
*
endptr
;
...
@@ -184,7 +184,7 @@ config_get_positive(ConfigOption option, unsigned default_value)
...
@@ -184,7 +184,7 @@ config_get_positive(ConfigOption option, unsigned default_value)
bool
bool
config_get_bool
(
ConfigOption
option
,
bool
default_value
)
config_get_bool
(
ConfigOption
option
,
bool
default_value
)
{
{
const
struct
config_param
*
param
=
config_get_param
(
option
);
const
auto
*
param
=
config_get_param
(
option
);
bool
success
,
value
;
bool
success
,
value
;
if
(
param
==
nullptr
)
if
(
param
==
nullptr
)
...
...
src/config/ConfigGlobal.hxx
View file @
5b2b4bf1
...
@@ -26,7 +26,7 @@
...
@@ -26,7 +26,7 @@
class
Error
;
class
Error
;
class
Path
;
class
Path
;
class
AllocatedPath
;
class
AllocatedPath
;
struct
config_p
aram
;
struct
ConfigP
aram
;
struct
ConfigBlock
;
struct
ConfigBlock
;
void
void
...
@@ -46,7 +46,7 @@ void
...
@@ -46,7 +46,7 @@ void
ReadConfigFile
(
Path
path
);
ReadConfigFile
(
Path
path
);
gcc_pure
gcc_pure
const
config_p
aram
*
const
ConfigP
aram
*
config_get_param
(
enum
ConfigOption
option
);
config_get_param
(
enum
ConfigOption
option
);
gcc_pure
gcc_pure
...
@@ -90,7 +90,7 @@ config_get_path(enum ConfigOption option, Error &error);
...
@@ -90,7 +90,7 @@ config_get_path(enum ConfigOption option, Error &error);
* not be parsed, returns AllocatedPath::Null() and sets the error.
* not be parsed, returns AllocatedPath::Null() and sets the error.
*/
*/
AllocatedPath
AllocatedPath
config_parse_path
(
const
struct
config_p
aram
*
param
,
Error
&
error_r
);
config_parse_path
(
const
ConfigP
aram
*
param
,
Error
&
error_r
);
gcc_pure
gcc_pure
unsigned
unsigned
...
...
src/config/Data.hxx
View file @
5b2b4bf1
...
@@ -24,11 +24,11 @@
...
@@ -24,11 +24,11 @@
#include <array>
#include <array>
struct
config_p
aram
;
struct
ConfigP
aram
;
struct
ConfigBlock
;
struct
ConfigBlock
;
struct
ConfigData
{
struct
ConfigData
{
std
::
array
<
config_p
aram
*
,
std
::
size_t
(
ConfigOption
::
MAX
)
>
params
;
std
::
array
<
ConfigP
aram
*
,
std
::
size_t
(
ConfigOption
::
MAX
)
>
params
;
std
::
array
<
ConfigBlock
*
,
std
::
size_t
(
ConfigBlockOption
::
MAX
)
>
blocks
;
std
::
array
<
ConfigBlock
*
,
std
::
size_t
(
ConfigBlockOption
::
MAX
)
>
blocks
;
void
Clear
();
void
Clear
();
...
...
src/config/Param.cxx
View file @
5b2b4bf1
...
@@ -20,10 +20,10 @@
...
@@ -20,10 +20,10 @@
#include "config.h"
#include "config.h"
#include "Param.hxx"
#include "Param.hxx"
config_param
::
config_p
aram
(
const
char
*
_value
,
int
_line
)
ConfigParam
::
ConfigP
aram
(
const
char
*
_value
,
int
_line
)
:
next
(
nullptr
),
value
(
_value
),
line
(
_line
),
used
(
false
)
{}
:
next
(
nullptr
),
value
(
_value
),
line
(
_line
),
used
(
false
)
{}
config_param
::~
config_p
aram
()
ConfigParam
::~
ConfigP
aram
()
{
{
delete
next
;
delete
next
;
}
}
src/config/Param.hxx
View file @
5b2b4bf1
...
@@ -25,12 +25,12 @@
...
@@ -25,12 +25,12 @@
#include <string>
#include <string>
struct
config_p
aram
{
struct
ConfigP
aram
{
/**
/**
* The next
config_p
aram with the same name. The destructor
* The next
ConfigP
aram with the same name. The destructor
* deletes the whole chain.
* deletes the whole chain.
*/
*/
struct
config_p
aram
*
next
;
ConfigP
aram
*
next
;
std
::
string
value
;
std
::
string
value
;
...
@@ -42,17 +42,17 @@ struct config_param {
...
@@ -42,17 +42,17 @@ struct config_param {
*/
*/
bool
used
;
bool
used
;
explicit
config_p
aram
(
int
_line
=-
1
)
explicit
ConfigP
aram
(
int
_line
=-
1
)
:
next
(
nullptr
),
line
(
_line
),
used
(
false
)
{}
:
next
(
nullptr
),
line
(
_line
),
used
(
false
)
{}
gcc_nonnull_all
gcc_nonnull_all
config_p
aram
(
const
char
*
_value
,
int
_line
=-
1
);
ConfigP
aram
(
const
char
*
_value
,
int
_line
=-
1
);
config_param
(
const
config_p
aram
&
)
=
delete
;
ConfigParam
(
const
ConfigP
aram
&
)
=
delete
;
~
config_p
aram
();
~
ConfigP
aram
();
config_param
&
operator
=
(
const
config_p
aram
&
)
=
delete
;
ConfigParam
&
operator
=
(
const
ConfigP
aram
&
)
=
delete
;
/**
/**
* Determine if this is a "null" instance, i.e. an empty
* Determine if this is a "null" instance, i.e. an empty
...
...
src/neighbor/Glue.hxx
View file @
5b2b4bf1
...
@@ -26,7 +26,6 @@
...
@@ -26,7 +26,6 @@
#include <forward_list>
#include <forward_list>
struct
config_param
;
class
EventLoop
;
class
EventLoop
;
class
NeighborExplorer
;
class
NeighborExplorer
;
class
NeighborListener
;
class
NeighborListener
;
...
...
src/output/OutputPlugin.hxx
View file @
5b2b4bf1
...
@@ -145,7 +145,7 @@ struct AudioOutputPlugin {
...
@@ -145,7 +145,7 @@ struct AudioOutputPlugin {
/**
/**
* The mixer plugin associated with this output plugin. This
* The mixer plugin associated with this output plugin. This
* may be nullptr if no mixer plugin is implemented. When
* may be nullptr if no mixer plugin is implemented. When
* created, this mixer plugin gets the same #
config_p
aram as
* created, this mixer plugin gets the same #
ConfigP
aram as
* this audio output device.
* this audio output device.
*/
*/
const
MixerPlugin
*
mixer_plugin
;
const
MixerPlugin
*
mixer_plugin
;
...
...
src/pcm/ConfiguredResampler.cxx
View file @
5b2b4bf1
...
@@ -71,7 +71,7 @@ MakeResamplerDefaultConfig(ConfigBlock &block)
...
@@ -71,7 +71,7 @@ MakeResamplerDefaultConfig(ConfigBlock &block)
* "resampler" block.
* "resampler" block.
*/
*/
static
const
ConfigBlock
*
static
const
ConfigBlock
*
MigrateResamplerConfig
(
const
config_p
aram
&
param
,
ConfigBlock
&
block
)
MigrateResamplerConfig
(
const
ConfigP
aram
&
param
,
ConfigBlock
&
block
)
{
{
assert
(
block
.
IsEmpty
());
assert
(
block
.
IsEmpty
());
...
@@ -102,7 +102,7 @@ MigrateResamplerConfig(const config_param ¶m, ConfigBlock &block)
...
@@ -102,7 +102,7 @@ MigrateResamplerConfig(const config_param ¶m, ConfigBlock &block)
}
}
static
const
ConfigBlock
*
static
const
ConfigBlock
*
MigrateResamplerConfig
(
const
config_p
aram
*
param
,
ConfigBlock
&
buffer
)
MigrateResamplerConfig
(
const
ConfigP
aram
*
param
,
ConfigBlock
&
buffer
)
{
{
assert
(
buffer
.
IsEmpty
());
assert
(
buffer
.
IsEmpty
());
...
...
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