From 6b397c812520016f7b2b22544f51bfddbcca8dfe Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sat, 6 Jul 2013 00:17:44 +0900 Subject: Use std::unique_ptr for CheckIntegrityEntry and FileAllocationEntry --- src/FileAllocationCommand.cc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/FileAllocationCommand.cc') diff --git a/src/FileAllocationCommand.cc b/src/FileAllocationCommand.cc index b76357cc..a36f44cf 100644 --- a/src/FileAllocationCommand.cc +++ b/src/FileAllocationCommand.cc @@ -54,16 +54,19 @@ namespace aria2 { FileAllocationCommand::FileAllocationCommand (cuid_t cuid, RequestGroup* requestGroup, DownloadEngine* e, - const std::shared_ptr& fileAllocationEntry): - RealtimeCommand(cuid, requestGroup, e), - fileAllocationEntry_(fileAllocationEntry) {} + FileAllocationEntry* fileAllocationEntry) + : RealtimeCommand{cuid, requestGroup, e}, + fileAllocationEntry_{fileAllocationEntry} +{} -FileAllocationCommand::~FileAllocationCommand() {} +FileAllocationCommand::~FileAllocationCommand() +{ + getDownloadEngine()->getFileAllocationMan()->dropPickedEntry(); +} bool FileAllocationCommand::executeInternal() { if(getRequestGroup()->isHaltRequested()) { - getDownloadEngine()->getFileAllocationMan()->dropPickedEntry(); return true; } fileAllocationEntry_->allocateChunk(); @@ -72,8 +75,6 @@ bool FileAllocationCommand::executeInternal() (fmt(MSG_ALLOCATION_COMPLETED, static_cast(timer_.difference(global::wallclock())), getRequestGroup()->getTotalLength())); - getDownloadEngine()->getFileAllocationMan()->dropPickedEntry(); - std::vector> commands; fileAllocationEntry_->prepareForNextAction(commands, getDownloadEngine()); getDownloadEngine()->addCommand(std::move(commands)); @@ -87,7 +88,6 @@ bool FileAllocationCommand::executeInternal() bool FileAllocationCommand::handleException(Exception& e) { - getDownloadEngine()->getFileAllocationMan()->dropPickedEntry(); A2_LOG_ERROR_EX(fmt(MSG_FILE_ALLOCATION_FAILURE, getCuid()), e); -- cgit