summaryrefslogtreecommitdiff
path: root/graphics/libv4l/patches/patch-af
blob: c0a5b00639ce6524940efc924a711e18fe5f6f7e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
$NetBSD: patch-af,v 1.3 2011/01/07 15:20:45 obache Exp $

* XXXX
* `mode_t' is promoted to `int' when passed through `...'.

--- libv4l2/v4l2convert.c.orig	2008-08-26 12:32:39.000000000 +0000
+++ libv4l2/v4l2convert.c
@@ -24,11 +24,16 @@
 
 #include <stdarg.h>
 #include <stdlib.h>
+#ifdef __linux__
 #include <syscall.h>
+#else
+#include <sys/syscall.h>
+#endif
 #include <fcntl.h>
 #include <string.h>
 #include <sys/ioctl.h>
 #include <sys/mman.h>
+#ifdef __linux__
 /* These headers are not needed by us, but by linux/videodev2.h,
    which is broken on some systems and doesn't include them itself :( */
 #include <sys/time.h>
@@ -36,8 +41,18 @@
 #include <linux/ioctl.h>
 /* end broken header workaround includes */
 #include <linux/videodev2.h>
+#else
+#include <sys/types.h>
+#include <sys/time.h>
+#include <sys/ioctl.h>
+#include <sys/videoio.h>
+#endif
 #include <libv4l2.h>
 
+#ifndef O_LARGEFILE
+#define O_LARGEFILE 0
+#endif
+
 /* Check that open/read/mmap is not a define */
 #if defined open || defined read || defined mmap
 #error open/read/mmap is a prepocessor macro !!
@@ -61,7 +76,7 @@ LIBV4L_PUBLIC int open (const char *file
     mode_t mode;
 
     va_start (ap, oflag);
-    mode = va_arg (ap, mode_t);
+    mode = (sizeof (mode_t) < sizeof (int) ? (mode_t)va_arg (ap, int) : va_arg (ap, mode_t));
 
     fd = syscall(SYS_open, file, oflag, mode);