ros / roscpp_core

ros distribution sandbox
88 stars 116 forks source link

added cast to uint32_t in roscpp_serialization #113

Closed anja-sheppard closed 5 years ago

anja-sheppard commented 5 years ago

Wanted to fix -Wconversion warning brought up in #112 :

In file included from /opt/ros/melodic/include/ros/publisher.h:34:0,
                 from /opt/ros/melodic/include/ros/node_handle.h:32,
                 from /opt/ros/melodic/include/ros/ros.h:45,
                 from /root/src/my_ros_ws/src/item_stream_service_server.cpp:2:
/root/src/my_ros_ws/src/roscpp_core/roscpp_serialization/include/ros/serialization.h: In instantiation of ‘void ros::serialization::deserializeMessage(const ros::SerializedMessage&, M&) [with M = item_server::RequestItemStreamRequest_<std::allocator<void> >]’:
/opt/ros/melodic/include/ros/service_callback_helper.h:176:28:   required from ‘bool ros::ServiceCallbackHelperT<Spec>::call(ros::ServiceCallbackHelperCallParams&) [with Spec = ros::ServiceSpec<item_server::RequestItemStreamRequest_<std::allocator<void> >, item_server::RequestItemStreamResponse_<std::allocator<void> > >]’
/root/src/my_ros_ws/src/item_server/src/item_stream_service_server.cpp:26:1:   required from here
/root/src/my_ros_ws/src/roscpp_core/roscpp_serialization/include/ros/serialization.h:859:42: warning: conversion to ‘uint32_t {aka unsigned int}’ from ‘long unsigned int’ may alter its value [-Wconversion]
   IStream s(m.message_start, m.num_bytes - (m.message_start - m.buf.get()));
dirk-thomas commented 5 years ago

Thanks for the patch.