fixed endianness testing (_BIG_ENDIAN is always defined in endian.h)

git-svn-id: http://svn.berlios.de/svnroot/repos/sems/trunk@724 8eb893ce-cfd4-0310-b710-fb5ebe64c474
sayer/1.4-spce2.6
Stefan Sayer 19 years ago
parent bd9150236b
commit 2d887db3b9

@ -28,6 +28,7 @@
#include "AmAudioFile.h"
#include "AmPlugIn.h"
#include "AmUtils.h"
#include "compat/solaris.h"
#include <string.h>
@ -303,7 +304,7 @@ int AmAudioFile::read(unsigned int user_ts, unsigned int size)
ret = (!ferror(fp) ? s : -1);
#if (defined(__BYTE_ORDER) && (__BYTE_ORDER == __BIG_ENDIAN)) || defined(_BIG_ENDIAN) || defined(__BIG_ENDIAN)
#if (defined(__BYTE_ORDER) && (__BYTE_ORDER == __BIG_ENDIAN))
#define bswap_16(A) ((((u_int16_t)(A) & 0xff00) >> 8) | \
(((u_int16_t)(A) & 0x00ff) << 8))

@ -1,5 +1,7 @@
#ifndef __SOLARIS_H__
#define __SOLARIS_H__
#ifdef SOLARIS
/*
* New compatibility code for Solaris.
*/
@ -62,4 +64,17 @@
typedef unsigned long long int u_int64_t;
#endif
#if defined(sun)
#include <sys/byteorder.h>
#if defined(_BIG_ENDIAN)
#define BYTE_ORDER BIG_ENDIAN
#else
#define BYTE_ORDER LITTLE_ENDIAN
#endif
#else
#include <endian.h>
#endif
#endif /* SOLARIS */
#endif

@ -40,6 +40,8 @@ on 1 byte), but shoehorning those bytes into integers efficiently is messy.
# include <endian.h> /* attempt to define endianness */
#endif
#include "compat/solaris.h"
/*
* My best guess at if you are big-endian or little-endian. This may
* need adjustment.

@ -32,7 +32,7 @@
#include <string.h>
#include <sys/types.h>
#if (defined(__BYTE_ORDER) && (__BYTE_ORDER == __BIG_ENDIAN)) || defined(_BIG_ENDIAN) || defined(__BIG_ENDIAN)
#if (defined(__BYTE_ORDER) && (__BYTE_ORDER == __BIG_ENDIAN))
#define bswap_16(A) ((((u_int16_t)(A) & 0xff00) >> 8) | \
(((u_int16_t)(A) & 0x00ff) << 8))
#define bswap_32(A) ((((u_int32_t)(A) & 0xff000000) >> 24) | \
@ -173,7 +173,6 @@ static int wav_read_header(FILE* fp, struct amci_file_desc_t* fmt_desc)
fseek(fp,chunk_size,SEEK_CUR);
}
fmt_desc->data_size = chunk_size;
return 0;

@ -50,7 +50,7 @@ typedef unsigned int u_int32;
*/
typedef struct {
#if (defined(__BYTE_ORDER) && (__BYTE_ORDER == __BIG_ENDIAN)) || defined(_BIG_ENDIAN) || defined(__BIG_ENDIAN)
#if (defined(__BYTE_ORDER) && (__BYTE_ORDER == __BIG_ENDIAN))
u_int16 version:2; /* protocol version */
u_int16 p:1; /* padding flag */
u_int16 x:1; /* header extension flag */

@ -33,6 +33,7 @@
#define _telephone_event_h_
#include <sys/types.h>
#include "../compat/solaris.h"
/*
* The type definitions below are valid for 32-bit architectures and
@ -49,7 +50,7 @@ typedef struct {
u_int8 event;
#if (defined(__BYTE_ORDER) && (__BYTE_ORDER == __BIG_ENDIAN)) || defined(_BIG_ENDIAN) || defined(__BIG_ENDIAN)
#if (defined(__BYTE_ORDER) && (__BYTE_ORDER == __BIG_ENDIAN))
u_int8 e:1;
u_int8 r:1;
u_int8 volume:6;

Loading…
Cancel
Save