From 6867620ef625bdbce43eb3d44404ce8fb37960d6 Mon Sep 17 00:00:00 2001
From: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Date: Wed, 10 Jan 2018 09:10:47 -0200
Subject: [PATCH] v4l2-ctl-streaming: fix type of a time_t value
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

As warned by gcc, when compiling on arm 32 bits:

	v4l2-ctl-streaming.cpp: In function ‘int do_handle_cap(int, buffers&, FILE*, int*, unsigned int&, timespec&)’:
	v4l2-ctl-streaming.cpp:1059:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
	   if (res.tv_sec > last_sec) {
	                  ^
	v4l2-ctl-streaming.cpp: In function ‘int do_handle_out(int, buffers&, FILE*, v4l2_buffer*, unsigned int&, timespec&)’:
	v4l2-ctl-streaming.cpp:1193:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
	   if (res.tv_sec > last_sec) {
	qv4l2.cpp: In member function ‘void ApplicationWindow::calculateFps()’:
	qv4l2.cpp:692:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
	   if (res.tv_sec > last_sec) {
	                  ^

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
---
 utils/qv4l2/qv4l2.cpp                 | 2 +-
 utils/v4l2-ctl/v4l2-ctl-streaming.cpp | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/utils/qv4l2/qv4l2.cpp b/utils/qv4l2/qv4l2.cpp
index 00e78cd3..929b795b 100644
--- a/utils/qv4l2/qv4l2.cpp
+++ b/utils/qv4l2/qv4l2.cpp
@@ -674,7 +674,7 @@ error:
 
 void ApplicationWindow::calculateFps()
 {
-	static unsigned last_sec;
+	static time_t last_sec;
 
 	if (m_frame == 0) {
 		clock_gettime(CLOCK_MONOTONIC, &m_startTimestamp);
diff --git a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp
index 352e58cf..89ff2ad3 100644
--- a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp
@@ -941,7 +941,7 @@ static int do_handle_cap(int fd, buffers &b, FILE *fout, int *index,
 	struct v4l2_plane planes[VIDEO_MAX_PLANES];
 	struct v4l2_buffer buf;
 	bool ignore_count_skip = false;
-	static unsigned last_sec;
+	static time_t last_sec;
 
 	memset(&buf, 0, sizeof(buf));
 	memset(planes, 0, sizeof(planes));
@@ -1090,7 +1090,7 @@ static int do_handle_cap(int fd, buffers &b, FILE *fout, int *index,
 static int do_handle_out(int fd, buffers &b, FILE *fin, struct v4l2_buffer *cap,
 			 unsigned &count, struct timespec &ts_last)
 {
-	static unsigned last_sec;
+	static time_t last_sec;
 	struct v4l2_plane planes[VIDEO_MAX_PLANES];
 	struct v4l2_buffer buf;
 	int ret;
-- 
2.33.0

