diff options
author | Lennart Poettering <lennart@poettering.net> | 2008-10-05 04:32:48 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2008-10-05 04:32:48 +0200 |
commit | 4df0522641275edaee6d7a65eab9ca3f913dfdce (patch) | |
tree | 93404a4c673e857fa2eef8e36bef74fc2ec76102 /src | |
parent | ad01bbd52b17ea0acc5f9286ae871e8b6f62f8dd (diff) |
fix prefix of byte order macros
Diffstat (limited to 'src')
-rw-r--r-- | src/macro.h | 80 | ||||
-rw-r--r-- | src/read-wav.c | 18 |
2 files changed, 49 insertions, 49 deletions
diff --git a/src/macro.h b/src/macro.h index d8b68d6..0ad892f 100644 --- a/src/macro.h +++ b/src/macro.h @@ -177,65 +177,65 @@ typedef void (*ca_free_cb_t)(void *); #endif #ifdef HAVE_BYTESWAP_H -#define PA_INT16_SWAP(x) ((int16_t) bswap_16((uint16_t) x)) -#define PA_UINT16_SWAP(x) ((uint16_t) bswap_16((uint16_t) x)) -#define PA_INT32_SWAP(x) ((int32_t) bswap_32((uint32_t) x)) -#define PA_UINT32_SWAP(x) ((uint32_t) bswap_32((uint32_t) x)) +#define CA_INT16_SWAP(x) ((int16_t) bswap_16((uint16_t) x)) +#define CA_UINT16_SWAP(x) ((uint16_t) bswap_16((uint16_t) x)) +#define CA_INT32_SWAP(x) ((int32_t) bswap_32((uint32_t) x)) +#define CA_UINT32_SWAP(x) ((uint32_t) bswap_32((uint32_t) x)) #else -#define PA_INT16_SWAP(x) ( (int16_t) ( ((uint16_t) x >> 8) | ((uint16_t) x << 8) ) ) -#define PA_UINT16_SWAP(x) ( (uint16_t) ( ((uint16_t) x >> 8) | ((uint16_t) x << 8) ) ) -#define PA_INT32_SWAP(x) ( (int32_t) ( ((uint32_t) x >> 24) | ((uint32_t) x << 24) | (((uint32_t) x & 0xFF00) << 8) | ((((uint32_t) x) >> 8) & 0xFF00) ) ) -#define PA_UINT32_SWAP(x) ( (uint32_t) ( ((uint32_t) x >> 24) | ((uint32_t) x << 24) | (((uint32_t) x & 0xFF00) << 8) | ((((uint32_t) x) >> 8) & 0xFF00) ) ) +#define CA_INT16_SWAP(x) ( (int16_t) ( ((uint16_t) x >> 8) | ((uint16_t) x << 8) ) ) +#define CA_UINT16_SWAP(x) ( (uint16_t) ( ((uint16_t) x >> 8) | ((uint16_t) x << 8) ) ) +#define CA_INT32_SWAP(x) ( (int32_t) ( ((uint32_t) x >> 24) | ((uint32_t) x << 24) | (((uint32_t) x & 0xFF00) << 8) | ((((uint32_t) x) >> 8) & 0xFF00) ) ) +#define CA_UINT32_SWAP(x) ( (uint32_t) ( ((uint32_t) x >> 24) | ((uint32_t) x << 24) | (((uint32_t) x & 0xFF00) << 8) | ((((uint32_t) x) >> 8) & 0xFF00) ) ) #endif #ifdef WORDS_BIGENDIAN - #define PA_INT16_FROM_LE(x) PA_INT16_SWAP(x) - #define PA_INT16_FROM_BE(x) ((int16_t)(x)) + #define CA_INT16_FROM_LE(x) CA_INT16_SWAP(x) + #define CA_INT16_FROM_BE(x) ((int16_t)(x)) - #define PA_INT16_TO_LE(x) PA_INT16_SWAP(x) - #define PA_INT16_TO_BE(x) ((int16_t)(x)) + #define CA_INT16_TO_LE(x) CA_INT16_SWAP(x) + #define CA_INT16_TO_BE(x) ((int16_t)(x)) - #define PA_UINT16_FROM_LE(x) PA_UINT16_SWAP(x) - #define PA_UINT16_FROM_BE(x) ((uint16_t)(x)) + #define CA_UINT16_FROM_LE(x) CA_UINT16_SWAP(x) + #define CA_UINT16_FROM_BE(x) ((uint16_t)(x)) - #define PA_UINT16_TO_LE(x) PA_UINT16_SWAP(x) - #define PA_UINT16_TO_BE(x) ((uint16_t)(x)) + #define CA_UINT16_TO_LE(x) CA_UINT16_SWAP(x) + #define CA_UINT16_TO_BE(x) ((uint16_t)(x)) - #define PA_INT32_FROM_LE(x) PA_INT32_SWAP(x) - #define PA_INT32_FROM_BE(x) ((int32_t)(x)) + #define CA_INT32_FROM_LE(x) CA_INT32_SWAP(x) + #define CA_INT32_FROM_BE(x) ((int32_t)(x)) - #define PA_INT32_TO_LE(x) PA_INT32_SWAP(x) - #define PA_INT32_TO_BE(x) ((int32_t)(x)) + #define CA_INT32_TO_LE(x) CA_INT32_SWAP(x) + #define CA_INT32_TO_BE(x) ((int32_t)(x)) - #define PA_UINT32_FROM_LE(x) PA_UINT32_SWAP(x) - #define PA_UINT32_FROM_BE(x) ((uint32_t)(x)) + #define CA_UINT32_FROM_LE(x) CA_UINT32_SWAP(x) + #define CA_UINT32_FROM_BE(x) ((uint32_t)(x)) - #define PA_UINT32_TO_LE(x) PA_UINT32_SWAP(x) - #define PA_UINT32_TO_BE(x) ((uint32_t)(x)) + #define CA_UINT32_TO_LE(x) CA_UINT32_SWAP(x) + #define CA_UINT32_TO_BE(x) ((uint32_t)(x)) #else - #define PA_INT16_FROM_LE(x) ((int16_t)(x)) - #define PA_INT16_FROM_BE(x) PA_INT16_SWAP(x) + #define CA_INT16_FROM_LE(x) ((int16_t)(x)) + #define CA_INT16_FROM_BE(x) CA_INT16_SWAP(x) - #define PA_INT16_TO_LE(x) ((int16_t)(x)) - #define PA_INT16_TO_BE(x) PA_INT16_SWAP(x) + #define CA_INT16_TO_LE(x) ((int16_t)(x)) + #define CA_INT16_TO_BE(x) CA_INT16_SWAP(x) - #define PA_UINT16_FROM_LE(x) ((uint16_t)(x)) - #define PA_UINT16_FROM_BE(x) PA_UINT16_SWAP(x) + #define CA_UINT16_FROM_LE(x) ((uint16_t)(x)) + #define CA_UINT16_FROM_BE(x) CA_UINT16_SWAP(x) - #define PA_UINT16_TO_LE(x) ((uint16_t)(x)) - #define PA_UINT16_TO_BE(x) PA_UINT16_SWAP(x) + #define CA_UINT16_TO_LE(x) ((uint16_t)(x)) + #define CA_UINT16_TO_BE(x) CA_UINT16_SWAP(x) - #define PA_INT32_FROM_LE(x) ((int32_t)(x)) - #define PA_INT32_FROM_BE(x) PA_INT32_SWAP(x) + #define CA_INT32_FROM_LE(x) ((int32_t)(x)) + #define CA_INT32_FROM_BE(x) CA_INT32_SWAP(x) - #define PA_INT32_TO_LE(x) ((int32_t)(x)) - #define PA_INT32_TO_BE(x) PA_INT32_SWAP(x) + #define CA_INT32_TO_LE(x) ((int32_t)(x)) + #define CA_INT32_TO_BE(x) CA_INT32_SWAP(x) - #define PA_UINT32_FROM_LE(x) ((uint32_t)(x)) - #define PA_UINT32_FROM_BE(x) PA_UINT32_SWAP(x) + #define CA_UINT32_FROM_LE(x) ((uint32_t)(x)) + #define CA_UINT32_FROM_BE(x) CA_UINT32_SWAP(x) - #define PA_UINT32_TO_LE(x) ((uint32_t)(x)) - #define PA_UINT32_TO_BE(x) PA_UINT32_SWAP(x) + #define CA_UINT32_TO_LE(x) ((uint32_t)(x)) + #define CA_UINT32_TO_BE(x) CA_UINT32_SWAP(x) #endif #define ca_streq(a, b) (strcmp((a),(b)) == 0) diff --git a/src/read-wav.c b/src/read-wav.c index 4b74c23..0313a3b 100644 --- a/src/read-wav.c +++ b/src/read-wav.c @@ -50,12 +50,12 @@ static int skip_to_chunk(ca_wav *w, uint32_t id, uint32_t *size) { if (fread(chunk, sizeof(uint32_t), CA_ELEMENTSOF(chunk), w->file) != CA_ELEMENTSOF(chunk)) goto fail_io; - s = PA_UINT32_FROM_LE(chunk[1]); + s = CA_UINT32_FROM_LE(chunk[1]); if (s <= 0 || s >= FILE_SIZE_MAX) return CA_ERROR_TOOBIG; - if (PA_UINT32_FROM_LE(chunk[0]) == id) { + if (CA_UINT32_FROM_LE(chunk[0]) == id) { *size = s; break; } @@ -93,13 +93,13 @@ int ca_wav_open(ca_wav **_w, FILE *f) { if (fread(header, sizeof(uint32_t), CA_ELEMENTSOF(header), f) != CA_ELEMENTSOF(header)) goto fail_io; - if (PA_UINT32_FROM_LE(header[0]) != 0x46464952U || - PA_UINT32_FROM_LE(header[2]) != 0x45564157U) { + if (CA_UINT32_FROM_LE(header[0]) != 0x46464952U || + CA_UINT32_FROM_LE(header[2]) != 0x45564157U) { ret = CA_ERROR_CORRUPT; goto fail; } - file_size = PA_UINT32_FROM_LE(header[1]); + file_size = CA_UINT32_FROM_LE(header[1]); if (file_size <= 0 || file_size >= FILE_SIZE_MAX) { ret = CA_ERROR_TOOBIG; @@ -118,14 +118,14 @@ int ca_wav_open(ca_wav **_w, FILE *f) { if (fread(fmt_chunk, sizeof(uint32_t), CA_ELEMENTSOF(fmt_chunk), f) != CA_ELEMENTSOF(fmt_chunk)) goto fail_io; - if ((PA_UINT32_FROM_LE(fmt_chunk[0]) & 0xFFFF) != 1) { + if ((CA_UINT32_FROM_LE(fmt_chunk[0]) & 0xFFFF) != 1) { ret = CA_ERROR_NOTSUPPORTED; goto fail; } - w->nchannels = PA_UINT32_FROM_LE(fmt_chunk[0]) >> 16; - w->rate = PA_UINT32_FROM_LE(fmt_chunk[1]); - w->depth = PA_UINT32_FROM_LE(fmt_chunk[3]) >> 16; + w->nchannels = CA_UINT32_FROM_LE(fmt_chunk[0]) >> 16; + w->rate = CA_UINT32_FROM_LE(fmt_chunk[1]); + w->depth = CA_UINT32_FROM_LE(fmt_chunk[3]) >> 16; if (w->nchannels <= 0 || w->rate <= 0) { ret = CA_ERROR_CORRUPT; |