From 07d270c87e6f9184aea4ca17eb26e466712e8db2 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sat, 22 Jun 2013 01:10:38 +0900 Subject: Require -std=c++11 and use std::shared_ptr instead of SharedHandle --- src/FtpNegotiationCommand.cc | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'src/FtpNegotiationCommand.cc') diff --git a/src/FtpNegotiationCommand.cc b/src/FtpNegotiationCommand.cc index 8ed30e5b..1845a116 100644 --- a/src/FtpNegotiationCommand.cc +++ b/src/FtpNegotiationCommand.cc @@ -82,11 +82,11 @@ namespace aria2 { FtpNegotiationCommand::FtpNegotiationCommand (cuid_t cuid, - const SharedHandle& req, - const SharedHandle& fileEntry, + const std::shared_ptr& req, + const std::shared_ptr& fileEntry, RequestGroup* requestGroup, DownloadEngine* e, - const SharedHandle& socket, + const std::shared_ptr& socket, Seq seq, const std::string& baseWorkingDir): AbstractCommand(cuid, req, fileEntry, requestGroup, e, socket), @@ -401,7 +401,7 @@ bool FtpNegotiationCommand::onFileSizeDetermined(int64_t totalLength) getRequestGroup()->initPieceStorage(); if(getDownloadContext()->isChecksumVerificationNeeded()) { A2_LOG_DEBUG("Zero length file exists. Verify checksum."); - SharedHandle entry + std::shared_ptr entry (new ChecksumCheckIntegrityEntry(getRequestGroup())); entry->initValidator(); getPieceStorage()->getDiskAdaptor()->openExistingFile(); @@ -435,7 +435,7 @@ bool FtpNegotiationCommand::onFileSizeDetermined(int64_t totalLength) // HttpResponseCommand::handleOtherEncoding() if(getDownloadContext()->isChecksumVerificationNeeded()) { A2_LOG_DEBUG("Verify checksum for zero-length file"); - SharedHandle entry + std::shared_ptr entry (new ChecksumCheckIntegrityEntry(getRequestGroup())); entry->initValidator(); getDownloadEngine()->getCheckIntegrityMan()->pushEntry(entry); @@ -455,9 +455,9 @@ bool FtpNegotiationCommand::onFileSizeDetermined(int64_t totalLength) getSegmentMan()->getSegmentWithIndex(getCuid(), 0); return true; } else { - SharedHandle progressInfoFile + std::shared_ptr progressInfoFile (new DefaultBtProgressInfoFile - (getDownloadContext(), SharedHandle(), getOption().get())); + (getDownloadContext(), std::shared_ptr(), getOption().get())); getRequestGroup()->adjustFilename(progressInfoFile); getRequestGroup()->initPieceStorage(); @@ -466,7 +466,7 @@ bool FtpNegotiationCommand::onFileSizeDetermined(int64_t totalLength) return false; } - SharedHandle checkIntegrityEntry = + std::shared_ptr checkIntegrityEntry = getRequestGroup()->createCheckIntegrityEntry(); if(!checkIntegrityEntry) { sequence_ = SEQ_DOWNLOAD_ALREADY_COMPLETED; @@ -684,7 +684,7 @@ bool FtpNegotiationCommand::preparePasvConnect() { bool FtpNegotiationCommand::resolveProxy() { - SharedHandle proxyReq = createProxyRequest(); + std::shared_ptr proxyReq = createProxyRequest(); std::vector addrs; proxyAddr_ = resolveHostname (addrs, proxyReq->getHost(), proxyReq->getPort()); @@ -698,7 +698,7 @@ bool FtpNegotiationCommand::resolveProxy() dataSocket_->establishConnection(proxyAddr_, proxyReq->getPort()); disableReadCheckSocket(); setWriteCheckSocket(dataSocket_); - SharedHandle socketRecvBuffer + std::shared_ptr socketRecvBuffer (new SocketRecvBuffer(dataSocket_)); http_.reset(new HttpConnection(getCuid(), dataSocket_, socketRecvBuffer)); sequence_ = SEQ_SEND_TUNNEL_REQUEST; @@ -711,7 +711,7 @@ bool FtpNegotiationCommand::sendTunnelRequest() if(dataSocket_->isReadable(0)) { std::string error = getSocket()->getSocketError(); if(!error.empty()) { - SharedHandle proxyReq = createProxyRequest(); + std::shared_ptr proxyReq = createProxyRequest(); getDownloadEngine()->markBadIPAddress(proxyReq->getHost(), proxyAddr_,proxyReq->getPort()); std::string nextProxyAddr = getDownloadEngine()->findCachedIPAddress @@ -735,9 +735,9 @@ bool FtpNegotiationCommand::sendTunnelRequest() } } } - SharedHandle httpRequest(new HttpRequest()); + std::shared_ptr httpRequest(new HttpRequest()); httpRequest->setUserAgent(getOption()->get(PREF_USER_AGENT)); - SharedHandle req(new Request()); + std::shared_ptr req(new Request()); // Construct fake URI in order to use HttpRequest std::pair dataAddr; uri::UriStruct us; @@ -767,7 +767,7 @@ bool FtpNegotiationCommand::sendTunnelRequest() bool FtpNegotiationCommand::recvTunnelResponse() { - SharedHandle httpResponse = http_->receiveResponse(); + std::shared_ptr httpResponse = http_->receiveResponse(); if(!httpResponse) { return false; } @@ -778,7 +778,7 @@ bool FtpNegotiationCommand::recvTunnelResponse() return true; } -bool FtpNegotiationCommand::sendRestPasv(const SharedHandle& segment) { +bool FtpNegotiationCommand::sendRestPasv(const std::shared_ptr& segment) { //dataSocket_->setBlockingMode(); // Check connection is made properly if(dataSocket_->isReadable(0)) { @@ -792,7 +792,7 @@ bool FtpNegotiationCommand::sendRestPasv(const SharedHandle& segment) { return sendRest(segment); } -bool FtpNegotiationCommand::sendRest(const SharedHandle& segment) { +bool FtpNegotiationCommand::sendRest(const std::shared_ptr& segment) { if(ftp_->sendRest(segment)) { disableWriteCheckSocket(); sequence_ = SEQ_RECV_REST; @@ -802,7 +802,7 @@ bool FtpNegotiationCommand::sendRest(const SharedHandle& segment) { return false; } -bool FtpNegotiationCommand::recvRest(const SharedHandle& segment) { +bool FtpNegotiationCommand::recvRest(const std::shared_ptr& segment) { int status = ftp_->receiveResponse(); if(status == 0) { return false; @@ -864,7 +864,7 @@ bool FtpNegotiationCommand::waitConnection() } bool FtpNegotiationCommand::processSequence -(const SharedHandle& segment) { +(const std::shared_ptr& segment) { bool doNextSequence = true; switch(sequence_) { case SEQ_RECV_GREETING: -- cgit