Skip to content

Commit

Permalink
[#573] Fix clang-tidy and clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
elfenpiff committed Jan 3, 2025
1 parent 246de57 commit f21d428
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 16 deletions.
2 changes: 2 additions & 0 deletions iceoryx2-ffi/cxx/include/iox2/enum_translation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,8 @@ constexpr auto from<int, iox2::EventOpenOrCreateError>(const int value) noexcept
return iox2::EventOpenOrCreateError::OpenIncompatibleMessagingPattern;
case iox2_event_open_or_create_error_e_O_INCOMPATIBLE_ATTRIBUTES:
return iox2::EventOpenOrCreateError::OpenIncompatibleAttributes;
case iox2_event_open_or_create_error_e_O_INCOMPATIBLE_DEADLINE:
return iox2::EventOpenOrCreateError::OpenIncompatibleDeadline;
case iox2_event_open_or_create_error_e_O_INTERNAL_FAILURE:
return iox2::EventOpenOrCreateError::OpenInternalFailure;
case iox2_event_open_or_create_error_e_O_HANGS_IN_CREATION:
Expand Down
2 changes: 2 additions & 0 deletions iceoryx2-ffi/cxx/include/iox2/service_builder_event_error.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ enum class EventOpenOrCreateError : uint8_t {
/// a corrupted
/// [`Service`]state.
OpenServiceInCorruptedState,
/// The [`Service`]s deadline settings are not equal the the user given requirements.
OpenIncompatibleDeadline,
/// The [`Service`] has the wrong messaging pattern.
OpenIncompatibleMessagingPattern,
/// The [`AttributeVerifier`] required attributes that the [`Service`] does
Expand Down
5 changes: 3 additions & 2 deletions iceoryx2-ffi/cxx/src/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,9 @@ auto Event::deadline() && -> iox::optional<iox::units::Duration> {
void Event::set_deadline(iox::optional<iox::units::Duration> value) && {
value
.and_then([&](auto value) {
uint64_t seconds = value.toSeconds();
uint32_t nanoseconds = value.toNanoseconds() - (value.toSeconds() * iox::units::Duration::NANOSECS_PER_SEC);
const uint64_t seconds = value.toSeconds();
const uint32_t nanoseconds =
value.toNanoseconds() - (value.toSeconds() * iox::units::Duration::NANOSECS_PER_SEC);
iox2_config_defaults_event_set_deadline(m_config, &seconds, &nanoseconds);
})
.or_else([&] { iox2_config_defaults_event_set_deadline(m_config, nullptr, nullptr); });
Expand Down
12 changes: 6 additions & 6 deletions iceoryx2-ffi/ffi/src/api/listener.rs
Original file line number Diff line number Diff line change
Expand Up @@ -370,12 +370,12 @@ pub unsafe extern "C" fn iox2_listener_deadline(
iox2_service_type_e::LOCAL => listener.value.as_mut().local.deadline(),
};

deadline.map(|v| {
*seconds = v.as_secs();
*nanoseconds = v.subsec_nanos();
});

deadline.is_some()
deadline
.map(|v| {
*seconds = v.as_secs();
*nanoseconds = v.subsec_nanos();
})
.is_some()
}

/// Blocks the listener until at least one event was received and then calls the callback for
Expand Down
12 changes: 6 additions & 6 deletions iceoryx2-ffi/ffi/src/api/notifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,12 +221,12 @@ pub unsafe extern "C" fn iox2_notifier_deadline(
iox2_service_type_e::LOCAL => notifier.value.as_mut().local.deadline(),
};

deadline.map(|v| {
*seconds = v.as_secs();
*nanoseconds = v.subsec_nanos();
});

deadline.is_some()
deadline
.map(|v| {
*seconds = v.as_secs();
*nanoseconds = v.subsec_nanos();
})
.is_some()
}

/// Notifies all [`iox2_listener_h`](crate::iox2_listener_h) connected to the service
Expand Down
2 changes: 0 additions & 2 deletions iceoryx2/src/port/listener.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,6 @@ impl<Service: service::Service> Listener<Service> {
with ListenerCreateError::ResourceCreationFailed,
"{} since the underlying event concept \"{}\" could not be created.", msg, event_name);

service.__internal_state().static_config.event().deadline;

let mut new_self = Self {
service_state: service.__internal_state().clone(),
dynamic_listener_handle: None,
Expand Down

0 comments on commit f21d428

Please sign in to comment.