From 65de9b593e4f86f933be0c9ee496df0b5b29f032 Mon Sep 17 00:00:00 2001 From: jaw Date: Fri, 25 Oct 2024 07:56:59 +0200 Subject: [PATCH 1/5] fixed Wreorder --- modules/common/include/ifm3d/common/logging/log_entry.h | 8 ++++---- modules/framegrabber/src/libifm3d_framegrabber/buffer.cpp | 4 ++-- .../src/libifm3d_framegrabber/distance_image_info.cpp | 6 +++--- .../src/libifm3d_framegrabber/frame_grabber_impl.hpp | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/modules/common/include/ifm3d/common/logging/log_entry.h b/modules/common/include/ifm3d/common/logging/log_entry.h index 67dfa92f..70e02304 100644 --- a/modules/common/include/ifm3d/common/logging/log_entry.h +++ b/modules/common/include/ifm3d/common/logging/log_entry.h @@ -24,12 +24,12 @@ namespace ifm3d const char* file, const char* function, size_t line) - : message_(message), + : time_(logging_clock::now()), log_level_(log_level), - file_(file), - func_(function), + message_(message), line_(line), - time_(logging_clock::now()) + func_(function), + file_(file) {} const logging_timepoint& diff --git a/modules/framegrabber/src/libifm3d_framegrabber/buffer.cpp b/modules/framegrabber/src/libifm3d_framegrabber/buffer.cpp index b68ae4a0..a7dd114c 100644 --- a/modules/framegrabber/src/libifm3d_framegrabber/buffer.cpp +++ b/modules/framegrabber/src/libifm3d_framegrabber/buffer.cpp @@ -84,8 +84,8 @@ namespace ifm3d ifm3d::Buffer::Buffer() : data_(nullptr), - rows_(0), cols_(0), + rows_(0), nchannel_(0), data_size_in_bytes_(0), size_(0), @@ -171,4 +171,4 @@ ifm3d::json ifm3d::Buffer::metadata() const { return metadata_; -} \ No newline at end of file +} diff --git a/modules/framegrabber/src/libifm3d_framegrabber/distance_image_info.cpp b/modules/framegrabber/src/libifm3d_framegrabber/distance_image_info.cpp index ffe88b0a..69e08dfa 100644 --- a/modules/framegrabber/src/libifm3d_framegrabber/distance_image_info.cpp +++ b/modules/framegrabber/src/libifm3d_framegrabber/distance_image_info.cpp @@ -228,10 +228,10 @@ namespace ifm3d inverse_intrinsic_calibration(inv_intr_calib), u16_distance_buffer(distance_buffer), u16_amplitude_buffer(amplitude_buffer), - timestamps_nsec(timestamps_nsec), - exposure_times_sec(exposure_times_sec), width(w), - height(h) + height(h), + timestamps_nsec(timestamps_nsec), + exposure_times_sec(exposure_times_sec) {} std::vector diff --git a/modules/framegrabber/src/libifm3d_framegrabber/frame_grabber_impl.hpp b/modules/framegrabber/src/libifm3d_framegrabber/frame_grabber_impl.hpp index ecf8cc8b..d7764505 100644 --- a/modules/framegrabber/src/libifm3d_framegrabber/frame_grabber_impl.hpp +++ b/modules/framegrabber/src/libifm3d_framegrabber/frame_grabber_impl.hpp @@ -177,11 +177,11 @@ ifm3d::FrameGrabber::Impl::Impl(ifm3d::Device::Ptr cam, pcic_port_(pcic_port.value_or(ifm3d::DEFAULT_PCIC_PORT)), io_service_(), sock_(), + finish_future_(std::async(std::launch::async, []() {})), + is_ready_(false), wait_for_frame_future(wait_for_frame_promise.get_future()), trigger_feedback_future_(trigger_feedback_promise_.get_future()), - ready_future_(ready_promise_.get_future()), - finish_future_(std::async(std::launch::async, []() {})), - is_ready_(false) + ready_future_(ready_promise_.get_future()) { auto device_type = this->cam_->WhoAmI(); if (device_type == Device::device_family::O3D) From 854d9f4b9452dd8ebb6048bcb4779f1ec79bd613 Mon Sep 17 00:00:00 2001 From: jaw Date: Fri, 25 Oct 2024 08:08:49 +0200 Subject: [PATCH 2/5] fixed Wcatch-value --- modules/device/src/libifm3d_device/discovery.hpp | 4 ++-- .../src/libifm3d_framegrabber/frame_grabber_impl.hpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/device/src/libifm3d_device/discovery.hpp b/modules/device/src/libifm3d_device/discovery.hpp index ca2e5bf1..70428969 100644 --- a/modules/device/src/libifm3d_device/discovery.hpp +++ b/modules/device/src/libifm3d_device/discovery.hpp @@ -365,7 +365,7 @@ namespace ifm3d { shared_this->_CheckTimeout(); } - catch (std::system_error err) + catch (const std::system_error &err) { if (err.code().category() == asio::system_category() && err.code().value() == asio::error::bad_descriptor) @@ -643,4 +643,4 @@ namespace ifm3d std::mutex device_list_lock_; }; } -#endif // IFM3D_CAMERA_DISCOVERY_HPP \ No newline at end of file +#endif // IFM3D_CAMERA_DISCOVERY_HPP diff --git a/modules/framegrabber/src/libifm3d_framegrabber/frame_grabber_impl.hpp b/modules/framegrabber/src/libifm3d_framegrabber/frame_grabber_impl.hpp index d7764505..299849c6 100644 --- a/modules/framegrabber/src/libifm3d_framegrabber/frame_grabber_impl.hpp +++ b/modules/framegrabber/src/libifm3d_framegrabber/frame_grabber_impl.hpp @@ -694,7 +694,7 @@ ifm3d::FrameGrabber::Impl::ImageHandler() this->new_frame_callback_(frame); } } - catch (ifm3d::Error ex) + catch (const ifm3d::Error &ex) { // We might get empty frames when we requesting only algo debug but // also enable async notifications or async errors, so we just ignore @@ -707,7 +707,7 @@ ifm3d::FrameGrabber::Impl::ImageHandler() LOG_WARNING("Bad image: {}", ex.message()); } } - catch (std::exception ex) + catch (const std::exception &ex) { LOG_WARNING("Bad image: {}", ex.what()); } From bf9b02ff2d9859c6218c5319383e1ce3e59695aa Mon Sep 17 00:00:00 2001 From: jaw Date: Fri, 25 Oct 2024 08:15:50 +0200 Subject: [PATCH 3/5] fixed Wmaybe-uninitialized --- .../src/libifm3d_framegrabber/organizer_utils.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/framegrabber/src/libifm3d_framegrabber/organizer_utils.cpp b/modules/framegrabber/src/libifm3d_framegrabber/organizer_utils.cpp index 95aec96c..16cba732 100644 --- a/modules/framegrabber/src/libifm3d_framegrabber/organizer_utils.cpp +++ b/modules/framegrabber/src/libifm3d_framegrabber/organizer_utils.cpp @@ -154,7 +154,7 @@ create_xyz_buffer(const std::vector& data, int row = -1; int xyz_col = 0; - T* xyz_ptr; + T* xyz_ptr = NULL; T x_, y_, z_; constexpr T bad_pixel = 0; @@ -622,4 +622,4 @@ ifm3d::create_metadata(const std::vector& data, std::size_t idx) return ifm3d::json::parse(metadata); } return {}; -} \ No newline at end of file +} From 38b97a2bcb4355a7496a7e3c71f1345f0876afe2 Mon Sep 17 00:00:00 2001 From: jaw Date: Fri, 25 Oct 2024 08:28:00 +0200 Subject: [PATCH 4/5] fixed Wsign-compare --- modules/device/src/libifm3d_device/discovery.hpp | 4 ++-- .../src/libifm3d_framegrabber/distance_image_info.cpp | 8 ++++---- modules/tools/src/libifm3d_tools/common/fg/jitter_app.cpp | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/modules/device/src/libifm3d_device/discovery.hpp b/modules/device/src/libifm3d_device/discovery.hpp index 70428969..0ee9705e 100644 --- a/modules/device/src/libifm3d_device/discovery.hpp +++ b/modules/device/src/libifm3d_device/discovery.hpp @@ -130,7 +130,7 @@ namespace ifm3d ss << std::hex << std::setfill('0') << std::setw(2) << int(value); }; - for (int i = 0; i < size - 1; i++) + for (size_t i = 0; i + 1 < size; i++) { converttoHexandAppend(mac[i]); ss << "::"; @@ -402,7 +402,7 @@ namespace ifm3d public: IFMDeviceDiscovery() : work_guard_(asio::make_work_guard(io_context_)) { - for (auto i = 0; i < THREADS_FOR_IO_OPERATIONS; i++) + for (unsigned int i = 0; i < THREADS_FOR_IO_OPERATIONS; i++) { thread_pool_.push_back( std::thread(std::bind([&] { io_context_.run(); }))); diff --git a/modules/framegrabber/src/libifm3d_framegrabber/distance_image_info.cpp b/modules/framegrabber/src/libifm3d_framegrabber/distance_image_info.cpp index 69e08dfa..58103bdd 100644 --- a/modules/framegrabber/src/libifm3d_framegrabber/distance_image_info.cpp +++ b/modules/framegrabber/src/libifm3d_framegrabber/distance_image_info.cpp @@ -40,7 +40,7 @@ namespace ifm3d std::vector u16_buffer(npts); idx += data_offset; - for (auto i = 0; i < npts; ++i) + for (std::uint32_t i = 0; i < npts; ++i) { u16_buffer[i] = ifm3d::mkval(data_buffer.data() + idx); idx += UINT16_DATA_SIZE; @@ -54,7 +54,7 @@ namespace ifm3d { std::uint32_t data_offset{}; std::vector t_vector(size); - for (auto i = 0; i < size; i++) + for (size_t i = 0; i < size; i++) { t_vector[i] = ifm3d::mkval(data_buffer + data_offset); data_offset += sizeof(T); @@ -67,7 +67,7 @@ namespace ifm3d { std::uint32_t data_offset{}; std::vector floatVector(size); - for (auto i = 0; i < size; i++) + for (std::size_t i = 0; i < size; i++) { floatVector[i] = ifm3d::mkval(data_buffer + data_offset); data_offset += FLOAT_DATA_SIZE; @@ -249,7 +249,7 @@ namespace ifm3d std::vector dist_u16(npts); uint16_t* u16Dist = (uint16_t*)dist_u16.data(); - for (auto i = 0; i < npts; ++i) + for (unsigned int i = 0; i < npts; ++i) { u16Dist[i] = u16_distance_buffer[i]; } diff --git a/modules/tools/src/libifm3d_tools/common/fg/jitter_app.cpp b/modules/tools/src/libifm3d_tools/common/fg/jitter_app.cpp index 407a0844..fba9c175 100644 --- a/modules/tools/src/libifm3d_tools/common/fg/jitter_app.cpp +++ b/modules/tools/src/libifm3d_tools/common/fg/jitter_app.cpp @@ -105,7 +105,7 @@ mad(const std::vector& arr, T center) { std::size_t n = arr.size(); std::vector arr_d(n); - for (int i = 0; i < n; ++i) + for (std::size_t i = 0; i < n; ++i) { arr_d[i] = std::abs(arr[i] - center); } From 02686e4d890b48b6ea31aba3e24dd43451c9ef7d Mon Sep 17 00:00:00 2001 From: jaw Date: Fri, 25 Oct 2024 08:58:39 +0200 Subject: [PATCH 5/5] fixed Wsuggest-override --- modules/device/include/ifm3d/device/err.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/device/include/ifm3d/device/err.h b/modules/device/include/ifm3d/device/err.h index ae1b6c31..d841c75d 100644 --- a/modules/device/include/ifm3d/device/err.h +++ b/modules/device/include/ifm3d/device/err.h @@ -122,7 +122,7 @@ namespace ifm3d /** * Exception message */ - virtual const char* what() const noexcept; + const char* what() const noexcept override; /** * Accessor to the underlying error code