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
92523f8c
Commit
92523f8c
authored
Oct 29, 2018
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
input/CdioParanoia: parse_cdio_uri() returns CdioUri
The `bool` return value isn't used anymore, so we can just return the parsed object instead of passing it as an output parameter.
parent
e33c0835
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
18 deletions
+18
-18
CdioParanoiaInputPlugin.cxx
src/input/plugins/CdioParanoiaInputPlugin.cxx
+18
-18
No files found.
src/input/plugins/CdioParanoiaInputPlugin.cxx
View file @
92523f8c
...
...
@@ -127,43 +127,45 @@ struct CdioUri {
int
track
;
};
static
bool
parse_cdio_uri
(
CdioUri
*
dest
,
const
char
*
src
)
static
CdioUri
parse_cdio_uri
(
const
char
*
src
)
{
CdioUri
dest
;
if
(
*
src
==
0
)
{
/* play the whole CD in the default drive */
dest
->
device
[
0
]
=
0
;
dest
->
track
=
-
1
;
return
true
;
dest
.
device
[
0
]
=
0
;
dest
.
track
=
-
1
;
return
dest
;
}
const
char
*
slash
=
strrchr
(
src
,
'/'
);
if
(
slash
==
nullptr
)
{
/* play the whole CD in the specified drive */
CopyTruncateString
(
dest
->
device
,
src
,
sizeof
(
dest
->
device
));
dest
->
track
=
-
1
;
return
true
;
CopyTruncateString
(
dest
.
device
,
src
,
sizeof
(
dest
.
device
));
dest
.
track
=
-
1
;
return
dest
;
}
size_t
device_length
=
slash
-
src
;
if
(
device_length
>=
sizeof
(
dest
->
device
))
device_length
=
sizeof
(
dest
->
device
)
-
1
;
if
(
device_length
>=
sizeof
(
dest
.
device
))
device_length
=
sizeof
(
dest
.
device
)
-
1
;
memcpy
(
dest
->
device
,
src
,
device_length
);
dest
->
device
[
device_length
]
=
0
;
memcpy
(
dest
.
device
,
src
,
device_length
);
dest
.
device
[
device_length
]
=
0
;
const
char
*
track
=
slash
+
1
;
char
*
endptr
;
dest
->
track
=
strtoul
(
track
,
&
endptr
,
10
);
dest
.
track
=
strtoul
(
track
,
&
endptr
,
10
);
if
(
*
endptr
!=
0
)
throw
std
::
runtime_error
(
"Malformed track number"
);
if
(
endptr
==
track
)
/* play the whole CD */
dest
->
track
=
-
1
;
dest
.
track
=
-
1
;
return
true
;
return
dest
;
}
static
AllocatedPath
...
...
@@ -186,9 +188,7 @@ input_cdio_open(const char *uri,
uri
=
StringAfterPrefixIgnoreCase
(
uri
,
"cdda://"
);
assert
(
uri
!=
nullptr
);
CdioUri
parsed_uri
;
if
(
!
parse_cdio_uri
(
&
parsed_uri
,
uri
))
return
nullptr
;
const
auto
parsed_uri
=
parse_cdio_uri
(
uri
);
/* get list of CD's supporting CD-DA */
const
AllocatedPath
device
=
parsed_uri
.
device
[
0
]
!=
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