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
d5fd3094
Commit
d5fd3094
authored
Apr 02, 2020
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
db/update/IO: pass std::string_view to directory_child_is_regular()
parent
6197b29a
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
6 deletions
+7
-6
UpdateIO.cxx
src/db/update/UpdateIO.cxx
+2
-2
UpdateIO.hxx
src/db/update/UpdateIO.hxx
+3
-1
Walk.cxx
src/db/update/Walk.cxx
+2
-3
No files found.
src/db/update/UpdateIO.cxx
View file @
d5fd3094
...
...
@@ -66,7 +66,7 @@ DirectoryExists(Storage &storage, const Directory &directory) noexcept
static
StorageFileInfo
GetDirectoryChildInfo
(
Storage
&
storage
,
const
Directory
&
directory
,
const
char
*
name_utf8
)
std
::
string_view
name_utf8
)
{
const
auto
uri_utf8
=
PathTraitsUTF8
::
Build
(
directory
.
GetPath
(),
name_utf8
);
...
...
@@ -75,7 +75,7 @@ GetDirectoryChildInfo(Storage &storage, const Directory &directory,
bool
directory_child_is_regular
(
Storage
&
storage
,
const
Directory
&
directory
,
const
char
*
name_utf8
)
noexcept
std
::
string_view
name_utf8
)
noexcept
try
{
return
GetDirectoryChildInfo
(
storage
,
directory
,
name_utf8
)
.
IsRegular
();
...
...
src/db/update/UpdateIO.hxx
View file @
d5fd3094
...
...
@@ -22,6 +22,8 @@
#include "util/Compiler.h"
#include <string_view>
struct
Directory
;
struct
StorageFileInfo
;
class
Storage
;
...
...
@@ -48,7 +50,7 @@ DirectoryExists(Storage &storage, const Directory &directory) noexcept;
gcc_pure
bool
directory_child_is_regular
(
Storage
&
storage
,
const
Directory
&
directory
,
const
char
*
name_utf8
)
noexcept
;
std
::
string_view
name_utf8
)
noexcept
;
/**
* Checks if the given permissions on the mapped file are given.
...
...
src/db/update/Walk.cxx
View file @
d5fd3094
...
...
@@ -103,7 +103,7 @@ UpdateWalk::PurgeDeletedFromDirectory(Directory &directory) noexcept
directory
.
ForEachSongSafe
([
&
](
Song
&
song
){
if
(
!
directory_child_is_regular
(
storage
,
directory
,
song
.
filename
.
c_str
()
))
{
song
.
filename
))
{
editor
.
LockDeleteSong
(
directory
,
&
song
);
modified
=
true
;
...
...
@@ -113,8 +113,7 @@ UpdateWalk::PurgeDeletedFromDirectory(Directory &directory) noexcept
for
(
auto
i
=
directory
.
playlists
.
begin
(),
end
=
directory
.
playlists
.
end
();
i
!=
end
;)
{
if
(
!
directory_child_is_regular
(
storage
,
directory
,
i
->
name
.
c_str
()))
{
if
(
!
directory_child_is_regular
(
storage
,
directory
,
i
->
name
))
{
const
ScopeDatabaseLock
protect
;
i
=
directory
.
playlists
.
erase
(
i
);
}
else
...
...
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