Skip to content

Commit

Permalink
clang tidy ecal/core/io
Browse files Browse the repository at this point in the history
  • Loading branch information
rex-schilasky committed Nov 10, 2023
1 parent 0e8a72c commit fc330d5
Show file tree
Hide file tree
Showing 14 changed files with 27 additions and 37 deletions.
6 changes: 3 additions & 3 deletions ecal/core/src/custom_tclap/advanced_tclap_output.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ namespace CustomTclap
*/
AdvancedTclapOutput(std::ostream* output_stream, int max_width);

virtual void version(TCLAP::CmdLineInterface &cmd) override;
virtual void usage(TCLAP::CmdLineInterface &cmd) override;
virtual void failure(TCLAP::CmdLineInterface &cmd, TCLAP::ArgException &e) override;
void version(TCLAP::CmdLineInterface &cmd) override;
void usage(TCLAP::CmdLineInterface &cmd) override;
void failure(TCLAP::CmdLineInterface &cmd, TCLAP::ArgException &e) override;

/**
* @brief Hides / un-hides an argument
Expand Down
2 changes: 1 addition & 1 deletion ecal/core/src/io/ecal_memfile_broadcast_reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ namespace eCAL
std::int64_t timestamp;
};

typedef std::vector<SMemfileBroadcastMessage> MemfileBroadcastMessageListT;
using MemfileBroadcastMessageListT = std::vector<SMemfileBroadcastMessage>;

class CMemoryFileBroadcastReader
{
Expand Down
6 changes: 3 additions & 3 deletions ecal/core/src/io/ecal_memfile_db.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,19 +164,19 @@ namespace eCAL
{
bool AddFile(const std::string& name_, const bool create_, const size_t len_, SMemFileInfo& mem_file_info_)
{
if (!g_memfile_map()) return false;
if (g_memfile_map() == nullptr) return false;
return g_memfile_map()->AddFile(name_, create_, len_, mem_file_info_);
}

bool RemoveFile(const std::string& name_, const bool remove_)
{
if (!g_memfile_map()) return false;
if (g_memfile_map() == nullptr) return false;
return g_memfile_map()->RemoveFile(name_, remove_);
}

bool CheckFileSize(const std::string& name_, const size_t len_, SMemFileInfo& mem_file_info_)
{
if (!g_memfile_map()) return false;
if (g_memfile_map() == nullptr) return false;
return g_memfile_map()->CheckFileSize(name_, len_, mem_file_info_);
}
}
Expand Down
2 changes: 1 addition & 1 deletion ecal/core/src/io/ecal_memfile_db.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ namespace eCAL
bool CheckFileSize(const std::string& name_, const size_t len_, SMemFileInfo& mem_file_info_);

protected:
typedef std::unordered_map<std::string, SMemFileInfo> MemFileMapT;
using MemFileMapT = std::unordered_map<std::string, SMemFileInfo>;
std::mutex m_memfile_map_mtx;
MemFileMapT m_memfile_map;
};
Expand Down
2 changes: 1 addition & 1 deletion ecal/core/src/io/ecal_memfile_header.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

#pragma once

#include <stdint.h>
#include <cstdint>

namespace eCAL
{
Expand Down
28 changes: 9 additions & 19 deletions ecal/core/src/io/ecal_memfile_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@

#include "ecal_win_main.h"

typedef HANDLE MemFileT;
typedef HANDLE MapRegionT;
using MemFileT = HANDLE;
using MapRegionT = HANDLE;

#endif /* ECAL_OS_WINDOWS */

Expand All @@ -48,23 +48,13 @@ namespace eCAL
{
struct SMemFileInfo
{
SMemFileInfo()
{
refcnt = 0;
remove = false;
memfile = 0;
map_region = 0;
mem_address = 0;
size = 0;
exists = false;
}
int refcnt;
bool remove;
MemFileT memfile;
MapRegionT map_region;
void* mem_address;
int refcnt = 0;
bool remove = false;
MemFileT memfile = 0;
MapRegionT map_region = 0;
void* mem_address = 0;
std::string name;
size_t size;
bool exists;
size_t size = 0;
bool exists = false;
};
}
2 changes: 1 addition & 1 deletion ecal/core/src/io/ecal_memfile_pool.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

