---
configure.ac |7 +
src/libFLAC/bitreader.c | 12 ++---
src/libFLAC/bitwriter.c |8 ++
src/libFLAC/fixed.c | 18 +
src/libFLAC/format.c |8 ++
src/libFLAC/include/private/macros.h | 29
src/libFLAC/metadata_iterators.c | 17 +++-
src/libFLAC/ogg_decoder_aspect.c |7 ++---
src/libFLAC/stream_decoder.c |8 ++
src/libFLAC/stream_encoder.c | 49 ++
src/libFLAC/stream_encoder_framing.c |5
11 files changed, 77 insertions(+), 91 deletions(-)
create mode 100644 src/libFLAC/include/private/macros.h
diff --git a/configure.ac b/configure.ac
index d2501bb..7627fb7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -22,6 +22,10 @@ AC_INIT(src/flac/main.c)
AM_INIT_AUTOMAKE(flac, 1.2.1)
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
+
+#Prefer whatever the current ISO standard is.
+AC_PROG_CC_STDC
+AC_USE_SYSTEM_EXTENSIONS
# Enable the generation of shared libraries under Win32
AC_LIBTOOL_WIN32_DLL
@@ -60,6 +64,7 @@ AC_HEADER_STDC
AM_PROG_CC_C_O
AC_C_INLINE
AC_C_VARARRAYS
+AC_C_TYPEOF
AC_CHECK_HEADERS(stdint.h)
AC_SUBST(HAVE_STDINT_H)
@@ -68,6 +73,8 @@ AC_SUBST(HAVE_INTTYPES_H)
AC_CHECK_HEADERS(byteswap.h)
AC_SUBST(HAVE_BYTESWAP_H)
+AC_CHECK_HEADERS([sys/param.h])
+
XIPH_C_BSWAP32
XIPH_C_FIND_ENDIAN
diff --git a/src/libFLAC/bitreader.c b/src/libFLAC/bitreader.c
index cd05a62..7e17fd8 100644
--- a/src/libFLAC/bitreader.c
+++ b/src/libFLAC/bitreader.c
@@ -38,6 +38,7 @@
#include "private/bitmath.h"
#include "private/bitreader.h"
#include "private/crc.h"
+#include "private/macros.h"
#include "FLAC/assert.h"
#include "share/endswap.h"
@@ -109,15 +110,6 @@ static const unsigned char byte_to_unary_table[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
-#ifdef min
-#undef min
-#endif
-#define min(x,y) ((x)<(y)?(x):(y))
-#ifdef max
-#undef max
-#endif
-#define max(x,y) ((x)>(y)?(x):(y))
-
/* adjust for compilers that can't understand using LLU suffix for uint64_t
literals */
#ifdef _MSC_VER
#define FLAC__U64L(x) x
@@ -547,7 +539,7 @@ FLAC__bool FLAC__bitreader_skip_bits_no_crc(FLAC__BitReader
*br, unsigned bits)
FLAC__uint32 x;
if(n != 0) {
- m = min(8-n, bits);
+ m = flac_min(8-n, bits);
if(!FLAC__bitreader_read_raw_uint32(br, &x, m))
return false;
bits -= m;
diff --git a/src/libFLAC/bitwriter.c b/src/libFLAC/bitwriter.c
index 7da4b15..44914d1 100644
--- a/src/libFLAC/bitwriter.c
+++ b/src/libFLAC/bitwriter.c
@@ -37,6 +37,7 @@
#include
#include "private/bitwriter.h"
#include "private/crc.h"
+#include "private/macros.h"
#include "FLAC/assert.h"
#include "share/alloc.h"
#include "share/endswap.h"
@@ -67,11 +68,6 @@ static const unsigned FLAC__BITWRITER_DEFAULT_INCREMENT =
4096u / sizeof(uint32_
#define FLAC__WORDS_TO_BITS(words) ((words) * FLAC__BITS_PER_WORD)
#define FLAC__TOTAL_BITS(bw) (FLAC__WORDS_TO_BITS((bw)->words) + (bw)->bits)
-#ifdef min
-#undef min
-#endif
-#define min(x,y) ((x)<(y)?(x):(y))
-
/* adjust for compilers that can't understand using LLU suffix for uint64_t
literals */
#ifdef _MSC_VER
#define FLAC__U64L(x) x
@@ -288,7 +284,7 @@ FLaC__INLINE FLAC__bool
FLAC__bitwriter_write_zeroes(FLAC__BitWriter *bw, unsign
return false;
/* first part gets to word alignment */
if(bw->bits) {
- n = min(FLAC__BITS_PER_WORD - bw->bits, bits);
+ n = flac_min(FLAC__BITS_PER_WORD - bw->bits, bits);
bw->accum <<= n;
bits -= n;
bw->bits += n;
diff --git a/src/libFLAC/fixed.c b/src/libFLAC/fixed.c
index 1a57cf4..05b289a 100644
--- a/src/libFLAC/fixed.c
+++ b/src/libFLAC/fixed.c
@@ -37,6 +37,7 @@
#include
#include "private/bitmath.h"
#include "private/fixed.h"
+#include "private/macros.h"
#include "FLAC/assert.h"
#ifndef M_LN2
@@ -44,11 +45,6 @@
#define M_LN2 0.69314718055994530942
#endif
-#ifdef min
-#undef min
-#endif
-#define min(x,y) ((x) < (y)? (x) : (y))
-
#ifdef local_abs
#undef local_abs
#endif
@@ -242,11 +238,11 @@ unsigned FLAC__fixed_compute_best_predictor(const
FLAC__int32 data[], unsigned d
error -= last_error_3; total_error_4 += local_abs(error);
last_error_3 = save;
}
- if(total_error_0 < min(min(min(total_error_1, total_error_2),
total_error_3), total_error_4))
+ if(total_error_0 < flac_min(flac_min(flac_min(total_error_1,
total_error_2), total_error_3), total_error_4))
order = 0;
- else if(total_error_1 < min(min(total_error_2, total_error_3),
total_error_4))
+ else if(total_error_1 < flac_min(flac_min(total_error_2,
total_error_3), total_error_4))