Purge usage of `unsigned` type
authorErik de Castro Lopo <erikd@mega-nerd.com>
Sat, 14 Jan 2017 06:26:39 +0000 (17:26 +1100)
committerErik de Castro Lopo <erikd@mega-nerd.com>
Sat, 14 Jan 2017 06:46:02 +0000 (17:46 +1100)
As pointed out by Ozkan Sezer, on some platforms `int32_t` is actually
a typedef for `long` so `unsigned` cannot be used interchangably with
`FLAC__uint32`. Fix is to switch from `unsigned` to explicit sized ISO
C types defined in <stdint.h>.

75 files changed:
src/libFLAC/bitmath.c
src/libFLAC/bitreader.c
src/libFLAC/bitwriter.c
src/libFLAC/cpu.c
src/libFLAC/crc.c
src/libFLAC/fixed.c
src/libFLAC/fixed_intrin_sse2.c
src/libFLAC/fixed_intrin_ssse3.c
src/libFLAC/float.c
src/libFLAC/format.c
src/libFLAC/include/private/bitmath.h
src/libFLAC/include/private/bitreader.h
src/libFLAC/include/private/bitwriter.h
src/libFLAC/include/private/crc.h
src/libFLAC/include/private/fixed.h
src/libFLAC/include/private/float.h
src/libFLAC/include/private/format.h
src/libFLAC/include/private/lpc.h
src/libFLAC/include/private/md5.h
src/libFLAC/include/private/memory.h
src/libFLAC/include/private/ogg_decoder_aspect.h
src/libFLAC/include/private/ogg_encoder_aspect.h
src/libFLAC/include/private/ogg_mapping.h
src/libFLAC/include/private/stream_encoder.h
src/libFLAC/include/private/stream_encoder_framing.h
src/libFLAC/include/protected/stream_decoder.h
src/libFLAC/include/protected/stream_encoder.h
src/libFLAC/lpc.c
src/libFLAC/lpc_intrin_avx2.c
src/libFLAC/lpc_intrin_sse.c
src/libFLAC/lpc_intrin_sse2.c
src/libFLAC/lpc_intrin_sse41.c
src/libFLAC/md5.c
src/libFLAC/memory.c
src/libFLAC/metadata_iterators.c
src/libFLAC/metadata_object.c
src/libFLAC/ogg_decoder_aspect.c
src/libFLAC/ogg_encoder_aspect.c
src/libFLAC/ogg_helper.c
src/libFLAC/ogg_mapping.c
src/libFLAC/stream_decoder.c
src/libFLAC/stream_encoder.c
src/libFLAC/stream_encoder_framing.c
src/libFLAC/stream_encoder_intrin_avx2.c
src/libFLAC/stream_encoder_intrin_sse2.c
src/libFLAC/stream_encoder_intrin_ssse3.c
src/plugin_common/dither.c
src/plugin_common/dither.h
src/plugin_common/tags.c
src/plugin_xmms/fileinfo.c
src/plugin_xmms/http.c
src/plugin_xmms/plugin.c
src/share/getopt/getopt.c
src/share/grabbag/cuesheet.c
src/share/grabbag/picture.c
src/share/grabbag/replaygain.c
src/share/grabbag/seektable.c
src/share/replaygain_analysis/replaygain_analysis.c
src/share/replaygain_synthesis/replaygain_synthesis.c
src/share/utf8/charmaps.h
src/share/utf8/charset.c
src/share/utf8/makemap.c
src/test_grabbag/cuesheet/main.c
src/test_grabbag/picture/main.c
src/test_libFLAC/bitwriter.c
src/test_libFLAC/decoders.c
src/test_libFLAC/encoders.c
src/test_libFLAC/endswap.c
src/test_libFLAC/format.c
src/test_libFLAC/md5.c
src/test_libFLAC/metadata_manip.c
src/test_libFLAC/metadata_object.c
src/test_libs_common/file_utils_flac.c
src/test_libs_common/metadata_utils.c
src/test_seeking/main.c

index b3d797d..32e31a7 100644 (file)
@@ -60,7 +60,7 @@
  * silog2(  9) = 5
  * silog2( 10) = 5
  */
-unsigned FLAC__bitmath_silog2(FLAC__int64 v)
+uint32_t FLAC__bitmath_silog2(FLAC__int64 v)
 {
        if(v == 0)
                return 0;
index ab62d41..386f420 100644 (file)
@@ -97,47 +97,47 @@ typedef FLAC__uint64 brword;
  * also depends on the CPU cache size and other factors; some twiddling
  * may be necessary to squeeze out the best performance.
  */
-static const unsigned FLAC__BITREADER_DEFAULT_CAPACITY = 65536u / FLAC__BITS_PER_WORD; /* in words */
+static const uint32_t FLAC__BITREADER_DEFAULT_CAPACITY = 65536u / FLAC__BITS_PER_WORD; /* in words */
 
 struct FLAC__BitReader {
        /* any partially-consumed word at the head will stay right-justified as bits are consumed from the left */
        /* any incomplete word at the tail will be left-justified, and bytes from the read callback are added on the right */
        brword *buffer;
-       unsigned capacity; /* in words */
-       unsigned words; /* # of completed words in buffer */
-       unsigned bytes; /* # of bytes in incomplete word at buffer[words] */
-       unsigned consumed_words; /* #words ... */
-       unsigned consumed_bits; /* ... + (#bits of head word) already consumed from the front of buffer */
-       unsigned read_crc16; /* the running frame CRC */
-       unsigned crc16_align; /* the number of bits in the current consumed word that should not be CRC'd */
+       uint32_t capacity; /* in words */
+       uint32_t words; /* # of completed words in buffer */
+       uint32_t bytes; /* # of bytes in incomplete word at buffer[words] */
+       uint32_t consumed_words; /* #words ... */
+       uint32_t consumed_bits; /* ... + (#bits of head word) already consumed from the front of buffer */
+       uint32_t read_crc16; /* the running frame CRC */
+       uint32_t crc16_align; /* the number of bits in the current consumed word that should not be CRC'd */
        FLAC__BitReaderReadCallback read_callback;
        void *client_data;
 };
 
 static inline void crc16_update_word_(FLAC__BitReader *br, brword word)
 {
-       register unsigned crc = br->read_crc16;
+       register uint32_t crc = br->read_crc16;
 #if FLAC__BYTES_PER_WORD == 4
        switch(br->crc16_align) {
-               case  0: crc = FLAC__CRC16_UPDATE((unsigned)(word >> 24), crc);
-               case  8: crc = FLAC__CRC16_UPDATE((unsigned)((word >> 16) & 0xff), crc);
-               case 16: crc = FLAC__CRC16_UPDATE((unsigned)((word >> 8) & 0xff), crc);
-               case 24: br->read_crc16 = FLAC__CRC16_UPDATE((unsigned)(word & 0xff), crc);
+               case  0: crc = FLAC__CRC16_UPDATE((uint32_t)(word >> 24), crc);
+               case  8: crc = FLAC__CRC16_UPDATE((uint32_t)((word >> 16) & 0xff), crc);
+               case 16: crc = FLAC__CRC16_UPDATE((uint32_t)((word >> 8) & 0xff), crc);
+               case 24: br->read_crc16 = FLAC__CRC16_UPDATE((uint32_t)(word & 0xff), crc);
        }
 #elif FLAC__BYTES_PER_WORD == 8
        switch(br->crc16_align) {
-               case  0: crc = FLAC__CRC16_UPDATE((unsigned)(word >> 56), crc);
-               case  8: crc = FLAC__CRC16_UPDATE((unsigned)((word >> 48) & 0xff), crc);
-               case 16: crc = FLAC__CRC16_UPDATE((unsigned)((word >> 40) & 0xff), crc);
-               case 24: crc = FLAC__CRC16_UPDATE((unsigned)((word >> 32) & 0xff), crc);
-               case 32: crc = FLAC__CRC16_UPDATE((unsigned)((word >> 24) & 0xff), crc);
-               case 40: crc = FLAC__CRC16_UPDATE((unsigned)((word >> 16) & 0xff), crc);
-               case 48: crc = FLAC__CRC16_UPDATE((unsigned)((word >> 8) & 0xff), crc);
-               case 56: br->read_crc16 = FLAC__CRC16_UPDATE((unsigned)(word & 0xff), crc);
+               case  0: crc = FLAC__CRC16_UPDATE((uint32_t)(word >> 56), crc);
+               case  8: crc = FLAC__CRC16_UPDATE((uint32_t)((word >> 48) & 0xff), crc);
+               case 16: crc = FLAC__CRC16_UPDATE((uint32_t)((word >> 40) & 0xff), crc);
+               case 24: crc = FLAC__CRC16_UPDATE((uint32_t)((word >> 32) & 0xff), crc);
+               case 32: crc = FLAC__CRC16_UPDATE((uint32_t)((word >> 24) & 0xff), crc);
+               case 40: crc = FLAC__CRC16_UPDATE((uint32_t)((word >> 16) & 0xff), crc);
+               case 48: crc = FLAC__CRC16_UPDATE((uint32_t)((word >> 8) & 0xff), crc);
+               case 56: br->read_crc16 = FLAC__CRC16_UPDATE((uint32_t)(word & 0xff), crc);
        }
 #else
        for( ; br->crc16_align < FLAC__BITS_PER_WORD; br->crc16_align += 8)
-               crc = FLAC__CRC16_UPDATE((unsigned)((word >> (FLAC__BITS_PER_WORD-8-br->crc16_align)) & 0xff), crc);
+               crc = FLAC__CRC16_UPDATE((uint32_t)((word >> (FLAC__BITS_PER_WORD-8-br->crc16_align)) & 0xff), crc);
        br->read_crc16 = crc;
 #endif
        br->crc16_align = 0;
@@ -145,7 +145,7 @@ static inline void crc16_update_word_(FLAC__BitReader *br, brword word)
 
 static FLAC__bool bitreader_read_from_client_(FLAC__BitReader *br)
 {
-       unsigned start, end;
+       uint32_t start, end;
        size_t bytes;
        FLAC__byte *target;
 
@@ -200,7 +200,7 @@ static FLAC__bool bitreader_read_from_client_(FLAC__BitReader *br)
         */
 #if WORDS_BIGENDIAN
 #else
-       end = (br->words*FLAC__BYTES_PER_WORD + br->bytes + (unsigned)bytes + (FLAC__BYTES_PER_WORD-1)) / FLAC__BYTES_PER_WORD;
+       end = (br->words*FLAC__BYTES_PER_WORD + br->bytes + (uint32_t)bytes + (FLAC__BYTES_PER_WORD-1)) / FLAC__BYTES_PER_WORD;
        for(start = br->words; start < end; start++)
                br->buffer[start] = SWAP_BE_WORD_TO_HOST(br->buffer[start]);
 #endif
@@ -211,7 +211,7 @@ static FLAC__bool bitreader_read_from_client_(FLAC__BitReader *br)
         *   buffer[LE]:  44 33 22 11 88 77 66 55 CC BB AA 99 ?? FF EE DD
         * finally we'll update the reader values:
         */
-       end = br->words*FLAC__BYTES_PER_WORD + br->bytes + (unsigned)bytes;
+       end = br->words*FLAC__BYTES_PER_WORD + br->bytes + (uint32_t)bytes;
        br->words = end / FLAC__BYTES_PER_WORD;
        br->bytes = end % FLAC__BYTES_PER_WORD;
 
@@ -293,7 +293,7 @@ FLAC__bool FLAC__bitreader_clear(FLAC__BitReader *br)
 
 void FLAC__bitreader_dump(const FLAC__BitReader *br, FILE *out)
 {
-       unsigned i, j;
+       uint32_t i, j;
        if(br == 0) {
                fprintf(out, "bitreader is NULL\n");
        }
@@ -327,7 +327,7 @@ void FLAC__bitreader_reset_read_crc16(FLAC__BitReader *br, FLAC__uint16 seed)
        FLAC__ASSERT(0 != br->buffer);
        FLAC__ASSERT((br->consumed_bits & 7) == 0);
 
-       br->read_crc16 = (unsigned)seed;
+       br->read_crc16 = (uint32_t)seed;
        br->crc16_align = br->consumed_bits;
 }
 
@@ -342,7 +342,7 @@ FLAC__uint16 FLAC__bitreader_get_read_crc16(FLAC__BitReader *br)
        if(br->consumed_bits) {
                const brword tail = br->buffer[br->consumed_words];
                for( ; br->crc16_align < br->consumed_bits; br->crc16_align += 8)
-                       br->read_crc16 = FLAC__CRC16_UPDATE((unsigned)((tail >> (FLAC__BITS_PER_WORD-8-br->crc16_align)) & 0xff), br->read_crc16);
+                       br->read_crc16 = FLAC__CRC16_UPDATE((uint32_t)((tail >> (FLAC__BITS_PER_WORD-8-br->crc16_align)) & 0xff), br->read_crc16);
        }
        return br->read_crc16;
 }
@@ -352,17 +352,17 @@ inline FLAC__bool FLAC__bitreader_is_consumed_byte_aligned(const FLAC__BitReader
        return ((br->consumed_bits & 7) == 0);
 }
 
-inline unsigned FLAC__bitreader_bits_left_for_byte_alignment(const FLAC__BitReader *br)
+inline uint32_t FLAC__bitreader_bits_left_for_byte_alignment(const FLAC__BitReader *br)
 {
        return 8 - (br->consumed_bits & 7);
 }
 
-inline unsigned FLAC__bitreader_get_input_bits_unconsumed(const FLAC__BitReader *br)
+inline uint32_t 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;
 }
 
-FLAC__bool FLAC__bitreader_read_raw_uint32(FLAC__BitReader *br, FLAC__uint32 *val, unsigned bits)
+FLAC__bool FLAC__bitreader_read_raw_uint32(FLAC__BitReader *br, FLAC__uint32 *val, uint32_t bits)
 {
        FLAC__ASSERT(0 != br);
        FLAC__ASSERT(0 != br->buffer);
@@ -387,7 +387,7 @@ FLAC__bool FLAC__bitreader_read_raw_uint32(FLAC__BitReader *br, FLAC__uint32 *va
                /* OPT: taking out the consumed_bits==0 "else" case below might make things faster if less code allows the compiler to inline this function */
                if(br->consumed_bits) {
                        /* this also works when consumed_bits==0, it's just a little slower than necessary for that case */
-                       const unsigned n = FLAC__BITS_PER_WORD - br->consumed_bits;
+                       const uint32_t n = FLAC__BITS_PER_WORD - br->consumed_bits;
                        const brword word = br->buffer[br->consumed_words];
                        if(bits < n) {
                                *val = (FLAC__uint32)((word & (FLAC__WORD_ALL_ONES >> br->consumed_bits)) >> (n-bits)); /* The result has <= 32 non-zero bits */
@@ -442,7 +442,7 @@ FLAC__bool FLAC__bitreader_read_raw_uint32(FLAC__BitReader *br, FLAC__uint32 *va
        }
 }
 
-FLAC__bool FLAC__bitreader_read_raw_int32(FLAC__BitReader *br, FLAC__int32 *val, unsigned bits)
+FLAC__bool FLAC__bitreader_read_raw_int32(FLAC__BitReader *br, FLAC__int32 *val, uint32_t bits)
 {
        FLAC__uint32 uval, mask;
        /* OPT: inline raw uint32 code here, or make into a macro if possible in the .h file */
@@ -455,7 +455,7 @@ FLAC__bool FLAC__bitreader_read_raw_int32(FLAC__BitReader *br, FLAC__int32 *val,
        return true;
 }
 
-FLAC__bool FLAC__bitreader_read_raw_uint64(FLAC__BitReader *br, FLAC__uint64 *val, unsigned bits)
+FLAC__bool FLAC__bitreader_read_raw_uint64(FLAC__BitReader *br, FLAC__uint64 *val, uint32_t bits)
 {
        FLAC__uint32 hi, lo;
 
@@ -501,7 +501,7 @@ inline FLAC__bool FLAC__bitreader_read_uint32_little_endian(FLAC__BitReader *br,
        return true;
 }
 
-FLAC__bool FLAC__bitreader_skip_bits_no_crc(FLAC__BitReader *br, unsigned bits)
+FLAC__bool FLAC__bitreader_skip_bits_no_crc(FLAC__BitReader *br, uint32_t bits)
 {
        /*
         * OPT: a faster implementation is possible but probably not that useful
@@ -511,8 +511,8 @@ FLAC__bool FLAC__bitreader_skip_bits_no_crc(FLAC__BitReader *br, unsigned bits)
        FLAC__ASSERT(0 != br->buffer);
 
        if(bits > 0) {
-               const unsigned n = br->consumed_bits & 7;
-               unsigned m;
+               const uint32_t n = br->consumed_bits & 7;
+               uint32_t m;
                FLAC__uint32 x;
 
                if(n != 0) {
@@ -536,7 +536,7 @@ FLAC__bool FLAC__bitreader_skip_bits_no_crc(FLAC__BitReader *br, unsigned bits)
        return true;
 }
 
-FLAC__bool FLAC__bitreader_skip_byte_block_aligned_no_crc(FLAC__BitReader *br, unsigned nvals)
+FLAC__bool FLAC__bitreader_skip_byte_block_aligned_no_crc(FLAC__BitReader *br, uint32_t nvals)
 {
        FLAC__uint32 x;
 
@@ -571,7 +571,7 @@ FLAC__bool FLAC__bitreader_skip_byte_block_aligned_no_crc(FLAC__BitReader *br, u
        return true;
 }
 
-FLAC__bool FLAC__bitreader_read_byte_block_aligned_no_crc(FLAC__BitReader *br, FLAC__byte *val, unsigned nvals)
+FLAC__bool FLAC__bitreader_read_byte_block_aligned_no_crc(FLAC__BitReader *br, FLAC__byte *val, uint32_t nvals)
 {
        FLAC__uint32 x;
 
@@ -627,10 +627,10 @@ FLAC__bool FLAC__bitreader_read_byte_block_aligned_no_crc(FLAC__BitReader *br, F
        return true;
 }
 
-FLAC__bool FLAC__bitreader_read_unary_unsigned(FLAC__BitReader *br, unsigned *val)
+FLAC__bool FLAC__bitreader_read_unary_unsigned(FLAC__BitReader *br, uint32_t *val)
 #if 0 /* slow but readable version */
 {
-       unsigned bit;
+       uint32_t bit;
 
        FLAC__ASSERT(0 != br);
        FLAC__ASSERT(0 != br->buffer);
@@ -648,7 +648,7 @@ FLAC__bool FLAC__bitreader_read_unary_unsigned(FLAC__BitReader *br, unsigned *va
 }
 #else
 {
-       unsigned i;
+       uint32_t i;
 
        FLAC__ASSERT(0 != br);
        FLAC__ASSERT(0 != br->buffer);
@@ -685,7 +685,7 @@ FLAC__bool FLAC__bitreader_read_unary_unsigned(FLAC__BitReader *br, unsigned *va
                 * be zero.
                 */
                if(br->bytes*8 > br->consumed_bits) {
-                       const unsigned end = br->bytes * 8;
+                       const uint32_t end = br->bytes * 8;
                        brword b = (br->buffer[br->consumed_words] & (FLAC__WORD_ALL_ONES << (FLAC__BITS_PER_WORD-end))) << br->consumed_bits;
                        if(b) {
                                i = COUNT_ZERO_MSBS(b);
@@ -708,10 +708,10 @@ FLAC__bool FLAC__bitreader_read_unary_unsigned(FLAC__BitReader *br, unsigned *va
 }
 #endif
 
-FLAC__bool FLAC__bitreader_read_rice_signed(FLAC__BitReader *br, int *val, unsigned parameter)
+FLAC__bool FLAC__bitreader_read_rice_signed(FLAC__BitReader *br, int *val, uint32_t parameter)
 {
        FLAC__uint32 lsbs = 0, msbs = 0;
-       unsigned uval;
+       uint32_t uval;
 
        FLAC__ASSERT(0 != br);
        FLAC__ASSERT(0 != br->buffer);
@@ -736,13 +736,13 @@ FLAC__bool FLAC__bitreader_read_rice_signed(FLAC__BitReader *br, int *val, unsig
 }
 
 /* this is by far the most heavily used reader call.  it ain't pretty but it's fast */
-FLAC__bool FLAC__bitreader_read_rice_signed_block(FLAC__BitReader *br, int vals[], unsigned nvals, unsigned parameter)
+FLAC__bool FLAC__bitreader_read_rice_signed_block(FLAC__BitReader *br, int vals[], uint32_t nvals, uint32_t parameter)
 {
        /* try and get br->consumed_words and br->consumed_bits into register;
         * must remember to flush them back to *br before calling other
         * bitreader functions that use them, and before returning */
-       unsigned cwords, words, lsbs, msbs, x, y;
-       unsigned ucbits; /* keep track of the number of unconsumed bits in word */
+       uint32_t cwords, words, lsbs, msbs, x, y;
+       uint32_t ucbits; /* keep track of the number of unconsumed bits in word */
        brword b;
        int *val, *end;
 
@@ -803,7 +803,7 @@ FLAC__bool FLAC__bitreader_read_rice_signed_block(FLAC__BitReader *br, int vals[
                msbs = x;
 
                /* read the binary LSBs */
-               x = (FLAC__uint32)(b >> (FLAC__BITS_PER_WORD - parameter)); /* parameter < 32, so we can cast to 32-bit unsigned */
+               x = (FLAC__uint32)(b >> (FLAC__BITS_PER_WORD - parameter)); /* parameter < 32, so we can cast to 32-bit uint32_t */
                if(parameter <= ucbits) {
                        ucbits -= parameter;
                        b <<= parameter;
@@ -876,10 +876,10 @@ incomplete_lsbs:
 }
 
 #if 0 /* UNUSED */
-FLAC__bool FLAC__bitreader_read_golomb_signed(FLAC__BitReader *br, int *val, unsigned parameter)
+FLAC__bool FLAC__bitreader_read_golomb_signed(FLAC__BitReader *br, int *val, uint32_t parameter)
 {
        FLAC__uint32 lsbs = 0, msbs = 0;
-       unsigned bit, uval, k;
+       uint32_t bit, uval, k;
 
        FLAC__ASSERT(0 != br);
        FLAC__ASSERT(0 != br->buffer);
@@ -899,7 +899,7 @@ FLAC__bool FLAC__bitreader_read_golomb_signed(FLAC__BitReader *br, int *val, uns
                uval = (msbs << k) | lsbs;
        }
        else {
-               unsigned d = (1 << (k+1)) - parameter;
+               uint32_t d = (1 << (k+1)) - parameter;
                if(lsbs >= d) {
                        if(!FLAC__bitreader_read_bit(br, &bit))
                                return false;
@@ -911,7 +911,7 @@ FLAC__bool FLAC__bitreader_read_golomb_signed(FLAC__BitReader *br, int *val, uns
                uval = msbs * parameter + lsbs;
        }
 
-       /* unfold unsigned to signed */
+       /* unfold uint32_t to signed */
        if(uval & 1)
                *val = -((int)(uval >> 1)) - 1;
        else
@@ -920,10 +920,10 @@ FLAC__bool FLAC__bitreader_read_golomb_signed(FLAC__BitReader *br, int *val, uns
        return true;
 }
 
-FLAC__bool FLAC__bitreader_read_golomb_unsigned(FLAC__BitReader *br, unsigned *val, unsigned parameter)
+FLAC__bool FLAC__bitreader_read_golomb_unsigned(FLAC__BitReader *br, uint32_t *val, uint32_t parameter)
 {
        FLAC__uint32 lsbs, msbs = 0;
-       unsigned bit, k;
+       uint32_t bit, k;
 
        FLAC__ASSERT(0 != br);
        FLAC__ASSERT(0 != br->buffer);
@@ -943,7 +943,7 @@ FLAC__bool FLAC__bitreader_read_golomb_unsigned(FLAC__BitReader *br, unsigned *v
                *val = (msbs << k) | lsbs;
        }
        else {
-               unsigned d = (1 << (k+1)) - parameter;
+               uint32_t d = (1 << (k+1)) - parameter;
                if(lsbs >= d) {
                        if(!FLAC__bitreader_read_bit(br, &bit))
                                return false;
@@ -960,11 +960,11 @@ FLAC__bool FLAC__bitreader_read_golomb_unsigned(FLAC__BitReader *br, unsigned *v
 #endif /* UNUSED */
 
 /* on return, if *val == 0xffffffff then the utf-8 sequence was invalid, but the return value will be true */
-FLAC__bool FLAC__bitreader_read_utf8_uint32(FLAC__BitReader *br, FLAC__uint32 *val, FLAC__byte *raw, unsigned *rawlen)
+FLAC__bool FLAC__bitreader_read_utf8_uint32(FLAC__BitReader *br, FLAC__uint32 *val, FLAC__byte *raw, uint32_t *rawlen)
 {
        FLAC__uint32 v = 0;
        FLAC__uint32 x;
-       unsigned i;
+       uint32_t i;
 
        if(!FLAC__bitreader_read_raw_uint32(br, &x, 8))
                return false;
@@ -1015,11 +1015,11 @@ FLAC__bool FLAC__bitreader_read_utf8_uint32(FLAC__BitReader *br, FLAC__uint32 *v
 }
 
 /* on return, if *val == 0xffffffffffffffff then the utf-8 sequence was invalid, but the return value will be true */
-FLAC__bool FLAC__bitreader_read_utf8_uint64(FLAC__BitReader *br, FLAC__uint64 *val, FLAC__byte *raw, unsigned *rawlen)
+FLAC__bool FLAC__bitreader_read_utf8_uint64(FLAC__BitReader *br, FLAC__uint64 *val, FLAC__byte *raw, uint32_t *rawlen)
 {
        FLAC__uint64 v = 0;
        FLAC__uint32 x;
-       unsigned i;
+       uint32_t i;
 
        if(!FLAC__bitreader_read_raw_uint32(br, &x, 8))
                return false;
@@ -1082,6 +1082,6 @@ FLAC__bool FLAC__bitreader_read_utf8_uint64(FLAC__BitReader *br, FLAC__uint64 *v
  * fix that we add extern declarations here.
  */
 extern FLAC__bool FLAC__bitreader_is_consumed_byte_aligned(const FLAC__BitReader *br);
-extern unsigned FLAC__bitreader_bits_left_for_byte_alignment(const FLAC__BitReader *br);
-extern unsigned FLAC__bitreader_get_input_bits_unconsumed(const FLAC__BitReader *br);
+extern uint32_t FLAC__bitreader_bits_left_for_byte_alignment(const FLAC__BitReader *br);
+extern uint32_t FLAC__bitreader_get_input_bits_unconsumed(const FLAC__BitReader *br);
 extern FLAC__bool FLAC__bitreader_read_uint32_little_endian(FLAC__BitReader *br, FLAC__uint32 *val);
index 402b1c4..8f475d5 100644 (file)
@@ -80,9 +80,9 @@ typedef FLAC__uint64 bwword;
  * a frame or metadata block, then write that out and clear the buffer for the
  * next one.
  */
-static const unsigned FLAC__BITWRITER_DEFAULT_CAPACITY = 32768u / sizeof(bwword); /* size in words */
+static const uint32_t FLAC__BITWRITER_DEFAULT_CAPACITY = 32768u / sizeof(bwword); /* size in words */
 /* When growing, increment 4K at a time */
-static const unsigned FLAC__BITWRITER_DEFAULT_INCREMENT = 4096u / sizeof(bwword); /* size in words */
+static const uint32_t FLAC__BITWRITER_DEFAULT_INCREMENT = 4096u / sizeof(bwword); /* size in words */
 
 #define FLAC__WORDS_TO_BITS(words) ((words) * FLAC__BITS_PER_WORD)
 #define FLAC__TOTAL_BITS(bw) (FLAC__WORDS_TO_BITS((bw)->words) + (bw)->bits)
@@ -90,18 +90,18 @@ static const unsigned FLAC__BITWRITER_DEFAULT_INCREMENT = 4096u / sizeof(bwword)
 struct FLAC__BitWriter {
        bwword *buffer;
        bwword accum; /* accumulator; bits are right-justified; when full, accum is appended to buffer */
-       unsigned capacity; /* capacity of buffer in words */
-       unsigned words; /* # of complete words in buffer */
-       unsigned bits; /* # of used bits in accum */
+       uint32_t capacity; /* capacity of buffer in words */
+       uint32_t words; /* # of complete words in buffer */
+       uint32_t bits; /* # of used bits in accum */
 };
 
 /* * WATCHOUT: The current implementation only grows the buffer. */
 #ifndef __SUNPRO_C
 static
 #endif
-FLAC__bool bitwriter_grow_(FLAC__BitWriter *bw, unsigned bits_to_add)
+FLAC__bool bitwriter_grow_(FLAC__BitWriter *bw, uint32_t bits_to_add)
 {
-       unsigned new_capacity;
+       uint32_t new_capacity;
        bwword *new_buffer;
 
        FLAC__ASSERT(0 != bw);
@@ -191,7 +191,7 @@ void FLAC__bitwriter_clear(FLAC__BitWriter *bw)
 
 void FLAC__bitwriter_dump(const FLAC__BitWriter *bw, FILE *out)
 {
-       unsigned i, j;
+       uint32_t i, j;
        if(bw == 0) {
                fprintf(out, "bitwriter is NULL\n");
        }
@@ -248,7 +248,7 @@ FLAC__bool FLAC__bitwriter_is_byte_aligned(const FLAC__BitWriter *bw)
        return ((bw->bits & 7) == 0);
 }
 
-unsigned FLAC__bitwriter_get_input_bits_unconsumed(const FLAC__BitWriter *bw)
+uint32_t FLAC__bitwriter_get_input_bits_unconsumed(const FLAC__BitWriter *bw)
 {
        return FLAC__TOTAL_BITS(bw);
 }
@@ -281,9 +281,9 @@ void FLAC__bitwriter_release_buffer(FLAC__BitWriter *bw)
        (void)bw;
 }
 
-inline FLAC__bool FLAC__bitwriter_write_zeroes(FLAC__BitWriter *bw, unsigned bits)
+inline FLAC__bool FLAC__bitwriter_write_zeroes(FLAC__BitWriter *bw, uint32_t bits)
 {
-       unsigned n;
+       uint32_t n;
 
        FLAC__ASSERT(0 != bw);
        FLAC__ASSERT(0 != bw->buffer);
@@ -319,9 +319,9 @@ inline FLAC__bool FLAC__bitwriter_write_zeroes(FLAC__BitWriter *bw, unsigned bit
        return true;
 }
 
-static inline FLAC__bool FLAC__bitwriter_write_raw_uint32_nocheck(FLAC__BitWriter *bw, FLAC__uint32 val, unsigned bits)
+static inline FLAC__bool FLAC__bitwriter_write_raw_uint32_nocheck(FLAC__BitWriter *bw, FLAC__uint32 val, uint32_t bits)
 {
-       register unsigned left;
+       register uint32_t left;
 
        /* WATCHOUT: code does not work with <32bit words; we can make things much faster with this assertion */
        FLAC__ASSERT(FLAC__BITS_PER_WORD >= 32);
@@ -360,7 +360,7 @@ static inline FLAC__bool FLAC__bitwriter_write_raw_uint32_nocheck(FLAC__BitWrite
        return true;
 }
 
-inline FLAC__bool FLAC__bitwriter_write_raw_uint32(FLAC__BitWriter *bw, FLAC__uint32 val, unsigned bits)
+inline FLAC__bool FLAC__bitwriter_write_raw_uint32(FLAC__BitWriter *bw, FLAC__uint32 val, uint32_t bits)
 {
        /* check that unused bits are unset */
        if((bits < 32) && (val>>bits != 0))
@@ -369,7 +369,7 @@ inline FLAC__bool FLAC__bitwriter_write_raw_uint32(FLAC__BitWriter *bw, FLAC__ui
        return FLAC__bitwriter_write_raw_uint32_nocheck(bw, val, bits);
 }
 
-inline FLAC__bool FLAC__bitwriter_write_raw_int32(FLAC__BitWriter *bw, FLAC__int32 val, unsigned bits)
+inline FLAC__bool FLAC__bitwriter_write_raw_int32(FLAC__BitWriter *bw, FLAC__int32 val, uint32_t bits)
 {
        /* zero-out unused bits */
        if(bits < 32)
@@ -378,7 +378,7 @@ inline FLAC__bool FLAC__bitwriter_write_raw_int32(FLAC__BitWriter *bw, FLAC__int
        return FLAC__bitwriter_write_raw_uint32_nocheck(bw, (FLAC__uint32)val, bits);
 }
 
-inline FLAC__bool FLAC__bitwriter_write_raw_uint64(FLAC__BitWriter *bw, FLAC__uint64 val, unsigned bits)
+inline FLAC__bool FLAC__bitwriter_write_raw_uint64(FLAC__BitWriter *bw, FLAC__uint64 val, uint32_t bits)
 {
        /* this could be a little faster but it's not used for much */
        if(bits > 32) {
@@ -406,9 +406,9 @@ inline FLAC__bool FLAC__bitwriter_write_raw_uint32_little_endian(FLAC__BitWriter
        return true;
 }
 
-inline FLAC__bool FLAC__bitwriter_write_byte_block(FLAC__BitWriter *bw, const FLAC__byte vals[], unsigned nvals)
+inline FLAC__bool FLAC__bitwriter_write_byte_block(FLAC__BitWriter *bw, const FLAC__byte vals[], uint32_t nvals)
 {
-       unsigned i;
+       uint32_t i;
 
        /* this could be faster but currently we don't need it to be since it's only used for writing metadata */
        for(i = 0; i < nvals; i++) {
@@ -419,7 +419,7 @@ inline FLAC__bool FLAC__bitwriter_write_byte_block(FLAC__BitWriter *bw, const FL
        return true;
 }
 
-FLAC__bool FLAC__bitwriter_write_unary_unsigned(FLAC__BitWriter *bw, unsigned val)
+FLAC__bool FLAC__bitwriter_write_unary_unsigned(FLAC__BitWriter *bw, uint32_t val)
 {
        if(val < 32)
                return FLAC__bitwriter_write_raw_uint32_nocheck(bw, 1, ++val);
@@ -429,13 +429,13 @@ FLAC__bool FLAC__bitwriter_write_unary_unsigned(FLAC__BitWriter *bw, unsigned va
                        FLAC__bitwriter_write_raw_uint32_nocheck(bw, 1, 1);
 }
 
-unsigned FLAC__bitwriter_rice_bits(FLAC__int32 val, unsigned parameter)
+uint32_t FLAC__bitwriter_rice_bits(FLAC__int32 val, uint32_t parameter)
 {
        FLAC__uint32 uval;
 
        FLAC__ASSERT(parameter < 32);
 
-       /* fold signed to unsigned; actual formula is: negative(v)? -2v-1 : 2v */
+       /* fold signed to uint32_t; actual formula is: negative(v)? -2v-1 : 2v */
        uval = val;
        uval <<= 1;
        uval ^= (val>>31);
@@ -444,18 +444,18 @@ unsigned FLAC__bitwriter_rice_bits(FLAC__int32 val, unsigned parameter)
 }
 
 #if 0 /* UNUSED */
-unsigned FLAC__bitwriter_golomb_bits_signed(int val, unsigned parameter)
+uint32_t FLAC__bitwriter_golomb_bits_signed(int val, uint32_t parameter)
 {
-       unsigned bits, msbs, uval;
-       unsigned k;
+       uint32_t bits, msbs, uval;
+       uint32_t k;
 
        FLAC__ASSERT(parameter > 0);
 
-       /* fold signed to unsigned */
+       /* fold signed to uint32_t */
        if(val < 0)
-               uval = (unsigned)(((-(++val)) << 1) + 1);
+               uval = (uint32_t)(((-(++val)) << 1) + 1);
        else
-               uval = (unsigned)(val << 1);
+               uval = (uint32_t)(val << 1);
 
        k = FLAC__bitmath_ilog2(parameter);
        if(parameter == 1u<<k) {
@@ -465,7 +465,7 @@ unsigned FLAC__bitwriter_golomb_bits_signed(int val, unsigned parameter)
                bits = 1 + k + msbs;
        }
        else {
-               unsigned q, r, d;
+               uint32_t q, r, d;
 
                d = (1 << (k+1)) - parameter;
                q = uval / parameter;
@@ -478,10 +478,10 @@ unsigned FLAC__bitwriter_golomb_bits_signed(int val, unsigned parameter)
        return bits;
 }
 
-unsigned FLAC__bitwriter_golomb_bits_unsigned(unsigned uval, unsigned parameter)
+uint32_t FLAC__bitwriter_golomb_bits_unsigned(uint32_t uval, uint32_t parameter)
 {
-       unsigned bits, msbs;
-       unsigned k;
+       uint32_t bits, msbs;
+       uint32_t k;
 
        FLAC__ASSERT(parameter > 0);
 
@@ -493,7 +493,7 @@ unsigned FLAC__bitwriter_golomb_bits_unsigned(unsigned uval, unsigned parameter)
                bits = 1 + k + msbs;
        }
        else {
-               unsigned q, r, d;
+               uint32_t q, r, d;
 
                d = (1 << (k+1)) - parameter;
                q = uval / parameter;
@@ -507,16 +507,16 @@ unsigned FLAC__bitwriter_golomb_bits_unsigned(unsigned uval, unsigned parameter)
 }
 #endif /* UNUSED */
 
-FLAC__bool FLAC__bitwriter_write_rice_signed(FLAC__BitWriter *bw, FLAC__int32 val, unsigned parameter)
+FLAC__bool FLAC__bitwriter_write_rice_signed(FLAC__BitWriter *bw, FLAC__int32 val, uint32_t parameter)
 {
-       unsigned total_bits, interesting_bits, msbs;
+       uint32_t total_bits, interesting_bits, msbs;
        FLAC__uint32 uval, pattern;
 
        FLAC__ASSERT(0 != bw);
        FLAC__ASSERT(0 != bw->buffer);
        FLAC__ASSERT(parameter < 32);
 
-       /* fold signed to unsigned; actual formula is: negative(v)? -2v-1 : 2v */
+       /* fold signed to uint32_t; actual formula is: negative(v)? -2v-1 : 2v */
        uval = val;
        uval <<= 1;
        uval ^= (val>>31);
@@ -535,14 +535,14 @@ FLAC__bool FLAC__bitwriter_write_rice_signed(FLAC__BitWriter *bw, FLAC__int32 va
                        FLAC__bitwriter_write_raw_uint32(bw, pattern, interesting_bits); /* write the unary end bit and binary LSBs */
 }
 
-FLAC__bool FLAC__bitwriter_write_rice_signed_block(FLAC__BitWriter *bw, const FLAC__int32 *vals, unsigned nvals, unsigned parameter)
+FLAC__bool FLAC__bitwriter_write_rice_signed_block(FLAC__BitWriter *bw, const FLAC__int32 *vals, uint32_t nvals, uint32_t parameter)
 {
        const FLAC__uint32 mask1 = (FLAC__uint32)0xffffffff << parameter; /* we val|=mask1 to set the stop bit above it... */
        const FLAC__uint32 mask2 = (FLAC__uint32)0xffffffff >> (31-parameter); /* ...then mask off the bits above the stop bit with val&=mask2 */
        FLAC__uint32 uval;
-       unsigned left;
-       const unsigned lsbits = 1 + parameter;
-       unsigned msbits, total_bits;
+       uint32_t left;
+       const uint32_t lsbits = 1 + parameter;
+       uint32_t msbits, total_bits;
 
        FLAC__ASSERT(0 != bw);
        FLAC__ASSERT(0 != bw->buffer);
@@ -551,7 +551,7 @@ FLAC__bool FLAC__bitwriter_write_rice_signed_block(FLAC__BitWriter *bw, const FL
        FLAC__ASSERT(FLAC__BITS_PER_WORD >= 32);
 
        while(nvals) {
-               /* fold signed to unsigned; actual formula is: negative(v)? -2v-1 : 2v */
+               /* fold signed to uint32_t; actual formula is: negative(v)? -2v-1 : 2v */
                uval = *vals;
                uval <<= 1;
                uval ^= (*vals>>31);
@@ -630,24 +630,24 @@ break1:
 }
 
 #if 0 /* UNUSED */
-FLAC__bool FLAC__bitwriter_write_golomb_signed(FLAC__BitWriter *bw, int val, unsigned parameter)
+FLAC__bool FLAC__bitwriter_write_golomb_signed(FLAC__BitWriter *bw, int val, uint32_t parameter)
 {
-       unsigned total_bits, msbs, uval;
-       unsigned k;
+       uint32_t total_bits, msbs, uval;
+       uint32_t k;
 
        FLAC__ASSERT(0 != bw);
        FLAC__ASSERT(0 != bw->buffer);
        FLAC__ASSERT(parameter > 0);
 
-       /* fold signed to unsigned */
+       /* fold signed to uint32_t */
        if(val < 0)
-               uval = (unsigned)(((-(++val)) << 1) + 1);
+               uval = (uint32_t)(((-(++val)) << 1) + 1);
        else
-               uval = (unsigned)(val << 1);
+               uval = (uint32_t)(val << 1);
 
        k = FLAC__bitmath_ilog2(parameter);
        if(parameter == 1u<<k) {
-               unsigned pattern;
+               uint32_t pattern;
 
                FLAC__ASSERT(k <= 30);
 
@@ -670,7 +670,7 @@ FLAC__bool FLAC__bitwriter_write_golomb_signed(FLAC__BitWriter *bw, int val, uns
                }
        }
        else {
-               unsigned q, r, d;
+               uint32_t q, r, d;
 
                d = (1 << (k+1)) - parameter;
                q = uval / parameter;
@@ -694,10 +694,10 @@ FLAC__bool FLAC__bitwriter_write_golomb_signed(FLAC__BitWriter *bw, int val, uns
        return true;
 }
 
-FLAC__bool FLAC__bitwriter_write_golomb_unsigned(FLAC__BitWriter *bw, unsigned uval, unsigned parameter)
+FLAC__bool FLAC__bitwriter_write_golomb_unsigned(FLAC__BitWriter *bw, uint32_t uval, uint32_t parameter)
 {
-       unsigned total_bits, msbs;
-       unsigned k;
+       uint32_t total_bits, msbs;
+       uint32_t k;
 
        FLAC__ASSERT(0 != bw);
        FLAC__ASSERT(0 != bw->buffer);
@@ -705,7 +705,7 @@ FLAC__bool FLAC__bitwriter_write_golomb_unsigned(FLAC__BitWriter *bw, unsigned u
 
        k = FLAC__bitmath_ilog2(parameter);
        if(parameter == 1u<<k) {
-               unsigned pattern;
+               uint32_t pattern;
 
                FLAC__ASSERT(k <= 30);
 
@@ -728,7 +728,7 @@ FLAC__bool FLAC__bitwriter_write_golomb_unsigned(FLAC__BitWriter *bw, unsigned u
                }
        }
        else {
-               unsigned q, r, d;
+               uint32_t q, r, d;
 
                d = (1 << (k+1)) - parameter;
                q = uval / parameter;
@@ -873,9 +873,9 @@ FLAC__bool FLAC__bitwriter_zero_pad_to_byte_boundary(FLAC__BitWriter *bw)
  * Unfortunately, the Microsoft VS compiler doesn't pick them up externally. To
  * fix that we add extern declarations here.
  */
-extern FLAC__bool FLAC__bitwriter_write_zeroes(FLAC__BitWriter *bw, unsigned bits);
-extern FLAC__bool FLAC__bitwriter_write_raw_uint32(FLAC__BitWriter *bw, FLAC__uint32 val, unsigned bits);
-extern FLAC__bool FLAC__bitwriter_write_raw_int32(FLAC__BitWriter *bw, FLAC__int32 val, unsigned bits);
-extern FLAC__bool FLAC__bitwriter_write_raw_uint64(FLAC__BitWriter *bw, FLAC__uint64 val, unsigned bits);
+extern FLAC__bool FLAC__bitwriter_write_zeroes(FLAC__BitWriter *bw, uint32_t bits);
+extern FLAC__bool FLAC__bitwriter_write_raw_uint32(FLAC__BitWriter *bw, FLAC__uint32 val, uint32_t bits);
+extern FLAC__bool FLAC__bitwriter_write_raw_int32(FLAC__BitWriter *bw, FLAC__int32 val, uint32_t bits);
+extern FLAC__bool FLAC__bitwriter_write_raw_uint64(FLAC__BitWriter *bw, FLAC__uint64 val, uint32_t bits);
 extern FLAC__bool FLAC__bitwriter_write_raw_uint32_little_endian(FLAC__BitWriter *bw, FLAC__uint32 val);
-extern FLAC__bool FLAC__bitwriter_write_byte_block(FLAC__BitWriter *bw, const FLAC__byte vals[], unsigned nvals);
+extern FLAC__bool FLAC__bitwriter_write_byte_block(FLAC__BitWriter *bw, const FLAC__byte vals[], uint32_t nvals);
index 12d4619..1c80a72 100644 (file)
 
 #if defined FLAC__CPU_IA32
 /* 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;
-static const unsigned FLAC__CPUINFO_IA32_CPUID_SSE = 0x02000000;
-static const unsigned FLAC__CPUINFO_IA32_CPUID_SSE2 = 0x04000000;
+static const uint32_t FLAC__CPUINFO_IA32_CPUID_CMOV = 0x00008000;
+static const uint32_t FLAC__CPUINFO_IA32_CPUID_MMX = 0x00800000;
+static const uint32_t FLAC__CPUINFO_IA32_CPUID_SSE = 0x02000000;
+static const uint32_t FLAC__CPUINFO_IA32_CPUID_SSE2 = 0x04000000;
 #endif
 
 #if FLAC__HAS_X86INTRIN || FLAC__AVX_SUPPORTED || defined FLAC__HAS_NASM
 /* 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;
-static const unsigned FLAC__CPUINFO_IA32_CPUID_SSE41 = 0x00080000;
-static const unsigned FLAC__CPUINFO_IA32_CPUID_SSE42 = 0x00100000;
+static const uint32_t FLAC__CPUINFO_IA32_CPUID_SSE3 = 0x00000001;
+static const uint32_t FLAC__CPUINFO_IA32_CPUID_SSSE3 = 0x00000200;
+static const uint32_t FLAC__CPUINFO_IA32_CPUID_SSE41 = 0x00080000;
+static const uint32_t FLAC__CPUINFO_IA32_CPUID_SSE42 = 0x00100000;
 
 /* these are flags in ECX of CPUID AX=00000001 */
-static const unsigned FLAC__CPUINFO_IA32_CPUID_OSXSAVE = 0x08000000;
-static const unsigned FLAC__CPUINFO_IA32_CPUID_AVX = 0x10000000;
-static const unsigned FLAC__CPUINFO_IA32_CPUID_FMA = 0x00001000;
+static const uint32_t FLAC__CPUINFO_IA32_CPUID_OSXSAVE = 0x08000000;
+static const uint32_t FLAC__CPUINFO_IA32_CPUID_AVX = 0x10000000;
+static const uint32_t FLAC__CPUINFO_IA32_CPUID_FMA = 0x00001000;
 /* these are flags in EBX of CPUID AX=00000007 */
-static const unsigned FLAC__CPUINFO_IA32_CPUID_AVX2 = 0x00000020;
+static const uint32_t FLAC__CPUINFO_IA32_CPUID_AVX2 = 0x00000020;
 #endif
 
 #if defined FLAC__CPU_IA32 || defined FLAC__CPU_X86_64
@@ -267,7 +267,7 @@ void FLAC__cpu_info_x86(FLAC__uint32 level, FLAC__uint32 *eax, FLAC__uint32 *ebx
        int cpuinfo[4];
        int ext = level & 0x80000000;
        __cpuid(cpuinfo, ext);
-       if((unsigned)cpuinfo[0] >= level) {
+       if((uint32_t)cpuinfo[0] >= level) {
 #if FLAC__AVX_SUPPORTED
                __cpuidex(cpuinfo, level, 0); /* for AVX2 detection */
 #else
index 8123c3b..a36d947 100644 (file)
@@ -75,7 +75,7 @@ FLAC__byte const FLAC__crc8_table[256] = {
 
 /* CRC-16, poly = x^16 + x^15 + x^2 + x^0, init = 0 */
 
-unsigned const FLAC__crc16_table[256] = {
+uint32_t const FLAC__crc16_table[256] = {
        0x0000,  0x8005,  0x800f,  0x000a,  0x801b,  0x001e,  0x0014,  0x8011,
        0x8033,  0x0036,  0x003c,  0x8039,  0x0028,  0x802d,  0x8027,  0x0022,
        0x8063,  0x0066,  0x006c,  0x8069,  0x0078,  0x807d,  0x8077,  0x0072,
@@ -116,13 +116,13 @@ void FLAC__crc8_update(const FLAC__byte data, FLAC__uint8 *crc)
        *crc = FLAC__crc8_table[*crc ^ data];
 }
 
-void FLAC__crc8_update_block(const FLAC__byte *data, unsigned len, FLAC__uint8 *crc)
+void FLAC__crc8_update_block(const FLAC__byte *data, uint32_t len, FLAC__uint8 *crc)
 {
        while(len--)
                *crc = FLAC__crc8_table[*crc ^ *data++];
 }
 
-FLAC__uint8 FLAC__crc8(const FLAC__byte *data, unsigned len)
+FLAC__uint8 FLAC__crc8(const FLAC__byte *data, uint32_t len)
 {
        FLAC__uint8 crc = 0;
 
@@ -132,9 +132,9 @@ FLAC__uint8 FLAC__crc8(const FLAC__byte *data, unsigned len)
        return crc;
 }
 
-unsigned FLAC__crc16(const FLAC__byte *data, unsigned len)
+uint32_t FLAC__crc16(const FLAC__byte *data, uint32_t len)
 {
-       unsigned crc = 0;
+       uint32_t crc = 0;
 
        while(len--)
                crc = ((crc<<8) ^ FLAC__crc16_table[(crc>>8) ^ *data++]) & 0xffff;
index 1e2d5b2..98f42a2 100644 (file)
@@ -45,7 +45,7 @@
 #ifdef local_abs
 #undef local_abs
 #endif
-#define local_abs(x) ((unsigned)((x)<0? -(x) : (x)))
+#define local_abs(x) ((uint32_t)((x)<0? -(x) : (x)))
 
 #ifdef FLAC__INTEGER_ONLY_LIBRARY
 /* rbps stands for residual bits per sample
@@ -57,7 +57,7 @@
 static FLAC__fixedpoint local__compute_rbps_integerized(FLAC__uint32 err, FLAC__uint32 n)
 {
        FLAC__uint32 rbps;
-       unsigned bits; /* the number of bits required to represent a number */
+       uint32_t bits; /* the number of bits required to represent a number */
        int fracbits; /* the number of bits of rbps that comprise the fractional part */
 
        FLAC__ASSERT(sizeof(rbps) == sizeof(FLAC__fixedpoint));
@@ -105,7 +105,7 @@ static FLAC__fixedpoint local__compute_rbps_integerized(FLAC__uint32 err, FLAC__
                }
        }
 
-       rbps = FLAC__fixedpoint_log2(rbps, fracbits, (unsigned)(-1));
+       rbps = FLAC__fixedpoint_log2(rbps, fracbits, (uint32_t)(-1));
 
        if(rbps == 0)
                return 0;
@@ -136,7 +136,7 @@ static FLAC__fixedpoint local__compute_rbps_integerized(FLAC__uint32 err, FLAC__
 static FLAC__fixedpoint local__compute_rbps_wide_integerized(FLAC__uint64 err, FLAC__uint32 n)
 {
        FLAC__uint32 rbps;
-       unsigned bits; /* the number of bits required to represent a number */
+       uint32_t bits; /* the number of bits required to represent a number */
        int fracbits; /* the number of bits of rbps that comprise the fractional part */
 
        FLAC__ASSERT(sizeof(rbps) == sizeof(FLAC__fixedpoint));
@@ -184,7 +184,7 @@ static FLAC__fixedpoint local__compute_rbps_wide_integerized(FLAC__uint64 err, F
                }
        }
 
-       rbps = FLAC__fixedpoint_log2(rbps, fracbits, (unsigned)(-1));
+       rbps = FLAC__fixedpoint_log2(rbps, fracbits, (uint32_t)(-1));
 
        if(rbps == 0)
                return 0;
@@ -214,9 +214,9 @@ static FLAC__fixedpoint local__compute_rbps_wide_integerized(FLAC__uint64 err, F
 #endif
 
 #ifndef FLAC__INTEGER_ONLY_LIBRARY
-unsigned FLAC__fixed_compute_best_predictor(const FLAC__int32 data[], unsigned data_len, float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1])
+uint32_t FLAC__fixed_compute_best_predictor(const FLAC__int32 data[], uint32_t data_len, float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1])
 #else
-unsigned FLAC__fixed_compute_best_predictor(const FLAC__int32 data[], unsigned data_len, FLAC__fixedpoint residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1])
+uint32_t FLAC__fixed_compute_best_predictor(const FLAC__int32 data[], uint32_t data_len, FLAC__fixedpoint residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1])
 #endif
 {
        FLAC__int32 last_error_0 = data[-1];
@@ -225,7 +225,7 @@ unsigned FLAC__fixed_compute_best_predictor(const FLAC__int32 data[], unsigned d
        FLAC__int32 last_error_3 = last_error_2 - (data[-2] - 2*data[-3] + data[-4]);
        FLAC__int32 error, save;
        FLAC__uint32 total_error_0 = 0, total_error_1 = 0, total_error_2 = 0, total_error_3 = 0, total_error_4 = 0;
-       unsigned i, order;
+       uint32_t i, order;
 
        for(i = 0; i < data_len; i++) {
                error  = data[i]     ; total_error_0 += local_abs(error);                      save = error;
@@ -272,9 +272,9 @@ unsigned FLAC__fixed_compute_best_predictor(const FLAC__int32 data[], unsigned d
 }
 
 #ifndef FLAC__INTEGER_ONLY_LIBRARY
-unsigned FLAC__fixed_compute_best_predictor_wide(const FLAC__int32 data[], unsigned data_len, float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1])
+uint32_t FLAC__fixed_compute_best_predictor_wide(const FLAC__int32 data[], uint32_t data_len, float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1])
 #else
-unsigned FLAC__fixed_compute_best_predictor_wide(const FLAC__int32 data[], unsigned data_len, FLAC__fixedpoint residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1])
+uint32_t FLAC__fixed_compute_best_predictor_wide(const FLAC__int32 data[], uint32_t data_len, FLAC__fixedpoint residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1])
 #endif
 {
        FLAC__int32 last_error_0 = data[-1];
@@ -287,7 +287,7 @@ unsigned FLAC__fixed_compute_best_predictor_wide(const FLAC__int32 data[], unsig
         * large.
         */
        FLAC__uint64 total_error_0 = 0, total_error_1 = 0, total_error_2 = 0, total_error_3 = 0, total_error_4 = 0;
-       unsigned i, order;
+       uint32_t i, order;
 
        for(i = 0; i < data_len; i++) {
                error  = data[i]     ; total_error_0 += local_abs(error);                      save = error;
@@ -333,7 +333,7 @@ unsigned FLAC__fixed_compute_best_predictor_wide(const FLAC__int32 data[], unsig
        return order;
 }
 
-void FLAC__fixed_compute_residual(const FLAC__int32 data[], unsigned data_len, unsigned order, FLAC__int32 residual[])
+void FLAC__fixed_compute_residual(const FLAC__int32 data[], uint32_t data_len, uint32_t order, FLAC__int32 residual[])
 {
        const int idata_len = (int)data_len;
        int i;
@@ -364,7 +364,7 @@ void FLAC__fixed_compute_residual(const FLAC__int32 data[], unsigned data_len, u
        }
 }
 
-void FLAC__fixed_restore_signal(const FLAC__int32 residual[], unsigned data_len, unsigned order, FLAC__int32 data[])
+void FLAC__fixed_restore_signal(const FLAC__int32 residual[], uint32_t data_len, uint32_t order, FLAC__int32 data[])
 {
        int i, idata_len = (int)data_len;
 
index 6a9b4dd..47258e9 100644 (file)
 #endif
 
 FLAC__SSE_TARGET("sse2")
-unsigned FLAC__fixed_compute_best_predictor_intrin_sse2(const FLAC__int32 data[], unsigned data_len, float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER + 1])
+uint32_t FLAC__fixed_compute_best_predictor_intrin_sse2(const FLAC__int32 data[], uint32_t data_len, float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER + 1])
 {
        FLAC__uint32 total_error_0, total_error_1, total_error_2, total_error_3, total_error_4;
-       unsigned i, order;
+       uint32_t i, order;
 
        __m128i total_err0, total_err1, total_err2;
 
@@ -152,10 +152,10 @@ unsigned FLAC__fixed_compute_best_predictor_intrin_sse2(const FLAC__int32 data[]
 }
 
 FLAC__SSE_TARGET("sse2")
-unsigned FLAC__fixed_compute_best_predictor_wide_intrin_sse2(const FLAC__int32 data[], unsigned data_len, float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER + 1])
+uint32_t FLAC__fixed_compute_best_predictor_wide_intrin_sse2(const FLAC__int32 data[], uint32_t data_len, float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER + 1])
 {
        FLAC__uint64 total_error_0, total_error_1, total_error_2, total_error_3, total_error_4;
-       unsigned i, order;
+       uint32_t i, order;
 
        __m128i total_err0, total_err1, total_err3;
 
index f4d93e8..2a61e83 100644 (file)
 #endif
 
 FLAC__SSE_TARGET("ssse3")
-unsigned FLAC__fixed_compute_best_predictor_intrin_ssse3(const FLAC__int32 data[], unsigned data_len, float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER + 1])
+uint32_t FLAC__fixed_compute_best_predictor_intrin_ssse3(const FLAC__int32 data[], uint32_t data_len, float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER + 1])
 {
        FLAC__uint32 total_error_0, total_error_1, total_error_2, total_error_3, total_error_4;
-       unsigned i, order;
+       uint32_t i, order;
 
        __m128i total_err0, total_err1, total_err2;
 
@@ -146,10 +146,10 @@ unsigned FLAC__fixed_compute_best_predictor_intrin_ssse3(const FLAC__int32 data[
 }
 
 FLAC__SSE_TARGET("ssse3")
-unsigned FLAC__fixed_compute_best_predictor_wide_intrin_ssse3(const FLAC__int32 data[], unsigned data_len, float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER + 1])
+uint32_t FLAC__fixed_compute_best_predictor_wide_intrin_ssse3(const FLAC__int32 data[], uint32_t data_len, float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER + 1])
 {
        FLAC__uint64 total_error_0, total_error_1, total_error_2, total_error_3, total_error_4;
-       unsigned i, order;
+       uint32_t i, order;
 
        __m128i total_err0, total_err1, total_err3;
 
index 25d1a78..a49a083 100644 (file)
@@ -266,7 +266,7 @@ static const FLAC__uint64 log2_lookup_wide[] = {
 };
 #endif
 
-FLAC__uint32 FLAC__fixedpoint_log2(FLAC__uint32 x, unsigned fracbits, unsigned precision)
+FLAC__uint32 FLAC__fixedpoint_log2(FLAC__uint32 x, uint32_t fracbits, uint32_t precision)
 {
        const FLAC__uint32 ONE = (1u << fracbits);
        const FLAC__uint32 *table = log2_lookup[fracbits >> 2];
index 214bd09..6caa69f 100644 (file)
@@ -50,99 +50,99 @@ FLAC_API const char *FLAC__VERSION_STRING = PACKAGE_VERSION;
 FLAC_API const char *FLAC__VENDOR_STRING = "reference libFLAC " PACKAGE_VERSION " 20170101";
 
 FLAC_API const FLAC__byte FLAC__STREAM_SYNC_STRING[4] = { 'f','L','a','C' };
-FLAC_API const unsigned FLAC__STREAM_SYNC = 0x664C6143;
-FLAC_API const unsigned FLAC__STREAM_SYNC_LEN = 32; /* bits */
+FLAC_API const uint32_t FLAC__STREAM_SYNC = 0x664C6143;
+FLAC_API const uint32_t FLAC__STREAM_SYNC_LEN = 32; /* bits */
 
-FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_MIN_BLOCK_SIZE_LEN = 16; /* bits */
-FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_MAX_BLOCK_SIZE_LEN = 16; /* bits */
-FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_MIN_FRAME_SIZE_LEN = 24; /* bits */
-FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_MAX_FRAME_SIZE_LEN = 24; /* bits */
-FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_SAMPLE_RATE_LEN = 20; /* bits */
-FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_CHANNELS_LEN = 3; /* bits */
-FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_BITS_PER_SAMPLE_LEN = 5; /* bits */
-FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_TOTAL_SAMPLES_LEN = 36; /* bits */
-FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_MD5SUM_LEN = 128; /* bits */
+FLAC_API const uint32_t FLAC__STREAM_METADATA_STREAMINFO_MIN_BLOCK_SIZE_LEN = 16; /* bits */
+FLAC_API const uint32_t FLAC__STREAM_METADATA_STREAMINFO_MAX_BLOCK_SIZE_LEN = 16; /* bits */
+FLAC_API const uint32_t FLAC__STREAM_METADATA_STREAMINFO_MIN_FRAME_SIZE_LEN = 24; /* bits */
+FLAC_API const uint32_t FLAC__STREAM_METADATA_STREAMINFO_MAX_FRAME_SIZE_LEN = 24; /* bits */
+FLAC_API const uint32_t FLAC__STREAM_METADATA_STREAMINFO_SAMPLE_RATE_LEN = 20; /* bits */
+FLAC_API const uint32_t FLAC__STREAM_METADATA_STREAMINFO_CHANNELS_LEN = 3; /* bits */
+FLAC_API const uint32_t FLAC__STREAM_METADATA_STREAMINFO_BITS_PER_SAMPLE_LEN = 5; /* bits */
+FLAC_API const uint32_t FLAC__STREAM_METADATA_STREAMINFO_TOTAL_SAMPLES_LEN = 36; /* bits */
+FLAC_API const uint32_t FLAC__STREAM_METADATA_STREAMINFO_MD5SUM_LEN = 128; /* bits */
 
-FLAC_API const unsigned FLAC__STREAM_METADATA_APPLICATION_ID_LEN = 32; /* bits */
+FLAC_API const uint32_t FLAC__STREAM_METADATA_APPLICATION_ID_LEN = 32; /* bits */
 
-FLAC_API const unsigned FLAC__STREAM_METADATA_SEEKPOINT_SAMPLE_NUMBER_LEN = 64; /* bits */
-FLAC_API const unsigned FLAC__STREAM_METADATA_SEEKPOINT_STREAM_OFFSET_LEN = 64; /* bits */
-FLAC_API const unsigned FLAC__STREAM_METADATA_SEEKPOINT_FRAME_SAMPLES_LEN = 16; /* bits */
+FLAC_API const uint32_t FLAC__STREAM_METADATA_SEEKPOINT_SAMPLE_NUMBER_LEN = 64; /* bits */
+FLAC_API const uint32_t FLAC__STREAM_METADATA_SEEKPOINT_STREAM_OFFSET_LEN = 64; /* bits */
+FLAC_API const uint32_t FLAC__STREAM_METADATA_SEEKPOINT_FRAME_SAMPLES_LEN = 16; /* bits */
 
 FLAC_API const FLAC__uint64 FLAC__STREAM_METADATA_SEEKPOINT_PLACEHOLDER = FLAC__U64L(0xffffffffffffffff);
 
-FLAC_API const unsigned FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN = 32; /* bits */
-FLAC_API const unsigned FLAC__STREAM_METADATA_VORBIS_COMMENT_NUM_COMMENTS_LEN = 32; /* bits */
-
-FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_INDEX_OFFSET_LEN = 64; /* bits */
-FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_INDEX_NUMBER_LEN = 8; /* bits */
-FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_INDEX_RESERVED_LEN = 3*8; /* bits */
-
-FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_OFFSET_LEN = 64; /* bits */
-FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_NUMBER_LEN = 8; /* bits */
-FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_ISRC_LEN = 12*8; /* bits */
-FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_TYPE_LEN = 1; /* bit */
-FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_PRE_EMPHASIS_LEN = 1; /* bit */
-FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_RESERVED_LEN = 6+13*8; /* bits */
-FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_NUM_INDICES_LEN = 8; /* bits */
-
-FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_MEDIA_CATALOG_NUMBER_LEN = 128*8; /* bits */
-FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_LEAD_IN_LEN = 64; /* bits */
-FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_IS_CD_LEN = 1; /* bit */
-FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_RESERVED_LEN = 7+258*8; /* bits */
-FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_NUM_TRACKS_LEN = 8; /* bits */
-
-FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_TYPE_LEN = 32; /* bits */
-FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_MIME_TYPE_LENGTH_LEN = 32; /* bits */
-FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_DESCRIPTION_LENGTH_LEN = 32; /* bits */
-FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_WIDTH_LEN = 32; /* bits */
-FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_HEIGHT_LEN = 32; /* bits */
-FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_DEPTH_LEN = 32; /* bits */
-FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_COLORS_LEN = 32; /* bits */
-FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_DATA_LENGTH_LEN = 32; /* bits */
-
-FLAC_API const unsigned FLAC__STREAM_METADATA_IS_LAST_LEN = 1; /* bits */
-FLAC_API const unsigned FLAC__STREAM_METADATA_TYPE_LEN = 7; /* bits */
-FLAC_API const unsigned FLAC__STREAM_METADATA_LENGTH_LEN = 24; /* bits */
-
-FLAC_API const unsigned FLAC__FRAME_HEADER_SYNC = 0x3ffe;
-FLAC_API const unsigned FLAC__FRAME_HEADER_SYNC_LEN = 14; /* bits */
-FLAC_API const unsigned FLAC__FRAME_HEADER_RESERVED_LEN = 1; /* bits */
-FLAC_API const unsigned FLAC__FRAME_HEADER_BLOCKING_STRATEGY_LEN = 1; /* bits */
-FLAC_API const unsigned FLAC__FRAME_HEADER_BLOCK_SIZE_LEN = 4; /* bits */
-FLAC_API const unsigned FLAC__FRAME_HEADER_SAMPLE_RATE_LEN = 4; /* bits */
-FLAC_API const unsigned FLAC__FRAME_HEADER_CHANNEL_ASSIGNMENT_LEN = 4; /* bits */
-FLAC_API const unsigned FLAC__FRAME_HEADER_BITS_PER_SAMPLE_LEN = 3; /* bits */
-FLAC_API const unsigned FLAC__FRAME_HEADER_ZERO_PAD_LEN = 1; /* bits */
-FLAC_API const unsigned FLAC__FRAME_HEADER_CRC_LEN = 8; /* bits */
-
-FLAC_API const unsigned FLAC__FRAME_FOOTER_CRC_LEN = 16; /* bits */
-
-FLAC_API const unsigned FLAC__ENTROPY_CODING_METHOD_TYPE_LEN = 2; /* bits */
-FLAC_API const unsigned FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ORDER_LEN = 4; /* bits */
-FLAC_API const unsigned FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_PARAMETER_LEN = 4; /* bits */
-FLAC_API const unsigned FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_PARAMETER_LEN = 5; /* bits */
-FLAC_API const unsigned FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_RAW_LEN = 5; /* bits */
-
-FLAC_API const unsigned FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER = 15; /* == (1<<FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_PARAMETER_LEN)-1 */
-FLAC_API const unsigned FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_ESCAPE_PARAMETER = 31; /* == (1<<FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_PARAMETER_LEN)-1 */
+FLAC_API const uint32_t FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN = 32; /* bits */
+FLAC_API const uint32_t FLAC__STREAM_METADATA_VORBIS_COMMENT_NUM_COMMENTS_LEN = 32; /* bits */
+
+FLAC_API const uint32_t FLAC__STREAM_METADATA_CUESHEET_INDEX_OFFSET_LEN = 64; /* bits */
+FLAC_API const uint32_t FLAC__STREAM_METADATA_CUESHEET_INDEX_NUMBER_LEN = 8; /* bits */
+FLAC_API const uint32_t FLAC__STREAM_METADATA_CUESHEET_INDEX_RESERVED_LEN = 3*8; /* bits */
+
+FLAC_API const uint32_t FLAC__STREAM_METADATA_CUESHEET_TRACK_OFFSET_LEN = 64; /* bits */
+FLAC_API const uint32_t FLAC__STREAM_METADATA_CUESHEET_TRACK_NUMBER_LEN = 8; /* bits */
+FLAC_API const uint32_t FLAC__STREAM_METADATA_CUESHEET_TRACK_ISRC_LEN = 12*8; /* bits */
+FLAC_API const uint32_t FLAC__STREAM_METADATA_CUESHEET_TRACK_TYPE_LEN = 1; /* bit */
+FLAC_API const uint32_t FLAC__STREAM_METADATA_CUESHEET_TRACK_PRE_EMPHASIS_LEN = 1; /* bit */
+FLAC_API const uint32_t FLAC__STREAM_METADATA_CUESHEET_TRACK_RESERVED_LEN = 6+13*8; /* bits */
+FLAC_API const uint32_t FLAC__STREAM_METADATA_CUESHEET_TRACK_NUM_INDICES_LEN = 8; /* bits */
+
+FLAC_API const uint32_t FLAC__STREAM_METADATA_CUESHEET_MEDIA_CATALOG_NUMBER_LEN = 128*8; /* bits */
+FLAC_API const uint32_t FLAC__STREAM_METADATA_CUESHEET_LEAD_IN_LEN = 64; /* bits */
+FLAC_API const uint32_t FLAC__STREAM_METADATA_CUESHEET_IS_CD_LEN = 1; /* bit */
+FLAC_API const uint32_t FLAC__STREAM_METADATA_CUESHEET_RESERVED_LEN = 7+258*8; /* bits */
+FLAC_API const uint32_t FLAC__STREAM_METADATA_CUESHEET_NUM_TRACKS_LEN = 8; /* bits */
+
+FLAC_API const uint32_t FLAC__STREAM_METADATA_PICTURE_TYPE_LEN = 32; /* bits */
+FLAC_API const uint32_t FLAC__STREAM_METADATA_PICTURE_MIME_TYPE_LENGTH_LEN = 32; /* bits */
+FLAC_API const uint32_t FLAC__STREAM_METADATA_PICTURE_DESCRIPTION_LENGTH_LEN = 32; /* bits */
+FLAC_API const uint32_t FLAC__STREAM_METADATA_PICTURE_WIDTH_LEN = 32; /* bits */
+FLAC_API const uint32_t FLAC__STREAM_METADATA_PICTURE_HEIGHT_LEN = 32; /* bits */
+FLAC_API const uint32_t FLAC__STREAM_METADATA_PICTURE_DEPTH_LEN = 32; /* bits */
+FLAC_API const uint32_t FLAC__STREAM_METADATA_PICTURE_COLORS_LEN = 32; /* bits */
+FLAC_API const uint32_t FLAC__STREAM_METADATA_PICTURE_DATA_LENGTH_LEN = 32; /* bits */
+
+FLAC_API const uint32_t FLAC__STREAM_METADATA_IS_LAST_LEN = 1; /* bits */
+FLAC_API const uint32_t FLAC__STREAM_METADATA_TYPE_LEN = 7; /* bits */
+FLAC_API const uint32_t FLAC__STREAM_METADATA_LENGTH_LEN = 24; /* bits */
+
+FLAC_API const uint32_t FLAC__FRAME_HEADER_SYNC = 0x3ffe;
+FLAC_API const uint32_t FLAC__FRAME_HEADER_SYNC_LEN = 14; /* bits */
+FLAC_API const uint32_t FLAC__FRAME_HEADER_RESERVED_LEN = 1; /* bits */
+FLAC_API const uint32_t FLAC__FRAME_HEADER_BLOCKING_STRATEGY_LEN = 1; /* bits */
+FLAC_API const uint32_t FLAC__FRAME_HEADER_BLOCK_SIZE_LEN = 4; /* bits */
+FLAC_API const uint32_t FLAC__FRAME_HEADER_SAMPLE_RATE_LEN = 4; /* bits */
+FLAC_API const uint32_t FLAC__FRAME_HEADER_CHANNEL_ASSIGNMENT_LEN = 4; /* bits */
+FLAC_API const uint32_t FLAC__FRAME_HEADER_BITS_PER_SAMPLE_LEN = 3; /* bits */
+FLAC_API const uint32_t FLAC__FRAME_HEADER_ZERO_PAD_LEN = 1; /* bits */
+FLAC_API const uint32_t FLAC__FRAME_HEADER_CRC_LEN = 8; /* bits */
+
+FLAC_API const uint32_t FLAC__FRAME_FOOTER_CRC_LEN = 16; /* bits */
+
+FLAC_API const uint32_t FLAC__ENTROPY_CODING_METHOD_TYPE_LEN = 2; /* bits */
+FLAC_API const uint32_t FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ORDER_LEN = 4; /* bits */
+FLAC_API const uint32_t FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_PARAMETER_LEN = 4; /* bits */
+FLAC_API const uint32_t FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_PARAMETER_LEN = 5; /* bits */
+FLAC_API const uint32_t FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_RAW_LEN = 5; /* bits */
+
+FLAC_API const uint32_t FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER = 15; /* == (1<<FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_PARAMETER_LEN)-1 */
+FLAC_API const uint32_t FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_ESCAPE_PARAMETER = 31; /* == (1<<FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_PARAMETER_LEN)-1 */
 
 FLAC_API const char * const FLAC__EntropyCodingMethodTypeString[] = {
        "PARTITIONED_RICE",
        "PARTITIONED_RICE2"
 };
 
-FLAC_API const unsigned FLAC__SUBFRAME_LPC_QLP_COEFF_PRECISION_LEN = 4; /* bits */
-FLAC_API const unsigned FLAC__SUBFRAME_LPC_QLP_SHIFT_LEN = 5; /* bits */
+FLAC_API const uint32_t FLAC__SUBFRAME_LPC_QLP_COEFF_PRECISION_LEN = 4; /* bits */
+FLAC_API const uint32_t FLAC__SUBFRAME_LPC_QLP_SHIFT_LEN = 5; /* bits */
 
-FLAC_API const unsigned FLAC__SUBFRAME_ZERO_PAD_LEN = 1; /* bits */
-FLAC_API const unsigned FLAC__SUBFRAME_TYPE_LEN = 6; /* bits */
-FLAC_API const unsigned FLAC__SUBFRAME_WASTED_BITS_FLAG_LEN = 1; /* bits */
+FLAC_API const uint32_t FLAC__SUBFRAME_ZERO_PAD_LEN = 1; /* bits */
+FLAC_API const uint32_t FLAC__SUBFRAME_TYPE_LEN = 6; /* bits */
+FLAC_API const uint32_t FLAC__SUBFRAME_WASTED_BITS_FLAG_LEN = 1; /* bits */
 
-FLAC_API const unsigned FLAC__SUBFRAME_TYPE_CONSTANT_BYTE_ALIGNED_MASK = 0x00;
-FLAC_API const unsigned FLAC__SUBFRAME_TYPE_VERBATIM_BYTE_ALIGNED_MASK = 0x02;
-FLAC_API const unsigned FLAC__SUBFRAME_TYPE_FIXED_BYTE_ALIGNED_MASK = 0x10;
-FLAC_API const unsigned FLAC__SUBFRAME_TYPE_LPC_BYTE_ALIGNED_MASK = 0x40;
+FLAC_API const uint32_t FLAC__SUBFRAME_TYPE_CONSTANT_BYTE_ALIGNED_MASK = 0x00;
+FLAC_API const uint32_t FLAC__SUBFRAME_TYPE_VERBATIM_BYTE_ALIGNED_MASK = 0x02;
+FLAC_API const uint32_t FLAC__SUBFRAME_TYPE_FIXED_BYTE_ALIGNED_MASK = 0x10;
+FLAC_API const uint32_t FLAC__SUBFRAME_TYPE_LPC_BYTE_ALIGNED_MASK = 0x40;
 
 FLAC_API const char * const FLAC__SubframeTypeString[] = {
        "CONSTANT",
@@ -197,7 +197,7 @@ FLAC_API const char * const FLAC__StreamMetadata_Picture_TypeString[] = {
        "Publisher/Studio logotype"
 };
 
-FLAC_API FLAC__bool FLAC__format_sample_rate_is_valid(unsigned sample_rate)
+FLAC_API FLAC__bool FLAC__format_sample_rate_is_valid(uint32_t sample_rate)
 {
        if(sample_rate == 0 || sample_rate > FLAC__MAX_SAMPLE_RATE) {
                return false;
@@ -206,7 +206,7 @@ FLAC_API FLAC__bool FLAC__format_sample_rate_is_valid(unsigned sample_rate)
                return true;
 }
 
-FLAC_API FLAC__bool FLAC__format_blocksize_is_subset(unsigned blocksize, unsigned sample_rate)
+FLAC_API FLAC__bool FLAC__format_blocksize_is_subset(uint32_t blocksize, uint32_t sample_rate)
 {
        if(blocksize > 16384)
                return false;
@@ -216,7 +216,7 @@ FLAC_API FLAC__bool FLAC__format_blocksize_is_subset(unsigned blocksize, unsigne
                return true;
 }
 
-FLAC_API FLAC__bool FLAC__format_sample_rate_is_subset(unsigned sample_rate)
+FLAC_API FLAC__bool FLAC__format_sample_rate_is_subset(uint32_t sample_rate)
 {
        if(
                !FLAC__format_sample_rate_is_valid(sample_rate) ||
@@ -234,7 +234,7 @@ FLAC_API FLAC__bool FLAC__format_sample_rate_is_subset(unsigned sample_rate)
 /* @@@@ add to unit tests; it is already indirectly tested by the metadata_object tests */
 FLAC_API FLAC__bool FLAC__format_seektable_is_legal(const FLAC__StreamMetadata_SeekTable *seek_table)
 {
-       unsigned i;
+       uint32_t i;
        FLAC__uint64 prev_sample_number = 0;
        FLAC__bool got_prev = false;
 
@@ -268,9 +268,9 @@ static int seekpoint_compare_(const FLAC__StreamMetadata_SeekPoint *l, const FLA
 }
 
 /* @@@@ add to unit tests; it is already indirectly tested by the metadata_object tests */
-FLAC_API unsigned FLAC__format_seektable_sort(FLAC__StreamMetadata_SeekTable *seek_table)
+FLAC_API uint32_t FLAC__format_seektable_sort(FLAC__StreamMetadata_SeekTable *seek_table)
 {
-       unsigned i, j;
+       uint32_t i, j;
        FLAC__bool first;
 
        FLAC__ASSERT(0 != seek_table);
@@ -309,7 +309,7 @@ FLAC_API unsigned FLAC__format_seektable_sort(FLAC__StreamMetadata_SeekTable *se
  * and a more clear explanation at the end of this section:
  *   http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
  */
-static unsigned utf8len_(const FLAC__byte *utf8)
+static uint32_t utf8len_(const FLAC__byte *utf8)
 {
        FLAC__ASSERT(0 != utf8);
        if ((utf8[0] & 0x80) == 0) {
@@ -359,11 +359,11 @@ FLAC_API FLAC__bool FLAC__format_vorbiscomment_entry_name_is_legal(const char *n
        return true;
 }
 
-FLAC_API FLAC__bool FLAC__format_vorbiscomment_entry_value_is_legal(const FLAC__byte *value, unsigned length)
+FLAC_API FLAC__bool FLAC__format_vorbiscomment_entry_value_is_legal(const FLAC__byte *value, uint32_t length)
 {
-       if(length == (unsigned)(-1)) {
+       if(length == (uint32_t)(-1)) {
                while(*value) {
-                       unsigned n = utf8len_(value);
+                       uint32_t n = utf8len_(value);
                        if(n == 0)
                                return false;
                        value += n;
@@ -372,7 +372,7 @@ FLAC_API FLAC__bool FLAC__format_vorbiscomment_entry_value_is_legal(const FLAC__
        else {
                const FLAC__byte *end = value + length;
                while(value < end) {
-                       unsigned n = utf8len_(value);
+                       uint32_t n = utf8len_(value);
                        if(n == 0)
                                return false;
                        value += n;
@@ -383,7 +383,7 @@ FLAC_API FLAC__bool FLAC__format_vorbiscomment_entry_value_is_legal(const FLAC__
        return true;
 }
 
-FLAC_API FLAC__bool FLAC__format_vorbiscomment_entry_is_legal(const FLAC__byte *entry, unsigned length)
+FLAC_API FLAC__bool FLAC__format_vorbiscomment_entry_is_legal(const FLAC__byte *entry, uint32_t length)
 {
        const FLAC__byte *s, *end;
 
@@ -397,7 +397,7 @@ FLAC_API FLAC__bool FLAC__format_vorbiscomment_entry_is_legal(const FLAC__byte *
        s++; /* skip '=' */
 
        while(s < end) {
-               unsigned n = utf8len_(s);
+               uint32_t n = utf8len_(s);
                if(n == 0)
                        return false;
                s += n;
@@ -411,7 +411,7 @@ FLAC_API FLAC__bool FLAC__format_vorbiscomment_entry_is_legal(const FLAC__byte *
 /* @@@@ add to unit tests; it is already indirectly tested by the metadata_object tests */
 FLAC_API FLAC__bool FLAC__format_cuesheet_is_legal(const FLAC__StreamMetadata_CueSheet *cue_sheet, FLAC__bool check_cd_da_subset, const char **violation)
 {
-       unsigned i, j;
+       uint32_t i, j;
 
        if(check_cd_da_subset) {
                if(cue_sheet->lead_in < 2 * 44100) {
@@ -501,7 +501,7 @@ FLAC_API FLAC__bool FLAC__format_picture_is_legal(const FLAC__StreamMetadata_Pic
        }
 
        for(b = picture->description; *b; ) {
-               unsigned n = utf8len_(b);
+               uint32_t n = utf8len_(b);
                if(n == 0) {
                        if(violation) *violation = "description string must be valid UTF-8";
                        return false;
@@ -515,7 +515,7 @@ FLAC_API FLAC__bool FLAC__format_picture_is_legal(const FLAC__StreamMetadata_Pic
 /*
  * These routines are private to libFLAC
  */
-unsigned FLAC__format_get_max_rice_partition_order(unsigned blocksize, unsigned predictor_order)
+uint32_t FLAC__format_get_max_rice_partition_order(uint32_t blocksize, uint32_t predictor_order)
 {
        return
                FLAC__format_get_max_rice_partition_order_from_blocksize_limited_max_and_predictor_order(
@@ -525,9 +525,9 @@ unsigned FLAC__format_get_max_rice_partition_order(unsigned blocksize, unsigned
                );
 }
 
-unsigned FLAC__format_get_max_rice_partition_order_from_blocksize(unsigned blocksize)
+uint32_t FLAC__format_get_max_rice_partition_order_from_blocksize(uint32_t blocksize)
 {
-       unsigned max_rice_partition_order = 0;
+       uint32_t max_rice_partition_order = 0;
        while(!(blocksize & 1)) {
                max_rice_partition_order++;
                blocksize >>= 1;
@@ -535,9 +535,9 @@ unsigned FLAC__format_get_max_rice_partition_order_from_blocksize(unsigned block
        return flac_min(FLAC__MAX_RICE_PARTITION_ORDER, max_rice_partition_order);
 }
 
-unsigned FLAC__format_get_max_rice_partition_order_from_blocksize_limited_max_and_predictor_order(unsigned limit, unsigned blocksize, unsigned predictor_order)
+uint32_t FLAC__format_get_max_rice_partition_order_from_blocksize_limited_max_and_predictor_order(uint32_t limit, uint32_t blocksize, uint32_t predictor_order)
 {
-       unsigned max_rice_partition_order = limit;
+       uint32_t max_rice_partition_order = limit;
 
        while(max_rice_partition_order > 0 && (blocksize >> max_rice_partition_order) <= predictor_order)
                max_rice_partition_order--;
@@ -570,18 +570,18 @@ void FLAC__format_entropy_coding_method_partitioned_rice_contents_clear(FLAC__En
        FLAC__format_entropy_coding_method_partitioned_rice_contents_init(object);
 }
 
-FLAC__bool FLAC__format_entropy_coding_method_partitioned_rice_contents_ensure_size(FLAC__EntropyCodingMethod_PartitionedRiceContents *object, unsigned max_partition_order)
+FLAC__bool FLAC__format_entropy_coding_method_partitioned_rice_contents_ensure_size(FLAC__EntropyCodingMethod_PartitionedRiceContents *object, uint32_t max_partition_order)
 {
        FLAC__ASSERT(0 != object);
 
        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 = safe_realloc_(object->parameters, sizeof(unsigned)*(1 << max_partition_order))))
+               if(0 == (object->parameters = safe_realloc_(object->parameters, sizeof(uint32_t)*(1 << max_partition_order))))
                        return false;
-               if(0 == (object->raw_bits = safe_realloc_(object->raw_bits, sizeof(unsigned)*(1 << max_partition_order))))
+               if(0 == (object->raw_bits = safe_realloc_(object->raw_bits, sizeof(uint32_t)*(1 << max_partition_order))))
                        return false;
-               memset(object->raw_bits, 0, sizeof(unsigned)*(1 << max_partition_order));
+               memset(object->raw_bits, 0, sizeof(uint32_t)*(1 << max_partition_order));
                object->capacity_by_order = max_partition_order;
        }
 
index 9c75f85..0d0a9c8 100644 (file)
@@ -43,9 +43,9 @@
 #endif
 
 /* Will never be emitted for MSVC, GCC, Intel compilers */
-static inline unsigned int FLAC__clz_soft_uint32(FLAC__uint32 word)
+static inline uint32_t FLAC__clz_soft_uint32(FLAC__uint32 word)
 {
-       static const unsigned char byte_to_unary_table[] = {
+       static const uint8_t byte_to_unary_table[] = {
        8, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4,
        3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
        2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -70,7 +70,7 @@ static inline unsigned int FLAC__clz_soft_uint32(FLAC__uint32 word)
                byte_to_unary_table[word] + 24;
 }
 
-static inline unsigned int FLAC__clz_uint32(FLAC__uint32 v)
+static inline uint32_t FLAC__clz_uint32(FLAC__uint32 v)
 {
 /* Never used with input 0 */
        FLAC__ASSERT(v > 0);
@@ -82,7 +82,7 @@ static inline unsigned int FLAC__clz_uint32(FLAC__uint32 v)
        return __builtin_clz(v);
 #elif defined(_MSC_VER)
        {
-               unsigned long idx;
+               uint32_t long idx;
                _BitScanReverse(&idx, v);
                return idx ^ 31U;
        }
@@ -92,13 +92,13 @@ static inline unsigned int FLAC__clz_uint32(FLAC__uint32 v)
 }
 
 /* Used when 64-bit bsr/clz is unavailable; can use 32-bit bsr/clz when possible */
-static inline unsigned int FLAC__clz_soft_uint64(FLAC__uint64 word)
+static inline uint32_t FLAC__clz_soft_uint64(FLAC__uint64 word)
 {
        return (FLAC__uint32)(word>>32) ? FLAC__clz_uint32((FLAC__uint32)(word>>32)) :
                FLAC__clz_uint32((FLAC__uint32)word) + 32;
 }
 
-static inline unsigned int FLAC__clz_uint64(FLAC__uint64 v)
+static inline uint32_t FLAC__clz_uint64(FLAC__uint64 v)
 {
        /* Never used with input 0 */
        FLAC__ASSERT(v > 0);
@@ -106,7 +106,7 @@ static inline unsigned int FLAC__clz_uint64(FLAC__uint64 v)
        return __builtin_clzll(v);
 #elif (defined(__INTEL_COMPILER) || defined(_MSC_VER)) && (defined(_M_IA64) || defined(_M_X64))
        {
-               unsigned long idx;
+               uint32_t long idx;
                _BitScanReverse64(&idx, v);
                return idx ^ 63U;
        }
@@ -116,14 +116,14 @@ static inline unsigned int FLAC__clz_uint64(FLAC__uint64 v)
 }
 
 /* These two functions work with input 0 */
-static inline unsigned int FLAC__clz2_uint32(FLAC__uint32 v)
+static inline uint32_t FLAC__clz2_uint32(FLAC__uint32 v)
 {
        if (!v)
                return 32;
        return FLAC__clz_uint32(v);
 }
 
-static inline unsigned int FLAC__clz2_uint64(FLAC__uint64 v)
+static inline uint32_t FLAC__clz2_uint64(FLAC__uint64 v)
 {
        if (!v)
                return 64;
@@ -153,14 +153,14 @@ static inline unsigned int FLAC__clz2_uint64(FLAC__uint64 v)
  * ilog2(18) = 4
  */
 
-static inline unsigned FLAC__bitmath_ilog2(FLAC__uint32 v)
+static inline uint32_t FLAC__bitmath_ilog2(FLAC__uint32 v)
 {
        FLAC__ASSERT(v > 0);
 #if defined(__INTEL_COMPILER)
        return _bit_scan_reverse(v);
 #elif defined(_MSC_VER)
        {
-               unsigned long idx;
+               uint32_t long idx;
                _BitScanReverse(&idx, v);
                return idx;
        }
@@ -169,7 +169,7 @@ static inline unsigned FLAC__bitmath_ilog2(FLAC__uint32 v)
 #endif
 }
 
-static inline unsigned FLAC__bitmath_ilog2_wide(FLAC__uint64 v)
+static inline uint32_t FLAC__bitmath_ilog2_wide(FLAC__uint64 v)
 {
        FLAC__ASSERT(v > 0);
 #if defined(__GNUC__) && (__GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
@@ -177,7 +177,7 @@ static inline unsigned FLAC__bitmath_ilog2_wide(FLAC__uint64 v)
 /* Sorry, only supported in x64/Itanium.. and both have fast FPU which makes integer-only encoder pointless */
 #elif (defined(__INTEL_COMPILER) || defined(_MSC_VER)) && (defined(_M_IA64) || defined(_M_X64))
        {
-               unsigned long idx;
+               uint32_t long idx;
                _BitScanReverse64(&idx, v);
                return idx;
        }
@@ -187,7 +187,7 @@ static inline unsigned FLAC__bitmath_ilog2_wide(FLAC__uint64 v)
        (C) Timothy B. Terriberry (tterribe@xiph.org) 2001-2009 CC0 (Public domain).
 */
        {
-               static const unsigned char DEBRUIJN_IDX64[64]={
+               static const uint8_t DEBRUIJN_IDX64[64]={
                        0, 1, 2, 7, 3,13, 8,19, 4,25,14,28, 9,34,20,40,
                        5,17,26,38,15,46,29,48,10,31,35,54,21,50,41,57,
                        63, 6,12,18,24,27,33,39,16,37,45,47,30,53,49,56,
@@ -205,6 +205,6 @@ static inline unsigned FLAC__bitmath_ilog2_wide(FLAC__uint64 v)
 #endif
 }
 
-unsigned FLAC__bitmath_silog2(FLAC__int64 v);
+uint32_t FLAC__bitmath_silog2(FLAC__int64 v);
 
 #endif
index 7c73165..81e585a 100644 (file)
@@ -65,27 +65,27 @@ FLAC__uint16 FLAC__bitreader_get_read_crc16(FLAC__BitReader *br);
  * info functions
  */
 FLAC__bool FLAC__bitreader_is_consumed_byte_aligned(const FLAC__BitReader *br);
-unsigned FLAC__bitreader_bits_left_for_byte_alignment(const FLAC__BitReader *br);
-unsigned FLAC__bitreader_get_input_bits_unconsumed(const FLAC__BitReader *br);
+uint32_t FLAC__bitreader_bits_left_for_byte_alignment(const FLAC__BitReader *br);
+uint32_t FLAC__bitreader_get_input_bits_unconsumed(const FLAC__BitReader *br);
 
 /*
  * read functions
  */
 
-FLAC__bool FLAC__bitreader_read_raw_uint32(FLAC__BitReader *br, FLAC__uint32 *val, unsigned bits);
-FLAC__bool FLAC__bitreader_read_raw_int32(FLAC__BitReader *br, FLAC__int32 *val, unsigned bits);
-FLAC__bool FLAC__bitreader_read_raw_uint64(FLAC__BitReader *br, FLAC__uint64 *val, unsigned bits);
+FLAC__bool FLAC__bitreader_read_raw_uint32(FLAC__BitReader *br, FLAC__uint32 *val, uint32_t bits);
+FLAC__bool FLAC__bitreader_read_raw_int32(FLAC__BitReader *br, FLAC__int32 *val, uint32_t bits);
+FLAC__bool FLAC__bitreader_read_raw_uint64(FLAC__BitReader *br, FLAC__uint64 *val, uint32_t bits);
 FLAC__bool FLAC__bitreader_read_uint32_little_endian(FLAC__BitReader *br, FLAC__uint32 *val); /*only for bits=32*/
-FLAC__bool FLAC__bitreader_skip_bits_no_crc(FLAC__BitReader *br, unsigned bits); /* WATCHOUT: does not CRC the skipped data! */ /*@@@@ add to unit tests */
-FLAC__bool FLAC__bitreader_skip_byte_block_aligned_no_crc(FLAC__BitReader *br, unsigned nvals); /* WATCHOUT: does not CRC the read data! */
-FLAC__bool FLAC__bitreader_read_byte_block_aligned_no_crc(FLAC__BitReader *br, FLAC__byte *val, unsigned nvals); /* WATCHOUT: does not CRC the read data! */
-FLAC__bool FLAC__bitreader_read_unary_unsigned(FLAC__BitReader *br, unsigned *val);
-FLAC__bool FLAC__bitreader_read_rice_signed(FLAC__BitReader *br, int *val, unsigned parameter);
-FLAC__bool FLAC__bitreader_read_rice_signed_block(FLAC__BitReader *br, int vals[], unsigned nvals, unsigned parameter);
+FLAC__bool FLAC__bitreader_skip_bits_no_crc(FLAC__BitReader *br, uint32_t bits); /* WATCHOUT: does not CRC the skipped data! */ /*@@@@ add to unit tests */
+FLAC__bool FLAC__bitreader_skip_byte_block_aligned_no_crc(FLAC__BitReader *br, uint32_t nvals); /* WATCHOUT: does not CRC the read data! */
+FLAC__bool FLAC__bitreader_read_byte_block_aligned_no_crc(FLAC__BitReader *br, FLAC__byte *val, uint32_t nvals); /* WATCHOUT: does not CRC the read data! */
+FLAC__bool FLAC__bitreader_read_unary_unsigned(FLAC__BitReader *br, uint32_t *val);
+FLAC__bool FLAC__bitreader_read_rice_signed(FLAC__BitReader *br, int *val, uint32_t parameter);
+FLAC__bool FLAC__bitreader_read_rice_signed_block(FLAC__BitReader *br, int vals[], uint32_t nvals, uint32_t parameter);
 #if 0 /* UNUSED */
-FLAC__bool FLAC__bitreader_read_golomb_signed(FLAC__BitReader *br, int *val, unsigned parameter);
-FLAC__bool FLAC__bitreader_read_golomb_unsigned(FLAC__BitReader *br, unsigned *val, unsigned parameter);
+FLAC__bool FLAC__bitreader_read_golomb_signed(FLAC__BitReader *br, int *val, uint32_t parameter);
+FLAC__bool FLAC__bitreader_read_golomb_uint32_t(FLAC__BitReader *br, uint32_t *val, uint32_t parameter);
 #endif
-FLAC__bool FLAC__bitreader_read_utf8_uint32(FLAC__BitReader *br, FLAC__uint32 *val, FLAC__byte *raw, unsigned *rawlen);
-FLAC__bool FLAC__bitreader_read_utf8_uint64(FLAC__BitReader *br, FLAC__uint64 *val, FLAC__byte *raw, unsigned *rawlen);
+FLAC__bool FLAC__bitreader_read_utf8_uint32(FLAC__BitReader *br, FLAC__uint32 *val, FLAC__byte *raw, uint32_t *rawlen);
+FLAC__bool FLAC__bitreader_read_utf8_uint64(FLAC__BitReader *br, FLAC__uint64 *val, FLAC__byte *raw, uint32_t *rawlen);
 #endif
index ef3ad1b..d1aa094 100644 (file)
@@ -64,7 +64,7 @@ FLAC__bool FLAC__bitwriter_get_write_crc8(FLAC__BitWriter *bw, FLAC__byte *crc);
  * info functions
  */
 FLAC__bool FLAC__bitwriter_is_byte_aligned(const FLAC__BitWriter *bw);
-unsigned FLAC__bitwriter_get_input_bits_unconsumed(const FLAC__BitWriter *bw); /* can be called anytime, returns total # of bits unconsumed */
+uint32_t FLAC__bitwriter_get_input_bits_unconsumed(const FLAC__BitWriter *bw); /* can be called anytime, returns total # of bits unconsumed */
 
 /*
  * direct buffer access
@@ -79,23 +79,23 @@ void FLAC__bitwriter_release_buffer(FLAC__BitWriter *bw);
 /*
  * write functions
  */
-FLAC__bool FLAC__bitwriter_write_zeroes(FLAC__BitWriter *bw, unsigned bits);
-FLAC__bool FLAC__bitwriter_write_raw_uint32(FLAC__BitWriter *bw, FLAC__uint32 val, unsigned bits);
-FLAC__bool FLAC__bitwriter_write_raw_int32(FLAC__BitWriter *bw, FLAC__int32 val, unsigned bits);
-FLAC__bool FLAC__bitwriter_write_raw_uint64(FLAC__BitWriter *bw, FLAC__uint64 val, unsigned bits);
+FLAC__bool FLAC__bitwriter_write_zeroes(FLAC__BitWriter *bw, uint32_t bits);
+FLAC__bool FLAC__bitwriter_write_raw_uint32(FLAC__BitWriter *bw, FLAC__uint32 val, uint32_t bits);
+FLAC__bool FLAC__bitwriter_write_raw_int32(FLAC__BitWriter *bw, FLAC__int32 val, uint32_t bits);
+FLAC__bool FLAC__bitwriter_write_raw_uint64(FLAC__BitWriter *bw, FLAC__uint64 val, uint32_t bits);
 FLAC__bool FLAC__bitwriter_write_raw_uint32_little_endian(FLAC__BitWriter *bw, FLAC__uint32 val); /*only for bits=32*/
-FLAC__bool FLAC__bitwriter_write_byte_block(FLAC__BitWriter *bw, const FLAC__byte vals[], unsigned nvals);
-FLAC__bool FLAC__bitwriter_write_unary_unsigned(FLAC__BitWriter *bw, unsigned val);
-unsigned FLAC__bitwriter_rice_bits(FLAC__int32 val, unsigned parameter);
+FLAC__bool FLAC__bitwriter_write_byte_block(FLAC__BitWriter *bw, const FLAC__byte vals[], uint32_t nvals);
+FLAC__bool FLAC__bitwriter_write_unary_unsigned(FLAC__BitWriter *bw, uint32_t val);
+uint32_t FLAC__bitwriter_rice_bits(FLAC__int32 val, uint32_t parameter);
 #if 0 /* UNUSED */
-unsigned FLAC__bitwriter_golomb_bits_signed(int val, unsigned parameter);
-unsigned FLAC__bitwriter_golomb_bits_unsigned(unsigned val, unsigned parameter);
+uint32_t FLAC__bitwriter_golomb_bits_signed(int val, uint32_t parameter);
+uint32_t FLAC__bitwriter_golomb_bits_uint32_t(uint32_t val, uint32_t parameter);
 #endif
-FLAC__bool FLAC__bitwriter_write_rice_signed(FLAC__BitWriter *bw, FLAC__int32 val, unsigned parameter);
-FLAC__bool FLAC__bitwriter_write_rice_signed_block(FLAC__BitWriter *bw, const FLAC__int32 *vals, unsigned nvals, unsigned parameter);
+FLAC__bool FLAC__bitwriter_write_rice_signed(FLAC__BitWriter *bw, FLAC__int32 val, uint32_t parameter);
+FLAC__bool FLAC__bitwriter_write_rice_signed_block(FLAC__BitWriter *bw, const FLAC__int32 *vals, uint32_t nvals, uint32_t parameter);
 #if 0 /* UNUSED */
-FLAC__bool FLAC__bitwriter_write_golomb_signed(FLAC__BitWriter *bw, int val, unsigned parameter);
-FLAC__bool FLAC__bitwriter_write_golomb_unsigned(FLAC__BitWriter *bw, unsigned val, unsigned parameter);
+FLAC__bool FLAC__bitwriter_write_golomb_signed(FLAC__BitWriter *bw, int val, uint32_t parameter);
+FLAC__bool FLAC__bitwriter_write_golomb_uint32_t(FLAC__BitWriter *bw, uint32_t val, uint32_t parameter);
 #endif
 FLAC__bool FLAC__bitwriter_write_utf8_uint32(FLAC__BitWriter *bw, FLAC__uint32 val);
 FLAC__bool FLAC__bitwriter_write_utf8_uint64(FLAC__BitWriter *bw, FLAC__uint64 val);
index 294f60e..f783dcc 100644 (file)
 extern FLAC__byte const FLAC__crc8_table[256];
 #define FLAC__CRC8_UPDATE(data, crc) (crc) = FLAC__crc8_table[(crc) ^ (data)];
 void FLAC__crc8_update(const FLAC__byte data, FLAC__uint8 *crc);
-void FLAC__crc8_update_block(const FLAC__byte *data, unsigned len, FLAC__uint8 *crc);
-FLAC__uint8 FLAC__crc8(const FLAC__byte *data, unsigned len);
+void FLAC__crc8_update_block(const FLAC__byte *data, uint32_t len, FLAC__uint8 *crc);
+FLAC__uint8 FLAC__crc8(const FLAC__byte *data, uint32_t len);
 
 /* 16 bit CRC generator, MSB shifted first
 ** polynomial = x^16 + x^15 + x^2 + x^0
 ** init = 0
 */
-extern unsigned const FLAC__crc16_table[256];
+extern uint32_t const FLAC__crc16_table[256];
 
 #define FLAC__CRC16_UPDATE(data, crc) ((((crc)<<8) & 0xffff) ^ FLAC__crc16_table[((crc)>>8) ^ (data)])
 /* this alternate may be faster on some systems/compilers */
@@ -57,6 +57,6 @@ extern unsigned const FLAC__crc16_table[256];
 #define FLAC__CRC16_UPDATE(data, crc) ((((crc)<<8) ^ FLAC__crc16_table[((crc)>>8) ^ (data)]) & 0xffff)
 #endif
 
-unsigned FLAC__crc16(const FLAC__byte *data, unsigned len);
+uint32_t FLAC__crc16(const FLAC__byte *data, uint32_t len);
 
 #endif
index 68cdfce..9edf0ab 100644 (file)
  *     OUT residual_bits_per_sample[0,FLAC__MAX_FIXED_ORDER]
  */
 #ifndef FLAC__INTEGER_ONLY_LIBRARY
-unsigned FLAC__fixed_compute_best_predictor(const FLAC__int32 data[], unsigned data_len, float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]);
-unsigned FLAC__fixed_compute_best_predictor_wide(const FLAC__int32 data[], unsigned data_len, float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]);
+uint32_t FLAC__fixed_compute_best_predictor(const FLAC__int32 data[], uint32_t data_len, float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]);
+uint32_t FLAC__fixed_compute_best_predictor_wide(const FLAC__int32 data[], uint32_t data_len, float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]);
 # ifndef FLAC__NO_ASM
 #  if (defined FLAC__CPU_IA32 || defined FLAC__CPU_X86_64) && FLAC__HAS_X86INTRIN
 #   ifdef FLAC__SSE2_SUPPORTED
-unsigned FLAC__fixed_compute_best_predictor_intrin_sse2(const FLAC__int32 data[], unsigned data_len, float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER + 1]);
-unsigned FLAC__fixed_compute_best_predictor_wide_intrin_sse2(const FLAC__int32 data[], unsigned data_len, float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER + 1]);
+uint32_t FLAC__fixed_compute_best_predictor_intrin_sse2(const FLAC__int32 data[], uint32_t data_len, float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER + 1]);
+uint32_t FLAC__fixed_compute_best_predictor_wide_intrin_sse2(const FLAC__int32 data[], uint32_t data_len, float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER + 1]);
 #   endif
 #   ifdef FLAC__SSSE3_SUPPORTED
-unsigned FLAC__fixed_compute_best_predictor_intrin_ssse3(const FLAC__int32 data[], unsigned data_len, float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]);
-unsigned FLAC__fixed_compute_best_predictor_wide_intrin_ssse3(const FLAC__int32 data[], unsigned data_len, float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER + 1]);
+uint32_t FLAC__fixed_compute_best_predictor_intrin_ssse3(const FLAC__int32 data[], uint32_t data_len, float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]);
+uint32_t FLAC__fixed_compute_best_predictor_wide_intrin_ssse3(const FLAC__int32 data[], uint32_t data_len, float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER + 1]);
 #   endif
 #  endif
 #  if defined FLAC__CPU_IA32 && defined FLAC__HAS_NASM
-unsigned FLAC__fixed_compute_best_predictor_asm_ia32_mmx_cmov(const FLAC__int32 data[], unsigned data_len, float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]);
+uint32_t FLAC__fixed_compute_best_predictor_asm_ia32_mmx_cmov(const FLAC__int32 data[], uint32_t data_len, float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]);
 #  endif
 # endif
 #else
-unsigned FLAC__fixed_compute_best_predictor(const FLAC__int32 data[], unsigned data_len, FLAC__fixedpoint residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]);
-unsigned FLAC__fixed_compute_best_predictor_wide(const FLAC__int32 data[], unsigned data_len, FLAC__fixedpoint residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]);
+uint32_t FLAC__fixed_compute_best_predictor(const FLAC__int32 data[], uint32_t data_len, FLAC__fixedpoint residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]);
+uint32_t FLAC__fixed_compute_best_predictor_wide(const FLAC__int32 data[], uint32_t data_len, FLAC__fixedpoint residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]);
 #endif
 
 /*
@@ -87,7 +87,7 @@ unsigned FLAC__fixed_compute_best_predictor_wide(const FLAC__int32 data[], unsig
  *     IN order <= FLAC__MAX_FIXED_ORDER fixed-predictor order
  *     OUT residual[0,data_len-1]        residual signal
  */
-void FLAC__fixed_compute_residual(const FLAC__int32 data[], unsigned data_len, unsigned order, FLAC__int32 residual[]);
+void FLAC__fixed_compute_residual(const FLAC__int32 data[], uint32_t data_len, uint32_t order, FLAC__int32 residual[]);
 
 /*
  *     FLAC__fixed_restore_signal()
@@ -102,6 +102,6 @@ void FLAC__fixed_compute_residual(const FLAC__int32 data[], unsigned data_len, u
  *     IN  data[-order,-1]               previously-reconstructed historical samples
  *     OUT data[0,data_len-1]            original signal
  */
-void FLAC__fixed_restore_signal(const FLAC__int32 residual[], unsigned data_len, unsigned order, FLAC__int32 data[]);
+void FLAC__fixed_restore_signal(const FLAC__int32 residual[], uint32_t data_len, uint32_t order, FLAC__int32 data[]);
 
 #endif
index 12ece60..cb32da4 100644 (file)
@@ -81,14 +81,14 @@ extern const FLAC__fixedpoint FLAC__FP_E;
  *     be < 32 and evenly divisible by 4 (0 is OK but not very precise).
  *
  *     'precision' roughly limits the number of iterations that are done;
- *     use (unsigned)(-1) for maximum precision.
+ *     use (uint32_t)(-1) for maximum precision.
  *
  *     If 'x' is less than one -- that is, x < (1<<fracbits) -- then this
  *     function will punt and return 0.
  *
  *     The return value will also have 'fracbits' fractional bits.
  */
-FLAC__uint32 FLAC__fixedpoint_log2(FLAC__uint32 x, unsigned fracbits, unsigned precision);
+FLAC__uint32 FLAC__fixedpoint_log2(FLAC__uint32 x, uint32_t fracbits, uint32_t precision);
 
 #endif
 
index 5b9cfbd..8f28017 100644 (file)
 
 #include "FLAC/format.h"
 
-unsigned FLAC__format_get_max_rice_partition_order(unsigned blocksize, unsigned predictor_order);
-unsigned FLAC__format_get_max_rice_partition_order_from_blocksize(unsigned blocksize);
-unsigned FLAC__format_get_max_rice_partition_order_from_blocksize_limited_max_and_predictor_order(unsigned limit, unsigned blocksize, unsigned predictor_order);
+uint32_t FLAC__format_get_max_rice_partition_order(uint32_t blocksize, uint32_t predictor_order);
+uint32_t FLAC__format_get_max_rice_partition_order_from_blocksize(uint32_t blocksize);
+uint32_t FLAC__format_get_max_rice_partition_order_from_blocksize_limited_max_and_predictor_order(uint32_t limit, uint32_t blocksize, uint32_t predictor_order);
 void FLAC__format_entropy_coding_method_partitioned_rice_contents_init(FLAC__EntropyCodingMethod_PartitionedRiceContents *object);
 void FLAC__format_entropy_coding_method_partitioned_rice_contents_clear(FLAC__EntropyCodingMethod_PartitionedRiceContents *object);
-FLAC__bool FLAC__format_entropy_coding_method_partitioned_rice_contents_ensure_size(FLAC__EntropyCodingMethod_PartitionedRiceContents *object, unsigned max_partition_order);
+FLAC__bool FLAC__format_entropy_coding_method_partitioned_rice_contents_ensure_size(FLAC__EntropyCodingMethod_PartitionedRiceContents *object, uint32_t max_partition_order);
 
 #endif
index 6eb02be..29c7ac3 100644 (file)
@@ -54,7 +54,7 @@
  *     OUT out[0,lag-1]
  *     IN data_len
  */
-void FLAC__lpc_window_data(const FLAC__int32 in[], const FLAC__real window[], FLAC__real out[], unsigned data_len);
+void FLAC__lpc_window_data(const FLAC__int32 in[], const FLAC__real window[], FLAC__real out[], uint32_t data_len);
 
 /*
  *     FLAC__lpc_compute_autocorrelation()
@@ -68,27 +68,27 @@ void FLAC__lpc_window_data(const FLAC__int32 in[], const FLAC__real window[], FL
  *     IN 0 < lag <= data_len
  *     OUT autoc[0,lag-1]
  */
-void FLAC__lpc_compute_autocorrelation(const FLAC__real data[], unsigned data_len, unsigned lag, FLAC__real autoc[]);
+void FLAC__lpc_compute_autocorrelation(const FLAC__real data[], uint32_t data_len, uint32_t lag, FLAC__real autoc[]);
 #ifndef FLAC__NO_ASM
 #  ifdef FLAC__CPU_IA32
 #    ifdef FLAC__HAS_NASM
-void FLAC__lpc_compute_autocorrelation_asm_ia32(const FLAC__real data[], unsigned data_len, unsigned lag, FLAC__real autoc[]);
-void FLAC__lpc_compute_autocorrelation_asm_ia32_sse_lag_4_old(const FLAC__real data[], unsigned data_len, unsigned lag, FLAC__real autoc[]);
-void FLAC__lpc_compute_autocorrelation_asm_ia32_sse_lag_8_old(const FLAC__real data[], unsigned data_len, unsigned lag, FLAC__real autoc[]);
-void FLAC__lpc_compute_autocorrelation_asm_ia32_sse_lag_12_old(const FLAC__real data[], unsigned data_len, unsigned lag, FLAC__real autoc[]);
-void FLAC__lpc_compute_autocorrelation_asm_ia32_sse_lag_16_old(const FLAC__real data[], unsigned data_len, unsigned lag, FLAC__real autoc[]);
+void FLAC__lpc_compute_autocorrelation_asm_ia32(const FLAC__real data[], uint32_t data_len, uint32_t lag, FLAC__real autoc[]);
+void FLAC__lpc_compute_autocorrelation_asm_ia32_sse_lag_4_old(const FLAC__real data[], uint32_t data_len, uint32_t lag, FLAC__real autoc[]);
+void FLAC__lpc_compute_autocorrelation_asm_ia32_sse_lag_8_old(const FLAC__real data[], uint32_t data_len, uint32_t lag, FLAC__real autoc[]);
+void FLAC__lpc_compute_autocorrelation_asm_ia32_sse_lag_12_old(const FLAC__real data[], uint32_t data_len, uint32_t lag, FLAC__real autoc[]);
+void FLAC__lpc_compute_autocorrelation_asm_ia32_sse_lag_16_old(const FLAC__real data[], uint32_t data_len, uint32_t lag, FLAC__real autoc[]);
 #    endif
 #  endif
 #  if (defined FLAC__CPU_IA32 || defined FLAC__CPU_X86_64) && FLAC__HAS_X86INTRIN
 #    ifdef FLAC__SSE_SUPPORTED
-void FLAC__lpc_compute_autocorrelation_intrin_sse_lag_4_old(const FLAC__real data[], unsigned data_len, unsigned lag, FLAC__real autoc[]);
-void FLAC__lpc_compute_autocorrelation_intrin_sse_lag_8_old(const FLAC__real data[], unsigned data_len, unsigned lag, FLAC__real autoc[]);
-void FLAC__lpc_compute_autocorrelation_intrin_sse_lag_12_old(const FLAC__real data[], unsigned data_len, unsigned lag, FLAC__real autoc[]);
-void FLAC__lpc_compute_autocorrelation_intrin_sse_lag_16_old(const FLAC__real data[], unsigned data_len, unsigned lag, FLAC__real autoc[]);
-void FLAC__lpc_compute_autocorrelation_intrin_sse_lag_4_new(const FLAC__real data[], unsigned data_len, unsigned lag, FLAC__real autoc[]);
-void FLAC__lpc_compute_autocorrelation_intrin_sse_lag_8_new(const FLAC__real data[], unsigned data_len, unsigned lag, FLAC__real autoc[]);
-void FLAC__lpc_compute_autocorrelation_intrin_sse_lag_12_new(const FLAC__real data[], unsigned data_len, unsigned lag, FLAC__real autoc[]);
-void FLAC__lpc_compute_autocorrelation_intrin_sse_lag_16_new(const FLAC__real data[], unsigned data_len, unsigned lag, FLAC__real autoc[]);
+void FLAC__lpc_compute_autocorrelation_intrin_sse_lag_4_old(const FLAC__real data[], uint32_t data_len, uint32_t lag, FLAC__real autoc[]);
+void FLAC__lpc_compute_autocorrelation_intrin_sse_lag_8_old(const FLAC__real data[], uint32_t data_len, uint32_t lag, FLAC__real autoc[]);
+void FLAC__lpc_compute_autocorrelation_intrin_sse_lag_12_old(const FLAC__real data[], uint32_t data_len, uint32_t lag, FLAC__real autoc[]);
+void FLAC__lpc_compute_autocorrelation_intrin_sse_lag_16_old(const FLAC__real data[], uint32_t data_len, uint32_t lag, FLAC__real autoc[]);
+void FLAC__lpc_compute_autocorrelation_intrin_sse_lag_4_new(const FLAC__real data[], uint32_t data_len, uint32_t lag, FLAC__real autoc[]);
+void FLAC__lpc_compute_autocorrelation_intrin_sse_lag_8_new(const FLAC__real data[], uint32_t data_len, uint32_t lag, FLAC__real autoc[]);
+void FLAC__lpc_compute_autocorrelation_intrin_sse_lag_12_new(const FLAC__real data[], uint32_t data_len, uint32_t lag, FLAC__real autoc[]);
+void FLAC__lpc_compute_autocorrelation_intrin_sse_lag_16_new(const FLAC__real data[], uint32_t data_len, uint32_t lag, FLAC__real autoc[]);
 #    endif
 #  endif
 #endif
@@ -114,7 +114,7 @@ void FLAC__lpc_compute_autocorrelation_intrin_sse_lag_16_new(const FLAC__real da
  *              in lp_coeff[8][0,8], the LP coefficients for order 8 will be
  *                      in lp_coeff[7][0,7], etc.
  */
-void FLAC__lpc_compute_lp_coefficients(const FLAC__real autoc[], unsigned *max_order, FLAC__real lp_coeff[][FLAC__MAX_LPC_ORDER], double error[]);
+void FLAC__lpc_compute_lp_coefficients(const FLAC__real autoc[], uint32_t *max_order, FLAC__real lp_coeff[][FLAC__MAX_LPC_ORDER], double error[]);
 
 /*
  *     FLAC__lpc_quantize_coefficients()
@@ -136,7 +136,7 @@ void FLAC__lpc_compute_lp_coefficients(const FLAC__real autoc[], unsigned *max_o
  *         2 => coefficients are all zero, which is bad.  'shift' is
  *              unset.
  */
-int FLAC__lpc_quantize_coefficients(const FLAC__real lp_coeff[], unsigned order, unsigned precision, FLAC__int32 qlp_coeff[], int *shift);
+int FLAC__lpc_quantize_coefficients(const FLAC__real lp_coeff[], uint32_t order, uint32_t precision, FLAC__int32 qlp_coeff[], int *shift);
 
 /*
  *     FLAC__lpc_compute_residual_from_qlp_coefficients()
@@ -151,29 +151,29 @@ int FLAC__lpc_quantize_coefficients(const FLAC__real lp_coeff[], unsigned order,
  *     IN lp_quantization         quantization of LP coefficients in bits
  *     OUT residual[0,data_len-1] residual signal
  */
-void FLAC__lpc_compute_residual_from_qlp_coefficients(const FLAC__int32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 residual[]);
-void FLAC__lpc_compute_residual_from_qlp_coefficients_wide(const FLAC__int32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 residual[]);
+void FLAC__lpc_compute_residual_from_qlp_coefficients(const FLAC__int32 *data, uint32_t data_len, const FLAC__int32 qlp_coeff[], uint32_t order, int lp_quantization, FLAC__int32 residual[]);
+void FLAC__lpc_compute_residual_from_qlp_coefficients_wide(const FLAC__int32 *data, uint32_t data_len, const FLAC__int32 qlp_coeff[], uint32_t order, int lp_quantization, FLAC__int32 residual[]);
 #ifndef FLAC__NO_ASM
 #  ifdef FLAC__CPU_IA32
 #    ifdef FLAC__HAS_NASM
-void FLAC__lpc_compute_residual_from_qlp_coefficients_asm_ia32(const FLAC__int32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 residual[]);
-void FLAC__lpc_compute_residual_from_qlp_coefficients_asm_ia32_mmx(const FLAC__int32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 residual[]);
-void FLAC__lpc_compute_residual_from_qlp_coefficients_wide_asm_ia32(const FLAC__int32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 residual[]);
+void FLAC__lpc_compute_residual_from_qlp_coefficients_asm_ia32(const FLAC__int32 *data, uint32_t data_len, const FLAC__int32 qlp_coeff[], uint32_t order, int lp_quantization, FLAC__int32 residual[]);
+void FLAC__lpc_compute_residual_from_qlp_coefficients_asm_ia32_mmx(const FLAC__int32 *data, uint32_t data_len, const FLAC__int32 qlp_coeff[], uint32_t order, int lp_quantization, FLAC__int32 residual[]);
+void FLAC__lpc_compute_residual_from_qlp_coefficients_wide_asm_ia32(const FLAC__int32 *data, uint32_t data_len, const FLAC__int32 qlp_coeff[], uint32_t order, int lp_quantization, FLAC__int32 residual[]);
 #    endif
 #  endif
 #  if (defined FLAC__CPU_IA32 || defined FLAC__CPU_X86_64) && FLAC__HAS_X86INTRIN
 #    ifdef FLAC__SSE2_SUPPORTED
-void FLAC__lpc_compute_residual_from_qlp_coefficients_16_intrin_sse2(const FLAC__int32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 residual[]);
-void FLAC__lpc_compute_residual_from_qlp_coefficients_intrin_sse2(const FLAC__int32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 residual[]);
+void FLAC__lpc_compute_residual_from_qlp_coefficients_16_intrin_sse2(const FLAC__int32 *data, uint32_t data_len, const FLAC__int32 qlp_coeff[], uint32_t order, int lp_quantization, FLAC__int32 residual[]);
+void FLAC__lpc_compute_residual_from_qlp_coefficients_intrin_sse2(const FLAC__int32 *data, uint32_t data_len, const FLAC__int32 qlp_coeff[], uint32_t order, int lp_quantization, FLAC__int32 residual[]);
 #    endif
 #    ifdef FLAC__SSE4_1_SUPPORTED
-void FLAC__lpc_compute_residual_from_qlp_coefficients_intrin_sse41(const FLAC__int32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 residual[]);
-void FLAC__lpc_compute_residual_from_qlp_coefficients_wide_intrin_sse41(const FLAC__int32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 residual[]);
+void FLAC__lpc_compute_residual_from_qlp_coefficients_intrin_sse41(const FLAC__int32 *data, uint32_t data_len, const FLAC__int32 qlp_coeff[], uint32_t order, int lp_quantization, FLAC__int32 residual[]);
+void FLAC__lpc_compute_residual_from_qlp_coefficients_wide_intrin_sse41(const FLAC__int32 *data, uint32_t data_len, const FLAC__int32 qlp_coeff[], uint32_t order, int lp_quantization, FLAC__int32 residual[]);
 #    endif
 #    ifdef FLAC__AVX2_SUPPORTED
-void FLAC__lpc_compute_residual_from_qlp_coefficients_16_intrin_avx2(const FLAC__int32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 residual[]);
-void FLAC__lpc_compute_residual_from_qlp_coefficients_intrin_avx2(const FLAC__int32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 residual[]);
-void FLAC__lpc_compute_residual_from_qlp_coefficients_wide_intrin_avx2(const FLAC__int32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 residual[]);
+void FLAC__lpc_compute_residual_from_qlp_coefficients_16_intrin_avx2(const FLAC__int32 *data, uint32_t data_len, const FLAC__int32 qlp_coeff[], uint32_t order, int lp_quantization, FLAC__int32 residual[]);
+void FLAC__lpc_compute_residual_from_qlp_coefficients_intrin_avx2(const FLAC__int32 *data, uint32_t data_len, const FLAC__int32 qlp_coeff[], uint32_t order, int lp_quantization, FLAC__int32 residual[]);
+void FLAC__lpc_compute_residual_from_qlp_coefficients_wide_intrin_avx2(const FLAC__int32 *data, uint32_t data_len, const FLAC__int32 qlp_coeff[], uint32_t order, int lp_quantization, FLAC__int32 residual[]);
 #    endif
 #  endif
 #endif
@@ -195,22 +195,22 @@ void FLAC__lpc_compute_residual_from_qlp_coefficients_wide_intrin_avx2(const FLA
  *     IN  data[-order,-1]        previously-reconstructed historical samples
  *     OUT data[0,data_len-1]     original signal
  */
-void FLAC__lpc_restore_signal(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]);
-void FLAC__lpc_restore_signal_wide(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]);
+void FLAC__lpc_restore_signal(const FLAC__int32 residual[], uint32_t data_len, const FLAC__int32 qlp_coeff[], uint32_t order, int lp_quantization, FLAC__int32 data[]);
+void FLAC__lpc_restore_signal_wide(const FLAC__int32 residual[], uint32_t data_len, const FLAC__int32 qlp_coeff[], uint32_t order, int lp_quantization, FLAC__int32 data[]);
 #ifndef FLAC__NO_ASM
 #  ifdef FLAC__CPU_IA32
 #    ifdef FLAC__HAS_NASM
-void FLAC__lpc_restore_signal_asm_ia32(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]);
-void FLAC__lpc_restore_signal_asm_ia32_mmx(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]);
-void FLAC__lpc_restore_signal_wide_asm_ia32(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]);
+void FLAC__lpc_restore_signal_asm_ia32(const FLAC__int32 residual[], uint32_t data_len, const FLAC__int32 qlp_coeff[], uint32_t order, int lp_quantization, FLAC__int32 data[]);
+void FLAC__lpc_restore_signal_asm_ia32_mmx(const FLAC__int32 residual[], uint32_t data_len, const FLAC__int32 qlp_coeff[], uint32_t order, int lp_quantization, FLAC__int32 data[]);
+void FLAC__lpc_restore_signal_wide_asm_ia32(const FLAC__int32 residual[], uint32_t data_len, const FLAC__int32 qlp_coeff[], uint32_t order, int lp_quantization, FLAC__int32 data[]);
 #    endif /* FLAC__HAS_NASM */
 #  endif /* FLAC__CPU_IA32 */
 #  if (defined FLAC__CPU_IA32 || defined FLAC__CPU_X86_64) && FLAC__HAS_X86INTRIN
 #    ifdef FLAC__SSE2_SUPPORTED
-void FLAC__lpc_restore_signal_16_intrin_sse2(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]);
+void FLAC__lpc_restore_signal_16_intrin_sse2(const FLAC__int32 residual[], uint32_t data_len, const FLAC__int32 qlp_coeff[], uint32_t order, int lp_quantization, FLAC__int32 data[]);
 #    endif
 #    ifdef FLAC__SSE4_1_SUPPORTED
-void FLAC__lpc_restore_signal_wide_intrin_sse41(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]);
+void FLAC__lpc_restore_signal_wide_intrin_sse41(const FLAC__int32 residual[], uint32_t data_len, const FLAC__int32 qlp_coeff[], uint32_t order, int lp_quantization, FLAC__int32 data[]);
 #    endif
 #  endif
 #endif /* FLAC__NO_ASM */
@@ -227,7 +227,7 @@ void FLAC__lpc_restore_signal_wide_intrin_sse41(const FLAC__int32 residual[], un
  *     IN total_samples > 0  # of samples in residual signal
  *     RETURN                expected bits per sample
  */
-double FLAC__lpc_compute_expected_bits_per_residual_sample(double lpc_error, unsigned total_samples);
+double FLAC__lpc_compute_expected_bits_per_residual_sample(double lpc_error, uint32_t total_samples);
 double FLAC__lpc_compute_expected_bits_per_residual_sample_with_error_scale(double lpc_error, double error_scale);
 
 /*
@@ -243,7 +243,7 @@ double FLAC__lpc_compute_expected_bits_per_residual_sample_with_error_scale(doub
  *                                         (includes warmup sample size and quantized LP coefficient)
  *     RETURN [1,max_order]                best order
  */
-unsigned FLAC__lpc_compute_best_order(const double lpc_error[], unsigned max_order, unsigned total_samples, unsigned overhead_bits_per_order);
+uint32_t FLAC__lpc_compute_best_order(const double lpc_error[], uint32_t max_order, uint32_t total_samples, uint32_t overhead_bits_per_order);
 
 #endif /* !defined FLAC__INTEGER_ONLY_LIBRARY */
 
index c665ab3..f9d79c3 100644 (file)
@@ -45,6 +45,6 @@ typedef struct {
 void FLAC__MD5Init(FLAC__MD5Context *context);
 void FLAC__MD5Final(FLAC__byte digest[16], FLAC__MD5Context *context);
 
-FLAC__bool FLAC__MD5Accumulate(FLAC__MD5Context *ctx, const FLAC__int32 * const signal[], unsigned channels, unsigned samples, unsigned bytes_per_sample);
+FLAC__bool FLAC__MD5Accumulate(FLAC__MD5Context *ctx, const FLAC__int32 * const signal[], uint32_t channels, uint32_t samples, uint32_t bytes_per_sample);
 
 #endif
index f103c53..a6d3faf 100644 (file)
@@ -49,7 +49,7 @@ void *FLAC__memory_alloc_aligned(size_t bytes, void **aligned_address);
 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);
+FLAC__bool FLAC__memory_alloc_aligned_unsigned_array(size_t elements, uint32_t **unaligned_pointer, uint32_t **aligned_pointer);
 #ifndef FLAC__INTEGER_ONLY_LIBRARY
 FLAC__bool FLAC__memory_alloc_aligned_real_array(size_t elements, FLAC__real **unaligned_pointer, FLAC__real **aligned_pointer);
 #endif
index 218f44e..0a8534d 100644 (file)
@@ -46,7 +46,7 @@ typedef struct FLAC__OggDecoderAspect {
        /* these are for internal state related to Ogg decoding */
        ogg_stream_state stream_state;
        ogg_sync_state sync_state;
-       unsigned version_major, version_minor;
+       uint32_t version_major, version_minor;
        FLAC__bool need_serial_number;
        FLAC__bool end_of_stream;
        FLAC__bool have_working_page; /* only if true will the following vars be valid */
index f55ef32..f3c95f9 100644 (file)
@@ -41,7 +41,7 @@
 typedef struct FLAC__OggEncoderAspect {
        /* these are storage for values that can be set through the API */
        long serial_number;
-       unsigned num_metadata;
+       uint32_t num_metadata;
 
        /* these are for internal state related to Ogg encoding */
        ogg_stream_state stream_state;
@@ -52,12 +52,12 @@ typedef struct FLAC__OggEncoderAspect {
 } FLAC__OggEncoderAspect;
 
 void FLAC__ogg_encoder_aspect_set_serial_number(FLAC__OggEncoderAspect *aspect, long value);
-FLAC__bool FLAC__ogg_encoder_aspect_set_num_metadata(FLAC__OggEncoderAspect *aspect, unsigned value);
+FLAC__bool FLAC__ogg_encoder_aspect_set_num_metadata(FLAC__OggEncoderAspect *aspect, uint32_t value);
 void FLAC__ogg_encoder_aspect_set_defaults(FLAC__OggEncoderAspect *aspect);
 FLAC__bool FLAC__ogg_encoder_aspect_init(FLAC__OggEncoderAspect *aspect);
 void FLAC__ogg_encoder_aspect_finish(FLAC__OggEncoderAspect *aspect);
 
-typedef FLAC__StreamEncoderWriteStatus (*FLAC__OggEncoderAspectWriteCallbackProxy)(const void *encoder, const FLAC__byte buffer[], size_t bytes, unsigned samples, unsigned current_frame, void *client_data);
+typedef FLAC__StreamEncoderWriteStatus (*FLAC__OggEncoderAspectWriteCallbackProxy)(const void *encoder, const FLAC__byte buffer[], size_t bytes, uint32_t samples, uint32_t current_frame, void *client_data);
 
-FLAC__StreamEncoderWriteStatus FLAC__ogg_encoder_aspect_write_callback_wrapper(FLAC__OggEncoderAspect *aspect, const FLAC__byte buffer[], size_t bytes, unsigned samples, unsigned current_frame, FLAC__bool is_last_block, FLAC__OggEncoderAspectWriteCallbackProxy write_callback, void *encoder, void *client_data);
+FLAC__StreamEncoderWriteStatus FLAC__ogg_encoder_aspect_write_callback_wrapper(FLAC__OggEncoderAspect *aspect, const FLAC__byte buffer[], size_t bytes, uint32_t samples, uint32_t current_frame, FLAC__bool is_last_block, FLAC__OggEncoderAspectWriteCallbackProxy write_callback, void *encoder, void *client_data);
 #endif
index 1fa022d..6eb609e 100644 (file)
@@ -38,7 +38,7 @@
 /** The length of the packet type field in bytes. */
 #define FLAC__OGG_MAPPING_PACKET_TYPE_LENGTH (1u)
 
-extern const unsigned FLAC__OGG_MAPPING_PACKET_TYPE_LEN; /* = 8 bits */
+extern const uint32_t FLAC__OGG_MAPPING_PACKET_TYPE_LEN; /* = 8 bits */
 
 extern const FLAC__byte FLAC__OGG_MAPPING_FIRST_HEADER_PACKET_TYPE; /* = 0x7f */
 
@@ -47,8 +47,8 @@ extern const FLAC__byte FLAC__OGG_MAPPING_FIRST_HEADER_PACKET_TYPE; /* = 0x7f */
 
 extern const FLAC__byte * const FLAC__OGG_MAPPING_MAGIC; /* = "FLAC" */
 
-extern const unsigned FLAC__OGG_MAPPING_VERSION_MAJOR_LEN; /* = 8 bits */
-extern const unsigned FLAC__OGG_MAPPING_VERSION_MINOR_LEN; /* = 8 bits */
+extern const uint32_t FLAC__OGG_MAPPING_VERSION_MAJOR_LEN; /* = 8 bits */
+extern const uint32_t FLAC__OGG_MAPPING_VERSION_MINOR_LEN; /* = 8 bits */
 
 /** The length of the Ogg FLAC mapping major version number in bytes. */
 #define FLAC__OGG_MAPPING_VERSION_MAJOR_LENGTH (1u)
@@ -56,7 +56,7 @@ extern const unsigned FLAC__OGG_MAPPING_VERSION_MINOR_LEN; /* = 8 bits */
 /** The length of the Ogg FLAC mapping minor version number in bytes. */
 #define FLAC__OGG_MAPPING_VERSION_MINOR_LENGTH (1u)
 
-extern const unsigned FLAC__OGG_MAPPING_NUM_HEADERS_LEN; /* = 16 bits */
+extern const uint32_t FLAC__OGG_MAPPING_NUM_HEADERS_LEN; /* = 16 bits */
 
 /** The length of the #-of-header-packets number bytes. */
 #define FLAC__OGG_MAPPING_NUM_HEADERS_LENGTH (2u)
index ab1721f..ade648b 100644 (file)
 
 #ifdef FLAC__SSE2_SUPPORTED
 extern void FLAC__precompute_partition_info_sums_intrin_sse2(const FLAC__int32 residual[], FLAC__uint64 abs_residual_partition_sums[],
-                       unsigned residual_samples, unsigned predictor_order, unsigned min_partition_order, unsigned max_partition_order, unsigned bps);
+                       uint32_t residual_samples, uint32_t predictor_order, uint32_t min_partition_order, uint32_t max_partition_order, uint32_t bps);
 #endif
 
 #ifdef FLAC__SSSE3_SUPPORTED
 extern void FLAC__precompute_partition_info_sums_intrin_ssse3(const FLAC__int32 residual[], FLAC__uint64 abs_residual_partition_sums[],
-                       unsigned residual_samples, unsigned predictor_order, unsigned min_partition_order, unsigned max_partition_order, unsigned bps);
+                       uint32_t residual_samples, uint32_t predictor_order, uint32_t min_partition_order, uint32_t max_partition_order, uint32_t bps);
 #endif
 
 #ifdef FLAC__AVX2_SUPPORTED
 extern void FLAC__precompute_partition_info_sums_intrin_avx2(const FLAC__int32 residual[], FLAC__uint64 abs_residual_partition_sums[],
-                       unsigned residual_samples, unsigned predictor_order, unsigned min_partition_order, unsigned max_partition_order, unsigned bps);
+                       uint32_t residual_samples, uint32_t predictor_order, uint32_t min_partition_order, uint32_t max_partition_order, uint32_t bps);
 #endif
 
 #endif
index f633a9d..8df1049 100644 (file)
@@ -38,9 +38,9 @@
 
 FLAC__bool FLAC__add_metadata_block(const FLAC__StreamMetadata *metadata, FLAC__BitWriter *bw);
 FLAC__bool FLAC__frame_add_header(const FLAC__FrameHeader *header, FLAC__BitWriter *bw);
-FLAC__bool FLAC__subframe_add_constant(const FLAC__Subframe_Constant *subframe, unsigned subframe_bps, unsigned wasted_bits, FLAC__BitWriter *bw);
-FLAC__bool FLAC__subframe_add_fixed(const FLAC__Subframe_Fixed *subframe, unsigned residual_samples, unsigned subframe_bps, unsigned wasted_bits, FLAC__BitWriter *bw);
-FLAC__bool FLAC__subframe_add_lpc(const FLAC__Subframe_LPC *subframe, unsigned residual_samples, unsigned subframe_bps, unsigned wasted_bits, FLAC__BitWriter *bw);
-FLAC__bool FLAC__subframe_add_verbatim(const FLAC__Subframe_Verbatim *subframe, unsigned samples, unsigned subframe_bps, unsigned wasted_bits, FLAC__BitWriter *bw);
+FLAC__bool FLAC__subframe_add_constant(const FLAC__Subframe_Constant *subframe, uint32_t subframe_bps, uint32_t wasted_bits, FLAC__BitWriter *bw);
+FLAC__bool FLAC__subframe_add_fixed(const FLAC__Subframe_Fixed *subframe, uint32_t residual_samples, uint32_t subframe_bps, uint32_t wasted_bits, FLAC__BitWriter *bw);
+FLAC__bool FLAC__subframe_add_lpc(const FLAC__Subframe_LPC *subframe, uint32_t residual_samples, uint32_t subframe_bps, uint32_t wasted_bits, FLAC__BitWriter *bw);
+FLAC__bool FLAC__subframe_add_verbatim(const FLAC__Subframe_Verbatim *subframe, uint32_t samples, uint32_t subframe_bps, uint32_t wasted_bits, FLAC__BitWriter *bw);
 
 #endif
index 5c31c16..c691edb 100644 (file)
 typedef struct FLAC__StreamDecoderProtected {
        FLAC__StreamDecoderState state;
        FLAC__StreamDecoderInitStatus initstate;
-       unsigned channels;
+       uint32_t channels;
        FLAC__ChannelAssignment channel_assignment;
-       unsigned bits_per_sample;
-       unsigned sample_rate; /* in Hz */
-       unsigned blocksize; /* in samples (per channel) */
+       uint32_t bits_per_sample;
+       uint32_t sample_rate; /* in Hz */
+       uint32_t blocksize; /* in samples (per channel) */
        FLAC__bool md5_checking; /* if true, generate MD5 signature of decoded data and compare against signature in the STREAMINFO metadata block */
 #if FLAC__HAS_OGG
        FLAC__OggDecoderAspect ogg_decoder_aspect;
@@ -55,6 +55,6 @@ typedef struct FLAC__StreamDecoderProtected {
 /*
  * return the number of input bytes consumed
  */
-unsigned FLAC__stream_decoder_get_input_bytes_unconsumed(const FLAC__StreamDecoder *decoder);
+uint32_t FLAC__stream_decoder_get_input_bytes_unconsumed(const FLAC__StreamDecoder *decoder);
 
 #endif
index 8850c6b..c290904 100644 (file)
@@ -90,25 +90,25 @@ typedef struct FLAC__StreamEncoderProtected {
        FLAC__bool do_md5;
        FLAC__bool do_mid_side_stereo;
        FLAC__bool loose_mid_side_stereo;
-       unsigned channels;
-       unsigned bits_per_sample;
-       unsigned sample_rate;
-       unsigned blocksize;
+       uint32_t channels;
+       uint32_t bits_per_sample;
+       uint32_t sample_rate;
+       uint32_t blocksize;
 #ifndef FLAC__INTEGER_ONLY_LIBRARY
-       unsigned num_apodizations;
+       uint32_t num_apodizations;
        FLAC__ApodizationSpecification apodizations[FLAC__MAX_APODIZATION_FUNCTIONS];
 #endif
-       unsigned max_lpc_order;
-       unsigned qlp_coeff_precision;
+       uint32_t max_lpc_order;
+       uint32_t qlp_coeff_precision;
        FLAC__bool do_qlp_coeff_prec_search;
        FLAC__bool do_exhaustive_model_search;
        FLAC__bool do_escape_coding;
-       unsigned min_residual_partition_order;
-       unsigned max_residual_partition_order;
-       unsigned rice_parameter_search_dist;
+       uint32_t min_residual_partition_order;
+       uint32_t max_residual_partition_order;
+       uint32_t rice_parameter_search_dist;
        FLAC__uint64 total_samples_estimate;
        FLAC__StreamMetadata **metadata;
-       unsigned num_metadata_blocks;
+       uint32_t num_metadata_blocks;
        FLAC__uint64 streaminfo_offset, seektable_offset, audio_offset;
 #if FLAC__HAS_OGG
        FLAC__OggEncoderAspect ogg_encoder_aspect;
index 531247b..53c3082 100644 (file)
@@ -63,19 +63,19 @@ static inline long int lround(double x) {
 /* If this fails, we are in the presence of a mid 90's compiler, move along... */
 #endif
 
-void FLAC__lpc_window_data(const FLAC__int32 in[], const FLAC__real window[], FLAC__real out[], unsigned data_len)
+void FLAC__lpc_window_data(const FLAC__int32 in[], const FLAC__real window[], FLAC__real out[], uint32_t data_len)
 {
-       unsigned i;
+       uint32_t i;
        for(i = 0; i < data_len; i++)
                out[i] = in[i] * window[i];
 }
 
-void FLAC__lpc_compute_autocorrelation(const FLAC__real data[], unsigned data_len, unsigned lag, FLAC__real autoc[])
+void FLAC__lpc_compute_autocorrelation(const FLAC__real data[], uint32_t data_len, uint32_t lag, FLAC__real autoc[])
 {
        /* a readable, but slower, version */
 #if 0
        FLAC__real d;
-       unsigned i;
+       uint32_t i;
 
        FLAC__ASSERT(lag > 0);
        FLAC__ASSERT(lag <= data_len);
@@ -99,8 +99,8 @@ void FLAC__lpc_compute_autocorrelation(const FLAC__real data[], unsigned data_le
         * ('data_len' is usually much larger than 'lag')
         */
        FLAC__real d;
-       unsigned sample, coeff;
-       const unsigned limit = data_len - lag;
+       uint32_t sample, coeff;
+       const uint32_t limit = data_len - lag;
 
        FLAC__ASSERT(lag > 0);
        FLAC__ASSERT(lag <= data_len);
@@ -119,9 +119,9 @@ void FLAC__lpc_compute_autocorrelation(const FLAC__real data[], unsigned data_le
        }
 }
 
-void FLAC__lpc_compute_lp_coefficients(const FLAC__real autoc[], unsigned *max_order, FLAC__real lp_coeff[][FLAC__MAX_LPC_ORDER], double error[])
+void FLAC__lpc_compute_lp_coefficients(const FLAC__real autoc[], uint32_t *max_order, FLAC__real lp_coeff[][FLAC__MAX_LPC_ORDER], double error[])
 {
-       unsigned i, j;
+       uint32_t i, j;
        double r, err, lpc[FLAC__MAX_LPC_ORDER];
 
        FLAC__ASSERT(0 != max_order);
@@ -163,9 +163,9 @@ void FLAC__lpc_compute_lp_coefficients(const FLAC__real autoc[], unsigned *max_o
        }
 }
 
-int FLAC__lpc_quantize_coefficients(const FLAC__real lp_coeff[], unsigned order, unsigned precision, FLAC__int32 qlp_coeff[], int *shift)
+int FLAC__lpc_quantize_coefficients(const FLAC__real lp_coeff[], uint32_t order, uint32_t precision, FLAC__int32 qlp_coeff[], int *shift)
 {
-       unsigned i;
+       uint32_t i;
        double cmax;
        FLAC__int32 qmax, qmin;
 
@@ -264,11 +264,11 @@ int FLAC__lpc_quantize_coefficients(const FLAC__real lp_coeff[], unsigned order,
 #pragma warning ( disable : 4028 )
 #endif
 
-void FLAC__lpc_compute_residual_from_qlp_coefficients(const FLAC__int32 * flac_restrict data, unsigned data_len, const FLAC__int32 * flac_restrict qlp_coeff, unsigned order, int lp_quantization, FLAC__int32 * flac_restrict residual)
+void FLAC__lpc_compute_residual_from_qlp_coefficients(const FLAC__int32 * flac_restrict data, uint32_t data_len, const FLAC__int32 * flac_restrict qlp_coeff, uint32_t order, int lp_quantization, FLAC__int32 * flac_restrict residual)
 #if defined(FLAC__OVERFLOW_DETECT) || !defined(FLAC__LPC_UNROLLED_FILTER_LOOPS)
 {
        FLAC__int64 sumo;
-       unsigned i, j;
+       uint32_t i, j;
        FLAC__int32 sum;
        const FLAC__int32 *history;
 
@@ -525,10 +525,10 @@ void FLAC__lpc_compute_residual_from_qlp_coefficients(const FLAC__int32 * flac_r
 }
 #endif
 
-void FLAC__lpc_compute_residual_from_qlp_coefficients_wide(const FLAC__int32 * flac_restrict data, unsigned data_len, const FLAC__int32 * flac_restrict qlp_coeff, unsigned order, int lp_quantization, FLAC__int32 * flac_restrict residual)
+void FLAC__lpc_compute_residual_from_qlp_coefficients_wide(const FLAC__int32 * flac_restrict data, uint32_t data_len, const FLAC__int32 * flac_restrict qlp_coeff, uint32_t order, int lp_quantization, FLAC__int32 * flac_restrict residual)
 #if defined(FLAC__OVERFLOW_DETECT) || !defined(FLAC__LPC_UNROLLED_FILTER_LOOPS)
 {
-       unsigned i, j;
+       uint32_t i, j;
        FLAC__int64 sum;
        const FLAC__int32 *history;
 
@@ -781,11 +781,11 @@ void FLAC__lpc_compute_residual_from_qlp_coefficients_wide(const FLAC__int32 * f
 
 #endif /* !defined FLAC__INTEGER_ONLY_LIBRARY */
 
-void FLAC__lpc_restore_signal(const FLAC__int32 * flac_restrict residual, unsigned data_len, const FLAC__int32 * flac_restrict qlp_coeff, unsigned order, int lp_quantization, FLAC__int32 * flac_restrict data)
+void FLAC__lpc_restore_signal(const FLAC__int32 * flac_restrict residual, uint32_t data_len, const FLAC__int32 * flac_restrict qlp_coeff, uint32_t order, int lp_quantization, FLAC__int32 * flac_restrict data)
 #if defined(FLAC__OVERFLOW_DETECT) || !defined(FLAC__LPC_UNROLLED_FILTER_LOOPS)
 {
        FLAC__int64 sumo;
-       unsigned i, j;
+       uint32_t i, j;
        FLAC__int32 sum;
        const FLAC__int32 *r = residual, *history;
 
@@ -1042,10 +1042,10 @@ void FLAC__lpc_restore_signal(const FLAC__int32 * flac_restrict residual, unsign
 }
 #endif
 
-void FLAC__lpc_restore_signal_wide(const FLAC__int32 * flac_restrict residual, unsigned data_len, const FLAC__int32 * flac_restrict qlp_coeff, unsigned order, int lp_quantization, FLAC__int32 * flac_restrict data)
+void FLAC__lpc_restore_signal_wide(const FLAC__int32 * flac_restrict residual, uint32_t data_len, const FLAC__int32 * flac_restrict qlp_coeff, uint32_t order, int lp_quantization, FLAC__int32 * flac_restrict data)
 #if defined(FLAC__OVERFLOW_DETECT) || !defined(FLAC__LPC_UNROLLED_FILTER_LOOPS)
 {
-       unsigned i, j;
+       uint32_t i, j;
        FLAC__int64 sum;
        const FLAC__int32 *r = residual, *history;
 
@@ -1302,7 +1302,7 @@ void FLAC__lpc_restore_signal_wide(const FLAC__int32 * flac_restrict residual, u
 
 #ifndef FLAC__INTEGER_ONLY_LIBRARY
 
-double FLAC__lpc_compute_expected_bits_per_residual_sample(double lpc_error, unsigned total_samples)
+double FLAC__lpc_compute_expected_bits_per_residual_sample(double lpc_error, uint32_t total_samples)
 {
        double error_scale;
 
@@ -1330,9 +1330,9 @@ double FLAC__lpc_compute_expected_bits_per_residual_sample_with_error_scale(doub
        }
 }
 
-unsigned FLAC__lpc_compute_best_order(const double lpc_error[], unsigned max_order, unsigned total_samples, unsigned overhead_bits_per_order)
+uint32_t FLAC__lpc_compute_best_order(const double lpc_error[], uint32_t max_order, uint32_t total_samples, uint32_t overhead_bits_per_order)
 {
-       unsigned order, indx, best_index; /* 'index' the index into lpc_error; index==order-1 since lpc_error[0] is for order==1, lpc_error[1] is for order==2, etc */
+       uint32_t order, indx, best_index; /* 'index' the index into lpc_error; index==order-1 since lpc_error[0] is for order==1, lpc_error[1] is for order==2, etc */
        double bits, best_bits, error_scale;
 
        FLAC__ASSERT(max_order > 0);
@@ -1341,7 +1341,7 @@ unsigned FLAC__lpc_compute_best_order(const double lpc_error[], unsigned max_ord
        error_scale = 0.5 / (double)total_samples;
 
        best_index = 0;
-       best_bits = (unsigned)(-1);
+       best_bits = (uint32_t)(-1);
 
        for(indx = 0, order = 1; indx < max_order; indx++, order++) {
                bits = FLAC__lpc_compute_expected_bits_per_residual_sample_with_error_scale(lpc_error[indx], error_scale) * (double)(total_samples - order) + (double)(order * overhead_bits_per_order);
index f9f5ccd..01de4fb 100644 (file)
@@ -48,7 +48,7 @@
 #include <immintrin.h> /* AVX2 */
 
 FLAC__SSE_TARGET("avx2")
-void FLAC__lpc_compute_residual_from_qlp_coefficients_16_intrin_avx2(const FLAC__int32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 residual[])
+void FLAC__lpc_compute_residual_from_qlp_coefficients_16_intrin_avx2(const FLAC__int32 *data, uint32_t data_len, const FLAC__int32 qlp_coeff[], uint32_t order, int lp_quantization, FLAC__int32 residual[])
 {
        int i;
        FLAC__int32 sum;
@@ -403,7 +403,7 @@ void FLAC__lpc_compute_residual_from_qlp_coefficients_16_intrin_avx2(const FLAC_
 }
 
 FLAC__SSE_TARGET("avx2")
-void FLAC__lpc_compute_residual_from_qlp_coefficients_intrin_avx2(const FLAC__int32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 residual[])
+void FLAC__lpc_compute_residual_from_qlp_coefficients_intrin_avx2(const FLAC__int32 *data, uint32_t data_len, const FLAC__int32 qlp_coeff[], uint32_t order, int lp_quantization, FLAC__int32 residual[])
 {
        int i;
        FLAC__int32 sum;
@@ -760,7 +760,7 @@ void FLAC__lpc_compute_residual_from_qlp_coefficients_intrin_avx2(const FLAC__in
 static FLAC__int32 pack_arr[8] = { 0, 2, 4, 6, 1, 3, 5, 7 };
 
 FLAC__SSE_TARGET("avx2")
-void FLAC__lpc_compute_residual_from_qlp_coefficients_wide_intrin_avx2(const FLAC__int32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 residual[])
+void FLAC__lpc_compute_residual_from_qlp_coefficients_wide_intrin_avx2(const FLAC__int32 *data, uint32_t data_len, const FLAC__int32 qlp_coeff[], uint32_t order, int lp_quantization, FLAC__int32 residual[])
 {
        int i;
        FLAC__int64 sum;
index 430e73f..d984418 100644 (file)
@@ -54,7 +54,7 @@
 /* new routines: faster on current Intel (starting from Core i aka Nehalem) and all AMD CPUs */
 
 FLAC__SSE_TARGET("sse")
-void FLAC__lpc_compute_autocorrelation_intrin_sse_lag_4_new(const FLAC__real data[], unsigned data_len, unsigned lag, FLAC__real autoc[])
+void FLAC__lpc_compute_autocorrelation_intrin_sse_lag_4_new(const FLAC__real data[], uint32_t data_len, uint32_t lag, FLAC__real autoc[])
 {
        int i;
        int limit = data_len - 4;
@@ -90,7 +90,7 @@ void FLAC__lpc_compute_autocorrelation_intrin_sse_lag_4_new(const FLAC__real dat
 }
 
 FLAC__SSE_TARGET("sse")
-void FLAC__lpc_compute_autocorrelation_intrin_sse_lag_8_new(const FLAC__real data[], unsigned data_len, unsigned lag, FLAC__real autoc[])
+void FLAC__lpc_compute_autocorrelation_intrin_sse_lag_8_new(const FLAC__real data[], uint32_t data_len, uint32_t lag, FLAC__real autoc[])
 {
        int i;
        int limit = data_len - 8;
@@ -134,7 +134,7 @@ void FLAC__lpc_compute_autocorrelation_intrin_sse_lag_8_new(const FLAC__real dat
 }
 
 FLAC__SSE_TARGET("sse")
-void FLAC__lpc_compute_autocorrelation_intrin_sse_lag_12_new(const FLAC__real data[], unsigned data_len, unsigned lag, FLAC__real autoc[])
+void FLAC__lpc_compute_autocorrelation_intrin_sse_lag_12_new(const FLAC__real data[], uint32_t data_len, uint32_t lag, FLAC__real autoc[])
 {
        int i;
        int limit = data_len - 12;
@@ -186,7 +186,7 @@ void FLAC__lpc_compute_autocorrelation_intrin_sse_lag_12_new(const FLAC__real da
 }
 
 FLAC__SSE_TARGET("sse")
-void FLAC__lpc_compute_autocorrelation_intrin_sse_lag_16_new(const FLAC__real data[], unsigned data_len, unsigned lag, FLAC__real autoc[])
+void FLAC__lpc_compute_autocorrelation_intrin_sse_lag_16_new(const FLAC__real data[], uint32_t data_len, uint32_t lag, FLAC__real autoc[])
 {
        int i;
        int limit = data_len - 16;
@@ -248,7 +248,7 @@ void FLAC__lpc_compute_autocorrelation_intrin_sse_lag_16_new(const FLAC__real da
 /* old routines: faster on older Intel CPUs (up to Core 2) */
 
 FLAC__SSE_TARGET("sse")
-void FLAC__lpc_compute_autocorrelation_intrin_sse_lag_4_old(const FLAC__real data[], unsigned data_len, unsigned lag, FLAC__real autoc[])
+void FLAC__lpc_compute_autocorrelation_intrin_sse_lag_4_old(const FLAC__real data[], uint32_t data_len, uint32_t lag, FLAC__real autoc[])
 {
        __m128 xmm0, xmm2, xmm5;
 
@@ -285,7 +285,7 @@ void FLAC__lpc_compute_autocorrelation_intrin_sse_lag_4_old(const FLAC__real dat
 }
 
 FLAC__SSE_TARGET("sse")
-void FLAC__lpc_compute_autocorrelation_intrin_sse_lag_8_old(const FLAC__real data[], unsigned data_len, unsigned lag, FLAC__real autoc[])
+void FLAC__lpc_compute_autocorrelation_intrin_sse_lag_8_old(const FLAC__real data[], uint32_t data_len, uint32_t lag, FLAC__real autoc[])
 {
        __m128 xmm0, xmm1, xmm2, xmm3, xmm5, xmm6;
 
@@ -331,7 +331,7 @@ void FLAC__lpc_compute_autocorrelation_intrin_sse_lag_8_old(const FLAC__real dat
 }
 
 FLAC__SSE_TARGET("sse")
-void FLAC__lpc_compute_autocorrelation_intrin_sse_lag_12_old(const FLAC__real data[], unsigned data_len, unsigned lag, FLAC__real autoc[])
+void FLAC__lpc_compute_autocorrelation_intrin_sse_lag_12_old(const FLAC__real data[], uint32_t data_len, uint32_t lag, FLAC__real autoc[])
 {
        __m128 xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7;
 
@@ -385,7 +385,7 @@ void FLAC__lpc_compute_autocorrelation_intrin_sse_lag_12_old(const FLAC__real da
 }
 
 FLAC__SSE_TARGET("sse")
-void FLAC__lpc_compute_autocorrelation_intrin_sse_lag_16_old(const FLAC__real data[], unsigned data_len, unsigned lag, FLAC__real autoc[])
+void FLAC__lpc_compute_autocorrelation_intrin_sse_lag_16_old(const FLAC__real data[], uint32_t data_len, uint32_t lag, FLAC__real autoc[])
 {
        __m128 xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, xmm8, xmm9;
 
index 1383394..f117636 100644 (file)
@@ -54,7 +54,7 @@
 #define     DATA32_RESULT(xmmN) data[i] = residual[i] + (_mm_cvtsi128_si32(xmmN) >> lp_quantization);
 
 FLAC__SSE_TARGET("sse2")
-void FLAC__lpc_compute_residual_from_qlp_coefficients_16_intrin_sse2(const FLAC__int32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 residual[])
+void FLAC__lpc_compute_residual_from_qlp_coefficients_16_intrin_sse2(const FLAC__int32 *data, uint32_t data_len, const FLAC__int32 qlp_coeff[], uint32_t order, int lp_quantization, FLAC__int32 residual[])
 {
        int i;
        FLAC__int32 sum;
@@ -408,7 +408,7 @@ void FLAC__lpc_compute_residual_from_qlp_coefficients_16_intrin_sse2(const FLAC_
 }
 
 FLAC__SSE_TARGET("sse2")
-void FLAC__lpc_compute_residual_from_qlp_coefficients_intrin_sse2(const FLAC__int32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 residual[])
+void FLAC__lpc_compute_residual_from_qlp_coefficients_intrin_sse2(const FLAC__int32 *data, uint32_t data_len, const FLAC__int32 qlp_coeff[], uint32_t order, int lp_quantization, FLAC__int32 residual[])
 {
        int i;
 
@@ -937,7 +937,7 @@ void FLAC__lpc_compute_residual_from_qlp_coefficients_intrin_sse2(const FLAC__in
 #if defined FLAC__CPU_IA32 && !defined FLAC__HAS_NASM /* unused for x64; not better than MMX asm */
 
 FLAC__SSE_TARGET("sse2")
-void FLAC__lpc_restore_signal_16_intrin_sse2(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[])
+void FLAC__lpc_restore_signal_16_intrin_sse2(const FLAC__int32 residual[], uint32_t data_len, const FLAC__int32 qlp_coeff[], uint32_t order, int lp_quantization, FLAC__int32 data[])
 {
        if (order < 8 || order > 12) {
                FLAC__lpc_restore_signal(residual, data_len, qlp_coeff, order, lp_quantization, data);
index bef73f4..71b3771 100644 (file)
@@ -53,7 +53,7 @@
 #define RESIDUAL64_RESULT1(xmmN) residual[i] = data[i] - _mm_cvtsi128_si32(_mm_srli_epi64(xmmN, lp_quantization))
 
 FLAC__SSE_TARGET("sse4.1")
-void FLAC__lpc_compute_residual_from_qlp_coefficients_wide_intrin_sse41(const FLAC__int32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 residual[])
+void FLAC__lpc_compute_residual_from_qlp_coefficients_wide_intrin_sse41(const FLAC__int32 *data, uint32_t data_len, const FLAC__int32 qlp_coeff[], uint32_t order, int lp_quantization, FLAC__int32 residual[])
 {
        int i;
        __m128i cnt = _mm_cvtsi32_si128(lp_quantization);
@@ -589,7 +589,7 @@ void FLAC__lpc_compute_residual_from_qlp_coefficients_wide_intrin_sse41(const FL
 }
 
 FLAC__SSE_TARGET("sse4.1")
-void FLAC__lpc_restore_signal_wide_intrin_sse41(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[])
+void FLAC__lpc_restore_signal_wide_intrin_sse41(const FLAC__int32 residual[], uint32_t data_len, const FLAC__int32 qlp_coeff[], uint32_t order, int lp_quantization, FLAC__int32 data[])
 {
        int i;
        __m128i cnt = _mm_cvtsi32_si128(lp_quantization);
@@ -955,7 +955,7 @@ void FLAC__lpc_restore_signal_wide_intrin_sse41(const FLAC__int32 residual[], un
 #endif /* defined FLAC__CPU_IA32 */
 
 FLAC__SSE_TARGET("sse4.1")
-void FLAC__lpc_compute_residual_from_qlp_coefficients_intrin_sse41(const FLAC__int32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 residual[])
+void FLAC__lpc_compute_residual_from_qlp_coefficients_intrin_sse41(const FLAC__int32 *data, uint32_t data_len, const FLAC__int32 qlp_coeff[], uint32_t order, int lp_quantization, FLAC__int32 residual[])
 {
        int i;
        FLAC__int32 sum;
index e9013a9..d395e09 100644 (file)
@@ -136,7 +136,7 @@ static void FLAC__MD5Transform(FLAC__uint32 buf[4], FLAC__uint32 const in[16])
 
 #if WORDS_BIGENDIAN
 //@@@@@@ OPT: use bswap/intrinsics
-static void byteSwap(FLAC__uint32 *buf, unsigned words)
+static void byteSwap(FLAC__uint32 *buf, uint32_t words)
 {
        register FLAC__uint32 x;
        do {
@@ -175,7 +175,7 @@ static void byteSwapX16(FLAC__uint32 *buf)
  * Update context to reflect the concatenation of another buffer full
  * of bytes.
  */
-static void FLAC__MD5Update(FLAC__MD5Context *ctx, FLAC__byte const *buf, unsigned len)
+static void FLAC__MD5Update(FLAC__MD5Context *ctx, FLAC__byte const *buf, uint32_t len)
 {
        FLAC__uint32 t;
 
@@ -271,13 +271,13 @@ void FLAC__MD5Final(FLAC__byte digest[16], FLAC__MD5Context *ctx)
 /*
  * Convert the incoming audio signal to a byte stream
  */
-static void format_input_(FLAC__multibyte *mbuf, const FLAC__int32 * const signal[], unsigned channels, unsigned samples, unsigned bytes_per_sample)
+static void format_input_(FLAC__multibyte *mbuf, const FLAC__int32 * const signal[], uint32_t channels, uint32_t samples, uint32_t bytes_per_sample)
 {
        FLAC__byte *buf_ = mbuf->p8;
        FLAC__int16 *buf16 = mbuf->p16;
        FLAC__int32 *buf32 = mbuf->p32;
        FLAC__int32 a_word;
-       unsigned channel, sample;
+       uint32_t channel, sample;
 
        /* Storage in the output buffer, buf, is little endian. */
 
@@ -488,7 +488,7 @@ static void format_input_(FLAC__multibyte *mbuf, const FLAC__int32 * const signa
 /*
  * Convert the incoming audio signal to a byte stream and FLAC__MD5Update it.
  */
-FLAC__bool FLAC__MD5Accumulate(FLAC__MD5Context *ctx, const FLAC__int32 * const signal[], unsigned channels, unsigned samples, unsigned bytes_per_sample)
+FLAC__bool FLAC__MD5Accumulate(FLAC__MD5Context *ctx, const FLAC__int32 * const signal[], uint32_t channels, uint32_t samples, uint32_t bytes_per_sample)
 {
        const size_t bytes_needed = (size_t)channels * (size_t)samples * (size_t)bytes_per_sample;
 
index a8ebd10..3dae9d2 100644 (file)
@@ -146,11 +146,11 @@ FLAC__bool FLAC__memory_alloc_aligned_uint64_array(size_t elements, FLAC__uint64
        }
 }
 
-FLAC__bool FLAC__memory_alloc_aligned_unsigned_array(size_t elements, unsigned **unaligned_pointer, unsigned **aligned_pointer)
+FLAC__bool FLAC__memory_alloc_aligned_unsigned_array(size_t elements, uint32_t **unaligned_pointer, uint32_t **aligned_pointer)
 {
-       unsigned *pu; /* unaligned pointer */
+       uint32_t *pu; /* unaligned pointer */
        union { /* union needed to comply with C99 pointer aliasing rules */
-               unsigned *pa; /* aligned pointer */
+               uint32_t *pa; /* aligned pointer */
                void     *pv; /* aligned pointer alias */
        } u;
 
index 0a84d03..352a6c7 100644 (file)
  *
  ***************************************************************************/
 
-static void pack_uint32_(FLAC__uint32 val, FLAC__byte *b, unsigned bytes);
-static void pack_uint32_little_endian_(FLAC__uint32 val, FLAC__byte *b, unsigned bytes);
-static void pack_uint64_(FLAC__uint64 val, FLAC__byte *b, unsigned bytes);
-static FLAC__uint32 unpack_uint32_(FLAC__byte *b, unsigned bytes);
-static FLAC__uint32 unpack_uint32_little_endian_(FLAC__byte *b, unsigned bytes);
-static FLAC__uint64 unpack_uint64_(FLAC__byte *b, unsigned bytes);
+static void pack_uint32_(FLAC__uint32 val, FLAC__byte *b, uint32_t bytes);
+static void pack_uint32_little_endian_(FLAC__uint32 val, FLAC__byte *b, uint32_t bytes);
+static void pack_uint64_(FLAC__uint64 val, FLAC__byte *b, uint32_t bytes);
+static FLAC__uint32 unpack_uint32_(FLAC__byte *b, uint32_t bytes);
+static FLAC__uint32 unpack_uint32_little_endian_(FLAC__byte *b, uint32_t bytes);
+static FLAC__uint64 unpack_uint64_(FLAC__byte *b, uint32_t bytes);
 
 static FLAC__bool read_metadata_block_header_(FLAC__Metadata_SimpleIterator *iterator);
 static FLAC__bool read_metadata_block_data_(FLAC__Metadata_SimpleIterator *iterator, FLAC__StreamMetadata *block);
-static FLAC__bool read_metadata_block_header_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__bool *is_last, FLAC__MetadataType *type, unsigned *length);
+static FLAC__bool read_metadata_block_header_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__bool *is_last, FLAC__MetadataType *type, uint32_t *length);
 static FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__IOCallback_Seek seek_cb, FLAC__StreamMetadata *block);
 static FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_streaminfo_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_StreamInfo *block);
-static FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_padding_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Seek seek_cb, FLAC__StreamMetadata_Padding *block, unsigned block_length);
-static FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_application_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_Application *block, unsigned block_length);
-static FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_seektable_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_SeekTable *block, unsigned block_length);
-static FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_vorbis_comment_entry_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_VorbisComment_Entry *entry, unsigned max_length);
-static FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_vorbis_comment_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__IOCallback_Seek seek_cb, FLAC__StreamMetadata_VorbisComment *block, unsigned block_length);
+static FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_padding_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Seek seek_cb, FLAC__StreamMetadata_Padding *block, uint32_t block_length);
+static FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_application_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_Application *block, uint32_t block_length);
+static FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_seektable_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_SeekTable *block, uint32_t block_length);
+static FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_vorbis_comment_entry_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_VorbisComment_Entry *entry, uint32_t max_length);
+static FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_vorbis_comment_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__IOCallback_Seek seek_cb, FLAC__StreamMetadata_VorbisComment *block, uint32_t block_length);
 static FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_cuesheet_track_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_CueSheet_Track *track);
 static FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_cuesheet_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_CueSheet *block);
 static FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_picture_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_Picture *block);
-static FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_unknown_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_Unknown *block, unsigned block_length);
+static FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_unknown_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_Unknown *block, uint32_t block_length);
 
 static FLAC__bool write_metadata_block_header_(FILE *file, FLAC__Metadata_SimpleIteratorStatus *status, const FLAC__StreamMetadata *block);
 static FLAC__bool write_metadata_block_data_(FILE *file, FLAC__Metadata_SimpleIteratorStatus *status, const FLAC__StreamMetadata *block);
 static FLAC__bool write_metadata_block_header_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata *block);
 static FLAC__bool write_metadata_block_data_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata *block);
 static FLAC__bool write_metadata_block_data_streaminfo_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_StreamInfo *block);
-static FLAC__bool write_metadata_block_data_padding_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_Padding *block, unsigned block_length);
-static FLAC__bool write_metadata_block_data_application_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_Application *block, unsigned block_length);
+static FLAC__bool write_metadata_block_data_padding_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_Padding *block, uint32_t block_length);
+static FLAC__bool write_metadata_block_data_application_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_Application *block, uint32_t block_length);
 static FLAC__bool write_metadata_block_data_seektable_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_SeekTable *block);
 static FLAC__bool write_metadata_block_data_vorbis_comment_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_VorbisComment *block);
 static FLAC__bool write_metadata_block_data_cuesheet_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_CueSheet *block);
 static FLAC__bool write_metadata_block_data_picture_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_Picture *block);
-static FLAC__bool write_metadata_block_data_unknown_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_Unknown *block, unsigned block_length);
+static FLAC__bool write_metadata_block_data_unknown_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_Unknown *block, uint32_t block_length);
 
 static FLAC__bool write_metadata_block_stationary_(FLAC__Metadata_SimpleIterator *iterator, const FLAC__StreamMetadata *block);
-static FLAC__bool write_metadata_block_stationary_with_padding_(FLAC__Metadata_SimpleIterator *iterator, FLAC__StreamMetadata *block, unsigned padding_length, FLAC__bool padding_is_last);
+static FLAC__bool write_metadata_block_stationary_with_padding_(FLAC__Metadata_SimpleIterator *iterator, FLAC__StreamMetadata *block, uint32_t padding_length, FLAC__bool padding_is_last);
 static FLAC__bool rewrite_whole_file_(FLAC__Metadata_SimpleIterator *iterator, FLAC__StreamMetadata *block, FLAC__bool append);
 
 static void simple_iterator_push_(FLAC__Metadata_SimpleIterator *iterator);
 static FLAC__bool simple_iterator_pop_(FLAC__Metadata_SimpleIterator *iterator);
 
-static unsigned seek_to_first_metadata_block_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__IOCallback_Seek seek_cb);
-static unsigned seek_to_first_metadata_block_(FILE *f);
+static uint32_t seek_to_first_metadata_block_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__IOCallback_Seek seek_cb);
+static uint32_t seek_to_first_metadata_block_(FILE *f);
 
 static FLAC__bool simple_iterator_copy_file_prefix_(FLAC__Metadata_SimpleIterator *iterator, FILE **tempfile, char **tempfilename, FLAC__bool append);
 static FLAC__bool simple_iterator_copy_file_postfix_(FLAC__Metadata_SimpleIterator *iterator, FILE **tempfile, char **tempfilename, int fixup_is_last_code, FLAC__off_t fixup_is_last_flag_offset, FLAC__bool backup);
@@ -265,7 +265,7 @@ void error_callback_(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErro
                cd->got_error = true;
 }
 
-FLAC_API FLAC__bool FLAC__metadata_get_picture(const char *filename, FLAC__StreamMetadata **picture, FLAC__StreamMetadata_Picture_Type type, const char *mime_type, const FLAC__byte *description, unsigned max_width, unsigned max_height, unsigned max_depth, unsigned max_colors)
+FLAC_API FLAC__bool FLAC__metadata_get_picture(const char *filename, FLAC__StreamMetadata **picture, FLAC__StreamMetadata_Picture_Type type, const char *mime_type, const FLAC__byte *description, uint32_t max_width, uint32_t max_height, uint32_t max_depth, uint32_t max_colors)
 {
        FLAC__Metadata_SimpleIterator *it;
        FLAC__uint64 max_area_seen = 0;
@@ -334,11 +334,11 @@ struct FLAC__Metadata_SimpleIterator {
        FLAC__Metadata_SimpleIteratorStatus status;
        FLAC__off_t offset[SIMPLE_ITERATOR_MAX_PUSH_DEPTH];
        FLAC__off_t first_offset; /* this is the offset to the STREAMINFO block */
-       unsigned depth;
+       uint32_t depth;
        /* this is the metadata block header of the current block we are pointing to: */
        FLAC__bool is_last;
        FLAC__MetadataType type;
-       unsigned length;
+       uint32_t length;
 };
 
 FLAC_API const char * const FLAC__Metadata_SimpleIteratorStatusString[] = {
@@ -417,7 +417,7 @@ FLAC_API FLAC__Metadata_SimpleIteratorStatus FLAC__metadata_simple_iterator_stat
 
 static FLAC__bool simple_iterator_prime_input_(FLAC__Metadata_SimpleIterator *iterator, FLAC__bool read_only)
 {
-       unsigned ret;
+       uint32_t ret;
 
        FLAC__ASSERT(0 != iterator);
 
@@ -588,7 +588,7 @@ FLAC_API FLAC__MetadataType FLAC__metadata_simple_iterator_get_block_type(const
 }
 
 /*@@@@add to tests*/
-FLAC_API unsigned FLAC__metadata_simple_iterator_get_block_length(const FLAC__Metadata_SimpleIterator *iterator)
+FLAC_API uint32_t FLAC__metadata_simple_iterator_get_block_length(const FLAC__Metadata_SimpleIterator *iterator)
 {
        FLAC__ASSERT(0 != iterator);
        FLAC__ASSERT(0 != iterator->file);
@@ -599,7 +599,7 @@ FLAC_API unsigned FLAC__metadata_simple_iterator_get_block_length(const FLAC__Me
 /*@@@@add to tests*/
 FLAC_API FLAC__bool FLAC__metadata_simple_iterator_get_application_id(FLAC__Metadata_SimpleIterator *iterator, FLAC__byte *id)
 {
-       const unsigned id_bytes = FLAC__STREAM_METADATA_APPLICATION_ID_LEN / 8;
+       const uint32_t id_bytes = FLAC__STREAM_METADATA_APPLICATION_ID_LEN / 8;
 
        FLAC__ASSERT(0 != iterator);
        FLAC__ASSERT(0 != iterator->file);
@@ -693,7 +693,7 @@ FLAC_API FLAC__bool FLAC__metadata_simple_iterator_set_block(FLAC__Metadata_Simp
                }
        }
        else /* iterator->length < block->length */ {
-               unsigned padding_leftover = 0;
+               uint32_t padding_leftover = 0;
                FLAC__bool padding_is_last = false;
                if(use_padding) {
                        /* first see if we can even use padding */
@@ -701,7 +701,7 @@ FLAC_API FLAC__bool FLAC__metadata_simple_iterator_set_block(FLAC__Metadata_Simp
                                use_padding = false;
                        }
                        else {
-                               const unsigned extra_padding_bytes_required = block->length - iterator->length;
+                               const uint32_t extra_padding_bytes_required = block->length - iterator->length;
                                simple_iterator_push_(iterator);
                                if(!FLAC__metadata_simple_iterator_next(iterator)) {
                                        (void)simple_iterator_pop_(iterator);
@@ -753,7 +753,7 @@ FLAC_API FLAC__bool FLAC__metadata_simple_iterator_set_block(FLAC__Metadata_Simp
 
 FLAC_API FLAC__bool FLAC__metadata_simple_iterator_insert_block_after(FLAC__Metadata_SimpleIterator *iterator, FLAC__StreamMetadata *block, FLAC__bool use_padding)
 {
-       unsigned padding_leftover = 0;
+       uint32_t padding_leftover = 0;
        FLAC__bool padding_is_last = false;
 
        FLAC__ASSERT_DECLARATION(FLAC__off_t debug_target_offset = iterator->offset[iterator->depth] + FLAC__STREAM_METADATA_HEADER_LENGTH + iterator->length;)
@@ -892,7 +892,7 @@ struct FLAC__Metadata_Chain {
        FLAC__bool is_ogg;
        FLAC__Metadata_Node *head;
        FLAC__Metadata_Node *tail;
-       unsigned nodes;
+       uint32_t nodes;
        FLAC__Metadata_ChainStatus status;
        FLAC__off_t first_offset, last_offset;
        /*
@@ -1089,7 +1089,7 @@ static void iterator_insert_node_after_(FLAC__Metadata_Iterator *iterator, FLAC_
 static FLAC__bool chain_merge_adjacent_padding_(FLAC__Metadata_Chain *chain, FLAC__Metadata_Node *node)
 {
        if(node->data->type == FLAC__METADATA_TYPE_PADDING && 0 != node->next && node->next->data->type == FLAC__METADATA_TYPE_PADDING) {
-               const unsigned growth = FLAC__STREAM_METADATA_HEADER_LENGTH + node->next->data->length;
+               const uint32_t growth = FLAC__STREAM_METADATA_HEADER_LENGTH + node->next->data->length;
                node->data->length += growth; /* new block size can be greater than max metadata block size, but it'll be fixed later in chain_prepare_for_write_() */
 
                chain_delete_node_(chain, node->next);
@@ -1213,7 +1213,7 @@ static FLAC__bool chain_read_cb_(FLAC__Metadata_Chain *chain, FLAC__IOHandle han
        {
                FLAC__bool is_last;
                FLAC__MetadataType type;
-               unsigned length;
+               uint32_t length;
 
                do {
                        node = node_new_();
@@ -1633,7 +1633,7 @@ FLAC_API FLAC__bool FLAC__metadata_chain_check_if_tempfile_needed(FLAC__Metadata
         */
        FLAC__off_t current_length;
        LastBlockState lbs_state = LBS_NONE;
-       unsigned lbs_size = 0;
+       uint32_t lbs_size = 0;
 
        FLAC__ASSERT(0 != chain);
 
@@ -1674,7 +1674,7 @@ FLAC_API FLAC__bool FLAC__metadata_chain_check_if_tempfile_needed(FLAC__Metadata
        {
                const FLAC__Metadata_Node *node;
                for(node = chain->head; node; node = node->next) {
-                       unsigned block_len = node->data->length;
+                       uint32_t block_len = node->data->length;
                        if(node == chain->tail) {
                                if(lbs_state == LBS_BLOCK_REMOVED)
                                        continue;
@@ -1692,7 +1692,7 @@ FLAC_API FLAC__bool FLAC__metadata_chain_check_if_tempfile_needed(FLAC__Metadata
 
                if(lbs_state == LBS_BLOCK_ADDED) {
                        /* test added padding block */
-                       unsigned block_len = lbs_size;
+                       uint32_t block_len = lbs_size;
                        if(block_len >= (1u << FLAC__STREAM_METADATA_LENGTH_LEN))
                                block_len = (1u << FLAC__STREAM_METADATA_LENGTH_LEN) - 1;
                        current_length += (FLAC__STREAM_METADATA_HEADER_LENGTH + block_len);
@@ -1864,7 +1864,7 @@ FLAC_API void FLAC__metadata_chain_merge_padding(FLAC__Metadata_Chain *chain)
 FLAC_API void FLAC__metadata_chain_sort_padding(FLAC__Metadata_Chain *chain)
 {
        FLAC__Metadata_Node *node, *save;
-       unsigned i;
+       uint32_t i;
 
        FLAC__ASSERT(0 != chain);
 
@@ -2041,9 +2041,9 @@ FLAC_API FLAC__bool FLAC__metadata_iterator_insert_block_after(FLAC__Metadata_It
  *
  ***************************************************************************/
 
-void pack_uint32_(FLAC__uint32 val, FLAC__byte *b, unsigned bytes)
+void pack_uint32_(FLAC__uint32 val, FLAC__byte *b, uint32_t bytes)
 {
-       unsigned i;
+       uint32_t i;
 
        b += bytes;
 
@@ -2053,9 +2053,9 @@ void pack_uint32_(FLAC__uint32 val, FLAC__byte *b, unsigned bytes)
        }
 }
 
-void pack_uint32_little_endian_(FLAC__uint32 val, FLAC__byte *b, unsigned bytes)
+void pack_uint32_little_endian_(FLAC__uint32 val, FLAC__byte *b, uint32_t bytes)
 {
-       unsigned i;
+       uint32_t i;
 
        for(i = 0; i < bytes; i++) {
                *(b++) = (FLAC__byte)(val & 0xff);
@@ -2063,9 +2063,9 @@ void pack_uint32_little_endian_(FLAC__uint32 val, FLAC__byte *b, unsigned bytes)
        }
 }
 
-void pack_uint64_(FLAC__uint64 val, FLAC__byte *b, unsigned bytes)
+void pack_uint64_(FLAC__uint64 val, FLAC__byte *b, uint32_t bytes)
 {
-       unsigned i;
+       uint32_t i;
 
        b += bytes;
 
@@ -2075,10 +2075,10 @@ void pack_uint64_(FLAC__uint64 val, FLAC__byte *b, unsigned bytes)
        }
 }
 
-FLAC__uint32 unpack_uint32_(FLAC__byte *b, unsigned bytes)
+FLAC__uint32 unpack_uint32_(FLAC__byte *b, uint32_t bytes)
 {
        FLAC__uint32 ret = 0;
-       unsigned i;
+       uint32_t i;
 
        for(i = 0; i < bytes; i++)
                ret = (ret << 8) | (FLAC__uint32)(*b++);
@@ -2086,10 +2086,10 @@ FLAC__uint32 unpack_uint32_(FLAC__byte *b, unsigned bytes)
        return ret;
 }
 
-FLAC__uint32 unpack_uint32_little_endian_(FLAC__byte *b, unsigned bytes)
+FLAC__uint32 unpack_uint32_little_endian_(FLAC__byte *b, uint32_t bytes)
 {
        FLAC__uint32 ret = 0;
-       unsigned i;
+       uint32_t i;
 
        b += bytes;
 
@@ -2099,10 +2099,10 @@ FLAC__uint32 unpack_uint32_little_endian_(FLAC__byte *b, unsigned bytes)
        return ret;
 }
 
-FLAC__uint64 unpack_uint64_(FLAC__byte *b, unsigned bytes)
+FLAC__uint64 unpack_uint64_(FLAC__byte *b, uint32_t bytes)
 {
        FLAC__uint64 ret = 0;
-       unsigned i;
+       uint32_t i;
 
        for(i = 0; i < bytes; i++)
                ret = (ret << 8) | (FLAC__uint64)(*b++);
@@ -2133,7 +2133,7 @@ FLAC__bool read_metadata_block_data_(FLAC__Metadata_SimpleIterator *iterator, FL
        return (iterator->status == FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK);
 }
 
-FLAC__bool read_metadata_block_header_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__bool *is_last, FLAC__MetadataType *type, unsigned *length)
+FLAC__bool read_metadata_block_header_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__bool *is_last, FLAC__MetadataType *type, uint32_t *length)
 {
        FLAC__byte raw_header[FLAC__STREAM_METADATA_HEADER_LENGTH];
 
@@ -2191,16 +2191,16 @@ FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_streaminfo_cb_(FLAC
        block->max_blocksize = unpack_uint32_(b, 2); b += 2;
        block->min_framesize = unpack_uint32_(b, 3); b += 3;
        block->max_framesize = unpack_uint32_(b, 3); b += 3;
-       block->sample_rate = (unpack_uint32_(b, 2) << 4) | ((unsigned)(b[2] & 0xf0) >> 4);
-       block->channels = (unsigned)((b[2] & 0x0e) >> 1) + 1;
-       block->bits_per_sample = ((((unsigned)(b[2] & 0x01)) << 4) | (((unsigned)(b[3] & 0xf0)) >> 4)) + 1;
+       block->sample_rate = (unpack_uint32_(b, 2) << 4) | ((uint32_t)(b[2] & 0xf0) >> 4);
+       block->channels = (uint32_t)((b[2] & 0x0e) >> 1) + 1;
+       block->bits_per_sample = ((((uint32_t)(b[2] & 0x01)) << 4) | (((uint32_t)(b[3] & 0xf0)) >> 4)) + 1;
        block->total_samples = (((FLAC__uint64)(b[3] & 0x0f)) << 32) | unpack_uint64_(b+4, 4);
        memcpy(block->md5sum, b+8, 16);
 
        return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK;
 }
 
-FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_padding_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Seek seek_cb, FLAC__StreamMetadata_Padding *block, unsigned block_length)
+FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_padding_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Seek seek_cb, FLAC__StreamMetadata_Padding *block, uint32_t block_length)
 {
        (void)block; /* nothing to do; we don't care about reading the padding bytes */
 
@@ -2210,9 +2210,9 @@ FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_padding_cb_(FLAC__I
        return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK;
 }
 
-FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_application_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_Application *block, unsigned block_length)
+FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_application_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_Application *block, uint32_t block_length)
 {
-       const unsigned id_bytes = FLAC__STREAM_METADATA_APPLICATION_ID_LEN / 8;
+       const uint32_t id_bytes = FLAC__STREAM_METADATA_APPLICATION_ID_LEN / 8;
 
        if(read_cb(block->id, 1, id_bytes, handle) != id_bytes)
                return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR;
@@ -2236,9 +2236,9 @@ FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_application_cb_(FLA
        return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK;
 }
 
-FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_seektable_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_SeekTable *block, unsigned block_length)
+FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_seektable_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_SeekTable *block, uint32_t block_length)
 {
-       unsigned i;
+       uint32_t i;
        FLAC__byte buffer[FLAC__STREAM_METADATA_SEEKPOINT_LENGTH];
 
        FLAC__ASSERT(block_length % FLAC__STREAM_METADATA_SEEKPOINT_LENGTH == 0);
@@ -2262,9 +2262,9 @@ FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_seektable_cb_(FLAC_
        return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK;
 }
 
-FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_vorbis_comment_entry_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_VorbisComment_Entry *entry, unsigned max_length)
+FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_vorbis_comment_entry_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_VorbisComment_Entry *entry, uint32_t max_length)
 {
-       const unsigned entry_length_len = FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN / 8;
+       const uint32_t entry_length_len = FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN / 8;
        FLAC__byte buffer[4]; /* magic number is asserted below */
 
        FLAC__ASSERT(FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN / 8 == sizeof(buffer));
@@ -2300,11 +2300,11 @@ FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_vorbis_comment_entr
        return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK;
 }
 
-FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_vorbis_comment_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__IOCallback_Seek seek_cb, FLAC__StreamMetadata_VorbisComment *block, unsigned block_length)
+FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_vorbis_comment_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__IOCallback_Seek seek_cb, FLAC__StreamMetadata_VorbisComment *block, uint32_t block_length)
 {
-       unsigned i;
+       uint32_t i;
        FLAC__Metadata_SimpleIteratorStatus status;
-       const unsigned num_comments_len = FLAC__STREAM_METADATA_VORBIS_COMMENT_NUM_COMMENTS_LEN / 8;
+       const uint32_t num_comments_len = FLAC__STREAM_METADATA_VORBIS_COMMENT_NUM_COMMENTS_LEN / 8;
        FLAC__byte buffer[4]; /* magic number is asserted below */
 
        FLAC__ASSERT(FLAC__STREAM_METADATA_VORBIS_COMMENT_NUM_COMMENTS_LEN / 8 == sizeof(buffer));
@@ -2354,7 +2354,7 @@ FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_vorbis_comment_cb_(
 
 FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_cuesheet_track_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_CueSheet_Track *track)
 {
-       unsigned i, len;
+       uint32_t i, len;
        FLAC__byte buffer[32]; /* asserted below that this is big enough */
 
        FLAC__ASSERT(sizeof(buffer) >= sizeof(FLAC__uint64));
@@ -2423,7 +2423,7 @@ FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_cuesheet_track_cb_(
 
 FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_cuesheet_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_CueSheet *block)
 {
-       unsigned i, len;
+       uint32_t i, len;
        FLAC__Metadata_SimpleIteratorStatus status;
        FLAC__byte buffer[1024]; /* MSVC needs a constant expression so we put a magic number and assert */
 
@@ -2553,7 +2553,7 @@ FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_picture_cb_(FLAC__I
        return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK;
 }
 
-FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_unknown_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_Unknown *block, unsigned block_length)
+FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_unknown_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_Unknown *block, uint32_t block_length)
 {
        if(block_length == 0) {
                block->data = 0;
@@ -2642,8 +2642,8 @@ FLAC__bool write_metadata_block_data_cb_(FLAC__IOHandle handle, FLAC__IOCallback
 FLAC__bool write_metadata_block_data_streaminfo_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_StreamInfo *block)
 {
        FLAC__byte buffer[FLAC__STREAM_METADATA_STREAMINFO_LENGTH];
-       const unsigned channels1 = block->channels - 1;
-       const unsigned bps1 = block->bits_per_sample - 1;
+       const uint32_t channels1 = block->channels - 1;
+       const uint32_t bps1 = block->bits_per_sample - 1;
 
        /* we are using hardcoded numbers for simplicity but we should
         * probably eventually write a bit-level packer and use the
@@ -2666,9 +2666,9 @@ FLAC__bool write_metadata_block_data_streaminfo_cb_(FLAC__IOHandle handle, FLAC_
        return true;
 }
 
-FLAC__bool write_metadata_block_data_padding_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_Padding *block, unsigned block_length)
+FLAC__bool write_metadata_block_data_padding_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_Padding *block, uint32_t block_length)
 {
-       unsigned i, n = block_length;
+       uint32_t i, n = block_length;
        FLAC__byte buffer[1024];
 
        (void)block;
@@ -2687,9 +2687,9 @@ FLAC__bool write_metadata_block_data_padding_cb_(FLAC__IOHandle handle, FLAC__IO
        return true;
 }
 
-FLAC__bool write_metadata_block_data_application_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_Application *block, unsigned block_length)
+FLAC__bool write_metadata_block_data_application_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_Application *block, uint32_t block_length)
 {
-       const unsigned id_bytes = FLAC__STREAM_METADATA_APPLICATION_ID_LEN / 8;
+       const uint32_t id_bytes = FLAC__STREAM_METADATA_APPLICATION_ID_LEN / 8;
 
        if(write_cb(block->id, 1, id_bytes, handle) != id_bytes)
                return false;
@@ -2704,7 +2704,7 @@ FLAC__bool write_metadata_block_data_application_cb_(FLAC__IOHandle handle, FLAC
 
 FLAC__bool write_metadata_block_data_seektable_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_SeekTable *block)
 {
-       unsigned i;
+       uint32_t i;
        FLAC__byte buffer[FLAC__STREAM_METADATA_SEEKPOINT_LENGTH];
 
        for(i = 0; i < block->num_points; i++) {
@@ -2721,9 +2721,9 @@ FLAC__bool write_metadata_block_data_seektable_cb_(FLAC__IOHandle handle, FLAC__
 
 FLAC__bool write_metadata_block_data_vorbis_comment_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_VorbisComment *block)
 {
-       unsigned i;
-       const unsigned entry_length_len = FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN / 8;
-       const unsigned num_comments_len = FLAC__STREAM_METADATA_VORBIS_COMMENT_NUM_COMMENTS_LEN / 8;
+       uint32_t i;
+       const uint32_t entry_length_len = FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN / 8;
+       const uint32_t num_comments_len = FLAC__STREAM_METADATA_VORBIS_COMMENT_NUM_COMMENTS_LEN / 8;
        FLAC__byte buffer[4]; /* magic number is asserted below */
 
        FLAC__ASSERT(flac_max(FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN, FLAC__STREAM_METADATA_VORBIS_COMMENT_NUM_COMMENTS_LEN) / 8 == sizeof(buffer));
@@ -2751,7 +2751,7 @@ FLAC__bool write_metadata_block_data_vorbis_comment_cb_(FLAC__IOHandle handle, F
 
 FLAC__bool write_metadata_block_data_cuesheet_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_CueSheet *block)
 {
-       unsigned i, j, len;
+       uint32_t i, j, len;
        FLAC__byte buffer[1024]; /* asserted below that this is big enough */
 
        FLAC__ASSERT(sizeof(buffer) >= sizeof(FLAC__uint64));
@@ -2845,7 +2845,7 @@ FLAC__bool write_metadata_block_data_cuesheet_cb_(FLAC__IOHandle handle, FLAC__I
 
 FLAC__bool write_metadata_block_data_picture_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_Picture *block)
 {
-       unsigned len;
+       uint32_t len;
        size_t slen;
        FLAC__byte buffer[4]; /* magic number is asserted below */
 
@@ -2917,7 +2917,7 @@ FLAC__bool write_metadata_block_data_picture_cb_(FLAC__IOHandle handle, FLAC__IO
        return true;
 }
 
-FLAC__bool write_metadata_block_data_unknown_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_Unknown *block, unsigned block_length)
+FLAC__bool write_metadata_block_data_unknown_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_Unknown *block, uint32_t block_length)
 {
        if(write_cb(block->data, 1, block_length, handle) != block_length)
                return false;
@@ -2946,7 +2946,7 @@ FLAC__bool write_metadata_block_stationary_(FLAC__Metadata_SimpleIterator *itera
        return read_metadata_block_header_(iterator);
 }
 
-FLAC__bool write_metadata_block_stationary_with_padding_(FLAC__Metadata_SimpleIterator *iterator, FLAC__StreamMetadata *block, unsigned padding_length, FLAC__bool padding_is_last)
+FLAC__bool write_metadata_block_stationary_with_padding_(FLAC__Metadata_SimpleIterator *iterator, FLAC__StreamMetadata *block, uint32_t padding_length, FLAC__bool padding_is_last)
 {
        FLAC__StreamMetadata *padding;
 
@@ -3065,11 +3065,11 @@ FLAC__bool simple_iterator_pop_(FLAC__Metadata_SimpleIterator *iterator)
  * 2: seek error
  * 3: not a FLAC file
  */
-unsigned seek_to_first_metadata_block_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__IOCallback_Seek seek_cb)
+uint32_t seek_to_first_metadata_block_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__IOCallback_Seek seek_cb)
 {
        FLAC__byte buffer[4];
        size_t n;
-       unsigned i;
+       uint32_t i;
 
        FLAC__ASSERT(FLAC__STREAM_SYNC_LENGTH == sizeof(buffer));
 
@@ -3081,7 +3081,7 @@ unsigned seek_to_first_metadata_block_cb_(FLAC__IOHandle handle, FLAC__IOCallbac
        else if(n != 4)
                return 3;
        else if(0 == memcmp(buffer, "ID3", 3)) {
-               unsigned tag_length = 0;
+               uint32_t tag_length = 0;
 
                /* skip to the tag length */
                if(seek_cb(handle, 2, SEEK_CUR) < 0)
@@ -3115,7 +3115,7 @@ unsigned seek_to_first_metadata_block_cb_(FLAC__IOHandle handle, FLAC__IOCallbac
                return 3;
 }
 
-unsigned seek_to_first_metadata_block_(FILE *f)
+uint32_t seek_to_first_metadata_block_(FILE *f)
 {
        return seek_to_first_metadata_block_cb_((FLAC__IOHandle)f, (FLAC__IOCallback_Read)fread, fseek_wrapper_);
 }
index 9cb9501..de8e513 100644 (file)
@@ -62,7 +62,7 @@
  *  else ASSERT
  * malloc error leaves 'to' unchanged
  */
-static FLAC__bool copy_bytes_(FLAC__byte **to, const FLAC__byte *from, unsigned bytes)
+static FLAC__bool copy_bytes_(FLAC__byte **to, const FLAC__byte *from, uint32_t bytes)
 {
        FLAC__ASSERT(to != NULL);
        if (bytes > 0 && from != NULL) {
@@ -80,7 +80,7 @@ static FLAC__bool copy_bytes_(FLAC__byte **to, const FLAC__byte *from, unsigned
 
 #if 0 /* UNUSED */
 /* like copy_bytes_(), but free()s the original '*to' if the copy succeeds and the original '*to' is non-NULL */
-static FLAC__bool free_copy_bytes_(FLAC__byte **to, const FLAC__byte *from, unsigned bytes)
+static FLAC__bool free_copy_bytes_(FLAC__byte **to, const FLAC__byte *from, uint32_t bytes)
 {
        FLAC__byte *copy;
        FLAC__ASSERT(to != NULL);
@@ -96,7 +96,7 @@ static FLAC__bool free_copy_bytes_(FLAC__byte **to, const FLAC__byte *from, unsi
 
 /* reallocate entry to 1 byte larger and add a terminating NUL */
 /* realloc() failure leaves entry unchanged */
-static FLAC__bool ensure_null_terminated_(FLAC__byte **entry, unsigned length)
+static FLAC__bool ensure_null_terminated_(FLAC__byte **entry, uint32_t length)
 {
        FLAC__byte *x = safe_realloc_add_2op_(*entry, length, /*+*/1);
        if (x != NULL) {
@@ -169,7 +169,7 @@ static void seektable_calculate_length_(FLAC__StreamMetadata *object)
        object->length = object->data.seek_table.num_points * FLAC__STREAM_METADATA_SEEKPOINT_LENGTH;
 }
 
-static FLAC__StreamMetadata_SeekPoint *seekpoint_array_new_(unsigned num_points)
+static FLAC__StreamMetadata_SeekPoint *seekpoint_array_new_(uint32_t num_points)
 {
        FLAC__StreamMetadata_SeekPoint *object_array;
 
@@ -178,7 +178,7 @@ static FLAC__StreamMetadata_SeekPoint *seekpoint_array_new_(unsigned num_points)
        object_array = safe_malloc_mul_2op_p(num_points, /*times*/sizeof(FLAC__StreamMetadata_SeekPoint));
 
        if (object_array != NULL) {
-               unsigned i;
+               uint32_t i;
                for (i = 0; i < num_points; i++) {
                        object_array[i].sample_number = FLAC__STREAM_METADATA_SEEKPOINT_PLACEHOLDER;
                        object_array[i].stream_offset = 0;
@@ -191,7 +191,7 @@ static FLAC__StreamMetadata_SeekPoint *seekpoint_array_new_(unsigned num_points)
 
 static void vorbiscomment_calculate_length_(FLAC__StreamMetadata *object)
 {
-       unsigned i;
+       uint32_t i;
 
        FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT);
 
@@ -204,16 +204,16 @@ static void vorbiscomment_calculate_length_(FLAC__StreamMetadata *object)
        }
 }
 
-static FLAC__StreamMetadata_VorbisComment_Entry *vorbiscomment_entry_array_new_(unsigned num_comments)
+static FLAC__StreamMetadata_VorbisComment_Entry *vorbiscomment_entry_array_new_(uint32_t num_comments)
 {
        FLAC__ASSERT(num_comments > 0);
 
        return safe_calloc_(num_comments, sizeof(FLAC__StreamMetadata_VorbisComment_Entry));
 }
 
-static void vorbiscomment_entry_array_delete_(FLAC__StreamMetadata_VorbisComment_Entry *object_array, unsigned num_comments)
+static void vorbiscomment_entry_array_delete_(FLAC__StreamMetadata_VorbisComment_Entry *object_array, uint32_t num_comments)
 {
-       unsigned i;
+       uint32_t i;
 
        FLAC__ASSERT(object_array != NULL && num_comments > 0);
 
@@ -223,7 +223,7 @@ static void vorbiscomment_entry_array_delete_(FLAC__StreamMetadata_VorbisComment
        free(object_array);
 }
 
-static FLAC__StreamMetadata_VorbisComment_Entry *vorbiscomment_entry_array_copy_(const FLAC__StreamMetadata_VorbisComment_Entry *object_array, unsigned num_comments)
+static FLAC__StreamMetadata_VorbisComment_Entry *vorbiscomment_entry_array_copy_(const FLAC__StreamMetadata_VorbisComment_Entry *object_array, uint32_t num_comments)
 {
        FLAC__StreamMetadata_VorbisComment_Entry *return_array;
 
@@ -233,7 +233,7 @@ static FLAC__StreamMetadata_VorbisComment_Entry *vorbiscomment_entry_array_copy_
        return_array = vorbiscomment_entry_array_new_(num_comments);
 
        if (return_array != NULL) {
-               unsigned i;
+               uint32_t i;
 
                for (i = 0; i < num_comments; i++) {
                        if (!copy_vcentry_(return_array+i, object_array+i)) {
@@ -291,9 +291,9 @@ static FLAC__bool vorbiscomment_set_entry_(FLAC__StreamMetadata *object, FLAC__S
        return true;
 }
 
-static int vorbiscomment_find_entry_from_(const FLAC__StreamMetadata *object, unsigned offset, const char *field_name, unsigned field_name_length)
+static int vorbiscomment_find_entry_from_(const FLAC__StreamMetadata *object, uint32_t offset, const char *field_name, uint32_t field_name_length)
 {
-       unsigned i;
+       uint32_t i;
 
        FLAC__ASSERT(object != NULL);
        FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT);
@@ -309,7 +309,7 @@ static int vorbiscomment_find_entry_from_(const FLAC__StreamMetadata *object, un
 
 static void cuesheet_calculate_length_(FLAC__StreamMetadata *object)
 {
-       unsigned i;
+       uint32_t i;
 
        FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_CUESHEET);
 
@@ -340,23 +340,23 @@ static void cuesheet_calculate_length_(FLAC__StreamMetadata *object)
        }
 }
 
-static FLAC__StreamMetadata_CueSheet_Index *cuesheet_track_index_array_new_(unsigned num_indices)
+static FLAC__StreamMetadata_CueSheet_Index *cuesheet_track_index_array_new_(uint32_t num_indices)
 {
        FLAC__ASSERT(num_indices > 0);
 
        return safe_calloc_(num_indices, sizeof(FLAC__StreamMetadata_CueSheet_Index));
 }
 
-static FLAC__StreamMetadata_CueSheet_Track *cuesheet_track_array_new_(unsigned num_tracks)
+static FLAC__StreamMetadata_CueSheet_Track *cuesheet_track_array_new_(uint32_t num_tracks)
 {
        FLAC__ASSERT(num_tracks > 0);
 
        return safe_calloc_(num_tracks, sizeof(FLAC__StreamMetadata_CueSheet_Track));
 }
 
-static void cuesheet_track_array_delete_(FLAC__StreamMetadata_CueSheet_Track *object_array, unsigned num_tracks)
+static void cuesheet_track_array_delete_(FLAC__StreamMetadata_CueSheet_Track *object_array, uint32_t num_tracks)
 {
-       unsigned i;
+       uint32_t i;
 
        FLAC__ASSERT(object_array != NULL && num_tracks > 0);
 
@@ -370,7 +370,7 @@ static void cuesheet_track_array_delete_(FLAC__StreamMetadata_CueSheet_Track *ob
        free(object_array);
 }
 
-static FLAC__StreamMetadata_CueSheet_Track *cuesheet_track_array_copy_(const FLAC__StreamMetadata_CueSheet_Track *object_array, unsigned num_tracks)
+static FLAC__StreamMetadata_CueSheet_Track *cuesheet_track_array_copy_(const FLAC__StreamMetadata_CueSheet_Track *object_array, uint32_t num_tracks)
 {
        FLAC__StreamMetadata_CueSheet_Track *return_array;
 
@@ -380,7 +380,7 @@ static FLAC__StreamMetadata_CueSheet_Track *cuesheet_track_array_copy_(const FLA
        return_array = cuesheet_track_array_new_(num_tracks);
 
        if (return_array != NULL) {
-               unsigned i;
+               uint32_t i;
 
                for (i = 0; i < num_tracks; i++) {
                        if (!copy_track_(return_array+i, object_array+i)) {
@@ -461,7 +461,7 @@ FLAC_API FLAC__StreamMetadata *FLAC__metadata_object_new(FLAC__MetadataType type
                                */
                                break;
                        case FLAC__METADATA_TYPE_VORBIS_COMMENT:
-                               object->data.vorbis_comment.vendor_string.length = (unsigned)strlen(FLAC__VENDOR_STRING);
+                               object->data.vorbis_comment.vendor_string.length = (uint32_t)strlen(FLAC__VENDOR_STRING);
                                if (!copy_bytes_(&object->data.vorbis_comment.vendor_string.entry, (const FLAC__byte*)FLAC__VENDOR_STRING, object->data.vorbis_comment.vendor_string.length+1)) {
                                        free(object);
                                        return 0;
@@ -715,7 +715,7 @@ static FLAC__bool compare_block_data_streaminfo_(const FLAC__StreamMetadata_Stre
        return true;
 }
 
-static FLAC__bool compare_block_data_application_(const FLAC__StreamMetadata_Application *block1, const FLAC__StreamMetadata_Application *block2, unsigned block_length)
+static FLAC__bool compare_block_data_application_(const FLAC__StreamMetadata_Application *block1, const FLAC__StreamMetadata_Application *block2, uint32_t block_length)
 {
        FLAC__ASSERT(block1 != NULL);
        FLAC__ASSERT(block2 != NULL);
@@ -731,7 +731,7 @@ static FLAC__bool compare_block_data_application_(const FLAC__StreamMetadata_App
 
 static FLAC__bool compare_block_data_seektable_(const FLAC__StreamMetadata_SeekTable *block1, const FLAC__StreamMetadata_SeekTable *block2)
 {
-       unsigned i;
+       uint32_t i;
 
        FLAC__ASSERT(block1 != NULL);
        FLAC__ASSERT(block2 != NULL);
@@ -756,7 +756,7 @@ static FLAC__bool compare_block_data_seektable_(const FLAC__StreamMetadata_SeekT
 
 static FLAC__bool compare_block_data_vorbiscomment_(const FLAC__StreamMetadata_VorbisComment *block1, const FLAC__StreamMetadata_VorbisComment *block2)
 {
-       unsigned i;
+       uint32_t i;
 
        if (block1->vendor_string.length != block2->vendor_string.length)
                return false;
@@ -784,7 +784,7 @@ static FLAC__bool compare_block_data_vorbiscomment_(const FLAC__StreamMetadata_V
 
 static FLAC__bool compare_block_data_cuesheet_(const FLAC__StreamMetadata_CueSheet *block1, const FLAC__StreamMetadata_CueSheet *block2)
 {
-       unsigned i, j;
+       uint32_t i, j;
 
        if (strcmp(block1->media_catalog_number, block2->media_catalog_number) != 0)
                return false;
@@ -854,7 +854,7 @@ static FLAC__bool compare_block_data_picture_(const FLAC__StreamMetadata_Picture
        return true;
 }
 
-static FLAC__bool compare_block_data_unknown_(const FLAC__StreamMetadata_Unknown *block1, const FLAC__StreamMetadata_Unknown *block2, unsigned block_length)
+static FLAC__bool compare_block_data_unknown_(const FLAC__StreamMetadata_Unknown *block1, const FLAC__StreamMetadata_Unknown *block2, uint32_t block_length)
 {
        FLAC__ASSERT(block1 != NULL);
        FLAC__ASSERT(block2 != NULL);
@@ -899,7 +899,7 @@ FLAC_API FLAC__bool FLAC__metadata_object_is_equal(const FLAC__StreamMetadata *b
        }
 }
 
-FLAC_API FLAC__bool FLAC__metadata_object_application_set_data(FLAC__StreamMetadata *object, FLAC__byte *data, unsigned length, FLAC__bool copy)
+FLAC_API FLAC__bool FLAC__metadata_object_application_set_data(FLAC__StreamMetadata *object, FLAC__byte *data, uint32_t length, FLAC__bool copy)
 {
        FLAC__byte *save;
 
@@ -924,7 +924,7 @@ FLAC_API FLAC__bool FLAC__metadata_object_application_set_data(FLAC__StreamMetad
        return true;
 }
 
-FLAC_API FLAC__bool FLAC__metadata_object_seektable_resize_points(FLAC__StreamMetadata *object, unsigned new_num_points)
+FLAC_API FLAC__bool FLAC__metadata_object_seektable_resize_points(FLAC__StreamMetadata *object, uint32_t new_num_points)
 {
        FLAC__ASSERT(object != NULL);
        FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_SEEKTABLE);
@@ -955,7 +955,7 @@ FLAC_API FLAC__bool FLAC__metadata_object_seektable_resize_points(FLAC__StreamMe
 
                /* if growing, set new elements to placeholders */
                if (new_size > old_size) {
-                       unsigned i;
+                       uint32_t i;
                        for (i = object->data.seek_table.num_points; i < new_num_points; i++) {
                                object->data.seek_table.points[i].sample_number = FLAC__STREAM_METADATA_SEEKPOINT_PLACEHOLDER;
                                object->data.seek_table.points[i].stream_offset = 0;
@@ -970,7 +970,7 @@ FLAC_API FLAC__bool FLAC__metadata_object_seektable_resize_points(FLAC__StreamMe
        return true;
 }
 
-FLAC_API void FLAC__metadata_object_seektable_set_point(FLAC__StreamMetadata *object, unsigned point_num, FLAC__StreamMetadata_SeekPoint point)
+FLAC_API void FLAC__metadata_object_seektable_set_point(FLAC__StreamMetadata *object, uint32_t point_num, FLAC__StreamMetadata_SeekPoint point)
 {
        FLAC__ASSERT(object != NULL);
        FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_SEEKTABLE);
@@ -979,7 +979,7 @@ FLAC_API void FLAC__metadata_object_seektable_set_point(FLAC__StreamMetadata *ob
        object->data.seek_table.points[point_num] = point;
 }
 
-FLAC_API FLAC__bool FLAC__metadata_object_seektable_insert_point(FLAC__StreamMetadata *object, unsigned point_num, FLAC__StreamMetadata_SeekPoint point)
+FLAC_API FLAC__bool FLAC__metadata_object_seektable_insert_point(FLAC__StreamMetadata *object, uint32_t point_num, FLAC__StreamMetadata_SeekPoint point)
 {
        int i;
 
@@ -999,9 +999,9 @@ FLAC_API FLAC__bool FLAC__metadata_object_seektable_insert_point(FLAC__StreamMet
        return true;
 }
 
-FLAC_API FLAC__bool FLAC__metadata_object_seektable_delete_point(FLAC__StreamMetadata *object, unsigned point_num)
+FLAC_API FLAC__bool FLAC__metadata_object_seektable_delete_point(FLAC__StreamMetadata *object, uint32_t point_num)
 {
-       unsigned i;
+       uint32_t i;
 
        FLAC__ASSERT(object != NULL);
        FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_SEEKTABLE);
@@ -1022,7 +1022,7 @@ FLAC_API FLAC__bool FLAC__metadata_object_seektable_is_legal(const FLAC__StreamM
        return FLAC__format_seektable_is_legal(&object->data.seek_table);
 }
 
-FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_append_placeholders(FLAC__StreamMetadata *object, unsigned num)
+FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_append_placeholders(FLAC__StreamMetadata *object, uint32_t num)
 {
        FLAC__ASSERT(object != NULL);
        FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_SEEKTABLE);
@@ -1053,7 +1053,7 @@ FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_append_point(FLAC__
        return true;
 }
 
-FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_append_points(FLAC__StreamMetadata *object, FLAC__uint64 sample_numbers[], unsigned num)
+FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_append_points(FLAC__StreamMetadata *object, FLAC__uint64 sample_numbers[], uint32_t num)
 {
        FLAC__ASSERT(object != NULL);
        FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_SEEKTABLE);
@@ -1061,7 +1061,7 @@ FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_append_points(FLAC_
 
        if (num > 0) {
                FLAC__StreamMetadata_SeekTable *seek_table = &object->data.seek_table;
-               unsigned i, j;
+               uint32_t i, j;
 
                i = seek_table->num_points;
 
@@ -1078,7 +1078,7 @@ FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_append_points(FLAC_
        return true;
 }
 
-FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_append_spaced_points(FLAC__StreamMetadata *object, unsigned num, FLAC__uint64 total_samples)
+FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_append_spaced_points(FLAC__StreamMetadata *object, uint32_t num, FLAC__uint64 total_samples)
 {
        FLAC__ASSERT(object != NULL);
        FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_SEEKTABLE);
@@ -1086,7 +1086,7 @@ FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_append_spaced_point
 
        if (num > 0 && total_samples > 0) {
                FLAC__StreamMetadata_SeekTable *seek_table = &object->data.seek_table;
-               unsigned i, j;
+               uint32_t i, j;
 
                i = seek_table->num_points;
 
@@ -1103,7 +1103,7 @@ FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_append_spaced_point
        return true;
 }
 
-FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_append_spaced_points_by_samples(FLAC__StreamMetadata *object, unsigned samples, FLAC__uint64 total_samples)
+FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_append_spaced_points_by_samples(FLAC__StreamMetadata *object, uint32_t samples, FLAC__uint64 total_samples)
 {
        FLAC__ASSERT(object != NULL);
        FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_SEEKTABLE);
@@ -1112,7 +1112,7 @@ FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_append_spaced_point
 
        if (samples > 0 && total_samples > 0) {
                FLAC__StreamMetadata_SeekTable *seek_table = &object->data.seek_table;
-               unsigned i, j;
+               uint32_t i, j;
                FLAC__uint64 num, sample;
 
                num = 1 + total_samples / samples; /* 1+ for the first sample at 0 */
@@ -1129,7 +1129,7 @@ FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_append_spaced_point
 
                i = seek_table->num_points;
 
-               if (!FLAC__metadata_object_seektable_resize_points(object, seek_table->num_points + (unsigned)num))
+               if (!FLAC__metadata_object_seektable_resize_points(object, seek_table->num_points + (uint32_t)num))
                        return false;
 
                sample = 0;
@@ -1145,7 +1145,7 @@ FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_append_spaced_point
 
 FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_sort(FLAC__StreamMetadata *object, FLAC__bool compact)
 {
-       unsigned unique;
+       uint32_t unique;
 
        FLAC__ASSERT(object != NULL);
        FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_SEEKTABLE);
@@ -1162,7 +1162,7 @@ FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_set_vendor_string(FLAC__
        return vorbiscomment_set_entry_(object, &object->data.vorbis_comment.vendor_string, &entry, copy);
 }
 
-FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_resize_comments(FLAC__StreamMetadata *object, unsigned new_num_comments)
+FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_resize_comments(FLAC__StreamMetadata *object, uint32_t new_num_comments)
 {
        FLAC__ASSERT(object != NULL);
        FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT);
@@ -1186,7 +1186,7 @@ FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_resize_comments(FLAC__St
 
                /* if shrinking, free the truncated entries */
                if (new_num_comments < object->data.vorbis_comment.num_comments) {
-                       unsigned i;
+                       uint32_t i;
                        for (i = new_num_comments; i < object->data.vorbis_comment.num_comments; i++)
                                if (object->data.vorbis_comment.comments[i].entry != NULL)
                                        free(object->data.vorbis_comment.comments[i].entry);
@@ -1216,7 +1216,7 @@ FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_resize_comments(FLAC__St
        return true;
 }
 
-FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_set_comment(FLAC__StreamMetadata *object, unsigned comment_num, FLAC__StreamMetadata_VorbisComment_Entry entry, FLAC__bool copy)
+FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_set_comment(FLAC__StreamMetadata *object, uint32_t comment_num, FLAC__StreamMetadata_VorbisComment_Entry entry, FLAC__bool copy)
 {
        FLAC__ASSERT(object != NULL);
        FLAC__ASSERT(comment_num < object->data.vorbis_comment.num_comments);
@@ -1226,7 +1226,7 @@ FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_set_comment(FLAC__Stream
        return vorbiscomment_set_entry_(object, &object->data.vorbis_comment.comments[comment_num], &entry, copy);
 }
 
-FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_insert_comment(FLAC__StreamMetadata *object, unsigned comment_num, FLAC__StreamMetadata_VorbisComment_Entry entry, FLAC__bool copy)
+FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_insert_comment(FLAC__StreamMetadata *object, uint32_t comment_num, FLAC__StreamMetadata_VorbisComment_Entry entry, FLAC__bool copy)
 {
        FLAC__StreamMetadata_VorbisComment *vc;
 
@@ -1276,7 +1276,7 @@ FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_replace_comment(FLAC__St
 
                i = vorbiscomment_find_entry_from_(object, 0, (const char *)entry.entry, field_name_length);
                if (i >= 0) {
-                       unsigned indx = (unsigned)i;
+                       uint32_t indx = (uint32_t)i;
                        if (!FLAC__metadata_object_vorbiscomment_set_comment(object, indx, entry, copy))
                                return false;
                        entry = object->data.vorbis_comment.comments[indx];
@@ -1284,7 +1284,7 @@ FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_replace_comment(FLAC__St
                        if (all && indx < object->data.vorbis_comment.num_comments) {
                                i = vorbiscomment_find_entry_from_(object, indx, (const char *)entry.entry, field_name_length);
                                while (i >= 0) {
-                                       indx = (unsigned)i;
+                                       indx = (uint32_t)i;
                                        if (!FLAC__metadata_object_vorbiscomment_delete_comment(object, indx))
                                                return false;
                                        if (indx < object->data.vorbis_comment.num_comments)
@@ -1300,7 +1300,7 @@ FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_replace_comment(FLAC__St
        }
 }
 
-FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_delete_comment(FLAC__StreamMetadata *object, unsigned comment_num)
+FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_delete_comment(FLAC__StreamMetadata *object, uint32_t comment_num)
 {
        FLAC__StreamMetadata_VorbisComment *vc;
 
@@ -1329,7 +1329,7 @@ FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_entry_from_name_value_pa
 
        if (!FLAC__format_vorbiscomment_entry_name_is_legal(field_name))
                return false;
-       if (!FLAC__format_vorbiscomment_entry_value_is_legal((const FLAC__byte *)field_value, (unsigned)(-1)))
+       if (!FLAC__format_vorbiscomment_entry_value_is_legal((const FLAC__byte *)field_value, (uint32_t)(-1)))
                return false;
 
        {
@@ -1378,16 +1378,16 @@ FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_entry_to_name_value_pair
        return true;
 }
 
-FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_entry_matches(const FLAC__StreamMetadata_VorbisComment_Entry entry, const char *field_name, unsigned field_name_length)
+FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_entry_matches(const FLAC__StreamMetadata_VorbisComment_Entry entry, const char *field_name, uint32_t field_name_length)
 {
        FLAC__ASSERT(entry.entry != NULL && entry.length > 0);
        {
                const FLAC__byte *eq = (FLAC__byte*)memchr(entry.entry, '=', entry.length);
-               return (eq != NULL && (unsigned)(eq-entry.entry) == field_name_length && FLAC__STRNCASECMP(field_name, (const char *)entry.entry, field_name_length) == 0);
+               return (eq != NULL && (uint32_t)(eq-entry.entry) == field_name_length && FLAC__STRNCASECMP(field_name, (const char *)entry.entry, field_name_length) == 0);
        }
 }
 
-FLAC_API int FLAC__metadata_object_vorbiscomment_find_entry_from(const FLAC__StreamMetadata *object, unsigned offset, const char *field_name)
+FLAC_API int FLAC__metadata_object_vorbiscomment_find_entry_from(const FLAC__StreamMetadata *object, uint32_t offset, const char *field_name)
 {
        FLAC__ASSERT(field_name != NULL);
 
@@ -1396,8 +1396,8 @@ FLAC_API int FLAC__metadata_object_vorbiscomment_find_entry_from(const FLAC__Str
 
 FLAC_API int FLAC__metadata_object_vorbiscomment_remove_entry_matching(FLAC__StreamMetadata *object, const char *field_name)
 {
-       const unsigned field_name_length = strlen(field_name);
-       unsigned i;
+       const uint32_t field_name_length = strlen(field_name);
+       uint32_t i;
 
        FLAC__ASSERT(object != NULL);
        FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT);
@@ -1417,8 +1417,8 @@ FLAC_API int FLAC__metadata_object_vorbiscomment_remove_entry_matching(FLAC__Str
 FLAC_API int FLAC__metadata_object_vorbiscomment_remove_entries_matching(FLAC__StreamMetadata *object, const char *field_name)
 {
        FLAC__bool ok = true;
-       unsigned matching = 0;
-       const unsigned field_name_length = strlen(field_name);
+       uint32_t matching = 0;
+       const uint32_t field_name_length = strlen(field_name);
        int i;
 
        FLAC__ASSERT(object != NULL);
@@ -1428,7 +1428,7 @@ FLAC_API int FLAC__metadata_object_vorbiscomment_remove_entries_matching(FLAC__S
        for (i = (int)object->data.vorbis_comment.num_comments - 1; ok && i >= 0; i--) {
                if (FLAC__metadata_object_vorbiscomment_entry_matches(object->data.vorbis_comment.comments[i], field_name, field_name_length)) {
                        matching++;
-                       ok &= FLAC__metadata_object_vorbiscomment_delete_comment(object, (unsigned)i);
+                       ok &= FLAC__metadata_object_vorbiscomment_delete_comment(object, (uint32_t)i);
                }
        }
 
@@ -1472,7 +1472,7 @@ FLAC_API void FLAC__metadata_object_cuesheet_track_delete(FLAC__StreamMetadata_C
        free(object);
 }
 
-FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_track_resize_indices(FLAC__StreamMetadata *object, unsigned track_num, unsigned new_num_indices)
+FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_track_resize_indices(FLAC__StreamMetadata *object, uint32_t track_num, uint32_t new_num_indices)
 {
        FLAC__StreamMetadata_CueSheet_Track *track;
        FLAC__ASSERT(object != NULL);
@@ -1516,7 +1516,7 @@ FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_track_resize_indices(FLAC__St
        return true;
 }
 
-FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_track_insert_index(FLAC__StreamMetadata *object, unsigned track_num, unsigned index_num, FLAC__StreamMetadata_CueSheet_Index indx)
+FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_track_insert_index(FLAC__StreamMetadata *object, uint32_t track_num, uint32_t index_num, FLAC__StreamMetadata_CueSheet_Index indx)
 {
        FLAC__StreamMetadata_CueSheet_Track *track;
 
@@ -1538,14 +1538,14 @@ FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_track_insert_index(FLAC__Stre
        return true;
 }
 
-FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_track_insert_blank_index(FLAC__StreamMetadata *object, unsigned track_num, unsigned index_num)
+FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_track_insert_blank_index(FLAC__StreamMetadata *object, uint32_t track_num, uint32_t index_num)
 {
        FLAC__StreamMetadata_CueSheet_Index indx;
        memset(&indx, 0, sizeof(indx));
        return FLAC__metadata_object_cuesheet_track_insert_index(object, track_num, index_num, indx);
 }
 
-FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_track_delete_index(FLAC__StreamMetadata *object, unsigned track_num, unsigned index_num)
+FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_track_delete_index(FLAC__StreamMetadata *object, uint32_t track_num, uint32_t index_num)
 {
        FLAC__StreamMetadata_CueSheet_Track *track;
 
@@ -1564,7 +1564,7 @@ FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_track_delete_index(FLAC__Stre
        return true;
 }
 
-FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_resize_tracks(FLAC__StreamMetadata *object, unsigned new_num_tracks)
+FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_resize_tracks(FLAC__StreamMetadata *object, uint32_t new_num_tracks)
 {
        FLAC__ASSERT(object != NULL);
        FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_CUESHEET);
@@ -1588,7 +1588,7 @@ FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_resize_tracks(FLAC__StreamMet
 
                /* if shrinking, free the truncated entries */
                if (new_num_tracks < object->data.cue_sheet.num_tracks) {
-                       unsigned i;
+                       uint32_t i;
                        for (i = new_num_tracks; i < object->data.cue_sheet.num_tracks; i++)
                                free(object->data.cue_sheet.tracks[i].indices);
                }
@@ -1611,7 +1611,7 @@ FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_resize_tracks(FLAC__StreamMet
        return true;
 }
 
-FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_set_track(FLAC__StreamMetadata *object, unsigned track_num, FLAC__StreamMetadata_CueSheet_Track *track, FLAC__bool copy)
+FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_set_track(FLAC__StreamMetadata *object, uint32_t track_num, FLAC__StreamMetadata_CueSheet_Track *track, FLAC__bool copy)
 {
        FLAC__ASSERT(object != NULL);
        FLAC__ASSERT(track_num < object->data.cue_sheet.num_tracks);
@@ -1619,7 +1619,7 @@ FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_set_track(FLAC__StreamMetadat
        return cuesheet_set_track_(object, object->data.cue_sheet.tracks + track_num, track, copy);
 }
 
-FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_insert_track(FLAC__StreamMetadata *object, unsigned track_num, FLAC__StreamMetadata_CueSheet_Track *track, FLAC__bool copy)
+FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_insert_track(FLAC__StreamMetadata *object, uint32_t track_num, FLAC__StreamMetadata_CueSheet_Track *track, FLAC__bool copy)
 {
        FLAC__StreamMetadata_CueSheet *cs;
 
@@ -1640,14 +1640,14 @@ FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_insert_track(FLAC__StreamMeta
        return FLAC__metadata_object_cuesheet_set_track(object, track_num, track, copy);
 }
 
-FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_insert_blank_track(FLAC__StreamMetadata *object, unsigned track_num)
+FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_insert_blank_track(FLAC__StreamMetadata *object, uint32_t track_num)
 {
        FLAC__StreamMetadata_CueSheet_Track track;
        memset(&track, 0, sizeof(track));
        return FLAC__metadata_object_cuesheet_insert_track(object, track_num, &track, /*copy=*/false);
 }
 
-FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_delete_track(FLAC__StreamMetadata *object, unsigned track_num)
+FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_delete_track(FLAC__StreamMetadata *object, uint32_t track_num)
 {
        FLAC__StreamMetadata_CueSheet *cs;
 
@@ -1676,7 +1676,7 @@ FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_is_legal(const FLAC__StreamMe
        return FLAC__format_cuesheet_is_legal(&object->data.cue_sheet, check_cd_da_subset, violation);
 }
 
-static FLAC__uint64 get_index_01_offset_(const FLAC__StreamMetadata_CueSheet *cs, unsigned track)
+static FLAC__uint64 get_index_01_offset_(const FLAC__StreamMetadata_CueSheet *cs, uint32_t track)
 {
        if (track >= (cs->num_tracks-1) || cs->tracks[track].num_indices < 1)
                return 0;
index 40cee19..44f3921 100644 (file)
@@ -161,7 +161,7 @@ FLAC__OggDecoderAspectReadStatus FLAC__ogg_decoder_aspect_read_callback_wrapper(
                                        /* if it is the first header packet, check for magic and a supported Ogg FLAC mapping version */
                                        if (aspect->working_packet.bytes > 0 && aspect->working_packet.packet[0] == FLAC__OGG_MAPPING_FIRST_HEADER_PACKET_TYPE) {
                                                const FLAC__byte *b = aspect->working_packet.packet;
-                                               const unsigned header_length =
+                                               const uint32_t header_length =
                                                        FLAC__OGG_MAPPING_PACKET_TYPE_LENGTH +
                                                        FLAC__OGG_MAPPING_MAGIC_LENGTH +
                                                        FLAC__OGG_MAPPING_VERSION_MAJOR_LENGTH +
@@ -173,9 +173,9 @@ FLAC__OggDecoderAspectReadStatus FLAC__ogg_decoder_aspect_read_callback_wrapper(
                                                if (memcmp(b, FLAC__OGG_MAPPING_MAGIC, FLAC__OGG_MAPPING_MAGIC_LENGTH))
                                                        return FLAC__OGG_DECODER_ASPECT_READ_STATUS_NOT_FLAC;
                                                b += FLAC__OGG_MAPPING_MAGIC_LENGTH;
-                                               aspect->version_major = (unsigned)(*b);
+                                               aspect->version_major = (uint32_t)(*b);
                                                b += FLAC__OGG_MAPPING_VERSION_MAJOR_LENGTH;
-                                               aspect->version_minor = (unsigned)(*b);
+                                               aspect->version_minor = (uint32_t)(*b);
                                                if (aspect->version_major != 1)
                                                        return FLAC__OGG_DECODER_ASPECT_READ_STATUS_UNSUPPORTED_MAPPING_VERSION;
                                                aspect->working_packet.packet += header_length;
index ebd4614..a655da9 100644 (file)
@@ -72,7 +72,7 @@ void FLAC__ogg_encoder_aspect_set_serial_number(FLAC__OggEncoderAspect *aspect,
        aspect->serial_number = value;
 }
 
-FLAC__bool FLAC__ogg_encoder_aspect_set_num_metadata(FLAC__OggEncoderAspect *aspect, unsigned value)
+FLAC__bool FLAC__ogg_encoder_aspect_set_num_metadata(FLAC__OggEncoderAspect *aspect, uint32_t value)
 {
        if(value < (1u << FLAC__OGG_MAPPING_NUM_HEADERS_LEN)) {
                aspect->num_metadata = value;
@@ -109,7 +109,7 @@ void FLAC__ogg_encoder_aspect_set_defaults(FLAC__OggEncoderAspect *aspect)
  * separate write callback for the fLaC magic, and then separate write
  * callbacks for each metadata block and audio frame.
  */
-FLAC__StreamEncoderWriteStatus FLAC__ogg_encoder_aspect_write_callback_wrapper(FLAC__OggEncoderAspect *aspect, const FLAC__byte buffer[], size_t bytes, unsigned samples, unsigned current_frame, FLAC__bool is_last_block, FLAC__OggEncoderAspectWriteCallbackProxy write_callback, void *encoder, void *client_data)
+FLAC__StreamEncoderWriteStatus FLAC__ogg_encoder_aspect_write_callback_wrapper(FLAC__OggEncoderAspect *aspect, const FLAC__byte buffer[], size_t bytes, uint32_t samples, uint32_t current_frame, FLAC__bool is_last_block, FLAC__OggEncoderAspectWriteCallbackProxy write_callback, void *encoder, void *client_data)
 {
        /* WATCHOUT:
         * This depends on the behavior of FLAC__StreamEncoder that 'samples'
@@ -170,14 +170,14 @@ FLAC__StreamEncoderWriteStatus FLAC__ogg_encoder_aspect_write_callback_wrapper(F
                        /* add STREAMINFO */
                        memcpy(b, buffer, bytes);
                        FLAC__ASSERT(b + bytes - synthetic_first_packet_body == sizeof(synthetic_first_packet_body));
-                       packet.packet = (unsigned char *)synthetic_first_packet_body;
+                       packet.packet = (uint8_t *)synthetic_first_packet_body;
                        packet.bytes = sizeof(synthetic_first_packet_body);
 
                        packet.b_o_s = 1;
                        aspect->is_first_packet = false;
                }
                else {
-                       packet.packet = (unsigned char *)buffer;
+                       packet.packet = (uint8_t *)buffer;
                        packet.bytes = bytes;
                }
 
index 7ca9160..cbe5bc6 100644 (file)
@@ -94,8 +94,8 @@ void simple_ogg_page__clear(ogg_page *page)
 
 FLAC__bool simple_ogg_page__get_at(FLAC__StreamEncoder *encoder, FLAC__uint64 position, ogg_page *page, FLAC__StreamEncoderSeekCallback seek_callback, FLAC__StreamEncoderReadCallback read_callback, void *client_data)
 {
-       static const unsigned OGG_HEADER_FIXED_PORTION_LEN = 27;
-       static const unsigned OGG_MAX_HEADER_LEN = 27/*OGG_HEADER_FIXED_PORTION_LEN*/ + 255;
+       static const uint32_t OGG_HEADER_FIXED_PORTION_LEN = 27;
+       static const uint32_t OGG_MAX_HEADER_LEN = 27/*OGG_HEADER_FIXED_PORTION_LEN*/ + 255;
        FLAC__byte crc[4];
        FLAC__StreamEncoderSeekStatus seek_status;
 
@@ -142,10 +142,10 @@ FLAC__bool simple_ogg_page__get_at(FLAC__StreamEncoder *encoder, FLAC__uint64 po
                return false;
 
        {
-               unsigned i;
+               uint32_t i;
 
                /* check to see that it specifies a single packet */
-               for(i = 0; i < (unsigned)page->header[26] - 1; i++) {
+               for(i = 0; i < (uint32_t)page->header[26] - 1; i++) {
                        if(page->header[i + OGG_HEADER_FIXED_PORTION_LEN] != 255) {
                                encoder->protected_->state = FLAC__STREAM_ENCODER_OGG_ERROR;
                                return false;
index 08fa514..f6de600 100644 (file)
 
 #include "private/ogg_mapping.h"
 
-const unsigned FLAC__OGG_MAPPING_PACKET_TYPE_LEN = 8; /* bits */
+const uint32_t FLAC__OGG_MAPPING_PACKET_TYPE_LEN = 8; /* bits */
 
 const FLAC__byte FLAC__OGG_MAPPING_FIRST_HEADER_PACKET_TYPE = 0x7f;
 
 const FLAC__byte * const FLAC__OGG_MAPPING_MAGIC = (const FLAC__byte * const)"FLAC";
 
-const unsigned FLAC__OGG_MAPPING_VERSION_MAJOR_LEN = 8; /* bits */
-const unsigned FLAC__OGG_MAPPING_VERSION_MINOR_LEN = 8; /* bits */
+const uint32_t FLAC__OGG_MAPPING_VERSION_MAJOR_LEN = 8; /* bits */
+const uint32_t FLAC__OGG_MAPPING_VERSION_MINOR_LEN = 8; /* bits */
 
-const unsigned FLAC__OGG_MAPPING_NUM_HEADERS_LEN = 16; /* bits */
+const uint32_t FLAC__OGG_MAPPING_NUM_HEADERS_LEN = 16; /* bits */
index d364b0c..2e1fdd5 100644 (file)
@@ -75,25 +75,25 @@ static const FLAC__byte ID3V2_TAG_[3] = { 'I', 'D', '3' };
 
 static void set_defaults_(FLAC__StreamDecoder *decoder);
 static FILE *get_binary_stdin_(void);
-static FLAC__bool allocate_output_(FLAC__StreamDecoder *decoder, unsigned size, unsigned channels);
+static FLAC__bool allocate_output_(FLAC__StreamDecoder *decoder, uint32_t size, uint32_t channels);
 static FLAC__bool has_id_filtered_(FLAC__StreamDecoder *decoder, FLAC__byte *id);
 static FLAC__bool find_metadata_(FLAC__StreamDecoder *decoder);
 static FLAC__bool read_metadata_(FLAC__StreamDecoder *decoder);
-static FLAC__bool read_metadata_streaminfo_(FLAC__StreamDecoder *decoder, FLAC__bool is_last, unsigned length);
-static FLAC__bool read_metadata_seektable_(FLAC__StreamDecoder *decoder, FLAC__bool is_last, unsigned length);
-static FLAC__bool read_metadata_vorbiscomment_(FLAC__StreamDecoder *decoder, FLAC__StreamMetadata_VorbisComment *obj, unsigned length);
+static FLAC__bool read_metadata_streaminfo_(FLAC__StreamDecoder *decoder, FLAC__bool is_last, uint32_t length);
+static FLAC__bool read_metadata_seektable_(FLAC__StreamDecoder *decoder, FLAC__bool is_last, uint32_t length);
+static FLAC__bool read_metadata_vorbiscomment_(FLAC__StreamDecoder *decoder, FLAC__StreamMetadata_VorbisComment *obj, uint32_t length);
 static FLAC__bool read_metadata_cuesheet_(FLAC__StreamDecoder *decoder, FLAC__StreamMetadata_CueSheet *obj);
 static FLAC__bool read_metadata_picture_(FLAC__StreamDecoder *decoder, FLAC__StreamMetadata_Picture *obj);
 static FLAC__bool skip_id3v2_tag_(FLAC__StreamDecoder *decoder);
 static FLAC__bool frame_sync_(FLAC__StreamDecoder *decoder);
 static FLAC__bool read_frame_(FLAC__StreamDecoder *decoder, FLAC__bool *got_a_frame, FLAC__bool do_full_decode);
 static FLAC__bool read_frame_header_(FLAC__StreamDecoder *decoder);
-static FLAC__bool read_subframe_(FLAC__StreamDecoder *decoder, unsigned channel, unsigned bps, FLAC__bool do_full_decode);
-static FLAC__bool read_subframe_constant_(FLAC__StreamDecoder *decoder, unsigned channel, unsigned bps, FLAC__bool do_full_decode);
-static FLAC__bool read_subframe_fixed_(FLAC__StreamDecoder *decoder, unsigned channel, unsigned bps, const unsigned order, FLAC__bool do_full_decode);
-static FLAC__bool read_subframe_lpc_(FLAC__StreamDecoder *decoder, unsigned channel, unsigned bps, const unsigned order, FLAC__bool do_full_decode);
-static FLAC__bool read_subframe_verbatim_(FLAC__StreamDecoder *decoder, unsigned channel, unsigned bps, FLAC__bool do_full_decode);
-static FLAC__bool read_residual_partitioned_rice_(FLAC__StreamDecoder *decoder, unsigned predictor_order, unsigned partition_order, FLAC__EntropyCodingMethod_PartitionedRiceContents *partitioned_rice_contents, FLAC__int32 *residual, FLAC__bool is_extended);
+static FLAC__bool read_subframe_(FLAC__StreamDecoder *decoder, uint32_t channel, uint32_t bps, FLAC__bool do_full_decode);
+static FLAC__bool read_subframe_constant_(FLAC__StreamDecoder *decoder, uint32_t channel, uint32_t bps, FLAC__bool do_full_decode);
+static FLAC__bool read_subframe_fixed_(FLAC__StreamDecoder *decoder, uint32_t channel, uint32_t bps, const uint32_t order, FLAC__bool do_full_decode);
+static FLAC__bool read_subframe_lpc_(FLAC__StreamDecoder *decoder, uint32_t channel, uint32_t bps, const uint32_t order, FLAC__bool do_full_decode);
+static FLAC__bool read_subframe_verbatim_(FLAC__StreamDecoder *decoder, uint32_t channel, uint32_t bps, FLAC__bool do_full_decode);
+static FLAC__bool read_residual_partitioned_rice_(FLAC__StreamDecoder *decoder, uint32_t predictor_order, uint32_t partition_order, FLAC__EntropyCodingMethod_PartitionedRiceContents *partitioned_rice_contents, FLAC__int32 *residual, FLAC__bool is_extended);
 static FLAC__bool read_zero_padding_(FLAC__StreamDecoder *decoder);
 static FLAC__bool read_callback_(FLAC__byte buffer[], size_t *bytes, void *client_data);
 #if FLAC__HAS_OGG
@@ -129,18 +129,18 @@ typedef struct FLAC__StreamDecoderPrivate {
        FLAC__StreamDecoderMetadataCallback metadata_callback;
        FLAC__StreamDecoderErrorCallback error_callback;
        /* generic 32-bit datapath: */
-       void (*local_lpc_restore_signal)(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]);
+       void (*local_lpc_restore_signal)(const FLAC__int32 residual[], uint32_t data_len, const FLAC__int32 qlp_coeff[], uint32_t order, int lp_quantization, FLAC__int32 data[]);
        /* generic 64-bit datapath: */
-       void (*local_lpc_restore_signal_64bit)(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]);
+       void (*local_lpc_restore_signal_64bit)(const FLAC__int32 residual[], uint32_t data_len, const FLAC__int32 qlp_coeff[], uint32_t order, int lp_quantization, FLAC__int32 data[]);
        /* for use when the signal is <= 16 bits-per-sample, or <= 15 bits-per-sample on a side channel (which requires 1 extra bit): */
-       void (*local_lpc_restore_signal_16bit)(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]);
+       void (*local_lpc_restore_signal_16bit)(const FLAC__int32 residual[], uint32_t data_len, const FLAC__int32 qlp_coeff[], uint32_t order, int lp_quantization, FLAC__int32 data[]);
        void *client_data;
        FILE *file; /* only used if FLAC__stream_decoder_init_file()/FLAC__stream_decoder_init_file() called, else NULL */
        FLAC__BitReader *input;
        FLAC__int32 *output[FLAC__MAX_CHANNELS];
        FLAC__int32 *residual[FLAC__MAX_CHANNELS]; /* WATCHOUT: these are the aligned pointers; the real pointers that should be free()'d are residual_unaligned[] below */
        FLAC__EntropyCodingMethod_PartitionedRiceContents partitioned_rice_contents[FLAC__MAX_CHANNELS];
-       unsigned output_capacity, output_channels;
+       uint32_t output_capacity, output_channels;
        FLAC__uint32 fixed_block_size, next_fixed_block_size;
        FLAC__uint64 samples_decoded;
        FLAC__bool has_stream_info, has_seek_table;
@@ -165,7 +165,7 @@ typedef struct FLAC__StreamDecoderPrivate {
        FLAC__Frame last_frame; /* holds the info of the last frame we seeked to */
        FLAC__uint64 first_frame_offset; /* hint to the seek routine of where in the stream the first audio frame starts */
        FLAC__uint64 target_sample;
-       unsigned unparseable_frame_count; /* used to tell whether we're decoding a future version of FLAC or just got a bad sync */
+       uint32_t unparseable_frame_count; /* used to tell whether we're decoding a future version of FLAC or just got a bad sync */
        FLAC__bool got_a_frame; /* hack needed in Ogg FLAC seek routine to check when process_single() actually writes a frame */
 } FLAC__StreamDecoderPrivate;
 
@@ -241,7 +241,7 @@ FLAC_API const char * const FLAC__StreamDecoderErrorStatusString[] = {
 FLAC_API FLAC__StreamDecoder *FLAC__stream_decoder_new(void)
 {
        FLAC__StreamDecoder *decoder;
-       unsigned i;
+       uint32_t i;
 
        FLAC__ASSERT(sizeof(int) >= 4); /* we want to die right away if this is not true */
 
@@ -303,7 +303,7 @@ FLAC_API FLAC__StreamDecoder *FLAC__stream_decoder_new(void)
 
 FLAC_API void FLAC__stream_decoder_delete(FLAC__StreamDecoder *decoder)
 {
-       unsigned i;
+       uint32_t i;
 
        if (decoder == NULL)
                return ;
@@ -629,7 +629,7 @@ FLAC_API FLAC__StreamDecoderInitStatus FLAC__stream_decoder_init_ogg_file(
 FLAC_API FLAC__bool FLAC__stream_decoder_finish(FLAC__StreamDecoder *decoder)
 {
        FLAC__bool md5_failed = false;
-       unsigned i;
+       uint32_t i;
 
        FLAC__ASSERT(0 != decoder);
        FLAC__ASSERT(0 != decoder->private_);
@@ -723,9 +723,9 @@ FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_respond(FLAC__StreamDecode
        FLAC__ASSERT(0 != decoder);
        FLAC__ASSERT(0 != decoder->private_);
        FLAC__ASSERT(0 != decoder->protected_);
-       FLAC__ASSERT((unsigned)type <= FLAC__MAX_METADATA_TYPE_CODE);
+       FLAC__ASSERT((uint32_t)type <= FLAC__MAX_METADATA_TYPE_CODE);
        /* double protection */
-       if((unsigned)type > FLAC__MAX_METADATA_TYPE_CODE)
+       if((uint32_t)type > FLAC__MAX_METADATA_TYPE_CODE)
                return false;
        if(decoder->protected_->state != FLAC__STREAM_DECODER_UNINITIALIZED)
                return false;
@@ -765,7 +765,7 @@ FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_respond_application(FLAC__
 
 FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_respond_all(FLAC__StreamDecoder *decoder)
 {
-       unsigned i;
+       uint32_t i;
        FLAC__ASSERT(0 != decoder);
        FLAC__ASSERT(0 != decoder->private_);
        FLAC__ASSERT(0 != decoder->protected_);
@@ -782,9 +782,9 @@ FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_ignore(FLAC__StreamDecoder
        FLAC__ASSERT(0 != decoder);
        FLAC__ASSERT(0 != decoder->private_);
        FLAC__ASSERT(0 != decoder->protected_);
-       FLAC__ASSERT((unsigned)type <= FLAC__MAX_METADATA_TYPE_CODE);
+       FLAC__ASSERT((uint32_t)type <= FLAC__MAX_METADATA_TYPE_CODE);
        /* double protection */
-       if((unsigned)type > FLAC__MAX_METADATA_TYPE_CODE)
+       if((uint32_t)type > FLAC__MAX_METADATA_TYPE_CODE)
                return false;
        if(decoder->protected_->state != FLAC__STREAM_DECODER_UNINITIALIZED)
                return false;
@@ -860,7 +860,7 @@ FLAC_API FLAC__uint64 FLAC__stream_decoder_get_total_samples(const FLAC__StreamD
        return decoder->private_->has_stream_info? decoder->private_->stream_info.data.stream_info.total_samples : 0;
 }
 
-FLAC_API unsigned FLAC__stream_decoder_get_channels(const FLAC__StreamDecoder *decoder)
+FLAC_API uint32_t FLAC__stream_decoder_get_channels(const FLAC__StreamDecoder *decoder)
 {
        FLAC__ASSERT(0 != decoder);
        FLAC__ASSERT(0 != decoder->protected_);
@@ -874,21 +874,21 @@ FLAC_API FLAC__ChannelAssignment FLAC__stream_decoder_get_channel_assignment(con
        return decoder->protected_->channel_assignment;
 }
 
-FLAC_API unsigned FLAC__stream_decoder_get_bits_per_sample(const FLAC__StreamDecoder *decoder)
+FLAC_API uint32_t FLAC__stream_decoder_get_bits_per_sample(const FLAC__StreamDecoder *decoder)
 {
        FLAC__ASSERT(0 != decoder);
        FLAC__ASSERT(0 != decoder->protected_);
        return decoder->protected_->bits_per_sample;
 }
 
-FLAC_API unsigned FLAC__stream_decoder_get_sample_rate(const FLAC__StreamDecoder *decoder)
+FLAC_API uint32_t FLAC__stream_decoder_get_sample_rate(const FLAC__StreamDecoder *decoder)
 {
        FLAC__ASSERT(0 != decoder);
        FLAC__ASSERT(0 != decoder->protected_);
        return decoder->protected_->sample_rate;
 }
 
-FLAC_API unsigned FLAC__stream_decoder_get_blocksize(const FLAC__StreamDecoder *decoder)
+FLAC_API uint32_t FLAC__stream_decoder_get_blocksize(const FLAC__StreamDecoder *decoder)
 {
        FLAC__ASSERT(0 != decoder);
        FLAC__ASSERT(0 != decoder->protected_);
@@ -1204,7 +1204,7 @@ FLAC_API FLAC__bool FLAC__stream_decoder_seek_absolute(FLAC__StreamDecoder *deco
  *
  ***********************************************************************/
 
-unsigned FLAC__stream_decoder_get_input_bytes_unconsumed(const FLAC__StreamDecoder *decoder)
+uint32_t FLAC__stream_decoder_get_input_bytes_unconsumed(const FLAC__StreamDecoder *decoder)
 {
        FLAC__ASSERT(0 != decoder);
        FLAC__ASSERT(FLAC__bitreader_is_consumed_byte_aligned(decoder->private_->input));
@@ -1263,9 +1263,9 @@ FILE *get_binary_stdin_(void)
        return stdin;
 }
 
-FLAC__bool allocate_output_(FLAC__StreamDecoder *decoder, unsigned size, unsigned channels)
+FLAC__bool allocate_output_(FLAC__StreamDecoder *decoder, uint32_t size, uint32_t channels)
 {
-       unsigned i;
+       uint32_t i;
        FLAC__int32 *tmp;
 
        if(size <= decoder->private_->output_capacity && channels <= decoder->private_->output_channels)
@@ -1328,7 +1328,7 @@ FLAC__bool has_id_filtered_(FLAC__StreamDecoder *decoder, FLAC__byte *id)
 FLAC__bool find_metadata_(FLAC__StreamDecoder *decoder)
 {
        FLAC__uint32 x;
-       unsigned i, id;
+       uint32_t i, id;
        FLAC__bool first = true;
 
        FLAC__ASSERT(FLAC__bitreader_is_consumed_byte_aligned(decoder->private_->input));
@@ -1430,7 +1430,7 @@ FLAC__bool read_metadata_(FLAC__StreamDecoder *decoder)
        }
        else {
                FLAC__bool skip_it = !decoder->private_->metadata_filter[type];
-               unsigned real_length = length;
+               uint32_t real_length = length;
                FLAC__StreamMetadata block;
 
                memset(&block, 0, sizeof(block));
@@ -1568,10 +1568,10 @@ FLAC__bool read_metadata_(FLAC__StreamDecoder *decoder)
        return true;
 }
 
-FLAC__bool read_metadata_streaminfo_(FLAC__StreamDecoder *decoder, FLAC__bool is_last, unsigned length)
+FLAC__bool read_metadata_streaminfo_(FLAC__StreamDecoder *decoder, FLAC__bool is_last, uint32_t length)
 {
        FLAC__uint32 x;
-       unsigned bits, used_bits = 0;
+       uint32_t bits, used_bits = 0;
 
        FLAC__ASSERT(FLAC__bitreader_is_consumed_byte_aligned(decoder->private_->input));
 
@@ -1639,7 +1639,7 @@ FLAC__bool read_metadata_streaminfo_(FLAC__StreamDecoder *decoder, FLAC__bool is
        return true;
 }
 
-FLAC__bool read_metadata_seektable_(FLAC__StreamDecoder *decoder, FLAC__bool is_last, unsigned length)
+FLAC__bool read_metadata_seektable_(FLAC__StreamDecoder *decoder, FLAC__bool is_last, uint32_t length)
 {
        FLAC__uint32 i, x;
        FLAC__uint64 xx;
@@ -1681,7 +1681,7 @@ FLAC__bool read_metadata_seektable_(FLAC__StreamDecoder *decoder, FLAC__bool is_
        return true;
 }
 
-FLAC__bool read_metadata_vorbiscomment_(FLAC__StreamDecoder *decoder, FLAC__StreamMetadata_VorbisComment *obj, unsigned length)
+FLAC__bool read_metadata_vorbiscomment_(FLAC__StreamDecoder *decoder, FLAC__StreamMetadata_VorbisComment *obj, uint32_t length)
 {
        FLAC__uint32 i;
 
@@ -1938,7 +1938,7 @@ FLAC__bool read_metadata_picture_(FLAC__StreamDecoder *decoder, FLAC__StreamMeta
 FLAC__bool skip_id3v2_tag_(FLAC__StreamDecoder *decoder)
 {
        FLAC__uint32 x;
-       unsigned i, skip;
+       uint32_t i, skip;
 
        /* skip the version and flags bytes */
        if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, 24))
@@ -2014,10 +2014,10 @@ FLAC__bool frame_sync_(FLAC__StreamDecoder *decoder)
 
 FLAC__bool read_frame_(FLAC__StreamDecoder *decoder, FLAC__bool *got_a_frame, FLAC__bool do_full_decode)
 {
-       unsigned channel;
-       unsigned i;
+       uint32_t channel;
+       uint32_t i;
        FLAC__int32 mid, side;
-       unsigned frame_crc; /* the one we calculate from the input stream */
+       uint32_t frame_crc; /* the one we calculate from the input stream */
        FLAC__uint32 x;
 
        *got_a_frame = false;
@@ -2038,7 +2038,7 @@ FLAC__bool read_frame_(FLAC__StreamDecoder *decoder, FLAC__bool *got_a_frame, FL
                /*
                 * first figure the correct bits-per-sample of the subframe
                 */
-               unsigned bps = decoder->private_->frame.header.bits_per_sample;
+               uint32_t bps = decoder->private_->frame.header.bits_per_sample;
                switch(decoder->private_->frame.header.channel_assignment) {
                        case FLAC__CHANNEL_ASSIGNMENT_INDEPENDENT:
                                /* no adjustment needed */
@@ -2163,9 +2163,9 @@ FLAC__bool read_frame_header_(FLAC__StreamDecoder *decoder)
 {
        FLAC__uint32 x;
        FLAC__uint64 xx;
-       unsigned i, blocksize_hint = 0, sample_rate_hint = 0;
+       uint32_t i, blocksize_hint = 0, sample_rate_hint = 0;
        FLAC__byte crc8, raw_header[16]; /* MAGIC NUMBER based on the maximum frame header size, including CRC */
-       unsigned raw_header_len;
+       uint32_t raw_header_len;
        FLAC__bool is_unparseable = false;
 
        FLAC__ASSERT(FLAC__bitreader_is_consumed_byte_aligned(decoder->private_->input));
@@ -2300,7 +2300,7 @@ FLAC__bool read_frame_header_(FLAC__StreamDecoder *decoder)
                        FLAC__ASSERT(0);
        }
 
-       x = (unsigned)(raw_header[3] >> 4);
+       x = (uint32_t)(raw_header[3] >> 4);
        if(x & 8) {
                decoder->private_->frame.header.channels = 2;
                switch(x & 7) {
@@ -2319,11 +2319,11 @@ FLAC__bool read_frame_header_(FLAC__StreamDecoder *decoder)
                }
        }
        else {
-               decoder->private_->frame.header.channels = (unsigned)x + 1;
+               decoder->private_->frame.header.channels = (uint32_t)x + 1;
                decoder->private_->frame.header.channel_assignment = FLAC__CHANNEL_ASSIGNMENT_INDEPENDENT;
        }
 
-       switch(x = (unsigned)(raw_header[3] & 0x0e) >> 1) {
+       switch(x = (uint32_t)(raw_header[3] & 0x0e) >> 1) {
                case 0:
                        if(decoder->private_->has_stream_info)
                                decoder->private_->frame.header.bits_per_sample = decoder->private_->stream_info.data.stream_info.bits_per_sample;
@@ -2468,11 +2468,11 @@ FLAC__bool read_frame_header_(FLAC__StreamDecoder *decoder)
        return true;
 }
 
-FLAC__bool read_subframe_(FLAC__StreamDecoder *decoder, unsigned channel, unsigned bps, FLAC__bool do_full_decode)
+FLAC__bool read_subframe_(FLAC__StreamDecoder *decoder, uint32_t channel, uint32_t bps, FLAC__bool do_full_decode)
 {
        FLAC__uint32 x;
        FLAC__bool wasted_bits;
-       unsigned i;
+       uint32_t i;
 
        if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, 8)) /* MAGIC NUMBER */
                return false; /* read_callback_ sets the state for us */
@@ -2481,7 +2481,7 @@ FLAC__bool read_subframe_(FLAC__StreamDecoder *decoder, unsigned channel, unsign
        x &= 0xfe;
 
        if(wasted_bits) {
-               unsigned u;
+               uint32_t u;
                if(!FLAC__bitreader_read_unary_unsigned(decoder->private_->input, &u))
                        return false; /* read_callback_ sets the state for us */
                decoder->private_->frame.subframes[channel].wasted_bits = u+1;
@@ -2542,11 +2542,11 @@ FLAC__bool read_subframe_(FLAC__StreamDecoder *decoder, unsigned channel, unsign
        return true;
 }
 
-FLAC__bool read_subframe_constant_(FLAC__StreamDecoder *decoder, unsigned channel, unsigned bps, FLAC__bool do_full_decode)
+FLAC__bool read_subframe_constant_(FLAC__StreamDecoder *decoder, uint32_t channel, uint32_t bps, FLAC__bool do_full_decode)
 {
        FLAC__Subframe_Constant *subframe = &decoder->private_->frame.subframes[channel].data.constant;
        FLAC__int32 x;
-       unsigned i;
+       uint32_t i;
        FLAC__int32 *output = decoder->private_->output[channel];
 
        decoder->private_->frame.subframes[channel].type = FLAC__SUBFRAME_TYPE_CONSTANT;
@@ -2565,12 +2565,12 @@ FLAC__bool read_subframe_constant_(FLAC__StreamDecoder *decoder, unsigned channe
        return true;
 }
 
-FLAC__bool read_subframe_fixed_(FLAC__StreamDecoder *decoder, unsigned channel, unsigned bps, const unsigned order, FLAC__bool do_full_decode)
+FLAC__bool read_subframe_fixed_(FLAC__StreamDecoder *decoder, uint32_t channel, uint32_t bps, const uint32_t order, FLAC__bool do_full_decode)
 {
        FLAC__Subframe_Fixed *subframe = &decoder->private_->frame.subframes[channel].data.fixed;
        FLAC__int32 i32;
        FLAC__uint32 u32;
-       unsigned u;
+       uint32_t u;
 
        decoder->private_->frame.subframes[channel].type = FLAC__SUBFRAME_TYPE_FIXED;
 
@@ -2627,12 +2627,12 @@ FLAC__bool read_subframe_fixed_(FLAC__StreamDecoder *decoder, unsigned channel,
        return true;
 }
 
-FLAC__bool read_subframe_lpc_(FLAC__StreamDecoder *decoder, unsigned channel, unsigned bps, const unsigned order, FLAC__bool do_full_decode)
+FLAC__bool read_subframe_lpc_(FLAC__StreamDecoder *decoder, uint32_t channel, uint32_t bps, const uint32_t order, FLAC__bool do_full_decode)
 {
        FLAC__Subframe_LPC *subframe = &decoder->private_->frame.subframes[channel].data.lpc;
        FLAC__int32 i32;
        FLAC__uint32 u32;
-       unsigned u;
+       uint32_t u;
 
        decoder->private_->frame.subframes[channel].type = FLAC__SUBFRAME_TYPE_LPC;
 
@@ -2722,11 +2722,11 @@ FLAC__bool read_subframe_lpc_(FLAC__StreamDecoder *decoder, unsigned channel, un
        return true;
 }
 
-FLAC__bool read_subframe_verbatim_(FLAC__StreamDecoder *decoder, unsigned channel, unsigned bps, FLAC__bool do_full_decode)
+FLAC__bool read_subframe_verbatim_(FLAC__StreamDecoder *decoder, uint32_t channel, uint32_t bps, FLAC__bool do_full_decode)
 {
        FLAC__Subframe_Verbatim *subframe = &decoder->private_->frame.subframes[channel].data.verbatim;
        FLAC__int32 x, *residual = decoder->private_->residual[channel];
-       unsigned i;
+       uint32_t i;
 
        decoder->private_->frame.subframes[channel].type = FLAC__SUBFRAME_TYPE_VERBATIM;
 
@@ -2745,15 +2745,15 @@ FLAC__bool read_subframe_verbatim_(FLAC__StreamDecoder *decoder, unsigned channe
        return true;
 }
 
-FLAC__bool read_residual_partitioned_rice_(FLAC__StreamDecoder *decoder, unsigned predictor_order, unsigned partition_order, FLAC__EntropyCodingMethod_PartitionedRiceContents *partitioned_rice_contents, FLAC__int32 *residual, FLAC__bool is_extended)
+FLAC__bool read_residual_partitioned_rice_(FLAC__StreamDecoder *decoder, uint32_t predictor_order, uint32_t partition_order, FLAC__EntropyCodingMethod_PartitionedRiceContents *partitioned_rice_contents, FLAC__int32 *residual, FLAC__bool is_extended)
 {
        FLAC__uint32 rice_parameter;
        int i;
-       unsigned partition, sample, u;
-       const unsigned partitions = 1u << partition_order;
-       const unsigned partition_samples = partition_order > 0? decoder->private_->frame.header.blocksize >> partition_order : decoder->private_->frame.header.blocksize - predictor_order;
-       const unsigned plen = is_extended? FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_PARAMETER_LEN : FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_PARAMETER_LEN;
-       const unsigned pesc = is_extended? FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_ESCAPE_PARAMETER : FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER;
+       uint32_t partition, sample, u;
+       const uint32_t partitions = 1u << partition_order;
+       const uint32_t partition_samples = partition_order > 0? decoder->private_->frame.header.blocksize >> partition_order : decoder->private_->frame.header.blocksize - predictor_order;
+       const uint32_t plen = is_extended? FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_PARAMETER_LEN : FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_PARAMETER_LEN;
+       const uint32_t pesc = is_extended? FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_ESCAPE_PARAMETER : FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER;
 
        /* invalid predictor and partition orders mush be handled in the callers */
        FLAC__ASSERT(partition_order > 0? partition_samples >= predictor_order : decoder->private_->frame.header.blocksize >= predictor_order);
@@ -2944,12 +2944,12 @@ FLAC__StreamDecoderWriteStatus write_audio_frame_to_client_(FLAC__StreamDecoder
 #endif
                decoder->private_->last_frame = *frame; /* save the frame */
                if(this_frame_sample <= target_sample && target_sample < next_frame_sample) { /* we hit our target frame */
-                       unsigned delta = (unsigned)(target_sample - this_frame_sample);
+                       uint32_t delta = (uint32_t)(target_sample - this_frame_sample);
                        /* kick out of seek mode */
                        decoder->private_->is_seeking = false;
                        /* shift out the samples before target_sample */
                        if(delta > 0) {
-                               unsigned channel;
+                               uint32_t channel;
                                const FLAC__int32 *newbuffer[FLAC__MAX_CHANNELS];
                                for(channel = 0; channel < frame->header.channels; channel++)
                                        newbuffer[channel] = buffer[channel] + delta;
@@ -2995,16 +2995,16 @@ FLAC__bool seek_to_absolute_sample_(FLAC__StreamDecoder *decoder, FLAC__uint64 s
        FLAC__uint64 first_frame_offset = decoder->private_->first_frame_offset, lower_bound, upper_bound, lower_bound_sample, upper_bound_sample, this_frame_sample;
        FLAC__int64 pos = -1;
        int i;
-       unsigned approx_bytes_per_frame;
+       uint32_t approx_bytes_per_frame;
        FLAC__bool first_seek = true;
        const FLAC__uint64 total_samples = FLAC__stream_decoder_get_total_samples(decoder);
-       const unsigned min_blocksize = decoder->private_->stream_info.data.stream_info.min_blocksize;
-       const unsigned max_blocksize = decoder->private_->stream_info.data.stream_info.max_blocksize;
-       const unsigned max_framesize = decoder->private_->stream_info.data.stream_info.max_framesize;
-       const unsigned min_framesize = decoder->private_->stream_info.data.stream_info.min_framesize;
+       const uint32_t min_blocksize = decoder->private_->stream_info.data.stream_info.min_blocksize;
+       const uint32_t max_blocksize = decoder->private_->stream_info.data.stream_info.max_blocksize;
+       const uint32_t max_framesize = decoder->private_->stream_info.data.stream_info.max_framesize;
+       const uint32_t min_framesize = decoder->private_->stream_info.data.stream_info.min_framesize;
        /* take these from the current frame in case they've changed mid-stream */
-       unsigned channels = FLAC__stream_decoder_get_channels(decoder);
-       unsigned bps = FLAC__stream_decoder_get_bits_per_sample(decoder);
+       uint32_t channels = FLAC__stream_decoder_get_channels(decoder);
+       uint32_t bps = FLAC__stream_decoder_get_bits_per_sample(decoder);
        const FLAC__StreamMetadata_SeekTable *seek_table = decoder->private_->has_seek_table? &decoder->private_->seek_table.data.seek_table : 0;
 
        /* use values from stream info if we didn't decode a frame */
@@ -3185,7 +3185,7 @@ FLAC__bool seek_to_absolute_sample_(FLAC__StreamDecoder *decoder, FLAC__uint64 s
                                decoder->protected_->state = FLAC__STREAM_DECODER_SEEK_ERROR;
                                return false;
                        }
-                       approx_bytes_per_frame = (unsigned)(2 * (upper_bound - pos) / 3 + 16);
+                       approx_bytes_per_frame = (uint32_t)(2 * (upper_bound - pos) / 3 + 16);
                }
                else { /* target_sample >= this_frame_sample + this frame's blocksize */
                        lower_bound_sample = this_frame_sample + decoder->private_->last_frame.header.blocksize;
@@ -3193,7 +3193,7 @@ FLAC__bool seek_to_absolute_sample_(FLAC__StreamDecoder *decoder, FLAC__uint64 s
                                decoder->protected_->state = FLAC__STREAM_DECODER_SEEK_ERROR;
                                return false;
                        }
-                       approx_bytes_per_frame = (unsigned)(2 * (lower_bound - pos) / 3 + 16);
+                       approx_bytes_per_frame = (uint32_t)(2 * (lower_bound - pos) / 3 + 16);
                }
        }
 
@@ -3208,14 +3208,14 @@ FLAC__bool seek_to_absolute_sample_ogg_(FLAC__StreamDecoder *decoder, FLAC__uint
        FLAC__uint64 this_frame_sample = (FLAC__uint64)0 - 1;
        FLAC__uint64 pos = 0; /* only initialized to avoid compiler warning */
        FLAC__bool did_a_seek;
-       unsigned iteration = 0;
+       uint32_t iteration = 0;
 
        /* In the first iterations, we will calculate the target byte position
         * by the distance from the target sample to left_sample and
         * right_sample (let's call it "proportional search").  After that, we
         * will switch to binary search.
         */
-       unsigned BINARY_SEARCH_AFTER_ITERATION = 2;
+       uint32_t BINARY_SEARCH_AFTER_ITERATION = 2;
 
        /* We will switch to a linear search once our current sample is less
         * than this number of samples ahead of the target sample
index e1cba75..9279c0a 100644 (file)
 
 typedef struct {
        FLAC__int32 *data[FLAC__MAX_CHANNELS];
-       unsigned size; /* of each data[] in samples */
-       unsigned tail;
+       uint32_t size; /* of each data[] in samples */
+       uint32_t tail;
 } verify_input_fifo;
 
 typedef struct {
        const FLAC__byte *data;
-       unsigned capacity;
-       unsigned bytes;
+       uint32_t capacity;
+       uint32_t bytes;
 } verify_output;
 
 typedef enum {
@@ -102,14 +102,14 @@ typedef enum {
 static const  struct CompressionLevels {
        FLAC__bool do_mid_side_stereo;
        FLAC__bool loose_mid_side_stereo;
-       unsigned max_lpc_order;
-       unsigned qlp_coeff_precision;
+       uint32_t max_lpc_order;
+       uint32_t qlp_coeff_precision;
        FLAC__bool do_qlp_coeff_prec_search;
        FLAC__bool do_escape_coding;
        FLAC__bool do_exhaustive_model_search;
-       unsigned min_residual_partition_order;
-       unsigned max_residual_partition_order;
-       unsigned rice_parameter_search_dist;
+       uint32_t min_residual_partition_order;
+       uint32_t max_residual_partition_order;
+       uint32_t rice_parameter_search_dist;
        const char *apodization;
 } compression_levels_[] = {
        { false, false,  0, 0, false, false, false, 0, 3, 0, "tukey(5e-1)" },
@@ -133,9 +133,9 @@ static const  struct CompressionLevels {
 
 static void set_defaults_(FLAC__StreamEncoder *encoder);
 static void free_(FLAC__StreamEncoder *encoder);
-static FLAC__bool resize_buffers_(FLAC__StreamEncoder *encoder, unsigned new_blocksize);
-static FLAC__bool write_bitbuffer_(FLAC__StreamEncoder *encoder, unsigned samples, FLAC__bool is_last_block);
-static FLAC__StreamEncoderWriteStatus write_frame_(FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], size_t bytes, unsigned samples, FLAC__bool is_last_block);
+static FLAC__bool resize_buffers_(FLAC__StreamEncoder *encoder, uint32_t new_blocksize);
+static FLAC__bool write_bitbuffer_(FLAC__StreamEncoder *encoder, uint32_t samples, FLAC__bool is_last_block);
+static FLAC__StreamEncoderWriteStatus write_frame_(FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], size_t bytes, uint32_t samples, FLAC__bool is_last_block);
 static void update_metadata_(const FLAC__StreamEncoder *encoder);
 #if FLAC__HAS_OGG
 static void update_ogg_metadata_(FLAC__StreamEncoder *encoder);
@@ -145,118 +145,118 @@ static FLAC__bool process_subframes_(FLAC__StreamEncoder *encoder, FLAC__bool is
 
 static FLAC__bool process_subframe_(
        FLAC__StreamEncoder *encoder,
-       unsigned min_partition_order,
-       unsigned max_partition_order,
+       uint32_t min_partition_order,
+       uint32_t max_partition_order,
        const FLAC__FrameHeader *frame_header,
-       unsigned subframe_bps,
+       uint32_t subframe_bps,
        const FLAC__int32 integer_signal[],
        FLAC__Subframe *subframe[2],
        FLAC__EntropyCodingMethod_PartitionedRiceContents *partitioned_rice_contents[2],
        FLAC__int32 *residual[2],
-       unsigned *best_subframe,
-       unsigned *best_bits
+       uint32_t *best_subframe,
+       uint32_t *best_bits
 );
 
 static FLAC__bool add_subframe_(
        FLAC__StreamEncoder *encoder,
-       unsigned blocksize,
-       unsigned subframe_bps,
+       uint32_t blocksize,
+       uint32_t subframe_bps,
        const FLAC__Subframe *subframe,
        FLAC__BitWriter *frame
 );
 
-static unsigned evaluate_constant_subframe_(
+static uint32_t evaluate_constant_subframe_(
        FLAC__StreamEncoder *encoder,
        const FLAC__int32 signal,
-       unsigned blocksize,
-       unsigned subframe_bps,
+       uint32_t blocksize,
+       uint32_t subframe_bps,
        FLAC__Subframe *subframe
 );
 
-static unsigned evaluate_fixed_subframe_(
+static uint32_t evaluate_fixed_subframe_(
        FLAC__StreamEncoder *encoder,
        const FLAC__int32 signal[],
        FLAC__int32 residual[],
        FLAC__uint64 abs_residual_partition_sums[],
-       unsigned raw_bits_per_partition[],
-       unsigned blocksize,
-       unsigned subframe_bps,
-       unsigned order,
-       unsigned rice_parameter,
-       unsigned rice_parameter_limit,
-       unsigned min_partition_order,
-       unsigned max_partition_order,
+       uint32_t raw_bits_per_partition[],
+       uint32_t blocksize,
+       uint32_t subframe_bps,
+       uint32_t order,
+       uint32_t rice_parameter,
+       uint32_t rice_parameter_limit,
+       uint32_t min_partition_order,
+       uint32_t max_partition_order,
        FLAC__bool do_escape_coding,
-       unsigned rice_parameter_search_dist,
+       uint32_t rice_parameter_search_dist,
        FLAC__Subframe *subframe,
        FLAC__EntropyCodingMethod_PartitionedRiceContents *partitioned_rice_contents
 );
 
 #ifndef FLAC__INTEGER_ONLY_LIBRARY
-static unsigned evaluate_lpc_subframe_(
+static uint32_t evaluate_lpc_subframe_(
        FLAC__StreamEncoder *encoder,
        const FLAC__int32 signal[],
        FLAC__int32 residual[],
        FLAC__uint64 abs_residual_partition_sums[],
-       unsigned raw_bits_per_partition[],
+       uint32_t raw_bits_per_partition[],
        const FLAC__real lp_coeff[],
-       unsigned blocksize,
-       unsigned subframe_bps,
-       unsigned order,
-       unsigned qlp_coeff_precision,
-       unsigned rice_parameter,
-       unsigned rice_parameter_limit,
-       unsigned min_partition_order,
-       unsigned max_partition_order,
+       uint32_t blocksize,
+       uint32_t subframe_bps,
+       uint32_t order,
+       uint32_t qlp_coeff_precision,
+       uint32_t rice_parameter,
+       uint32_t rice_parameter_limit,
+       uint32_t min_partition_order,
+       uint32_t max_partition_order,
        FLAC__bool do_escape_coding,
-       unsigned rice_parameter_search_dist,
+       uint32_t rice_parameter_search_dist,
        FLAC__Subframe *subframe,
        FLAC__EntropyCodingMethod_PartitionedRiceContents *partitioned_rice_contents
 );
 #endif
 
-static unsigned evaluate_verbatim_subframe_(
+static uint32_t evaluate_verbatim_subframe_(
        FLAC__StreamEncoder *encoder,
        const FLAC__int32 signal[],
-       unsigned blocksize,
-       unsigned subframe_bps,
+       uint32_t blocksize,
+       uint32_t subframe_bps,
        FLAC__Subframe *subframe
 );
 
-static unsigned find_best_partition_order_(
+static uint32_t find_best_partition_order_(
        struct FLAC__StreamEncoderPrivate *private_,
        const FLAC__int32 residual[],
        FLAC__uint64 abs_residual_partition_sums[],
-       unsigned raw_bits_per_partition[],
-       unsigned residual_samples,
-       unsigned predictor_order,
-       unsigned rice_parameter,
-       unsigned rice_parameter_limit,
-       unsigned min_partition_order,
-       unsigned max_partition_order,
-       unsigned bps,
+       uint32_t raw_bits_per_partition[],
+       uint32_t residual_samples,
+       uint32_t predictor_order,
+       uint32_t rice_parameter,
+       uint32_t rice_parameter_limit,
+       uint32_t min_partition_order,
+       uint32_t max_partition_order,
+       uint32_t bps,
        FLAC__bool do_escape_coding,
-       unsigned rice_parameter_search_dist,
+       uint32_t rice_parameter_search_dist,
        FLAC__EntropyCodingMethod *best_ecm
 );
 
 static void precompute_partition_info_sums_(
        const FLAC__int32 residual[],
        FLAC__uint64 abs_residual_partition_sums[],
-       unsigned residual_samples,
-       unsigned predictor_order,
-       unsigned min_partition_order,
-       unsigned max_partition_order,
-       unsigned bps
+       uint32_t residual_samples,
+       uint32_t predictor_order,
+       uint32_t min_partition_order,
+       uint32_t max_partition_order,
+       uint32_t bps
 );
 
 static void precompute_partition_info_escapes_(
        const FLAC__int32 residual[],
-       unsigned raw_bits_per_partition[],
-       unsigned residual_samples,
-       unsigned predictor_order,
-       unsigned min_partition_order,
-       unsigned max_partition_order
+       uint32_t raw_bits_per_partition[],
+       uint32_t residual_samples,
+       uint32_t predictor_order,
+       uint32_t min_partition_order,
+       uint32_t max_partition_order
 );
 
 static FLAC__bool set_partitioned_rice_(
@@ -264,35 +264,35 @@ static FLAC__bool set_partitioned_rice_(
        const FLAC__int32 residual[],
 #endif
        const FLAC__uint64 abs_residual_partition_sums[],
-       const unsigned raw_bits_per_partition[],
-       const unsigned residual_samples,
-       const unsigned predictor_order,
-       const unsigned suggested_rice_parameter,
-       const unsigned rice_parameter_limit,
-       const unsigned rice_parameter_search_dist,
-       const unsigned partition_order,
+       const uint32_t raw_bits_per_partition[],
+       const uint32_t residual_samples,
+       const uint32_t predictor_order,
+       const uint32_t suggested_rice_parameter,
+       const uint32_t rice_parameter_limit,
+       const uint32_t rice_parameter_search_dist,
+       const uint32_t partition_order,
        const FLAC__bool search_for_escapes,
        FLAC__EntropyCodingMethod_PartitionedRiceContents *partitioned_rice_contents,
-       unsigned *bits
+       uint32_t *bits
 );
 
-static unsigned get_wasted_bits_(FLAC__int32 signal[], unsigned samples);
+static uint32_t get_wasted_bits_(FLAC__int32 signal[], uint32_t samples);
 
 /* verify-related routines: */
 static void append_to_verify_fifo_(
        verify_input_fifo *fifo,
        const FLAC__int32 * const input[],
-       unsigned input_offset,
-       unsigned channels,
-       unsigned wide_samples
+       uint32_t input_offset,
+       uint32_t channels,
+       uint32_t wide_samples
 );
 
 static void append_to_verify_fifo_interleaved_(
        verify_input_fifo *fifo,
        const FLAC__int32 input[],
-       unsigned input_offset,
-       unsigned channels,
-       unsigned wide_samples
+       uint32_t input_offset,
+       uint32_t channels,
+       uint32_t wide_samples
 );
 
 static FLAC__StreamDecoderReadStatus verify_read_callback_(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *bytes, void *client_data);
@@ -303,7 +303,7 @@ static void verify_error_callback_(const FLAC__StreamDecoder *decoder, FLAC__Str
 static FLAC__StreamEncoderReadStatus file_read_callback_(const FLAC__StreamEncoder *encoder, FLAC__byte buffer[], size_t *bytes, void *client_data);
 static FLAC__StreamEncoderSeekStatus file_seek_callback_(const FLAC__StreamEncoder *encoder, FLAC__uint64 absolute_byte_offset, void *client_data);
 static FLAC__StreamEncoderTellStatus file_tell_callback_(const FLAC__StreamEncoder *encoder, FLAC__uint64 *absolute_byte_offset, void *client_data);
-static FLAC__StreamEncoderWriteStatus file_write_callback_(const FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], size_t bytes, unsigned samples, unsigned current_frame, void *client_data);
+static FLAC__StreamEncoderWriteStatus file_write_callback_(const FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], size_t bytes, uint32_t samples, uint32_t current_frame, void *client_data);
 static FILE *get_binary_stdout_(void);
 
 
@@ -314,7 +314,7 @@ static FILE *get_binary_stdout_(void);
  ***********************************************************************/
 
 typedef struct FLAC__StreamEncoderPrivate {
-       unsigned input_capacity;                          /* current size (in samples) of the signal and residual buffers */
+       uint32_t input_capacity;                          /* current size (in samples) of the signal and residual buffers */
        FLAC__int32 *integer_signal[FLAC__MAX_CHANNELS];  /* the integer version of the input signal */
        FLAC__int32 *integer_signal_mid_side[2];          /* the integer version of the mid-side input signal (stereo only) */
 #ifndef FLAC__INTEGER_ONLY_LIBRARY
@@ -323,8 +323,8 @@ typedef struct FLAC__StreamEncoderPrivate {
        FLAC__real *window[FLAC__MAX_APODIZATION_FUNCTIONS]; /* the pre-computed floating-point window for each apodization function */
        FLAC__real *windowed_signal;                      /* the integer_signal[] * current window[] */
 #endif
-       unsigned subframe_bps[FLAC__MAX_CHANNELS];        /* the effective bits per sample of the input signal (stream bps - wasted bits) */
-       unsigned subframe_bps_mid_side[2];                /* the effective bits per sample of the mid-side input signal (stream bps - wasted bits + 0/1) */
+       uint32_t subframe_bps[FLAC__MAX_CHANNELS];        /* the effective bits per sample of the input signal (stream bps - wasted bits) */
+       uint32_t subframe_bps_mid_side[2];                /* the effective bits per sample of the mid-side input signal (stream bps - wasted bits + 0/1) */
        FLAC__int32 *residual_workspace[FLAC__MAX_CHANNELS][2]; /* each channel has a candidate and best workspace where the subframe residual signals will be stored */
        FLAC__int32 *residual_workspace_mid_side[2][2];
        FLAC__Subframe subframe_workspace[FLAC__MAX_CHANNELS][2];
@@ -335,35 +335,35 @@ typedef struct FLAC__StreamEncoderPrivate {
        FLAC__EntropyCodingMethod_PartitionedRiceContents partitioned_rice_contents_workspace_mid_side[FLAC__MAX_CHANNELS][2];
        FLAC__EntropyCodingMethod_PartitionedRiceContents *partitioned_rice_contents_workspace_ptr[FLAC__MAX_CHANNELS][2];
        FLAC__EntropyCodingMethod_PartitionedRiceContents *partitioned_rice_contents_workspace_ptr_mid_side[FLAC__MAX_CHANNELS][2];
-       unsigned best_subframe[FLAC__MAX_CHANNELS];       /* index (0 or 1) into 2nd dimension of the above workspaces */
-       unsigned best_subframe_mid_side[2];
-       unsigned best_subframe_bits[FLAC__MAX_CHANNELS];  /* size in bits of the best subframe for each channel */
-       unsigned best_subframe_bits_mid_side[2];
+       uint32_t best_subframe[FLAC__MAX_CHANNELS];       /* index (0 or 1) into 2nd dimension of the above workspaces */
+       uint32_t best_subframe_mid_side[2];
+       uint32_t best_subframe_bits[FLAC__MAX_CHANNELS];  /* size in bits of the best subframe for each channel */
+       uint32_t best_subframe_bits_mid_side[2];
        FLAC__uint64 *abs_residual_partition_sums;        /* workspace where the sum of abs(candidate residual) for each partition is stored */
-       unsigned *raw_bits_per_partition;                 /* workspace where the sum of silog2(candidate residual) for each partition is stored */
+       uint32_t *raw_bits_per_partition;                 /* workspace where the sum of silog2(candidate residual) for each partition is stored */
        FLAC__BitWriter *frame;                           /* the current frame being worked on */
-       unsigned loose_mid_side_stereo_frames;            /* rounded number of frames the encoder will use before trying both independent and mid/side frames again */
-       unsigned loose_mid_side_stereo_frame_count;       /* number of frames using the current channel assignment */
+       uint32_t loose_mid_side_stereo_frames;            /* rounded number of frames the encoder will use before trying both independent and mid/side frames again */
+       uint32_t loose_mid_side_stereo_frame_count;       /* number of frames using the current channel assignment */
        FLAC__ChannelAssignment last_channel_assignment;
        FLAC__StreamMetadata streaminfo;                  /* scratchpad for STREAMINFO as it is built */
        FLAC__StreamMetadata_SeekTable *seek_table;       /* pointer into encoder->protected_->metadata_ where the seek table is */
-       unsigned current_sample_number;
-       unsigned current_frame_number;
+       uint32_t current_sample_number;
+       uint32_t current_frame_number;
        FLAC__MD5Context md5context;
        FLAC__CPUInfo cpuinfo;
-       void (*local_precompute_partition_info_sums)(const FLAC__int32 residual[], FLAC__uint64 abs_residual_partition_sums[], unsigned residual_samples, unsigned predictor_order, unsigned min_partition_order, unsigned max_partition_order, unsigned bps);
+       void (*local_precompute_partition_info_sums)(const FLAC__int32 residual[], FLAC__uint64 abs_residual_partition_sums[], uint32_t residual_samples, uint32_t predictor_order, uint32_t min_partition_order, uint32_t max_partition_order, uint32_t bps);
 #ifndef FLAC__INTEGER_ONLY_LIBRARY
-       unsigned (*local_fixed_compute_best_predictor)(const FLAC__int32 data[], unsigned data_len, float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]);
-       unsigned (*local_fixed_compute_best_predictor_wide)(const FLAC__int32 data[], unsigned data_len, float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]);
+       uint32_t (*local_fixed_compute_best_predictor)(const FLAC__int32 data[], uint32_t data_len, float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]);
+       uint32_t (*local_fixed_compute_best_predictor_wide)(const FLAC__int32 data[], uint32_t data_len, float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]);
 #else
-       unsigned (*local_fixed_compute_best_predictor)(const FLAC__int32 data[], unsigned data_len, FLAC__fixedpoint residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]);
-       unsigned (*local_fixed_compute_best_predictor_wide)(const FLAC__int32 data[], unsigned data_len, FLAC__fixedpoint residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]);
+       uint32_t (*local_fixed_compute_best_predictor)(const FLAC__int32 data[], uint32_t data_len, FLAC__fixedpoint residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]);
+       uint32_t (*local_fixed_compute_best_predictor_wide)(const FLAC__int32 data[], uint32_t data_len, FLAC__fixedpoint residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]);
 #endif
 #ifndef FLAC__INTEGER_ONLY_LIBRARY
-       void (*local_lpc_compute_autocorrelation)(const FLAC__real data[], unsigned data_len, unsigned lag, FLAC__real autoc[]);
-       void (*local_lpc_compute_residual_from_qlp_coefficients)(const FLAC__int32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 residual[]);
-       void (*local_lpc_compute_residual_from_qlp_coefficients_64bit)(const FLAC__int32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 residual[]);
-       void (*local_lpc_compute_residual_from_qlp_coefficients_16bit)(const FLAC__int32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 residual[]);
+       void (*local_lpc_compute_autocorrelation)(const FLAC__real data[], uint32_t data_len, uint32_t lag, FLAC__real autoc[]);
+       void (*local_lpc_compute_residual_from_qlp_coefficients)(const FLAC__int32 *data, uint32_t data_len, const FLAC__int32 qlp_coeff[], uint32_t order, int lp_quantization, FLAC__int32 residual[]);
+       void (*local_lpc_compute_residual_from_qlp_coefficients_64bit)(const FLAC__int32 *data, uint32_t data_len, const FLAC__int32 qlp_coeff[], uint32_t order, int lp_quantization, FLAC__int32 residual[]);
+       void (*local_lpc_compute_residual_from_qlp_coefficients_16bit)(const FLAC__int32 *data, uint32_t data_len, const FLAC__int32 qlp_coeff[], uint32_t order, int lp_quantization, FLAC__int32 residual[]);
 #endif
        FLAC__bool disable_constant_subframes;
        FLAC__bool disable_fixed_subframes;
@@ -376,12 +376,12 @@ typedef struct FLAC__StreamEncoderPrivate {
        FLAC__StreamEncoderMetadataCallback metadata_callback;
        FLAC__StreamEncoderProgressCallback progress_callback;
        void *client_data;
-       unsigned first_seekpoint_to_check;
+       uint32_t first_seekpoint_to_check;
        FILE *file;                            /* only used when encoding to a file */
        FLAC__uint64 bytes_written;
        FLAC__uint64 samples_written;
-       unsigned frames_written;
-       unsigned total_frames_estimate;
+       uint32_t frames_written;
+       uint32_t total_frames_estimate;
        /* unaligned (original) pointers to allocated data */
        FLAC__int32 *integer_signal_unaligned[FLAC__MAX_CHANNELS];
        FLAC__int32 *integer_signal_mid_side_unaligned[2];
@@ -394,7 +394,7 @@ typedef struct FLAC__StreamEncoderPrivate {
        FLAC__int32 *residual_workspace_unaligned[FLAC__MAX_CHANNELS][2];
        FLAC__int32 *residual_workspace_mid_side_unaligned[2][2];
        FLAC__uint64 *abs_residual_partition_sums_unaligned;
-       unsigned *raw_bits_per_partition_unaligned;
+       uint32_t *raw_bits_per_partition_unaligned;
        /*
         * These fields have been moved here from private function local
         * declarations merely to save stack space during encoding.
@@ -414,9 +414,9 @@ typedef struct FLAC__StreamEncoderPrivate {
                verify_output output;
                struct {
                        FLAC__uint64 absolute_sample;
-                       unsigned frame_number;
-                       unsigned channel;
-                       unsigned sample;
+                       uint32_t frame_number;
+                       uint32_t channel;
+                       uint32_t sample;
                        FLAC__int32 expected;
                        FLAC__int32 got;
                } error_stats;
@@ -494,7 +494,7 @@ FLAC_API const char * const FLAC__StreamEncoderTellStatusString[] = {
  * WATCHOUT: some parts of the code assert that OVERREAD_ == 1 and there's
  * not really any reason to change it.
  */
-static const unsigned OVERREAD_ = 1;
+static const uint32_t OVERREAD_ = 1;
 
 /***********************************************************************
  *
@@ -504,7 +504,7 @@ static const unsigned OVERREAD_ = 1;
 FLAC_API FLAC__StreamEncoder *FLAC__stream_encoder_new(void)
 {
        FLAC__StreamEncoder *encoder;
-       unsigned i;
+       uint32_t i;
 
        FLAC__ASSERT(sizeof(int) >= 4); /* we want to die right away if this is not true */
 
@@ -575,7 +575,7 @@ FLAC_API FLAC__StreamEncoder *FLAC__stream_encoder_new(void)
 
 FLAC_API void FLAC__stream_encoder_delete(FLAC__StreamEncoder *encoder)
 {
-       unsigned i;
+       uint32_t i;
 
        if (encoder == NULL)
                return ;
@@ -625,7 +625,7 @@ static FLAC__StreamEncoderInitStatus init_stream_internal_(
        FLAC__bool is_ogg
 )
 {
-       unsigned i;
+       uint32_t i;
        FLAC__bool metadata_has_seektable, metadata_has_vorbis_comment, metadata_picture_has_type1, metadata_picture_has_type2;
 
        FLAC__ASSERT(0 != encoder);
@@ -743,7 +743,7 @@ static FLAC__StreamEncoderInitStatus init_stream_internal_(
 #if FLAC__HAS_OGG
        /* reorder metadata if necessary to ensure that any VORBIS_COMMENT is the first, according to the mapping spec */
        if(is_ogg && 0 != encoder->protected_->metadata && encoder->protected_->num_metadata_blocks > 1) {
-               unsigned i1;
+               uint32_t i1;
                for(i1 = 1; i1 < encoder->protected_->num_metadata_blocks; i1++) {
                        if(0 != encoder->protected_->metadata[i1] && encoder->protected_->metadata[i1]->type == FLAC__METADATA_TYPE_VORBIS_COMMENT) {
                                FLAC__StreamMetadata *vc = encoder->protected_->metadata[i1];
@@ -757,7 +757,7 @@ static FLAC__StreamEncoderInitStatus init_stream_internal_(
 #endif
        /* keep track of any SEEKTABLE block */
        if(0 != encoder->protected_->metadata && encoder->protected_->num_metadata_blocks > 0) {
-               unsigned i2;
+               uint32_t i2;
                for(i2 = 0; i2 < encoder->protected_->num_metadata_blocks; i2++) {
                        if(0 != encoder->protected_->metadata[i2] && encoder->protected_->metadata[i2]->type == FLAC__METADATA_TYPE_SEEKTABLE) {
                                encoder->private_->seek_table = &encoder->protected_->metadata[i2]->data.seek_table;
@@ -850,7 +850,7 @@ static FLAC__StreamEncoderInitStatus init_stream_internal_(
        encoder->private_->abs_residual_partition_sums_unaligned = encoder->private_->abs_residual_partition_sums = 0;
        encoder->private_->raw_bits_per_partition_unaligned = encoder->private_->raw_bits_per_partition = 0;
 #ifndef FLAC__INTEGER_ONLY_LIBRARY
-       encoder->private_->loose_mid_side_stereo_frames = (unsigned)((double)encoder->protected_->sample_rate * 0.4 / (double)encoder->protected_->blocksize + 0.5);
+       encoder->private_->loose_mid_side_stereo_frames = (uint32_t)((double)encoder->protected_->sample_rate * 0.4 / (double)encoder->protected_->blocksize + 0.5);
 #else
        /* 26214 is the approximate fixed-point equivalent to 0.4 (0.4 * 2^16) */
        /* sample rate can be up to 655350 Hz, and thus use 20 bits, so we do the multiply&divide by hand */
@@ -858,7 +858,7 @@ static FLAC__StreamEncoderInitStatus init_stream_internal_(
        FLAC__ASSERT(FLAC__MAX_BLOCK_SIZE <= 65535);
        FLAC__ASSERT(encoder->protected_->sample_rate <= 655350);
        FLAC__ASSERT(encoder->protected_->blocksize <= 65535);
-       encoder->private_->loose_mid_side_stereo_frames = (unsigned)FLAC__fixedpoint_trunc((((FLAC__uint64)(encoder->protected_->sample_rate) * (FLAC__uint64)(26214)) << 16) / (encoder->protected_->blocksize<<16) + FLAC__FP_ONE_HALF);
+       encoder->private_->loose_mid_side_stereo_frames = (uint32_t)FLAC__fixedpoint_trunc((((FLAC__uint64)(encoder->protected_->sample_rate) * (FLAC__uint64)(26214)) << 16) / (encoder->protected_->blocksize<<16) + FLAC__FP_ONE_HALF);
 #endif
        if(encoder->private_->loose_mid_side_stereo_frames == 0)
                encoder->private_->loose_mid_side_stereo_frames = 1;
@@ -1356,10 +1356,10 @@ static FLAC__StreamEncoderInitStatus init_FILE_internal_(
        }
 
        {
-               unsigned blocksize = FLAC__stream_encoder_get_blocksize(encoder);
+               uint32_t blocksize = FLAC__stream_encoder_get_blocksize(encoder);
 
                FLAC__ASSERT(blocksize != 0);
-               encoder->private_->total_frames_estimate = (unsigned)((FLAC__stream_encoder_get_total_samples_estimate(encoder) + blocksize - 1) / blocksize);
+               encoder->private_->total_frames_estimate = (uint32_t)((FLAC__stream_encoder_get_total_samples_estimate(encoder) + blocksize - 1) / blocksize);
        }
 
        return init_status;
@@ -1555,7 +1555,7 @@ FLAC_API FLAC__bool FLAC__stream_encoder_set_do_md5(FLAC__StreamEncoder *encoder
        return true;
 }
 
-FLAC_API FLAC__bool FLAC__stream_encoder_set_channels(FLAC__StreamEncoder *encoder, unsigned value)
+FLAC_API FLAC__bool FLAC__stream_encoder_set_channels(FLAC__StreamEncoder *encoder, uint32_t value)
 {
        FLAC__ASSERT(0 != encoder);
        FLAC__ASSERT(0 != encoder->private_);
@@ -1566,7 +1566,7 @@ FLAC_API FLAC__bool FLAC__stream_encoder_set_channels(FLAC__StreamEncoder *encod
        return true;
 }
 
-FLAC_API FLAC__bool FLAC__stream_encoder_set_bits_per_sample(FLAC__StreamEncoder *encoder, unsigned value)
+FLAC_API FLAC__bool FLAC__stream_encoder_set_bits_per_sample(FLAC__StreamEncoder *encoder, uint32_t value)
 {
        FLAC__ASSERT(0 != encoder);
        FLAC__ASSERT(0 != encoder->private_);
@@ -1577,7 +1577,7 @@ FLAC_API FLAC__bool FLAC__stream_encoder_set_bits_per_sample(FLAC__StreamEncoder
        return true;
 }
 
-FLAC_API FLAC__bool FLAC__stream_encoder_set_sample_rate(FLAC__StreamEncoder *encoder, unsigned value)
+FLAC_API FLAC__bool FLAC__stream_encoder_set_sample_rate(FLAC__StreamEncoder *encoder, uint32_t value)
 {
        FLAC__ASSERT(0 != encoder);
        FLAC__ASSERT(0 != encoder->private_);
@@ -1588,7 +1588,7 @@ FLAC_API FLAC__bool FLAC__stream_encoder_set_sample_rate(FLAC__StreamEncoder *en
        return true;
 }
 
-FLAC_API FLAC__bool FLAC__stream_encoder_set_compression_level(FLAC__StreamEncoder *encoder, unsigned value)
+FLAC_API FLAC__bool FLAC__stream_encoder_set_compression_level(FLAC__StreamEncoder *encoder, uint32_t value)
 {
        FLAC__bool ok = true;
        FLAC__ASSERT(0 != encoder);
@@ -1621,7 +1621,7 @@ FLAC_API FLAC__bool FLAC__stream_encoder_set_compression_level(FLAC__StreamEncod
        return ok;
 }
 
-FLAC_API FLAC__bool FLAC__stream_encoder_set_blocksize(FLAC__StreamEncoder *encoder, unsigned value)
+FLAC_API FLAC__bool FLAC__stream_encoder_set_blocksize(FLAC__StreamEncoder *encoder, uint32_t value)
 {
        FLAC__ASSERT(0 != encoder);
        FLAC__ASSERT(0 != encoder->private_);
@@ -1768,7 +1768,7 @@ FLAC_API FLAC__bool FLAC__stream_encoder_set_apodization(FLAC__StreamEncoder *en
        return true;
 }
 
-FLAC_API FLAC__bool FLAC__stream_encoder_set_max_lpc_order(FLAC__StreamEncoder *encoder, unsigned value)
+FLAC_API FLAC__bool FLAC__stream_encoder_set_max_lpc_order(FLAC__StreamEncoder *encoder, uint32_t value)
 {
        FLAC__ASSERT(0 != encoder);
        FLAC__ASSERT(0 != encoder->private_);
@@ -1779,7 +1779,7 @@ FLAC_API FLAC__bool FLAC__stream_encoder_set_max_lpc_order(FLAC__StreamEncoder *
        return true;
 }
 
-FLAC_API FLAC__bool FLAC__stream_encoder_set_qlp_coeff_precision(FLAC__StreamEncoder *encoder, unsigned value)
+FLAC_API FLAC__bool FLAC__stream_encoder_set_qlp_coeff_precision(FLAC__StreamEncoder *encoder, uint32_t value)
 {
        FLAC__ASSERT(0 != encoder);
        FLAC__ASSERT(0 != encoder->private_);
@@ -1828,7 +1828,7 @@ FLAC_API FLAC__bool FLAC__stream_encoder_set_do_exhaustive_model_search(FLAC__St
        return true;
 }
 
-FLAC_API FLAC__bool FLAC__stream_encoder_set_min_residual_partition_order(FLAC__StreamEncoder *encoder, unsigned value)
+FLAC_API FLAC__bool FLAC__stream_encoder_set_min_residual_partition_order(FLAC__StreamEncoder *encoder, uint32_t value)
 {
        FLAC__ASSERT(0 != encoder);
        FLAC__ASSERT(0 != encoder->private_);
@@ -1839,7 +1839,7 @@ FLAC_API FLAC__bool FLAC__stream_encoder_set_min_residual_partition_order(FLAC__
        return true;
 }
 
-FLAC_API FLAC__bool FLAC__stream_encoder_set_max_residual_partition_order(FLAC__StreamEncoder *encoder, unsigned value)
+FLAC_API FLAC__bool FLAC__stream_encoder_set_max_residual_partition_order(FLAC__StreamEncoder *encoder, uint32_t value)
 {
        FLAC__ASSERT(0 != encoder);
        FLAC__ASSERT(0 != encoder->private_);
@@ -1850,7 +1850,7 @@ FLAC_API FLAC__bool FLAC__stream_encoder_set_max_residual_partition_order(FLAC__
        return true;
 }
 
-FLAC_API FLAC__bool FLAC__stream_encoder_set_rice_parameter_search_dist(FLAC__StreamEncoder *encoder, unsigned value)
+FLAC_API FLAC__bool FLAC__stream_encoder_set_rice_parameter_search_dist(FLAC__StreamEncoder *encoder, uint32_t value)
 {
        FLAC__ASSERT(0 != encoder);
        FLAC__ASSERT(0 != encoder->private_);
@@ -1878,7 +1878,7 @@ FLAC_API FLAC__bool FLAC__stream_encoder_set_total_samples_estimate(FLAC__Stream
        return true;
 }
 
-FLAC_API FLAC__bool FLAC__stream_encoder_set_metadata(FLAC__StreamEncoder *encoder, FLAC__StreamMetadata **metadata, unsigned num_blocks)
+FLAC_API FLAC__bool FLAC__stream_encoder_set_metadata(FLAC__StreamEncoder *encoder, FLAC__StreamMetadata **metadata, uint32_t num_blocks)
 {
        FLAC__ASSERT(0 != encoder);
        FLAC__ASSERT(0 != encoder->private_);
@@ -1977,7 +1977,7 @@ FLAC_API const char *FLAC__stream_encoder_get_resolved_state_string(const FLAC__
                return FLAC__stream_decoder_get_resolved_state_string(encoder->private_->verify.decoder);
 }
 
-FLAC_API void FLAC__stream_encoder_get_verify_decoder_error_stats(const FLAC__StreamEncoder *encoder, FLAC__uint64 *absolute_sample, unsigned *frame_number, unsigned *channel, unsigned *sample, FLAC__int32 *expected, FLAC__int32 *got)
+FLAC_API void FLAC__stream_encoder_get_verify_decoder_error_stats(const FLAC__StreamEncoder *encoder, FLAC__uint64 *absolute_sample, uint32_t *frame_number, uint32_t *channel, uint32_t *sample, FLAC__int32 *expected, FLAC__int32 *got)
 {
        FLAC__ASSERT(0 != encoder);
        FLAC__ASSERT(0 != encoder->private_);
@@ -2020,7 +2020,7 @@ FLAC_API FLAC__bool FLAC__stream_encoder_get_do_md5(const FLAC__StreamEncoder *e
        return encoder->protected_->do_md5;
 }
 
-FLAC_API unsigned FLAC__stream_encoder_get_channels(const FLAC__StreamEncoder *encoder)
+FLAC_API uint32_t FLAC__stream_encoder_get_channels(const FLAC__StreamEncoder *encoder)
 {
        FLAC__ASSERT(0 != encoder);
        FLAC__ASSERT(0 != encoder->private_);
@@ -2028,7 +2028,7 @@ FLAC_API unsigned FLAC__stream_encoder_get_channels(const FLAC__StreamEncoder *e
        return encoder->protected_->channels;
 }
 
-FLAC_API unsigned FLAC__stream_encoder_get_bits_per_sample(const FLAC__StreamEncoder *encoder)
+FLAC_API uint32_t FLAC__stream_encoder_get_bits_per_sample(const FLAC__StreamEncoder *encoder)
 {
        FLAC__ASSERT(0 != encoder);
        FLAC__ASSERT(0 != encoder->private_);
@@ -2036,7 +2036,7 @@ FLAC_API unsigned FLAC__stream_encoder_get_bits_per_sample(const FLAC__StreamEnc
        return encoder->protected_->bits_per_sample;
 }
 
-FLAC_API unsigned FLAC__stream_encoder_get_sample_rate(const FLAC__StreamEncoder *encoder)
+FLAC_API uint32_t FLAC__stream_encoder_get_sample_rate(const FLAC__StreamEncoder *encoder)
 {
        FLAC__ASSERT(0 != encoder);
        FLAC__ASSERT(0 != encoder->private_);
@@ -2044,7 +2044,7 @@ FLAC_API unsigned FLAC__stream_encoder_get_sample_rate(const FLAC__StreamEncoder
        return encoder->protected_->sample_rate;
 }
 
-FLAC_API unsigned FLAC__stream_encoder_get_blocksize(const FLAC__StreamEncoder *encoder)
+FLAC_API uint32_t FLAC__stream_encoder_get_blocksize(const FLAC__StreamEncoder *encoder)
 {
        FLAC__ASSERT(0 != encoder);
        FLAC__ASSERT(0 != encoder->private_);
@@ -2068,7 +2068,7 @@ FLAC_API FLAC__bool FLAC__stream_encoder_get_loose_mid_side_stereo(const FLAC__S
        return encoder->protected_->loose_mid_side_stereo;
 }
 
-FLAC_API unsigned FLAC__stream_encoder_get_max_lpc_order(const FLAC__StreamEncoder *encoder)
+FLAC_API uint32_t FLAC__stream_encoder_get_max_lpc_order(const FLAC__StreamEncoder *encoder)
 {
        FLAC__ASSERT(0 != encoder);
        FLAC__ASSERT(0 != encoder->private_);
@@ -2076,7 +2076,7 @@ FLAC_API unsigned FLAC__stream_encoder_get_max_lpc_order(const FLAC__StreamEncod
        return encoder->protected_->max_lpc_order;
 }
 
-FLAC_API unsigned FLAC__stream_encoder_get_qlp_coeff_precision(const FLAC__StreamEncoder *encoder)
+FLAC_API uint32_t FLAC__stream_encoder_get_qlp_coeff_precision(const FLAC__StreamEncoder *encoder)
 {
        FLAC__ASSERT(0 != encoder);
        FLAC__ASSERT(0 != encoder->private_);
@@ -2108,7 +2108,7 @@ FLAC_API FLAC__bool FLAC__stream_encoder_get_do_exhaustive_model_search(const FL
        return encoder->protected_->do_exhaustive_model_search;
 }
 
-FLAC_API unsigned FLAC__stream_encoder_get_min_residual_partition_order(const FLAC__StreamEncoder *encoder)
+FLAC_API uint32_t FLAC__stream_encoder_get_min_residual_partition_order(const FLAC__StreamEncoder *encoder)
 {
        FLAC__ASSERT(0 != encoder);
        FLAC__ASSERT(0 != encoder->private_);
@@ -2116,7 +2116,7 @@ FLAC_API unsigned FLAC__stream_encoder_get_min_residual_partition_order(const FL
        return encoder->protected_->min_residual_partition_order;
 }
 
-FLAC_API unsigned FLAC__stream_encoder_get_max_residual_partition_order(const FLAC__StreamEncoder *encoder)
+FLAC_API uint32_t FLAC__stream_encoder_get_max_residual_partition_order(const FLAC__StreamEncoder *encoder)
 {
        FLAC__ASSERT(0 != encoder);
        FLAC__ASSERT(0 != encoder->private_);
@@ -2124,7 +2124,7 @@ FLAC_API unsigned FLAC__stream_encoder_get_max_residual_partition_order(const FL
        return encoder->protected_->max_residual_partition_order;
 }
 
-FLAC_API unsigned FLAC__stream_encoder_get_rice_parameter_search_dist(const FLAC__StreamEncoder *encoder)
+FLAC_API uint32_t FLAC__stream_encoder_get_rice_parameter_search_dist(const FLAC__StreamEncoder *encoder)
 {
        FLAC__ASSERT(0 != encoder);
        FLAC__ASSERT(0 != encoder->private_);
@@ -2140,10 +2140,10 @@ FLAC_API FLAC__uint64 FLAC__stream_encoder_get_total_samples_estimate(const FLAC
        return encoder->protected_->total_samples_estimate;
 }
 
-FLAC_API FLAC__bool FLAC__stream_encoder_process(FLAC__StreamEncoder *encoder, const FLAC__int32 * const buffer[], unsigned samples)
+FLAC_API FLAC__bool FLAC__stream_encoder_process(FLAC__StreamEncoder *encoder, const FLAC__int32 * const buffer[], uint32_t samples)
 {
-       unsigned i, j = 0, channel;
-       const unsigned channels = encoder->protected_->channels, blocksize = encoder->protected_->blocksize;
+       uint32_t i, j = 0, channel;
+       const uint32_t channels = encoder->protected_->channels, blocksize = encoder->protected_->blocksize;
 
        FLAC__ASSERT(0 != encoder);
        FLAC__ASSERT(0 != encoder->private_);
@@ -2151,7 +2151,7 @@ FLAC_API FLAC__bool FLAC__stream_encoder_process(FLAC__StreamEncoder *encoder, c
        FLAC__ASSERT(encoder->protected_->state == FLAC__STREAM_ENCODER_OK);
 
        do {
-               const unsigned n = flac_min(blocksize+OVERREAD_-encoder->private_->current_sample_number, samples-j);
+               const uint32_t n = flac_min(blocksize+OVERREAD_-encoder->private_->current_sample_number, samples-j);
 
                if(encoder->protected_->verify)
                        append_to_verify_fifo_(&encoder->private_->verify.input_fifo, buffer, j, channels, n);
@@ -2196,11 +2196,11 @@ FLAC_API FLAC__bool FLAC__stream_encoder_process(FLAC__StreamEncoder *encoder, c
        return true;
 }
 
-FLAC_API FLAC__bool FLAC__stream_encoder_process_interleaved(FLAC__StreamEncoder *encoder, const FLAC__int32 buffer[], unsigned samples)
+FLAC_API FLAC__bool FLAC__stream_encoder_process_interleaved(FLAC__StreamEncoder *encoder, const FLAC__int32 buffer[], uint32_t samples)
 {
-       unsigned i, j, k, channel;
+       uint32_t i, j, k, channel;
        FLAC__int32 x, mid, side;
-       const unsigned channels = encoder->protected_->channels, blocksize = encoder->protected_->blocksize;
+       const uint32_t channels = encoder->protected_->channels, blocksize = encoder->protected_->blocksize;
 
        FLAC__ASSERT(0 != encoder);
        FLAC__ASSERT(0 != encoder->private_);
@@ -2340,7 +2340,7 @@ void set_defaults_(FLAC__StreamEncoder *encoder)
 
 void free_(FLAC__StreamEncoder *encoder)
 {
-       unsigned i, channel;
+       uint32_t i, channel;
 
        FLAC__ASSERT(0 != encoder);
        if(encoder->protected_->metadata) {
@@ -2419,10 +2419,10 @@ void free_(FLAC__StreamEncoder *encoder)
        FLAC__bitwriter_free(encoder->private_->frame);
 }
 
-FLAC__bool resize_buffers_(FLAC__StreamEncoder *encoder, unsigned new_blocksize)
+FLAC__bool resize_buffers_(FLAC__StreamEncoder *encoder, uint32_t new_blocksize)
 {
        FLAC__bool ok;
-       unsigned i, channel;
+       uint32_t i, channel;
 
        FLAC__ASSERT(new_blocksize > 0);
        FLAC__ASSERT(encoder->protected_->state == FLAC__STREAM_ENCODER_OK);
@@ -2559,7 +2559,7 @@ FLAC__bool resize_buffers_(FLAC__StreamEncoder *encoder, unsigned new_blocksize)
        return ok;
 }
 
-FLAC__bool write_bitbuffer_(FLAC__StreamEncoder *encoder, unsigned samples, FLAC__bool is_last_block)
+FLAC__bool write_bitbuffer_(FLAC__StreamEncoder *encoder, uint32_t samples, FLAC__bool is_last_block)
 {
        const FLAC__byte *buffer;
        size_t bytes;
@@ -2606,7 +2606,7 @@ FLAC__bool write_bitbuffer_(FLAC__StreamEncoder *encoder, unsigned samples, FLAC
        return true;
 }
 
-FLAC__StreamEncoderWriteStatus write_frame_(FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], size_t bytes, unsigned samples, FLAC__bool is_last_block)
+FLAC__StreamEncoderWriteStatus write_frame_(FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], size_t bytes, uint32_t samples, FLAC__bool is_last_block)
 {
        FLAC__StreamEncoderWriteStatus status;
        FLAC__uint64 output_position = 0;
@@ -2638,11 +2638,11 @@ FLAC__StreamEncoderWriteStatus write_frame_(FLAC__StreamEncoder *encoder, const
         * frame yet)
         */
        if(0 != encoder->private_->seek_table && encoder->protected_->audio_offset > 0 && encoder->private_->seek_table->num_points > 0) {
-               const unsigned blocksize = FLAC__stream_encoder_get_blocksize(encoder);
+               const uint32_t blocksize = FLAC__stream_encoder_get_blocksize(encoder);
                const FLAC__uint64 frame_first_sample = encoder->private_->samples_written;
                const FLAC__uint64 frame_last_sample = frame_first_sample + (FLAC__uint64)blocksize - 1;
                FLAC__uint64 test_sample;
-               unsigned i;
+               uint32_t i;
                for(i = encoder->private_->first_seekpoint_to_check; i < encoder->private_->seek_table->num_points; i++) {
                        test_sample = encoder->private_->seek_table->points[i].sample_number;
                        if(test_sample > frame_last_sample) {
@@ -2705,9 +2705,9 @@ void update_metadata_(const FLAC__StreamEncoder *encoder)
        FLAC__byte b[flac_max(6u, FLAC__STREAM_METADATA_SEEKPOINT_LENGTH)];
        const FLAC__StreamMetadata *metadata = &encoder->private_->streaminfo;
        const FLAC__uint64 samples = metadata->data.stream_info.total_samples;
-       const unsigned min_framesize = metadata->data.stream_info.min_framesize;
-       const unsigned max_framesize = metadata->data.stream_info.max_framesize;
-       const unsigned bps = metadata->data.stream_info.bits_per_sample;
+       const uint32_t min_framesize = metadata->data.stream_info.min_framesize;
+       const uint32_t max_framesize = metadata->data.stream_info.max_framesize;
+       const uint32_t bps = metadata->data.stream_info.bits_per_sample;
        FLAC__StreamEncoderSeekStatus seek_status;
 
        FLAC__ASSERT(metadata->type == FLAC__METADATA_TYPE_STREAMINFO);
@@ -2721,7 +2721,7 @@ void update_metadata_(const FLAC__StreamEncoder *encoder)
         * Write MD5 signature
         */
        {
-               const unsigned md5_offset =
+               const uint32_t md5_offset =
                        FLAC__STREAM_METADATA_HEADER_LENGTH +
                        (
                                FLAC__STREAM_METADATA_STREAMINFO_MIN_BLOCK_SIZE_LEN +
@@ -2749,7 +2749,7 @@ void update_metadata_(const FLAC__StreamEncoder *encoder)
         * Write total samples
         */
        {
-               const unsigned total_samples_byte_offset =
+               const uint32_t total_samples_byte_offset =
                        FLAC__STREAM_METADATA_HEADER_LENGTH +
                        (
                                FLAC__STREAM_METADATA_STREAMINFO_MIN_BLOCK_SIZE_LEN +
@@ -2782,7 +2782,7 @@ void update_metadata_(const FLAC__StreamEncoder *encoder)
         * Write min/max framesize
         */
        {
-               const unsigned min_framesize_offset =
+               const uint32_t min_framesize_offset =
                        FLAC__STREAM_METADATA_HEADER_LENGTH +
                        (
                                FLAC__STREAM_METADATA_STREAMINFO_MIN_BLOCK_SIZE_LEN +
@@ -2810,7 +2810,7 @@ void update_metadata_(const FLAC__StreamEncoder *encoder)
         * Write seektable
         */
        if(0 != encoder->private_->seek_table && encoder->private_->seek_table->num_points > 0 && encoder->protected_->seektable_offset > 0) {
-               unsigned i;
+               uint32_t i;
 
                FLAC__format_seektable_sort(encoder->private_->seek_table);
 
@@ -2824,7 +2824,7 @@ void update_metadata_(const FLAC__StreamEncoder *encoder)
 
                for(i = 0; i < encoder->private_->seek_table->num_points; i++) {
                        FLAC__uint64 xx;
-                       unsigned x;
+                       uint32_t x;
                        xx = encoder->private_->seek_table->points[i].sample_number;
                        b[7] = (FLAC__byte)xx; xx >>= 8;
                        b[6] = (FLAC__byte)xx; xx >>= 8;
@@ -2859,7 +2859,7 @@ void update_metadata_(const FLAC__StreamEncoder *encoder)
 void update_ogg_metadata_(FLAC__StreamEncoder *encoder)
 {
        /* the # of bytes in the 1st packet that precede the STREAMINFO */
-       static const unsigned FIRST_OGG_PACKET_STREAMINFO_PREFIX_LENGTH =
+       static const uint32_t FIRST_OGG_PACKET_STREAMINFO_PREFIX_LENGTH =
                FLAC__OGG_MAPPING_PACKET_TYPE_LENGTH +
                FLAC__OGG_MAPPING_MAGIC_LENGTH +
                FLAC__OGG_MAPPING_VERSION_MAJOR_LENGTH +
@@ -2870,8 +2870,8 @@ void update_ogg_metadata_(FLAC__StreamEncoder *encoder)
        FLAC__byte b[flac_max(6u, FLAC__STREAM_METADATA_SEEKPOINT_LENGTH)];
        const FLAC__StreamMetadata *metadata = &encoder->private_->streaminfo;
        const FLAC__uint64 samples = metadata->data.stream_info.total_samples;
-       const unsigned min_framesize = metadata->data.stream_info.min_framesize;
-       const unsigned max_framesize = metadata->data.stream_info.max_framesize;
+       const uint32_t min_framesize = metadata->data.stream_info.min_framesize;
+       const uint32_t max_framesize = metadata->data.stream_info.max_framesize;
        ogg_page page;
 
        FLAC__ASSERT(metadata->type == FLAC__METADATA_TYPE_STREAMINFO);
@@ -2901,7 +2901,7 @@ void update_ogg_metadata_(FLAC__StreamEncoder *encoder)
         * Write MD5 signature
         */
        {
-               const unsigned md5_offset =
+               const uint32_t md5_offset =
                        FIRST_OGG_PACKET_STREAMINFO_PREFIX_LENGTH +
                        FLAC__STREAM_METADATA_HEADER_LENGTH +
                        (
@@ -2915,7 +2915,7 @@ void update_ogg_metadata_(FLAC__StreamEncoder *encoder)
                                FLAC__STREAM_METADATA_STREAMINFO_TOTAL_SAMPLES_LEN
                        ) / 8;
 
-               if(md5_offset + 16 > (unsigned)page.body_len) {
+               if(md5_offset + 16 > (uint32_t)page.body_len) {
                        encoder->protected_->state = FLAC__STREAM_ENCODER_OGG_ERROR;
                        simple_ogg_page__clear(&page);
                        return;
@@ -2927,7 +2927,7 @@ void update_ogg_metadata_(FLAC__StreamEncoder *encoder)
         * Write total samples
         */
        {
-               const unsigned total_samples_byte_offset =
+               const uint32_t total_samples_byte_offset =
                        FIRST_OGG_PACKET_STREAMINFO_PREFIX_LENGTH +
                        FLAC__STREAM_METADATA_HEADER_LENGTH +
                        (
@@ -2941,7 +2941,7 @@ void update_ogg_metadata_(FLAC__StreamEncoder *encoder)
                                - 4
                        ) / 8;
 
-               if(total_samples_byte_offset + 5 > (unsigned)page.body_len) {
+               if(total_samples_byte_offset + 5 > (uint32_t)page.body_len) {
                        encoder->protected_->state = FLAC__STREAM_ENCODER_OGG_ERROR;
                        simple_ogg_page__clear(&page);
                        return;
@@ -2959,7 +2959,7 @@ void update_ogg_metadata_(FLAC__StreamEncoder *encoder)
         * Write min/max framesize
         */
        {
-               const unsigned min_framesize_offset =
+               const uint32_t min_framesize_offset =
                        FIRST_OGG_PACKET_STREAMINFO_PREFIX_LENGTH +
                        FLAC__STREAM_METADATA_HEADER_LENGTH +
                        (
@@ -2967,7 +2967,7 @@ void update_ogg_metadata_(FLAC__StreamEncoder *encoder)
                                FLAC__STREAM_METADATA_STREAMINFO_MAX_BLOCK_SIZE_LEN
                        ) / 8;
 
-               if(min_framesize_offset + 6 > (unsigned)page.body_len) {
+               if(min_framesize_offset + 6 > (uint32_t)page.body_len) {
                        encoder->protected_->state = FLAC__STREAM_ENCODER_OGG_ERROR;
                        simple_ogg_page__clear(&page);
                        return;
@@ -2990,7 +2990,7 @@ void update_ogg_metadata_(FLAC__StreamEncoder *encoder)
         * Write seektable
         */
        if(0 != encoder->private_->seek_table && encoder->private_->seek_table->num_points > 0 && encoder->protected_->seektable_offset > 0) {
-               unsigned i;
+               uint32_t i;
                FLAC__byte *p;
 
                FLAC__format_seektable_sort(encoder->private_->seek_table);
@@ -3003,7 +3003,7 @@ void update_ogg_metadata_(FLAC__StreamEncoder *encoder)
                        return; /* state already set */
                }
 
-               if((FLAC__STREAM_METADATA_HEADER_LENGTH + 18*encoder->private_->seek_table->num_points) != (unsigned)page.body_len) {
+               if((FLAC__STREAM_METADATA_HEADER_LENGTH + 18*encoder->private_->seek_table->num_points) != (uint32_t)page.body_len) {
                        encoder->protected_->state = FLAC__STREAM_ENCODER_OGG_ERROR;
                        simple_ogg_page__clear(&page);
                        return;
@@ -3011,7 +3011,7 @@ void update_ogg_metadata_(FLAC__StreamEncoder *encoder)
 
                for(i = 0, p = page.body + FLAC__STREAM_METADATA_HEADER_LENGTH; i < encoder->private_->seek_table->num_points; i++, p += 18) {
                        FLAC__uint64 xx;
-                       unsigned x;
+                       uint32_t x;
                        xx = encoder->private_->seek_table->points[i].sample_number;
                        b[7] = (FLAC__byte)xx; xx >>= 8;
                        b[6] = (FLAC__byte)xx; xx >>= 8;
@@ -3107,7 +3107,7 @@ FLAC__bool process_frame_(FLAC__StreamEncoder *encoder, FLAC__bool is_fractional
 FLAC__bool process_subframes_(FLAC__StreamEncoder *encoder, FLAC__bool is_fractional_block)
 {
        FLAC__FrameHeader frame_header;
-       unsigned channel, min_partition_order = encoder->protected_->min_residual_partition_order, max_partition_order;
+       uint32_t channel, min_partition_order = encoder->protected_->min_residual_partition_order, max_partition_order;
        FLAC__bool do_independent, do_mid_side;
 
        /*
@@ -3164,7 +3164,7 @@ FLAC__bool process_subframes_(FLAC__StreamEncoder *encoder, FLAC__bool is_fracti
         */
        if(do_independent) {
                for(channel = 0; channel < encoder->protected_->channels; channel++) {
-                       unsigned w = get_wasted_bits_(encoder->private_->integer_signal[channel], encoder->protected_->blocksize);
+                       uint32_t w = get_wasted_bits_(encoder->private_->integer_signal[channel], encoder->protected_->blocksize);
                        if (w > encoder->protected_->bits_per_sample) {
                                w = encoder->protected_->bits_per_sample;
                        }
@@ -3175,7 +3175,7 @@ FLAC__bool process_subframes_(FLAC__StreamEncoder *encoder, FLAC__bool is_fracti
        if(do_mid_side) {
                FLAC__ASSERT(encoder->protected_->channels == 2);
                for(channel = 0; channel < 2; channel++) {
-                       unsigned w = get_wasted_bits_(encoder->private_->integer_signal_mid_side[channel], encoder->protected_->blocksize);
+                       uint32_t w = get_wasted_bits_(encoder->private_->integer_signal_mid_side[channel], encoder->protected_->blocksize);
                        if (w > encoder->protected_->bits_per_sample) {
                                w = encoder->protected_->bits_per_sample;
                        }
@@ -3238,7 +3238,7 @@ FLAC__bool process_subframes_(FLAC__StreamEncoder *encoder, FLAC__bool is_fracti
         * Compose the frame bitbuffer
         */
        if(do_mid_side) {
-               unsigned left_bps = 0, right_bps = 0; /* initialized only to prevent superfluous compiler warning */
+               uint32_t left_bps = 0, right_bps = 0; /* initialized only to prevent superfluous compiler warning */
                FLAC__Subframe *left_subframe = 0, *right_subframe = 0; /* initialized only to prevent superfluous compiler warning */
                FLAC__ChannelAssignment channel_assignment;
 
@@ -3248,8 +3248,8 @@ FLAC__bool process_subframes_(FLAC__StreamEncoder *encoder, FLAC__bool is_fracti
                        channel_assignment = (encoder->private_->last_channel_assignment == FLAC__CHANNEL_ASSIGNMENT_INDEPENDENT? FLAC__CHANNEL_ASSIGNMENT_INDEPENDENT : FLAC__CHANNEL_ASSIGNMENT_MID_SIDE);
                }
                else {
-                       unsigned bits[4]; /* WATCHOUT - indexed by FLAC__ChannelAssignment */
-                       unsigned min_bits;
+                       uint32_t bits[4]; /* WATCHOUT - indexed by FLAC__ChannelAssignment */
+                       uint32_t min_bits;
                        int ca;
 
                        FLAC__ASSERT(FLAC__CHANNEL_ASSIGNMENT_INDEPENDENT == 0);
@@ -3356,16 +3356,16 @@ FLAC__bool process_subframes_(FLAC__StreamEncoder *encoder, FLAC__bool is_fracti
 
 FLAC__bool process_subframe_(
        FLAC__StreamEncoder *encoder,
-       unsigned min_partition_order,
-       unsigned max_partition_order,
+       uint32_t min_partition_order,
+       uint32_t max_partition_order,
        const FLAC__FrameHeader *frame_header,
-       unsigned subframe_bps,
+       uint32_t subframe_bps,
        const FLAC__int32 integer_signal[],
        FLAC__Subframe *subframe[2],
        FLAC__EntropyCodingMethod_PartitionedRiceContents *partitioned_rice_contents[2],
        FLAC__int32 *residual[2],
-       unsigned *best_subframe,
-       unsigned *best_bits
+       uint32_t *best_subframe,
+       uint32_t *best_bits
 )
 {
 #ifndef FLAC__INTEGER_ONLY_LIBRARY
@@ -3377,15 +3377,15 @@ FLAC__bool process_subframe_(
        double lpc_residual_bits_per_sample;
        FLAC__real autoc[FLAC__MAX_LPC_ORDER+1]; /* WATCHOUT: the size is important even though encoder->protected_->max_lpc_order might be less; some asm and x86 intrinsic routines need all the space */
        double lpc_error[FLAC__MAX_LPC_ORDER];
-       unsigned min_lpc_order, max_lpc_order, lpc_order;
-       unsigned min_qlp_coeff_precision, max_qlp_coeff_precision, qlp_coeff_precision;
+       uint32_t min_lpc_order, max_lpc_order, lpc_order;
+       uint32_t min_qlp_coeff_precision, max_qlp_coeff_precision, qlp_coeff_precision;
 #endif
-       unsigned min_fixed_order, max_fixed_order, guess_fixed_order, fixed_order;
-       unsigned rice_parameter;
-       unsigned _candidate_bits, _best_bits;
-       unsigned _best_subframe;
+       uint32_t min_fixed_order, max_fixed_order, guess_fixed_order, fixed_order;
+       uint32_t rice_parameter;
+       uint32_t _candidate_bits, _best_bits;
+       uint32_t _best_subframe;
        /* only use RICE2 partitions if stream bps > 16 */
-       const unsigned rice_parameter_limit = FLAC__stream_encoder_get_bits_per_sample(encoder) > 16? FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_ESCAPE_PARAMETER : FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER;
+       const uint32_t rice_parameter_limit = FLAC__stream_encoder_get_bits_per_sample(encoder) > 16? FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_ESCAPE_PARAMETER : FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER;
 
        FLAC__ASSERT(frame_header->blocksize > 0);
 
@@ -3397,7 +3397,7 @@ FLAC__bool process_subframe_(
                _best_bits = evaluate_verbatim_subframe_(encoder, integer_signal, frame_header->blocksize, subframe_bps, subframe[_best_subframe]);
 
        if(frame_header->blocksize >= FLAC__MAX_FIXED_ORDER) {
-               unsigned signal_is_constant = false;
+               uint32_t signal_is_constant = false;
                if(subframe_bps + 4 + FLAC__bitmath_ilog2((frame_header->blocksize-FLAC__MAX_FIXED_ORDER)|1) <= 32)
                        guess_fixed_order = encoder->private_->local_fixed_compute_best_predictor(integer_signal+FLAC__MAX_FIXED_ORDER, frame_header->blocksize-FLAC__MAX_FIXED_ORDER, fixed_residual_bits_per_sample);
                else
@@ -3412,7 +3412,7 @@ FLAC__bool process_subframe_(
 #endif
                ) {
                        /* the above means it's possible all samples are the same value; now double-check it: */
-                       unsigned i;
+                       uint32_t i;
                        signal_is_constant = true;
                        for(i = 1; i < frame_header->blocksize; i++) {
                                if(integer_signal[0] != integer_signal[i]) {
@@ -3444,13 +3444,13 @@ FLAC__bool process_subframe_(
 #ifndef FLAC__INTEGER_ONLY_LIBRARY
                                        if(fixed_residual_bits_per_sample[fixed_order] >= (float)subframe_bps)
                                                continue; /* don't even try */
-                                       rice_parameter = (fixed_residual_bits_per_sample[fixed_order] > 0.0)? (unsigned)(fixed_residual_bits_per_sample[fixed_order]+0.5) : 0; /* 0.5 is for rounding */
+                                       rice_parameter = (fixed_residual_bits_per_sample[fixed_order] > 0.0)? (uint32_t)(fixed_residual_bits_per_sample[fixed_order]+0.5) : 0; /* 0.5 is for rounding */
 #else
                                        if(FLAC__fixedpoint_trunc(fixed_residual_bits_per_sample[fixed_order]) >= (int)subframe_bps)
                                                continue; /* don't even try */
-                                       rice_parameter = (fixed_residual_bits_per_sample[fixed_order] > FLAC__FP_ZERO)? (unsigned)FLAC__fixedpoint_trunc(fixed_residual_bits_per_sample[fixed_order]+FLAC__FP_ONE_HALF) : 0; /* 0.5 is for rounding */
+                                       rice_parameter = (fixed_residual_bits_per_sample[fixed_order] > FLAC__FP_ZERO)? (uint32_t)FLAC__fixedpoint_trunc(fixed_residual_bits_per_sample[fixed_order]+FLAC__FP_ONE_HALF) : 0; /* 0.5 is for rounding */
 #endif
-                                       rice_parameter++; /* to account for the signed->unsigned conversion during rice coding */
+                                       rice_parameter++; /* to account for the signed->uint32_t conversion during rice coding */
                                        if(rice_parameter >= rice_parameter_limit) {
 #ifdef DEBUG_VERBOSE
                                                fprintf(stderr, "clipping rice_parameter (%u -> %u) @0\n", rice_parameter, rice_parameter_limit - 1);
@@ -3491,7 +3491,7 @@ FLAC__bool process_subframe_(
                                else
                                        max_lpc_order = encoder->protected_->max_lpc_order;
                                if(max_lpc_order > 0) {
-                                       unsigned a;
+                                       uint32_t a;
                                        for (a = 0; a < encoder->protected_->num_apodizations; a++) {
                                                FLAC__lpc_window_data(integer_signal, encoder->private_->window[a], encoder->private_->windowed_signal, frame_header->blocksize);
                                                encoder->private_->local_lpc_compute_autocorrelation(encoder->private_->windowed_signal, frame_header->blocksize, max_lpc_order+1, autoc);
@@ -3502,7 +3502,7 @@ FLAC__bool process_subframe_(
                                                                min_lpc_order = 1;
                                                        }
                                                        else {
-                                                               const unsigned guess_lpc_order =
+                                                               const uint32_t guess_lpc_order =
                                                                        FLAC__lpc_compute_best_order(
                                                                                lpc_error,
                                                                                max_lpc_order,
@@ -3521,8 +3521,8 @@ FLAC__bool process_subframe_(
                                                                lpc_residual_bits_per_sample = FLAC__lpc_compute_expected_bits_per_residual_sample(lpc_error[lpc_order-1], frame_header->blocksize-lpc_order);
                                                                if(lpc_residual_bits_per_sample >= (double)subframe_bps)
                                                                        continue; /* don't even try */
-                                                               rice_parameter = (lpc_residual_bits_per_sample > 0.0)? (unsigned)(lpc_residual_bits_per_sample+0.5) : 0; /* 0.5 is for rounding */
-                                                               rice_parameter++; /* to account for the signed->unsigned conversion during rice coding */
+                                                               rice_parameter = (lpc_residual_bits_per_sample > 0.0)? (uint32_t)(lpc_residual_bits_per_sample+0.5) : 0; /* 0.5 is for rounding */
+                                                               rice_parameter++; /* to account for the signed->uint32_t conversion during rice coding */
                                                                if(rice_parameter >= rice_parameter_limit) {
 #ifdef DEBUG_VERBOSE
                                                                        fprintf(stderr, "clipping rice_parameter (%u -> %u) @1\n", rice_parameter, rice_parameter_limit - 1);
@@ -3594,8 +3594,8 @@ FLAC__bool process_subframe_(
 
 FLAC__bool add_subframe_(
        FLAC__StreamEncoder *encoder,
-       unsigned blocksize,
-       unsigned subframe_bps,
+       uint32_t blocksize,
+       uint32_t subframe_bps,
        const FLAC__Subframe *subframe,
        FLAC__BitWriter *frame
 )
@@ -3636,10 +3636,10 @@ FLAC__bool add_subframe_(
 #if SPOTCHECK_ESTIMATE
 static void spotcheck_subframe_estimate_(
        FLAC__StreamEncoder *encoder,
-       unsigned blocksize,
-       unsigned subframe_bps,
+       uint32_t blocksize,
+       uint32_t subframe_bps,
        const FLAC__Subframe *subframe,
-       unsigned estimate
+       uint32_t estimate
 )
 {
        FLAC__bool ret;
@@ -3655,7 +3655,7 @@ static void spotcheck_subframe_estimate_(
        ret = add_subframe_(encoder, blocksize, subframe_bps, subframe, frame);
        FLAC__ASSERT(ret);
        {
-               const unsigned actual = FLAC__bitwriter_get_input_bits_unconsumed(frame);
+               const uint32_t actual = FLAC__bitwriter_get_input_bits_unconsumed(frame);
                if(estimate != actual)
                        fprintf(stderr, "EST: bad, frame#%u sub#%%d type=%8s est=%u, actual=%u, delta=%d\n", encoder->private_->current_frame_number, FLAC__SubframeTypeString[subframe->type], estimate, actual, (int)actual-(int)estimate);
        }
@@ -3663,15 +3663,15 @@ static void spotcheck_subframe_estimate_(
 }
 #endif
 
-unsigned evaluate_constant_subframe_(
+uint32_t evaluate_constant_subframe_(
        FLAC__StreamEncoder *encoder,
        const FLAC__int32 signal,
-       unsigned blocksize,
-       unsigned subframe_bps,
+       uint32_t blocksize,
+       uint32_t subframe_bps,
        FLAC__Subframe *subframe
 )
 {
-       unsigned estimate;
+       uint32_t estimate;
        subframe->type = FLAC__SUBFRAME_TYPE_CONSTANT;
        subframe->data.constant.value = signal;
 
@@ -3686,27 +3686,27 @@ unsigned evaluate_constant_subframe_(
        return estimate;
 }
 
-unsigned evaluate_fixed_subframe_(
+uint32_t evaluate_fixed_subframe_(
        FLAC__StreamEncoder *encoder,
        const FLAC__int32 signal[],
        FLAC__int32 residual[],
        FLAC__uint64 abs_residual_partition_sums[],
-       unsigned raw_bits_per_partition[],
-       unsigned blocksize,
-       unsigned subframe_bps,
-       unsigned order,
-       unsigned rice_parameter,
-       unsigned rice_parameter_limit,
-       unsigned min_partition_order,
-       unsigned max_partition_order,
+       uint32_t raw_bits_per_partition[],
+       uint32_t blocksize,
+       uint32_t subframe_bps,
+       uint32_t order,
+       uint32_t rice_parameter,
+       uint32_t rice_parameter_limit,
+       uint32_t min_partition_order,
+       uint32_t max_partition_order,
        FLAC__bool do_escape_coding,
-       unsigned rice_parameter_search_dist,
+       uint32_t rice_parameter_search_dist,
        FLAC__Subframe *subframe,
        FLAC__EntropyCodingMethod_PartitionedRiceContents *partitioned_rice_contents
 )
 {
-       unsigned i, residual_bits, estimate;
-       const unsigned residual_samples = blocksize - order;
+       uint32_t i, residual_bits, estimate;
+       const uint32_t residual_samples = blocksize - order;
 
        FLAC__fixed_compute_residual(signal+order, residual_samples, order, residual);
 
@@ -3748,31 +3748,31 @@ unsigned evaluate_fixed_subframe_(
 }
 
 #ifndef FLAC__INTEGER_ONLY_LIBRARY
-unsigned evaluate_lpc_subframe_(
+uint32_t evaluate_lpc_subframe_(
        FLAC__StreamEncoder *encoder,
        const FLAC__int32 signal[],
        FLAC__int32 residual[],
        FLAC__uint64 abs_residual_partition_sums[],
-       unsigned raw_bits_per_partition[],
+       uint32_t raw_bits_per_partition[],
        const FLAC__real lp_coeff[],
-       unsigned blocksize,
-       unsigned subframe_bps,
-       unsigned order,
-       unsigned qlp_coeff_precision,
-       unsigned rice_parameter,
-       unsigned rice_parameter_limit,
-       unsigned min_partition_order,
-       unsigned max_partition_order,
+       uint32_t blocksize,
+       uint32_t subframe_bps,
+       uint32_t order,
+       uint32_t qlp_coeff_precision,
+       uint32_t rice_parameter,
+       uint32_t rice_parameter_limit,
+       uint32_t min_partition_order,
+       uint32_t max_partition_order,
        FLAC__bool do_escape_coding,
-       unsigned rice_parameter_search_dist,
+       uint32_t rice_parameter_search_dist,
        FLAC__Subframe *subframe,
        FLAC__EntropyCodingMethod_PartitionedRiceContents *partitioned_rice_contents
 )
 {
        FLAC__int32 qlp_coeff[FLAC__MAX_LPC_ORDER]; /* WATCHOUT: the size is important; some x86 intrinsic routines need more than lpc order elements */
-       unsigned i, residual_bits, estimate;
+       uint32_t i, residual_bits, estimate;
        int quantization, ret;
-       const unsigned residual_samples = blocksize - order;
+       const uint32_t residual_samples = blocksize - order;
 
        /* try to keep qlp coeff precision such that only 32-bit math is required for decode of <=16bps(+1bps for side channel) streams */
        if(subframe_bps <= 17) {
@@ -3834,15 +3834,15 @@ unsigned evaluate_lpc_subframe_(
 }
 #endif
 
-unsigned evaluate_verbatim_subframe_(
+uint32_t evaluate_verbatim_subframe_(
        FLAC__StreamEncoder *encoder,
        const FLAC__int32 signal[],
-       unsigned blocksize,
-       unsigned subframe_bps,
+       uint32_t blocksize,
+       uint32_t subframe_bps,
        FLAC__Subframe *subframe
 )
 {
-       unsigned estimate;
+       uint32_t estimate;
 
        subframe->type = FLAC__SUBFRAME_TYPE_VERBATIM;
 
@@ -3859,27 +3859,27 @@ unsigned evaluate_verbatim_subframe_(
        return estimate;
 }
 
-unsigned find_best_partition_order_(
+uint32_t find_best_partition_order_(
        FLAC__StreamEncoderPrivate *private_,
        const FLAC__int32 residual[],
        FLAC__uint64 abs_residual_partition_sums[],
-       unsigned raw_bits_per_partition[],
-       unsigned residual_samples,
-       unsigned predictor_order,
-       unsigned rice_parameter,
-       unsigned rice_parameter_limit,
-       unsigned min_partition_order,
-       unsigned max_partition_order,
-       unsigned bps,
+       uint32_t raw_bits_per_partition[],
+       uint32_t residual_samples,
+       uint32_t predictor_order,
+       uint32_t rice_parameter,
+       uint32_t rice_parameter_limit,
+       uint32_t min_partition_order,
+       uint32_t max_partition_order,
+       uint32_t bps,
        FLAC__bool do_escape_coding,
-       unsigned rice_parameter_search_dist,
+       uint32_t rice_parameter_search_dist,
        FLAC__EntropyCodingMethod *best_ecm
 )
 {
-       unsigned residual_bits, best_residual_bits = 0;
-       unsigned best_parameters_index = 0;
-       unsigned best_partition_order = 0;
-       const unsigned blocksize = residual_samples + predictor_order;
+       uint32_t residual_bits, best_residual_bits = 0;
+       uint32_t best_parameters_index = 0;
+       uint32_t best_partition_order = 0;
+       const uint32_t blocksize = residual_samples + predictor_order;
 
        max_partition_order = FLAC__format_get_max_rice_partition_order_from_blocksize_limited_max_and_predictor_order(max_partition_order, blocksize, predictor_order);
        min_partition_order = flac_min(min_partition_order, max_partition_order);
@@ -3891,7 +3891,7 @@ unsigned find_best_partition_order_(
 
        {
                int partition_order;
-               unsigned sum;
+               uint32_t sum;
 
                for(partition_order = (int)max_partition_order, sum = 0; partition_order >= (int)min_partition_order; partition_order--) {
                        if(!
@@ -3906,7 +3906,7 @@ unsigned find_best_partition_order_(
                                        rice_parameter,
                                        rice_parameter_limit,
                                        rice_parameter_search_dist,
-                                       (unsigned)partition_order,
+                                       (uint32_t)partition_order,
                                        do_escape_coding,
                                        &private_->partitioned_rice_contents_extra[!best_parameters_index],
                                        &residual_bits
@@ -3933,13 +3933,13 @@ unsigned find_best_partition_order_(
                 * knowledge; it is const to the outside world.
                 */
                FLAC__EntropyCodingMethod_PartitionedRiceContents* prc = (FLAC__EntropyCodingMethod_PartitionedRiceContents*)best_ecm->data.partitioned_rice.contents;
-               unsigned partition;
+               uint32_t partition;
 
                /* save best parameters and raw_bits */
                FLAC__format_entropy_coding_method_partitioned_rice_contents_ensure_size(prc, flac_max(6u, 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(uint32_t)*(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(uint32_t)*(1<<(best_partition_order)));
                /*
                 * Now need to check if the type should be changed to
                 * FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2 based on the
@@ -3959,22 +3959,22 @@ unsigned find_best_partition_order_(
 void precompute_partition_info_sums_(
        const FLAC__int32 residual[],
        FLAC__uint64 abs_residual_partition_sums[],
-       unsigned residual_samples,
-       unsigned predictor_order,
-       unsigned min_partition_order,
-       unsigned max_partition_order,
-       unsigned bps
+       uint32_t residual_samples,
+       uint32_t predictor_order,
+       uint32_t min_partition_order,
+       uint32_t max_partition_order,
+       uint32_t bps
 )
 {
-       const unsigned default_partition_samples = (residual_samples + predictor_order) >> max_partition_order;
-       unsigned partitions = 1u << max_partition_order;
+       const uint32_t default_partition_samples = (residual_samples + predictor_order) >> max_partition_order;
+       uint32_t partitions = 1u << max_partition_order;
 
        FLAC__ASSERT(default_partition_samples > predictor_order);
 
        /* first do max_partition_order */
        {
-               const unsigned threshold = 32 - FLAC__bitmath_ilog2(default_partition_samples);
-               unsigned partition, residual_sample, end = (unsigned)(-(int)predictor_order);
+               const uint32_t threshold = 32 - FLAC__bitmath_ilog2(default_partition_samples);
+               uint32_t partition, residual_sample, end = (uint32_t)(-(int)predictor_order);
                /* WATCHOUT: "bps + FLAC__MAX_EXTRA_RESIDUAL_BPS" is the maximum assumed size of the average residual magnitude */
                if(bps + FLAC__MAX_EXTRA_RESIDUAL_BPS < threshold) {
                        for(partition = residual_sample = 0; partition < partitions; partition++) {
@@ -3998,10 +3998,10 @@ void precompute_partition_info_sums_(
 
        /* now merge partitions for lower orders */
        {
-               unsigned from_partition = 0, to_partition = partitions;
+               uint32_t from_partition = 0, to_partition = partitions;
                int partition_order;
                for(partition_order = (int)max_partition_order - 1; partition_order >= (int)min_partition_order; partition_order--) {
-                       unsigned i;
+                       uint32_t i;
                        partitions >>= 1;
                        for(i = 0; i < partitions; i++) {
                                abs_residual_partition_sums[to_partition++] =
@@ -4015,24 +4015,24 @@ void precompute_partition_info_sums_(
 
 void precompute_partition_info_escapes_(
        const FLAC__int32 residual[],
-       unsigned raw_bits_per_partition[],
-       unsigned residual_samples,
-       unsigned predictor_order,
-       unsigned min_partition_order,
-       unsigned max_partition_order
+       uint32_t raw_bits_per_partition[],
+       uint32_t residual_samples,
+       uint32_t predictor_order,
+       uint32_t min_partition_order,
+       uint32_t max_partition_order
 )
 {
        int partition_order;
-       unsigned from_partition, to_partition = 0;
-       const unsigned blocksize = residual_samples + predictor_order;
+       uint32_t from_partition, to_partition = 0;
+       const uint32_t blocksize = residual_samples + predictor_order;
 
        /* first do max_partition_order */
        for(partition_order = (int)max_partition_order; partition_order >= 0; partition_order--) {
                FLAC__int32 r;
                FLAC__uint32 rmax;
-               unsigned partition, partition_sample, partition_samples, residual_sample;
-               const unsigned partitions = 1u << partition_order;
-               const unsigned default_partition_samples = blocksize >> partition_order;
+               uint32_t partition, partition_sample, partition_samples, residual_sample;
+               const uint32_t partitions = 1u << partition_order;
+               const uint32_t default_partition_samples = blocksize >> partition_order;
 
                FLAC__ASSERT(default_partition_samples > predictor_order);
 
@@ -4058,9 +4058,9 @@ void precompute_partition_info_escapes_(
 
        /* now merge partitions for lower orders */
        for(from_partition = 0, --partition_order; partition_order >= (int)min_partition_order; partition_order--) {
-               unsigned m;
-               unsigned i;
-               const unsigned partitions = 1u << partition_order;
+               uint32_t m;
+               uint32_t i;
+               const uint32_t partitions = 1u << partition_order;
                for(i = 0; i < partitions; i++) {
                        m = raw_bits_per_partition[from_partition];
                        from_partition++;
@@ -4072,13 +4072,13 @@ void precompute_partition_info_escapes_(
 }
 
 #ifdef EXACT_RICE_BITS_CALCULATION
-static inline unsigned count_rice_bits_in_partition_(
-       const unsigned rice_parameter,
-       const unsigned partition_samples,
+static inline uint32_t count_rice_bits_in_partition_(
+       const uint32_t rice_parameter,
+       const uint32_t partition_samples,
        const FLAC__int32 *residual
 )
 {
-       unsigned i, partition_bits =
+       uint32_t i, partition_bits =
                FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_PARAMETER_LEN + /* actually could end up being FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_PARAMETER_LEN but err on side of 16bps */
                (1+rice_parameter) * partition_samples /* 1 for unary stop bit + rice_parameter for the binary portion */
        ;
@@ -4087,9 +4087,9 @@ static inline unsigned count_rice_bits_in_partition_(
        return partition_bits;
 }
 #else
-static inline unsigned count_rice_bits_in_partition_(
-       const unsigned rice_parameter,
-       const unsigned partition_samples,
+static inline uint32_t count_rice_bits_in_partition_(
+       const uint32_t rice_parameter,
+       const uint32_t partition_samples,
        const FLAC__uint64 abs_residual_partition_sum
 )
 {
@@ -4098,8 +4098,8 @@ static inline unsigned count_rice_bits_in_partition_(
                (1+rice_parameter) * partition_samples + /* 1 for unary stop bit + rice_parameter for the binary portion */
                (
                        rice_parameter?
-                               (unsigned)(abs_residual_partition_sum >> (rice_parameter-1)) /* rice_parameter-1 because the real coder sign-folds instead of using a sign bit */
-                               : (unsigned)(abs_residual_partition_sum << 1) /* can't shift by negative number, so reverse */
+                               (uint32_t)(abs_residual_partition_sum >> (rice_parameter-1)) /* rice_parameter-1 because the real coder sign-folds instead of using a sign bit */
+                               : (uint32_t)(abs_residual_partition_sum << 1) /* can't shift by negative number, so reverse */
                )
                - (partition_samples >> 1)
                /* -(partition_samples>>1) to subtract out extra contributions to the abs_residual_partition_sum.
@@ -4117,24 +4117,24 @@ FLAC__bool set_partitioned_rice_(
        const FLAC__int32 residual[],
 #endif
        const FLAC__uint64 abs_residual_partition_sums[],
-       const unsigned raw_bits_per_partition[],
-       const unsigned residual_samples,
-       const unsigned predictor_order,
-       const unsigned suggested_rice_parameter,
-       const unsigned rice_parameter_limit,
-       const unsigned rice_parameter_search_dist,
-       const unsigned partition_order,
+       const uint32_t raw_bits_per_partition[],
+       const uint32_t residual_samples,
+       const uint32_t predictor_order,
+       const uint32_t suggested_rice_parameter,
+       const uint32_t rice_parameter_limit,
+       const uint32_t rice_parameter_search_dist,
+       const uint32_t partition_order,
        const FLAC__bool search_for_escapes,
        FLAC__EntropyCodingMethod_PartitionedRiceContents *partitioned_rice_contents,
-       unsigned *bits
+       uint32_t *bits
 )
 {
-       unsigned rice_parameter, partition_bits;
-       unsigned best_partition_bits, best_rice_parameter = 0;
-       unsigned bits_ = FLAC__ENTROPY_CODING_METHOD_TYPE_LEN + FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ORDER_LEN;
-       unsigned *parameters, *raw_bits;
+       uint32_t rice_parameter, partition_bits;
+       uint32_t best_partition_bits, best_rice_parameter = 0;
+       uint32_t bits_ = FLAC__ENTROPY_CODING_METHOD_TYPE_LEN + FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ORDER_LEN;
+       uint32_t *parameters, *raw_bits;
 #ifdef ENABLE_RICE_PARAMETER_SEARCH
-       unsigned min_rice_parameter, max_rice_parameter;
+       uint32_t min_rice_parameter, max_rice_parameter;
 #else
        (void)rice_parameter_search_dist;
 #endif
@@ -4147,7 +4147,7 @@ FLAC__bool set_partitioned_rice_(
        raw_bits = partitioned_rice_contents->raw_bits;
 
        if(partition_order == 0) {
-               best_partition_bits = (unsigned)(-1);
+               best_partition_bits = (uint32_t)(-1);
 #ifdef ENABLE_RICE_PARAMETER_SEARCH
                if(rice_parameter_search_dist) {
                        if(suggested_rice_parameter < rice_parameter_search_dist)
@@ -4195,10 +4195,10 @@ FLAC__bool set_partitioned_rice_(
                bits_ += best_partition_bits;
        }
        else {
-               unsigned partition, residual_sample;
-               unsigned partition_samples;
+               uint32_t partition, residual_sample;
+               uint32_t partition_samples;
                FLAC__uint64 mean, k;
-               const unsigned partitions = 1u << partition_order;
+               const uint32_t partitions = 1u << partition_order;
                for(partition = residual_sample = 0; partition < partitions; partition++) {
                        partition_samples = (residual_samples+predictor_order) >> partition_order;
                        if(partition == 0) {
@@ -4252,7 +4252,7 @@ FLAC__bool set_partitioned_rice_(
                                rice_parameter = rice_parameter_limit - 1;
                        }
 
-                       best_partition_bits = (unsigned)(-1);
+                       best_partition_bits = (uint32_t)(-1);
 #ifdef ENABLE_RICE_PARAMETER_SEARCH
                        if(rice_parameter_search_dist) {
                                if(rice_parameter < rice_parameter_search_dist)
@@ -4304,9 +4304,9 @@ FLAC__bool set_partitioned_rice_(
        return true;
 }
 
-unsigned get_wasted_bits_(FLAC__int32 signal[], unsigned samples)
+uint32_t get_wasted_bits_(FLAC__int32 signal[], uint32_t samples)
 {
-       unsigned i, shift;
+       uint32_t i, shift;
        FLAC__int32 x = 0;
 
        for(i = 0; i < samples && !(x&1); i++)
@@ -4328,9 +4328,9 @@ unsigned get_wasted_bits_(FLAC__int32 signal[], unsigned samples)
        return shift;
 }
 
-void append_to_verify_fifo_(verify_input_fifo *fifo, const FLAC__int32 * const input[], unsigned input_offset, unsigned channels, unsigned wide_samples)
+void append_to_verify_fifo_(verify_input_fifo *fifo, const FLAC__int32 * const input[], uint32_t input_offset, uint32_t channels, uint32_t wide_samples)
 {
-       unsigned channel;
+       uint32_t channel;
 
        for(channel = 0; channel < channels; channel++)
                memcpy(&fifo->data[channel][fifo->tail], &input[channel][input_offset], sizeof(FLAC__int32) * wide_samples);
@@ -4340,11 +4340,11 @@ void append_to_verify_fifo_(verify_input_fifo *fifo, const FLAC__int32 * const i
        FLAC__ASSERT(fifo->tail <= fifo->size);
 }
 
-void append_to_verify_fifo_interleaved_(verify_input_fifo *fifo, const FLAC__int32 input[], unsigned input_offset, unsigned channels, unsigned wide_samples)
+void append_to_verify_fifo_interleaved_(verify_input_fifo *fifo, const FLAC__int32 input[], uint32_t input_offset, uint32_t channels, uint32_t wide_samples)
 {
-       unsigned channel;
-       unsigned sample, wide_sample;
-       unsigned tail = fifo->tail;
+       uint32_t channel;
+       uint32_t sample, wide_sample;
+       uint32_t tail = fifo->tail;
 
        sample = input_offset * channels;
        for(wide_sample = 0; wide_sample < wide_samples; wide_sample++) {