From 6e0faae19643b5a88789c336859387ca6002aae0 Mon Sep 17 00:00:00 2001 From: Dan Rose Date: Tue, 18 Feb 2020 11:50:09 -0600 Subject: [PATCH] Fix warning -Wimplicit-int-float-conversion ``` /opt/ros/master/src/eclipse-cyclonedds/cyclonedds/src/tools/pubsub/common.c:586:28: warning: implicit conversion from 'long' to 'double' changes value from 9223372036854775807 to 9223372036854775808 [-Wimplicit-int-float-conversion] if(nanosec > nextafter(INT64_MAX, 0)) { ~~~~~~~~~ ^~~~~~~~~ /usr/include/stdint.h:134:22: note: expanded from macro 'INT64_MAX' ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/stdint.h:116:24: note: expanded from macro '__INT64_C' ^~~~~~ :345:1: note: expanded from here 9223372036854775807L ^~~~~~~~~~~~~~~~~~~~ 1 warning generated. ``` Signed-off-by: Dan Rose --- src/tools/pubsub/common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/pubsub/common.c b/src/tools/pubsub/common.c index a9b5418..aeb90bf 100644 --- a/src/tools/pubsub/common.c +++ b/src/tools/pubsub/common.c @@ -583,7 +583,7 @@ int double_to_dds_duration(dds_duration_t *dd, double d) { if (d < 0) return -1; double nanosec = d * 1e9; - if(nanosec > INT64_MAX) { + if(nanosec > (double)INT64_MAX) { *dd = DDS_INFINITY; } else { *dd = (int64_t) nanosec;