Fix more signed/unsigned warnings.

This commit is contained in:
Samer Afach 2018-05-19 19:03:46 +02:00
parent 0227be3445
commit 1fcfbaac75
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()
.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;
return ec;
}
@ -483,7 +483,7 @@ std::error_code jwt_object::verify(
auto p_exp = payload()
.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;
return ec;
}

View file

@ -34,7 +34,7 @@ TEST (DecodeTest, DecodeNoneAlgSign)
EXPECT_TRUE (obj.has_claim("aud"));
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)