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
1a5b66b7
Commit
1a5b66b7
authored
Oct 22, 2015
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SongLoader: move code to LoadFromDatabase()
Avoids the recursion in LoadFile().
parent
bea5973e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
10 deletions
+20
-10
SongLoader.cxx
src/SongLoader.cxx
+17
-10
SongLoader.hxx
src/SongLoader.hxx
+3
-0
No files found.
src/SongLoader.cxx
View file @
1a5b66b7
...
...
@@ -42,6 +42,21 @@ SongLoader::SongLoader(const Client &_client)
#endif
DetachedSong
*
SongLoader
::
LoadFromDatabase
(
const
char
*
uri
,
Error
&
error
)
const
{
#ifdef ENABLE_DATABASE
if
(
db
!=
nullptr
)
return
DatabaseDetachSong
(
*
db
,
*
storage
,
uri
,
error
);
#else
(
void
)
uri
;
#endif
error
.
Set
(
playlist_domain
,
int
(
PlaylistResult
::
NO_SUCH_SONG
),
"No database"
);
return
nullptr
;
}
DetachedSong
*
SongLoader
::
LoadFile
(
const
char
*
path_utf8
,
Error
&
error
)
const
{
#ifdef ENABLE_DATABASE
...
...
@@ -50,7 +65,7 @@ SongLoader::LoadFile(const char *path_utf8, Error &error) const
if
(
suffix
!=
nullptr
)
/* this path was relative to the music
directory - obtain it from the database */
return
Load
Song
(
suffix
,
error
);
return
Load
FromDatabase
(
suffix
,
error
);
}
#endif
...
...
@@ -99,14 +114,6 @@ SongLoader::LoadSong(const char *uri_utf8, Error &error) const
}
else
{
/* URI relative to the music directory */
#ifdef ENABLE_DATABASE
if
(
db
!=
nullptr
)
return
DatabaseDetachSong
(
*
db
,
*
storage
,
uri_utf8
,
error
);
#endif
error
.
Set
(
playlist_domain
,
int
(
PlaylistResult
::
NO_SUCH_SONG
),
"No database"
);
return
nullptr
;
return
LoadFromDatabase
(
uri_utf8
,
error
);
}
}
src/SongLoader.hxx
View file @
1a5b66b7
...
...
@@ -71,6 +71,9 @@ public:
private
:
gcc_nonnull_all
DetachedSong
*
LoadFromDatabase
(
const
char
*
uri
,
Error
&
error
)
const
;
gcc_nonnull_all
DetachedSong
*
LoadFile
(
const
char
*
path_utf8
,
Error
&
error
)
const
;
};
...
...
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