mirror of https://github.com/aria2/aria2
DownloadContext, FileEntry: Use move semantics to path parameter in ctor
parent
9b54272190
commit
d1d5ea5b21
|
@ -59,7 +59,7 @@ DownloadContext::DownloadContext()
|
||||||
|
|
||||||
DownloadContext::DownloadContext(int32_t pieceLength,
|
DownloadContext::DownloadContext(int32_t pieceLength,
|
||||||
int64_t totalLength,
|
int64_t totalLength,
|
||||||
const std::string& path)
|
std::string path)
|
||||||
: ownerRequestGroup_(nullptr),
|
: ownerRequestGroup_(nullptr),
|
||||||
attrs_(MAX_CTX_ATTR),
|
attrs_(MAX_CTX_ATTR),
|
||||||
downloadStopTime_(0),
|
downloadStopTime_(0),
|
||||||
|
@ -68,8 +68,8 @@ DownloadContext::DownloadContext(int32_t pieceLength,
|
||||||
knowsTotalLength_(true),
|
knowsTotalLength_(true),
|
||||||
acceptMetalink_(true)
|
acceptMetalink_(true)
|
||||||
{
|
{
|
||||||
std::shared_ptr<FileEntry> fileEntry(new FileEntry(path, totalLength, 0));
|
fileEntries_.push_back
|
||||||
fileEntries_.push_back(fileEntry);
|
(std::make_shared<FileEntry>(std::move(path), totalLength, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
DownloadContext::~DownloadContext() {}
|
DownloadContext::~DownloadContext() {}
|
||||||
|
|
|
@ -97,7 +97,7 @@ public:
|
||||||
// should be escaped with util::escapePath(...).
|
// should be escaped with util::escapePath(...).
|
||||||
DownloadContext(int32_t pieceLength,
|
DownloadContext(int32_t pieceLength,
|
||||||
int64_t totalLength,
|
int64_t totalLength,
|
||||||
const std::string& path = A2STR::NIL);
|
std::string path = A2STR::NIL);
|
||||||
|
|
||||||
~DownloadContext();
|
~DownloadContext();
|
||||||
|
|
||||||
|
|
|
@ -66,12 +66,12 @@ bool FileEntry::RequestFaster::operator()
|
||||||
return lspd > rspd || (lspd == rspd && lhs.get() < rhs.get());
|
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)
|
const std::vector<std::string>& uris)
|
||||||
: length_(length),
|
: length_(length),
|
||||||
offset_(offset),
|
offset_(offset),
|
||||||
uris_(uris.begin(), uris.end()),
|
uris_(uris.begin(), uris.end()),
|
||||||
path_(path),
|
path_(std::move(path)),
|
||||||
lastFasterReplace_(0),
|
lastFasterReplace_(0),
|
||||||
maxConnectionPerServer_(1),
|
maxConnectionPerServer_(1),
|
||||||
requested_(true),
|
requested_(true),
|
||||||
|
|
|
@ -99,7 +99,7 @@ private:
|
||||||
public:
|
public:
|
||||||
FileEntry();
|
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>());
|
const std::vector<std::string>& uris = std::vector<std::string>());
|
||||||
|
|
||||||
~FileEntry();
|
~FileEntry();
|
||||||
|
|
|
@ -230,8 +230,8 @@ createBtMagnetRequestGroup
|
||||||
auto option = util::copy(optionTemplate);
|
auto option = util::copy(optionTemplate);
|
||||||
auto gid = getGID(option);
|
auto gid = getGID(option);
|
||||||
auto rg = std::make_shared<RequestGroup>(gid, option);
|
auto rg = std::make_shared<RequestGroup>(gid, option);
|
||||||
auto dctx = std::make_shared<DownloadContext>(METADATA_PIECE_SIZE, 0,
|
auto dctx = std::make_shared<DownloadContext>(METADATA_PIECE_SIZE, 0);
|
||||||
A2STR::NIL);
|
|
||||||
// We only know info hash. Total Length is unknown at this moment.
|
// We only know info hash. Total Length is unknown at this moment.
|
||||||
dctx->markTotalLengthIsUnknown();
|
dctx->markTotalLengthIsUnknown();
|
||||||
rg->setFileAllocationEnabled(false);
|
rg->setFileAllocationEnabled(false);
|
||||||
|
|
Loading…
Reference in New Issue