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
7a89b165
Commit
7a89b165
authored
Aug 14, 2019
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lib/xiph/FlacStreamMetadata: properly convert entries to StringView
parent
07fcf091
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
7 deletions
+10
-7
FlacStreamMetadata.cxx
src/lib/xiph/FlacStreamMetadata.cxx
+10
-7
No files found.
src/lib/xiph/FlacStreamMetadata.cxx
View file @
7a89b165
...
...
@@ -34,6 +34,12 @@
#include <assert.h>
static
StringView
ToStringView
(
const
FLAC__StreamMetadata_VorbisComment_Entry
&
entry
)
noexcept
{
return
{(
const
char
*
)
entry
.
entry
,
entry
.
length
};
}
bool
flac_parse_replay_gain
(
ReplayGainInfo
&
rgi
,
const
FLAC__StreamMetadata_VorbisComment
&
vc
)
...
...
@@ -44,8 +50,7 @@ flac_parse_replay_gain(ReplayGainInfo &rgi,
const
auto
*
comments
=
vc
.
comments
;
for
(
FLAC__uint32
i
=
0
,
n
=
vc
.
num_comments
;
i
<
n
;
++
i
)
if
(
ParseReplayGainVorbis
(
rgi
,
(
const
char
*
)
comments
[
i
].
entry
))
if
(
ParseReplayGainVorbis
(
rgi
,
ToStringView
(
comments
[
i
])))
found
=
true
;
return
found
;
...
...
@@ -58,8 +63,7 @@ flac_parse_mixramp(const FLAC__StreamMetadata_VorbisComment &vc)
const
auto
*
comments
=
vc
.
comments
;
for
(
FLAC__uint32
i
=
0
,
n
=
vc
.
num_comments
;
i
<
n
;
++
i
)
ParseMixRampVorbis
(
mix_ramp
,
(
const
char
*
)
comments
[
i
].
entry
);
ParseMixRampVorbis
(
mix_ramp
,
ToStringView
(
comments
[
i
]));
return
mix_ramp
;
}
...
...
@@ -72,8 +76,7 @@ static StringView
GetFlacCommentValue
(
const
FLAC__StreamMetadata_VorbisComment_Entry
*
entry
,
StringView
name
)
noexcept
{
return
GetVorbisCommentValue
({(
const
char
*
)
entry
->
entry
,
entry
->
length
},
name
);
return
GetVorbisCommentValue
(
ToStringView
(
*
entry
),
name
);
}
/**
...
...
@@ -99,7 +102,7 @@ flac_scan_comment(const FLAC__StreamMetadata_VorbisComment_Entry *entry,
TagHandler
&
handler
)
noexcept
{
if
(
handler
.
WantPair
())
{
const
StringView
comment
((
const
char
*
)
entry
->
entry
);
const
auto
comment
=
ToStringView
(
*
entry
);
const
auto
split
=
StringView
(
comment
).
Split
(
'='
);
if
(
!
split
.
first
.
empty
()
&&
!
split
.
second
.
IsNull
())
handler
.
OnPair
(
split
.
first
,
split
.
second
);
...
...
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