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
01f86e1c
Commit
01f86e1c
authored
Aug 14, 2019
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lib/xiph/FlacStreamMetadata: pass StringView to flac_scan_comment()
parent
7a89b165
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
21 deletions
+7
-21
FlacStreamMetadata.cxx
src/lib/xiph/FlacStreamMetadata.cxx
+7
-21
No files found.
src/lib/xiph/FlacStreamMetadata.cxx
View file @
01f86e1c
...
...
@@ -69,26 +69,15 @@ flac_parse_mixramp(const FLAC__StreamMetadata_VorbisComment &vc)
}
/**
* Checks if the specified name matches the entry's name, and if yes,
* returns the comment value;
*/
static
StringView
GetFlacCommentValue
(
const
FLAC__StreamMetadata_VorbisComment_Entry
*
entry
,
StringView
name
)
noexcept
{
return
GetVorbisCommentValue
(
ToStringView
(
*
entry
),
name
);
}
/**
* Check if the comment's name equals the passed name, and if so, copy
* the comment value into the tag.
*/
static
bool
flac_copy_comment
(
const
FLAC__StreamMetadata_VorbisComment_Entry
*
entry
,
flac_copy_comment
(
StringView
comment
,
StringView
name
,
TagType
tag_type
,
TagHandler
&
handler
)
noexcept
{
const
auto
value
=
Get
FlacCommentValue
(
entry
,
name
);
const
auto
value
=
Get
VorbisCommentValue
(
comment
,
name
);
if
(
!
value
.
IsNull
())
{
handler
.
OnTag
(
tag_type
,
value
);
return
true
;
...
...
@@ -98,22 +87,20 @@ flac_copy_comment(const FLAC__StreamMetadata_VorbisComment_Entry *entry,
}
static
void
flac_scan_comment
(
const
FLAC__StreamMetadata_VorbisComment_Entry
*
entry
,
TagHandler
&
handler
)
noexcept
flac_scan_comment
(
StringView
comment
,
TagHandler
&
handler
)
noexcept
{
if
(
handler
.
WantPair
())
{
const
auto
comment
=
ToStringView
(
*
entry
);
const
auto
split
=
StringView
(
comment
).
Split
(
'='
);
const
auto
split
=
comment
.
Split
(
'='
);
if
(
!
split
.
first
.
empty
()
&&
!
split
.
second
.
IsNull
())
handler
.
OnPair
(
split
.
first
,
split
.
second
);
}
for
(
const
struct
tag_table
*
i
=
xiph_tags
;
i
->
name
!=
nullptr
;
++
i
)
if
(
flac_copy_comment
(
entry
,
i
->
name
,
i
->
type
,
handler
))
if
(
flac_copy_comment
(
comment
,
i
->
name
,
i
->
type
,
handler
))
return
;
for
(
unsigned
i
=
0
;
i
<
TAG_NUM_OF_ITEM_TYPES
;
++
i
)
if
(
flac_copy_comment
(
entry
,
if
(
flac_copy_comment
(
comment
,
tag_item_names
[
i
],
(
TagType
)
i
,
handler
))
return
;
...
...
@@ -124,8 +111,7 @@ flac_scan_comments(const FLAC__StreamMetadata_VorbisComment *comment,
TagHandler
&
handler
)
noexcept
{
for
(
unsigned
i
=
0
;
i
<
comment
->
num_comments
;
++
i
)
flac_scan_comment
(
&
comment
->
comments
[
i
],
handler
);
flac_scan_comment
(
ToStringView
(
comment
->
comments
[
i
]),
handler
);
}
gcc_pure
...
...
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