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