2 years agolibFLAC/cpu.c: Improve logic
Erik de Castro Lopo [Tue, 6 Dec 2016 08:37:52 +0000 (19:37 +1100)]
libFLAC/cpu.c: Improve logic

Only call `FLAC__cpu_have_cpuid_asm_ia32` if `FLAC__HAS_NASM` is

Patch-from: "lvqcl.mail" <lvqcl.mail@gmail.com>

2 years agoUpdate version in MSVS project files
Erik de Castro Lopo [Mon, 5 Dec 2016 08:35:53 +0000 (19:35 +1100)]
Update version in MSVS project files

2 years agoAnother bulk update of copyright dates
Erik de Castro Lopo [Mon, 5 Dec 2016 07:57:47 +0000 (18:57 +1100)]
Another bulk update of copyright dates

2 years agodoc/html/changelog.html: Update for 1.3.2 release
Erik de Castro Lopo [Sun, 4 Dec 2016 19:49:59 +0000 (06:49 +1100)]
doc/html/changelog.html: Update for 1.3.2 release

2 years agoBulk update copyright dates
Erik de Castro Lopo [Sun, 4 Dec 2016 19:35:39 +0000 (06:35 +1100)]
Bulk update copyright dates

2 years agoconfigure.ac: Fix description of --disable-sse
Erik de Castro Lopo [Sun, 4 Dec 2016 18:37:44 +0000 (05:37 +1100)]
configure.ac: Fix description of --disable-sse

2 years agoconfigure.ac: Remove unused config flags
Erik de Castro Lopo [Sun, 4 Dec 2016 18:33:51 +0000 (05:33 +1100)]
configure.ac: Remove unused config flags


Patch-from: "lvqcl.mail" <lvqcl.mail@gmail.com>

2 years agovcxproj: Remove unused config flags
Erik de Castro Lopo [Sun, 4 Dec 2016 18:31:24 +0000 (05:31 +1100)]
vcxproj: Remove unused config flags

Specifically, FLAC__NO_SSE_OS and FLAC__SSE_OS.

Patch-from: "lvqcl.mail" <lvqcl.mail@gmail.com>

2 years agolibFLAC/cpu.c: Whitespace fixes
Erik de Castro Lopo [Sun, 4 Dec 2016 06:41:40 +0000 (17:41 +1100)]
libFLAC/cpu.c: Whitespace fixes

Patch-from : lvqcl.mail <lvqcl.mail@gmail.com>

2 years agolibFLAC/cpu.c: Remove OS SSE detection
Erik de Castro Lopo [Sun, 4 Dec 2016 06:36:58 +0000 (17:36 +1100)]
libFLAC/cpu.c: Remove OS SSE detection

Assume that all OSes that are usable today support SSE.

Patch-from: lvqcl.mail <lvqcl.mail@gmail.com>

2 years agosrc/share/grabbag/seektable.c: Fix typo inside assert
Erik de Castro Lopo [Fri, 2 Dec 2016 07:02:50 +0000 (18:02 +1100)]
src/share/grabbag/seektable.c: Fix typo inside assert

Patch-from: "lvqcl.mail" <lvqcl.mail@gmail.com>

2 years agoCorrect additional 'MEATADATA' typos.
Ralph Giles [Thu, 27 Oct 2016 15:47:09 +0000 (08:47 -0700)]
Correct additional 'MEATADATA' typos.

Thanks to Matthew Gregan for the report.

Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
2 years agoFlac-in-mp4 draft v0.0.3.
Ralph Giles [Tue, 4 Oct 2016 16:46:26 +0000 (09:46 -0700)]
Flac-in-mp4 draft v0.0.3.

Draft updates in response to feedback from Yusuke Nakamura.

Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
2 years agoFlac-in-mp4 draft v0.0.2.
Ralph Giles [Tue, 4 Oct 2016 15:49:09 +0000 (08:49 -0700)]
Flac-in-mp4 draft v0.0.2.

Draft updates in response to feedback from David Evans.

Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
2 years agoFlac-in-mp4 draft v0.0.1.
Ralph Giles [Tue, 4 Oct 2016 15:46:00 +0000 (08:46 -0700)]
Flac-in-mp4 draft v0.0.1.

Draft updates in response to feedback from Timothy B. Terriberry
and Jean-Yves Avenard.

Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
2 years agoFlac-in-mp4 draft v0.0.0.
Ralph Giles [Tue, 4 Oct 2016 15:41:07 +0000 (08:41 -0700)]
Flac-in-mp4 draft v0.0.0.

We've been working on a draft spec for encapsulation of FLAC
in the ISO Base Media File Format (mp4). This is the initial
draft created by Monty Montgomery based on Yusuke Nakamura's
Opus-in-mp4 draft.

