PATCH: libv4l-warnings.patch
Hi,
Fix all compiler warnings in libv4l
Signed-off-by Hans de Goede <[email protected]>
Regards,
Hans
Fix all compiler warnings in libv4l
Signed-off-by Hans de Goede <[email protected]>
v4l2-apps/lib/libv4l/libv4l1/libv4l1-priv.h +1 -1
@@ -64,7 +64,7 @@unsigned int v4l1_pal;/* VIDEO_PALETTE */ unsigned int v4l2_pixfmt;/* V4L2_PIX_FMT */ unsigned int min_width, min_height, max_width, max_height; -int width, height; +unsigned int width, height;unsigned char *v4l1_frame_pointer; };
v4l2-apps/lib/libv4l/libv4l1/libv4l1.c +7 -6
@@ -70,9 +70,10 @@#define V4L1_PIX_SIZE_TOUCHED 0x08static pthread_mutex_t v4l1_open_mutex =PTHREAD_MUTEX_INITIALIZER ; -static struct v4l1_dev_info devices[V4L1_MAX_DEVICES ] = { {-1 }, {-1 }, {-1 }, - {-1 }, {-1 }, {-1 }, {-1 }, {-1 }, {-1 }, {-1 }, {-1 }, {-1 }, {-1 }, {-1 }, {-1 }, - {-1 } }; +static struct v4l1_dev_info devices[V4L1_MAX_DEVICES ] = { { .fd =-1 }, + { .fd =-1 }, { .fd =-1 }, { .fd =-1 }, { .fd =-1 }, { .fd =-1 }, + { .fd =-1 }, { .fd =-1 }, { .fd =-1 }, { .fd =-1 }, { .fd =-1 }, + { .fd =-1 }, { .fd =-1 }, { .fd =-1 }, { .fd =-1 }, { .fd =-1 }};static int devices_used =0 ;static unsigned int palette_to_pixelformat (unsigned int palette)
@@ -135,8 +136,8 @@return 0 ; } -static int v4l1_set_format (int index,int width,int height, -int v4l1_pal,int width_height_may_differ) +static int v4l1_set_format (int index,unsigned int width, +unsigned int height,int v4l1_pal,int width_height_may_differ) {int result;unsigned int v4l2_pixfmt;
@@ -748,7 +749,7 @@void *v4l1_mmap (void *start,size_t length,int prot,int flags,int fd, -off_t offset) +__off_t offset) {int index;void *result;
v4l2-apps/lib/libv4l/libv4l1/v4l1compat.c +1 -1
@@ -77,7 +77,7 @@ }void mmap (void *start,size_t length,int prot,int flags,int fd, -off_t offset) +__off_t offset) {return v4l1_mmap (start, length, prot, flags, fd, offset); }
v4l2-apps/lib/libv4l/libv4l2/libv4l2-priv.h +1 -1
@@ -27,7 +27,7 @@/* Warning when making this larger the frame_queued and frame_mapped members of the v4l2_dev_info struct can no longer be a bitfield, so the code needs to be adjusted! */ -#define V4L2_MAX_NO_FRAMES 32u +#define V4L2_MAX_NO_FRAMES 32#define V4L2_DEFAULT_NREADBUFFERS 4#define V4L2_FRAME_BUF_SIZE (4096 * 4096)
v4l2-apps/lib/libv4l/libv4l2/libv4l2.c +7 -6
@@ -80,9 +80,10 @@#define V4L2_MMAP_OFFSET_MAGIC 0xABCDEF00ustatic pthread_mutex_t v4l2_open_mutex =PTHREAD_MUTEX_INITIALIZER ; -static struct v4l2_dev_info devices[V4L2_MAX_DEVICES ] = { {-1 }, {-1 }, - {-1 }, {-1 }, {-1 }, {-1 }, {-1 }, {-1 }, {-1 }, {-1 }, {-1 }, {-1 }, {-1 }, {-1 }, - {-1 }, {-1 }}; +static struct v4l2_dev_info devices[V4L2_MAX_DEVICES ] = { { .fd =-1 }, + { .fd =-1 }, { .fd =-1 }, { .fd =-1 }, { .fd =-1 }, { .fd =-1 }, + { .fd =-1 }, { .fd =-1 }, { .fd =-1 }, { .fd =-1 }, { .fd =-1 }, + { .fd =-1 }, { .fd =-1 }, { .fd =-1 }, { .fd =-1 }, { .fd =-1 }};static int devices_used =0 ;
@@ -830,7 +831,7 @@ssize_t v4l2_read (int fd,void * buffer,size_t n) {ssize_t result; -int index, bytesused, frame_index; +int index, bytesused =0 , frame_index;if ((index =v4l2_get_index (fd)) ==-1 )return syscall (SYS_read, fd, buffer, n);
@@ -867,7 +868,7 @@ }void *v4l2_mmap (void *start,size_t length,int prot,int flags,int fd, -off_t offset) +__off_t offset) {int index;unsigned int buffer_index;
@@ -877,7 +878,7 @@/* Check if the mmap data matches our answer to QUERY_BUF, if it doesn't let the kernel handle it (to allow for mmap based non capture use) */ start || length != V4L2_FRAME_BUF_SIZE || - (offset & ~0xff) != V4L2_MMAP_OFFSET_MAGIC) { + ((unsigned int)offset & ~0xFFu) != V4L2_MMAP_OFFSET_MAGIC) {if (index !=-1 )V4L2_LOG ("Passing mmap(%p, %d, ..., %x, through to the driver\n" , start, (int )length, (int )offset);
v4l2-apps/lib/libv4l/libv4l2/v4l2convert.c +1 -1
@@ -110,7 +110,7 @@ }void mmap (void *start,size_t length,int prot,int flags,int fd, -off_t offset) +__off_t offset) {return v4l2_mmap (start, length, prot, flags, fd, offset); }
v4l2-apps/lib/libv4l/libv4lconvert/libv4lconvert-priv.h +1 -1
@@ -57,7 +57,7 @@struct v4lconvert_data {int fd;int supported_src_formats;/* bitfield */ -int no_formats; +unsigned int no_formats;char error_msg[V4LCONVERT_ERROR_MSG_SIZE ];struct jdec_private *jdec; };
v4l2-apps/lib/libv4l/libv4lconvert/libv4lconvert.c +13 -14
@@ -25,6 +25,7 @@#include "libv4lconvert-priv.h" #define MIN (a,b) (((a)<(b))?(a):(b)) +#define ARRAY_SIZE (x) ((int)sizeof(x)/(int)sizeof((x)[0]))static const unsigned int supported_src_pixfmts[] = {V4L2_PIX_FMT_BGR24 ,
@@ -39,13 +40,11 @@V4L2_PIX_FMT_SPCA561 ,V4L2_PIX_FMT_SN9C10X , V4L2_PIX_FMT_PAC207, - -1 };static const unsigned int supported_dst_pixfmts[] = {V4L2_PIX_FMT_BGR24 ,V4L2_PIX_FMT_YUV420 , --1 };
@@ -69,7 +68,7 @@if (syscall (SYS_ioctl, fd,VIDIOC_ENUM_FMT , &fmt))break ; -for (j =0 ; supported_src_pixfmts[j] !=-1 ; j++) +for (j =0 ; j <ARRAY_SIZE (supported_src_pixfmts); j++)if (fmt.pixelformat == supported_src_pixfmts[j]) { data->supported_src_formats |=1 << j;break ;
@@ -100,7 +99,7 @@return syscall (SYS_ioctl, data->fd,VIDIOC_ENUM_FMT , fmt); fmt->flags =0 ; - fmt->pixelformat =-1 ; + fmt->pixelformat =0 ;memset (fmt->reserved,0 ,4 );/* Note bgr24 and yuv420 are the first 2 in our mask of supported formats */
@@ -121,7 +120,7 @@ }break ; } -if (fmt->pixelformat ==-1 ) { +if (fmt->pixelformat ==0 ) { errno =EINVAL ;return -1 ; }
@@ -134,16 +133,16 @@ struct v4l2_format *dest_fmt, struct v4l2_format *src_fmt) { int i; -unsigned int try_pixfmt, closest_fmt_size_diff =-1 ; +unsigned int closest_fmt_size_diff =-1 ;unsigned int desired_pixfmt = dest_fmt->fmt.pix.pixelformat; -struct v4l2_format try_fmt, closest_fmt = { .type =-1 }; +struct v4l2_format try_fmt, closest_fmt = { .type =0 }; -for (i =0 ; supported_dst_pixfmts[i] !=-1 ; i++) +for (i =0 ; i <ARRAY_SIZE (supported_dst_pixfmts); i++)if (supported_dst_pixfmts[i] == desired_pixfmt)break ;/* Can we do conversion to the requested format & type? */ -if (supported_dst_pixfmts[i] ==-1 || +if (i ==ARRAY_SIZE (supported_dst_pixfmts) || dest_fmt->type !=V4L2_BUF_TYPE_VIDEO_CAPTURE ) {int ret =syscall (SYS_ioctl, data->fd,VIDIOC_TRY_FMT , dest_fmt);if (src_fmt)
@@ -151,17 +150,17 @@return ret; } -for (i =0 ; (try_pixfmt = supported_src_pixfmts[i]) !=-1 ; i++) { +for (i =0 ; i <ARRAY_SIZE (supported_src_pixfmts); i++) {/* is this format supported? */ if (!(data->supported_src_formats & (1 << i)))continue ; try_fmt = *dest_fmt; - try_fmt.fmt.pix.pixelformat = try_pixfmt; + try_fmt.fmt.pix.pixelformat = supported_src_pixfmts[i];if (!syscall (SYS_ioctl, data->fd,VIDIOC_TRY_FMT , &try_fmt)) { -if (try_fmt.fmt.pix.pixelformat == try_pixfmt) { +if (try_fmt.fmt.pix.pixelformat == supported_src_pixfmts[i]) {int size_x_diff =abs ((int )try_fmt.fmt.pix.width - (int )dest_fmt->fmt.pix.width); int size_y_diff = abs((int)try_fmt.fmt.pix.height -
@@ -176,7 +175,7 @@ } } -if (closest_fmt.type ==-1 ) { +if (closest_fmt.type ==0 ) { errno =EINVAL ;return -1 ; }
@@ -322,7 +321,7 @@case V4L2_PIX_FMT_PAC207 : {unsigned char tmpbuf[dest_fmt->fmt.pix.width*dest_fmt->fmt.pix.height]; -unsigned int bayer_fmt; +unsigned int bayer_fmt =0 ;switch (src_fmt->fmt.pix.pixelformat) {case V4L2_PIX_FMT_SPCA561 :
v4l2-apps/lib/libv4l/libv4lconvert/sn9c10x.c +1 -1
@@ -139,7 +139,7 @@int val;int bitpos;unsigned char code; -unsigned char *addr; +const unsigned char *addr;if (!init_done)sonix_decompress_init ();
v4l2-apps/lib/libv4l/libv4lconvert/spca561-decompress.c +12 -12
@@ -307,7 +307,7 @@static int accum[8 *8 *8 ];static int i_hits[8 *8 *8 ]; -const static int nbits_A[] = +const int nbits_A[] = {1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,
@@ -335,7 +335,7 @@3 ,3 ,3 ,3 ,3 , 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, }; -const static int tab_A[] = +const int tab_A[] = {0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , 0, 0,
@@ -370,7 +370,7 @@1 }; -const static int nbits_B[] = +const int nbits_B[] = {0 ,8 ,7 ,7 ,6 ,6 ,6 ,6 ,5 ,5 ,5 ,5 ,5 ,5 ,5 ,5 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4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5 ,5 ,5 ,5 ,5 ,5 ,5 ,5 ,5 ,5 ,
@@ -525,7 +525,7 @@3 ,3 ,3 ,3 ,3 ,3 ,3 ,3 ,3 ,3 ,3 ,3 ,3 ,3 ,3 ,3 ,3 ,3 ,3 ,3 ,3 ,3 ,3 ,3 ,3 }; -const static int tab_D[] = +const int tab_D[] = {0xff ,0xfe ,0xfd ,0xfc ,10 ,-11 ,11 ,-12 ,8 ,8 ,-9 ,-9 ,9 ,9 ,-10 ,-10 ,6 ,6 ,6 ,6 ,-7 ,-7 ,-7 ,-7 ,7 ,7 ,7 ,7 ,-8 ,-8 , -8, -8,
@@ -563,7 +563,7 @@ };/* a_curve[19 + i] = ... [-19..19] => [-160..160] */ -const static int a_curve[] = +const int a_curve[] = {-160 ,-144 ,-128 ,-112 ,-98 ,-88 ,-80 ,-72 ,-64 ,-56 ,-48 ,-40 ,-32 ,-24 ,-18 ,-12 ,-8 ,-5 ,-2 ,0 ,2 ,5 ,8 ,12 ,18 ,24 ,32 ,
@@ -571,7 +571,7 @@72 ,80 ,88 ,98 ,112 ,128 ,144 ,160 };/* clamp0_255[256 + i] = min(max(i,255),0) */ -const static unsigned char clamp0_255[] = +const unsigned char clamp0_255[] = {0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , 0, 0,
@@ -680,14 +680,14 @@255 };/* abs_clamp15[19 + i] = min(abs(i), 15) */ -const static int abs_clamp15[] = +const int abs_clamp15[] = {15 ,15 ,15 ,15 ,15 ,14 ,13 ,12 ,11 ,10 ,9 ,8 ,7 ,6 ,5 ,4 ,3 ,2 ,1 ,0 ,1 ,2 ,3 ,4 ,5 ,6 ,7 ,8 ,9 ,10 ,11 ,12 ,13 ,14 ,15 ,15 ,15 ,15 };/* diff_encoding[256 + i] = ... */ -const static int diff_encoding[] = +const int diff_encoding[] = {7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,
--
video4linux-list mailing list
Unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list