projects
/
chise
/
xemacs-chise.git-
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
(MIN_LEADING_BYTE): Changed to -0x200.
[chise/xemacs-chise.git-]
/
src
/
nas.c
diff --git
a/src/nas.c
b/src/nas.c
index
a338ad1
..
bc473aa
100644
(file)
--- a/
src/nas.c
+++ b/
src/nas.c
@@
-68,15
+68,30
@@
#include <unistd.h>
#endif
#include <unistd.h>
#endif
+/* NAS <= 1.2p5 defines {BIG,LITTLE}_ENDIAN in <audio/fileutil.h>,
+ conflicting with GNU libc (at least); newer versions avoid this
+ name space pollution.
+ DO NOT USE THOSE MACROS in this file. Use NAS_{BIG,LITTLE}_ENDIAN.
+
+ It would be slightly more reliable to do this via configure, but that
+ seems unnecessarily complex.
+*/
#undef LITTLE_ENDIAN
#undef BIG_ENDIAN
#undef LITTLE_ENDIAN
#undef BIG_ENDIAN
+
#include <audio/audiolib.h>
#include <audio/soundlib.h>
#include <audio/snd.h>
#include <audio/wave.h>
#include <audio/fileutil.h>
#include <audio/audiolib.h>
#include <audio/soundlib.h>
#include <audio/snd.h>
#include <audio/wave.h>
#include <audio/fileutil.h>
+/* NAS <= 1.2p5 <audio/fileutil.h> doesn't define the NAS_ versions */
+#ifndef NAS_LITTLE_ENDIAN
+#define NAS_LITTLE_ENDIAN LITTLE_ENDIAN
+#define NAS_BIG_ENDIAN BIG_ENDIAN
+#endif
+
#ifdef emacs
# define XTOOLKIT
#ifdef emacs
# define XTOOLKIT
@@
-108,7
+123,6
@@
#else /* !emacs */
# define warn(str) fprintf (stderr, "%s\n", (str))
#else /* !emacs */
# define warn(str) fprintf (stderr, "%s\n", (str))
-# define CONST const
#endif /* emacs */
#ifdef XTOOLKIT
#endif /* emacs */
#ifdef XTOOLKIT
@@
-624,7
+638,7
@@
CatchErrorAndJump (AuServer *old_aud,
/* Create a name from the sound. */
static char *
/* Create a name from the sound. */
static char *
-NameFromData (CONST char *buf,
+NameFromData (const char *buf,
int len)
{
int len)
{
@@
-668,7
+682,7
@@
NameFromData (CONST char *buf,
*/
static SndInfo *
*/
static SndInfo *
-SndOpenDataForReading (CONST char *data,
+SndOpenDataForReading (const char *data,
int length)
{
int length)
{
@@
-683,7
+697,7
@@
SndOpenDataForReading (CONST char *data,
memcpy (&si->h, data, sizeof (SndHeader));
memcpy (&si->h, data, sizeof (SndHeader));
- if (LITTLE_ENDIAN)
+ if (NAS_LITTLE_ENDIAN)
{
char n;
{
char n;
@@
-744,11
+758,11
@@
static size_t file_posn;
/* The length of the "file" */
static size_t file_len;
/* The actual "file" data. */
/* The length of the "file" */
static size_t file_len;
/* The actual "file" data. */
-static CONST void* file_data;
+static const void* file_data;
/* Like fopen, but for a buffer in memory */
static void
/* Like fopen, but for a buffer in memory */
static void
-dopen (CONST void* data, size_t length)
+dopen (const void* data, size_t length)
{
file_data = data;
file_len = length;
{
file_data = data;
file_len = length;
@@
-799,7
+813,7
@@
dseek (long offset, int from)
/* Like ftell, but for a buffer in memory */
static long
/* Like ftell, but for a buffer in memory */
static long
-dtell()
+dtell (void)
{
return file_posn;
}
{
return file_posn;
}
@@
-807,7
+821,7
@@
dtell()
/* Data buffer analogs for FileReadS and FileReadL in NAS. */
static unsigned short
/* Data buffer analogs for FileReadS and FileReadL in NAS. */
static unsigned short
-DataReadS(int swapit)
+DataReadS (int swapit)
{
unsigned short us;
{
unsigned short us;
@@
-818,7
+832,7
@@
DataReadS(int swapit)
}
static AuUint32
}
static AuUint32
-DataReadL(int swapit)
+DataReadL (int swapit)
{
AuUint32 ul;
{
AuUint32 ul;
@@
-829,13
+843,13
@@
DataReadL(int swapit)
}
static int
}
static int
-readChunk(RiffChunk *c)
+readChunk (RiffChunk *c)
{
int status;
char n;
if ((status = dread(c, sizeof(RiffChunk), 1)))
{
int status;
char n;
if ((status = dread(c, sizeof(RiffChunk), 1)))
- if (BIG_ENDIAN)
+ if (NAS_BIG_ENDIAN)
swapl(&c->ckSize, n);
return status;
swapl(&c->ckSize, n);
return status;
@@
-845,8
+859,8
@@
readChunk(RiffChunk *c)
read the wave data from a buffer in memory. */
static WaveInfo *
read the wave data from a buffer in memory. */
static WaveInfo *
-WaveOpenDataForReading(CONST char *data,
- int length)
+WaveOpenDataForReading (const char *data,
+ int length)
{
RiffChunk ck;
RIFF_FOURCC fourcc;
{
RiffChunk ck;
RIFF_FOURCC fourcc;
@@
-921,18
+935,18
@@
WaveOpenDataForReading(CONST char *data,
{
AuInt32 dummy;
{
AuInt32 dummy;
- wi->format = DataReadS(BIG_ENDIAN);
- wi->channels = DataReadS(BIG_ENDIAN);
- wi->sampleRate = DataReadL(BIG_ENDIAN);
+ wi->format = DataReadS(NAS_BIG_ENDIAN);
+ wi->channels = DataReadS(NAS_BIG_ENDIAN);
+ wi->sampleRate = DataReadL(NAS_BIG_ENDIAN);
/* we don't care about the next two fields */
/* we don't care about the next two fields */
- dummy = DataReadL(BIG_ENDIAN);
- dummy = DataReadS(BIG_ENDIAN);
+ dummy = DataReadL(NAS_BIG_ENDIAN);
+ dummy = DataReadS(NAS_BIG_ENDIAN);
if (wi->format != RIFF_WAVE_FORMAT_PCM)
Err();
if (wi->format != RIFF_WAVE_FORMAT_PCM)
Err();
- wi->bitsPerSample = DataReadS(BIG_ENDIAN);
+ wi->bitsPerSample = DataReadS(NAS_BIG_ENDIAN);
/* skip any other format specific fields */
dseek(PAD2(ck.ckSize - 16), 1);
/* skip any other format specific fields */
dseek(PAD2(ck.ckSize - 16), 1);