mirror of https://github.com/aria2/aria2
sgl.normalize() must be called before DownloadContext::setFileFilter() call.
sgl.normalize() was removed from DownloadContext::setFileFilter().pull/2/head
parent
9b62a6e1fe
commit
d1667ea246
|
@ -130,7 +130,6 @@ void DownloadContext::setFilePathWithIndex
|
||||||
|
|
||||||
void DownloadContext::setFileFilter(SegList<int>& sgl)
|
void DownloadContext::setFileFilter(SegList<int>& sgl)
|
||||||
{
|
{
|
||||||
sgl.normalize();
|
|
||||||
if(!sgl.hasNext() || fileEntries_.size() == 1) {
|
if(!sgl.hasNext() || fileEntries_.size() == 1) {
|
||||||
std::for_each(fileEntries_.begin(), fileEntries_.end(),
|
std::for_each(fileEntries_.begin(), fileEntries_.end(),
|
||||||
std::bind2nd(mem_fun_sh(&FileEntry::setRequested), true));
|
std::bind2nd(mem_fun_sh(&FileEntry::setRequested), true));
|
||||||
|
|
|
@ -179,6 +179,7 @@ public:
|
||||||
ownerRequestGroup_ = owner;
|
ownerRequestGroup_ = owner;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// sgl must be normalized before the call.
|
||||||
void setFileFilter(SegList<int>& sgl);
|
void setFileFilter(SegList<int>& sgl);
|
||||||
|
|
||||||
// Sets file path for specified index. index starts from 1. The
|
// Sets file path for specified index. index starts from 1. The
|
||||||
|
|
|
@ -186,6 +186,7 @@ createBtRequestGroup(const std::string& torrentFilePath,
|
||||||
}
|
}
|
||||||
SegList<int> sgl;
|
SegList<int> sgl;
|
||||||
util::parseIntSegments(sgl, option->get(PREF_SELECT_FILE));
|
util::parseIntSegments(sgl, option->get(PREF_SELECT_FILE));
|
||||||
|
sgl.normalize();
|
||||||
dctx->setFileFilter(sgl);
|
dctx->setFileFilter(sgl);
|
||||||
std::istringstream indexOutIn(option->get(PREF_INDEX_OUT));
|
std::istringstream indexOutIn(option->get(PREF_INDEX_OUT));
|
||||||
std::map<size_t, std::string> indexPathMap =
|
std::map<size_t, std::string> indexPathMap =
|
||||||
|
|
|
@ -84,7 +84,8 @@ void DownloadContextTest::testSetFileFilter()
|
||||||
}
|
}
|
||||||
ctx.setFileEntries(files.begin(), files.end());
|
ctx.setFileEntries(files.begin(), files.end());
|
||||||
SegList<int> sgl;
|
SegList<int> sgl;
|
||||||
util::parseIntSegments(sgl, "2-4,6-8");
|
util::parseIntSegments(sgl, "6-8,2-4");
|
||||||
|
sgl.normalize();
|
||||||
ctx.setFileFilter(sgl);
|
ctx.setFileFilter(sgl);
|
||||||
const std::vector<SharedHandle<FileEntry> >& res = ctx.getFileEntries();
|
const std::vector<SharedHandle<FileEntry> >& res = ctx.getFileEntries();
|
||||||
CPPUNIT_ASSERT(!res[0]->isRequested());
|
CPPUNIT_ASSERT(!res[0]->isRequested());
|
||||||
|
|
Loading…
Reference in New Issue