[vlc-devel] commit: Use macro for __attribute__((packed)) ( Rémi Denis-Courmont )
git version control
git at videolan.org
Thu May 1 17:36:34 CEST 2008
vlc | branch: master | Rémi Denis-Courmont <rem at videolan.org> | Thu May 1 18:37:43 2008 +0300| [311e5e3ab7ee5981eaf187565472c0b942c7bc79]
Use macro for __attribute__((packed))
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=311e5e3ab7ee5981eaf187565472c0b942c7bc79
---
include/vlc_codecs.h | 40 ++++++++++------------------------------
include/vlc_common.h | 4 ++++
2 files changed, 14 insertions(+), 30 deletions(-)
diff --git a/include/vlc_codecs.h b/include/vlc_codecs.h
index 35da7d4..ea421ed 100644
--- a/include/vlc_codecs.h
+++ b/include/vlc_codecs.h
@@ -44,9 +44,7 @@ typedef struct _GUID
#ifndef _WAVEFORMATEX_
#define _WAVEFORMATEX_
typedef struct
-#ifdef HAVE_ATTRIBUTE_PACKED
- __attribute__((__packed__))
-#endif
+ATTR_PACKED
_WAVEFORMATEX {
uint16_t wFormatTag;
uint16_t nChannels;
@@ -61,9 +59,7 @@ _WAVEFORMATEX {
#ifndef _WAVEFORMATEXTENSIBLE_
#define _WAVEFORMATEXTENSIBLE_
typedef struct
-#ifdef HAVE_ATTRIBUTE_PACKED
- __attribute__((__packed__))
-#endif
+ATTR_PACKED
_WAVEFORMATEXTENSIBLE {
WAVEFORMATEX Format;
union {
@@ -79,9 +75,7 @@ _WAVEFORMATEXTENSIBLE {
#ifndef _WAVEHEADER_
#define _WAVEHEADER_
typedef struct
-#ifdef HAVE_ATTRIBUTE_PACKED
- __attribute__((__packed__))
-#endif
+ATTR_PACKED
_WAVEHEADER {
uint32_t MainChunkID;
uint32_t Length;
@@ -102,9 +96,7 @@ _WAVEHEADER {
#if !defined(_BITMAPINFOHEADER_) && !defined(WIN32)
#define _BITMAPINFOHEADER_
typedef struct
-#ifdef HAVE_ATTRIBUTE_PACKED
- __attribute__((__packed__))
-#endif
+ATTR_PACKED
{
uint32_t biSize;
uint32_t biWidth;
@@ -120,9 +112,7 @@ typedef struct
} BITMAPINFOHEADER, *PBITMAPINFOHEADER, *LPBITMAPINFOHEADER;
typedef struct
-#ifdef HAVE_ATTRIBUTE_PACKED
- __attribute__((__packed__))
-#endif
+ATTR_PACKED
{
BITMAPINFOHEADER bmiHeader;
int bmiColors[1];
@@ -132,9 +122,7 @@ typedef struct
#ifndef _RECT32_
#define _RECT32_
typedef struct
-#ifdef HAVE_ATTRIBUTE_PACKED
- __attribute__((__packed__))
-#endif
+ATTR_PACKED
{
int left, top, right, bottom;
} RECT32;
@@ -148,9 +136,7 @@ typedef int64_t REFERENCE_TIME;
#ifndef _VIDEOINFOHEADER_
#define _VIDEOINFOHEADER_
typedef struct
-#ifdef HAVE_ATTRIBUTE_PACKED
- __attribute__((__packed__))
-#endif
+ATTR_PACKED
{
RECT32 rcSource;
RECT32 rcTarget;
@@ -164,9 +150,7 @@ typedef struct
#ifndef _RGBQUAD_
#define _RGBQUAD_
typedef struct
-#ifdef HAVE_ATTRIBUTE_PACKED
- __attribute__((__packed__))
-#endif
+ATTR_PACKED
{
uint8_t rgbBlue;
uint8_t rgbGreen;
@@ -178,9 +162,7 @@ typedef struct
#ifndef _TRUECOLORINFO_
#define _TRUECOLORINFO_
typedef struct
-#ifdef HAVE_ATTRIBUTE_PACKED
- __attribute__((__packed__))
-#endif
+ATTR_PACKED
{
uint32_t dwBitMasks[3];
RGBQUAD1 bmiColors[256];
@@ -190,9 +172,7 @@ typedef struct
#ifndef _VIDEOINFO_
#define _VIDEOINFO_
typedef struct
-#ifdef HAVE_ATTRIBUTE_PACKED
- __attribute__((__packed__))
-#endif
+ATTR_PACKED
{
RECT32 rcSource;
RECT32 rcTarget;
diff --git a/include/vlc_common.h b/include/vlc_common.h
index 2e92ea3..537c0fc 100644
--- a/include/vlc_common.h
+++ b/include/vlc_common.h
@@ -780,6 +780,10 @@ static inline void _SetQWBE( uint8_t *p, uint64_t i_qw )
# define ATTR_ALIGN(align)
#endif
+#ifdef HAVE_ATTRIBUTE_PACKED
+# define ATTR_PACKED __attribute__((__packed__))
+#endif
+
/* */
#define VLC_UNUSED(x) (void)(x)
More information about the vlc-devel
mailing list