More details at https://bugzilla.mozilla.org/show_bug.cgi?id=1286097

Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
2 years agocpu.c: Really fix compiler warnings
Erik de Castro Lopo [Mon, 12 Sep 2016 07:27:03 +0000 (17:27 +1000)]
cpu.c: Really fix compiler warnings

2 years agocpu.c: Fix compiler warning on PowerPC
Erik de Castro Lopo [Sun, 11 Sep 2016 03:35:46 +0000 (13:35 +1000)]
cpu.c: Fix compiler warning on PowerPC

2 years agoFix compiler warning from gcc-6.1.1
Erik de Castro Lopo [Thu, 8 Sep 2016 10:39:16 +0000 (20:39 +1000)]
Fix compiler warning from gcc-6.1.1

3 years agostream_decoder: reset has_seek_table before read_metadata_seektable_()
Max Kellermann [Thu, 14 Jul 2016 08:22:43 +0000 (10:22 +0200)]
stream_decoder: reset has_seek_table before read_metadata_seektable_()

If a seek table has already been read successfully, then the
has_seek_table flag is true.  Now imagine the file comes with another
seek table, which doesn't make sense, but libFLAC accepts it happily.
If reading this second seek table fails (for example allocation
failure), read_metadata_seektable_() returns false, but the
has_seek_table flag is still true.  If the calling application happens
to ignore this failure, and at some point tries to seek, the process
will crash due to NULL pointer dereference.  This would sure be an
application bug that needs to be fixed, but libFLAC's internal state
is inconsistent, so let's fix this up.

Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
3 years agostream_decoder: fix memory leak after seek table read error
Max Kellermann [Thu, 14 Jul 2016 08:06:23 +0000 (10:06 +0200)]
stream_decoder: fix memory leak after seek table read error

When read_metadata_seektable_() fails, the has_seek_table flag is
never set to true, and thus free() is never called.

Example valgrind output:

 11,185,464 bytes in 1 blocks are definitely lost in loss record 62 of 62
    at 0x4C2BC0F: malloc (vg_replace_malloc.c:299)
    by 0x4C2DE6F: realloc (vg_replace_malloc.c:785)
    by 0x40A7880: safe_realloc_ (alloc.h:159)
    by 0x40A7911: safe_realloc_mul_2op_ (alloc.h:205)
    by 0x40AB6B5: read_metadata_seektable_ (stream_decoder.c:1654)
    by 0x40AAB2D: read_metadata_ (stream_decoder.c:1422)
    by 0x40A9C79: FLAC__stream_decoder_process_until_end_of_metadata (stream_decoder.c:1055)

It is easy to craft a FLAC file which leaks megabytes of memory on
every attempt to open the file.

This patch fixes the problem by removing checks which are unnecessary
(and harmful).  Checking the has_seek_table flag is not enough, as
described above.  The NULL check is not harmful, but is not helpful
either, because free(NULL) is documented to be legal.

After running this code block, we're in a well-known safe state, no
matter how inconsistent pointer and flag may have been before, for
whatever reasons.

Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
3 years agolibFLAC: Fix cpuid detecton on old Cyrix CPUs
Erik de Castro Lopo [Wed, 13 Jul 2016 09:45:53 +0000 (19:45 +1000)]
libFLAC: Fix cpuid detecton on old Cyrix CPUs

Some old CPUs (eg Cyrix) set EDX but not ECX when executing CPUID.
One of the solutions is to clear ECX before calling cpuid. From
https://bugzilla.mozilla.org/show_bug.cgi?id=1096651#c9 bug

Patch-from: lvqcl <lvqcl.mail@gmail.com>

3 years agolibFLAC: Set decoding status if write callback failed
Erik de Castro Lopo [Wed, 13 Jul 2016 09:41:14 +0000 (19:41 +1000)]
libFLAC: Set decoding status if write callback failed

Previously, it the write callback failed the error status
would be set to `FLAC__STREAM_DECODER_READ_FRAME`. Now it

Patch-from: lvqcl <lvqcl.mail@gmail.com>

3 years agolibFLAC/metadata_object.c: Clean up
Erik de Castro Lopo [Sun, 10 Jul 2016 06:12:32 +0000 (16:12 +1000)]
libFLAC/metadata_object.c: Clean up

* Remove Yoda conditionals.
* Drop some un-needed asserts.

3 years agometadata_object.c: Remove un-needed asserts
Erik de Castro Lopo [Sun, 10 Jul 2016 01:18:34 +0000 (11:18 +1000)]
metadata_object.c: Remove un-needed asserts

