aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab+samsung@kernel.org>2018-09-04 21:17:48 (GMT)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>2018-09-04 21:24:03 (GMT)
commitb7c0e34d931af0bf04437e22b2490bee671e123f (patch)
tree10f27906bbc8fc3ef9f7526153b46c9ca7f10434
parented6913fd860f88a9005a08dffec1e7af1df1702c (diff)
v4l: fix some troubles due to unsigned int on resolutionsdist_improvements
Changeset af1f1940a636 ("Do some code cleanups") caused a regression when setting the resolution, as x and y could be a negative value in the past. Fix it. Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
-rw-r--r--src/main.c2
-rw-r--r--src/v4l.c8
2 files changed, 5 insertions, 5 deletions
diff --git a/src/main.c b/src/main.c
index 5b0b416..5b434e3 100644
--- a/src/main.c
+++ b/src/main.c
@@ -17,7 +17,7 @@
static int ver = 0, max = 0, min;
static int half = 0, use_read = 0, buggery = 0;
static gchar *poopoo = NULL;
-static int x = -1, y = -1;
+static int x = 0, y = 0;
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdiscarded-qualifiers"
diff --git a/src/v4l.c b/src/v4l.c
index 930d497..e9ce8f2 100644
--- a/src/v4l.c
+++ b/src/v4l.c
@@ -59,9 +59,9 @@ static int sort_func(const void *__b, const void *__a)
const struct resolutions *b = __b;
int r;
- r = b->x - a->x;
+ r = (int)b->x - a->x;
if (!r)
- r = b->y - a->y;
+ r = (int)b->y - a->y;
return r;
}
@@ -129,8 +129,8 @@ void camera_cap(cam_t *cam)
/* Query supported resolutions */
cam->rdir_ok = FALSE;
- cam->min_width = -1;
- cam->min_height = -1;
+ cam->min_width = (unsigned)-1;
+ cam->min_height = (unsigned)-1;
cam->max_width = 0;
cam->max_height = 0;
for (i = 0;; i++) {

Privacy Policy