Merge pull request #17 from TheQuantumPhysicist/master

Fix more signed/unsigned warnings.
This commit is contained in:
Arun Muralidharan 2018-05-19 22:53:34 +05:30 committed by GitHub
commit 549235f009
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View file

@ -414,7 +414,7 @@ std::error_code jwt_object::verify(
auto p_exp = payload() auto p_exp = payload()
.get_claim_value<uint64_t>(registered_claims::expiration); .get_claim_value<uint64_t>(registered_claims::expiration);
if (curr_time > (p_exp + dparams.leeway)) { if (static_cast<uint64_t>(curr_time) > static_cast<uint64_t>(p_exp + dparams.leeway)) {
ec = VerificationErrc::TokenExpired; ec = VerificationErrc::TokenExpired;
return ec; return ec;
} }
@ -483,7 +483,7 @@ std::error_code jwt_object::verify(
auto p_exp = payload() auto p_exp = payload()
.get_claim_value<uint64_t>(registered_claims::not_before); .get_claim_value<uint64_t>(registered_claims::not_before);
if ((p_exp - dparams.leeway) > curr_time) { if (static_cast<uint64_t>(p_exp - dparams.leeway) > static_cast<uint64_t>(curr_time)) {
ec = VerificationErrc::ImmatureSignature; ec = VerificationErrc::ImmatureSignature;
return ec; return ec;
} }

View file

@ -34,7 +34,7 @@ TEST (DecodeTest, DecodeNoneAlgSign)
EXPECT_TRUE (obj.has_claim("aud")); EXPECT_TRUE (obj.has_claim("aud"));
EXPECT_TRUE (obj.has_claim("exp")); EXPECT_TRUE (obj.has_claim("exp"));
EXPECT_EQ (obj.payload().get_claim_value<uint64_t>("exp"), 1513863371); EXPECT_EQ (obj.payload().get_claim_value<uint64_t>("exp"), static_cast<uint64_t>(1513863371));
} }
TEST (DecodeTest, DecodeWrongAlgo) TEST (DecodeTest, DecodeWrongAlgo)