diff options
| -rw-r--r-- | src/DownloadContext.cc | 6 | ||||
| -rw-r--r-- | src/DownloadContext.h | 2 | ||||
| -rw-r--r-- | src/FileEntry.cc | 4 | ||||
| -rw-r--r-- | src/FileEntry.h | 2 | ||||
| -rw-r--r-- | src/download_helper.cc | 4 |
5 files changed, 9 insertions, 9 deletions
diff --git a/src/DownloadContext.cc b/src/DownloadContext.cc index 819a51cd..fab50c52 100644 --- a/src/DownloadContext.cc +++ b/src/DownloadContext.cc @@ -59,7 +59,7 @@ DownloadContext::DownloadContext() DownloadContext::DownloadContext(int32_t pieceLength, int64_t totalLength, - const std::string& path) + std::string path) : ownerRequestGroup_(nullptr), attrs_(MAX_CTX_ATTR), downloadStopTime_(0), @@ -68,8 +68,8 @@ DownloadContext::DownloadContext(int32_t pieceLength, knowsTotalLength_(true), acceptMetalink_(true) { - std::shared_ptr<FileEntry> fileEntry(new FileEntry(path, totalLength, 0)); - fileEntries_.push_back(fileEntry); + fileEntries_.push_back + (std::make_shared<FileEntry>(std::move(path), totalLength, 0)); } DownloadContext::~DownloadContext() {} diff --git a/src/DownloadContext.h b/src/DownloadContext.h index 310bcccc..490ad166 100644 --- a/src/DownloadContext.h +++ b/src/DownloadContext.h @@ -97,7 +97,7 @@ public: // should be escaped with util::escapePath(...). DownloadContext(int32_t pieceLength, int64_t totalLength, - const std::string& path = A2STR::NIL); + std::string path = A2STR::NIL); ~DownloadContext(); diff --git a/src/FileEntry.cc b/src/FileEntry.cc index e500f67f..c12a9182 100644 --- a/src/FileEntry.cc +++ b/src/FileEntry.cc @@ -66,12 +66,12 @@ bool FileEntry::RequestFaster::operator() return lspd > rspd || (lspd == rspd && lhs.get() < rhs.get()); } -FileEntry::FileEntry(const std::string& path, int64_t length, int64_t offset, +FileEntry::FileEntry(std::string path, int64_t length, int64_t offset, const std::vector<std::string>& uris) : length_(length), offset_(offset), uris_(uris.begin(), uris.end()), - path_(path), + path_(std::move(path)), lastFasterReplace_(0), maxConnectionPerServer_(1), requested_(true), diff --git a/src/FileEntry.h b/src/FileEntry.h index d714e19e..759cce47 100644 --- a/src/FileEntry.h +++ b/src/FileEntry.h @@ -99,7 +99,7 @@ private: public: FileEntry(); - FileEntry(const std::string& path, int64_t length, int64_t offset, + FileEntry(std::string path, int64_t length, int64_t offset, const std::vector<std::string>& uris = std::vector<std::string>()); ~FileEntry(); diff --git a/src/download_helper.cc b/src/download_helper.cc index 6167473e..054b87c4 100644 --- a/src/download_helper.cc +++ b/src/download_helper.cc @@ -230,8 +230,8 @@ createBtMagnetRequestGroup auto option = util::copy(optionTemplate); auto gid = getGID(option); auto rg = std::make_shared<RequestGroup>(gid, option); - auto dctx = std::make_shared<DownloadContext>(METADATA_PIECE_SIZE, 0, - A2STR::NIL); + auto dctx = std::make_shared<DownloadContext>(METADATA_PIECE_SIZE, 0); + // We only know info hash. Total Length is unknown at this moment. dctx->markTotalLengthIsUnknown(); rg->setFileAllocationEnabled(false); |
