Commit 0a259635 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen
Browse files

MetadataParser: Don't use a const shared_ptr&

This involves an extra & useless dereference, and we end up copying the
shared_ptr anyway.
Might as well copy & move it when done.
parent 5ebc44bf
......@@ -264,7 +264,7 @@ bool MetadataParser::addPlaylistMedias( parser::Task& task ) const
return true;
}
void MetadataParser::addPlaylistElement( parser::Task& task, const std::shared_ptr<Playlist>& playlistPtr,
void MetadataParser::addPlaylistElement( parser::Task& task, std::shared_ptr<Playlist> playlistPtr,
const parser::Task::Item& subitem ) const
{
const auto& mrl = subitem.mrl();
......@@ -323,14 +323,14 @@ void MetadataParser::addPlaylistElement( parser::Task& task, const std::shared_p
if ( parentKnown == false && Folder::fromMrl( m_ml, entryPoint ) != nullptr )
{
auto probePtr = std::unique_ptr<prober::PathProbe>( new prober::PathProbe{ utils::file::stripScheme( mrl ),
isDirectory, playlistPtr, parentFolder,
isDirectory, std::move( playlistPtr ), parentFolder,
utils::file::stripScheme( directoryMrl ), subitem.parentPlaylistIndex(), true } );
FsDiscoverer discoverer( fsFactory, m_ml, nullptr, std::move( probePtr ) );
discoverer.reload( entryPoint );
return;
}
auto probePtr = std::unique_ptr<prober::PathProbe>( new prober::PathProbe{ utils::file::stripScheme( mrl ),
isDirectory, playlistPtr, parentFolder,
isDirectory, std::move( playlistPtr ), parentFolder,
utils::file::stripScheme( directoryMrl ), subitem.parentPlaylistIndex(), false } );
FsDiscoverer discoverer( fsFactory, m_ml, nullptr, std::move( probePtr ) );
if ( parentKnown == false )
......
......@@ -46,7 +46,7 @@ protected:
virtual bool isCompleted( const parser::Task& task ) const override;
bool addPlaylistMedias( parser::Task& task ) const;
void addPlaylistElement( parser::Task& task, const std::shared_ptr<Playlist>& playlistPtr,
void addPlaylistElement( parser::Task& task, std::shared_ptr<Playlist> playlistPtr,
const parser::Task::Item& subitem ) const;
bool parseAudioFile(parser::Task& task);
bool parseVideoFile(parser::Task& task) const;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment