1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-31 10:46:16 +00:00

- Fix build on 6.x

PR:		144086
Submitted by:	Mark Andrews <marka@isc.org>
Approved by:	maintainer timeout
This commit is contained in:
Dmitry Marakasov 2010-04-14 16:22:21 +00:00
parent 2413f5a9bc
commit 2f17f561b5
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=252683
2 changed files with 75 additions and 0 deletions

View File

@ -113,6 +113,10 @@ IGNORE= does not build on FreeBSD 6.x with Qt4.x, set this OPTION to off or defi
CFLAGS+= -DHAVE_SYS_MOUNT_H
.endif
.if (${OSVERSION} < 700000)
EXTRA_PATCHES+= ${FILESDIR}/extra-patch-modules_access_v4l2.c
.endif
WITH_VLC_DEFAULT_FONT?= ${LOCALBASE}/lib/X11/fonts/bitstream-vera/Vera.ttf
.if ${PERL_LEVEL} < 500800

View File

@ -0,0 +1,71 @@
--- modules/access/v4l2.c.orig 2009-12-21 04:43:39.000000000 +1100
+++ modules/access/v4l2.c 2010-02-19 13:29:51.000000000 +1100
@@ -492,6 +492,9 @@
{
void * start;
size_t length;
+#if !defined (HAVE_POSIX_MEMALIGN) && !defined (HAVE_MEMALIGN)
+ void * free;
+#endif
};
struct demux_sys_t
@@ -1038,7 +1041,12 @@
switch( p_sys->io )
{
case IO_METHOD_READ:
- free( p_sys->p_buffers[0].start );
+#if !defined (HAVE_POSIX_MEMALIGN) && !defined (HAVE_MEMALIGN)
+ if (p_sys->p_buffers[0].free)
+ free( p_sys->p_buffers[0].free );
+ else
+#endif
+ free( p_sys->p_buffers[0].start );
break;
case IO_METHOD_MMAP:
@@ -1054,7 +1062,12 @@
case IO_METHOD_USERPTR:
for( i = 0; i < p_sys->i_nbuffers; ++i )
{
- free( p_sys->p_buffers[i].start );
+#if !defined (HAVE_POSIX_MEMALIGN) && !defined (HAVE_MEMALIGN)
+ if (p_sys->p_buffers[0].free)
+ free( p_sys->p_buffers[i].free );
+ else
+#endif
+ free( p_sys->p_buffers[i].start );
}
break;
@@ -1600,10 +1613,31 @@
for( p_sys->i_nbuffers = 0; p_sys->i_nbuffers < 4; ++p_sys->i_nbuffers )
{
+#if defined (HAVE_POSIX_MEMALIGN)
p_sys->p_buffers[p_sys->i_nbuffers].length = i_buffer_size;
if( posix_memalign( &p_sys->p_buffers[p_sys->i_nbuffers].start,
/* boundary */ i_page_size, i_buffer_size ) )
goto open_failed;
+#elif defined (HAVE_MEMALIGN)
+ p_sys->p_buffers[p_sys->i_nbuffers].length = i_buffer_size;
+ p_sys->p_buffers[p_sys->i_nbuffers].start =
+ memalign ( /* boundary */ i_page_size, i_buffer_size );
+ if (p_sys->p_buffers[p_sys->i_nbuffers].start == NULL)
+ goto open_failed;
+#else
+ unsigned char *ptr;
+ size_t align = i_page_size - 1;
+
+ p_sys->p_buffers[p_sys->i_nbuffers].length = i_buffer_size;
+ ptr = malloc (i_buffer_size + align);
+ if ( ptr == NULL )
+ goto open_failed;
+
+ p_sys->p_buffers[p_sys->i_nbuffers].free = ptr;
+ ptr += align;
+ p_sys->p_buffers[p_sys->i_nbuffers].start =
+ (void *)(((uintptr_t)ptr) & ~align);
+#endif
}
return VLC_SUCCESS;