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
e0c75da2
Commit
e0c75da2
authored
Oct 05, 2020
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
playlist/cue/parser: pass StringView to Feed()
parent
34bb53a2
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
9 additions
and
8 deletions
+9
-8
CueParser.cxx
src/playlist/cue/CueParser.cxx
+3
-3
CueParser.hxx
src/playlist/cue/CueParser.hxx
+3
-1
CuePlaylistPlugin.cxx
src/playlist/plugins/CuePlaylistPlugin.cxx
+1
-0
FuzzCueParser.cxx
test/fuzzer/FuzzCueParser.cxx
+2
-4
No files found.
src/playlist/cue/CueParser.cxx
View file @
e0c75da2
...
...
@@ -21,6 +21,7 @@
#include "tag/ParseName.hxx"
#include "util/Alloc.hxx"
#include "util/StringStrip.hxx"
#include "util/StringView.hxx"
#include "util/CharUtil.hxx"
#include <cassert>
...
...
@@ -271,12 +272,11 @@ CueParser::Feed2(char *p) noexcept
}
void
CueParser
::
Feed
(
const
char
*
line
)
noexcept
CueParser
::
Feed
(
StringView
line
)
noexcept
{
assert
(
!
end
);
assert
(
line
!=
nullptr
);
char
*
allocated
=
xstr
dup
(
lin
e
);
char
*
allocated
=
xstr
ndup
(
line
.
data
,
line
.
siz
e
);
Feed2
(
allocated
);
free
(
allocated
);
}
...
...
src/playlist/cue/CueParser.hxx
View file @
e0c75da2
...
...
@@ -27,6 +27,8 @@
#include <string>
#include <memory>
struct
StringView
;
class
CueParser
{
enum
{
/**
...
...
@@ -104,7 +106,7 @@ public:
* Feed a text line from the CUE file into the parser. Call
* Get() after this to see if a song has been finished.
*/
void
Feed
(
const
char
*
line
)
noexcept
;
void
Feed
(
StringView
line
)
noexcept
;
/**
* Tell the parser that the end of the file has been reached. Call
...
...
src/playlist/plugins/CuePlaylistPlugin.cxx
View file @
e0c75da2
...
...
@@ -22,6 +22,7 @@
#include "../SongEnumerator.hxx"
#include "../cue/CueParser.hxx"
#include "input/TextInputStream.hxx"
#include "util/StringView.hxx"
class
CuePlaylist
final
:
public
SongEnumerator
{
TextInputStream
tis
;
...
...
test/fuzzer/FuzzCueParser.cxx
View file @
e0c75da2
#include "playlist/cue/CueParser.hxx"
#include "util/IterableSplitString.hxx"
#include <string>
#include <string_view>
#include "util/StringView.hxx"
extern
"C"
{
int
LLVMFuzzerTestOneInput
(
const
uint8_t
*
data
,
size_t
size
);
...
...
@@ -15,7 +13,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
const
std
::
string_view
src
{(
const
char
*
)
data
,
size
};
for
(
const
auto
line
:
IterableSplitString
(
src
,
'\n'
))
{
parser
.
Feed
(
std
::
string
(
line
).
c_str
()
);
parser
.
Feed
(
line
);
parser
.
Get
();
}
...
...
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