Package: libunicap2-dev
Version: 0.9.12-2
Severity: normal
File: /usr/include/unicap/unicap.h
Tags: upstream patch
As unicap uses private as a variable name, it is not possible to
compile this library with c++ code (usefull in OpenFrameworks 0.061,
for example).
Steps to reproduce:
1. Create a test file with
$ cat test_unicap.cpp EOF
#include unicap.h
int main(){}
EOF
2. Try to compile it with:
$ g++ `pkg-config --cflags libunicap` -o test_unicap test_unicap.cpp
This will give the following error:
In file included from test_unicap.cpp:1:0:
/usr/include/unicap/unicap.h:218:34: error: expected unqualified-id before
‘private’
/usr/include/unicap/unicap.h:218:33: error: expected ‘;’ at end of member
declaration
/usr/include/unicap/unicap.h:218:41: error: expected ‘:’ before ‘;’ token
This problem is fixed in upstream, but not in this version of unicap.
I have submitted a patch where the name of the variable is changed
in unicap.h as well as in unicap.c
-- System Information:
Debian Release: wheezy/sid
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 3.2.0-3-486
Locale: LANG=es_ES.UTF-8, LC_CTYPE=es_ES.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages libunicap2-dev depends on:
ii libunicap2 0.9.12-2
libunicap2-dev recommends no packages.
libunicap2-dev suggests no packages.
-- no debconf information
diff -Nru unicap-0.9.12/debian/changelog unicap-0.9.12/debian/changelog
--- unicap-0.9.12/debian/changelog 2012-06-24 14:27:15.0 +0200
+++ unicap-0.9.12/debian/changelog 2012-09-01 15:19:57.0 +0200
@@ -1,3 +1,11 @@
+unicap (0.9.12-2.1) UNRELEASED; urgency=low
+
+ * Non-maintainer upload.
+ * Add patch 2001 to avoid using private keyword as variable name
+in unicap.h
+
+ -- Jorge Muñoz pun...@gmail.com Sat, 01 Sep 2012 14:32:25 +0200
+
unicap (0.9.12-2) unstable; urgency=low
* Add patch 1010 to fix implicit pointer conversions in v4l2 macros.
diff -Nru unicap-0.9.12/debian/copyright unicap-0.9.12/debian/copyright
--- unicap-0.9.12/debian/copyright 2012-06-24 14:15:29.0 +0200
+++ unicap-0.9.12/debian/copyright 2012-09-01 15:37:23.0 +0200
@@ -71,6 +71,10 @@
Copyright: 2008, by Miriam Ruiz little_m...@yahoo.es
License: GPL-2+
+Files: debian/patches/2001_avoid_private_as_variable_name.patch
+Copyright: 2012, Jorge Muñoz pun...@gmail.com
+License: GPL-2+
+
License: GPL-2+
This file is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
diff -Nru unicap-0.9.12/debian/patches/2001_avoid_private_as_variable_name.patch unicap-0.9.12/debian/patches/2001_avoid_private_as_variable_name.patch
--- unicap-0.9.12/debian/patches/2001_avoid_private_as_variable_name.patch 1970-01-01 01:00:00.0 +0100
+++ unicap-0.9.12/debian/patches/2001_avoid_private_as_variable_name.patch 2012-09-01 15:17:14.0 +0200
@@ -0,0 +1,131 @@
+# Copyright (C) 2012 by Jorge Muñoz pun...@gmail.com
+# Distributed under the same license as the software. See debian/copyright
+
+--- unicap.orig/include/unicap.h 2012-09-01 14:50:19.0 +0200
unicap/include/unicap.h 2012-09-01 14:54:07.0 +0200
+@@ -215,7 +215,7 @@
+
+unicap_buffer_flags_t flags;
+
+- unicap_data_buffer_private_t *private;
++ unicap_data_buffer_private_t *ptr_private;
+ };
+
+ typedef struct _unicap_data_buffer_t unicap_data_buffer_t;
+
+--- unicap.orig/src/unicap.c 2012-09-01 14:50:13.0 +0200
unicap/src/unicap.c 2012-09-01 14:54:18.0 +0200
+@@ -1467,7 +1467,7 @@
+buffer-buffer_size = buffer-format.buffer_size;
+buffer-data = malloc( buffer-buffer_size );
+unicap_copy_format( buffer-format, format );
+- buffer-private = NULL;
++ buffer-ptr_private = NULL;
+
+return buffer;
+ }
+@@ -1475,28 +1475,28 @@
+ void unicap_data_buffer_init( unicap_data_buffer_t *buffer, unicap_format_t *format, unicap_data_buffer_init_data_t *init_data )
+ {
+unicap_copy_format( buffer-format, format );
+- buffer-private = malloc( sizeof( unicap_data_buffer_private_t ) );
+- sem_init( buffer-private-lock, 0, 1 );
+- buffer-private-ref_count = 0;
+- buffer-private-free_func = init_data-free_func;
+- buffer-private-free_func_data = init_data-free_func_data;
+- buffer-private-ref_func = init_data-ref_func;
+- buffer-private-ref_func_data = init_data-ref_func_data;
+- buffer-private-unref_func = init_data-unref_func;
+- buffer-private-unref_func_data = init_data-unref_func_data;
++ buffer-ptr_private = malloc( sizeof( unicap_data_buffer_private_t ) );
++ sem_init( buffer-ptr_private-lock, 0, 1 );
++ buffer-ptr_private-ref_count = 0;
++ buffer-ptr_private-free_func = init_data-free_func;
++ buffer-ptr_private-free_func_data = init_data-free_func_data;
++ buffer-ptr_private-ref_func = init_data-ref_func;
++ buffer-ptr_private-ref_func_data = init_data-ref_func_data;
++