Skip to content

Commit 379696f

Browse files
authored
Merge pull request #47 from JustusBraun/fix/warnings
Fix warnings for users of the library
2 parents 9c9fc5f + 6d1f825 commit 379696f

File tree

7 files changed

+26
-17
lines changed

7 files changed

+26
-17
lines changed

include/lvr2/algorithm/ColorAlgorithms.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ boost::optional<DenseVertexMap<RGB8Color>> calcColorFromPointCloud(
7979
*
8080
* @return The 8-bit RGB-Color, interpreted as rainbowcolor.
8181
*/
82-
static RGB8Color floatToRainbowColor(float value);
82+
inline RGB8Color floatToRainbowColor(float value);
8383

8484
/**
8585
* @brief Convert a given float to an 8-bit Grayscale-Color.
@@ -92,7 +92,7 @@ static RGB8Color floatToRainbowColor(float value);
9292
*
9393
* @return The 8-bit Grayscale-Color.
9494
*/
95-
static RGB8Color floatToGrayScaleColor(float value);
95+
inline RGB8Color floatToGrayScaleColor(float value);
9696

9797
/**
9898
* @brief Calculate the color for the centroid of a given face

include/lvr2/algorithm/ColorAlgorithms.tcc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ boost::optional<DenseVertexMap<RGB8Color>> calcColorFromPointCloud(
9191
return vertexMap;
9292
}
9393

94-
static RGB8Color floatToRainbowColor(float value)
94+
inline RGB8Color floatToRainbowColor(float value)
9595
{
9696
value = std::min(value, 1.0f);
9797
value = std::max(value, 0.0f);
@@ -135,7 +135,7 @@ static RGB8Color floatToRainbowColor(float value)
135135
}
136136
}
137137

138-
static RGB8Color floatToGrayScaleColor(float value)
138+
inline RGB8Color floatToGrayScaleColor(float value)
139139
{
140140
if(value > 1)
141141
{

include/lvr2/io/deprecated/hdf5/ChannelIO.tcc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ template<typename Derived>
142142
template <typename T>
143143
bool ChannelIO<Derived>::getChannel(const std::string group, const std::string name, boost::optional<AttributeChannel<T>>& channel)
144144
{
145+
(void) group;
145146
// TODO check group for vertex / face attribute and set flag in hdf5 channel
146147
HighFive::Group g = hdf5util::getGroup(m_file_access->m_hdf5_file, "channels");
147148
if(m_file_access->m_hdf5_file && m_file_access->m_hdf5_file->isValid())
@@ -245,4 +246,4 @@ bool ChannelIO<Derived>::addChannel(const std::string group, const std::string n
245246

246247
} // namespace hdf5features
247248

248-
} // namespace lvr2
249+
} // namespace lvr2

include/lvr2/io/deprecated/hdf5/MeshIO.tcc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ MeshBufferPtr MeshIO<Derived>::load(HighFive::Group& group)
223223
}
224224
else
225225
{
226-
for(int i = 0; i < dimensionTextureHandle.at(0); i++)
226+
for(long unsigned int i = 0; i < dimensionTextureHandle.at(0); i++)
227227
{
228228
lvr2::Material nextMat;
229229
if(materialColor.get()[i * 3] != -1)

include/lvr2/io/deprecated/hdf5/PointCloudIO.tcc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ template<typename Derived>
102102
bool PointCloudIO<Derived>::isPointCloud(
103103
HighFive::Group& group)
104104
{
105+
(void) group;
105106
// std::string id(PointCloudIO<Derived>::ID);
106107
// std::string obj(PointCloudIO<Derived>::OBJID);
107108
// return hdf5util::checkAttribute(group, "IO", id)
@@ -112,4 +113,4 @@ bool PointCloudIO<Derived>::isPointCloud(
112113

113114
} // hdf5features
114115

115-
} // namespace lvr2
116+
} // namespace lvr2

include/lvr2/util/Hdf5Util.tcc

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,10 @@ std::unique_ptr<HighFive::DataSet> createDataset(HighFive::Group& g,
284284
if (dataset->getDataType() != HighFive::AtomicType<T>())
285285
{
286286
// different datatype -> delete
287-
int result = H5Ldelete(g.getId(), datasetName.data(), H5P_DEFAULT);
287+
if (0 > H5Ldelete(g.getId(), datasetName.data(), H5P_DEFAULT))
288+
{
289+
std::cout << "[Hdf5Util - createDataset] Failed to delete dataset " << datasetName << std::endl;
290+
}
288291
dataset = std::make_unique<HighFive::DataSet>(
289292
g.createDataSet<T>(datasetName, dataSpace, properties));
290293
}
@@ -326,7 +329,10 @@ std::unique_ptr<HighFive::DataSet> createDataset(HighFive::Group& g,
326329
std::cout << "[Hdf5Util - createDataset] WARNING: could not resize. Generating new "
327330
"space..."
328331
<< std::endl;
329-
int result = H5Ldelete(g.getId(), datasetName.data(), H5P_DEFAULT);
332+
if (0 > H5Ldelete(g.getId(), datasetName.data(), H5P_DEFAULT))
333+
{
334+
std::cout << "[Hdf5Util - createDataset] Failed to delete dataset " << datasetName << std::endl;
335+
}
330336

331337
dataset = std::make_unique<HighFive::DataSet>(
332338
g.createDataSet<T>(datasetName, dataSpace, properties));
@@ -343,7 +349,8 @@ std::unique_ptr<HighFive::DataSet> createDataset(HighFive::Group& g,
343349
std::cout << "[Hdf5Util - createDataset] WARNING: could not create dataset ' << " << datasetName << "'. Data Type not allowed by H5" << std::endl;
344350
}
345351

346-
return std::move(dataset);
352+
// using std::move() on dataset in this return prevents the compiler from optimizing away the copy (copy elision)
353+
return dataset;
347354
}
348355

349356
template <typename T, typename HT>
@@ -1088,4 +1095,4 @@ YAML::Node getAttributeMeta(
10881095

10891096
} // namespace hdf5util
10901097

1091-
} // namespace lvr2
1098+
} // namespace lvr2

include/lvr2/util/Logging.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -154,22 +154,22 @@ struct LoggerInfo{};
154154
struct LoggerDebug{};
155155

156156
/// @brief Endline and flush for logger objects
157-
static LoggerEndline endl;
157+
inline constexpr LoggerEndline endl;
158158

159159
/// @brief Marks error log level for streamed output
160-
static LoggerError error;
160+
inline constexpr LoggerError error;
161161

162162
/// @brief Marks warning log level for streamed output
163-
static LoggerWarning warning;
163+
inline constexpr LoggerWarning warning;
164164

165165
/// @brief Marks trace log level for streamed output
166-
static LoggerTrace trace;
166+
inline constexpr LoggerTrace trace;
167167

168168
/// @brief Marks info log level for streamed output
169-
static LoggerInfo info;
169+
inline constexpr LoggerInfo info;
170170

171171
/// @brief Marks debug log level for streamed output
172-
static LoggerDebug debug;
172+
inline constexpr LoggerDebug debug;
173173

174174
// Alias for logger singleton
175175
using logout = Logger;

0 commit comments

Comments
 (0)