mirror of https://github.com/aria2/aria2
parent
6e6d0e315a
commit
437d4aa776
|
@ -623,10 +623,10 @@ void OptimizeConcurrentDownloadsOptionHandler::parseArg(
|
|||
PrefPtr pref = PREF_OPTIMIZE_CONCURRENT_DOWNLOADS_COEFFA;
|
||||
std::string* sptr = &coeff_a;
|
||||
for (;;) {
|
||||
try {
|
||||
double dbl = std::stod(*sptr);
|
||||
}
|
||||
catch (std::invalid_argument& ex) {
|
||||
char *end;
|
||||
errno = 0;
|
||||
auto dbl = strtod(sptr->c_str(), &end);
|
||||
if (errno != 0 || sptr->c_str() + sptr->size() != end) {
|
||||
throw DL_ABORT_EX(fmt("Bad number '%s'", sptr->c_str()));
|
||||
}
|
||||
option.put(pref, *sptr);
|
||||
|
|
|
@ -138,10 +138,12 @@ bool RequestGroupMan::setupOptimizeConcurrentDownloads(void)
|
|||
option_->getAsBool(PREF_OPTIMIZE_CONCURRENT_DOWNLOADS);
|
||||
if (optimizeConcurrentDownloads_) {
|
||||
if (option_->defined(PREF_OPTIMIZE_CONCURRENT_DOWNLOADS_COEFFA)) {
|
||||
optimizeConcurrentDownloadsCoeffA_ =
|
||||
std::stod(option_->get(PREF_OPTIMIZE_CONCURRENT_DOWNLOADS_COEFFA));
|
||||
optimizeConcurrentDownloadsCoeffB_ =
|
||||
std::stod(option_->get(PREF_OPTIMIZE_CONCURRENT_DOWNLOADS_COEFFB));
|
||||
optimizeConcurrentDownloadsCoeffA_ = strtod(
|
||||
option_->get(PREF_OPTIMIZE_CONCURRENT_DOWNLOADS_COEFFA).c_str(),
|
||||
nullptr);
|
||||
optimizeConcurrentDownloadsCoeffB_ = strtod(
|
||||
option_->get(PREF_OPTIMIZE_CONCURRENT_DOWNLOADS_COEFFB).c_str(),
|
||||
nullptr);
|
||||
}
|
||||
}
|
||||
return optimizeConcurrentDownloads_;
|
||||
|
|
Loading…
Reference in New Issue