фикс предупреждений о типах данных при преобразовании

This commit is contained in:
Vladislav Ostapov 2025-01-17 19:12:31 +03:00
parent 3537965393
commit 6464cda437

View File

@ -28,19 +28,19 @@ http::auth::jwt::Jwt http::auth::jwt::Jwt::fromCookies(const std::string &cookie
Jwt t;
if (pc.find("auth") != pc.end()) {
const auto auth = pc.at("auth");
int firstDot = -1;
int secondDot = -1;
std::string::size_type firstDot = std::string::npos;
std::string::size_type secondDot = std::string::npos;
for (size_t i = 0; i < auth.size(); i++) {
if (auth[i] == '.') {
if (firstDot < 0) { firstDot = static_cast<int>(i); }
else if (secondDot < 0) { secondDot = static_cast<int>(i); }
if (firstDot == std::string::npos) { firstDot = static_cast<int>(i); }
else if (secondDot == std::string::npos) { secondDot = static_cast<int>(i); }
else {
// так быть не должно
return t;
}
}
}
if (firstDot < 0 || secondDot < 0 || secondDot - firstDot == 0) {
if (firstDot == std::string::npos || secondDot == std::string::npos || secondDot - firstDot == 0) {
// так тоже быть не должно
return t;
}