Skip to content

Commit 6ca89ea

Browse files
hasan-htpKerstinKeller
authored andcommitted
Fix: compiler warnings (#2688)
1 parent f98fa62 commit 6ca89ea

4 files changed

Lines changed: 13 additions & 26 deletions

File tree

contrib/ecalhdf5/src/eh5_meas_file_v2.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -275,14 +275,10 @@ bool eCAL::eh5::HDF5MeasFileV2::GetEntryData(long long entry_id, void* data) con
275275

276276
if (dataset_id < 0) return false;
277277

278-
auto size = H5Dget_storage_size(dataset_id);
279-
280278
herr_t read_status = -1;
281-
if (size >= 0)
282-
{
283-
read_status = H5Dread(dataset_id, H5T_NATIVE_UCHAR, H5S_ALL, H5S_ALL, H5P_DEFAULT, data);
284-
}
285279

280+
read_status = H5Dread(dataset_id, H5T_NATIVE_UCHAR, H5S_ALL, H5S_ALL, H5P_DEFAULT, data);
281+
286282
H5Dclose(dataset_id);
287283

288284
return (read_status >= 0);

contrib/ecalhdf5/src/hdf5_helper.cpp

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,12 @@ bool ReadStringEntryAsString(hid_t root, const std::string& url, std::string& da
7272
const auto size = H5Dget_storage_size(dataset_id);
7373

7474
herr_t read_status = -1;
75-
if (size >= 0)
76-
{
77-
data.resize(size);
78-
const auto string_data_type = H5Tcopy(H5T_C_S1);
79-
H5Tset_size(string_data_type, size);
80-
read_status = H5Dread(dataset_id, string_data_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, static_cast<void*>(const_cast<char*>(data.data())));
81-
}
75+
76+
data.resize(size);
77+
const auto string_data_type = H5Tcopy(H5T_C_S1);
78+
H5Tset_size(string_data_type, size);
79+
read_status = H5Dread(dataset_id, string_data_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, static_cast<void*>(const_cast<char*>(data.data())));
80+
8281

8382
H5Dclose(dataset_id);
8483
return (read_status >= 0);
@@ -129,11 +128,9 @@ bool ReadBinaryEntryAsString(hid_t root, const std::string& url, std::string& da
129128
data.resize(size);
130129

131130
herr_t read_status = -1;
132-
if (size >= 0)
133-
{
134-
read_status = H5Dread(dataset_id, H5T_NATIVE_UCHAR, H5S_ALL, H5S_ALL, H5P_DEFAULT, static_cast<void*>(const_cast<char*>(data.data())));
135-
}
136131

132+
read_status = H5Dread(dataset_id, H5T_NATIVE_UCHAR, H5S_ALL, H5S_ALL, H5P_DEFAULT, static_cast<void*>(const_cast<char*>(data.data())));
133+
137134
H5Dclose(dataset_id);
138135
return (read_status >= 0);
139136
}

serialization/common/common/include/ecal/msg/imeasurement.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ namespace eCAL
4444
using MessageT = T;
4545

4646
IMessageChannel(IChannel&& binary_channel_)
47-
: m_serializer{std::make_shared<Serializer>()}
48-
, binary_channel(std::move(binary_channel_))
47+
: binary_channel(std::move(binary_channel_))
48+
, m_serializer{std::make_shared<Serializer>()}
4949
{
5050
// We are trying to create a "strong" type, based on only a channel name
5151
// There is a good chance, that the created channel does not match the data

serialization/common/common/include/ecal/msg/omeasurement.h

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ namespace eCAL
2828
template <typename T, typename Serializer>
2929
class OMessageChannel
3030
{
31-
friend OMessageChannel CreateChannel(OMeasurement& meas_, const std::string& channel_name_);
32-
3331
public:
3432
// Should those be private?
3533
using SerializerT = Serializer;
@@ -57,11 +55,7 @@ namespace eCAL
5755
// The way we handle Publishers requires us to do a two pass serialization;
5856
size_t message_size = m_serializer->MessageSize(entry_.message);
5957
buffer.resize(message_size);
60-
if (message_size == 0)
61-
{
62-
m_serializer->Serialize(entry_.message, nullptr, 0);
63-
}
64-
else
58+
if (message_size > 0)
6559
{
6660
m_serializer->Serialize(entry_.message, static_cast<void*>(&buffer[0]), buffer.size());
6761
}

0 commit comments

Comments
 (0)