v4l2: Add types compatiblity for other OS

Adds type compatiblity with other OS like BSD. This uses types mapping macro to
avoid conflict with existing defined types. We resuse glib types as these are
already available on supported platforms. This is GCC only because of the
le32 type that uses bitwise attribute.

https://bugzilla.gnome.org/show_bug.cgi?id=726453
This commit is contained in:
Nicolas Dufresne 2014-03-16 15:26:04 +01:00
parent 5f0ea73d28
commit 155d666845
2 changed files with 48 additions and 1 deletions

View file

@ -0,0 +1,47 @@
/*
* Copyright (C) 2014 Collabora Ltd.
* Author: Nicolas Dufresne <nicolas@ndufresne.ca>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
*/
#include <glib.h>
#ifndef __TYPES_COMPAT_H__
#define __TYPES_COMPAT_H__
/* From linux/types.h */
#ifdef __CHECKER__
#define __bitwise__ __attribute__((bitwise))
#else
#define __bitwise__
#endif
#ifdef __CHECK_ENDIAN__
#define __bitwise __bitwise__
#else
#define __bitwise
#endif
#define __u64 guint64
#define __u32 guint32
#define __u16 guint16
#define __u8 guint8
#define __s64 gint64
#define __s32 gint32
#define __le32 guint32 __bitwise
#endif /* __TYPES_COMPAT_H__ */

View file

@ -58,8 +58,8 @@
#include <sys/time.h>
#include <sys/ioctl.h>
#include <linux/types.h>
#include "ext/types-compat.h"
#include "ext/v4l2-common.h"
#include "ext/v4l2-controls.h"