[flac-dev] [PATCH] Remove even more CPP hackery

Dave Yeo dave.r.yeo at gmail.com
Mon Feb 6 23:30:28 PST 2012


This commit will break OS/2's EMX 0.9d library (GCC 2.8.1) which has been
been replaced by klibc. Considering the age of EMX and lack of testing
and that klibc contains so many improvements I think this is exceptable.
---
 include/FLAC/ordinals.h           |   17 +++++++++--------
 src/flac/main.c                   |    2 +-
 src/libFLAC/metadata_iterators.c  |    2 +-
 src/libFLAC/metadata_object.c     |    2 +-
 src/share/grabbag/cuesheet.c      |    2 +-
 src/test_libFLAC/metadata_manip.c |    2 +-
 6 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/include/FLAC/ordinals.h b/include/FLAC/ordinals.h
index 80d055b..dc2dafc 100644
--- a/include/FLAC/ordinals.h
+++ b/include/FLAC/ordinals.h
@@ -32,10 +32,18 @@
 #ifndef FLAC__ORDINALS_H
 #define FLAC__ORDINALS_H
 -#if !(defined(_MSC_VER) || defined(__BORLANDC__) || defined(__EMX__))
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#if !(defined(_MSC_VER) || defined(__BORLANDC__))
 #include <inttypes.h>
 #endif
 +#if HAVE_STDINT_H
+#include <stdint.h>
+#endif
+
 typedef signed char FLAC__int8;
 typedef unsigned char FLAC__uint8;
 @@ -46,13 +54,6 @@ 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;
diff --git a/src/flac/main.c b/src/flac/main.c
index e673a78..d35c960 100644
--- a/src/flac/main.c
+++ b/src/flac/main.c
@@ -43,7 +43,7 @@
 #include "utils.h"
 #include "vorbiscomment.h"
 -#if defined _MSC_VER || defined __MINGW32__ || defined __EMX__
+#if defined _MSC_VER || defined __MINGW32__
 #define FLAC__STRCASECMP stricmp
 #else
 #define FLAC__STRCASECMP strcasecmp
diff --git a/src/libFLAC/metadata_iterators.c
b/src/libFLAC/metadata_iterators.c
index e9d5275..32e8ed3 100644
--- a/src/libFLAC/metadata_iterators.c
+++ b/src/libFLAC/metadata_iterators.c
@@ -3312,7 +3312,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 __BORLANDC__ && !defined __MINGW32__
&& !defined __EMX__
+#if !defined _MSC_VER && !defined __BORLANDC__ && !defined __MINGW32__
 	(void)chown(filename, stats->st_uid, -1);
 	(void)chown(filename, -1, stats->st_gid);
 #endif
diff --git a/src/libFLAC/metadata_object.c b/src/libFLAC/metadata_object.c
index b7a3280..9196313 100644
--- a/src/libFLAC/metadata_object.c
+++ b/src/libFLAC/metadata_object.c
@@ -1375,7 +1375,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 __BORLANDC__ || defined __MINGW32__ ||
defined __EMX__
+#if defined _MSC_VER || defined __BORLANDC__ || defined __MINGW32__
 #define FLAC__STRNCASECMP strnicmp
 #else
 #define FLAC__STRNCASECMP strncasecmp
diff --git a/src/share/grabbag/cuesheet.c b/src/share/grabbag/cuesheet.c
index 7e62945..15ca5f3 100644
--- a/src/share/grabbag/cuesheet.c
+++ b/src/share/grabbag/cuesheet.c
@@ -240,7 +240,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, unsigned sample_rate, FLAC__bool is_cdda, FLAC__uint64
lead_out_offset)
 {
-#if defined _MSC_VER || defined __MINGW32__ || defined __EMX__
+#if defined _MSC_VER || defined __MINGW32__
 #define FLAC__STRCASECMP stricmp
 #else
 #define FLAC__STRCASECMP strcasecmp
diff --git a/src/test_libFLAC/metadata_manip.c
b/src/test_libFLAC/metadata_manip.c
index f0b941f..19c4e14 100644
--- a/src/test_libFLAC/metadata_manip.c
+++ b/src/test_libFLAC/metadata_manip.c
@@ -259,7 +259,7 @@ static 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__ && !defined __EMX__
+#if !defined _MSC_VER && !defined __MINGW32__
 	(void)chown(filename, stats->st_uid, -1);
 	(void)chown(filename, -1, stats->st_gid);
 #endif
-- 
1.7.2.3


More information about the flac-dev mailing list