diff options
-rw-r--r-- | examples/c/decode/file/main.c | 4 | ||||
-rw-r--r-- | examples/c/encode/file/main.c | 4 | ||||
-rw-r--r-- | include/share/compat.h | 61 | ||||
-rw-r--r-- | src/flac/decode.c | 18 | ||||
-rw-r--r-- | src/flac/encode.c | 18 | ||||
-rw-r--r-- | src/flac/foreign_metadata.c | 12 | ||||
-rw-r--r-- | src/flac/iffscan.c | 12 | ||||
-rw-r--r-- | src/libFLAC/metadata_iterators.c | 9 | ||||
-rw-r--r-- | src/libFLAC/stream_encoder.c | 23 | ||||
-rw-r--r-- | src/metaflac/operations.c | 4 | ||||
-rw-r--r-- | src/metaflac/operations_shorthand_cuesheet.c | 4 | ||||
-rw-r--r-- | src/metaflac/operations_shorthand_streaminfo.c | 4 | ||||
-rw-r--r-- | src/share/grabbag/cuesheet.c | 4 | ||||
-rw-r--r-- | src/test_libFLAC/decoders.c | 11 | ||||
-rw-r--r-- | src/test_libFLAC/encoders.c | 4 | ||||
-rw-r--r-- | src/test_libFLAC/metadata_manip.c | 9 | ||||
-rw-r--r-- | src/test_libFLAC/metadata_object.c | 4 | ||||
-rw-r--r-- | src/test_libs_common/metadata_utils.c | 4 | ||||
-rw-r--r-- | src/test_seeking/main.c | 4 |
19 files changed, 85 insertions, 128 deletions
diff --git a/examples/c/decode/file/main.c b/examples/c/decode/file/main.c index f7efd9a9..33e56336 100644 --- a/examples/c/decode/file/main.c +++ b/examples/c/decode/file/main.c @@ -28,11 +28,9 @@ # include <config.h> #endif -#if HAVE_INTTYPES_H -#include <inttypes.h> -#endif #include <stdio.h> #include <stdlib.h> +#include "share/compat.h" #include "FLAC/stream_decoder.h" static FLAC__StreamDecoderWriteStatus write_callback(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data); diff --git a/examples/c/encode/file/main.c b/examples/c/encode/file/main.c index bce97327..93533160 100644 --- a/examples/c/encode/file/main.c +++ b/examples/c/encode/file/main.c @@ -28,12 +28,10 @@ # include <config.h> #endif -#if HAVE_INTTYPES_H -#include <inttypes.h> -#endif #include <stdio.h> #include <stdlib.h> #include <string.h> +#include "share/compat.h" #include "FLAC/metadata.h" #include "FLAC/stream_encoder.h" diff --git a/include/share/compat.h b/include/share/compat.h new file mode 100644 index 00000000..e9ac9583 --- /dev/null +++ b/include/share/compat.h @@ -0,0 +1,61 @@ +/* libFLAC - Free Lossless Audio Codec library + * Copyright (C) 2012 Xiph.org Foundation + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* This is the prefered location of all CPP hackery to make $random_compiler + * work like something approaching a C99 (or maybe more accurately GNU99) + * compiler. + * + * It is assumed that this header will be included after "config.h". + */ + +#if defined _WIN32 && !defined __CYGWIN__ +/* where MSVC puts unlink() */ +# include <io.h> +#else +# include <unistd.h> +#endif + +#if defined _MSC_VER || defined __BORLANDC__ || defined __MINGW32__ +#include <sys/types.h> /* for off_t */ +#if _MSC_VER <= 1600 || defined __BORLANDC__ /* @@@ [2G limit] */ +#ifndef fseeko +#define fseeko fseek +#endif +#ifndef ftello +#define ftello ftell +#endif +#endif +#endif + +#if HAVE_INTTYPES_H +#include <inttypes.h> +#endif + diff --git a/src/flac/decode.c b/src/flac/decode.c index 21736696..ce152a22 100644 --- a/src/flac/decode.c +++ b/src/flac/decode.c @@ -20,23 +20,6 @@ # include <config.h> #endif -#if defined _WIN32 && !defined __CYGWIN__ -/* where MSVC puts unlink() */ -# include <io.h> -#else -# include <unistd.h> -#endif -#if defined _MSC_VER || defined __MINGW32__ -#include <sys/types.h> /* for off_t */ -#if _MSC_VER <= 1600 /* @@@ [2G limit] */ -#ifndef fseeko -#define fseeko fseek -#endif -#ifndef ftello -#define ftello ftell -#endif -#endif -#endif #include <errno.h> #include <math.h> /* for floor() */ #include <stdio.h> /* for FILE etc. */ @@ -44,6 +27,7 @@ #include "FLAC/all.h" #include "share/grabbag.h" #include "share/replaygain_synthesis.h" +#include "share/compat.h" #include "decode.h" typedef struct { diff --git a/src/flac/encode.c b/src/flac/encode.c index 87ef2ef2..263224d3 100644 --- a/src/flac/encode.c +++ b/src/flac/encode.c @@ -20,23 +20,6 @@ # include <config.h> #endif -#if defined _WIN32 && !defined __CYGWIN__ -/* where MSVC puts unlink() */ -# include <io.h> -#else -# include <unistd.h> -#endif -#if defined _MSC_VER || defined __MINGW32__ -#include <sys/types.h> /* for off_t */ -#if _MSC_VER <= 1600 /* @@@ [2G limit] */ -#ifndef fseeko -#define fseeko fseek -#endif -#ifndef ftello -#define ftello ftell -#endif -#endif -#endif #include <errno.h> #include <limits.h> /* for LONG_MAX */ #include <math.h> /* for floor() */ @@ -46,6 +29,7 @@ #include "FLAC/all.h" #include "share/alloc.h" #include "share/grabbag.h" +#include "share/compat.h" #include "encode.h" #ifdef min diff --git a/src/flac/foreign_metadata.c b/src/flac/foreign_metadata.c index d4fb7c27..c9b4d71d 100644 --- a/src/flac/foreign_metadata.c +++ b/src/flac/foreign_metadata.c @@ -20,23 +20,13 @@ # include <config.h> #endif -#if defined _MSC_VER || defined __MINGW32__ -#include <sys/types.h> /* for off_t */ -#if _MSC_VER <= 1600 /* @@@ [2G limit] */ -#ifndef fseeko -#define fseeko fseek -#endif -#ifndef ftello -#define ftello ftell -#endif -#endif -#endif #include <stdio.h> /* for FILE etc. */ #include <stdlib.h> /* for calloc() etc. */ #include <string.h> /* for memcmp() etc. */ #include "FLAC/assert.h" #include "FLAC/metadata.h" #include "share/alloc.h" +#include "share/compat.h" #include "foreign_metadata.h" #ifdef min diff --git a/src/flac/iffscan.c b/src/flac/iffscan.c index 2cb9075c..41f0bc2f 100644 --- a/src/flac/iffscan.c +++ b/src/flac/iffscan.c @@ -23,17 +23,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#if defined _MSC_VER || defined __MINGW32__ -#include <sys/types.h> /* for off_t */ -#if _MSC_VER <= 1600 /* @@@ [2G limit] */ -#ifndef fseeko -#define fseeko fseek -#endif -#ifndef ftello -#define ftello ftell -#endif -#endif -#endif +#include "share/compat.h" #include "foreign_metadata.h" static FLAC__uint32 unpack32be_(const FLAC__byte *b) diff --git a/src/libFLAC/metadata_iterators.c b/src/libFLAC/metadata_iterators.c index 9ef98822..e9d5275f 100644 --- a/src/libFLAC/metadata_iterators.c +++ b/src/libFLAC/metadata_iterators.c @@ -46,14 +46,6 @@ #endif #include <io.h> /* for chmod() */ #include <sys/types.h> /* for off_t */ -#if _MSC_VER <= 1600 || defined __BORLANDC__ /* @@@ [2G limit] */ -#ifndef fseeko -#define fseeko fseek -#endif -#ifndef ftello -#define ftello ftell -#endif -#endif #else #include <sys/types.h> /* some flavors of BSD (like OS X) require this to get time_t */ #include <utime.h> /* for utime() */ @@ -66,6 +58,7 @@ #include "FLAC/assert.h" #include "FLAC/stream_decoder.h" #include "share/alloc.h" +#include "share/compat.h" #ifdef max #undef max diff --git a/src/libFLAC/stream_encoder.c b/src/libFLAC/stream_encoder.c index 0b6d8c28..eb1b1e0b 100644 --- a/src/libFLAC/stream_encoder.c +++ b/src/libFLAC/stream_encoder.c @@ -46,19 +46,10 @@ #include <stdlib.h> /* for malloc() */ #include <string.h> /* for memcpy() */ #include <sys/types.h> /* for off_t */ -#if defined _MSC_VER || defined __BORLANDC__ || defined __MINGW32__ -#if _MSC_VER <= 1600 || defined __BORLANDC__ /* @@@ [2G limit] */ -#ifndef fseeko -#define fseeko fseek -#endif -#ifndef ftello -#define ftello ftell -#endif -#endif -#endif #include "FLAC/assert.h" #include "FLAC/stream_decoder.h" #include "share/alloc.h" +#include "share/compat.h" #include "protected/stream_encoder.h" #include "private/bitwriter.h" #include "private/bitmath.h" @@ -100,7 +91,7 @@ * parameter estimation in this encoder is very good, almost always * yielding compression within 0.1% of the optimal parameters. */ -#undef ENABLE_RICE_PARAMETER_SEARCH +#undef ENABLE_RICE_PARAMETER_SEARCH typedef struct { @@ -236,7 +227,7 @@ static unsigned evaluate_lpc_subframe_( #endif static unsigned evaluate_verbatim_subframe_( - FLAC__StreamEncoder *encoder, + FLAC__StreamEncoder *encoder, const FLAC__int32 signal[], unsigned blocksize, unsigned subframe_bps, @@ -824,7 +815,7 @@ static FLAC__StreamEncoderInitStatus init_stream_internal_( metadata_picture_has_type1 = true; /* standard icon must be 32x32 pixel PNG */ if( - m->data.picture.type == FLAC__STREAM_METADATA_PICTURE_TYPE_FILE_ICON_STANDARD && + m->data.picture.type == FLAC__STREAM_METADATA_PICTURE_TYPE_FILE_ICON_STANDARD && ( (strcmp(m->data.picture.mime_type, "image/png") && strcmp(m->data.picture.mime_type, "-->")) || m->data.picture.width != 32 || @@ -1173,7 +1164,7 @@ FLAC_API FLAC__StreamEncoderInitStatus FLAC__stream_encoder_init_ogg_stream( /*is_ogg=*/true ); } - + static FLAC__StreamEncoderInitStatus init_FILE_internal_( FLAC__StreamEncoder *encoder, FILE *file, @@ -1235,7 +1226,7 @@ static FLAC__StreamEncoderInitStatus init_FILE_internal_( return init_status; } - + FLAC_API FLAC__StreamEncoderInitStatus FLAC__stream_encoder_init_FILE( FLAC__StreamEncoder *encoder, FILE *file, @@ -1245,7 +1236,7 @@ FLAC_API FLAC__StreamEncoderInitStatus FLAC__stream_encoder_init_FILE( { return init_FILE_internal_(encoder, file, progress_callback, client_data, /*is_ogg=*/false); } - + FLAC_API FLAC__StreamEncoderInitStatus FLAC__stream_encoder_init_ogg_FILE( FLAC__StreamEncoder *encoder, FILE *file, diff --git a/src/metaflac/operations.c b/src/metaflac/operations.c index 369883ab..4df8fd55 100644 --- a/src/metaflac/operations.c +++ b/src/metaflac/operations.c @@ -27,9 +27,7 @@ #include "FLAC/metadata.h" #include "share/alloc.h" #include "share/grabbag.h" -#if HAVE_INTTYPES_H -#include <inttypes.h> -#endif +#include "share/compat.h" #include <stdio.h> #include <stdlib.h> #include <string.h> diff --git a/src/metaflac/operations_shorthand_cuesheet.c b/src/metaflac/operations_shorthand_cuesheet.c index 4393a163..bbad0b5e 100644 --- a/src/metaflac/operations_shorthand_cuesheet.c +++ b/src/metaflac/operations_shorthand_cuesheet.c @@ -21,15 +21,13 @@ #endif #include <errno.h> -#if HAVE_INTTYPES_H -#include <inttypes.h> -#endif #include <stdio.h> /* for snprintf() */ #include <string.h> #include "options.h" #include "utils.h" #include "FLAC/assert.h" #include "share/grabbag.h" +#include "share/compat.h" #include "operations_shorthand.h" static FLAC__bool import_cs_from(const char *filename, FLAC__StreamMetadata **cuesheet, const char *cs_filename, FLAC__bool *needs_write, FLAC__uint64 lead_out_offset, unsigned sample_rate, FLAC__bool is_cdda, Argument_AddSeekpoint *add_seekpoint_link); diff --git a/src/metaflac/operations_shorthand_streaminfo.c b/src/metaflac/operations_shorthand_streaminfo.c index 10194596..9912f7b9 100644 --- a/src/metaflac/operations_shorthand_streaminfo.c +++ b/src/metaflac/operations_shorthand_streaminfo.c @@ -24,9 +24,7 @@ #include "utils.h" #include "FLAC/assert.h" #include "FLAC/metadata.h" -#if HAVE_INTTYPES_H -#include <inttypes.h> -#endif +#include "share/compat.h" #include <string.h> #include "operations_shorthand.h" diff --git a/src/share/grabbag/cuesheet.c b/src/share/grabbag/cuesheet.c index fb62a6bb..7e629456 100644 --- a/src/share/grabbag/cuesheet.c +++ b/src/share/grabbag/cuesheet.c @@ -21,10 +21,8 @@ #endif #include "share/grabbag.h" +#include "share/compat.h" #include "FLAC/assert.h" -#if HAVE_INTTYPES_H -#include <inttypes.h> -#endif #include <stdio.h> #include <stdlib.h> #include <string.h> diff --git a/src/test_libFLAC/decoders.c b/src/test_libFLAC/decoders.c index 70127cf7..efd5e13a 100644 --- a/src/test_libFLAC/decoders.c +++ b/src/test_libFLAC/decoders.c @@ -24,20 +24,11 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#if defined _MSC_VER || defined __MINGW32__ -#if _MSC_VER <= 1600 /* @@@ [2G limit] */ -#ifndef fseeko -#define fseeko fseek -#endif -#ifndef ftello -#define ftello ftell -#endif -#endif -#endif #include "decoders.h" #include "FLAC/assert.h" #include "FLAC/stream_decoder.h" #include "share/grabbag.h" +#include "share/compat.h" #include "test_libs_common/file_utils_flac.h" #include "test_libs_common/metadata_utils.h" diff --git a/src/test_libFLAC/encoders.c b/src/test_libFLAC/encoders.c index 403e808c..616661d9 100644 --- a/src/test_libFLAC/encoders.c +++ b/src/test_libFLAC/encoders.c @@ -21,9 +21,6 @@ #endif #include <errno.h> -#if HAVE_INTTYPES_H -#include <inttypes.h> -#endif #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -31,6 +28,7 @@ #include "FLAC/assert.h" #include "FLAC/stream_encoder.h" #include "share/grabbag.h" +#include "share/compat.h" #include "test_libs_common/file_utils_flac.h" #include "test_libs_common/metadata_utils.h" diff --git a/src/test_libFLAC/metadata_manip.c b/src/test_libFLAC/metadata_manip.c index 6644e791..f0b941ff 100644 --- a/src/test_libFLAC/metadata_manip.c +++ b/src/test_libFLAC/metadata_manip.c @@ -26,14 +26,6 @@ #if defined _MSC_VER || defined __MINGW32__ #include <sys/utime.h> /* for utime() */ #include <io.h> /* for chmod() */ -#if _MSC_VER <= 1600 /* @@@ [2G limit] */ -#ifndef fseeko -#define fseeko fseek -#endif -#ifndef ftello -#define ftello ftell -#endif -#endif #else #include <sys/types.h> /* some flavors of BSD (like OS X) require this to get time_t */ #include <utime.h> /* for utime() */ @@ -44,6 +36,7 @@ #include "FLAC/stream_decoder.h" #include "FLAC/metadata.h" #include "share/grabbag.h" +#include "share/compat.h" #include "test_libs_common/file_utils_flac.h" #include "test_libs_common/metadata_utils.h" #include "metadata.h" diff --git a/src/test_libFLAC/metadata_object.c b/src/test_libFLAC/metadata_object.c index 8e3ba7a0..c2552cb4 100644 --- a/src/test_libFLAC/metadata_object.c +++ b/src/test_libFLAC/metadata_object.c @@ -23,10 +23,8 @@ #include "FLAC/assert.h" #include "FLAC/metadata.h" #include "test_libs_common/metadata_utils.h" +#include "share/compat.h" #include "metadata.h" -#if HAVE_INTTYPES_H -#include <inttypes.h> -#endif #include <stdio.h> #include <stdlib.h> /* for malloc() */ #include <string.h> /* for memcmp() */ diff --git a/src/test_libs_common/metadata_utils.c b/src/test_libs_common/metadata_utils.c index ac73db96..a417dff0 100644 --- a/src/test_libs_common/metadata_utils.c +++ b/src/test_libs_common/metadata_utils.c @@ -26,9 +26,7 @@ #include "FLAC/metadata.h" #include "test_libs_common/metadata_utils.h" -#if HAVE_INTTYPES_H -#include <inttypes.h> -#endif +#include "share/compat.h" #include <stdio.h> #include <stdlib.h> /* for malloc() */ #include <string.h> /* for memcmp() */ diff --git a/src/test_seeking/main.c b/src/test_seeking/main.c index 5a56bf99..d1f11d6e 100644 --- a/src/test_seeking/main.c +++ b/src/test_seeking/main.c @@ -20,9 +20,6 @@ # include <config.h> #endif -#if HAVE_INTTYPES_H -#include <inttypes.h> -#endif #include <signal.h> #include <stdio.h> #include <stdlib.h> @@ -36,6 +33,7 @@ #include "FLAC/assert.h" #include "FLAC/metadata.h" #include "FLAC/stream_decoder.h" +#include "share/compat.h" typedef struct { FLAC__int32 **pcm; |