diff --git a/src/auth/jwt.cpp b/src/auth/jwt.cpp index 5a7f032..a785c3b 100644 --- a/src/auth/jwt.cpp +++ b/src/auth/jwt.cpp @@ -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(i); } - else if (secondDot < 0) { secondDot = static_cast(i); } + if (firstDot == std::string::npos) { firstDot = static_cast(i); } + else if (secondDot == std::string::npos) { secondDot = static_cast(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; }