These asserts were being triggered by AFL (American Fuzzy Lop) and
serve seemingly no useful purpose. The are only enabled in debug builds
where they abort the program which is otherwise in a safe state.

Removing these asserts will potentially allow AFL to turn up other
problems elsewhere.

3 years agostream_decoder: fix integer underflow due to malformed wasted_bits
Max Kellermann [Fri, 8 Jul 2016 19:29:41 +0000 (21:29 +0200)]
stream_decoder: fix integer underflow due to malformed wasted_bits

It is pretty easy for a malformed FLAC file to underflow the "bps"
variable.  In the debug build, this results in an assertion failure in

    FLAC__ASSERT(bits <= 32);

In non-debug builds, this simply makes
FLAC__bitreader_read_raw_uint32() fail because
bitreader_read_from_client_() doesn't find enough buffer space for
2**32-1 bits.  But since the failing FLAC_ASSERT() is reasonable, this
should be caught in the FLAC__bitreader_read_raw_uint32() caller.

Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
Closes: https://github.com/xiph/flac/pull/13

3 years agostream_decoder: check state==ABORTED after process_single() for seek
Max Kellermann [Wed, 6 Jul 2016 14:28:53 +0000 (16:28 +0200)]
stream_decoder: check state==ABORTED after process_single() for seek

FLAC__stream_decoder_process_single() ignores frame_sync_() errors,
which means the caller cannot rely solely on the boolean return value,
it is also required to check the new "state".

After FLAC__stream_decoder_process_until_end_of_metadata(),
last_frame.header.number_type==FRAME_NUMBER.  When an application
seeks at this time, but an I/O error occurs, then
FLAC__stream_decoder_process_single() returns true, but no frame has
been read yet, i.e. last_frame.header.number_type is still
FRAME_NUMBER.  This triggers the assertion in

 FLAC__ASSERT(decoder->private_->last_frame.header.number_type == FLAC__FRAME_NUMBER_TYPE_SAMPLE_NUMBER);

So what needs to be done is check for state==ABORTED after the
FLAC__stream_decoder_process_single() call.

