Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sync-with-eclipse-ecal-2024-05-16-2 #69

Merged
merged 1 commit into from
May 16, 2024

Conversation

rex-schilasky
Copy link
Contributor

sync-with-eclipse-ecal-2024-05-16-2

@rex-schilasky rex-schilasky merged commit fe42403 into main May 16, 2024
82 checks passed
@rex-schilasky rex-schilasky deleted the sync-with-eclipse-ecal-2024-05-16-2 branch May 16, 2024 15:13
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

There were too many comments to post at once. Showing the first 20 out of 39. Check the log or trigger a new build to see more.

{
class CDynamicSubscriber
class CapnprotoDynamicDeserializer

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: constructor does not initialize these fields: m_msg_builder, m_schema_map, m_loader [cppcoreguidelines-pro-type-member-init]

ecal/core/include/ecal/msg/capnproto/dynamic.h:77:

-       capnp::MallocMessageBuilder                   m_msg_builder;
-       std::map<SDataTypeInformation, capnp::Schema> m_schema_map;
-       capnp::SchemaLoader                           m_loader;
+       capnp::MallocMessageBuilder                   m_msg_builder{};
+       std::map<SDataTypeInformation, capnp::Schema> m_schema_map{};
+       capnp::SchemaLoader                           m_loader{};

// This function is NOT threadsafe!!!
// what about the lifetime of the objects?
// It's totally unclear to me :/
capnp::DynamicStruct::Reader Deserialize(const void* buffer_, size_t size_, const SDataTypeInformation& datatype_info_)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: parameter 'buffer_' is unused [misc-unused-parameters]

Suggested change
capnp::DynamicStruct::Reader Deserialize(const void* buffer_, size_t size_, const SDataTypeInformation& datatype_info_)
capnp::DynamicStruct::Reader Deserialize(const void* /*buffer_*/, size_t size_, const SDataTypeInformation& datatype_info_)

void OnReceive(const char* topic_name_, const capnp::MallocMessageBuilder& msg_, long long time_, long long clock_, long long id_)
{
if (!initialized)
capnp::Schema schema = GetSchema(datatype_info_);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'schema' is not initialized [cppcoreguidelines-init-variables]

Suggested change
capnp::Schema schema = GetSchema(datatype_info_);
capnp::Schema schema = 0 = GetSchema(datatype_info_);

{
if (!initialized)
capnp::Schema schema = GetSchema(datatype_info_);
capnp::DynamicStruct::Builder root_builder = m_msg_builder.getRoot<capnp::DynamicStruct>(schema.asStruct());

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'root_builder' is not initialized [cppcoreguidelines-init-variables]

Suggested change
capnp::DynamicStruct::Builder root_builder = m_msg_builder.getRoot<capnp::DynamicStruct>(schema.asStruct());
capnp::DynamicStruct::Builder root_builder = 0 = m_msg_builder.getRoot<capnp::DynamicStruct>(schema.asStruct());

**/
class CBuilderSubscriber : public CMsgSubscriber<capnp::MallocMessageBuilder>
template <typename T>
class CapnprotoDeserializer

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: constructor does not initialize these fields: m_msg_builder [cppcoreguidelines-pro-type-member-init]

ecal/core/include/ecal/msg/capnproto/subscriber.h:69:

-       capnp::MallocMessageBuilder m_msg_builder;
+       capnp::MallocMessageBuilder m_msg_builder{};

// the callback bound to the CSubscriber belongs to rhs, bind to this callback instead
CSubscriber::RemReceiveCallback();
auto callback = std::bind(&CDynamicMessageSubscriber::ReceiveCallback, this, std::placeholders::_1, std::placeholders::_2);
CSubscriber::AddReceiveCallback(callback);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'callback' is not initialized [cppcoreguidelines-init-variables]

Suggested change
CSubscriber::AddReceiveCallback(callback);
CSubscriber::AddReceiveCallback(callback = 0);

// Do we want to call error callbacks on receive? Probably not! std::expected wouuld be a good thing to return the reason why things went wrong.
std::optional<T> Receive(long long* time_ = nullptr, int rcv_timeout_ = 0)
{
std::string rec_buf;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'rec_buf' of type 'std::string' (aka 'basic_string') can be declared 'const' [misc-const-correctness]

Suggested change
std::string rec_buf;
std::string const rec_buf;

std::optional<T> Receive(long long* time_ = nullptr, int rcv_timeout_ = 0)
{
std::string rec_buf;
bool success = CSubscriber::ReceiveBuffer(rec_buf, time_, rcv_timeout_);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'success' is not initialized [cppcoreguidelines-init-variables]

Suggested change
bool success = CSubscriber::ReceiveBuffer(rec_buf, time_, rcv_timeout_);
bool success = false = CSubscriber::ReceiveBuffer(rec_buf, time_, rcv_timeout_);

**/
bool RemReceiveCallback()
{
bool ret = CSubscriber::RemReceiveCallback();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'ret' is not initialized [cppcoreguidelines-init-variables]

Suggested change
bool ret = CSubscriber::RemReceiveCallback();
bool ret = false = CSubscriber::RemReceiveCallback();

private:
void ReceiveCallback(const char* topic_name_, const struct eCAL::SReceiveCallbackData* data_)
{
MsgReceiveCallbackT fn_callback = nullptr;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'fn_callback' is not initialized [cppcoreguidelines-init-variables]

Suggested change
MsgReceiveCallbackT fn_callback = nullptr;
MsgReceiveCallbackT fn_callback = 0 = nullptr;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant