Slamtec / rplidar_ros

BSD 2-Clause "Simplified" License
497 stars 532 forks source link

Add static cast to avoid narrowing error #66

Open fmrico opened 2 years ago

fmrico commented 2 years ago

Dear maintainers,

As happened to @sai5555 in #56, I got this error building rplidar_ros from sources (Noetic, g++ (Ubuntu 10.3.0-1ubuntu1~20.04) 10.3.0):

/home/fmrico/ros/ros1/robots_ws/src/ThirdParty/rplidar_ros/sdk/src/sl_lidar_driver.cpp:556:34: error: narrowing conversion of ‘rp::hal::Event::EVENT_TIMEOUT’ from ‘int’ to ‘long unsigned int’ [-Wnarrowing]
  556 |             case rp::hal::Event::EVENT_TIMEOUT:

This PR contains a simple fix for this.

I hope it helps