]> granicus.if.org Git - strace/commitdiff
v4l2: fix preprocessor checks
authorDmitry V. Levin <ldv@altlinux.org>
Tue, 13 Jun 2017 21:00:04 +0000 (21:00 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Tue, 13 Jun 2017 21:00:04 +0000 (21:00 +0000)
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.

tests/ioctl_v4l2.c
v4l2.c

index 921e7a887ea12fdb70b302ca7a2a46bc873126bf..9aac01727fede0fb4b0c36c8ced0052053bf1aaa 100644 (file)
@@ -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 ad29722d66604a67ee08386cfac00075f12e3fd1..ad904426f6bade3003d54add316eb6841d6a9662 100644 (file)
--- 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