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
a1a97cc0
Commit
a1a97cc0
authored
Jan 17, 2009
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
conf: use config_get_bool() instead of getBoolConfigParam()
parent
4d472c26
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
16 additions
and
33 deletions
+16
-33
conf.c
src/conf.c
+7
-13
conf.h
src/conf.h
+0
-2
mp3_plugin.c
src/decoder/mp3_plugin.c
+2
-4
normalize.c
src/normalize.c
+2
-3
playlist.c
src/playlist.c
+3
-7
zeroconf.c
src/zeroconf.c
+2
-4
No files found.
src/conf.c
View file @
a1a97cc0
...
...
@@ -429,30 +429,24 @@ parseConfigFilePath(const char *name, int force)
return
param
;
}
int
getBoolConfigParam
(
const
char
*
name
,
int
forc
e
)
bool
config_get_bool
(
const
char
*
name
,
bool
default_valu
e
)
{
int
ret
;
struct
config_param
*
param
=
config_get_param
(
name
);
int
value
;
if
(
!
param
)
return
CONF_BOOL_UNSET
;
if
(
param
==
NULL
)
return
default_value
;
ret
=
get_bool
(
param
->
value
);
if
(
force
&&
ret
==
CONF_BOOL_INVALID
)
value
=
get_bool
(
param
->
value
);
if
(
value
==
CONF_BOOL_INVALID
)
g_error
(
"%s is not a boolean value (yes, true, 1) or "
"(no, false, 0) on line %i
\n
"
,
name
,
param
->
line
);
return
ret
;
}
bool
config_get_bool
(
const
char
*
name
,
bool
default_value
)
{
int
value
=
getBoolConfigParam
(
name
,
true
);
if
(
value
==
CONF_BOOL_UNSET
)
return
default_value
;
return
value
;
return
!!
value
;
}
int
...
...
src/conf.h
View file @
a1a97cc0
...
...
@@ -106,8 +106,6 @@ getBlockParam(struct config_param *param, const char *name);
struct
config_param
*
parseConfigFilePath
(
const
char
*
name
,
int
force
);
int
getBoolConfigParam
(
const
char
*
name
,
int
force
);
bool
config_get_bool
(
const
char
*
name
,
bool
default_value
);
int
...
...
src/decoder/mp3_plugin.c
View file @
a1a97cc0
...
...
@@ -93,10 +93,8 @@ mad_fixed_to_24_buffer(int32_t *dest, const struct mad_synth *synth,
static
bool
mp3_plugin_init
(
void
)
{
int
ret
=
getBoolConfigParam
(
CONF_GAPLESS_MP3_PLAYBACK
,
true
);
gapless_playback
=
ret
!=
CONF_BOOL_UNSET
?
!!
ret
:
DEFAULT_GAPLESS_MP3_PLAYBACK
;
gapless_playback
=
config_get_bool
(
CONF_GAPLESS_MP3_PLAYBACK
,
DEFAULT_GAPLESS_MP3_PLAYBACK
);
return
true
;
}
...
...
src/normalize.c
View file @
a1a97cc0
...
...
@@ -27,9 +27,8 @@ int normalizationEnabled;
void
initNormalization
(
void
)
{
normalizationEnabled
=
getBoolConfigParam
(
CONF_VOLUME_NORMALIZATION
,
1
);
if
(
normalizationEnabled
==
CONF_BOOL_UNSET
)
normalizationEnabled
=
DEFAULT_VOLUME_NORMALIZATION
;
normalizationEnabled
=
config_get_bool
(
CONF_VOLUME_NORMALIZATION
,
DEFAULT_VOLUME_NORMALIZATION
);
if
(
normalizationEnabled
)
CompressCfg
(
0
,
ANTICLIP
,
TARGET
,
GAINMAX
,
GAINSMOOTH
,
BUCKETS
);
...
...
src/playlist.c
View file @
a1a97cc0
...
...
@@ -121,7 +121,6 @@ void initPlaylist(void)
{
char
*
test
;
struct
config_param
*
param
;
int
value
;
g_rand
=
g_rand_new
();
...
...
@@ -141,12 +140,9 @@ void initPlaylist(void)
"line %i"
,
param
->
value
,
param
->
line
);
}
value
=
getBoolConfigParam
(
CONF_SAVE_ABSOLUTE_PATHS
,
1
);
if
(
value
!=
CONF_BOOL_UNSET
)
playlist_saveAbsolutePaths
=
value
;
else
playlist_saveAbsolutePaths
=
DEFAULT_PLAYLIST_SAVE_ABSOLUTE_PATHS
;
playlist_saveAbsolutePaths
=
config_get_bool
(
CONF_SAVE_ABSOLUTE_PATHS
,
DEFAULT_PLAYLIST_SAVE_ABSOLUTE_PATHS
);
playlist
.
songs
=
g_malloc
(
sizeof
(
playlist
.
songs
[
0
])
*
playlist_max_length
);
...
...
src/zeroconf.c
View file @
a1a97cc0
...
...
@@ -37,10 +37,8 @@ void initZeroconf(void)
const
char
*
serviceName
=
SERVICE_NAME
;
struct
config_param
*
param
;
zeroconfEnabled
=
getBoolConfigParam
(
CONF_ZEROCONF_ENABLED
,
1
);
if
(
zeroconfEnabled
==
CONF_BOOL_UNSET
)
zeroconfEnabled
=
DEFAULT_ZEROCONF_ENABLED
;
zeroconfEnabled
=
config_get_bool
(
CONF_ZEROCONF_ENABLED
,
DEFAULT_ZEROCONF_ENABLED
);
if
(
!
zeroconfEnabled
)
return
;
...
...
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