summaryrefslogtreecommitdiff
path: root/src/FtpNegotiationCommand.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2013-07-06 00:17:44 +0900
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2013-07-06 15:56:08 +0900
commit6b397c812520016f7b2b22544f51bfddbcca8dfe (patch)
tree6dcf656fb19da47833324111efcee62c66809365 /src/FtpNegotiationCommand.cc
parentc9e58779e1a30b32ea2f86e686211d901aca19f0 (diff)
Use std::unique_ptr for CheckIntegrityEntry and FileAllocationEntry
Diffstat (limited to 'src/FtpNegotiationCommand.cc')
-rw-r--r--src/FtpNegotiationCommand.cc19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/FtpNegotiationCommand.cc b/src/FtpNegotiationCommand.cc
index ef943859..285ca489 100644
--- a/src/FtpNegotiationCommand.cc
+++ b/src/FtpNegotiationCommand.cc
@@ -400,11 +400,12 @@ bool FtpNegotiationCommand::onFileSizeDetermined(int64_t totalLength)
getRequestGroup()->initPieceStorage();
if(getDownloadContext()->isChecksumVerificationNeeded()) {
A2_LOG_DEBUG("Zero length file exists. Verify checksum.");
- std::shared_ptr<ChecksumCheckIntegrityEntry> entry
- (new ChecksumCheckIntegrityEntry(getRequestGroup()));
+ auto entry = make_unique<ChecksumCheckIntegrityEntry>
+ (getRequestGroup());
entry->initValidator();
getPieceStorage()->getDiskAdaptor()->openExistingFile();
- getDownloadEngine()->getCheckIntegrityMan()->pushEntry(entry);
+ getDownloadEngine()->getCheckIntegrityMan()->pushEntry
+ (std::move(entry));
sequence_ = SEQ_EXIT;
} else
#endif // ENABLE_MESSAGE_DIGEST
@@ -434,10 +435,11 @@ bool FtpNegotiationCommand::onFileSizeDetermined(int64_t totalLength)
// HttpResponseCommand::handleOtherEncoding()
if(getDownloadContext()->isChecksumVerificationNeeded()) {
A2_LOG_DEBUG("Verify checksum for zero-length file");
- std::shared_ptr<ChecksumCheckIntegrityEntry> entry
- (new ChecksumCheckIntegrityEntry(getRequestGroup()));
+ auto entry = make_unique<ChecksumCheckIntegrityEntry>
+ (getRequestGroup());
entry->initValidator();
- getDownloadEngine()->getCheckIntegrityMan()->pushEntry(entry);
+ getDownloadEngine()->getCheckIntegrityMan()->pushEntry
+ (std::move(entry));
sequence_ = SEQ_EXIT;
} else
#endif // ENABLE_MESSAGE_DIGEST
@@ -465,8 +467,7 @@ bool FtpNegotiationCommand::onFileSizeDetermined(int64_t totalLength)
return false;
}
- std::shared_ptr<CheckIntegrityEntry> checkIntegrityEntry =
- getRequestGroup()->createCheckIntegrityEntry();
+ auto checkIntegrityEntry = getRequestGroup()->createCheckIntegrityEntry();
if(!checkIntegrityEntry) {
sequence_ = SEQ_DOWNLOAD_ALREADY_COMPLETED;
poolConnection();
@@ -478,7 +479,7 @@ bool FtpNegotiationCommand::onFileSizeDetermined(int64_t totalLength)
// AbstractCommand::execute()
getSegmentMan()->getSegmentWithIndex(getCuid(), 0);
- prepareForNextAction(checkIntegrityEntry);
+ prepareForNextAction(std::move(checkIntegrityEntry));
disableReadCheckSocket();
}