From c4def12c4d7d8f0e8e398cfd3a783a720f9f97a5 Mon Sep 17 00:00:00 2001 From: Matthew Russell Date: Mon, 11 Dec 2023 15:59:50 -0500 Subject: [PATCH] Small code modernizations - Use std::numeric_limits::max() to ensure consistency with gui/gid - Specify partition_id_t as a constexpr --- implementation/configuration/include/internal.hpp.in | 6 +++--- test/unit_tests/security_tests/ut_is_client_allowed.cpp | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/implementation/configuration/include/internal.hpp.in b/implementation/configuration/include/internal.hpp.in index a2b5cb93c..16c6e1c3c 100644 --- a/implementation/configuration/include/internal.hpp.in +++ b/implementation/configuration/include/internal.hpp.in @@ -160,8 +160,8 @@ inline constexpr std::uint32_t MAX_RECONNECTS_UNLIMITED = (std::numeric_limits::max(); +inline constexpr gid_t ANY_GID = std::numeric_limits::max(); enum class port_type_e { PT_OPTIONAL, @@ -171,7 +171,7 @@ enum class port_type_e { }; using partition_id_t = std::uint8_t; -const partition_id_t VSOMEIP_DEFAULT_PARTITION_ID = 0; +inline constexpr partition_id_t VSOMEIP_DEFAULT_PARTITION_ID = 0; } // namespace vsomeip_v3 diff --git a/test/unit_tests/security_tests/ut_is_client_allowed.cpp b/test/unit_tests/security_tests/ut_is_client_allowed.cpp index bd6f72f07..c00afebdc 100644 --- a/test/unit_tests/security_tests/ut_is_client_allowed.cpp +++ b/test/unit_tests/security_tests/ut_is_client_allowed.cpp @@ -22,8 +22,8 @@ namespace { vsomeip_v3::gid_t invalid_uid = 1; vsomeip_v3::gid_t invalid_gid = 1; - vsomeip_v3::uid_t ANY_UID = 0xFFFFFFFF; - vsomeip_v3::gid_t ANY_GID = 0xFFFFFFFF; + vsomeip_v3::uid_t ANY_UID = std::numeric_limits::max(); + vsomeip_v3::gid_t ANY_GID = std::numeric_limits::max(); vsomeip_v3::gid_t deny_uid = 9999; vsomeip_v3::gid_t deny_gid = 9999;