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
5f779100
Commit
5f779100
authored
Jan 25, 2009
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
conf: const pointers in block get functions
All config_get_block_*() functions should accept constant config_param pointers.
parent
80799fa8
Hide whitespace changes
Inline
Side-by-side
Showing
27 changed files
with
49 additions
and
49 deletions
+49
-49
audio.c
src/audio.c
+3
-3
conf.c
src/conf.c
+8
-8
conf.h
src/conf.h
+6
-6
listen.c
src/listen.c
+2
-2
log.c
src/log.c
+2
-3
main.c
src/main.c
+1
-1
alsa_mixer.c
src/mixer/alsa_mixer.c
+2
-2
oss_mixer.c
src/mixer/oss_mixer.c
+2
-2
mixer_api.c
src/mixer_api.c
+1
-1
mixer_api.h
src/mixer_api.h
+3
-2
alsa_plugin.c
src/output/alsa_plugin.c
+2
-2
ao_plugin.c
src/output/ao_plugin.c
+1
-1
fifo_plugin.c
src/output/fifo_plugin.c
+1
-1
jack_plugin.c
src/output/jack_plugin.c
+1
-1
mvp_plugin.c
src/output/mvp_plugin.c
+1
-1
null_plugin.c
src/output/null_plugin.c
+1
-1
oss_plugin.c
src/output/oss_plugin.c
+2
-2
osx_plugin.c
src/output/osx_plugin.c
+1
-1
pulse_plugin.c
src/output/pulse_plugin.c
+1
-1
shout_plugin.c
src/output/shout_plugin.c
+1
-1
output_api.h
src/output_api.h
+1
-1
output_control.h
src/output_control.h
+1
-1
output_init.c
src/output_init.c
+1
-1
permission.c
src/permission.c
+1
-1
replay_gain.c
src/replay_gain.c
+1
-1
tag.c
src/tag.c
+1
-1
volume.c
src/volume.c
+1
-1
No files found.
src/audio.c
View file @
5f779100
...
...
@@ -43,7 +43,7 @@ static unsigned int audioOutputArraySize;
unsigned
int
audio_output_count
(
void
)
{
unsigned
int
nr
=
0
;
struct
config_param
*
param
=
NULL
;
const
struct
config_param
*
param
=
NULL
;
while
((
param
=
config_get_next_param
(
CONF_AUDIO_OUTPUT
,
param
)))
nr
++
;
...
...
@@ -55,7 +55,7 @@ unsigned int audio_output_count(void)
/* make sure initPlayerData is called before this function!! */
void
initAudioDriver
(
void
)
{
struct
config_param
*
param
=
NULL
;
const
struct
config_param
*
param
=
NULL
;
unsigned
int
i
;
notify_init
(
&
audio_output_client_notify
);
...
...
@@ -106,7 +106,7 @@ void getOutputAudioFormat(const struct audio_format *inAudioFormat,
void
initAudioConfig
(
void
)
{
struct
config_param
*
param
=
config_get_param
(
CONF_AUDIO_OUTPUT_FORMAT
);
const
struct
config_param
*
param
=
config_get_param
(
CONF_AUDIO_OUTPUT_FORMAT
);
if
(
NULL
==
param
||
NULL
==
param
->
value
)
return
;
...
...
src/conf.c
View file @
5f779100
...
...
@@ -350,7 +350,7 @@ void config_read_file(const char *file)
}
struct
config_param
*
config_get_next_param
(
const
char
*
name
,
struct
config_param
*
last
)
config_get_next_param
(
const
char
*
name
,
const
struct
config_param
*
last
)
{
struct
config_entry
*
entry
;
GSList
*
node
;
...
...
@@ -381,7 +381,7 @@ config_get_next_param(const char *name, struct config_param * last)
const
char
*
config_get_string
(
const
char
*
name
,
const
char
*
default_value
)
{
struct
config_param
*
param
=
config_get_param
(
name
);
const
struct
config_param
*
param
=
config_get_param
(
name
);
if
(
param
==
NULL
)
return
default_value
;
...
...
@@ -410,7 +410,7 @@ config_get_path(const char *name)
unsigned
config_get_positive
(
const
char
*
name
,
unsigned
default_value
)
{
struct
config_param
*
param
=
config_get_param
(
name
);
const
struct
config_param
*
param
=
config_get_param
(
name
);
long
value
;
char
*
endptr
;
...
...
@@ -428,7 +428,7 @@ config_get_positive(const char *name, unsigned default_value)
}
struct
block_param
*
getBlockParam
(
struct
config_param
*
param
,
const
char
*
name
)
getBlockParam
(
const
struct
config_param
*
param
,
const
char
*
name
)
{
struct
block_param
*
ret
=
NULL
;
int
i
;
...
...
@@ -449,7 +449,7 @@ getBlockParam(struct config_param * param, const char *name)
bool
config_get_bool
(
const
char
*
name
,
bool
default_value
)
{
struct
config_param
*
param
=
config_get_param
(
name
);
const
struct
config_param
*
param
=
config_get_param
(
name
);
int
value
;
if
(
param
==
NULL
)
...
...
@@ -468,7 +468,7 @@ bool config_get_bool(const char *name, bool default_value)
}
const
char
*
config_get_block_string
(
struct
config_param
*
param
,
const
char
*
name
,
config_get_block_string
(
const
struct
config_param
*
param
,
const
char
*
name
,
const
char
*
default_value
)
{
struct
block_param
*
bp
=
getBlockParam
(
param
,
name
);
...
...
@@ -480,7 +480,7 @@ config_get_block_string(struct config_param *param, const char *name,
}
unsigned
config_get_block_unsigned
(
struct
config_param
*
param
,
const
char
*
name
,
config_get_block_unsigned
(
const
struct
config_param
*
param
,
const
char
*
name
,
unsigned
default_value
)
{
struct
block_param
*
bp
=
getBlockParam
(
param
,
name
);
...
...
@@ -501,7 +501,7 @@ config_get_block_unsigned(struct config_param *param, const char *name,
}
bool
config_get_block_bool
(
struct
config_param
*
param
,
const
char
*
name
,
config_get_block_bool
(
const
struct
config_param
*
param
,
const
char
*
name
,
bool
default_value
)
{
struct
block_param
*
bp
=
getBlockParam
(
param
,
name
);
...
...
src/conf.h
View file @
5f779100
...
...
@@ -94,7 +94,7 @@ void config_read_file(const char *file);
/* don't free the returned value
set _last_ to NULL to get first entry */
struct
config_param
*
config_get_next_param
(
const
char
*
name
,
struct
config_param
*
last
);
config_get_next_param
(
const
char
*
name
,
const
struct
config_param
*
last
);
static
inline
struct
config_param
*
config_get_param
(
const
char
*
name
)
...
...
@@ -117,27 +117,27 @@ unsigned
config_get_positive
(
const
char
*
name
,
unsigned
default_value
);
struct
block_param
*
getBlockParam
(
struct
config_param
*
param
,
const
char
*
name
);
getBlockParam
(
const
struct
config_param
*
param
,
const
char
*
name
);
bool
config_get_bool
(
const
char
*
name
,
bool
default_value
);
const
char
*
config_get_block_string
(
struct
config_param
*
param
,
const
char
*
name
,
config_get_block_string
(
const
struct
config_param
*
param
,
const
char
*
name
,
const
char
*
default_value
);
static
inline
char
*
config_dup_block_string
(
struct
config_param
*
param
,
const
char
*
name
,
config_dup_block_string
(
const
struct
config_param
*
param
,
const
char
*
name
,
const
char
*
default_value
)
{
return
g_strdup
(
config_get_block_string
(
param
,
name
,
default_value
));
}
unsigned
config_get_block_unsigned
(
struct
config_param
*
param
,
const
char
*
name
,
config_get_block_unsigned
(
const
struct
config_param
*
param
,
const
char
*
name
,
unsigned
default_value
);
bool
config_get_block_bool
(
struct
config_param
*
param
,
const
char
*
name
,
config_get_block_bool
(
const
struct
config_param
*
param
,
const
char
*
name
,
bool
default_value
);
struct
config_param
*
...
...
src/listen.c
View file @
5f779100
...
...
@@ -128,7 +128,7 @@ static bool ipv6Supported(void)
static
void
parseListenConfigParam
(
G_GNUC_UNUSED
unsigned
int
port
,
struct
config_param
*
param
)
const
struct
config_param
*
param
)
{
const
struct
sockaddr
*
addrp
;
socklen_t
addrlen
;
...
...
@@ -254,7 +254,7 @@ parseListenConfigParam(G_GNUC_UNUSED unsigned int port,
void
listenOnPort
(
void
)
{
int
port
=
config_get_positive
(
CONF_PORT
,
DEFAULT_PORT
);
struct
config_param
*
param
=
const
struct
config_param
*
param
=
config_get_next_param
(
CONF_BIND_TO_ADDRESS
,
NULL
);
do
{
...
...
src/log.c
View file @
5f779100
...
...
@@ -219,7 +219,7 @@ parse_log_level(const char *value, unsigned line)
void
log_init
(
bool
verbose
,
bool
use_stdout
)
{
struct
config_param
*
param
;
const
struct
config_param
*
param
;
g_get_charset
(
&
log_charset
);
...
...
@@ -252,9 +252,8 @@ void log_init(bool verbose, bool use_stdout)
if
(
path
==
NULL
)
g_error
(
"error parsing
\"
%s
\"
at line %i
\n
"
,
CONF_LOG_FILE
,
param
->
line
);
param
->
value
=
path
;
log_init_file
(
pa
ram
->
value
,
param
->
line
);
log_init_file
(
pa
th
,
param
->
line
);
}
}
}
...
...
src/main.c
View file @
5f779100
...
...
@@ -126,7 +126,7 @@ static void openDB(Options * options, char *argv0)
static
void
initialize_decoder_and_player
(
void
)
{
struct
config_param
*
param
;
const
struct
config_param
*
param
;
char
*
test
;
size_t
buffer_size
;
float
perc
;
...
...
src/mixer/alsa_mixer.c
View file @
5f779100
...
...
@@ -43,7 +43,7 @@ alsa_mixer_finish(struct mixer_data *data)
}
static
void
alsa_mixer_configure
(
struct
mixer_data
*
data
,
struct
config_param
*
param
)
alsa_mixer_configure
(
struct
mixer_data
*
data
,
const
struct
config_param
*
param
)
{
struct
alsa_mixer
*
am
=
(
struct
alsa_mixer
*
)
data
;
const
char
*
value
;
...
...
@@ -149,7 +149,7 @@ alsa_mixer_control(struct mixer_data *data, int cmd, void *arg)
struct
alsa_mixer
*
am
=
(
struct
alsa_mixer
*
)
data
;
switch
(
cmd
)
{
case
AC_MIXER_CONFIGURE
:
alsa_mixer_configure
(
data
,
(
struct
config_param
*
)
arg
);
alsa_mixer_configure
(
data
,
(
const
struct
config_param
*
)
arg
);
if
(
am
->
handle
)
alsa_mixer_close
(
data
);
return
true
;
...
...
src/mixer/oss_mixer.c
View file @
5f779100
...
...
@@ -47,7 +47,7 @@ oss_mixer_finish(struct mixer_data *data)
}
static
void
oss_mixer_configure
(
struct
mixer_data
*
data
,
struct
config_param
*
param
)
oss_mixer_configure
(
struct
mixer_data
*
data
,
const
struct
config_param
*
param
)
{
struct
oss_mixer
*
om
=
(
struct
oss_mixer
*
)
data
;
const
char
*
value
;
...
...
@@ -140,7 +140,7 @@ oss_mixer_control(struct mixer_data *data, int cmd, void *arg)
struct
oss_mixer
*
om
=
(
struct
oss_mixer
*
)
data
;
switch
(
cmd
)
{
case
AC_MIXER_CONFIGURE
:
oss_mixer_configure
(
data
,
(
struct
config_param
*
)
arg
);
oss_mixer_configure
(
data
,
(
const
struct
config_param
*
)
arg
);
if
(
om
->
device_fd
>=
0
)
oss_mixer_close
(
data
);
return
true
;
...
...
src/mixer_api.c
View file @
5f779100
...
...
@@ -20,7 +20,7 @@ void mixer_finish(struct mixer *mixer)
mixer
->
plugin
=
NULL
;
}
void
mixer_configure
(
struct
mixer
*
mixer
,
struct
config_param
*
param
)
void
mixer_configure
(
struct
mixer
*
mixer
,
const
struct
config_param
*
param
)
{
assert
(
mixer
!=
NULL
&&
mixer
->
plugin
!=
NULL
);
mixer
->
plugin
->
configure
(
mixer
->
data
,
param
);
...
...
src/mixer_api.h
View file @
5f779100
...
...
@@ -28,7 +28,8 @@ struct mixer_plugin {
/**
* Setup and configure mixer
*/
void
(
*
configure
)(
struct
mixer_data
*
data
,
struct
config_param
*
param
);
void
(
*
configure
)(
struct
mixer_data
*
data
,
const
struct
config_param
*
param
);
/**
* Open mixer device
...
...
@@ -53,7 +54,7 @@ struct mixer {
void
mixer_init
(
struct
mixer
*
mixer
,
struct
mixer_plugin
*
plugin
);
void
mixer_finish
(
struct
mixer
*
mixer
);
void
mixer_configure
(
struct
mixer
*
mixer
,
struct
config_param
*
param
);
void
mixer_configure
(
struct
mixer
*
mixer
,
const
struct
config_param
*
param
);
bool
mixer_open
(
struct
mixer
*
mixer
);
bool
mixer_control
(
struct
mixer
*
mixer
,
int
cmd
,
void
*
arg
);
void
mixer_close
(
struct
mixer
*
mixer
);
...
...
src/output/alsa_plugin.c
View file @
5f779100
...
...
@@ -108,7 +108,7 @@ alsa_data_free(struct alsa_data *ad)
}
static
void
alsa_configure
(
struct
alsa_data
*
ad
,
struct
config_param
*
param
)
alsa_configure
(
struct
alsa_data
*
ad
,
const
struct
config_param
*
param
)
{
ad
->
device
=
config_dup_block_string
(
param
,
"device"
,
NULL
);
...
...
@@ -138,7 +138,7 @@ alsa_configure(struct alsa_data *ad, struct config_param *param)
static
void
*
alsa_init
(
G_GNUC_UNUSED
struct
audio_output
*
ao
,
G_GNUC_UNUSED
const
struct
audio_format
*
audio_format
,
struct
config_param
*
param
)
const
struct
config_param
*
param
)
{
/* no need for pthread_once thread-safety when reading config */
static
int
free_global_registered
;
...
...
src/output/ao_plugin.c
View file @
5f779100
...
...
@@ -77,7 +77,7 @@ static void audioOutputAo_error(const char *msg)
static
void
*
audioOutputAo_initDriver
(
struct
audio_output
*
ao
,
G_GNUC_UNUSED
const
struct
audio_format
*
audio_format
,
struct
config_param
*
param
)
const
struct
config_param
*
param
)
{
ao_info
*
ai
;
AoData
*
ad
=
newAoData
();
...
...
src/output/fifo_plugin.c
View file @
5f779100
...
...
@@ -161,7 +161,7 @@ static bool openFifo(FifoData *fd)
static
void
*
fifo_initDriver
(
G_GNUC_UNUSED
struct
audio_output
*
ao
,
G_GNUC_UNUSED
const
struct
audio_format
*
audio_format
,
struct
config_param
*
param
)
const
struct
config_param
*
param
)
{
FifoData
*
fd
;
char
*
value
,
*
path
;
...
...
src/output/jack_plugin.c
View file @
5f779100
...
...
@@ -183,7 +183,7 @@ mpd_jack_error(const char *msg)
static
void
*
mpd_jack_init
(
struct
audio_output
*
ao
,
G_GNUC_UNUSED
const
struct
audio_format
*
audio_format
,
struct
config_param
*
param
)
const
struct
config_param
*
param
)
{
struct
jack_data
*
jd
;
const
char
*
value
;
...
...
src/output/mvp_plugin.c
View file @
5f779100
...
...
@@ -112,7 +112,7 @@ static bool mvp_testDefault(void)
static
void
*
mvp_initDriver
(
G_GNUC_UNUSED
struct
audio_output
*
audio_output
,
G_GNUC_UNUSED
const
struct
audio_format
*
audio_format
,
G_GNUC_UNUSED
struct
config_param
*
param
)
G_GNUC_UNUSED
const
struct
config_param
*
param
)
{
MvpData
*
md
=
g_new
(
MvpData
,
1
);
md
->
audio_output
=
audio_output
;
...
...
src/output/null_plugin.c
View file @
5f779100
...
...
@@ -32,7 +32,7 @@ struct null_data {
static
void
*
null_init
(
G_GNUC_UNUSED
struct
audio_output
*
audio_output
,
G_GNUC_UNUSED
const
struct
audio_format
*
audio_format
,
G_GNUC_UNUSED
struct
config_param
*
param
)
G_GNUC_UNUSED
const
struct
config_param
*
param
)
{
struct
null_data
*
nd
=
g_new
(
struct
null_data
,
1
);
...
...
src/output/oss_plugin.c
View file @
5f779100
...
...
@@ -344,7 +344,7 @@ static bool oss_testDefault(void)
return
false
;
}
static
void
*
oss_open_default
(
struct
config_param
*
param
)
static
void
*
oss_open_default
(
const
struct
config_param
*
param
)
{
int
i
;
int
err
[
G_N_ELEMENTS
(
default_devices
)];
...
...
@@ -390,7 +390,7 @@ static void *oss_open_default(struct config_param *param)
static
void
*
oss_initDriver
(
G_GNUC_UNUSED
struct
audio_output
*
audioOutput
,
G_GNUC_UNUSED
const
struct
audio_format
*
audio_format
,
struct
config_param
*
param
)
const
struct
config_param
*
param
)
{
if
(
param
)
{
const
char
*
device
=
...
...
src/output/osx_plugin.c
View file @
5f779100
...
...
@@ -83,7 +83,7 @@ static bool osx_testDefault(void)
static
void
*
osx_initDriver
(
G_GNUC_UNUSED
struct
audio_output
*
audioOutput
,
G_GNUC_UNUSED
const
struct
audio_format
*
audio_format
,
G_GNUC_UNUSED
struct
config_param
*
param
)
G_GNUC_UNUSED
const
struct
config_param
*
param
)
{
return
newOsxData
();
}
...
...
src/output/pulse_plugin.c
View file @
5f779100
...
...
@@ -55,7 +55,7 @@ static void pulse_free_data(struct pulse_data *pd)
static
void
*
pulse_init
(
struct
audio_output
*
ao
,
G_GNUC_UNUSED
const
struct
audio_format
*
audio_format
,
struct
config_param
*
param
)
const
struct
config_param
*
param
)
{
struct
pulse_data
*
pd
;
...
...
src/output/shout_plugin.c
View file @
5f779100
...
...
@@ -94,7 +94,7 @@ static void free_shout_data(struct shout_data *sd)
static
void
*
my_shout_init_driver
(
struct
audio_output
*
audio_output
,
const
struct
audio_format
*
audio_format
,
struct
config_param
*
param
)
const
struct
config_param
*
param
)
{
struct
shout_data
*
sd
;
char
*
test
;
...
...
src/output_api.h
View file @
5f779100
...
...
@@ -60,7 +60,7 @@ struct audio_output_plugin {
*/
void
*
(
*
init
)(
struct
audio_output
*
ao
,
const
struct
audio_format
*
audio_format
,
struct
config_param
*
param
);
const
struct
config_param
*
param
);
/**
* Free resources allocated by this device.
...
...
src/output_control.h
View file @
5f779100
...
...
@@ -29,7 +29,7 @@ struct tag;
struct
config_param
;
int
audio_output_init
(
struct
audio_output
*
,
struct
config_param
*
param
);
audio_output_init
(
struct
audio_output
*
,
const
struct
config_param
*
param
);
bool
audio_output_open
(
struct
audio_output
*
audioOutput
,
...
...
src/output_init.c
View file @
5f779100
...
...
@@ -39,7 +39,7 @@
}
int
audio_output_init
(
struct
audio_output
*
ao
,
struct
config_param
*
param
)
audio_output_init
(
struct
audio_output
*
ao
,
const
struct
config_param
*
param
)
{
const
char
*
name
=
NULL
;
char
*
format
=
NULL
;
...
...
src/permission.c
View file @
5f779100
...
...
@@ -71,7 +71,7 @@ void initPermissions(void)
{
char
*
password
;
unsigned
permission
;
struct
config_param
*
param
;
const
struct
config_param
*
param
;
permission_passwords
=
g_hash_table_new_full
(
g_str_hash
,
g_str_equal
,
g_free
,
NULL
);
...
...
src/replay_gain.c
View file @
5f779100
...
...
@@ -38,7 +38,7 @@ static float replay_gain_preamp = 1.0;
void
replay_gain_global_init
(
void
)
{
struct
config_param
*
param
=
config_get_param
(
CONF_REPLAYGAIN
);
const
struct
config_param
*
param
=
config_get_param
(
CONF_REPLAYGAIN
);
if
(
!
param
)
return
;
...
...
src/tag.c
View file @
5f779100
...
...
@@ -76,7 +76,7 @@ void tag_lib_init(void)
char
*
temp
;
char
*
s
;
char
*
c
;
struct
config_param
*
param
;
const
struct
config_param
*
param
;
int
i
;
/* parse the "metadata_to_use" config parameter below */
...
...
src/volume.c
View file @
5f779100
...
...
@@ -77,7 +77,7 @@ mixer_reconfigure(char *driver)
void
volume_init
(
void
)
{
struct
config_param
*
param
=
config_get_param
(
CONF_MIXER_TYPE
);
const
struct
config_param
*
param
=
config_get_param
(
CONF_MIXER_TYPE
);
//hw mixing is by default
if
(
param
)
{
if
(
strcmp
(
param
->
value
,
VOLUME_MIXER_SOFTWARE
)
==
0
)
{
...
...
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