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
59067e6a
Commit
59067e6a
authored
Jan 03, 2009
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ao: use g_strsplit() instead of strtok_r()
g_strsplit() is more portable than strtok_r().
parent
5b543e8f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
37 deletions
+15
-37
ao_plugin.c
src/output/ao_plugin.c
+15
-37
No files found.
src/output/ao_plugin.c
View file @
59067e6a
...
@@ -79,12 +79,6 @@ static void *audioOutputAo_initDriver(struct audio_output *ao,
...
@@ -79,12 +79,6 @@ static void *audioOutputAo_initDriver(struct audio_output *ao,
ConfigParam
*
param
)
ConfigParam
*
param
)
{
{
ao_info
*
ai
;
ao_info
*
ai
;
char
*
duplicated
;
char
*
stk1
;
char
*
stk2
;
char
*
n1
;
char
*
key
;
char
*
value
;
char
*
test
;
char
*
test
;
AoData
*
ad
=
newAoData
();
AoData
*
ad
=
newAoData
();
BlockParam
*
blockParam
;
BlockParam
*
blockParam
;
...
@@ -121,40 +115,24 @@ static void *audioOutputAo_initDriver(struct audio_output *ao,
...
@@ -121,40 +115,24 @@ static void *audioOutputAo_initDriver(struct audio_output *ao,
audio_output_get_name
(
ao
));
audio_output_get_name
(
ao
));
blockParam
=
getBlockParam
(
param
,
"options"
);
blockParam
=
getBlockParam
(
param
,
"options"
);
if
(
blockParam
)
{
if
(
blockParam
)
{
duplicated
=
g_strdup
(
blockParam
->
value
);
gchar
**
options
=
g_strsplit
(
blockParam
->
value
,
";"
,
0
);
}
else
duplicated
=
g_strdup
(
""
);
for
(
unsigned
i
=
0
;
options
[
i
]
!=
NULL
;
++
i
)
{
gchar
**
key_value
=
g_strsplit
(
options
[
i
],
"="
,
2
);
if
(
strlen
(
duplicated
))
{
stk1
=
NULL
;
if
(
key_value
[
0
]
==
NULL
||
key_value
[
1
]
==
NULL
)
n1
=
strtok_r
(
duplicated
,
";"
,
&
stk1
);
g_error
(
"problems parsing options
\"
%s
\"\n
"
,
while
(
n1
)
{
options
[
i
]);
stk2
=
NULL
;
key
=
strtok_r
(
n1
,
"="
,
&
stk2
);
ao_append_option
(
&
ad
->
options
,
key_value
[
0
],
if
(
!
key
)
key_value
[
1
]);
g_error
(
"problems parsing options
\"
%s
\"\n
"
,
n1
);
/*found = 0;
g_strfreev
(
key_value
);
for(i=0;i<ai->option_count;i++) {
if(strcmp(ai->options[i],key)==0) {
found = 1;
break;
}
}
if(!found) {
FATAL("\"%s\" is not an option for "
"\"%s\" ao driver\n",key,
ai->short_name);
} */
value
=
strtok_r
(
NULL
,
""
,
&
stk2
);
if
(
!
value
)
g_error
(
"problems parsing options
\"
%s
\"\n
"
,
n1
);
ao_append_option
(
&
ad
->
options
,
key
,
value
);
n1
=
strtok_r
(
NULL
,
";"
,
&
stk1
);
}
}
g_strfreev
(
options
);
}
}
free
(
duplicated
);
return
ad
;
return
ad
;
}
}
...
...
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