Message ID | CAB0OVGpXT5X75CPX6VRGs=KHbxc+L+OXpQxdpPX8Xm2Z4JnOxw@mail.gmail.com |
---|---|
State | Superseded |
Headers | show |
On 05/11/17 00:46, Carl Eugen Hoyos wrote: > Hi! > > Attached patch fixes a warning on a current 64bit Linux system (that I > do not see on my ancient system where the ioctl cmd has type int). > Is there a better way to deal with it? > Fixes a warning on recent Linux: > libavcodec/v4l2_context.c: In function 'ff_v4l2_context_set_status': > libavcodec/v4l2_context.c:496:26: warning: comparison is always false due to limited range of data type Huh. I didn't realise that the standard Linux ioctl numbering actually acts differently on different achitectures (you don't hit this on ARM or x86-64 with a write-only ioctl, as VIDIOC_STREAMON is). The patch is probably correct, though I think I would prefer the type to be uint32_t as the ioctl numbering in Linux really is 32-bit regardless of what some external prototypes (i.e. glibc) might say. (Inside the kernel it's unsigned int, but uint32_t would be more explicit.) Thanks, - Mark
2017-11-05 2:46 GMT+01:00 Mark Thompson <sw@jkqxz.net>: > On 05/11/17 00:46, Carl Eugen Hoyos wrote: >> Hi! >> >> Attached patch fixes a warning on a current 64bit Linux system (that I >> do not see on my ancient system where the ioctl cmd has type int). >> Is there a better way to deal with it? > >> Fixes a warning on recent Linux: >> libavcodec/v4l2_context.c: In function 'ff_v4l2_context_set_status': >> libavcodec/v4l2_context.c:496:26: warning: comparison is always false due to limited range of data type > > Huh. I didn't realise that the standard Linux ioctl numbering actually > acts differently on different achitectures (you don't hit this on ARM > or x86-64 with a write-only ioctl, as VIDIOC_STREAMON is). > > The patch is probably correct, though I think I would prefer the type > to be uint32_t Pushed with that change. Thank you, Carl Eugen
From 06886eea147cd68ee14291de1e437c364682f8ef Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos <ceffmpeg@gmail.com> Date: Sun, 5 Nov 2017 01:42:37 +0100 Subject: [PATCH] lavc/v4l2_context: Change the type of the ioctl cmd to unsigned long. Fixes a warning on recent Linux: libavcodec/v4l2_context.c: In function 'ff_v4l2_context_set_status': libavcodec/v4l2_context.c:496:26: warning: comparison is always false due to limited range of data type --- libavcodec/v4l2_context.c | 2 +- libavcodec/v4l2_context.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/v4l2_context.c b/libavcodec/v4l2_context.c index 9f3b56d..e3f0175 100644 --- a/libavcodec/v4l2_context.c +++ b/libavcodec/v4l2_context.c @@ -484,7 +484,7 @@ static int v4l2_get_coded_format(V4L2Context* ctx, uint32_t *p) * *****************************************************************************/ -int ff_v4l2_context_set_status(V4L2Context* ctx, int cmd) +int ff_v4l2_context_set_status(V4L2Context* ctx, unsigned long cmd) { int type = ctx->type; int ret; diff --git a/libavcodec/v4l2_context.h b/libavcodec/v4l2_context.h index 503cc36..1a6ad7a 100644 --- a/libavcodec/v4l2_context.h +++ b/libavcodec/v4l2_context.h @@ -135,7 +135,7 @@ void ff_v4l2_context_release(V4L2Context* ctx); * those frames will be dropped. * @return 0 in case of success, a negative value representing the error otherwise. */ -int ff_v4l2_context_set_status(V4L2Context* ctx, int cmd); +int ff_v4l2_context_set_status(V4L2Context* ctx, unsigned long cmd); /** * Dequeues a buffer from a V4L2Context to an AVPacket. -- 1.7.10.4