From 6464cda437bd550a7c16d6352d263584f3074f8d Mon Sep 17 00:00:00 2001 From: Vladislav Ostapov Date: Fri, 17 Jan 2025 19:12:31 +0300 Subject: [PATCH] =?UTF-8?q?=D1=84=D0=B8=D0=BA=D1=81=20=D0=BF=D1=80=D0=B5?= =?UTF-8?q?=D0=B4=D1=83=D0=BF=D1=80=D0=B5=D0=B6=D0=B4=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D0=B9=20=D0=BE=20=D1=82=D0=B8=D0=BF=D0=B0=D1=85=20=D0=B4=D0=B0?= =?UTF-8?q?=D0=BD=D0=BD=D1=8B=D1=85=20=D0=BF=D1=80=D0=B8=20=D0=BF=D1=80?= =?UTF-8?q?=D0=B5=D0=BE=D0=B1=D1=80=D0=B0=D0=B7=D0=BE=D0=B2=D0=B0=D0=BD?= =?UTF-8?q?=D0=B8=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/auth/jwt.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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; }