[flac-dev] Fwd: flac 1.3.0pre1 prelease

Erik de Castro Lopo mle+la at mega-nerd.com
Sun Mar 3 13:32:39 PST 2013


Ben Allison wrote:

> There's a more few issues for compiling on MSVC.  I put together a patch.
> 
> Here's a quick rundown:
> * must use __inline keyword with static inline functions (bitmath.h)

If you include "share/compath.h" you will get a inline #defined as __inline
when _MSC_VER is defined. I'd prefer a single diffinition of that in one
place and one place only.

> * change instances of uint32_t in bitwriter.c to FLAC__uint32

Can we include <inttypes.h> to fix this instead?

> * functions marked inline cannot be used within another C file (e.g.
> FLAC__bitreader_get_input_bits_unconsumed produces the linker error "error
> LNK2001: unresolved external symbol
> _FLAC__bitreader_get_input_bits_unconsumed").  This change has performance
> implications!  I'd like someone to review this and possibly come up with a
> better solution.

The solution there is to move the function definition to the header file as
a static inline function


    static inline unsigned FLAC__bitreader_get_input_bits_unconsumed(const FLAC__BitReader *br)
    {
	return (br->words-br->consumed_words)*FLAC__BITS_PER_WORD + br->bytes*8 - br->consumed_bits;
    }

Can you please try that and line me know if it works in MSVC? I know it
works for GCC and Clang as its required for C99.

Erik
-- 
----------------------------------------------------------------------
Erik de Castro Lopo
http://www.mega-nerd.com/


More information about the flac-dev mailing list