]> git.sesse.net Git - vlc/commitdiff
contrib: fix zvbi compilation on Win32
authorRémi Denis-Courmont <remi@remlab.net>
Sun, 6 Nov 2011 09:34:33 +0000 (11:34 +0200)
committerRémi Denis-Courmont <remi@remlab.net>
Sun, 6 Nov 2011 09:35:25 +0000 (11:35 +0200)
contrib/src/zvbi/rules.mak
contrib/src/zvbi/zvbi-ioctl.patch [new file with mode: 0644]
contrib/src/zvbi/zvbi-ssize_max.patch [new file with mode: 0644]

index 913cc8fd4e3b6eeb53f30363f447e5af1e64a2b0..e1c9d386dd6d504c8a6ab03b3fba2813add44cb3 100644 (file)
@@ -15,6 +15,8 @@ $(TARBALLS)/zvbi-$(ZVBI_VERSION).tar.bz2:
 
 zvbi: zvbi-$(ZVBI_VERSION).tar.bz2 .sum-zvbi
        $(UNPACK)
+       $(APPLY) $(SRC)/zvbi/zvbi-ssize_max.patch
+       $(APPLY) $(SRC)/zvbi/zvbi-ioctl.patch
 ifdef HAVE_WIN32
        $(APPLY) $(SRC)/zvbi/zvbi-win32.patch
 endif
diff --git a/contrib/src/zvbi/zvbi-ioctl.patch b/contrib/src/zvbi/zvbi-ioctl.patch
new file mode 100644 (file)
index 0000000..2b0e42d
--- /dev/null
@@ -0,0 +1,19 @@
+diff -ru zvbi.orig/contrib/ntsc-cc.c zvbi/contrib/ntsc-cc.c
+--- zvbi.orig/contrib/ntsc-cc.c        2011-11-06 11:22:47.000000000 +0200
++++ zvbi/contrib/ntsc-cc.c     2011-11-06 11:29:04.000000000 +0200
+@@ -32,7 +32,6 @@
+ #include <fcntl.h>
+ #include <errno.h>
+ #include <locale.h>
+-#include <sys/ioctl.h>
+ #include <sys/types.h>
+ #include <sys/time.h>
+ #ifdef HAVE_GETOPT_LONG
+@@ -44,6 +43,7 @@
+ #include "src/libzvbi.h"
+ #ifdef ENABLE_V4L2
++#  include <sys/ioctl.h>
+ #  include <asm/types.h>
+ #  include "src/videodev2k.h"
+ #endif
diff --git a/contrib/src/zvbi/zvbi-ssize_max.patch b/contrib/src/zvbi/zvbi-ssize_max.patch
new file mode 100644 (file)
index 0000000..eb980a6
--- /dev/null
@@ -0,0 +1,28 @@
+Linear memory extents over SSIZE_MAX are undefined, so there is no
+point in protecting against them.
+diff -ru zvbi.orig/src/export.c zvbi/src/export.c
+--- zvbi.orig/src/export.c     2011-11-06 11:22:47.000000000 +0200
++++ zvbi/src/export.c  2011-11-06 11:27:39.000000000 +0200
+@@ -1076,8 +1076,6 @@
+               size_t count;
+               count = src_size;
+-              if (unlikely (src_size > SSIZE_MAX))
+-                      count = SSIZE_MAX & -4096;
+               for (retry = 10;; --retry) {
+                       actual = write (e->_handle.fd, src, count);
+@@ -1632,12 +1630,7 @@
+                       free (e->buffer.data);
+               }
+-              if (unlikely (e->buffer.offset > (size_t) SSIZE_MAX)) {
+-                      errno = EOVERFLOW;
+-                      actual = -1; /* failed */
+-              } else {
+-                      actual = e->buffer.offset;
+-              }
++              actual = e->buffer.offset;
+       } else {
+               if (VBI_EXPORT_TARGET_ALLOC == e->target)
+                       free (e->buffer.data);