db/simple/Song: wrap in std::unique_ptr<>
This commit is contained in:
@@ -82,11 +82,11 @@ UpdateWalk::UpdateArchiveTree(ArchiveFile &archive, Directory &directory,
|
||||
//add file
|
||||
Song *song = LockFindSong(directory, name);
|
||||
if (song == nullptr) {
|
||||
song = Song::LoadFromArchive(archive, name, directory);
|
||||
if (song != nullptr) {
|
||||
auto new_song = Song::LoadFromArchive(archive, name, directory);
|
||||
if (!new_song) {
|
||||
{
|
||||
const ScopeDatabaseLock protect;
|
||||
directory.AddSong(song);
|
||||
directory.AddSong(std::move(new_song));
|
||||
}
|
||||
|
||||
modified = true;
|
||||
|
||||
@@ -102,8 +102,7 @@ UpdateWalk::UpdateContainerFile(Directory &directory,
|
||||
}
|
||||
|
||||
for (auto &vtrack : v) {
|
||||
Song *song = Song::NewFrom(std::move(vtrack),
|
||||
*contdir);
|
||||
auto song = Song::NewFrom(std::move(vtrack), *contdir);
|
||||
|
||||
// shouldn't be necessary but it's there..
|
||||
song->mtime = info.mtime;
|
||||
@@ -113,7 +112,7 @@ UpdateWalk::UpdateContainerFile(Directory &directory,
|
||||
|
||||
{
|
||||
const ScopeDatabaseLock protect;
|
||||
contdir->AddSong(song);
|
||||
contdir->AddSong(std::move(song));
|
||||
}
|
||||
|
||||
modified = true;
|
||||
|
||||
@@ -61,8 +61,8 @@ UpdateWalk::UpdateSongFile2(Directory &directory,
|
||||
if (song == nullptr) {
|
||||
FormatDebug(update_domain, "reading %s/%s",
|
||||
directory.GetPath(), name);
|
||||
song = Song::LoadFile(storage, name, directory);
|
||||
if (song == nullptr) {
|
||||
auto new_song = Song::LoadFile(storage, name, directory);
|
||||
if (!new_song) {
|
||||
FormatDebug(update_domain,
|
||||
"ignoring unrecognized file %s/%s",
|
||||
directory.GetPath(), name);
|
||||
@@ -71,7 +71,7 @@ UpdateWalk::UpdateSongFile2(Directory &directory,
|
||||
|
||||
{
|
||||
const ScopeDatabaseLock protect;
|
||||
directory.AddSong(song);
|
||||
directory.AddSong(std::move(new_song));
|
||||
}
|
||||
|
||||
modified = true;
|
||||
|
||||
Reference in New Issue
Block a user