-
Notifications
You must be signed in to change notification settings - Fork 3
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
ecal c api split #33
ecal c api split #33
Conversation
deprecated functions removed
There was a problem hiding this 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 54. Check the log or trigger a new build to see more.
if(source_s_.empty()) return(0); | ||
if(target_len_ == ECAL_ALLOCATE_4ME) | ||
{ | ||
void* buf_alloc = malloc(source_s_.size()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: initializing non-owner 'void *' with a newly created 'gsl::owner<>' [cppcoreguidelines-owning-memory]
void* buf_alloc = malloc(source_s_.size());
^
if(source_s_.empty()) return(0); | ||
if(target_len_ == ECAL_ALLOCATE_4ME) | ||
{ | ||
void* buf_alloc = malloc(source_s_.size()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: do not manage memory manually; consider a container or a smart pointer [cppcoreguidelines-no-malloc]
void* buf_alloc = malloc(source_s_.size());
^
{ | ||
void* buf_alloc = malloc(source_s_.size()); | ||
if(buf_alloc == nullptr) return(0); | ||
int copied = CopyBuffer(buf_alloc, static_cast<int>(source_s_.size()), source_s_); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'copied' of type 'int' can be declared 'const' [misc-const-correctness]
int copied = CopyBuffer(buf_alloc, static_cast<int>(source_s_.size()), source_s_); | |
int const copied = CopyBuffer(buf_alloc, static_cast<int>(source_s_.size()), source_s_); |
int copied = CopyBuffer(buf_alloc, static_cast<int>(source_s_.size()), source_s_); | ||
if(copied > 0) | ||
{ | ||
*((void**)target_) = buf_alloc; //-V206 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: do not use C-style cast to convert between unrelated types [cppcoreguidelines-pro-type-cstyle-cast]
*((void**)target_) = buf_alloc; //-V206
^
else | ||
{ | ||
// copying buffer failed, so free allocated memory. | ||
free(buf_alloc); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: do not manage memory manually; use RAII [cppcoreguidelines-no-malloc]
free(buf_alloc);
^
|
||
ECALC_API int eCAL_Process_GetHostName(void* name_, int name_len_) | ||
{ | ||
std::string name = eCAL::Process::GetHostName(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'name' of type 'std::string' (aka 'basic_string') can be declared 'const' [misc-const-correctness]
std::string name = eCAL::Process::GetHostName(); | |
std::string const name = eCAL::Process::GetHostName(); |
|
||
ECALC_API int eCAL_Process_GetUnitName(void* name_, int name_len_) | ||
{ | ||
std::string name = eCAL::Process::GetUnitName(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'name' of type 'std::string' (aka 'basic_string') can be declared 'const' [misc-const-correctness]
std::string name = eCAL::Process::GetUnitName(); | |
std::string const name = eCAL::Process::GetUnitName(); |
|
||
ECALC_API int eCAL_Process_GetTaskParameter(void* par_, int par_len_, const char* sep_) | ||
{ | ||
std::string par = eCAL::Process::GetTaskParameter(sep_); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'par' of type 'std::string' (aka 'basic_string') can be declared 'const' [misc-const-correctness]
std::string par = eCAL::Process::GetTaskParameter(sep_); | |
std::string const par = eCAL::Process::GetTaskParameter(sep_); |
|
||
ECALC_API int eCAL_Process_GetProcessName(void* name_, int name_len_) | ||
{ | ||
std::string name = eCAL::Process::GetProcessName(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'name' of type 'std::string' (aka 'basic_string') can be declared 'const' [misc-const-correctness]
std::string name = eCAL::Process::GetProcessName(); | |
std::string const name = eCAL::Process::GetProcessName(); |
|
||
ECALC_API int eCAL_Process_GetProcessParameter(void* par_, int par_len_) | ||
{ | ||
std::string par = eCAL::Process::GetProcessParameter(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'par' of type 'std::string' (aka 'basic_string') can be declared 'const' [misc-const-correctness]
std::string par = eCAL::Process::GetProcessParameter(); | |
std::string const par = eCAL::Process::GetProcessParameter(); |
There was a problem hiding this 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 34. Check the log or trigger a new build to see more.
|
||
ECALC_API int eCAL_Process_StopProcessName(const char* proc_name_) | ||
{ | ||
return(eCAL::Process::StopProcess(proc_name_)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: implicit conversion bool -> 'int' [readability-implicit-bool-conversion]
return(eCAL::Process::StopProcess(proc_name_)); | |
returnstatic_cast<int>(eCAL::Process::StopProcess(proc_name_)); |
|
||
ECALC_API int eCAL_Process_StopProcessID(int proc_id_) | ||
{ | ||
return(eCAL::Process::StopProcess(proc_id_)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: implicit conversion bool -> 'int' [readability-implicit-bool-conversion]
return(eCAL::Process::StopProcess(proc_id_)); | |
returnstatic_cast<int>(eCAL::Process::StopProcess(proc_id_)); |
#if ECAL_CORE_PUBLISHER | ||
namespace | ||
{ | ||
std::recursive_mutex g_pub_event_callback_mtx; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'g_pub_event_callback_mtx' is non-const and globally accessible, consider making it const [cppcoreguidelines-avoid-non-const-global-variables]
std::recursive_mutex g_pub_event_callback_mtx;
^
{ | ||
ECALC_API ECAL_HANDLE eCAL_Pub_New() | ||
{ | ||
auto* pub = new eCAL::CPublisher; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: initializing non-owner 'eCAL::CPublisher *' with a newly created 'gsl::owner<>' [cppcoreguidelines-owning-memory]
auto* pub = new eCAL::CPublisher;
^
{ | ||
if (handle_ == nullptr) return(0); | ||
auto* pub = static_cast<eCAL::CPublisher*>(handle_); | ||
struct eCAL::SDataTypeInformation topic_info = { topic_type_name_, topic_type_encoding_, std::string(topic_desc_, static_cast<size_t>(topic_desc_len_)) }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'topic_info' of type 'struct eCAL::SDataTypeInformation' can be declared 'const' [misc-const-correctness]
struct eCAL::SDataTypeInformation topic_info = { topic_type_name_, topic_type_encoding_, std::string(topic_desc_, static_cast<size_t>(topic_desc_len_)) }; | |
struct eCAL::SDataTypeInformation const topic_info = { topic_type_name_, topic_type_encoding_, std::string(topic_desc_, static_cast<size_t>(topic_desc_len_)) }; |
{ | ||
if (handle_ == nullptr) return(0); | ||
auto* sub = static_cast<eCAL::CSubscriber*>(handle_); | ||
struct eCAL::SDataTypeInformation topic_info = { topic_type_name_, topic_type_encoding_, std::string(topic_desc_, static_cast<size_t>(topic_desc_len_)) }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'topic_info' of type 'struct eCAL::SDataTypeInformation' can be declared 'const' [misc-const-correctness]
struct eCAL::SDataTypeInformation topic_info = { topic_type_name_, topic_type_encoding_, std::string(topic_desc_, static_cast<size_t>(topic_desc_len_)) }; | |
struct eCAL::SDataTypeInformation const topic_info = { topic_type_name_, topic_type_encoding_, std::string(topic_desc_, static_cast<size_t>(topic_desc_len_)) }; |
{ | ||
if (handle_ == nullptr) return(0); | ||
auto* sub = static_cast<eCAL::CSubscriber*>(handle_); | ||
delete sub; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: deleting a pointer through a type that is not marked 'gsl::owner<>'; consider using a smart pointer instead [cppcoreguidelines-owning-memory]
delete sub;
^
Additional context
ecal/core/src/cimpl/ecal_subscriber_cimpl.cpp:83: variable declared here
auto* sub = static_cast<eCAL::CSubscriber*>(handle_);
^
if (handle_ == nullptr) return(0); | ||
auto* sub = static_cast<eCAL::CSubscriber*>(handle_); | ||
const eCAL::SDataTypeInformation datatype_info = sub->GetDataTypeInformation(); | ||
int buffer_len = CopyBuffer(buf_, buf_len_, datatype_info.name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'buffer_len' of type 'int' can be declared 'const' [misc-const-correctness]
int buffer_len = CopyBuffer(buf_, buf_len_, datatype_info.name); | |
int const buffer_len = CopyBuffer(buf_, buf_len_, datatype_info.name); |
if (handle_ == nullptr) return(0); | ||
auto* sub = static_cast<eCAL::CSubscriber*>(handle_); | ||
const eCAL::SDataTypeInformation datatype_info = sub->GetDataTypeInformation(); | ||
int buffer_len = CopyBuffer(buf_, buf_len_, datatype_info.encoding); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'buffer_len' of type 'int' can be declared 'const' [misc-const-correctness]
int buffer_len = CopyBuffer(buf_, buf_len_, datatype_info.encoding); | |
int const buffer_len = CopyBuffer(buf_, buf_len_, datatype_info.encoding); |
if (handle_ == nullptr) return(0); | ||
auto* sub = static_cast<eCAL::CSubscriber*>(handle_); | ||
const eCAL::SDataTypeInformation datatype_info = sub->GetDataTypeInformation(); | ||
int buffer_len = CopyBuffer(buf_, buf_len_, datatype_info.descriptor); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'buffer_len' of type 'int' can be declared 'const' [misc-const-correctness]
int buffer_len = CopyBuffer(buf_, buf_len_, datatype_info.descriptor); | |
int const buffer_len = CopyBuffer(buf_, buf_len_, datatype_info.descriptor); |
There was a problem hiding this 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
#if ECAL_CORE_MONITORING | ||
ECALC_API void eCAL_Util_ShutdownUnitName(const char* unit_name_) | ||
{ | ||
std::string unit_name = unit_name_; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'unit_name' of type 'std::string' (aka 'basic_string') can be declared 'const' [misc-const-correctness]
std::string unit_name = unit_name_; | |
std::string const unit_name = unit_name_; |
Description