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
87a8a3e2
Commit
87a8a3e2
authored
Mar 02, 2015
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PlaylistFile: move memchr() call to class Path
parent
e9125ef8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
2 deletions
+14
-2
PlaylistFile.cxx
src/PlaylistFile.cxx
+4
-2
Path.hxx
src/fs/Path.hxx
+10
-0
No files found.
src/PlaylistFile.cxx
View file @
87a8a3e2
...
...
@@ -169,11 +169,13 @@ LoadPlaylistFileInfo(PlaylistInfo &info,
const
Path
parent_path_fs
,
const
Path
name_fs
)
{
if
(
name_fs
.
HasNewline
())
return
false
;
const
auto
*
const
name_fs_str
=
name_fs
.
c_str
();
const
size_t
name_length
=
name_fs
.
length
();
if
(
name_length
<
ARRAY_SIZE
(
PLAYLIST_FILE_SUFFIX
)
||
memchr
(
name_fs_str
,
'\n'
,
name_length
)
!=
nullptr
)
if
(
name_length
<
ARRAY_SIZE
(
PLAYLIST_FILE_SUFFIX
))
return
false
;
if
(
!
StringEndsWith
(
name_fs_str
,
PLAYLIST_FILE_SUFFIX
))
...
...
src/fs/Path.hxx
View file @
87a8a3e2
...
...
@@ -123,6 +123,16 @@ public:
}
/**
* Does the path contain a newline character? (Which is
* usually rejected by MPD because its protocol cannot
* transfer newline characters).
*/
gcc_pure
bool
HasNewline
()
const
{
return
strchr
(
value
,
'\n'
)
!=
nullptr
;
}
/**
* Convert the path to UTF-8.
* Returns empty string on error or if this instance is "nulled"
* (#IsNull returns true).
...
...
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