2008-10-06 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>

Casted entry->maxConnections to int32_t for std::min<T> with T =
	int32_t.
	Changed the type of count to int32_t.
	* src/Metalink2RequestGroup.cc
pull/1/head
Tatsuhiro Tsujikawa 2008-10-05 16:52:18 +00:00
parent bb1ee91509
commit f4e27634e7
2 changed files with 17 additions and 6 deletions

View File

@ -1,3 +1,10 @@
2008-10-06 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Casted entry->maxConnections to int32_t for std::min<T> with T =
int32_t.
Changed the type of count to int32_t.
* src/Metalink2RequestGroup.cc
2008-10-06 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Added test for Time::elapsed(time_t).

View File

@ -126,14 +126,15 @@ Metalink2RequestGroup::createRequestGroup
_logger->notice(EX_NO_RESULT_WITH_YOUR_PREFS);
return;
}
std::deque<int32_t> selectIndexes = Util::parseIntRange(_option->get(PREF_SELECT_FILE)).flush();
std::deque<int32_t> selectIndexes =
Util::parseIntRange(_option->get(PREF_SELECT_FILE)).flush();
bool useIndex;
if(selectIndexes.size()) {
useIndex = true;
} else {
useIndex = false;
}
unsigned int count = 0;
int32_t count = 0;
for(std::deque<SharedHandle<MetalinkEntry> >::iterator itr = entries.begin(); itr != entries.end();
itr++, ++count) {
SharedHandle<MetalinkEntry>& entry = *itr;
@ -146,7 +147,8 @@ Metalink2RequestGroup::createRequestGroup
entry->setProtocolPreference(_option->get(PREF_METALINK_PREFERRED_PROTOCOL), 100);
}
if(useIndex) {
if(std::find(selectIndexes.begin(), selectIndexes.end(), count+1) == selectIndexes.end()) {
if(std::find(selectIndexes.begin(), selectIndexes.end(), count+1) ==
selectIndexes.end()) {
continue;
}
}
@ -222,9 +224,11 @@ Metalink2RequestGroup::createRequestGroup
#endif // ENABLE_MESSAGE_DIGEST
dctx->setSignature(entry->getSignature());
rg->setDownloadContext(dctx);
rg->setNumConcurrentCommand(entry->maxConnections < 0 ?
_option->getAsInt(PREF_METALINK_SERVERS) :
std::min(_option->getAsInt(PREF_METALINK_SERVERS), entry->maxConnections));
rg->setNumConcurrentCommand
(entry->maxConnections < 0 ?
_option->getAsInt(PREF_METALINK_SERVERS) :
std::min(_option->getAsInt(PREF_METALINK_SERVERS),
static_cast<int32_t>(entry->maxConnections)));
// In metalink, multi connection to a single host is not allowed by default.
rg->setSingleHostMultiConnectionEnabled(!_option->getAsBool(PREF_METALINK_ENABLE_UNIQUE_PROTOCOL));
// remove "metalink" from Accept Type list to avoid loop in tranparent