Skip to content

Commit 0b4fece

Browse files
authored
Cast data size to unsigned int (#405)
* Cast data size to unsigned int * correcting CI worktree * Add LCOV_ARGS to Fix geninfo line mismatch error * Add unused error ignore to LCOV_ARGS * Refactor Format to match lint requirements * Fix formatting in CMakeLists.txt for coverage setup * Fix coverage setup for jwt-cpp-test
1 parent b0ea29a commit 0b4fece

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

include/jwt-cpp/jwt.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1624,7 +1624,7 @@ namespace jwt {
16241624
ec = error::signature_generation_error::signinit_failed;
16251625
return {};
16261626
}
1627-
if (!EVP_DigestUpdate(ctx.get(), data.data(), data.size())) {
1627+
if (!EVP_DigestUpdate(ctx.get(), data.data(), static_cast<unsigned int>(data.size()))) {
16281628
ec = error::signature_generation_error::digestupdate_failed;
16291629
return {};
16301630
}
@@ -1664,7 +1664,7 @@ namespace jwt {
16641664
ec = error::signature_verification_error::verifyinit_failed;
16651665
return;
16661666
}
1667-
if (!EVP_DigestUpdate(ctx.get(), data.data(), data.size())) {
1667+
if (!EVP_DigestUpdate(ctx.get(), data.data(), static_cast<unsigned int>(data.size()))) {
16681668
ec = error::signature_verification_error::verifyupdate_failed;
16691669
return;
16701670
}
@@ -1984,7 +1984,7 @@ namespace jwt {
19841984
return {};
19851985
}
19861986
#endif
1987-
if (EVP_DigestUpdate(md_ctx.get(), data.data(), data.size()) != 1) {
1987+
if (EVP_DigestUpdate(md_ctx.get(), data.data(), static_cast<unsigned int>(data.size())) != 1) {
19881988
ec = error::signature_generation_error::digestupdate_failed;
19891989
return {};
19901990
}
@@ -2033,7 +2033,7 @@ namespace jwt {
20332033
return;
20342034
}
20352035
#endif
2036-
if (EVP_DigestUpdate(md_ctx.get(), data.data(), data.size()) != 1) {
2036+
if (EVP_DigestUpdate(md_ctx.get(), data.data(), static_cast<unsigned int>(data.size())) != 1) {
20372037
ec = error::signature_verification_error::verifyupdate_failed;
20382038
return;
20392039
}
@@ -2670,7 +2670,8 @@ namespace jwt {
26702670
*/
26712671
date as_date() const {
26722672
using std::chrono::system_clock;
2673-
if (get_type() == json::type::number) return date(std::chrono::seconds(std::llround(as_number())));
2673+
if (get_type() == json::type::number)
2674+
return date(std::chrono::seconds(static_cast<int64_t>(std::llround(as_number()))));
26742675
return date(std::chrono::seconds(as_integer()));
26752676
}
26762677

tests/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,5 +81,6 @@ if(JWT_ENABLE_COVERAGE)
8181
setup_coverage(jwt-cpp-test)
8282
set(COVERAGE_EXCLUDES "/usr/**" "/home/*/.conan/**" "*test*" "*build*" "**/nlohmann/json.hpp"
8383
"**/picojson/picojson.h" "*boost*" "*jsoncons*")
84-
setup_target_for_coverage_lcov(NAME coverage EXECUTABLE ${CMAKE_CURRENT_BINARY_DIR}/jwt-cpp-test)
84+
setup_target_for_coverage_lcov(NAME coverage EXECUTABLE ${CMAKE_CURRENT_BINARY_DIR}/jwt-cpp-test LCOV_ARGS
85+
"--ignore-errors;mismatch;--ignore-errors;unused")
8586
endif()

0 commit comments

Comments
 (0)