add support for building on os/2 with emx

This commit is contained in:
Josh Coalson 2005-09-03 03:54:16 +00:00
parent 1be4415813
commit e9a638d004
12 changed files with 46 additions and 21 deletions

View File

@ -110,7 +110,7 @@
<li>
build system:
<ul>
<li>(none)</li>
<li>Add support for building on OS/2 with EMX (<a href="https://sourceforge.net/tracker/index.php?func=detail&aid=1229495&group_id=13478&atid=113478">SF #1229495</a>)</li>
</ul>
</li>
<li>

View File

@ -32,7 +32,7 @@
#ifndef FLAC__ORDINALS_H
#define FLAC__ORDINALS_H
#ifndef _MSC_VER
#if !(defined(_MSC_VER) || defined(__EMX__))
#include <inttypes.h>
#endif
@ -46,6 +46,13 @@ typedef __int64 FLAC__int64;
typedef unsigned __int16 FLAC__uint16;
typedef unsigned __int32 FLAC__uint32;
typedef unsigned __int64 FLAC__uint64;
#elif defined(__EMX__)
typedef short FLAC__int16;
typedef long FLAC__int32;
typedef long long FLAC__int64;
typedef unsigned short FLAC__uint16;
typedef unsigned long FLAC__uint32;
typedef unsigned long long FLAC__uint64;
#else
typedef int16_t FLAC__int16;
typedef int32_t FLAC__int32;

View File

@ -31,8 +31,6 @@
#if !defined _MSC_VER && !defined __MINGW32__
/* unlink is in stdio.h in VC++ */
#include <unistd.h> /* for unlink() */
#else
#define strcasecmp stricmp
#endif
#include "FLAC/all.h"
#include "share/grabbag.h"
@ -43,6 +41,12 @@
#include "utils.h"
#include "vorbiscomment.h"
#if defined _MSC_VER || defined __MINGW32__ || defined __EMX__
#define FLAC__STRCASECMP stricmp
#else
#define FLAC__STRCASECMP strcasecmp
#endif
#if 0
/*[JEC] was:#if HAVE_GETOPT_LONG*/
/*[JEC] see flac/include/share/getopt.h as to why the change */
@ -274,6 +278,11 @@ int main(int argc, char *argv[])
{
int retval = 0;
#ifdef __EMX__
_response(&argc, &argv);
_wildcard(&argc, &argv);
#endif
setlocale(LC_ALL, "");
if(!init_options()) {
flac__utils_printf(stderr, 1, "ERROR: allocating memory\n");
@ -1513,11 +1522,11 @@ int encode_file(const char *infilename, FLAC__bool is_first_file, FLAC__bool is_
if(!option_values.force_raw_format) {
/* first set format based on name */
if(strlen(infilename) >= 4 && 0 == strcasecmp(infilename+(strlen(infilename)-4), ".wav"))
if(strlen(infilename) >= 4 && 0 == FLAC__STRCASECMP(infilename+(strlen(infilename)-4), ".wav"))
fmt= WAV;
else if(strlen(infilename) >= 4 && 0 == strcasecmp(infilename+(strlen(infilename)-4), ".aif"))
else if(strlen(infilename) >= 4 && 0 == FLAC__STRCASECMP(infilename+(strlen(infilename)-4), ".aif"))
fmt= AIF;
else if(strlen(infilename) >= 5 && 0 == strcasecmp(infilename+(strlen(infilename)-5), ".aiff"))
else if(strlen(infilename) >= 5 && 0 == FLAC__STRCASECMP(infilename+(strlen(infilename)-5), ".aiff"))
fmt= AIF;
/* attempt to guess the file type based on the first 12 bytes */
@ -1686,7 +1695,7 @@ int decode_file(const char *infilename)
if(option_values.use_ogg)
treat_as_ogg = true;
else if(strlen(infilename) >= 4 && 0 == strcasecmp(infilename+(strlen(infilename)-4), ".ogg"))
else if(strlen(infilename) >= 4 && 0 == FLAC__STRCASECMP(infilename+(strlen(infilename)-4), ".ogg"))
treat_as_ogg = true;
else
treat_as_ogg = false;
@ -1730,8 +1739,8 @@ int decode_file(const char *infilename)
if(
option_values.force_aiff_format ||
(strlen(outfilename) >= 4 && 0 == strcasecmp(outfilename+(strlen(outfilename)-4), ".aif")) ||
(strlen(outfilename) >= 5 && 0 == strcasecmp(outfilename+(strlen(outfilename)-5), ".aiff"))
(strlen(outfilename) >= 4 && 0 == FLAC__STRCASECMP(outfilename+(strlen(outfilename)-4), ".aif")) ||
(strlen(outfilename) >= 5 && 0 == FLAC__STRCASECMP(outfilename+(strlen(outfilename)-5), ".aiff"))
)
retval = flac__decode_aiff(infilename, option_values.test_only? 0 : outfilename, option_values.analyze, option_values.aopts, options);
else

View File

@ -2856,7 +2856,7 @@ FLAC__bool transport_tempfile_(const char *filename, FILE **tempfile, char **tem
(void)fclose(*tempfile);
*tempfile = 0;
#if defined _MSC_VER || defined __MINGW32__
#if defined _MSC_VER || defined __MINGW32__ || defined __EMX__
if(unlink(filename) < 0) {
cleanup_tempfile_(tempfile, tempfilename);
*status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_UNLINK_ERROR;
@ -2908,7 +2908,7 @@ void set_file_stats_(const char *filename, struct stat *stats)
srctime.modtime = stats->st_mtime;
(void)chmod(filename, stats->st_mode);
(void)utime(filename, &srctime);
#if !defined _MSC_VER && !defined __MINGW32__
#if !defined _MSC_VER && !defined __MINGW32__ && !defined __EMX__
(void)chown(filename, stats->st_uid, -1);
(void)chown(filename, -1, stats->st_gid);
#endif

View File

@ -1178,7 +1178,7 @@ FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_entry_matches(const FLAC
FLAC__ASSERT(0 != entry.entry && entry.length > 0);
{
const FLAC__byte *eq = (FLAC__byte*)memchr(entry.entry, '=', entry.length);
#if defined _MSC_VER || defined __MINGW32__
#if defined _MSC_VER || defined __MINGW32__ || defined __EMX__
#define FLAC__STRNCASECMP strnicmp
#else
#define FLAC__STRNCASECMP strncasecmp

View File

@ -29,6 +29,11 @@ int main(int argc, char *argv[])
CommandLineOptions options;
int ret = 0;
#ifdef __EMX__
_response(&argc, &argv);
_wildcard(&argc, &argv);
#endif
setlocale(LC_ALL, "");
init_options(&options);

View File

@ -196,7 +196,7 @@ static char *local__get_field_(char **s, FLAC__bool allow_quotes)
static FLAC__bool local__cuesheet_parse_(FILE *file, const char **error_message, unsigned *last_line_read, FLAC__StreamMetadata *cuesheet, FLAC__bool is_cdda, FLAC__uint64 lead_out_offset)
{
#if defined _MSC_VER || defined __MINGW32__
#if defined _MSC_VER || defined __MINGW32__ || defined __EMX__
#define FLAC__STRCASECMP stricmp
#else
#define FLAC__STRCASECMP strcasecmp

View File

@ -24,7 +24,7 @@
#include <sys/types.h> /* some flavors of BSD (like OS X) require this to get time_t */
#include <utime.h> /* for utime() */
#endif
#ifdef __CYGWIN__
#if defined __CYGWIN__ || defined __EMX__
#include <io.h> /* for setmode(), O_BINARY */
#include <fcntl.h> /* for _O_BINARY */
#endif
@ -120,6 +120,8 @@ FILE *grabbag__file_get_binary_stdin()
#elif defined __CYGWIN__
/* almost certainly not needed for any modern Cygwin, but let's be safe... */
setmode(_fileno(stdin), _O_BINARY);
#elif defined __EMX__
setmode(fileno(stdin), O_BINARY);
#endif
return stdin;
@ -136,6 +138,8 @@ FILE *grabbag__file_get_binary_stdout()
#elif defined __CYGWIN__
/* almost certainly not needed for any modern Cygwin, but let's be safe... */
setmode(_fileno(stdout), _O_BINARY);
#elif defined __EMX__
setmode(fileno(stdout), O_BINARY);
#endif
return stdout;

View File

@ -221,7 +221,7 @@ bool transport_tempfile_(const char *filename, FILE **tempfile, char **tempfilen
*tempfile = 0;
}
#if defined _MSC_VER || defined __MINGW32__
#if defined _MSC_VER || defined __MINGW32__ || defined __EMX__
if(unlink(filename) < 0) {
cleanup_tempfile_(tempfile, tempfilename);
return false;
@ -256,7 +256,7 @@ void set_file_stats_(const char *filename, struct stat *stats)
srctime.modtime = stats->st_mtime;
(void)chmod(filename, stats->st_mode);
(void)utime(filename, &srctime);
#if !defined _MSC_VER && !defined __MINGW32__
#if !defined _MSC_VER && !defined __MINGW32__ && !defined __EMX__
(void)chown(filename, stats->st_uid, (gid_t)(-1));
(void)chown(filename, (uid_t)(-1), stats->st_gid);
#endif

View File

@ -204,7 +204,7 @@ FLAC__bool transport_tempfile_(const char *filename, FILE **tempfile, char **tem
*tempfile = 0;
}
#if defined _MSC_VER || defined __MINGW32__
#if defined _MSC_VER || defined __MINGW32__ || defined __EMX__
if(unlink(filename) < 0) {
cleanup_tempfile_(tempfile, tempfilename);
return false;
@ -239,7 +239,7 @@ void set_file_stats_(const char *filename, struct stat *stats)
srctime.modtime = stats->st_mtime;
(void)chmod(filename, stats->st_mode);
(void)utime(filename, &srctime);
#if !defined _MSC_VER && !defined __MINGW32__
#if !defined _MSC_VER && !defined __MINGW32__ && !defined __EMX__
(void)chown(filename, stats->st_uid, -1);
(void)chown(filename, -1, stats->st_gid);
#endif

View File

@ -228,7 +228,7 @@ static FLAC__bool seek_barrage_native_flac(const char *filename, off_t filesize,
return die_f_("FLAC__file_decoder_process_until_end_of_metadata() FAILED", decoder);
printf("file's total_samples is %llu\n", decoder_client_data.total_samples);
#if !defined _MSC_VER && !defined __MINGW32__
#if !defined _MSC_VER && !defined __MINGW32__ && !defined __EMX__
if (decoder_client_data.total_samples > (FLAC__uint64)RAND_MAX) {
printf("ERROR: must be total_samples < %u\n", (unsigned)RAND_MAX);
return false;

View File

@ -32,7 +32,7 @@
#define M_PI 3.14159265358979323846
#endif
#ifdef _WIN32
#if defined _WIN32 || defined __EMX__
static const char *mode = "wb";
#else
static const char *mode = "w";