Skip to content

Commit

Permalink
Fix gcc warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
jlblancoc committed Sep 21, 2024
1 parent 01ac53c commit 7fba71c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions libs/ros2bridge/src/point_cloud2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ bool mrpt::ros2bridge::fromROS(const sensor_msgs::msg::PointCloud2& msg, CSimple
{
const unsigned char* msg_data = row_data + col * msg.point_step;

float x, y, z;
float x = 0, y = 0, z = 0;
get_float_from_field(x_field, msg_data, x);
get_float_from_field(y_field, msg_data, y);
get_float_from_field(z_field, msg_data, z);
Expand Down Expand Up @@ -165,7 +165,7 @@ bool mrpt::ros2bridge::fromROS(const sensor_msgs::msg::PointCloud2& msg, CPoints
{
const unsigned char* msg_data = row_data + col * msg.point_step;

float x, y, z, i;
float x = 0, y = 0, z = 0, i = 0;
get_float_from_field(x_field, msg_data, x);
get_float_from_field(y_field, msg_data, y);
get_float_from_field(z_field, msg_data, z);
Expand Down Expand Up @@ -212,15 +212,15 @@ bool mrpt::ros2bridge::fromROS(const sensor_msgs::msg::PointCloud2& msg, CPoints
{
const unsigned char* msg_data = row_data + col * msg.point_step;

float x, y, z;
float x = 0, y = 0, z = 0;
get_float_from_field(x_field, msg_data, x);
get_float_from_field(y_field, msg_data, y);
get_float_from_field(z_field, msg_data, z);
obj.setPointFast(idx, x, y, z);

if (i_field)
{
float i;
float i = 0;
get_float_from_field(i_field, msg_data, i);
obj.setPointIntensity(idx, i);
}
Expand Down

0 comments on commit 7fba71c

Please sign in to comment.