summaryrefslogtreecommitdiff
path: root/v4l2-apps/lib/libv4l/libv4lconvert
diff options
context:
space:
mode:
authorThierry MERLE <thierry.merle@free.fr>2008-07-04 19:30:13 +0200
committerThierry MERLE <thierry.merle@free.fr>2008-07-04 19:30:13 +0200
commit63c4e4bef7b1537de4e313ee9d20907a372d8f56 (patch)
tree75117f0820d55998bcae2e4bfac9647781ed4e61 /v4l2-apps/lib/libv4l/libv4lconvert
parent40536a32a310338da9cf2c697dd978780aeda18a (diff)
downloadmediapointer-dvb-s2-63c4e4bef7b1537de4e313ee9d20907a372d8f56.tar.gz
mediapointer-dvb-s2-63c4e4bef7b1537de4e313ee9d20907a372d8f56.tar.bz2
v4l2-library: libv4l-warnings.patch
From: Hans de Goede <j.w.r.degoede@hhs.nl> Fix all compiler warnings in libv4l Signed-off-by: Hans de Goede <j.w.r.degoede@hhs.nl> Signed-off-by: Thierry MERLE <thierry.merle@free.fr>
Diffstat (limited to 'v4l2-apps/lib/libv4l/libv4lconvert')
-rw-r--r--v4l2-apps/lib/libv4l/libv4lconvert/libv4lconvert-priv.h2
-rw-r--r--v4l2-apps/lib/libv4l/libv4lconvert/libv4lconvert.c27
-rw-r--r--v4l2-apps/lib/libv4l/libv4lconvert/sn9c10x.c2
-rw-r--r--v4l2-apps/lib/libv4l/libv4lconvert/spca561-decompress.c24
4 files changed, 27 insertions, 28 deletions
diff --git a/v4l2-apps/lib/libv4l/libv4lconvert/libv4lconvert-priv.h b/v4l2-apps/lib/libv4l/libv4lconvert/libv4lconvert-priv.h
index ed1aa01ac..badb89d62 100644
--- a/v4l2-apps/lib/libv4l/libv4lconvert/libv4lconvert-priv.h
+++ b/v4l2-apps/lib/libv4l/libv4lconvert/libv4lconvert-priv.h
@@ -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;
};
diff --git a/v4l2-apps/lib/libv4l/libv4lconvert/libv4lconvert.c b/v4l2-apps/lib/libv4l/libv4lconvert/libv4lconvert.c
index 7d01425ad..35fd52481 100644
--- a/v4l2-apps/lib/libv4l/libv4lconvert/libv4lconvert.c
+++ b/v4l2-apps/lib/libv4l/libv4lconvert/libv4lconvert.c
@@ -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 @@ static const unsigned int supported_src_pixfmts[] = {
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 @@ struct v4lconvert_data *v4lconvert_create(int fd)
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 @@ int v4lconvert_enum_fmt(struct v4lconvert_data *data, struct v4l2_fmtdesc *fmt)
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 @@ int v4lconvert_enum_fmt(struct v4lconvert_data *data, struct v4l2_fmtdesc *fmt)
}
break;
}
- if (fmt->pixelformat == -1) {
+ if (fmt->pixelformat == 0) {
errno = EINVAL;
return -1;
}
@@ -134,16 +133,16 @@ int v4lconvert_try_format(struct v4lconvert_data *data,
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 @@ int v4lconvert_try_format(struct v4lconvert_data *data,
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 @@ int v4lconvert_try_format(struct v4lconvert_data *data,
}
}
- if (closest_fmt.type == -1) {
+ if (closest_fmt.type == 0) {
errno = EINVAL;
return -1;
}
@@ -322,7 +321,7 @@ int v4lconvert_convert(struct v4lconvert_data *data,
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:
diff --git a/v4l2-apps/lib/libv4l/libv4lconvert/sn9c10x.c b/v4l2-apps/lib/libv4l/libv4lconvert/sn9c10x.c
index ba7c8d064..b23ad4630 100644
--- a/v4l2-apps/lib/libv4l/libv4lconvert/sn9c10x.c
+++ b/v4l2-apps/lib/libv4l/libv4lconvert/sn9c10x.c
@@ -139,7 +139,7 @@ void v4lconvert_decode_sn9c10x(const unsigned char *inp, unsigned char *outp,
int val;
int bitpos;
unsigned char code;
- unsigned char *addr;
+ const unsigned char *addr;
if (!init_done)
sonix_decompress_init();
diff --git a/v4l2-apps/lib/libv4l/libv4lconvert/spca561-decompress.c b/v4l2-apps/lib/libv4l/libv4lconvert/spca561-decompress.c
index 1f7c6dd2f..40b0f90db 100644
--- a/v4l2-apps/lib/libv4l/libv4lconvert/spca561-decompress.c
+++ b/v4l2-apps/lib/libv4l/libv4lconvert/spca561-decompress.c
@@ -307,7 +307,7 @@ static int internal_spca561_decode(int width, int height,
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 @@ static int internal_spca561_decode(int width, int height,
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 @@ static int internal_spca561_decode(int width, int height,
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, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3,
@@ -398,7 +398,7 @@ static int internal_spca561_decode(int width, int height,
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,
};
- const static int tab_B[] =
+ const int tab_B[] =
{ 0xff, -4, 3, 3, -3, -3, -3, -3, 2, 2, 2, 2, 2, 2, 2, 2, -2,
-2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
1, 1,
@@ -433,7 +433,7 @@ static int internal_spca561_decode(int width, int height,
0, 0, 0, 0, 0, 0, 0,
};
- const static int nbits_C[] =
+ const int nbits_C[] =
{ 0, 0, 8, 8, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4,
@@ -461,7 +461,7 @@ static int internal_spca561_decode(int width, int height,
2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
};
- const static int tab_C[] =
+ const int tab_C[] =
{ 0xff, 0xfe, 6, -7, 5, 5, -6, -6, 4, 4, 4, 4, -5, -5, -5, -5,
3, 3, 3, 3, 3, 3, 3, 3, -4, -4, -4, -4, -4, -4, -4, -4, 2,
2, 2, 2,
@@ -497,7 +497,7 @@ static int internal_spca561_decode(int width, int height,
-1,
};
- const static int nbits_D[] =
+ const int nbits_D[] =
{ 0, 0, 0, 0, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6,
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5,
@@ -525,7 +525,7 @@ static int internal_spca561_decode(int width, int height,
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 @@ static int internal_spca561_decode(int width, int height,
};
/* 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 @@ static int internal_spca561_decode(int width, int height,
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 @@ static int internal_spca561_decode(int width, int height,
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,