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
7acc6236
Commit
7acc6236
authored
Jan 17, 2009
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
conf: replaced getBoolBlockParam() with config_get_block_bool()
No "force" parameter, pass a default value instead.
parent
a1a97cc0
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
21 deletions
+23
-21
conf.c
src/conf.c
+14
-10
conf.h
src/conf.h
+3
-2
alsa_plugin.c
src/output/alsa_plugin.c
+5
-6
shout_plugin.c
src/output/shout_plugin.c
+1
-3
No files found.
src/conf.c
View file @
7acc6236
...
...
@@ -449,20 +449,24 @@ bool config_get_bool(const char *name, bool default_value)
return
!!
value
;
}
int
getBoolBlockParam
(
struct
config_param
*
param
,
const
char
*
name
,
int
force
)
bool
config_get_block_bool
(
struct
config_param
*
param
,
const
char
*
name
,
bool
default_value
)
{
int
ret
;
struct
block_param
*
bp
=
getBlockParam
(
param
,
name
);
int
value
;
if
(
!
bp
)
return
CONF_BOOL_UNSET
;
if
(
bp
==
NULL
)
return
default_value
;
ret
=
get_bool
(
bp
->
value
);
if
(
force
&&
ret
==
CONF_BOOL_INVALID
)
value
=
get_bool
(
bp
->
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
"
,
bp
->
value
,
bp
->
line
);
return
ret
;
}
name
,
bp
->
line
);
if
(
value
==
CONF_BOOL_UNSET
)
return
default_value
;
return
!!
value
;
}
src/conf.h
View file @
7acc6236
...
...
@@ -108,8 +108,9 @@ parseConfigFilePath(const char *name, int force);
bool
config_get_bool
(
const
char
*
name
,
bool
default_value
);
int
getBoolBlockParam
(
struct
config_param
*
param
,
const
char
*
name
,
int
force
);
bool
config_get_block_bool
(
struct
config_param
*
param
,
const
char
*
name
,
bool
default_value
);
struct
config_param
*
newConfigParam
(
const
char
*
value
,
int
line
);
...
...
src/output/alsa_plugin.c
View file @
7acc6236
...
...
@@ -95,26 +95,25 @@ alsa_configure(AlsaData *ad, struct config_param *param)
if
((
bp
=
getBlockParam
(
param
,
"device"
)))
ad
->
device
=
g_strdup
(
bp
->
value
);
ad
->
useMmap
=
getBoolBlockParam
(
param
,
"use_mmap"
,
1
);
if
(
ad
->
useMmap
==
CONF_BOOL_UNSET
)
ad
->
useMmap
=
0
;
ad
->
useMmap
=
config_get_block_bool
(
param
,
"use_mmap"
,
false
);
if
((
bp
=
getBlockParam
(
param
,
"buffer_time"
)))
ad
->
buffer_time
=
atoi
(
bp
->
value
);
if
((
bp
=
getBlockParam
(
param
,
"period_time"
)))
ad
->
period_time
=
atoi
(
bp
->
value
);
#ifdef SND_PCM_NO_AUTO_RESAMPLE
if
(
!
getBoolBlockParam
(
param
,
"auto_resample"
,
true
))
if
(
!
config_get_block_bool
(
param
,
"auto_resample"
,
true
))
ad
->
mode
|=
SND_PCM_NO_AUTO_RESAMPLE
;
#endif
#ifdef SND_PCM_NO_AUTO_CHANNELS
if
(
!
getBoolBlockParam
(
param
,
"auto_channels"
,
true
))
if
(
!
config_get_block_bool
(
param
,
"auto_channels"
,
true
))
ad
->
mode
|=
SND_PCM_NO_AUTO_CHANNELS
;
#endif
#ifdef SND_PCM_NO_AUTO_FORMAT
if
(
!
getBoolBlockParam
(
param
,
"auto_format"
,
true
))
if
(
!
config_get_block_bool
(
param
,
"auto_format"
,
true
))
ad
->
mode
|=
SND_PCM_NO_AUTO_FORMAT
;
#endif
}
...
...
src/output/shout_plugin.c
View file @
7acc6236
...
...
@@ -138,9 +138,7 @@ static void *my_shout_init_driver(struct audio_output *audio_output,
check_block_param
(
"name"
);
name
=
block_param
->
value
;
public
=
getBoolBlockParam
(
param
,
"public"
,
1
);
if
(
public
==
CONF_BOOL_UNSET
)
public
=
0
;
public
=
config_get_block_bool
(
param
,
"public"
,
false
);
block_param
=
getBlockParam
(
param
,
"user"
);
if
(
block_param
)
...
...
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