This bug can be triggered remotely with the Music Player Daemon
(https://www.musicpd.org/), and crashes the process.

Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
Closes: https://github.com/xiph/flac/pull/12

3 years agoflac++.pc.in: Make flac a private requires
Erik de Castro Lopo [Sat, 9 Jul 2016 11:55:07 +0000 (21:55 +1000)]
flac++.pc.in: Make flac a private requires

Patch pulled from Debian package.

Chain::Status::as_cstring uses FLAC__Metadata_ChainStatusString which
is in libFLAC. Since the function is inline, every program calling
this function must also link with -lflac, but this is missing in

Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=713645

3 years agolibFLAC/cpu.c: Fix dfprintf macro for MSVS
Erik de Castro Lopo [Thu, 30 Jun 2016 20:41:18 +0000 (06:41 +1000)]
libFLAC/cpu.c: Fix dfprintf macro for MSVS

3 years agolibFLAC/cpu.c: Add parens to avoid compiler warnings
Erik de Castro Lopo [Mon, 27 Jun 2016 21:12:42 +0000 (07:12 +1000)]
libFLAC/cpu.c: Add parens to avoid compiler warnings

3 years agolibFLAC/cpu.c: Inline *_disable_avx()
Julian Calaby [Mon, 27 Jun 2016 13:22:20 +0000 (23:22 +1000)]
libFLAC/cpu.c: Inline *_disable_avx()

Also only print out OS AVX status if AVX is actually enabled.

3 years agolibFLAC/cpu.c: Move cpu_id_ex into cpu_info_x86()
Julian Calaby [Mon, 27 Jun 2016 12:41:13 +0000 (22:41 +1000)]
libFLAC/cpu.c: Move cpu_id_ex into cpu_info_x86()

This simplifies the C code without complexifying the preprocessor

3 years agolibFLAC/cpu.c: Eliminate a branch in cpu_info_x86
Julian Calaby [Mon, 27 Jun 2016 12:37:45 +0000 (22:37 +1000)]
libFLAC/cpu.c: Eliminate a branch in cpu_info_x86

Inverting all the if statements allows us to move the common code of
setting all the registers to zero outside the #if statement.

3 years agolibFLAC/cpu.c: Remove a layer of cpp conditionals
Julian Calaby [Mon, 27 Jun 2016 12:17:03 +0000 (22:17 +1000)]
libFLAC/cpu.c: Remove a layer of cpp conditionals

3 years agolibFLAC/cpu.c: Drop some unnecessary returns
Julian Calaby [Mon, 27 Jun 2016 12:15:31 +0000 (22:15 +1000)]
libFLAC/cpu.c: Drop some unnecessary returns

3 years agolibFLAC/cpu.c: Get rid of OS_IS_ANDROID function
Julian Calaby [Mon, 27 Jun 2016 12:13:30 +0000 (22:13 +1000)]
libFLAC/cpu.c: Get rid of OS_IS_ANDROID function

3 years agolibFLAC/cpu.c: Move stdio.h include under DEBUG
Julian Calaby [Mon, 27 Jun 2016 12:10:47 +0000 (22:10 +1000)]
libFLAC/cpu.c: Move stdio.h include under DEBUG

3 years agolibFLAC/cpu.c: Use a dummy function for debugging
Julian Calaby [Mon, 27 Jun 2016 12:08:51 +0000 (22:08 +1000)]
libFLAC/cpu.c: Use a dummy function for debugging

This saves 5 if statements that would have had to have been
optimised away.

3 years agolibFLAC/cpu.c: More MSVC fixes
Erik de Castro Lopo [Sun, 26 Jun 2016 19:09:07 +0000 (05:09 +1000)]
libFLAC/cpu.c: More MSVC fixes

With help from lvqcl <lvqcl.mail@gmail.com>

3 years agolibFLAC/cpu.c: Fixes for MSVC
Erik de Castro Lopo [Sun, 26 Jun 2016 11:09:08 +0000 (21:09 +1000)]
libFLAC/cpu.c: Fixes for MSVC

MSVC is strange and perverse.

3 years agolibFLAC/cpu.c: Fix build on non-Intel CPUs
Erik de Castro Lopo [Sun, 26 Jun 2016 07:28:27 +0000 (17:28 +1000)]
libFLAC/cpu.c: Fix build on non-Intel CPUs

3 years agolibFLAC/cpu.c: More cleanup and refactoring
Erik de Castro Lopo [Sun, 26 Jun 2016 02:59:11 +0000 (12:59 +1000)]
libFLAC/cpu.c: More cleanup and refactoring

* Split `FLAC__cpu_info` into CPU specific functions. We now have
  `ia32_cpi_info` and `x86_64_cpu_info` and a simple obvious way
  to add support for other CPUs.
* Improve handling of Android OS.
* Remove more #ifdefs where possible.
* Compile (syntax and type check) DEBUG output code even when debugging
  is disabled.
* Remove build support for ancient NetBSD version 1.5 (version 1.6 was
  released in 2002).

3 years agolibFLAC/cpu.[ch]: More pre-processor cleanups
Erik de Castro Lopo [Sun, 26 Jun 2016 01:32:06 +0000 (11:32 +1000)]
libFLAC/cpu.[ch]: More pre-processor cleanups

3 years agolibFLAC/cpu.c: More refactoring and cleanups
Erik de Castro Lopo [Sun, 26 Jun 2016 00:39:18 +0000 (10:39 +1000)]
libFLAC/cpu.c: More refactoring and cleanups

* Make `FLAC__cpu_xgetbv_x86` private to cpu.c (and rename it to
  `cpu_xgetbv_x86` (it wasn't being used anywhere else).
* Remove `FLAC__cpu_have_cpuid_x86` altogether as it wasn't actually
  being used but that was difficult to tell because of all the #ifdef

3 years agolibFLAC/cpu.c: More pre-processor cleanups
Erik de Castro Lopo [Sat, 25 Jun 2016 07:02:06 +0000 (17:02 +1000)]
libFLAC/cpu.c: More pre-processor cleanups

3 years agoFix use of FLAC__HAS_X86INTRIN configure variable
Erik de Castro Lopo [Mon, 20 Jun 2016 10:29:59 +0000 (20:29 +1000)]
Fix use of FLAC__HAS_X86INTRIN configure variable

3 years agoFix use of FLAC__SSE_OS configure variable
Erik de Castro Lopo [Sun, 19 Jun 2016 11:51:31 +0000 (21:51 +1000)]
Fix use of FLAC__SSE_OS configure variable

3 years agoFix nasm compile on OS X / Darwin
Erik de Castro Lopo [Mon, 13 Jun 2016 20:27:24 +0000 (06:27 +1000)]
Fix nasm compile on OS X / Darwin

Apparently this had been fixes in Audacity and other projects
but no one had bothered to feed them back upstream. Thanks to
lvqcl for researching this and finding the relevant patches.
Thanks to Ozkan Sezer for validating them.

Closes:  https://sourceforge.net/p/flac/bugs/438/

3 years agolibFLAC: More metadata_iterators fixes
Erik de Castro Lopo [Sun, 22 May 2016 01:06:29 +0000 (11:06 +1000)]
libFLAC: More metadata_iterators fixes

The previous fixes for metadata_iterators didn't completely fix the problem.

The behavior of chain_prepare_for_write_() must always be the same as the
behavior of FLAC__metadata_chain_check_if_tempfile_needed(). Before this
fix, one check was missing in FLAC__metadata_chain_check_if_tempfile_needed(),
and also chain_prepare_for_write_() checked the sizes of the metadata blocks
*after* making the changes to the chain, while
FLAC__metadata_chain_check_if_tempfile_needed() does it *before* the changes.

This patch changes FLAC__metadata_chain_check_if_tempfile_needed() so that it
keeps some info (lbs_state, lbs_size) about estimated changes and then uses
it to check the block sizes.

It also simplifies FLAC__metadata_chain_check_if_tempfile_needed() a little.

Patch-from: lvqcl <lvqcl.mail@gmail.com>

3 years agotest/Makefile.lite: Remove call to old script
Erik de Castro Lopo [Thu, 12 May 2016 20:45:54 +0000 (06:45 +1000)]
test/Makefile.lite: Remove call to old script

3 years agoMakefile.lite: Improved solution to CFLAGS from environment
Erik de Castro Lopo [Wed, 11 May 2016 20:33:22 +0000 (06:33 +1000)]
Makefile.lite: Improved solution to CFLAGS from environment

3 years agoMakefile.lite: Pick up `CFLAGS` from the environment
Erik de Castro Lopo [Thu, 12 May 2016 08:13:22 +0000 (18:13 +1000)]
Makefile.lite: Pick up `CFLAGS` from the environment

This allows extra CFLAGS to be set on the command line. Eg

     CFLAGS=Werror make -f Makefile.lite

3 years agolibFLAC: infer cpu type from compiler macros
Tim Blechmann [Wed, 11 May 2016 12:05:49 +0000 (14:05 +0200)]
libFLAC: infer cpu type from compiler macros

Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
3 years agotest_libFLAC++: Fix memory leaks
Erik de Castro Lopo [Sun, 8 May 2016 07:28:56 +0000 (17:28 +1000)]
test_libFLAC++: Fix memory leaks

Memory leaks found using `cppcheck`.

3 years agolibFLAC: Add a workaround for a bug in MSVC2105 update2
Erik de Castro Lopo [Thu, 5 May 2016 07:21:20 +0000 (17:21 +1000)]
libFLAC: Add a workaround for a bug in MSVC2105 update2

MSVC2105 update2 compiles the C code:

    abs_residual_partition_sums[partition] =

into this:

    movq    QWORD PTR [rsi], xmm2

while it should be:

    movd    eax, xmm2
    mov     QWORD PTR [rsi], rax

With this patch, MSVC emits:

    movq    QWORD PTR [rsi], xmm2
    mov     DWORD PTR [rsi+4], r9d

so the price of this workaround is 1 extra write instruction per

Patch-from: lvqcl <lvqcl.mail@gmail.com>

3 years agometadata_iterators.c: Limit padding size
Erik de Castro Lopo [Sun, 1 May 2016 10:57:15 +0000 (20:57 +1000)]
metadata_iterators.c: Limit padding size

Without this fix, its possible for libFLAC to create an oversized
padding metadata block when:

a) it merges existing padding blocks

b) it expands padding block during metadata changes

resulting in a corrupt FLAC file.

Patch-from: lvqcl <lvqcl.mail@gmail.com>

3 years agoWindows/MSVC: Add ENABLE_64_BIT_WORDS macro
Erik de Castro Lopo [Sun, 1 May 2016 10:55:10 +0000 (20:55 +1000)]
Windows/MSVC: Add ENABLE_64_BIT_WORDS macro

Allow setting of ENABLE_64_BIT_WORDS preprocessor variable for
libFLAC_dynamic, libFLAC_static and test_libFLAC projects and x64

Patch-from: lvqcl <lvqcl.mail@gmail.com>

3 years agobitwrite.c: Tweaks
Erik de Castro Lopo [Sun, 1 May 2016 10:40:24 +0000 (20:40 +1000)]
bitwrite.c: Tweaks

* Removes unused FLAC__WORD_ALL_ONES definition.
* Add comment that unused bits of accumulator can contain garbage.
* Turn assert inside FLAC__bitwriter_write_utf8_uint32 into runtime
  check (similar to FLAC__bitwriter_write_utf8_uint64() function).

Patch-from: lvqcl <lvqcl.mail@gmail.com>

3 years agolibFLAC: Add metadata size checks to FLAC library
Erik de Castro Lopo [Sun, 1 May 2016 10:34:26 +0000 (20:34 +1000)]
libFLAC: Add metadata size checks to FLAC library

This follows on from the previous patch.

Patch-from: lvqcl <lvqcl.mail@gmail.com>

3 years agoflac/metaflac: Limit the size of metadata blocks
Erik de Castro Lopo [Sun, 1 May 2016 10:30:37 +0000 (20:30 +1000)]
flac/metaflac: Limit the size of metadata blocks

Limit allow image file size to slightly less than 2^24 bytes so that
the file size plus extra house keeping data is strictly less that
2^24 bytes in size.

Patch-from: lvqcl <lvqcl.mail@gmail.com>

3 years agoFix 'make distcheck' target
Erik de Castro Lopo [Wed, 27 Apr 2016 00:19:45 +0000 (10:19 +1000)]
Fix 'make distcheck' target

Last commit added a new file which was not added to `EXTRA_DIST`.

3 years agocuesheet.c: Allow quotes around ISRC field
Erik de Castro Lopo [Tue, 26 Apr 2016 07:55:36 +0000 (17:55 +1000)]
cuesheet.c: Allow quotes around ISRC field

With this change, flac now accepts cuesheets where the ISRC field is
enclosed in double quotes. Added a test for this as well.

Closes: https://sourceforge.net/p/flac/bugs/436/

3 years agolibFLAC/stream_decoder.c: Fix typo
Erik de Castro Lopo [Sun, 20 Mar 2016 09:42:27 +0000 (20:42 +1100)]
libFLAC/stream_decoder.c: Fix typo

Introduced in 1be4f9537e.

3 years agoconfigure.ac: Force FLAC__HAS_OGG to 0 or 1
Erik de Castro Lopo [Sun, 20 Mar 2016 09:14:01 +0000 (20:14 +1100)]
configure.ac: Force FLAC__HAS_OGG to 0 or 1

3 years agolibFLAC: Reduce FLAC__HAS_OGG #ifdef crud
Erik de Castro Lopo [Sun, 20 Mar 2016 08:28:41 +0000 (19:28 +1100)]
libFLAC: Reduce FLAC__HAS_OGG #ifdef crud

3 years agolibFLAC/stream_decoder.c: Fix compiling with integer only
Erik de Castro Lopo [Sun, 20 Mar 2016 06:49:39 +0000 (17:49 +1100)]
libFLAC/stream_decoder.c: Fix compiling with integer only

Was failing to compile on IA32 with FLAC__INTEGER_ONLY_LIBRARY

Reported-by: "Joakim Landberg" <joakim.landberg@intel.com>
3 years agostream_decoder.c: Set obj->num_comments before return
Erik de Castro Lopo [Sun, 20 Mar 2016 04:49:21 +0000 (15:49 +1100)]
stream_decoder.c: Set obj->num_comments before return

Make sure obj-num_comments gets set on failure conditions.

Patch-from: Robert Shih <robertshih@google.com>

3 years agolibFLAC/cpu.c: Use `sigemptyset` instead of `__sigemptyset`
Erik de Castro Lopo [Mon, 14 Mar 2016 07:14:31 +0000 (18:14 +1100)]
libFLAC/cpu.c: Use `sigemptyset` instead of `__sigemptyset`

The former is POSIX while the later is a GNU glibc-ism that does not
exist in (for example) the Musl C library that is used in OpenWrt.

Reported-by: <neheb@hushmail.com>
3 years agoAnother Windows build fix
Erik de Castro Lopo [Thu, 11 Feb 2016 06:52:42 +0000 (17:52 +1100)]
Another Windows build fix

Patch-from: lvqcl <lvqcl.mail@gmail.com>

3 years agotest/: Remove two redundant scripts
Erik de Castro Lopo [Thu, 11 Feb 2016 06:50:10 +0000 (17:50 +1100)]
test/: Remove two redundant scripts

* test_bin.sh looks like it was a personal use script for the original
  developer Josh Coalson and referenced directories outside the actual
* test_wrapper.sh was trivial and un-used.

3 years agoFix autotool warnings
Erik de Castro Lopo [Wed, 10 Feb 2016 10:24:41 +0000 (21:24 +1100)]
Fix autotool warnings

3 years agomicrobench: Add fallback to gettimeofday()
Dave Yeo [Wed, 3 Feb 2016 04:19:59 +0000 (20:19 -0800)]
microbench: Add fallback to gettimeofday()

Some operating systems such as OS/2 don't have any of the CLOCK* API
functions so add gettimeofday() as a fallback.

Signed-off-by: Dave Yeo <dave.r.yeo@gmail.com>
Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
3 years agoMore Windows fixes
Erik de Castro Lopo [Tue, 9 Feb 2016 05:56:32 +0000 (16:56 +1100)]
More Windows fixes

These fixes got lost in an earlier commit.

Patch-from: lvqcl <lvqcl.mail@gmail.com>

3 years agoMore `make distcheck` fixes
Erik de Castro Lopo [Tue, 9 Feb 2016 05:47:30 +0000 (16:47 +1100)]
More `make distcheck` fixes

* Add two missing files to repo.
* Add files to Makefile.am `EXTRA_DIST` list.

3 years agotest_libFLAC: Fix `make distcheck` target
Erik de Castro Lopo [Mon, 8 Feb 2016 20:01:29 +0000 (07:01 +1100)]
test_libFLAC: Fix `make distcheck` target

3 years agoRetire FLAC__float and FLAC__double types
Thomas Zander [Mon, 8 Feb 2016 09:43:37 +0000 (10:43 +0100)]
Retire FLAC__float and FLAC__double types

Usage of internal aliases for float and double do not provide
substantial value. For integer-only libs, the macro
FLAC__INTEGER_ONLY_LIBRARY is used in the appropriate places

Also, adapt copyright messages to include 2016.

Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
Closes: https://github.com/xiph/flac/pull/10

3 years agoMake AVX and AVX2 instructions a configure option
Dave Yeo [Mon, 25 Jan 2016 06:09:50 +0000 (22:09 -0800)]
Make AVX and AVX2 instructions a configure option

Handy for toolchains or operating systems that don't support AVX or AVX2
like OS/2.

Signed-off-by: Dave Yeo <dave.r.yeo@gmail.com>
Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
3 years agolibFLAC: Remove win_utf8_io dependency
Erik de Castro Lopo [Fri, 5 Feb 2016 00:02:44 +0000 (11:02 +1100)]
libFLAC: Remove win_utf8_io dependency

Path-from: lvqcl <lvqcl.mail@gmail.com>

3 years agosrc/share/utf8/utf8.c: Windows API usage fixes
Erik de Castro Lopo [Thu, 4 Feb 2016 02:42:33 +0000 (13:42 +1100)]
src/share/utf8/utf8.c: Windows API usage fixes

Patch-from: <lvqcl.mail@gmail.com>

3 years agoRemove src/share/utf8/Makefile.am
Erik de Castro Lopo [Tue, 2 Feb 2016 23:41:53 +0000 (10:41 +1100)]
Remove src/share/utf8/Makefile.am

This file was redundant.

Patch-from: lvqcl <lvqcl.mail@gmail.com>

3 years agowin_utf8_io: Fix compile error
Erik de Castro Lopo [Mon, 1 Feb 2016 22:33:12 +0000 (09:33 +1100)]
win_utf8_io: Fix compile error

The function `set_filename_utf8` was defined as static, but the
prototype was missing `static`.

3 years agotest_streams: Use fopen instead of flac_fopen
Erik de Castro Lopo [Mon, 1 Feb 2016 22:19:58 +0000 (09:19 +1100)]
test_streams: Use fopen instead of flac_fopen

test_streams doesn't create/open files with non-ascii filenames,
so there's no need in unicode support.

Patch-from: lvqcl <lvqcl.mail@gmail.com>

3 years agoFix debug build for VS2005
Erik de Castro Lopo [Mon, 1 Feb 2016 22:16:31 +0000 (09:16 +1100)]
Fix debug build for VS2005

Patch-from: lvqcl <lvqcl.mail@gmail.com>

3 years agoshare/utf8: Add missing check
Erik de Castro Lopo [Sun, 31 Jan 2016 23:58:47 +0000 (10:58 +1100)]
share/utf8: Add missing check

Patch-from: lvqcl <lvqcl.mail@gmail.com>

3 years agoRefactoring of win_utf8_io
Erik de Castro Lopo [Sun, 31 Jan 2016 01:42:23 +0000 (12:42 +1100)]
Refactoring of win_utf8_io

* Simplifies *print functions.
* Improves file related functions.
* Preparation to move all file related functions into libFLAC.

Patch-from: lvqcl <lvqcl.mail@gmail.com>

3 years agosrc/share/Makefile.am: Fix EXTRA_DIST
Erik de Castro Lopo [Sun, 31 Jan 2016 01:35:53 +0000 (12:35 +1100)]
src/share/Makefile.am: Fix EXTRA_DIST

* Remove reference to deleted file charsetmap.h.
* Move utf8/iconvert.h from EXTRA_DIST to utf8_libutf8_la_SOURCES.

Reported-by: lvqcl <lvqcl.mail@gmail.com>
3 years agolocale_hack.h: Fix comment
Erik de Castro Lopo [Sat, 30 Jan 2016 22:55:15 +0000 (09:55 +1100)]
locale_hack.h: Fix comment

Patch-from: lvqcl <lvqcl.mail@gmail.com>

3 years agoRemove plugin_common library from MSVC build
Erik de Castro Lopo [Sat, 30 Jan 2016 22:51:52 +0000 (09:51 +1100)]
Remove plugin_common library from MSVC build

Previously src/plugin_common library was used by FLAC's own Winamp plugin
(MSVC/Windows) and by the XMMS plugin (*nix). The Winamp plugin is long
gone from FLAC tree, so plugin_common is unused on Windows.

Patch-from: lvqcl <lvqcl.mail@gmail.com>

3 years agoFix dependencies for MSVC
Erik de Castro Lopo [Sat, 30 Jan 2016 22:50:06 +0000 (09:50 +1100)]
Fix dependencies for MSVC

Patch-from: lvqcl <lvqcl.mail@gmail.com>

3 years agoRemove src/share/utf8/charsetmap.h
Erik de Castro Lopo [Sat, 30 Jan 2016 22:47:30 +0000 (09:47 +1100)]
Remove src/share/utf8/charsetmap.h

It was added in 2002 but is not used anywhere.

Reported-by: lvqcl <lvqcl.mail@gmail.com>
3 years agoWindows/MSVC utf8 build fixes
Erik de Castro Lopo [Thu, 28 Jan 2016 20:39:12 +0000 (07:39 +1100)]
Windows/MSVC utf8 build fixes

Files share/utf8/charset.c and share/utf8/iconvert.c aren't needed
under Windows. This patch removes them from MSVC build system.

Patch-from: lvqcl <lvqcl.mail@gmail.com>

3 years agomicrobench/util.c: Fix -Wshadow warning
Erik de Castro Lopo [Tue, 26 Jan 2016 05:20:00 +0000 (16:20 +1100)]
microbench/util.c: Fix -Wshadow warning

3 years agoFix ioctl/TIOCGWINSZ for OSX
Erik de Castro Lopo [Tue, 26 Jan 2016 02:35:10 +0000 (13:35 +1100)]
Fix ioctl/TIOCGWINSZ for OSX

3 years agosrc/flac/utils.c: Fix for OpenBSD
Erik de Castro Lopo [Tue, 26 Jan 2016 01:50:44 +0000 (12:50 +1100)]
src/flac/utils.c: Fix for OpenBSD

OpenBSD defineds `TIOCGWINSZ` in `termios.h` which is already being
included, so this fix should work on most POSIX systems.

Closes: https://sourceforge.net/p/flac/bugs/435/

3 years agoautogen.sh: Improve autoconf/automake detection on OpenBSD
Erik de Castro Lopo [Tue, 26 Jan 2016 01:47:58 +0000 (12:47 +1100)]
autogen.sh: Improve autoconf/automake detection on OpenBSD

OpenBSD needs the enviroment variables `AUTOCONF_VERSION` and
`AUTOMAKE_VERSION` to be set in order to find these tools.

The script now tests (individually) if they are already set and if they
aren't sets them to something that is known to work on OpenBSD 5.8

3 years agoconfigure.ac: Drop -Wunreachable-code from CFLAGS
Erik de Castro Lopo [Tue, 26 Jan 2016 01:33:01 +0000 (12:33 +1100)]
configure.ac: Drop -Wunreachable-code from CFLAGS

According to:


this warning was removed in GCC 4.5.

3 years agoconfigure.ac: Remove redundant `XIPH_ADD_CFLAGS([-Wextra])`
Erik de Castro Lopo [Sun, 24 Jan 2016 23:12:33 +0000 (10:12 +1100)]
configure.ac: Remove redundant `XIPH_ADD_CFLAGS([-Wextra])`

3 years agodoc: specify that quantized LPC shift must be non-negative
Tristan Matthews [Sun, 24 Jan 2016 16:41:50 +0000 (11:41 -0500)]
doc: specify that quantized LPC shift must be non-negative

Refs http://sourceforge.net/p/flac/bugs/424/

Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
3 years agoFix linking of microbenchmark program
Erik de Castro Lopo [Sat, 23 Jan 2016 21:21:23 +0000 (08:21 +1100)]
Fix linking of microbenchmark program

On some setups, benchmark_residual linkage fails with an undefined
reference to clock_gettime(). Adding -lrt fixes that.

Patch-from: Ozkan Sezer <sezeroz@gmail.com>

3 years agolibFLAC/lpc.c: Fix comments
Erik de Castro Lopo [Sat, 23 Jan 2016 21:12:55 +0000 (08:12 +1100)]
libFLAC/lpc.c: Fix comments

Patch-from: lvqcl <lvqcl.mail@gmail.com>