Skip to content

Commit

Permalink
Small code modernizations
Browse files Browse the repository at this point in the history
- Use std::numeric_limits<uid_t>::max() to ensure consistency with
  gui/gid
- Specify partition_id_t as a constexpr
  • Loading branch information
kheaactua committed Jan 13, 2025
1 parent ade0d62 commit 87039e1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions implementation/configuration/include/internal.hpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ inline constexpr std::uint32_t MAX_RECONNECTS_UNLIMITED = (std::numeric_limits<s
inline constexpr std::uint32_t MAX_RECONNECTS_LOCAL_UDS = 13;
inline constexpr std::uint32_t MAX_RECONNECTS_LOCAL_TCP = 5;

const uid_t ANY_UID = 0xFFFFFFFF;
const gid_t ANY_GID = 0xFFFFFFFF;
inline constexpr uid_t ANY_UID = (std::numeric_limits<uid_t>::max)();
inline constexpr gid_t ANY_GID = (std::numeric_limits<uid_t>::max)();

enum class port_type_e {
PT_OPTIONAL,
Expand All @@ -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

Expand Down
4 changes: 2 additions & 2 deletions test/unit_tests/security_tests/ut_is_client_allowed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<uid_t>::max();
vsomeip_v3::gid_t ANY_GID = std::numeric_limits<uid_t>::max();

vsomeip_v3::gid_t deny_uid = 9999;
vsomeip_v3::gid_t deny_gid = 9999;
Expand Down

0 comments on commit 87039e1

Please sign in to comment.