From 5b42d5a4da172d0bfdd8bcfbbe69c8ce9a80d6ce Mon Sep 17 00:00:00 2001 From: Jose Luis Blanco-Claraco Date: Sun, 25 Aug 2024 23:53:44 +0200 Subject: [PATCH] FIX: gcc warnings (false positives?) --- libs/ros1bridge/src/point_cloud2.cpp | 4 ++-- libs/ros2bridge/src/point_cloud2.cpp | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libs/ros1bridge/src/point_cloud2.cpp b/libs/ros1bridge/src/point_cloud2.cpp index 160f5c4062..0ca9a7e763 100644 --- a/libs/ros1bridge/src/point_cloud2.cpp +++ b/libs/ros1bridge/src/point_cloud2.cpp @@ -560,7 +560,7 @@ bool mrpt::ros1bridge::fromROS( { const unsigned char* msg_data = row_data + col * msg.point_step; - float x, y, z; + float x = 0, y = 0, z = 0; uint16_t ring_id = 0; get_float_from_field(x_field, msg_data, x); get_float_from_field(y_field, msg_data, y); @@ -589,7 +589,7 @@ bool mrpt::ros1bridge::fromROS( if (i_field) { - float intensity; + float intensity = 0; get_float_from_field(i_field, msg_data, intensity); obj.intensityImage(ring_id, az_idx) = lround(255 * intensity / max_intensity); } diff --git a/libs/ros2bridge/src/point_cloud2.cpp b/libs/ros2bridge/src/point_cloud2.cpp index 34685ae174..a7de829f25 100644 --- a/libs/ros2bridge/src/point_cloud2.cpp +++ b/libs/ros2bridge/src/point_cloud2.cpp @@ -232,7 +232,7 @@ bool mrpt::ros2bridge::fromROS(const sensor_msgs::msg::PointCloud2& msg, CPoints } if (t_field) { - double t; + double t = 0; get_double_from_field(t_field, msg_data, t); // If the sensor uses absolute timestamp, convert them to relative @@ -546,7 +546,7 @@ bool mrpt::ros2bridge::fromROS( { const unsigned char* msg_data = row_data + col * msg.point_step; - float x, y, z; + float x = 0, y = 0, z = 0; uint16_t ring_id = 0; get_float_from_field(x_field, msg_data, x); get_float_from_field(y_field, msg_data, y); @@ -575,7 +575,7 @@ bool mrpt::ros2bridge::fromROS( if (i_field) { - float intensity; + float intensity = 0; get_float_from_field(i_field, msg_data, intensity); obj.intensityImage(ring_id, az_idx) = lround(255 * intensity / max_intensity); }