pull/1045/merge
Carmot 2024-08-24 10:39:36 -07:00 committed by GitHub
commit 99827db69e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 12 additions and 8 deletions

View File

@ -158,7 +158,11 @@ int GZipFile::onVprintf(const char* format, va_list va)
while (static_cast<ssize_t>(buflen_) < len) { while (static_cast<ssize_t>(buflen_) < len) {
buflen_ *= 2; buflen_ *= 2;
} }
buf_ = reinterpret_cast<char*>(realloc(buf_, buflen_)); char* buf = reinterpret_cast<char*>(realloc(buf_, buflen_));
if (!buf) {
return -1;
}
buf_ = buf;
} }
else if (len < 0) { else if (len < 0) {
return len; return len;

View File

@ -81,7 +81,7 @@ bool LongestSequencePieceSelector::select(size_t& index,
} }
nextIndex = endindex; nextIndex = endindex;
} }
if (mendindex - mstartindex > 0) { if (mendindex != mstartindex) {
index = mendindex - 1; index = mendindex - 1;
return true; return true;
} }

View File

@ -168,12 +168,12 @@ void Netrc::parse(const std::string& path)
iter != eoi; ++iter) { iter != eoi; ++iter) {
if (state == GET_TOKEN) { if (state == GET_TOKEN) {
if (util::streq((*iter).first, (*iter).second, "machine")) { if (util::streq((*iter).first, (*iter).second, "machine")) {
storeAuthenticator(std::move(authenticator)); storeAuthenticator(authenticator);
authenticator = make_unique<Authenticator>(); authenticator = make_unique<Authenticator>();
state = SET_MACHINE; state = SET_MACHINE;
} }
else if (util::streq((*iter).first, (*iter).second, "default")) { else if (util::streq((*iter).first, (*iter).second, "default")) {
storeAuthenticator(std::move(authenticator)); storeAuthenticator(authenticator);
authenticator = make_unique<DefaultAuthenticator>(); authenticator = make_unique<DefaultAuthenticator>();
} }
else { else {
@ -220,7 +220,7 @@ void Netrc::parse(const std::string& path)
if (state != GET_TOKEN) { if (state != GET_TOKEN) {
throw DL_ABORT_EX("Netrc:parse error. EOF reached where a token expected."); throw DL_ABORT_EX("Netrc:parse error. EOF reached where a token expected.");
} }
storeAuthenticator(std::move(authenticator)); storeAuthenticator(authenticator);
} }
void Netrc::storeAuthenticator(std::unique_ptr<Authenticator> authenticator) void Netrc::storeAuthenticator(std::unique_ptr<Authenticator> authenticator)

View File

@ -638,8 +638,8 @@ void OptimizeConcurrentDownloadsOptionHandler::parseArg(
for (;;) { for (;;) {
char* end; char* end;
errno = 0; errno = 0;
strtod(sptr->c_str(), &end); double result = strtod(sptr->c_str(), &end);
if (errno != 0 || sptr->c_str() + sptr->size() != end) { if (errno == ERANGE || result == 0.0) {
throw DL_ABORT_EX(fmt("Bad number '%s'", sptr->c_str())); throw DL_ABORT_EX(fmt("Bad number '%s'", sptr->c_str()));
} }
option.put(pref, *sptr); option.put(pref, *sptr);

View File

@ -129,7 +129,7 @@ int cookieRowMapper(void* data, int columns, char** values, char** names)
expiryTime, expiryTime,
true, // persistent true, // persistent
std::move(cookieDomain), std::move(cookieDomain),
numericHost || (values[0] && values[0][0] != '.'), // hostOnly numericHost || values[0][0] != '.', // hostOnly
std::move(cookiePath), values[2] && strcmp(values[2], "1") == 0, // secure std::move(cookiePath), values[2] && strcmp(values[2], "1") == 0, // secure
false, false,
lastAccessTime // creation time. Set this later. lastAccessTime // creation time. Set this later.