namespace eCAL
{
typedef std::function<size_t(const std::string& topic_name_, const std::string& topic_id_, const char* buf_, size_t len_, long long id_, long long clock_, long long time_, size_t hash_)> MemFileDataCallbackT;
using MemFileDataCallbackT = std::function<size_t (const std::string &, const std::string &, const char *, size_t, long long, long long, long long, size_t)>;

////////////////////////////////////////
// CMemFileObserver
Expand Down
2 changes: 1 addition & 1 deletion ecal/core/src/io/ecal_memfile_sync.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ namespace eCAL
EventHandleT event_ack;
bool event_ack_is_invalid = false; //!< The ack event has timeouted. Thus, we don't wait for it anymore, until the subscriber notifies us via registration layer that it is still alive.
};
typedef std::unordered_map<std::string, SEventHandlePair> EventHandleMapT;
using EventHandleMapT = std::unordered_map<std::string, SEventHandlePair>;
std::mutex m_event_handle_map_sync;
EventHandleMapT m_event_handle_map;
};
Expand Down
2 changes: 1 addition & 1 deletion ecal/core/src/io/ecal_named_mutex_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace eCAL
class CNamedMutexImplBase
{
public:
virtual ~CNamedMutexImplBase(){}
virtual ~CNamedMutexImplBase()= default;

virtual bool IsCreated() const = 0;
virtual bool IsRecoverable() const = 0;
Expand Down
2 changes: 1 addition & 1 deletion ecal/core/src/io/rcv_sample.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ class CSampleReceiver
int Process(const char* sample_buffer_, size_t sample_buffer_len_);

protected:
typedef std::unordered_map<int32_t, std::shared_ptr<CSampleReceiveSlot>> ReceiveSlotMapT;
using ReceiveSlotMapT = std::unordered_map<int32_t, std::shared_ptr<CSampleReceiveSlot>>;
ReceiveSlotMapT m_receive_slot_map;
std::vector<char> m_msg_buffer;
eCAL::pb::Sample m_ecal_sample;
Expand Down
4 changes: 2 additions & 2 deletions ecal/core/src/io/snd_raw_buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ namespace eCAL

size_t SendSampleBuffer(char* buf_, size_t buf_len_, long bandwidth_, TransmitCallbackT transmit_cb_)
{
if (!buf_) return(0);
if (buf_ == nullptr) return(0);

size_t sent(0);
size_t sent_sum(0);
Expand Down Expand Up @@ -168,7 +168,7 @@ namespace eCAL
// send data package
sent = transmit_cb_(buf_ + static_cast<size_t>(current_packet_num)*MSG_PAYLOAD_SIZE, sizeof(struct SUDPMessageHead) + current_snd_len);
if (sent == 0) return(sent);
if (send_sleep_us)
if (send_sleep_us != 0)
eCAL::Process::SleepFor(std::chrono::microseconds(send_sleep_us));

#ifndef NDEBUG
Expand Down
2 changes: 1 addition & 1 deletion ecal/core/src/io/snd_raw_buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ namespace eCAL
{
size_t CreateSampleBuffer(const std::string& sample_name_, const eCAL::pb::Sample& ecal_sample_, std::vector<char>& payload_);

typedef std::function<size_t(const void* buf_, const size_t len_)> TransmitCallbackT;
using TransmitCallbackT = std::function<size_t (const void *, const size_t)>;
size_t SendSampleBuffer(char* buf_, size_t buf_len_, long bandwidth_, TransmitCallbackT transmit_cb_);
}
2 changes: 1 addition & 1 deletion ecal/core/src/io/udp_init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

#include <ecal/ecal_os.h>

#include <stdio.h>
#include <cstdio>
#include <atomic>

#ifdef ECAL_OS_WINDOWS
Expand Down
2 changes: 1 addition & 1 deletion ecal/core/src/io/udp_receiver_asio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ namespace eCAL
RunIOContext(asio::chrono::milliseconds(timeout_));

// retrieve underlaying raw socket informations
if (address_)
if (address_ != nullptr)
{
if (m_sender_endpoint.address().is_v4())
{
Expand Down

0 comments on commit fc330d5

Please sign in to comment.