From 4663084cfa26c60998d72781949c03f53fd2ee84 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sat, 10 Jan 2015 19:14:57 +0100 Subject: Updated flac so it can compile, applied changes from previous source (nw) --- 3rdparty/libflac/include/share/alloc.h | 2 +- 3rdparty/libflac/src/libFLAC/bitmath.c | 2 +- 3rdparty/libflac/src/libFLAC/bitreader.c | 7 ++++-- 3rdparty/libflac/src/libFLAC/bitwriter.c | 2 +- 3rdparty/libflac/src/libFLAC/cpu.c | 6 +++++- 3rdparty/libflac/src/libFLAC/crc.c | 2 +- 3rdparty/libflac/src/libFLAC/fixed.c | 2 +- 3rdparty/libflac/src/libFLAC/float.c | 2 +- 3rdparty/libflac/src/libFLAC/format.c | 8 +++---- .../libflac/src/libFLAC/include/private/memory.h | 10 ++++----- 3rdparty/libflac/src/libFLAC/lpc.c | 23 +++++++++++++------- 3rdparty/libflac/src/libFLAC/md5.c | 4 ++-- 3rdparty/libflac/src/libFLAC/memory.c | 25 +++++++++++----------- 3rdparty/libflac/src/libFLAC/metadata_iterators.c | 2 +- 3rdparty/libflac/src/libFLAC/metadata_object.c | 2 +- 3rdparty/libflac/src/libFLAC/ogg_decoder_aspect.c | 2 +- 3rdparty/libflac/src/libFLAC/ogg_encoder_aspect.c | 2 +- 3rdparty/libflac/src/libFLAC/ogg_helper.c | 2 +- 3rdparty/libflac/src/libFLAC/ogg_mapping.c | 2 +- 3rdparty/libflac/src/libFLAC/stream_decoder.c | 9 +++++--- 3rdparty/libflac/src/libFLAC/stream_encoder.c | 12 ++++++----- .../libflac/src/libFLAC/stream_encoder_framing.c | 2 +- 3rdparty/libflac/src/libFLAC/window.c | 2 +- src/lib/lib.mak | 2 +- 24 files changed, 77 insertions(+), 57 deletions(-) diff --git a/3rdparty/libflac/include/share/alloc.h b/3rdparty/libflac/include/share/alloc.h index 812aa69d0b6..3fdfad2991a 100644 --- a/3rdparty/libflac/include/share/alloc.h +++ b/3rdparty/libflac/include/share/alloc.h @@ -19,7 +19,7 @@ #ifndef FLAC__SHARE__ALLOC_H #define FLAC__SHARE__ALLOC_H -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif diff --git a/3rdparty/libflac/src/libFLAC/bitmath.c b/3rdparty/libflac/src/libFLAC/bitmath.c index 27e25f0f7ac..af19c35445a 100644 --- a/3rdparty/libflac/src/libFLAC/bitmath.c +++ b/3rdparty/libflac/src/libFLAC/bitmath.c @@ -29,7 +29,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif diff --git a/3rdparty/libflac/src/libFLAC/bitreader.c b/3rdparty/libflac/src/libFLAC/bitreader.c index 7d63e526e0a..e2a4ba3bd16 100644 --- a/3rdparty/libflac/src/libFLAC/bitreader.c +++ b/3rdparty/libflac/src/libFLAC/bitreader.c @@ -29,7 +29,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif @@ -156,6 +156,8 @@ static _inline FLAC__uint32 local_swap32_(FLAC__uint32 x) x = ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF); return (x>>16) | (x<<16); } + +#if defined(_M_IX86) static void local_swap32_block_(FLAC__uint32 *start, FLAC__uint32 len) { __asm { @@ -174,6 +176,7 @@ done1: } } #endif +#endif static FLaC__INLINE void crc16_update_word_(FLAC__BitReader *br, brword word) { @@ -263,7 +266,7 @@ FLAC__bool bitreader_read_from_client_(FLAC__BitReader *br) #if WORDS_BIGENDIAN #else end = (br->words*FLAC__BYTES_PER_WORD + br->bytes + bytes + (FLAC__BYTES_PER_WORD-1)) / FLAC__BYTES_PER_WORD; -# if defined(_MSC_VER) && (FLAC__BYTES_PER_WORD == 4) +# if defined(_MSC_VER) && (FLAC__BYTES_PER_WORD == 4) && defined(_M_IX86) if(br->cpu_info.type == FLAC__CPUINFO_TYPE_IA32 && br->cpu_info.data.ia32.bswap) { start = br->words; local_swap32_block_(br->buffer + start, end - start); diff --git a/3rdparty/libflac/src/libFLAC/bitwriter.c b/3rdparty/libflac/src/libFLAC/bitwriter.c index e3e7ad164ef..089ff872b59 100644 --- a/3rdparty/libflac/src/libFLAC/bitwriter.c +++ b/3rdparty/libflac/src/libFLAC/bitwriter.c @@ -29,7 +29,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif diff --git a/3rdparty/libflac/src/libFLAC/cpu.c b/3rdparty/libflac/src/libFLAC/cpu.c index 60b73bff143..e5ea78ea37c 100644 --- a/3rdparty/libflac/src/libFLAC/cpu.c +++ b/3rdparty/libflac/src/libFLAC/cpu.c @@ -29,7 +29,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif @@ -86,6 +86,7 @@ static void sigill_handler (int sig) /* how to get sysctlbyname()? */ #endif +#if defined(FLAC__CPU_IA32) && !defined(FLAC__NO_ASM) && defined (FLAC__HAS_NASM) /* these are flags in EDX of CPUID AX=00000001 */ static const unsigned FLAC__CPUINFO_IA32_CPUID_CMOV = 0x00008000; static const unsigned FLAC__CPUINFO_IA32_CPUID_MMX = 0x00800000; @@ -95,10 +96,13 @@ static const unsigned FLAC__CPUINFO_IA32_CPUID_SSE2 = 0x04000000; /* these are flags in ECX of CPUID AX=00000001 */ static const unsigned FLAC__CPUINFO_IA32_CPUID_SSE3 = 0x00000001; static const unsigned FLAC__CPUINFO_IA32_CPUID_SSSE3 = 0x00000200; +#ifdef FLAC__USE_3DNOW /* these are flags in EDX of CPUID AX=80000001 */ static const unsigned FLAC__CPUINFO_IA32_CPUID_EXTENDED_AMD_3DNOW = 0x80000000; static const unsigned FLAC__CPUINFO_IA32_CPUID_EXTENDED_AMD_EXT3DNOW = 0x40000000; static const unsigned FLAC__CPUINFO_IA32_CPUID_EXTENDED_AMD_EXTMMX = 0x00400000; +#endif +#endif /* diff --git a/3rdparty/libflac/src/libFLAC/crc.c b/3rdparty/libflac/src/libFLAC/crc.c index 463ab65ef83..52574f87c80 100644 --- a/3rdparty/libflac/src/libFLAC/crc.c +++ b/3rdparty/libflac/src/libFLAC/crc.c @@ -29,7 +29,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif diff --git a/3rdparty/libflac/src/libFLAC/fixed.c b/3rdparty/libflac/src/libFLAC/fixed.c index 1a3aac090f6..e92faf3d8ff 100644 --- a/3rdparty/libflac/src/libFLAC/fixed.c +++ b/3rdparty/libflac/src/libFLAC/fixed.c @@ -29,7 +29,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif diff --git a/3rdparty/libflac/src/libFLAC/float.c b/3rdparty/libflac/src/libFLAC/float.c index 8e19280207b..60fa7e8371a 100644 --- a/3rdparty/libflac/src/libFLAC/float.c +++ b/3rdparty/libflac/src/libFLAC/float.c @@ -29,7 +29,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif diff --git a/3rdparty/libflac/src/libFLAC/format.c b/3rdparty/libflac/src/libFLAC/format.c index 749461d8620..3480905108a 100644 --- a/3rdparty/libflac/src/libFLAC/format.c +++ b/3rdparty/libflac/src/libFLAC/format.c @@ -29,7 +29,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif @@ -581,11 +581,11 @@ FLAC__bool FLAC__format_entropy_coding_method_partitioned_rice_contents_ensure_s FLAC__ASSERT(object->capacity_by_order > 0 || (0 == object->parameters && 0 == object->raw_bits)); if(object->capacity_by_order < max_partition_order) { - if(0 == (object->parameters = (unsigned*)realloc(object->parameters, sizeof(unsigned)*(1 << max_partition_order)))) + if(0 == (object->parameters = (unsigned*)realloc(object->parameters, sizeof(unsigned)*((unsigned long long)1 << max_partition_order)))) return false; - if(0 == (object->raw_bits = (unsigned*)realloc(object->raw_bits, sizeof(unsigned)*(1 << max_partition_order)))) + if(0 == (object->raw_bits = (unsigned*)realloc(object->raw_bits, sizeof(unsigned)*((unsigned long long)1 << max_partition_order)))) return false; - memset(object->raw_bits, 0, sizeof(unsigned)*(1 << max_partition_order)); + memset(object->raw_bits, 0, sizeof(unsigned)*((unsigned long long)1 << max_partition_order)); object->capacity_by_order = max_partition_order; } diff --git a/3rdparty/libflac/src/libFLAC/include/private/memory.h b/3rdparty/libflac/src/libFLAC/include/private/memory.h index 7852c815085..38a9ffe0711 100644 --- a/3rdparty/libflac/src/libFLAC/include/private/memory.h +++ b/3rdparty/libflac/src/libFLAC/include/private/memory.h @@ -45,12 +45,12 @@ * Use free() on this address to deallocate. */ void *FLAC__memory_alloc_aligned(size_t bytes, void **aligned_address); -FLAC__bool FLAC__memory_alloc_aligned_int32_array(unsigned elements, FLAC__int32 **unaligned_pointer, FLAC__int32 **aligned_pointer); -FLAC__bool FLAC__memory_alloc_aligned_uint32_array(unsigned elements, FLAC__uint32 **unaligned_pointer, FLAC__uint32 **aligned_pointer); -FLAC__bool FLAC__memory_alloc_aligned_uint64_array(unsigned elements, FLAC__uint64 **unaligned_pointer, FLAC__uint64 **aligned_pointer); -FLAC__bool FLAC__memory_alloc_aligned_unsigned_array(unsigned elements, unsigned **unaligned_pointer, unsigned **aligned_pointer); +FLAC__bool FLAC__memory_alloc_aligned_int32_array(size_t elements, FLAC__int32 **unaligned_pointer, FLAC__int32 **aligned_pointer); +FLAC__bool FLAC__memory_alloc_aligned_uint32_array(size_t elements, FLAC__uint32 **unaligned_pointer, FLAC__uint32 **aligned_pointer); +FLAC__bool FLAC__memory_alloc_aligned_uint64_array(size_t elements, FLAC__uint64 **unaligned_pointer, FLAC__uint64 **aligned_pointer); +FLAC__bool FLAC__memory_alloc_aligned_unsigned_array(size_t elements, unsigned **unaligned_pointer, unsigned **aligned_pointer); #ifndef FLAC__INTEGER_ONLY_LIBRARY -FLAC__bool FLAC__memory_alloc_aligned_real_array(unsigned elements, FLAC__real **unaligned_pointer, FLAC__real **aligned_pointer); +FLAC__bool FLAC__memory_alloc_aligned_real_array(size_t elements, FLAC__real **unaligned_pointer, FLAC__real **aligned_pointer); #endif #endif diff --git a/3rdparty/libflac/src/libFLAC/lpc.c b/3rdparty/libflac/src/libFLAC/lpc.c index 7806348f2bc..00bbab44c1c 100644 --- a/3rdparty/libflac/src/libFLAC/lpc.c +++ b/3rdparty/libflac/src/libFLAC/lpc.c @@ -29,7 +29,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif @@ -60,6 +60,9 @@ void FLAC__lpc_window_data(const FLAC__int32 in[], const FLAC__real window[], FL out[i] = in[i] * window[i]; } +#if defined(__GNUC__) && defined(__i386__) && (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) +__attribute__((optimize("O0"))) +#endif void FLAC__lpc_compute_autocorrelation(const FLAC__real data[], unsigned data_len, unsigned lag, FLAC__real autoc[]) { /* a readable, but slower, version */ @@ -88,7 +91,7 @@ void FLAC__lpc_compute_autocorrelation(const FLAC__real data[], unsigned data_le * this version tends to run faster because of better data locality * ('data_len' is usually much larger than 'lag') */ - FLAC__real d; + FLAC__real d, tmp; unsigned sample, coeff; const unsigned limit = data_len - lag; @@ -99,20 +102,24 @@ void FLAC__lpc_compute_autocorrelation(const FLAC__real data[], unsigned data_le autoc[coeff] = 0.0; for(sample = 0; sample <= limit; sample++) { d = data[sample]; - for(coeff = 0; coeff < lag; coeff++) - autoc[coeff] += d * data[sample+coeff]; + for(coeff = 0; coeff < lag; coeff++) { + tmp = d * data[sample+coeff]; + autoc[coeff] += tmp; + } } for(; sample < data_len; sample++) { d = data[sample]; - for(coeff = 0; coeff < data_len - sample; coeff++) - autoc[coeff] += d * data[sample+coeff]; + for(coeff = 0; coeff < data_len - sample; coeff++) { + tmp = d * data[sample+coeff]; + autoc[coeff] += tmp; + } } } void FLAC__lpc_compute_lp_coefficients(const FLAC__real autoc[], unsigned *max_order, FLAC__real lp_coeff[][FLAC__MAX_LPC_ORDER], FLAC__double error[]) { unsigned i, j; - FLAC__double r, err, ref[FLAC__MAX_LPC_ORDER], lpc[FLAC__MAX_LPC_ORDER]; + FLAC__double r, err, lpc[FLAC__MAX_LPC_ORDER]; FLAC__ASSERT(0 != max_order); FLAC__ASSERT(0 < *max_order); @@ -126,7 +133,7 @@ void FLAC__lpc_compute_lp_coefficients(const FLAC__real autoc[], unsigned *max_o r = -autoc[i+1]; for(j = 0; j < i; j++) r -= lpc[j] * autoc[i-j]; - ref[i] = (r/=err); + r/=err; /* Update LPC coefficients and total error. */ lpc[i]=r; diff --git a/3rdparty/libflac/src/libFLAC/md5.c b/3rdparty/libflac/src/libFLAC/md5.c index 37cef67bdc8..af350e01d16 100644 --- a/3rdparty/libflac/src/libFLAC/md5.c +++ b/3rdparty/libflac/src/libFLAC/md5.c @@ -1,4 +1,4 @@ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif @@ -263,12 +263,12 @@ void FLAC__MD5Final(FLAC__byte digest[16], FLAC__MD5Context *ctx) byteSwap(ctx->buf, 4); memcpy(digest, ctx->buf, 16); - memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */ if(0 != ctx->internal_buf) { free(ctx->internal_buf); ctx->internal_buf = 0; ctx->capacity = 0; } + memset(ctx, 0, sizeof(*ctx)); /* In case it's sensitive */ } /* diff --git a/3rdparty/libflac/src/libFLAC/memory.c b/3rdparty/libflac/src/libFLAC/memory.c index 4d100975087..48f381b7e8c 100644 --- a/3rdparty/libflac/src/libFLAC/memory.c +++ b/3rdparty/libflac/src/libFLAC/memory.c @@ -29,7 +29,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif @@ -71,7 +71,7 @@ void *FLAC__memory_alloc_aligned(size_t bytes, void **aligned_address) return x; } -FLAC__bool FLAC__memory_alloc_aligned_int32_array(unsigned elements, FLAC__int32 **unaligned_pointer, FLAC__int32 **aligned_pointer) +FLAC__bool FLAC__memory_alloc_aligned_int32_array(size_t elements, FLAC__int32 **unaligned_pointer, FLAC__int32 **aligned_pointer) { FLAC__int32 *pu; /* unaligned pointer */ union { /* union needed to comply with C99 pointer aliasing rules */ @@ -84,10 +84,10 @@ FLAC__bool FLAC__memory_alloc_aligned_int32_array(unsigned elements, FLAC__int32 FLAC__ASSERT(0 != aligned_pointer); FLAC__ASSERT(unaligned_pointer != aligned_pointer); - if((size_t)elements > SIZE_MAX / sizeof(*pu)) /* overflow check */ + if(elements > SIZE_MAX / sizeof(*pu)) /* overflow check */ return false; - pu = (FLAC__int32*)FLAC__memory_alloc_aligned(sizeof(*pu) * (size_t)elements, &u.pv); + pu = (FLAC__int32*)FLAC__memory_alloc_aligned(sizeof(*pu) * elements, &u.pv); if(0 == pu) { return false; } @@ -100,7 +100,8 @@ FLAC__bool FLAC__memory_alloc_aligned_int32_array(unsigned elements, FLAC__int32 } } -FLAC__bool FLAC__memory_alloc_aligned_uint32_array(unsigned elements, FLAC__uint32 **unaligned_pointer, FLAC__uint32 **aligned_pointer) + +FLAC__bool FLAC__memory_alloc_aligned_uint32_array(size_t elements, FLAC__uint32 **unaligned_pointer, FLAC__uint32 **aligned_pointer) { FLAC__uint32 *pu; /* unaligned pointer */ union { /* union needed to comply with C99 pointer aliasing rules */ @@ -113,7 +114,7 @@ FLAC__bool FLAC__memory_alloc_aligned_uint32_array(unsigned elements, FLAC__uint FLAC__ASSERT(0 != aligned_pointer); FLAC__ASSERT(unaligned_pointer != aligned_pointer); - if((size_t)elements > SIZE_MAX / sizeof(*pu)) /* overflow check */ + if(elements > SIZE_MAX / sizeof(*pu)) /* overflow check */ return false; pu = (FLAC__uint32*)FLAC__memory_alloc_aligned(sizeof(*pu) * elements, &u.pv); @@ -129,7 +130,7 @@ FLAC__bool FLAC__memory_alloc_aligned_uint32_array(unsigned elements, FLAC__uint } } -FLAC__bool FLAC__memory_alloc_aligned_uint64_array(unsigned elements, FLAC__uint64 **unaligned_pointer, FLAC__uint64 **aligned_pointer) +FLAC__bool FLAC__memory_alloc_aligned_uint64_array(size_t elements, FLAC__uint64 **unaligned_pointer, FLAC__uint64 **aligned_pointer) { FLAC__uint64 *pu; /* unaligned pointer */ union { /* union needed to comply with C99 pointer aliasing rules */ @@ -142,7 +143,7 @@ FLAC__bool FLAC__memory_alloc_aligned_uint64_array(unsigned elements, FLAC__uint FLAC__ASSERT(0 != aligned_pointer); FLAC__ASSERT(unaligned_pointer != aligned_pointer); - if((size_t)elements > SIZE_MAX / sizeof(*pu)) /* overflow check */ + if(elements > SIZE_MAX / sizeof(*pu)) /* overflow check */ return false; pu = (FLAC__uint64*)FLAC__memory_alloc_aligned(sizeof(*pu) * elements, &u.pv); @@ -158,7 +159,7 @@ FLAC__bool FLAC__memory_alloc_aligned_uint64_array(unsigned elements, FLAC__uint } } -FLAC__bool FLAC__memory_alloc_aligned_unsigned_array(unsigned elements, unsigned **unaligned_pointer, unsigned **aligned_pointer) +FLAC__bool FLAC__memory_alloc_aligned_unsigned_array(size_t elements, unsigned **unaligned_pointer, unsigned **aligned_pointer) { unsigned *pu; /* unaligned pointer */ union { /* union needed to comply with C99 pointer aliasing rules */ @@ -171,7 +172,7 @@ FLAC__bool FLAC__memory_alloc_aligned_unsigned_array(unsigned elements, unsigned FLAC__ASSERT(0 != aligned_pointer); FLAC__ASSERT(unaligned_pointer != aligned_pointer); - if((size_t)elements > SIZE_MAX / sizeof(*pu)) /* overflow check */ + if(elements > SIZE_MAX / sizeof(*pu)) /* overflow check */ return false; pu = (unsigned*)FLAC__memory_alloc_aligned(sizeof(*pu) * elements, &u.pv); @@ -189,7 +190,7 @@ FLAC__bool FLAC__memory_alloc_aligned_unsigned_array(unsigned elements, unsigned #ifndef FLAC__INTEGER_ONLY_LIBRARY -FLAC__bool FLAC__memory_alloc_aligned_real_array(unsigned elements, FLAC__real **unaligned_pointer, FLAC__real **aligned_pointer) +FLAC__bool FLAC__memory_alloc_aligned_real_array(size_t elements, FLAC__real **unaligned_pointer, FLAC__real **aligned_pointer) { FLAC__real *pu; /* unaligned pointer */ union { /* union needed to comply with C99 pointer aliasing rules */ @@ -202,7 +203,7 @@ FLAC__bool FLAC__memory_alloc_aligned_real_array(unsigned elements, FLAC__real * FLAC__ASSERT(0 != aligned_pointer); FLAC__ASSERT(unaligned_pointer != aligned_pointer); - if((size_t)elements > SIZE_MAX / sizeof(*pu)) /* overflow check */ + if(elements > SIZE_MAX / sizeof(*pu)) /* overflow check */ return false; pu = (FLAC__real*)FLAC__memory_alloc_aligned(sizeof(*pu) * elements, &u.pv); diff --git a/3rdparty/libflac/src/libFLAC/metadata_iterators.c b/3rdparty/libflac/src/libFLAC/metadata_iterators.c index 15362f7b507..f88795bcf82 100644 --- a/3rdparty/libflac/src/libFLAC/metadata_iterators.c +++ b/3rdparty/libflac/src/libFLAC/metadata_iterators.c @@ -29,7 +29,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif diff --git a/3rdparty/libflac/src/libFLAC/metadata_object.c b/3rdparty/libflac/src/libFLAC/metadata_object.c index a1465f5bb51..6f8bccf4563 100644 --- a/3rdparty/libflac/src/libFLAC/metadata_object.c +++ b/3rdparty/libflac/src/libFLAC/metadata_object.c @@ -29,7 +29,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif diff --git a/3rdparty/libflac/src/libFLAC/ogg_decoder_aspect.c b/3rdparty/libflac/src/libFLAC/ogg_decoder_aspect.c index 6974de3061f..945b2c3c0d8 100644 --- a/3rdparty/libflac/src/libFLAC/ogg_decoder_aspect.c +++ b/3rdparty/libflac/src/libFLAC/ogg_decoder_aspect.c @@ -29,7 +29,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif diff --git a/3rdparty/libflac/src/libFLAC/ogg_encoder_aspect.c b/3rdparty/libflac/src/libFLAC/ogg_encoder_aspect.c index 37df089357a..a9928c3d6e1 100644 --- a/3rdparty/libflac/src/libFLAC/ogg_encoder_aspect.c +++ b/3rdparty/libflac/src/libFLAC/ogg_encoder_aspect.c @@ -29,7 +29,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif diff --git a/3rdparty/libflac/src/libFLAC/ogg_helper.c b/3rdparty/libflac/src/libFLAC/ogg_helper.c index 73f9f0bee13..f406777e047 100644 --- a/3rdparty/libflac/src/libFLAC/ogg_helper.c +++ b/3rdparty/libflac/src/libFLAC/ogg_helper.c @@ -29,7 +29,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif diff --git a/3rdparty/libflac/src/libFLAC/ogg_mapping.c b/3rdparty/libflac/src/libFLAC/ogg_mapping.c index a5188926721..cd87197cb17 100644 --- a/3rdparty/libflac/src/libFLAC/ogg_mapping.c +++ b/3rdparty/libflac/src/libFLAC/ogg_mapping.c @@ -29,7 +29,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif diff --git a/3rdparty/libflac/src/libFLAC/stream_decoder.c b/3rdparty/libflac/src/libFLAC/stream_decoder.c index 4d86fdaf3b7..198d5dcc883 100644 --- a/3rdparty/libflac/src/libFLAC/stream_decoder.c +++ b/3rdparty/libflac/src/libFLAC/stream_decoder.c @@ -29,7 +29,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif @@ -46,9 +46,11 @@ #include /* for memset/memcpy() */ #include /* for stat() */ #include /* for off_t */ -#if defined _MSC_VER || defined __BORLANDC__ || defined __MINGW32__ -#if _MSC_VER <= 1600 || defined __BORLANDC__ /* @@@ [2G limit] */ +#if defined _MSC_VER || defined __BORLANDC__ || defined __MINGW32__ /* @@@ [2G limit] */ +#ifndef fseeko #define fseeko fseek +#endif +#ifndef ftello #define ftello ftell #endif #endif @@ -1467,6 +1469,7 @@ FLAC__bool read_metadata_(FLAC__StreamDecoder *decoder) block.is_last = is_last; block.type = (FLAC__MetadataType)type; block.length = length; + memset(&block.data, 0, sizeof(block.data)); if(type == FLAC__METADATA_TYPE_APPLICATION) { if(!FLAC__bitreader_read_byte_block_aligned_no_crc(decoder->private_->input, block.data.application.id, FLAC__STREAM_METADATA_APPLICATION_ID_LEN/8)) diff --git a/3rdparty/libflac/src/libFLAC/stream_encoder.c b/3rdparty/libflac/src/libFLAC/stream_encoder.c index 6d9859c9e2b..afc79850096 100644 --- a/3rdparty/libflac/src/libFLAC/stream_encoder.c +++ b/3rdparty/libflac/src/libFLAC/stream_encoder.c @@ -29,7 +29,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif @@ -46,9 +46,11 @@ #include /* for malloc() */ #include /* for memcpy() */ #include /* for off_t */ -#if defined _MSC_VER || defined __BORLANDC__ || defined __MINGW32__ -#if _MSC_VER <= 1600 || defined __BORLANDC__ /* @@@ [2G limit] */ +#if defined _MSC_VER || defined __BORLANDC__ || defined __MINGW32__ /* @@@ [2G limit] */ +#ifndef fseeko #define fseeko fseek +#endif +#ifndef ftello #define ftello ftell #endif #endif @@ -3750,9 +3752,9 @@ unsigned find_best_partition_order_( /* save best parameters and raw_bits */ FLAC__format_entropy_coding_method_partitioned_rice_contents_ensure_size(prc, max(6, best_partition_order)); - memcpy(prc->parameters, private_->partitioned_rice_contents_extra[best_parameters_index].parameters, sizeof(unsigned)*(1<<(best_partition_order))); + memcpy(prc->parameters, private_->partitioned_rice_contents_extra[best_parameters_index].parameters, sizeof(unsigned)*((unsigned long long)1<<(best_partition_order))); if(do_escape_coding) - memcpy(prc->raw_bits, private_->partitioned_rice_contents_extra[best_parameters_index].raw_bits, sizeof(unsigned)*(1<<(best_partition_order))); + memcpy(prc->raw_bits, private_->partitioned_rice_contents_extra[best_parameters_index].raw_bits, sizeof(unsigned)*((unsigned long long)1<<(best_partition_order))); /* * Now need to check if the type should be changed to * FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2 based on the diff --git a/3rdparty/libflac/src/libFLAC/stream_encoder_framing.c b/3rdparty/libflac/src/libFLAC/stream_encoder_framing.c index 939955bf2d6..621b34c8228 100644 --- a/3rdparty/libflac/src/libFLAC/stream_encoder_framing.c +++ b/3rdparty/libflac/src/libFLAC/stream_encoder_framing.c @@ -29,7 +29,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif diff --git a/3rdparty/libflac/src/libFLAC/window.c b/3rdparty/libflac/src/libFLAC/window.c index cd689c573d4..b35c72efeac 100644 --- a/3rdparty/libflac/src/libFLAC/window.c +++ b/3rdparty/libflac/src/libFLAC/window.c @@ -29,7 +29,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif diff --git a/src/lib/lib.mak b/src/lib/lib.mak index de71181e897..497c027ab47 100644 --- a/src/lib/lib.mak +++ b/src/lib/lib.mak @@ -399,7 +399,7 @@ $(OBJ)/libflac.a: $(LIBFLACOBJS) $(LIBOBJ)/libflac/%.o: $(3RDPARTY)/libflac/src/libFLAC/%.c | $(OSPREBUILD) @echo Compiling $<... - $(CC) $(CDEFS) $(CONLYFLAGS) $(CCOMFLAGS) $(FLACOPTS) -I$(LIBSRC)/libflac/include -I$(LIBSRC)/libflac/libFLAC/include -c $< -o $@ + $(CC) $(CDEFS) $(CONLYFLAGS) $(CCOMFLAGS) $(FLACOPTS) -I$(3RDPARTY)/libflac/include -I$(3RDPARTY)/libflac/src/libFLAC/include -c $< -o $@ -- cgit v1.2.3