bigendian fixes
This commit is contained in:
parent
98ed2dd98c
commit
dababde103
|
@ -1,3 +1,9 @@
|
|||
/* $Id: mve_main.c,v 1.2 2003-02-19 00:42:40 btb Exp $ */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <conf.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
@ -8,6 +14,8 @@
|
|||
|
||||
#include "mvelib.h"
|
||||
|
||||
#define SWAPINT(x) (((x)<<24) | (((unsigned int)(x)) >> 24) | (((x) &0x0000ff00) << 8) | (((x) & 0x00ff0000) >> 8))
|
||||
|
||||
#define MAX_FILES 256
|
||||
|
||||
extern int g_spdFactorNum;
|
||||
|
@ -94,6 +102,13 @@ int main(int argc, char *argv[])
|
|||
fprintf(stderr, "Error reading %s\n", mvlfile);
|
||||
exit(1);
|
||||
}
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
nfiles = SWAPINT(nfiles);
|
||||
#endif
|
||||
if (nfiles > MAX_FILES) {
|
||||
fprintf(stderr, "Error reading %s: nfiles = %d, MAX_FILES = %d\n",
|
||||
mvlfile, nfiles, MAX_FILES);
|
||||
}
|
||||
for (i = 0; i < nfiles; i++) {
|
||||
if ((read(filehandle, filename[i], 13) < 13) ||
|
||||
(read(filehandle, &filesize[i], 4) < 4) ||
|
||||
|
@ -101,6 +116,9 @@ int main(int argc, char *argv[])
|
|||
fprintf(stderr, "Error reading %s\n", mvlfile);
|
||||
exit(1);
|
||||
}
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
filesize[i] = SWAPINT(filesize[i]);
|
||||
#endif
|
||||
}
|
||||
|
||||
for (i = 0; i < nfiles; i++) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: mveplay.c,v 1.2 2003-02-18 23:28:47 btb Exp $ */
|
||||
/* $Id: mveplay.c,v 1.3 2003-02-19 00:42:40 btb Exp $ */
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <conf.h>
|
||||
#endif
|
||||
|
@ -30,6 +30,7 @@
|
|||
#include "u_mem.h"
|
||||
#include "gr.h"
|
||||
#include "palette.h"
|
||||
#include "args.h"
|
||||
#endif
|
||||
|
||||
#ifdef STANDALONE
|
||||
|
@ -355,7 +356,11 @@ static int create_audiobuf_handler(unsigned char major, unsigned char minor, uns
|
|||
mve_audio_compressed = compressed;
|
||||
|
||||
if (bitsize == 1) {
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
format = AUDIO_S16MSB;
|
||||
#else
|
||||
format = AUDIO_S16LSB;
|
||||
#endif
|
||||
} else {
|
||||
format = AUDIO_U8;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue