aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRosen Penev <rosenp@gmail.com>2020-04-23 14:10:38 -0700
committerHans Verkuil <hverkuil-cisco@xs4all.nl>2020-04-24 14:43:24 +0200
commit222e1760c78f6a65b9702f9c6064e500a39906fa (patch)
tree7c9ed734d3a897dea95b1f24f5fb027fad61e018
parentc71e51f4b05131a093f285faee89aae00b003629 (diff)
utils: fix implicit float conversions
Found with -Wfloat-conversion Signed-off-by: Rosen Penev <rosenp@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
-rw-r--r--utils/cec-ctl/cec-ctl.cpp4
-rw-r--r--utils/cec-ctl/cec-pin.cpp2
-rw-r--r--utils/v4l2-compliance/v4l2-test-buffers.cpp2
-rw-r--r--utils/v4l2-ctl/v4l2-ctl-misc.cpp4
-rw-r--r--utils/v4l2-ctl/v4l2-ctl-streaming.cpp2
-rw-r--r--utils/v4l2-ctl/v4l2-ctl-subdev.cpp2
6 files changed, 8 insertions, 8 deletions
diff --git a/utils/cec-ctl/cec-ctl.cpp b/utils/cec-ctl/cec-ctl.cpp
index f4133494..ae7b2dba 100644
--- a/utils/cec-ctl/cec-ctl.cpp
+++ b/utils/cec-ctl/cec-ctl.cpp
@@ -1507,8 +1507,8 @@ static void stress_test_power_cycle(struct node &node, unsigned cnt,
srandom(seed);
for (;;) {
- unsigned usecs1 = mod_usleep ? random() % mod_usleep : sleep_before_on * 1000000;
- unsigned usecs2 = mod_usleep ? random() % mod_usleep : sleep_before_off * 1000000;
+ unsigned usecs1 = mod_usleep ? random() % mod_usleep : static_cast<unsigned>(sleep_before_on * 1000000);
+ unsigned usecs2 = mod_usleep ? random() % mod_usleep : static_cast<unsigned>(sleep_before_off * 1000000);
usecs1 += min_usleep;
usecs2 += min_usleep;
diff --git a/utils/cec-ctl/cec-pin.cpp b/utils/cec-ctl/cec-pin.cpp
index 0322ad5e..c09d6bbd 100644
--- a/utils/cec-ctl/cec-pin.cpp
+++ b/utils/cec-ctl/cec-pin.cpp
@@ -261,7 +261,7 @@ static void cec_pin_rx_data_bit_was_low(__u64 ev_ts, __u64 usecs, __u64 usecs_mi
* If the low drive starts at the end of a 0 bit, then the actual
* maximum time that the bus can be low is the two summed.
*/
- const unsigned max_low_drive = CEC_TIM_LOW_DRIVE_ERROR_MAX +
+ const unsigned max_low_drive = static_cast<unsigned>(CEC_TIM_LOW_DRIVE_ERROR_MAX) +
CEC_TIM_DATA_BIT_0_LOW_MAX + CEC_TIM_MARGIN;
low_usecs = usecs;
diff --git a/utils/v4l2-compliance/v4l2-test-buffers.cpp b/utils/v4l2-compliance/v4l2-test-buffers.cpp
index 93df7034..561a3376 100644
--- a/utils/v4l2-compliance/v4l2-test-buffers.cpp
+++ b/utils/v4l2-compliance/v4l2-test-buffers.cpp
@@ -2597,7 +2597,7 @@ static void streamFmt(struct node *node, __u32 pixelformat, __u32 w, __u32 h,
char hz[32] = "";
if (!frame_count)
- frame_count = f ? 1.0 / fract2f(f) : 10;
+ frame_count = f ? static_cast<unsigned>(1.0f / fract2f(f)) : 10;
node->g_fmt(fmt);
fmt.s_pixelformat(pixelformat);
fmt.s_width(w);
diff --git a/utils/v4l2-ctl/v4l2-ctl-misc.cpp b/utils/v4l2-ctl/v4l2-ctl-misc.cpp
index cb933217..b038cfe9 100644
--- a/utils/v4l2-ctl/v4l2-ctl-misc.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-misc.cpp
@@ -320,7 +320,7 @@ void misc_set(cv4l_fd &_fd)
parm.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
parm.parm.capture.timeperframe.numerator = 1000;
parm.parm.capture.timeperframe.denominator =
- fps * parm.parm.capture.timeperframe.numerator;
+ static_cast<uint32_t>(fps * parm.parm.capture.timeperframe.numerator);
if (doioctl(fd, VIDIOC_S_PARM, &parm) == 0) {
struct v4l2_fract *tf = &parm.parm.capture.timeperframe;
@@ -338,7 +338,7 @@ void misc_set(cv4l_fd &_fd)
parm.type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
parm.parm.output.timeperframe.numerator = 1000;
parm.parm.output.timeperframe.denominator =
- output_fps * parm.parm.output.timeperframe.numerator;
+ static_cast<uint32_t>(output_fps * parm.parm.output.timeperframe.numerator);
if (doioctl(fd, VIDIOC_S_PARM, &parm) == 0) {
struct v4l2_fract *tf = &parm.parm.output.timeperframe;
diff --git a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp
index 066a336a..6981a3cc 100644
--- a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp
@@ -569,7 +569,7 @@ static void print_concise_buffer(FILE *f, cv4l_buffer &buf, cv4l_fmt &fmt,
if (!skip_ts && (buf.g_flags() & V4L2_BUF_FLAG_TIMESTAMP_MASK) != V4L2_BUF_FLAG_TIMESTAMP_COPY) {
double ts = buf.g_timestamp().tv_sec + buf.g_timestamp().tv_usec / 1000000.0;
fprintf(f, " ts: %.06f", ts);
- if (last_ts)
+ if (last_ts <= 0.0)
fprintf(f, " delta: %.03f ms", (ts - last_ts) * 1000.0);
last_ts = ts;
diff --git a/utils/v4l2-ctl/v4l2-ctl-subdev.cpp b/utils/v4l2-ctl/v4l2-ctl-subdev.cpp
index 747f1699..5bd5f57e 100644
--- a/utils/v4l2-ctl/v4l2-ctl-subdev.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-subdev.cpp
@@ -487,7 +487,7 @@ void subdev_set(cv4l_fd &_fd)
exit(1);
}
fival.interval.numerator = 1000;
- fival.interval.denominator = set_fps * fival.interval.numerator;
+ fival.interval.denominator = static_cast<uint32_t>(set_fps * fival.interval.numerator);
printf("Note: --set-subdev-fps is only for testing.\n"
"Normally media-ctl is used to configure the video pipeline.\n");
printf("ioctl: VIDIOC_SUBDEV_S_FRAME_INTERVAL (pad=%u)\n", fival.pad);

Privacy Policy