summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuergen Keil <jkeil@users.sourceforge.net>2002-10-24 16:02:43 +0000
committerJuergen Keil <jkeil@users.sourceforge.net>2002-10-24 16:02:43 +0000
commit9db694509d4b6005d84367007c18a8c224c56de0 (patch)
treefe5645b09bd3ecba8b1d67bf2c1bf96d756d034c
parent0270bd6a95d9fe507c54212993b4fcf1a343091b (diff)
downloadxine-lib-9db694509d4b6005d84367007c18a8c224c56de0.tar.gz
xine-lib-9db694509d4b6005d84367007c18a8c224c56de0.tar.bz2
try to handle the __attribute((__packed__)) gnu extension in buffer.h header
CVS patchset: 2987 CVS date: 2002/10/24 16:02:43
-rw-r--r--src/xine-engine/buffer.h16
-rw-r--r--src/xine-utils/attributes.h8
2 files changed, 20 insertions, 4 deletions
diff --git a/src/xine-engine/buffer.h b/src/xine-engine/buffer.h
index 99402d53b..8f532382f 100644
--- a/src/xine-engine/buffer.h
+++ b/src/xine-engine/buffer.h
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: buffer.h,v 1.71 2002/10/12 19:18:48 tmmm Exp $
+ * $Id: buffer.h,v 1.72 2002/10/24 16:02:44 jkeil Exp $
*
*
* contents:
@@ -46,6 +46,7 @@ extern "C" {
#include <pthread.h>
#include <inttypes.h>
#include <sys/types.h>
+#include "attributes.h"
/*
* buffer types
@@ -377,6 +378,10 @@ uint32_t formattag_to_buf_audio( uint32_t formattag );
char * buf_audio_name( uint32_t buf_type );
+#ifndef ATTRIBUTE_PACKED
+/* no attribute packed? let's try with pragma pack as a last resort */
+#pragma pack(2)
+#endif
/* this is xine version of BITMAPINFOHEADER
* - should be safe to compile on 64bits machines
* - will always use machine endian format, so demuxers reading
@@ -396,9 +401,6 @@ typedef struct __attribute__((__packed__)) {
int32_t biClrImportant;
} xine_bmiheader;
-/* convert xine_bmiheader struct from little endian */
-void xine_bmiheader_le2me( xine_bmiheader *bih );
-
/* this is xine version of WAVEFORMATEX
* (the same comments from xine_bmiheader)
*/
@@ -411,6 +413,12 @@ typedef struct __attribute__((__packed__)) {
int16_t wBitsPerSample;
int16_t cbSize;
} xine_waveformatex;
+#ifndef ATTRIBUTE_PACKED
+#pragma pack()
+#endif
+
+/* convert xine_bmiheader struct from little endian */
+void xine_bmiheader_le2me( xine_bmiheader *bih );
/* convert xine_waveformatex struct from little endian */
void xine_waveformatex_le2me( xine_waveformatex *wavex );
diff --git a/src/xine-utils/attributes.h b/src/xine-utils/attributes.h
index 0e377831b..5e4afaa73 100644
--- a/src/xine-utils/attributes.h
+++ b/src/xine-utils/attributes.h
@@ -26,3 +26,11 @@
#else
#define ATTR_ALIGN(align)
#endif
+
+/* disable GNU __attribute__ extension, when not compiling with GNU C */
+#if defined(__GNUC__)
+#define ATTRIBUTE_PACKED 1
+#else
+#undef ATTRIBUTE_PACKED
+#define __attribute__(x) /**/
+#endif