From: Dmitry V. Levin Date: Tue, 13 Jun 2017 21:00:04 +0000 (+0000) Subject: v4l2: fix preprocessor checks X-Git-Tag: v4.18~95 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c2449486d61e68e813c43fd0ff5ac3ac2622037f;p=strace v4l2: fix preprocessor checks Fix checks for struct v4l2_window.global_alpha and struct v4l2_sdr_format.buffersize. * v4l2.c (print_v4l2_format_fmt): Do not assume that HAVE_STRUCT_V4L2_WINDOW_GLOBAL_ALPHA and HAVE_STRUCT_V4L2_SDR_FORMAT_BUFFERSIZE are defined. * tests/ioctl_v4l2.c (init_v4l2_format, dprint_ioctl_v4l2): Likewise. --- diff --git a/tests/ioctl_v4l2.c b/tests/ioctl_v4l2.c index 921e7a88..9aac0172 100644 --- a/tests/ioctl_v4l2.c +++ b/tests/ioctl_v4l2.c @@ -120,7 +120,7 @@ init_v4l2_format(struct v4l2_format *const f, f->fmt.win.clips[1].c.height = 0x05617b76; f->fmt.win.bitmap = (void*) -2UL; -#if HAVE_STRUCT_V4L2_WINDOW_GLOBAL_ALPHA +#ifdef HAVE_STRUCT_V4L2_WINDOW_GLOBAL_ALPHA f->fmt.win.global_alpha = 0xce; #endif break; @@ -158,7 +158,7 @@ init_v4l2_format(struct v4l2_format *const f, #if HAVE_DECL_V4L2_BUF_TYPE_SDR_CAPTURE case V4L2_BUF_TYPE_SDR_CAPTURE: f->fmt.sdr.pixelformat = magic; -#if HAVE_STRUCT_V4L2_SDR_FORMAT_BUFFERSIZE +#ifdef HAVE_STRUCT_V4L2_SDR_FORMAT_BUFFERSIZE f->fmt.sdr.buffersize = 0x25afabfb; #endif break; @@ -225,7 +225,7 @@ dprint_ioctl_v4l2(struct v4l2_format *const f, "[{left=%d, top=%d, width=%u, height=%u}, " "{left=%d, top=%d, width=%u, height=%u}]" ", clipcount=%u, bitmap=%p" -#if HAVE_STRUCT_V4L2_WINDOW_GLOBAL_ALPHA +#ifdef HAVE_STRUCT_V4L2_WINDOW_GLOBAL_ALPHA ", global_alpha=%#x" #endif "}}) = -1 EBADF (%m)\n", @@ -243,7 +243,7 @@ dprint_ioctl_v4l2(struct v4l2_format *const f, f->fmt.win.clips[1].c.width, f->fmt.win.clips[1].c.height, f->fmt.win.clipcount, f->fmt.win.bitmap -#if HAVE_STRUCT_V4L2_WINDOW_GLOBAL_ALPHA +#ifdef HAVE_STRUCT_V4L2_WINDOW_GLOBAL_ALPHA , f->fmt.win.global_alpha #endif ); @@ -304,14 +304,14 @@ dprint_ioctl_v4l2(struct v4l2_format *const f, printf("ioctl(-1, %s, {type=%s" ", fmt.sdr={pixelformat=v4l2_fourcc('\\x%x', '\\x%x'," " '\\x%x', '\\x%x')" -#if HAVE_STRUCT_V4L2_SDR_FORMAT_BUFFERSIZE +#ifdef HAVE_STRUCT_V4L2_SDR_FORMAT_BUFFERSIZE ", buffersize=%u" #endif "}}) = -1 EBADF (%m)\n", request, buf_type_string, cc0(magic), cc1(magic), cc2(magic), cc3(magic) -#if HAVE_STRUCT_V4L2_SDR_FORMAT_BUFFERSIZE +#ifdef HAVE_STRUCT_V4L2_SDR_FORMAT_BUFFERSIZE , f->fmt.sdr.buffersize #endif ); diff --git a/v4l2.c b/v4l2.c index ad29722d..ad904426 100644 --- a/v4l2.c +++ b/v4l2.c @@ -280,7 +280,7 @@ print_v4l2_format_fmt(struct tcb *const tcp, const char *prefix, umoven_or_printaddr, print_v4l2_clip, 0); tprintf(", clipcount=%u, bitmap=", f->fmt.win.clipcount); printaddr(ptr_to_kulong(f->fmt.win.bitmap)); -#if HAVE_STRUCT_V4L2_WINDOW_GLOBAL_ALPHA +#ifdef HAVE_STRUCT_V4L2_WINDOW_GLOBAL_ALPHA tprintf(", global_alpha=%#x", f->fmt.win.global_alpha); #endif tprints("}"); @@ -341,7 +341,7 @@ print_v4l2_format_fmt(struct tcb *const tcp, const char *prefix, tprints(prefix); tprints("fmt.sdr={pixelformat="); print_pixelformat(f->fmt.sdr.pixelformat); -#if HAVE_STRUCT_V4L2_SDR_FORMAT_BUFFERSIZE +#ifdef HAVE_STRUCT_V4L2_SDR_FORMAT_BUFFERSIZE tprintf(", buffersize=%u", f->fmt.sdr.buffersize); #endif